[PATCH] D44684: [mips] Improve handling of -fno-[pic/PIC] option

Simon Dardis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 30 03:45:15 PDT 2018


sdardis accepted this revision.
sdardis added a comment.
This revision is now accepted and ready to land.

LGTM, with a touch up of the error message to match the others we have regarding -mabicalls. Some other minor nits inlined.



================
Comment at: include/clang/Basic/DiagnosticDriverKinds.td:340
+  "ignoring '%0' option as it cannot be used with "
+  "explicit use of -mabicalls and the N64 ABI">,
   InGroup<OptionIgnored>;
----------------
abeserminji wrote:
> sdardis wrote:
> > Use the %select{optionA|optionB|..|optionZ}$NUM operator here like:
> > 
> > "cannot be used with the %select{explicit|implicit}1 usage of -mabicalls and the N64 ABI"
> > 
> > Which eliminates the need for two separate warnings.
> Thanks for the hint. I simplified it now.
Just saw the error messages above; so for style, you should reformat the message to be of the form "ignoring '%0' option as it cannt be used with %select{|implicit usage of}1-mabicalls and the N64 ABI".

This way all the error messages are consistent. 


================
Comment at: lib/Driver/ToolChains/CommonArgs.cpp:1024
+    mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
+    // For n64 ABI, PIC is always true, except in case when -mno-abicalls
+    // option is used. And we exit at next check if that's true,
----------------
Nit: "When targeting the N64 ABI, PIC is the default, except in the case when the -mno-abicalls option is used."


================
Comment at: test/Driver/mips-abicalls-warning.c:2
 // REQUIRES: mips-registered-target
-// RUN: %clang -### -c -target mips64-mti-elf -fno-PIC -mabicalls %s 2>&1 | FileCheck %s
-// CHECK: warning: ignoring '-mabicalls' option as it cannot be used with non position-independent code and the N64 ABI
+// RUN: %clang -### -c -target mips64-mti-elf -fno-pic %s 2>&1 | FileCheck -check-prefix=CHECK-PIC1-IMPLICIT %s
+// CHECK-PIC1-IMPLICIT: warning: ignoring '-fno-pic' option as it cannot be used with implicit use of -mabicalls and the N64 ABI
----------------
Add some checks for -fno-pie,  -fno-PIE.


https://reviews.llvm.org/D44684





More information about the cfe-commits mailing list