r187680 - Only use the Darwin linker's -export_dynamic option with supported versions.
Bob Wilson
bob.wilson at apple.com
Fri Aug 2 15:25:34 PDT 2013
Author: bwilson
Date: Fri Aug 2 17:25:34 2013
New Revision: 187680
URL: http://llvm.org/viewvc/llvm-project?rev=187680&view=rev
Log:
Only use the Darwin linker's -export_dynamic option with supported versions.
Related to <rdar://problem/14578094>.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-ld.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=187680&r1=187679&r2=187680&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug 2 17:25:34 2013
@@ -4517,6 +4517,9 @@ void darwin::Link::AddLinkArgs(Compilati
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(Compilat
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());
Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=187680&r1=187679&r2=187680&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Fri Aug 2 17:25:34 2013
@@ -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"
+
+
More information about the cfe-commits
mailing list