Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Redesign how mustang ensures its libraries are linked in, to be somewhat
more robust in the face of various kinds of optimizations. Use explicit symbols
to pull in individual modules. This also makes it easier to split more c-scape
functionality into separate modules.
Instead of having users declare
extern crate mustang
, have them invokea macro,
mustang::can_compile_this!();
.Don't declare c-scape functions as
pub
. Most code should use thelibc
crate declarations;c-scape
usesextern "C"
to interceptthose at link time.
Put
extern "C"
functions in a named section; this overrides-ffunction-sections and puts all the functions in the same section,
so that the linker doesn't DCE individual functions before they have a
chance to intercept libc calls.
Similarly, add
#[inline(never)]
so that these functions aren't inlined,which can result in symbols being removed if an optimizer believes it
has seen all of their uses.
This helps with #7, though is not the only thing needed.