Add a test for issue 47384
This commit is contained in:
parent
fbc45b650a
commit
419e3ba97b
12
src/test/run-make/issue-47384/Makefile
Normal file
12
src/test/run-make/issue-47384/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
-include ../../run-make-fulldeps/tools.mk
|
||||
|
||||
# only-linux
|
||||
# ignore-cross-compile
|
||||
|
||||
all: main.rs
|
||||
$(RUSTC) --crate-type lib lib.rs
|
||||
$(RUSTC) --crate-type cdylib -Clink-args="-Tlinker.ld" main.rs
|
||||
# Ensure `#[used]` and `KEEP`-ed section is there
|
||||
objdump -s -j".static" $(TMPDIR)/libmain.so
|
||||
# Ensure `#[no_mangle]` symbol is there
|
||||
nm $(TMPDIR)/libmain.so | $(CGREP) bar
|
12
src/test/run-make/issue-47384/lib.rs
Normal file
12
src/test/run-make/issue-47384/lib.rs
Normal file
@ -0,0 +1,12 @@
|
||||
mod foo {
|
||||
#[link_section = ".rodata.STATIC"]
|
||||
#[used]
|
||||
static STATIC: [u32; 10] = [1; 10];
|
||||
}
|
||||
|
||||
mod bar {
|
||||
#[no_mangle]
|
||||
extern "C" fn bar() -> i32 {
|
||||
0
|
||||
}
|
||||
}
|
7
src/test/run-make/issue-47384/linker.ld
Normal file
7
src/test/run-make/issue-47384/linker.ld
Normal file
@ -0,0 +1,7 @@
|
||||
SECTIONS
|
||||
{
|
||||
.static : ALIGN(4)
|
||||
{
|
||||
KEEP(*(.rodata.STATIC));
|
||||
}
|
||||
}
|
1
src/test/run-make/issue-47384/main.rs
Normal file
1
src/test/run-make/issue-47384/main.rs
Normal file
@ -0,0 +1 @@
|
||||
extern crate lib;
|
Loading…
x
Reference in New Issue
Block a user