]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | // run-pass |
2 | ||
0bf4aa26 | 3 | #![allow(non_upper_case_globals)] |
1a4d82fc JJ |
4 | #[cfg(not(target_os = "macos"))] |
5 | #[link_section=".moretext"] | |
6 | fn i_live_in_more_text() -> &'static str { | |
7 | "knock knock" | |
8 | } | |
9 | ||
10 | #[cfg(not(target_os = "macos"))] | |
11 | #[link_section=".imm"] | |
c34b1796 | 12 | static magic: usize = 42; |
1a4d82fc JJ |
13 | |
14 | #[cfg(not(target_os = "macos"))] | |
15 | #[link_section=".mut"] | |
c34b1796 | 16 | static mut frobulator: usize = 0xdeadbeef; |
1a4d82fc JJ |
17 | |
18 | #[cfg(target_os = "macos")] | |
19 | #[link_section="__TEXT,__moretext"] | |
20 | fn i_live_in_more_text() -> &'static str { | |
21 | "knock knock" | |
22 | } | |
23 | ||
24 | #[cfg(target_os = "macos")] | |
25 | #[link_section="__RODATA,__imm"] | |
c34b1796 | 26 | static magic: usize = 42; |
1a4d82fc JJ |
27 | |
28 | #[cfg(target_os = "macos")] | |
29 | #[link_section="__DATA,__mut"] | |
c34b1796 | 30 | static mut frobulator: usize = 0xdeadbeef; |
1a4d82fc JJ |
31 | |
32 | pub fn main() { | |
33 | unsafe { | |
a2a8927a | 34 | frobulator = 0x12345678; |
1a4d82fc JJ |
35 | println!("{} {} {}", i_live_in_more_text(), magic, frobulator); |
36 | } | |
37 | } |