summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-07-03 20:42:10 +0000
committerBob Wilson <bob.wilson@apple.com>2012-07-03 20:42:10 +0000
commit1e148fe064bbb65ae1fcdc893db0e7af781ad20b (patch)
tree5c5f90b7f30453484a770018818972f88599355d /clang/lib
parentfa6d73cc900334ae55bdd518315655613ebad4ad (diff)
downloadbcm5719-llvm-1e148fe064bbb65ae1fcdc893db0e7af781ad20b.tar.gz
bcm5719-llvm-1e148fe064bbb65ae1fcdc893db0e7af781ad20b.zip
When using -pg targeting OS X 10.8, pass -no_new_main to the linker.
By default on OS X 10.8, we don't link with a crt1.o file and the linker knows to use _main as the entry point. But, when compiling with -pg, we need to link with the gcrt1.o file, and the linker needs to be told to use the "start" symbol as the entry point. The -no_new_main linker option does that last part. <rdar://problem/11491405> llvm-svn: 159683
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index c5a837f3d1e..601ea54c295 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4341,6 +4341,9 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
// darwin_crt2 spec is empty.
}
+ if (getDarwinToolChain().isTargetMacOS() &&
+ !getDarwinToolChain().isMacosxVersionLT(10, 8))
+ CmdArgs.push_back("-no_new_main");
} else {
if (Args.hasArg(options::OPT_static) ||
Args.hasArg(options::OPT_object) ||
OpenPOWER on IntegriCloud