[cfe-commits] r171329 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/openbsd.c
Rafael Espindola
rafael.espindola at gmail.com
Mon Dec 31 14:41:36 PST 2012
Author: rafael
Date: Mon Dec 31 16:41:36 2012
New Revision: 171329
URL: http://llvm.org/viewvc/llvm-project?rev=171329&view=rev
Log:
Silence some warnings and allow passing down some feature flags to the linker.
Patch by Brad Smith.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/openbsd.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=171329&r1=171328&r2=171329&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 31 16:41:36 2012
@@ -4682,6 +4682,14 @@
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
+ // Silence warning for "clang -g foo.o -o foo"
+ Args.ClaimAllArgs(options::OPT_g_Group);
+ // and "clang -emit-llvm foo.o -o foo"
+ Args.ClaimAllArgs(options::OPT_emit_llvm);
+ // and for "clang -w foo.o -o foo". Other warning options are already
+ // handled somewhere else.
+ Args.ClaimAllArgs(options::OPT_w);
+
if ((!Args.hasArg(options::OPT_nostdlib)) &&
(!Args.hasArg(options::OPT_shared))) {
CmdArgs.push_back("-e");
@@ -4736,6 +4744,10 @@
Args.AddAllArgs(CmdArgs, options::OPT_L);
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
Args.AddAllArgs(CmdArgs, options::OPT_e);
+ Args.AddAllArgs(CmdArgs, options::OPT_s);
+ Args.AddAllArgs(CmdArgs, options::OPT_t);
+ Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
+ Args.AddAllArgs(CmdArgs, options::OPT_r);
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=171329&r1=171328&r2=171329&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Mon Dec 31 16:41:36 2012
@@ -7,3 +7,21 @@
// RUN: | FileCheck --check-prefix=CHECK-PG %s
// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o"
+
+// Check that the new linker flags are passed to OpenBSD
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -r %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-R %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -s %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-S %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -t %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-T %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -Z %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-Z %s
+// CHECK-LD-R: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD-R: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-r" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// CHECK-LD-S: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD-S: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-s" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// CHECK-LD-T: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD-T: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-t" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// CHECK-LD-Z: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD-Z: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-Z" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
More information about the cfe-commits
mailing list