1+ // ignore-tidy-linelength
2+ //
13//@ add-minicore
2- //@ revisions: linux win_x86_msvc win_x86_gnu win_i686_gnu macos thumb
4+ //@ revisions: linux linux_no_function_sections macos thumb
5+ //@ revisions: win_x86_msvc win_x86_gnu win_i686_gnu win_x86_gnu_function_sections
36//
47//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
58//@[linux] needs-llvm-components: x86
9+ //@[linux_no_function_sections] compile-flags: --target x86_64-unknown-linux-gnu -Zfunction-sections=false
10+ //@[linux_no_function_sections] needs-llvm-components: x86
611//@[win_x86_gnu] compile-flags: --target x86_64-pc-windows-gnu
712//@[win_x86_gnu] needs-llvm-components: x86
13+ //@[win_x86_gnu_function_sections] compile-flags: --target x86_64-pc-windows-gnu -Zfunction-sections
14+ //@[win_x86_gnu_function_sections] needs-llvm-components: x86
815//@[win_x86_msvc] compile-flags: --target x86_64-pc-windows-msvc
916//@[win_x86_msvc] needs-llvm-components: x86
1017//@[win_i686_gnu] compile-flags: --target i686-pc-windows-gnu
2128extern crate minicore;
2229use minicore:: * ;
2330
24- // linux,win_x86,win_i686 : .intel_syntax
31+ // linux,win_x86_gnu,win_i686_gnu : .intel_syntax
2532//
2633// linux: .pushsection .text.naked_empty,\22ax\22, @progbits
34+ // linux_no_function_sections: .text
2735// macos-NOT: .pushsection
2836//
29- // win_x86_msvc: .pushsection .text$naked_empty,\22xr\22
30- // win_x86_gnu-NOT: .pushsection
31- // win_i686_gnu-NOT: .pushsection
37+ // win_x86_msvc: .section .text,\22xr\22,one_only,naked_empty
38+ // win_x86_gnu_function_sections: .section .text$naked_empty,\22xr\22,one_only,naked_empty
39+ // win_x86_gnu-NOT: .section
40+ // win_i686_gnu-NOT: .section
3241//
3342// thumb: .pushsection .text.naked_empty,\22ax\22, %progbits
3443//
3544// linux, macos, thumb: .balign 4
3645//
37- // linux,thumb: .globl naked_empty
46+ // linux,win_x86_gnu, thumb: .globl naked_empty
3847// macos: .globl _naked_empty
3948//
4049// CHECK-NOT: .private_extern
@@ -63,7 +72,7 @@ use minicore::*;
6372//
6473// CHECK-LABEL: naked_empty:
6574//
66- // linux,macos,win_x86,win_x86 : ret
75+ // linux,macos,win_x86_msvc,win_x86_gnu,win_i686_gnu : ret
6776// thumb: bx lr
6877//
6978// linux,windows,win_x86_msvc,thumb: .popsection
@@ -86,20 +95,22 @@ pub extern "C" fn naked_empty() {
8695 }
8796}
8897
89- // linux,win_x86,win_i686 : .intel_syntax
98+ // linux,win_x86_gnu,win_i686_gnu,win_x86_msvc : .intel_syntax
9099//
91100// linux: .pushsection .text.naked_with_args_and_return,\22ax\22, @progbits
101+ // linux_no_function_sections: .text
92102// macos-NOT: .pushsection
93103//
94- // win_x86_msvc: .pushsection .text$naked_with_args_and_return,\22xr\22
95- // win_x86_gnu-NOT: .pushsection
96- // win_i686_gnu-NOT: .pushsection
104+ // win_x86_msvc: .section .text,\22xr\22,one_only,naked_with_args_and_return
105+ // win_x86_gnu_function_sections: .section .text$naked_with_args_and_return,\22xr\22,one_only,naked_with_args_and_return
106+ // win_x86_gnu-NOT: .section
107+ // win_i686_gnu-NOT: .section
97108//
98109// thumb: .pushsection .text.naked_with_args_and_return,\22ax\22, %progbits
99110//
100111// linux, macos, thumb: .balign 4
101112//
102- // linux,thumb: .globl naked_with_args_and_return
113+ // linux,win_x86_gnu,win_x86_msvc,win_i686_gnu, thumb: .globl naked_with_args_and_return
103114// macos: .globl _naked_with_args_and_return
104115//
105116// CHECK-NOT: .private_extern
@@ -132,7 +143,7 @@ pub extern "C" fn naked_empty() {
132143// macos: add x0, x0, x1
133144// thumb: adds r0, r0, r1
134145//
135- // linux,macos,win_x86,win_i686 : ret
146+ // linux,macos,win_x86_msvc,win_x86_gnu,win_i686_gnu : ret
136147// thumb: bx lr
137148//
138149// linux,windows,win_x86_msvc,thumb: .popsection
@@ -158,9 +169,10 @@ pub extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize {
158169 }
159170}
160171
161- // linux: .pushsection .text.some_different_name,\22ax\22, @progbits
172+ // linux,linux_no_function_sections: .pushsection .text.some_different_name,\22ax\22, @progbits
162173// macos: .pushsection .text.some_different_name,regular,pure_instructions
163- // win_x86_msvc,win_x86_gnu,win_i686_gnu: .pushsection .text.some_different_name,\22xr\22
174+ // win_x86_msvc,win_x86_gnu,win_i686_gnu: .section .text.some_different_name,\22xr\22
175+ // win_x86_gnu_function_sections: .section .text.some_different_name,\22xr\22
164176// thumb: .pushsection .text.some_different_name,\22ax\22, %progbits
165177// CHECK-LABEL: test_link_section:
166178#[ no_mangle]
0 commit comments