const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
- CmdArgs.push_back("--hash-style=both");
- CmdArgs.push_back("--enable-new-dtags");
+
+ // 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 (!D.SysRoot.empty())
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
CmdArgs.push_back("-dynamic-linker");
CmdArgs.push_back("/libexec/ld-elf.so.1");
}
+ if (getToolChain().getTriple().getOSMajorVersion() >= 9) {
+ llvm::Triple::ArchType Arch = getToolChain().getArch();
+ if (Arch == llvm::Triple::arm || Arch == llvm::Triple::sparc ||
+ Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) {
+ CmdArgs.push_back("--hash-style=both");
+ }
+ }
+ CmdArgs.push_back("--enable-new-dtags");
}
// When building 32-bit code on FreeBSD/amd64, we have to explicitly
Args.ClaimAllArgs(options::OPT_g_Group);
// and "clang -emit-llvm foo.o -o foo"
Args.ClaimAllArgs(options::OPT_emit_llvm);
- // and for "clang -g foo.o -o foo". Other warning options are already
+ // and for "clang -w foo.o -o foo". Other warning options are already
// handled somewhere else.
Args.ClaimAllArgs(options::OPT_w);
// Check that the new linker flags are passed to FreeBSD
// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \
// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS %s
-// CHECK-LDFLAGS: --hash-style=both
-// CHECK-LDFLAGS: --enable-new-dtags
+// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS8 %s
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd9 -m32 %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd10.0 -m32 %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s
+// CHECK-LDFLAGS8-NOT: --hash-style=both
+// CHECK-LDFLAGS8: --enable-new-dtags
+// CHECK-LDFLAGS9: --hash-style=both
+// CHECK-LDFLAGS9: --enable-new-dtags