[PATCH] D97507: llvm-lto: default Relocation Model should be selected by the TargetMachine.

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 14:31:45 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe646e31487b: llvm-lto: default Relocation Model should be selected by the TargetMachine. (authored by w2yehia, committed by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D97507?vs=329672&id=329777#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97507/new/

https://reviews.llvm.org/D97507

Files:
  llvm/lib/LTO/LTOBackend.cpp
  test/tools/llvm-lto/aix.ll


Index: test/tools/llvm-lto/aix.ll
===================================================================
--- /dev/null
+++ test/tools/llvm-lto/aix.ll
@@ -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
+
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.329777.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210310/4c18ad93/attachment.bin>


More information about the llvm-commits mailing list