зеркало из https://github.com/microsoft/clang-1.git
Provide correct linker command line options on FreeBSD 8 (GNU ld 2.15) and on newer FreeBSD (GNU ld 2.17).
Patch by Dimitry Andric! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b2efdf3e92
Коммит
dfa210b1e1
|
@ -5003,8 +5003,14 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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));
|
||||
|
@ -5021,6 +5027,14 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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
|
||||
|
@ -5432,7 +5446,7 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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);
|
||||
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
// 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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче