Skip to content

Commit 3249f0b

Browse files
committed
Rename flag to -Z plt
1 parent e53d2b9 commit 3249f0b

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/librustc/session/config.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,10 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13871387
"output a json file with profiler results"),
13881388
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
13891389
"emits a section containing stack size metadata"),
1390-
no_plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
1391-
"skip the PLT when calling into ELF shared libraries
1392-
(default: true if full relro is also enabled)"),
1390+
plt: Option<bool> = (Some(false), parse_opt_bool, [TRACKED],
1391+
"whether to use the PLT when calling into shared libraries;
1392+
only has effect for PIC code on systems with ELF binaries
1393+
(default: PLT is disabled if full relro is enabled)"),
13931394
}
13941395

13951396
pub fn default_lib_output() -> CrateType {

src/librustc_codegen_llvm/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub fn from_fn_attrs(
174174
set_frame_pointer_elimination(cx, llfn);
175175
set_probestack(cx, llfn);
176176

177-
if cx.sess().opts.debugging_opts.no_plt.unwrap_or(true) {
177+
if !cx.sess().opts.debugging_opts.plt.unwrap_or(false) {
178178
// Only enable this optimization if full relro is also enabled.
179179
// In this case, lazy binding was already unavailable, so nothing is lost.
180180
if let RelroLevel::Full = cx.sess().target.target.options.relro_level {

src/librustc_codegen_llvm/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub unsafe fn create_module(
210210

211211
// If skipping the PLT is enabled, we need to add some module metadata
212212
// to ensure intrinsic calls don't use it.
213-
if sess.opts.debugging_opts.no_plt.unwrap_or(true) {
213+
if !sess.opts.debugging_opts.plt.unwrap_or(false) {
214214
let avoid_plt = "RtLibUseGOT\0".as_ptr() as *const _;
215215
llvm::LLVMRustAddModuleFlag(llmod, avoid_plt, 1);
216216
}

src/test/codegen/no-plt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -C relocation-model=pic -Z no-plt
11+
// compile-flags: -C relocation-model=pic -Z plt=no
1212

1313
#![crate_type = "lib"]
1414

0 commit comments

Comments
 (0)