]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/link-section.rs
Add simple link_section test to exercise it
[rust.git] / src / test / run-pass / link-section.rs
1 #[cfg(not(target_os = "macos"))]
2 #[link_section=".moretext"]
3 fn i_live_in_more_text() -> &'static str {
4     "knock knock"
5 }
6
7 #[cfg(not(target_os = "macos"))]
8 #[link_section=".imm"]
9 static magic: uint = 42;
10
11 #[cfg(not(target_os = "macos"))]
12 #[link_section=".mut"]
13 static mut frobulator: uint = 0xdeadbeef;
14
15 #[cfg(target_os = "macos")]
16 #[link_section="__TEXT,__moretext"]
17 fn i_live_in_more_text() -> &'static str {
18     "knock knock"
19 }
20
21 #[cfg(target_os = "macos")]
22 #[link_section="__RODATA,__imm"]
23 static magic: uint = 42;
24
25 #[cfg(target_os = "macos")]
26 #[link_section="__DATA,__mut"]
27 static mut frobulator: uint = 0xdeadbeef;
28
29 fn main() {
30     unsafe {
31         frobulator = 0xcafebabe;
32         printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);
33     }
34 }