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