[PATCH] D126346: [Clang] Make PIC check comprehensive with respect to relocation models.

Zhiyao Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 17:09:42 PDT 2022


ZhiyaoMa98 created this revision.
ZhiyaoMa98 added reviewers: rsmith, llvm-commits.
Herald added a project: All.
ZhiyaoMa98 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add missing if branch for "ropi", "rwpi" and "ropi-rwpi" relocation model when initializing the PIC boolean variable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126346

Files:
  clang/tools/driver/cc1as_main.cpp


Index: clang/tools/driver/cc1as_main.cpp
===================================================================
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -403,6 +403,12 @@
     PIC = false;
   } else if (Opts.RelocationModel == "pic") {
     PIC = true;
+  } else if (Opts.RelocationModel == "ropi-rwpi") {
+    PIC = true;
+  } else if (Opts.RelocationModel == "ropi") {
+    PIC = false;
+  } else if (Opts.RelocationModel == "rwpi") {
+    PIC = false;
   } else {
     assert(Opts.RelocationModel == "dynamic-no-pic" &&
            "Invalid PIC model!");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126346.431839.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220525/12e82318/attachment.bin>


More information about the cfe-commits mailing list