From: Bob Wilson Date: Fri, 2 Aug 2013 22:25:34 +0000 (+0000) Subject: Only use the Darwin linker's -export_dynamic option with supported versions. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d27dad72851db4f7353387dbc46948dae476b97;p=platform%2Fupstream%2Fllvm.git Only use the Darwin linker's -export_dynamic option with supported versions. Related to . llvm-svn: 187680 --- diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 33e2803..dfaffaa 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4517,6 +4517,9 @@ void darwin::Link::AddLinkArgs(Compilation &C, CmdArgs.push_back("-demangle"); } + if (Args.hasArg(options::OPT_rdynamic) && Version[0] >= 137) + CmdArgs.push_back("-export_dynamic"); + // If we are using LTO, then automatically create a temporary file path for // the linker to use, so that it's lifetime will extend past a possible // dsymutil step. @@ -4724,9 +4727,6 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_ObjC) || Args.hasArg(options::OPT_ObjCXX)) CmdArgs.push_back("-ObjC"); - if (Args.hasArg(options::OPT_rdynamic)) - CmdArgs.push_back("-export_dynamic"); - CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename()); diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c index cd511e0..d6c5170 100644 --- a/clang/test/Driver/darwin-ld.c +++ b/clang/test/Driver/darwin-ld.c @@ -130,3 +130,17 @@ // RUN: FileCheck -check-prefix=LINK_PG %s < %t.log // LINK_PG: -lgcrt1.o // LINK_PG: -no_new_main + +// RUN: %clang -target x86_64-apple-darwin12 -rdynamic -### %t.o \ +// RUN: -mlinker-version=100 2> %t.log +// RUN: FileCheck -check-prefix=LINK_NO_EXPORT_DYNAMIC %s < %t.log +// LINK_NO_EXPORT_DYNAMIC: {{ld(.exe)?"}} +// LINK_NO_EXPORT_DYNAMIC-NOT: "-export_dynamic" + +// RUN: %clang -target x86_64-apple-darwin12 -rdynamic -### %t.o \ +// RUN: -mlinker-version=137 2> %t.log +// RUN: FileCheck -check-prefix=LINK_EXPORT_DYNAMIC %s < %t.log +// LINK_EXPORT_DYNAMIC: {{ld(.exe)?"}} +// LINK_EXPORT_DYNAMIC: "-export_dynamic" + +