forked from OSchip/llvm-project
Driver/Darwin: Pass -demangle when linking, if the linker supports it.
llvm-svn: 110873
This commit is contained in:
parent
976a2f54fa
commit
cacb0e2d45
|
@ -2262,6 +2262,22 @@ void darwin::Link::AddLinkArgs(const ArgList &Args,
|
|||
ArgStringList &CmdArgs) const {
|
||||
const Driver &D = getToolChain().getDriver();
|
||||
|
||||
unsigned Version[3] = { 0, 0, 0 };
|
||||
if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
|
||||
bool HadExtra;
|
||||
if (!Driver::GetReleaseVersion(A->getValue(Args), Version[0],
|
||||
Version[1], Version[2], HadExtra) ||
|
||||
HadExtra)
|
||||
D.Diag(clang::diag::err_drv_invalid_version_number)
|
||||
<< A->getAsString(Args);
|
||||
}
|
||||
|
||||
// Newer linkers support -demangle, pass it if supported and not disabled by
|
||||
// the user.
|
||||
if (Version[0] >= 100 && !Args.hasArg(options::OPT_Z_Xlinker__no_demangle)) {
|
||||
CmdArgs.push_back("-demangle");
|
||||
}
|
||||
|
||||
// Derived from the "link" spec.
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_static);
|
||||
if (!Args.hasArg(options::OPT_static))
|
||||
|
|
|
@ -82,3 +82,26 @@
|
|||
//
|
||||
// LINK_EXPLICIT_NO_PIE: ld"
|
||||
// LINK_EXPLICIT_NO_PIE: "-no_pie"
|
||||
|
||||
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \
|
||||
// RUN: -mlinker-version=100 2> %t.log
|
||||
// RUN: FileCheck -check-prefix=LINK_NEWER_DEMANGLE %s < %t.log
|
||||
//
|
||||
// LINK_NEWER_DEMANGLE: ld"
|
||||
// LINK_NEWER_DEMANGLE: "-demangle"
|
||||
|
||||
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \
|
||||
// RUN: -mlinker-version=100 -Wl,--no-demangle 2> %t.log
|
||||
// RUN: FileCheck -check-prefix=LINK_NEWER_NODEMANGLE %s < %t.log
|
||||
//
|
||||
// LINK_NEWER_NODEMANGLE: ld"
|
||||
// LINK_NEWER_NODEMANGLE-NOT: "-demangle"
|
||||
// LINK_NEWER_NODEMANGLE: "-lgcc"
|
||||
|
||||
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \
|
||||
// RUN: -mlinker-version=95 2> %t.log
|
||||
// RUN: FileCheck -check-prefix=LINK_OLDER_NODEMANGLE %s < %t.log
|
||||
//
|
||||
// LINK_OLDER_NODEMANGLE: ld"
|
||||
// LINK_OLDER_NODEMANGLE-NOT: "-demangle"
|
||||
// LINK_OLDER_NODEMANGLE: "-lgcc"
|
||||
|
|
Loading…
Reference in New Issue