Fix issue with GOT relocations being emitted on Mac.

This commit is contained in:
Nick Lewycky
2020-05-18 12:30:49 -07:00
parent 52a4888814
commit be1754766e

View File

@@ -50,10 +50,22 @@ impl LLVMConfig {
// Override the default multi-value switch
features.multi_value = false;
let operating_system =
if target.triple().operating_system == wasmer_compiler::OperatingSystem::Darwin {
// LLVM detects static relocation + darwin on 64-bit and
// force-enables PIC because MachO doesn't support it. They don't
// check whether they're targeting MachO, they check whether the
// OS is set to Darwin.
//
// Since both linux and darwin use SysV ABI, this should work.
wasmer_compiler::OperatingSystem::Linux
} else {
target.triple().operating_system
};
let triple = Triple {
architecture: target.triple().architecture,
vendor: target.triple().vendor.clone(),
operating_system: target.triple().operating_system,
operating_system,
environment: target.triple().environment,
binary_format: target_lexicon::BinaryFormat::Elf,
};