[PATCH] On {mips, mipsel, mips64, mips64el}-freebsd, we need to pass any -G option to the assembler.

Brooks Davis brooks at one-eyed-alien.net
Fri May 29 14:10:08 PDT 2015


Hi emaste, theraven, atanasyan,

See also:
https://sourceware.org/binutils/docs/as/MIPS-Options.html#index-g_t_0040code_007b_002dG_007d-option-_0028MIPS_0029-1392

http://reviews.llvm.org/D10137

Files:
  lib/Driver/Tools.cpp
  test/Driver/freebsd.c

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6742,6 +6742,12 @@
     else
       CmdArgs.push_back("-EL");
 
+  if (Arg *A = Args.getLastArg(options::OPT_G)) {
+    StringRef v = A->getValue();
+    CmdArgs.push_back(Args.MakeArgString("-G" + v));
+    A->claim();
+  }
+
     addAssemblerKPIC(Args, CmdArgs);
   } else if (getToolChain().getArch() == llvm::Triple::arm ||
              getToolChain().getArch() == llvm::Triple::armeb ||
Index: test/Driver/freebsd.c
===================================================================
--- test/Driver/freebsd.c
+++ test/Driver/freebsd.c
@@ -140,3 +140,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-SPARC-CPU %s
 // CHECK-SPARC-CPU: cc1{{.*}}" "-target-cpu" "ultrasparc"
 // CHECK-SPARC-CPU: as{{.*}}" "-Av9a
+
+// RUN: %clang -mcpu=ultrasparc -target mips-unknown-freebsd8 %s -G0 -### -no-integrated-as 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-AS-G0 %s
+// CHECK-MIPS-AS-G0: as{{.*}}" "-G0

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10137.26819.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150529/cd9d1d96/attachment.bin>


More information about the cfe-commits mailing list