[PATCH] D35970: Teach cc1as driver to accept ARM ropi/rwpi reloc model

Weiming Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 18:04:59 PDT 2017


weimingz created this revision.
Herald added subscribers: kristof.beyls, aemerson.

Cureently, passing -frwpi/-fropi for assmebling causes assertion.
This patch teaches the cc1as driver to accept the flags


Repository:
  rL LLVM

https://reviews.llvm.org/D35970

Files:
  tools/driver/cc1as_main.cpp


Index: tools/driver/cc1as_main.cpp
===================================================================
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -344,12 +344,19 @@
   std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
 
   MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
+  Triple T(Opts.Triple);
 
   bool PIC = false;
   if (Opts.RelocationModel == "static") {
     PIC = false;
   } else if (Opts.RelocationModel == "pic") {
     PIC = true;
+  } else if ((T.getArch() == llvm::Triple::arm ||
+              T.getArch() == llvm::Triple::armeb) &&
+             (Opts.RelocationModel == "ropi" ||
+              Opts.RelocationModel == "rwpi" ||
+              Opts.RelocationModel == "ropi-rwpi")) {
+    PIC = false;
   } else {
     assert(Opts.RelocationModel == "dynamic-no-pic" &&
            "Invalid PIC model!");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35970.108566.patch
Type: text/x-patch
Size: 872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170728/b635064f/attachment.bin>


More information about the llvm-commits mailing list