forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#117115 - zetafunction:linking, r=bjorn3
Mark .rmeta files as /SAFESEH on x86 Windows. Chrome links .rlibs with /WHOLEARCHIVE or -Wl,--whole-archive to prevent the linker from discarding static initializers. This works well, except on Windows x86, where lld complains: error: /safeseh: lib.rmeta is not compatible with SEH The fix is simply to mark the .rmeta as SAFESEH aware. This is trivially true, since the metadata file does not contain any executable code.
- Loading branch information
Showing
7 changed files
with
55 additions
and
33 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 was deleted.
Oops, something went wrong.
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,19 @@ | ||
# only-windows | ||
# needs-rust-lld | ||
|
||
include ../tools.mk | ||
|
||
all: foo bar | ||
|
||
# Ensure that LLD can link when an .rlib contains a synthetic object | ||
# file referencing exported or used symbols. | ||
foo: | ||
$(RUSTC) -C linker=rust-lld foo.rs | ||
|
||
# Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib. | ||
# Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware. | ||
bar: baz | ||
$(RUSTC) -C linker=rust-lld -C link-arg=/WHOLEARCHIVE:libbaz.rlib bar.rs | ||
|
||
baz: | ||
$(RUSTC) baz.rs |
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 @@ | ||
fn main() {} |
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,4 @@ | ||
#![crate_type = "rlib"] | ||
|
||
#[no_mangle] | ||
extern "C" fn baz() {} |
File renamed without changes.