2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2019-07-26 21:54:25 +00:00
|
|
|
|
2018-09-14 10:20:28 +00:00
|
|
|
#![allow(non_upper_case_globals)]
|
2013-07-23 21:23:22 +00:00
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
#[link_section=".moretext"]
|
|
|
|
fn i_live_in_more_text() -> &'static str {
|
|
|
|
"knock knock"
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
#[link_section=".imm"]
|
2015-03-26 00:06:52 +00:00
|
|
|
static magic: usize = 42;
|
2013-07-23 21:23:22 +00:00
|
|
|
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
#[link_section=".mut"]
|
2015-03-26 00:06:52 +00:00
|
|
|
static mut frobulator: usize = 0xdeadbeef;
|
2013-07-23 21:23:22 +00:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[link_section="__TEXT,__moretext"]
|
|
|
|
fn i_live_in_more_text() -> &'static str {
|
|
|
|
"knock knock"
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[link_section="__RODATA,__imm"]
|
2015-03-26 00:06:52 +00:00
|
|
|
static magic: usize = 42;
|
2013-07-23 21:23:22 +00:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[link_section="__DATA,__mut"]
|
2015-03-26 00:06:52 +00:00
|
|
|
static mut frobulator: usize = 0xdeadbeef;
|
2013-07-23 21:23:22 +00:00
|
|
|
|
2013-09-25 07:43:37 +00:00
|
|
|
pub fn main() {
|
2013-07-23 21:23:22 +00:00
|
|
|
unsafe {
|
2022-01-01 05:13:07 +00:00
|
|
|
frobulator = 0x12345678;
|
2013-09-25 05:16:43 +00:00
|
|
|
println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
|
2013-07-23 21:23:22 +00:00
|
|
|
}
|
|
|
|
}
|