[cfe-commits] r65104 - in /cfe/trunk/tools/ccc: ccclib/HostInfo.py ccclib/ToolChain.py ccclib/Tools.py test/ccc/universal-hello.c
Daniel Dunbar
daniel at zuster.org
Thu Feb 19 17:48:01 PST 2009
Author: ddunbar
Date: Thu Feb 19 19:48:01 2009
New Revision: 65104
URL: http://llvm.org/viewvc/llvm-project?rev=65104&view=rev
Log:
ccc: Use toolChain arch name instead of looking for arch command line
argument; the toolchain should always know the arch.
- Fixes: <rdar://problem/6582911> -ccc-clang-archs doesn't work for excluding ppc
Modified:
cfe/trunk/tools/ccc/ccclib/HostInfo.py
cfe/trunk/tools/ccc/ccclib/ToolChain.py
cfe/trunk/tools/ccc/ccclib/Tools.py
cfe/trunk/tools/ccc/test/ccc/universal-hello.c
Modified: cfe/trunk/tools/ccc/ccclib/HostInfo.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/HostInfo.py?rev=65104&r1=65103&r2=65104&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/HostInfo.py (original)
+++ cfe/trunk/tools/ccc/ccclib/HostInfo.py Thu Feb 19 19:48:01 2009
@@ -47,7 +47,7 @@
self.darwinVersion,
self.gccVersion)
- return ToolChain.Generic_GCC_ToolChain(self.driver, '')
+ return ToolChain.Generic_GCC_ToolChain(self.driver, arch)
class DarwinPPCHostInfo(DarwinHostInfo):
def getArchName(self, args):
Modified: cfe/trunk/tools/ccc/ccclib/ToolChain.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/ToolChain.py?rev=65104&r1=65103&r2=65104&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/ToolChain.py (original)
+++ cfe/trunk/tools/ccc/ccclib/ToolChain.py Thu Feb 19 19:48:01 2009
@@ -74,6 +74,12 @@
if self.driver.cccNoClangCXX:
if action.inputs[0].type in Types.cxxTypesSet:
return False
+
+ # Don't use clang if this isn't one of the user specified
+ # archs to build.
+ if (self.driver.cccClangArchs and
+ self.archName not in self.driver.cccClangArchs):
+ return False
return True
@@ -131,18 +137,6 @@
major,minor,minorminor = self.darwinVersion
return '%d.%d.%d' % (10, major-4, minor)
- def shouldUseClangCompiler(self, action):
- if not super(Darwin_X86_ToolChain, self).shouldUseClangCompiler(action):
- return False
-
- # Only use clang if user didn't override archs, or this is one
- # of the ones they provided.
- if (not self.driver.cccClangArchs or
- self.archName in self.driver.cccClangArchs):
- return True
-
- return False
-
def selectTool(self, action):
assert isinstance(action, Phases.JobAction)
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=65104&r1=65103&r2=65104&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Thu Feb 19 19:48:01 2009
@@ -37,8 +37,13 @@
cmd_args.extend(arglist.render(arg))
cmd_args.extend(self.getGCCExtraArgs())
- if arch:
- cmd_args.extend(arglist.render(arch))
+
+ # If using a driver driver, force the arch.
+ if self.toolChain.driver.hostInfo.useDriverDriver():
+ # FIXME: Remove this branch once ok.
+ cmd_args.append('-arch')
+ cmd_args.append(self.toolChain.archName)
+
if isinstance(output, Jobs.PipedJob):
cmd_args.extend(['-o', '-'])
elif isinstance(phase.phase, Phases.SyntaxOnlyPhase):
@@ -141,8 +146,9 @@
cmd_args.append('--gstabs')
# Derived from asm spec.
- if arch:
- cmd_args.extend(arglist.render(arch))
+ cmd_args.append('-arch')
+ cmd_args.append(self.toolChain.archName)
+
cmd_args.append('-force_cpusubtype_ALL')
if (arglist.getLastArg(arglist.parser.m_kernelOption) or
arglist.getLastArg(arglist.parser.staticOption) or
@@ -252,13 +258,11 @@
not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption)))
# FIXME: This needs to tie into a platform hook.
- if arch:
- archName = arglist.getValue(arch)
- if (archName == 'x86_64' or
- picEnabled):
- cmd_args.append('--relocation-model=pic')
- elif not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption):
- cmd_args.append('--relocation-model=static')
+ if (self.toolChain.archName == 'x86_64' or
+ picEnabled):
+ cmd_args.append('--relocation-model=pic')
+ elif not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption):
+ cmd_args.append('--relocation-model=static')
if arglist.getLastArg(arglist.parser.f_timeReportOption):
cmd_args.append('--time-passes')
@@ -353,8 +357,10 @@
for arg in arglist.getArgs(arglist.parser.XclangOption):
cmd_args.extend(arglist.getValues(arg))
- if arch is not None:
- cmd_args.extend(arglist.render(arch))
+ # FIXME: We should always pass this once it is always known.
+ if self.toolChain.archName:
+ cmd_args.append('-arch')
+ cmd_args.append(self.toolChain.archName)
if isinstance(output, Jobs.PipedJob):
cmd_args.extend(['-o', '-'])
@@ -583,7 +589,7 @@
arglist.addLastArg(cmd_args, arglist.parser.POption)
# FIXME: Handle %I properly.
- if arglist.getValue(arch) == 'x86_64':
+ if self.toolChain.archName == 'x86_64':
cmd_args.append('-imultilib')
cmd_args.append('x86_64')
@@ -796,13 +802,7 @@
def addDarwinArch(self, cmd_args, arch, arglist):
# Derived from darwin_arch spec.
cmd_args.append('-arch')
- # FIXME: The actual spec uses -m64 for this, but we want to
- # respect arch. Figure out what exactly gcc is doing.
- #if arglist.getLastArg(arglist.parser.m_64Option):
- if arglist.getValue(arch) == 'x86_64':
- cmd_args.append('x86_64')
- else:
- cmd_args.append('i386')
+ cmd_args.append(self.toolChain.archName)
def addDarwinSubArch(self, cmd_args, arch, arglist):
# Derived from darwin_subarch spec, not sure what the
@@ -1109,7 +1109,7 @@
# FIXME: Derive these correctly.
tcDir = self.toolChain.getToolChainDir()
- if arglist.getValue(arch) == 'x86_64':
+ if self.toolChain.archName == 'x86_64':
cmd_args.extend(["-L/usr/lib/gcc/%s/x86_64" % tcDir,
"-L/usr/lib/gcc/%s/x86_64" % tcDir])
cmd_args.extend(["-L/usr/lib/%s" % tcDir,
Modified: cfe/trunk/tools/ccc/test/ccc/universal-hello.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/test/ccc/universal-hello.c?rev=65104&r1=65103&r2=65104&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/test/ccc/universal-hello.c (original)
+++ cfe/trunk/tools/ccc/test/ccc/universal-hello.c Thu Feb 19 19:48:01 2009
@@ -5,7 +5,10 @@
// RUN: %t | grep "Hello, World" &&
// Check that multiple archs are handled properly.
-// RUN: xcc -ccc-print-phases -### -arch ppc -arch ppc %s | grep linker- | count 1
+// RUN: xcc -ccc-print-phases -### -arch ppc -arch ppc %s | grep linker- | count 1 &&
+
+// Check that -ccc-clang-archs is honored.
+// RUN: xcc -ccc-clang-archs i386 -### -arch ppc -arch i386 %s 2>&1 | grep clang | count 1
int main() {
printf("Hello, World!\n");
More information about the cfe-commits
mailing list