[cfe-commits] r62081 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py Tools.py
Daniel Dunbar
daniel at zuster.org
Sun Jan 11 23:40:26 PST 2009
Author: ddunbar
Date: Mon Jan 12 01:40:25 2009
New Revision: 62081
URL: http://llvm.org/viewvc/llvm-project?rev=62081&view=rev
Log:
ccc: Implement the rest of Darwin/Assembler argument translation.
Modified:
cfe/trunk/tools/ccc/ccclib/Arguments.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=62081&r1=62080&r2=62081&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Mon Jan 12 01:40:25 2009
@@ -146,6 +146,9 @@
def getValue(self, args):
abstract
+ def getValues(self, args):
+ return [self.getValue(args)]
+
class PositionalArg(ValueArg):
"""PositionalArg - A simple positional argument."""
@@ -262,6 +265,16 @@
if arg.opt is option:
yield arg
+ def getArgs2(self, optionA, optionB):
+ """getArgs2 - Iterate over all arguments for two options, in
+ the order they were specified."""
+ # As long as getArgs is efficient, we can easily make this
+ # efficient by iterating both at once and always taking the
+ # earlier arg.
+ for arg in self.args:
+ if arg.opt in (optionA, optionB):
+ yield arg
+
def getLastArg(self, option):
return self.lastArgs.get(option)
@@ -430,8 +443,8 @@
# Blanket pass-through options.
- self.addOption(CommaJoinedOption('-Wa,'))
- self.addOption(SeparateOption('-Xassembler'))
+ self.WaOption = self.addOption(CommaJoinedOption('-Wa,'))
+ self.XassemblerOption = self.addOption(SeparateOption('-Xassembler'))
self.addOption(CommaJoinedOption('-Wp,'))
self.addOption(SeparateOption('-Xpreprocessor'))
@@ -600,8 +613,12 @@
# FIXME: Naming convention.
self.dOption = self.addOption(FlagOption('-d'))
self.addOption(JoinedOption('-d'))
- self.addOption(JoinedOption('-g'))
+ # Take care on extension, the Darwin assembler wants to add a
+ # flag for any -g* option.
+ self.gOption = self.addOption(JoinedOption('-g'))
+
+ self.f_appleKextOption = self.addOption(FlagOption('-fapple-kext'))
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions'))
self.f_objcOption = self.addOption(FlagOption('-fobjc'))
self.f_openmpOption = self.addOption(FlagOption('-fopenmp'))
@@ -619,6 +636,7 @@
self.m_64Option = self.addOption(FlagOption('-m64'))
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'))
# Ugh. Need to disambiguate our naming convetion. -m x goes to
# the linker sometimes, wheres -mxxxx is used for a variety of
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62081&r1=62080&r2=62081&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Mon Jan 12 01:40:25 2009
@@ -112,14 +112,32 @@
input = inputs[0]
cmd_args = []
+
+ if arglist.getLastArg(arglist.parser.gOption):
+ cmd_args.append('--gstabs')
+
+ # Derived from asm spec.
if arch:
cmd_args.extend(arglist.render(arch))
cmd_args.append('-force_cpusubtype_ALL')
cmd_args.extend(arglist.render(output))
+ if (arglist.getLastArg(arglist.parser.m_kernelOption) or
+ arglist.getLastArg(arglist.parser.staticOption) or
+ arglist.getLastArg(arglist.parser.f_appleKextOption)):
+ if not arglist.getLastArg(arglist.parser.ZdynamicOption):
+ cmd_args.append('-static')
+
+ for arg in arglist.getArgs2(arglist.parser.WaOption,
+ arglist.parser.XassemblerOption):
+ cmd_args.extend(arglist.getValues(arg))
+
if isinstance(input.source, Jobs.PipedJob):
cmd_args.append('-')
else:
cmd_args.extend(arglist.renderAsInput(input.source))
+
+ # asm_final spec is empty.
+
jobs.addJob(Jobs.Command('as', cmd_args))
class GCC_AssembleTool(GCC_Common_Tool):
More information about the cfe-commits
mailing list