提交 96f5eba4 编写于 作者: D Daniel Micay

work around MinGW linker bug for ASLR on Windows

Closes #16514
上级 7074592e
......@@ -87,7 +87,7 @@
use std::rc::Rc;
use std::{i8, i16, i32, i64};
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustCall};
use syntax::abi::{RustIntrinsic, Abi};
use syntax::abi::{RustIntrinsic, Abi, OsWindows};
use syntax::ast_util::{local_def, is_local};
use syntax::attr::AttrMetaMethods;
use syntax::attr;
......@@ -2446,6 +2446,13 @@ fn create_entry_fn(ccx: &CrateContext,
&ccx.int_type);
let llfn = decl_cdecl_fn(ccx, "main", llfty, ty::mk_nil());
// FIXME: #16581: Marking a symbol in the executable with `dllexport`
// linkage forces MinGW's linker to output a `.reloc` section for ASLR
if ccx.sess().targ_cfg.os == OsWindows {
unsafe { llvm::LLVMRustSetDLLExportStorageClass(llfn) }
}
let llbb = "top".with_c_str(|buf| {
unsafe {
llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册