diff options
-rw-r--r-- | lib/Driver/Tools.cpp | 3 | ||||
-rw-r--r-- | test/Driver/darwin-ld.c | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c5a837f3d1..601ea54c29 100644 --- a/lib/Driver/Tools.cpp +++ b/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) || diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index 3206f654d5..4cda37f9b2 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -121,3 +121,8 @@ // RUN: %clang -target x86_64-apple-darwin12 -### %t.o 2> %t.log // RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log // LINK_NO_CRT1-NOT: crt + +// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log +// LINK_PG: -lgcrt1.o +// LINK_PG: -no_new_main |