2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-14 12:20:28 +02:00
|
|
|
#![allow(non_upper_case_globals)]
|
2013-07-23 17:23:22 -04: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-25 17:06:52 -07:00
|
|
|
static magic: usize = 42;
|
2013-07-23 17:23:22 -04:00
|
|
|
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
#[link_section=".mut"]
|
2015-03-25 17:06:52 -07:00
|
|
|
static mut frobulator: usize = 0xdeadbeef;
|
2013-07-23 17:23:22 -04: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-25 17:06:52 -07:00
|
|
|
static magic: usize = 42;
|
2013-07-23 17:23:22 -04:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[link_section="__DATA,__mut"]
|
2015-03-25 17:06:52 -07:00
|
|
|
static mut frobulator: usize = 0xdeadbeef;
|
2013-07-23 17:23:22 -04:00
|
|
|
|
2013-09-25 00:43:37 -07:00
|
|
|
pub fn main() {
|
2013-07-23 17:23:22 -04:00
|
|
|
unsafe {
|
2021-12-31 21:13:07 -08:00
|
|
|
frobulator = 0x12345678;
|
2013-09-24 22:16:43 -07:00
|
|
|
println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
|
2013-07-23 17:23:22 -04:00
|
|
|
}
|
|
|
|
}
|