Change linker for x86_64-fortanix-unknown-sgx to rust-lld

For SGX, the relocation using the relocation table is done by
the code in rust/src/libstd/sys/sgx/abi/reloc.rs and this code
should not require relocation. Setting RelaxELFRelocations flag
if allows this to happen, hence adding a Target Option for it.
This commit is contained in:
Parth Sane 2019-12-02 17:52:45 +05:30
parent 4af3ee8ee2
commit 54b206034f
6 changed files with 40 additions and 31 deletions

View file

@ -393,7 +393,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
bool TrapUnreachable,
bool Singlethread,
bool AsmComments,
bool EmitStackSizeSection) {
bool EmitStackSizeSection,
bool RelaxELFRelocations) {
auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
@ -418,6 +419,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
Options.MCOptions.AsmVerbose = AsmComments;
Options.MCOptions.PreserveAsmComments = AsmComments;
Options.MCOptions.ABIName = ABIStr;
Options.RelaxELFRelocations = RelaxELFRelocations;
if (TrapUnreachable) {
// Tell LLVM to codegen `unreachable` into an explicit trap instruction.