]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | #[cfg(not(target_os = "macos"))] | |
12 | #[link_section=".moretext"] | |
13 | fn i_live_in_more_text() -> &'static str { | |
14 | "knock knock" | |
15 | } | |
16 | ||
17 | #[cfg(not(target_os = "macos"))] | |
18 | #[link_section=".imm"] | |
c34b1796 | 19 | static magic: usize = 42; |
1a4d82fc JJ |
20 | |
21 | #[cfg(not(target_os = "macos"))] | |
22 | #[link_section=".mut"] | |
c34b1796 | 23 | static mut frobulator: usize = 0xdeadbeef; |
1a4d82fc JJ |
24 | |
25 | #[cfg(target_os = "macos")] | |
26 | #[link_section="__TEXT,__moretext"] | |
27 | fn i_live_in_more_text() -> &'static str { | |
28 | "knock knock" | |
29 | } | |
30 | ||
31 | #[cfg(target_os = "macos")] | |
32 | #[link_section="__RODATA,__imm"] | |
c34b1796 | 33 | static magic: usize = 42; |
1a4d82fc JJ |
34 | |
35 | #[cfg(target_os = "macos")] | |
36 | #[link_section="__DATA,__mut"] | |
c34b1796 | 37 | static mut frobulator: usize = 0xdeadbeef; |
1a4d82fc JJ |
38 | |
39 | pub fn main() { | |
40 | unsafe { | |
41 | frobulator = 0xcafebabe; | |
42 | println!("{} {} {}", i_live_in_more_text(), magic, frobulator); | |
43 | } | |
44 | } |