-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: correctly handle alwayslink staticlibs (#606)
* test: add test that demonstrates missing alwayslink libraries * refactor: inline get_libs_for_static_executable into rustc logic We then move the function to its only remaining caller in bindgen. I didn't inline it there because it's used in a few different ways and cleaning it up felt like more work than it was immediately worth. * refactor: make DepInfo carry around LibraryToLink and not File data We need this information to implement support for alwayslink, and it cascaded around the codebase more than a little. The next change will implement always link, which is currently left as a stub so that this change has no functional changes. * rustc: remove awkward file-ending check for _is_dylib Instead we just verify we're not going to link anything static. This removes the need for a toolchain in _is_dylib, which will allow further cleanups in a moment. * rustc: remove unused toolchain= argument to _make_link_flags This allows us to use a more efficient construction to add linker arguments to the command line. * rustc: add support for alwayslink library dependencies This follows up on the previous commit's refactoring and actually adds alwayslink support. Fixes #325. * tests: add coverage for a cdylib with alwayslink Makes sure that cdylibs also correctly pick up their alwayslink dependencies. * rustc: tote around LinkerInput for noncrate deps This lets us avoid reifying a depset a little longer, which is nice. Co-authored-by: Augie Fackler <augie@google.com>
- Loading branch information
Showing
6 changed files
with
212 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extern "C" int alwayslink() { return 42; } |
Oops, something went wrong.