From: Roman Divacky Date: Mon, 10 Oct 2011 19:47:45 +0000 (+0000) Subject: Link in Scrt1.o instead of crt1.o when -pie is specified. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8642f21ca7b5963293a5424de7fe158305ae5229;p=clang Link in Scrt1.o instead of crt1.o when -pie is specified. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141573 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 648da87c8e..2b4b9f1791 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3929,9 +3929,11 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_pg)) CmdArgs.push_back(Args.MakeArgString( getToolChain().GetFilePath("gcrt1.o"))); - else + else { + const char *crt = Args.hasArg(options::OPT_pie) ? "Scrt1.o" : "crt1.o"; CmdArgs.push_back(Args.MakeArgString( - getToolChain().GetFilePath("crt1.o"))); + getToolChain().GetFilePath(crt))); + } CmdArgs.push_back(Args.MakeArgString( getToolChain().GetFilePath("crti.o"))); CmdArgs.push_back(Args.MakeArgString(