When we're building PIC we don't need the large code model. Try small.

Only mangle darwin to linux when PIC is disabled (the reason we do it is to avoid LLVM forcably enabling PIC for us).
This commit is contained in:
Nick Lewycky
2020-08-07 18:13:56 -07:00
parent 8daeff8bc8
commit 45dcee1282

View File

@@ -95,8 +95,12 @@ impl LLVM {
} }
fn code_model(&self) -> CodeModel { fn code_model(&self) -> CodeModel {
if self.is_pic {
CodeModel::Small
} else {
CodeModel::Large CodeModel::Large
} }
}
fn target_triple(&self, target: &Target) -> TargetTriple { fn target_triple(&self, target: &Target) -> TargetTriple {
// Hack: we're using is_pic to determine whether this is a native // Hack: we're using is_pic to determine whether this is a native
@@ -106,8 +110,10 @@ impl LLVM {
} else { } else {
target_lexicon::BinaryFormat::Elf target_lexicon::BinaryFormat::Elf
}; };
let operating_system = let operating_system = if target.triple().operating_system
if target.triple().operating_system == wasmer_compiler::OperatingSystem::Darwin { == wasmer_compiler::OperatingSystem::Darwin
&& !self.is_pic
{
// LLVM detects static relocation + darwin + 64-bit and // LLVM detects static relocation + darwin + 64-bit and
// force-enables PIC because MachO doesn't support that // force-enables PIC because MachO doesn't support that
// combination. They don't check whether they're targeting // combination. They don't check whether they're targeting