Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Forbidden casts and LTO compatability improvements #1523

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dragonmux
Copy link
Contributor

This PR aims to improve standards conformance and LTO compatibility.

ISO C forbids casting function pointers to or from void * as the size of a function pointer is allowed to be different from the size of a data pointer, the library should never have been doing this and especially as the casts aren't even required, so we eliminate them for all devices BMD compiles for.

It is an error to do pointer arithmetic on a void pointer - sizeof(void) has no standards-set size, and the operation is meaningless. Luckily all instances of this are trivially convertible to using properly typed pointers.

LTO requires we mark the vector table, reset vector and vector table's section all used/keep so it doesn't eliminate them due to nothing it can see calling into them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant