llvm-lto: default Relocation Model should be selected by the TargetMachine.
Right now, the createTargetMachine function in LTOBackend.cpp (used by llvm-lto, and other components) selects the default Relocation Model when none is specified in the module. Other components (such as opt and llc) that construct a TargetMachine delegate the decision on the default value to the polymorphic TargetMachine's constructor. This commit aligns llvm-lto with other components. Reviewed By: daltenty, fhahn Differential Revision: https://reviews.llvm.org/D97507
This commit is contained in:
parent
1a808286ef
commit
be646e3148
@ -184,10 +184,10 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
|
||||
for (const std::string &A : Conf.MAttrs)
|
||||
Features.AddFeature(A);
|
||||
|
||||
Reloc::Model RelocModel;
|
||||
Optional<Reloc::Model> RelocModel = None;
|
||||
if (Conf.RelocModel)
|
||||
RelocModel = *Conf.RelocModel;
|
||||
else
|
||||
else if (M.getModuleFlag("PIC Level"))
|
||||
RelocModel =
|
||||
M.getPICLevel() == PICLevel::NotPIC ? Reloc::Static : Reloc::PIC_;
|
||||
|
||||
|
12
test/tools/llvm-lto/aix.ll
Normal file
12
test/tools/llvm-lto/aix.ll
Normal file
@ -0,0 +1,12 @@
|
||||
; REQUIRES: powerpc-registered-target
|
||||
; RUN: llvm-as < %s > %t1
|
||||
; RUN: llvm-lto %t1 | FileCheck %s
|
||||
|
||||
target triple = "powerpc-ibm-aix"
|
||||
|
||||
define i32 @main() {
|
||||
entry:
|
||||
ret i32 42
|
||||
}
|
||||
; CHECK: Wrote native object file
|
||||
|
Loading…
x
Reference in New Issue
Block a user