File tree 1 file changed +7
-2
lines changed
src/librustc_codegen_llvm
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ use rustc::ty::layout::HasTyCtxt;
20
20
use rustc:: ty:: query:: Providers ;
21
21
use rustc_data_structures:: sync:: Lrc ;
22
22
use rustc_data_structures:: fx:: FxHashMap ;
23
- use rustc_target:: spec:: PanicStrategy ;
23
+ use rustc_target:: spec:: { PanicStrategy , RelroLevel } ;
24
24
25
25
use attributes;
26
26
use llvm:: { self , Attribute } ;
@@ -173,7 +173,12 @@ pub fn from_fn_attrs(
173
173
174
174
set_frame_pointer_elimination ( cx, llfn) ;
175
175
set_probestack ( cx, llfn) ;
176
- Attribute :: NonLazyBind . apply_llfn ( Function , llfn) ;
176
+
177
+ // Only enable this optimization if full relro is also enabled.
178
+ // In this case, lazy binding was already unavailable, so nothing is lost.
179
+ if let RelroLevel :: Full = cx. sess ( ) . target . target . options . relro_level {
180
+ Attribute :: NonLazyBind . apply_llfn ( Function , llfn) ;
181
+ }
177
182
178
183
if codegen_fn_attrs. flags . contains ( CodegenFnAttrFlags :: COLD ) {
179
184
Attribute :: Cold . apply_llfn ( Function , llfn) ;
You can’t perform that action at this time.
0 commit comments