PR4766: Don't pass -static to 'as' on x86_64 on Darwin.

Also, do pass -static even with -dynamic on i386.

llvm-svn: 79948
This commit is contained in:
Daniel Dunbar 2009-08-24 22:26:16 +00:00
parent 7c07d5fed8
commit a6b4a3d646
2 changed files with 13 additions and 3 deletions

View File

@ -1277,10 +1277,10 @@ void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName().c_str()));
CmdArgs.push_back("-force_cpusubtype_ALL");
if ((Args.hasArg(options::OPT_mkernel) ||
if (getToolChain().getTriple().getArch() != llvm::Triple::x86_64 &&
(Args.hasArg(options::OPT_mkernel) ||
Args.hasArg(options::OPT_static) ||
Args.hasArg(options::OPT_fapple_kext)) &&
!Args.hasArg(options::OPT_dynamic))
Args.hasArg(options::OPT_fapple_kext)))
CmdArgs.push_back("-static");
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,

View File

@ -0,0 +1,10 @@
// RUN: clang -ccc-host-triple i386-apple-darwin10 -### -x assembler -c %s -static -dynamic 2>%t &&
// RUN: FileCheck -check-prefix=STATIC_AND_DYNAMIC-32 --input-file %t %s
// CHECK-STATIC_AND_DYNAMIC-32: as" "-arch" "i386" "-force_cpusubtype_ALL" "-static" "-o"
// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -x assembler -c %s -static 2>%t &&
// RUN: FileCheck -check-prefix=STATIC-64 --input-file %t %s
// CHECK-STATIC-64: as" "-arch" "x86_64" "-force_cpusubtype_ALL" "-o"