We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba972e2 commit e53d2b9Copy full SHA for e53d2b9
src/librustc_codegen_llvm/context.rs
@@ -208,6 +208,13 @@ pub unsafe fn create_module(
208
llvm::LLVMRustSetModulePIELevel(llmod);
209
}
210
211
+ // If skipping the PLT is enabled, we need to add some module metadata
212
+ // to ensure intrinsic calls don't use it.
213
+ if sess.opts.debugging_opts.no_plt.unwrap_or(true) {
214
+ let avoid_plt = "RtLibUseGOT\0".as_ptr() as *const _;
215
+ llvm::LLVMRustAddModuleFlag(llmod, avoid_plt, 1);
216
+ }
217
+
218
llmod
219
220
src/test/codegen/no-plt.rs
@@ -22,3 +22,6 @@ extern "C" {
22
pub unsafe fn call_through_plt() -> *mut u8 {
23
getenv(b"\0".as_ptr())
24
25
26
+// Ensure intrinsics also skip the PLT
27
+// CHECK: !"RtLibUseGOT"
0 commit comments