Add no_default_libraries target linker option#28578
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 22, 2015
Merged
Conversation
If set to false, `-nodefaultlibs` is not passed to the linker. This was the default behavior on Windows, but it should be configurable per target. This is a [breaking-change] for target specifications that have the `is_like_windows` option set to true. Such targets need to set `no_default_libraries` to false in order to restore the old behavior.
Contributor
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Member
Member
Collaborator
bors
added a commit
that referenced
this pull request
Sep 22, 2015
This patch basically adds a target option for omitting the `-nodefaultlibs` flag when invoking the linker. I am not sure if this is the correct or only way to approach this problem, so any feedback is welcome. Motivation: I'm currently working on a Rust target specification for the [rumprun](/rumpkernel/rumprun) unikernel. rumprun is based on rump kernels and uses NetBSDs libc and drivers to provide a POSIXy environment. It provides its own linker wrapper that generates binaries which can be "baked" into a unikernel after configuration. Using `-nodefaultlibs` on the rumprun linker will prevent it from selecting the search paths for the rumprun libraries. My current target implementation for rumprun is here: gandro/rust@295744b Currently, only a target that `is_like_windows` will omit the `-nodefaultlibs` flag, but since rumprun is not like Windows otherwise, I think a separate flag makes more sense. This might be a breaking change for target specifications that have the `is_like_windows` option set to true. Such targets need to set `no_default_libraries` to false in order to restore the old behavior.
Collaborator
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Sep 21, 2018
Use no_default_libraries for all NetBSD flavors The no_default_libraries was introduced in rust-lang#28578 because the NetBSD-based rumprun needed to disable the link flag. This moves the definition to be used by all NetBSD linker flavors to close rust-lang#49627. A different solution would be adding -lc but as there is no platform with explicit -lc, this approach is used.
emilyalbini
added a commit
to emilyalbini/rust
that referenced
this pull request
Sep 22, 2018
Use no_default_libraries for all NetBSD flavors The no_default_libraries was introduced in rust-lang#28578 because the NetBSD-based rumprun needed to disable the link flag. This moves the definition to be used by all NetBSD linker flavors to close rust-lang#49627. A different solution would be adding -lc but as there is no platform with explicit -lc, this approach is used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This patch basically adds a target option for omitting the
-nodefaultlibsflag when invoking the linker. I am not sure if this is the correct or only way to approach this problem, so any feedback is welcome.Motivation: I'm currently working on a Rust target specification for the rumprun unikernel. rumprun is based on rump kernels and uses NetBSDs libc and drivers to provide a POSIXy environment. It provides its own linker wrapper that generates binaries which can be "baked" into a unikernel after configuration. Using
-nodefaultlibson the rumprun linker will prevent it from selecting the search paths for the rumprun libraries. My current target implementation for rumprun is here: gandro/rust@295744bCurrently, only a target that
is_like_windowswill omit the-nodefaultlibsflag, but since rumprun is not like Windows otherwise, I think a separate flag makes more sense. This might be a breaking change for target specifications that have theis_like_windowsoption set to true. Such targets need to setno_default_librariesto false in order to restore the old behavior.