]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/link_section.rs
Rollup merge of #61389 - Zoxc:arena-cleanup, r=eddyb
[rust.git] / src / test / codegen / link_section.rs
1 // compile-flags: -C no-prepopulate-passes
2
3 #![crate_type = "lib"]
4
5 // CHECK: @VAR1 = constant <{ [4 x i8] }> <{ [4 x i8] c"\01\00\00\00" }>, section ".test_one"
6 #[no_mangle]
7 #[link_section = ".test_one"]
8 #[cfg(target_endian = "little")]
9 pub static VAR1: u32 = 1;
10
11 #[no_mangle]
12 #[link_section = ".test_one"]
13 #[cfg(target_endian = "big")]
14 pub static VAR1: u32 = 0x01000000;
15
16 pub enum E {
17     A(u32),
18     B(f32)
19 }
20
21 // CHECK: @VAR2 = constant {{.*}}, section ".test_two"
22 #[no_mangle]
23 #[link_section = ".test_two"]
24 pub static VAR2: E = E::A(666);
25
26 // CHECK: @VAR3 = constant {{.*}}, section ".test_three"
27 #[no_mangle]
28 #[link_section = ".test_three"]
29 pub static VAR3: E = E::B(1.);
30
31 // CHECK: define void @fn1() {{.*}} section ".test_four" {
32 #[no_mangle]
33 #[link_section = ".test_four"]
34 pub fn fn1() {}