File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/librustc_codegen_llvm Expand file tree Collapse file tree 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;
2020use rustc:: ty:: query:: Providers ;
2121use rustc_data_structures:: sync:: Lrc ;
2222use rustc_data_structures:: fx:: FxHashMap ;
23- use rustc_target:: spec:: PanicStrategy ;
23+ use rustc_target:: spec:: { PanicStrategy , RelroLevel } ;
2424
2525use attributes;
2626use llvm:: { self , Attribute } ;
@@ -173,7 +173,12 @@ pub fn from_fn_attrs(
173173
174174 set_frame_pointer_elimination ( cx, llfn) ;
175175 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+ }
177182
178183 if codegen_fn_attrs. flags . contains ( CodegenFnAttrFlags :: COLD ) {
179184 Attribute :: Cold . apply_llfn ( Function , llfn) ;
You can’t perform that action at this time.
0 commit comments