mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 13:18:20 +00:00
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:
@@ -95,7 +95,11 @@ impl LLVM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn code_model(&self) -> CodeModel {
|
fn code_model(&self) -> CodeModel {
|
||||||
CodeModel::Large
|
if self.is_pic {
|
||||||
|
CodeModel::Small
|
||||||
|
} else {
|
||||||
|
CodeModel::Large
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn target_triple(&self, target: &Target) -> TargetTriple {
|
fn target_triple(&self, target: &Target) -> TargetTriple {
|
||||||
@@ -106,18 +110,20 @@ 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
|
||||||
// LLVM detects static relocation + darwin + 64-bit and
|
&& !self.is_pic
|
||||||
// force-enables PIC because MachO doesn't support that
|
{
|
||||||
// combination. They don't check whether they're targeting
|
// LLVM detects static relocation + darwin + 64-bit and
|
||||||
// MachO, they check whether the OS is set to Darwin.
|
// force-enables PIC because MachO doesn't support that
|
||||||
//
|
// combination. They don't check whether they're targeting
|
||||||
// Since both linux and darwin use SysV ABI, this should work.
|
// MachO, they check whether the OS is set to Darwin.
|
||||||
wasmer_compiler::OperatingSystem::Linux
|
//
|
||||||
} else {
|
// Since both linux and darwin use SysV ABI, this should work.
|
||||||
target.triple().operating_system
|
wasmer_compiler::OperatingSystem::Linux
|
||||||
};
|
} else {
|
||||||
|
target.triple().operating_system
|
||||||
|
};
|
||||||
let triple = Triple {
|
let triple = Triple {
|
||||||
architecture: target.triple().architecture,
|
architecture: target.triple().architecture,
|
||||||
vendor: target.triple().vendor.clone(),
|
vendor: target.triple().vendor.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user