]> git.proxmox.com Git - rustc.git/blame - src/test/ui/link-section.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / link-section.rs
CommitLineData
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"]
6fn i_live_in_more_text() -> &'static str {
7 "knock knock"
8}
9
10#[cfg(not(target_os = "macos"))]
11#[link_section=".imm"]
c34b1796 12static magic: usize = 42;
1a4d82fc
JJ
13
14#[cfg(not(target_os = "macos"))]
15#[link_section=".mut"]
c34b1796 16static mut frobulator: usize = 0xdeadbeef;
1a4d82fc
JJ
17
18#[cfg(target_os = "macos")]
19#[link_section="__TEXT,__moretext"]
20fn i_live_in_more_text() -> &'static str {
21 "knock knock"
22}
23
24#[cfg(target_os = "macos")]
25#[link_section="__RODATA,__imm"]
c34b1796 26static magic: usize = 42;
1a4d82fc
JJ
27
28#[cfg(target_os = "macos")]
29#[link_section="__DATA,__mut"]
c34b1796 30static mut frobulator: usize = 0xdeadbeef;
1a4d82fc
JJ
31
32pub fn main() {
33 unsafe {
a2a8927a 34 frobulator = 0x12345678;
1a4d82fc
JJ
35 println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
36 }
37}