@@ -76,6 +76,9 @@ macro_rules! sel {
76
76
#[ used]
77
77
static _IMAGE_TAG: [ u32 ; 2 ] = [ 0 , 0 ] ;
78
78
79
+ // Marked with `unnamed_addr` in Objective-C's LLVM.
80
+ // See rust-lang/rust#18297
81
+ // Should only be an optimization (?)
79
82
#[ link_section = "__TEXT,__objc_methname,cstring_literals" ]
80
83
#[ export_name = concat!( "\x01 L_OBJC_METH_VAR_NAME_" , $crate:: __proc_macros:: hash_idents!( $( $idents) +) ) ]
81
84
static NAME : [ u8 ; X . len( ) ] = {
@@ -89,6 +92,8 @@ macro_rules! sel {
89
92
} ;
90
93
91
94
// Place the constant value in the correct section.
95
+ //
96
+ // Clang uses `no_dead_strip` here for some reason?
92
97
#[ link_section = "__DATA,__objc_selrefs,literal_pointers" ]
93
98
#[ export_name = concat!( "\x01 L_OBJC_SELECTOR_REFERENCES_" , $crate:: __proc_macros:: hash_idents!( $( $idents) +) ) ]
94
99
static mut REF : & [ u8 ; X . len( ) ] = & NAME ;
@@ -97,6 +102,9 @@ macro_rules! sel {
97
102
// loaded, so we need to use a volatile read to prevent the
98
103
// optimizer from thinking it can circumvent the read through REF.
99
104
//
105
+ // Clang avoids this by marking `REF` with LLVM's
106
+ // `externally_initialized`.
107
+ //
100
108
// TODO: `::core` here could be replaced with some more
101
109
// sophisticated logic so we don't rely on downstream users having
102
110
// this setup.
0 commit comments