[llvm-branch-commits] [cfe-branch] r213742 - Merging r213741:

Daniel Sanders daniel.sanders at imgtec.com
Wed Jul 23 05:11:46 PDT 2014


Author: dsanders
Date: Wed Jul 23 07:11:45 2014
New Revision: 213742

URL: http://llvm.org/viewvc/llvm-project?rev=213742&view=rev
Log:
Merging r213741:
------------------------------------------------------------------------
r213741 | dsanders | 2014-07-23 13:06:13 +0100 (Wed, 23 Jul 2014) | 5 lines

[mips] -mno-shared should only be given to the assembler when -fPIC/-fpic/-fPIE/-fpie is not in effect.

This fixes compiler recursion on MIPS32r2.


------------------------------------------------------------------------

Modified:
    cfe/branches/release_35/   (props changed)
    cfe/branches/release_35/lib/Driver/Tools.cpp
    cfe/branches/release_35/test/Driver/mips-as.c

Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 23 07:11:45 2014
@@ -1,3 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
+/cfe/trunk:213741
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_35/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Driver/Tools.cpp?rev=213742&r1=213741&r2=213742&view=diff
==============================================================================
--- cfe/branches/release_35/lib/Driver/Tools.cpp (original)
+++ cfe/branches/release_35/lib/Driver/Tools.cpp Wed Jul 23 07:11:45 2014
@@ -7047,8 +7047,22 @@ void gnutools::Assemble::ConstructJob(Co
     CmdArgs.push_back("-mabi");
     CmdArgs.push_back(ABIName.data());
 
-    // LLVM doesn't support -mabicalls yet and acts as if it is always given.
-    CmdArgs.push_back("-mno-shared");
+    // -mno-shared should be emitted unless -fpic, -fpie, -fPIC, -fPIE,
+    // or -mshared (not implemented) is in effect.
+    bool IsPicOrPie = false;
+    if (Arg *A = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
+                                 options::OPT_fpic, options::OPT_fno_pic,
+                                 options::OPT_fPIE, options::OPT_fno_PIE,
+                                 options::OPT_fpie, options::OPT_fno_pie)) {
+      if (A->getOption().matches(options::OPT_fPIC) ||
+          A->getOption().matches(options::OPT_fpic) ||
+          A->getOption().matches(options::OPT_fPIE) ||
+          A->getOption().matches(options::OPT_fpie))
+        IsPicOrPie = true;
+    }
+    if (!IsPicOrPie)
+      CmdArgs.push_back("-mno-shared");
+
     // LLVM doesn't support -mplt yet and acts as if it is always given.
     // However, -mplt has no effect with the N64 ABI.
     CmdArgs.push_back(ABIName == "64" ? "-KPIC" : "-call_nonpic");

Modified: cfe/branches/release_35/test/Driver/mips-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/test/Driver/mips-as.c?rev=213742&r1=213741&r2=213742&view=diff
==============================================================================
--- cfe/branches/release_35/test/Driver/mips-as.c (original)
+++ cfe/branches/release_35/test/Driver/mips-as.c Wed Jul 23 07:11:45 2014
@@ -12,7 +12,7 @@
 // RUN: %clang -target mips-linux-gnu -### \
 // RUN:   -no-integrated-as -fPIC -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS32R2-EB-PIC %s
-// MIPS32R2-EB-PIC: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB"
+// MIPS32R2-EB-PIC: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-call_nonpic" "-EB"
 // MIPS32R2-EB-PIC: "-KPIC"
 //
 // RUN: %clang -target mipsel-linux-gnu -### \





More information about the llvm-branch-commits mailing list