[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
Thu Feb 25 15:57:25 PST 2021


w2yehia created this revision.
Herald added subscribers: steven_wu, hiraditya, inglorion.
w2yehia requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

https://reviews.llvm.org/D97507

Files:
  llvm/lib/LTO/LTOBackend.cpp


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.326542.patch
Type: text/x-patch
Size: 543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/e9c85fe1/attachment.bin>


More information about the llvm-commits mailing list