rust/tests/run-make/windows-safeseh/Makefile
Daniel Cheng 8fa800db61 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.
2023-10-24 13:42:28 -07:00

20 lines
469 B
Makefile

# 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