[cfe-commits] r62093 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py ToolChain.py Tools.py
Daniel Dunbar
daniel at zuster.org
Mon Jan 12 10:51:02 PST 2009
Author: ddunbar
Date: Mon Jan 12 12:51:02 2009
New Revision: 62093
URL: http://llvm.org/viewvc/llvm-project?rev=62093&view=rev
Log:
ccc: (Darwin) More argument translation for Darwin/Compile tool.
Modified:
cfe/trunk/tools/ccc/ccclib/Arguments.py
cfe/trunk/tools/ccc/ccclib/ToolChain.py
cfe/trunk/tools/ccc/ccclib/Tools.py
Modified: cfe/trunk/tools/ccc/ccclib/Arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Arguments.py?rev=62093&r1=62092&r2=62093&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Mon Jan 12 12:51:02 2009
@@ -658,6 +658,7 @@
self.fastcpOption = self.addOption(FlagOption('-fastcp'))
self.f_appleKextOption = self.addOption(FlagOption('-fapple-kext'))
+ self.f_noEliminateUnusedDebugSymbolsOption = self.addOption(FlagOption('-fno-eliminate-unused-debug-symbols'))
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions'))
self.f_objcOption = self.addOption(FlagOption('-fobjc'))
self.f_openmpOption = self.addOption(FlagOption('-fopenmp'))
@@ -676,6 +677,7 @@
self.m_32Option = self.addOption(FlagOption('-m32'))
self.m_64Option = self.addOption(FlagOption('-m64'))
+ self.m_dynamicNoPicOption = self.addOption(JoinedOption('-mdynamic-no-pic'))
self.m_iphoneosVersionMinOption = self.addOption(JoinedOption('-miphoneos-version-min='))
self.m_macosxVersionMinOption = self.addOption(JoinedOption('-mmacosx-version-min='))
self.m_kernelOption = self.addOption(FlagOption('-mkernel'))
@@ -697,9 +699,9 @@
# '='.
self._paramOption = self.addOption(SeparateOption('--param'))
- # FIXME: What is this? Seems to do something on Linux. I think
- # only one is valid, but have a log that uses both.
- self.addOption(FlagOption('-pthread'))
+ # FIXME: What is this? I think only one is valid, but have a
+ # log that uses both.
+ self.pthreadOption = self.addOption(FlagOption('-pthread'))
self.addOption(FlagOption('-pthreads'))
def addOption(self, opt):
Modified: cfe/trunk/tools/ccc/ccclib/ToolChain.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/ToolChain.py?rev=62093&r1=62092&r2=62093&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/ToolChain.py (original)
+++ cfe/trunk/tools/ccc/ccclib/ToolChain.py Mon Jan 12 12:51:02 2009
@@ -39,6 +39,10 @@
# FIXME: Implement proper search.
return '/usr/libexec/gcc/%s/%s' % (self.getToolChainDir(), name)
+ def getMacosxVersionMin(self):
+ major,minor,minorminor = self.darwinVersion
+ return '%d.%d.%d' % (10, major-4, minor)
+
def selectTool(self, action):
assert isinstance(action, Phases.JobAction)
return self.toolMap[action.phase.__class__]
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62093&r1=62092&r2=62093&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Mon Jan 12 12:51:02 2009
@@ -174,6 +174,51 @@
Tool.eFlagsIntegratedCPP))
self.toolChain = toolChain
+ def addCPPArgs(self, cmd_args, arch, arglist):
+ # Derived from cpp spec.
+
+ # FIXME: The gcc spec is broken here, it refers to dynamic but
+ # that has been translated.
+ if arglist.getLastArg(arglist.parser.staticOption):
+ if not arglist.getLastArg(arglist.parser.ZdynamicOption):
+ cmd_args.append('-D__STATIC__')
+ else:
+ cmd_args.append('-D__DYNAMIC__')
+
+ if arglist.getLastArg(arglist.parser.pthreadOption):
+ cmd_args.append('-D_REENTRANT')
+
+ def addCC1Args(self, cmd_args, arch, arglist):
+ # Derived from cc1 spec.
+
+ # FIXME: -fapple-kext seems to disable this too. Investigate.
+ if (not arglist.getLastArg(arglist.parser.m_kernelOption) and
+ not arglist.getLastArg(arglist.parser.staticOption) and
+ not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption)):
+ cmd_args.append('-fPIC')
+
+ # FIXME: Remove mthumb
+ # FIXME: Remove mno-thumb
+
+ # FIXME: As with ld, something else is going on. My best guess
+ # is gcc is faking an -mmacosx-version-min
+ # somewhere. Investigate.
+ if (not arglist.getLastArg(arglist.parser.m_macosxVersionMinOption) and
+ not arglist.getLastArg(arglist.parser.m_iphoneosVersionMinOption)):
+ cmd_args.append('-mmacosx-version-min=' +
+ self.toolChain.getMacosxVersionMin())
+
+ # FIXME: Remove faltivec
+ # FIXME: Remove mno-fused-madd
+ # FIXME: Remove mlong-branch
+ # FIXME: Remove mlongcall
+ # FIXME: Remove mcpu=G4
+ # FIXME: Remove mcpu=G5
+
+ if (arglist.getLastArg(arglist.parser.gOption) and
+ not arglist.getLastArg(arglist.parser.f_noEliminateUnusedDebugSymbolsOption)):
+ cmd_args.append('-feliminate-unused-debug-symbols')
+
def constructJob(self, phase, arch, jobs, inputs,
output, outputType, args, arglist):
inputType = inputs[0].type
@@ -270,7 +315,7 @@
cmd_args.append('-dD')
arglist.addLastArg(cmd_args, arglist.parser.HOption)
- # FIXME: %C
+ self.addCPPArgs(cmd_args, arch, arglist)
arglist.addAllArgs3(cmd_args,
arglist.parser.DOption,
@@ -316,7 +361,7 @@
arglist.getLastArg(arglist.parser.f_omitFramePointerOption)):
raise ValueError,"-pg and -fomit-frame-pointer are incompatible"
- # FIXME: cc1 spec
+ self.addCC1Args(cmd_args, arch, arglist)
if not arglist.getLastArg(arglist.parser.QOption):
cmd_args.append('-quiet')
@@ -393,10 +438,6 @@
super(Darwin_X86_LinkTool, self).__init__('collect2')
self.toolChain = toolChain
- def getMacosxVersionMin(self):
- major,minor,minorminor = self.toolChain.darwinVersion
- return '%d.%d.%d' % (10, major-4, minor)
-
def getMacosxVersionTuple(self, arglist):
arg = arglist.getLastArg(arglist.parser.m_macosxVersionMinOption)
if arg:
@@ -540,7 +581,7 @@
# following that; it must be getting over-ridden
# somewhere.
cmd_args.append('-macosx_version_min')
- cmd_args.append(self.getMacosxVersionMin())
+ cmd_args.append(self.toolChain.getMacosxVersionMin())
else:
# addAll doesn't make sense here but this is what gcc
# does.
More information about the cfe-commits
mailing list