[PATCH] D97507: llvm-lto: default Relocation Model should be selected by the TargetMachine.
wael yehia via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 9 19:21:05 PST 2021
w2yehia updated this revision to Diff 329514.
w2yehia added a comment.
@daltenty provided a reduced testcase that would fail without this fix.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97507/new/
https://reviews.llvm.org/D97507
Files:
llvm/lib/LTO/LTOBackend.cpp
llvm/test/tools/llvm-lto/aix.ll
Index: llvm/test/tools/llvm-lto/aix.ll
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-lto/aix.ll
@@ -0,0 +1,11 @@
+; 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
+
Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -184,10 +184,10 @@
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_;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97507.329514.patch
Type: text/x-patch
Size: 903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210310/03852532/attachment.bin>
More information about the llvm-commits
mailing list