File tree 4 files changed +32
-0
lines changed
src/test/run-make/issue-47384
4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ -include ../../run-make-fulldeps/tools.mk
2
+
3
+ # ignore-windows
4
+ # ignore-cross-compile
5
+
6
+ all : main.rs
7
+ $(RUSTC ) --crate-type lib lib.rs
8
+ $(RUSTC ) --crate-type cdylib -Clink-args=" -Tlinker.ld" main.rs
9
+ # Ensure `#[used]` and `KEEP`-ed section is there
10
+ objdump -s -j" .static" $(TMPDIR ) /libmain.so
11
+ # Ensure `#[no_mangle]` symbol is there
12
+ nm $(TMPDIR ) /libmain.so | $(CGREP ) bar
Original file line number Diff line number Diff line change
1
+ mod foo {
2
+ #[ link_section = ".rodata.STATIC" ]
3
+ #[ used]
4
+ static STATIC : [ u32 ; 10 ] = [ 1 ; 10 ] ;
5
+ }
6
+
7
+ mod bar {
8
+ #[ no_mangle]
9
+ extern "C" fn bar ( ) -> i32 {
10
+ 0
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ SECTIONS
2
+ {
3
+ .static : ALIGN (4)
4
+ {
5
+ KEEP(*(.rodata.STATIC));
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ extern crate lib;
You can’t perform that action at this time.
0 commit comments