ccc: Darwin/X86: Implement remainder of (non -Z...) generic argument

translation.
 - As is my general strategy, this is initially pedantically
   compatible with gcc and can be cleaned up later. So, for example,
   we still pass -static to collect2 4 times if you say '-mkernel
   -fapple-kext'. ;)

llvm-svn: 62353
This commit is contained in:
Daniel Dunbar 2009-01-16 20:25:36 +00:00
parent 762edbc074
commit 1e3677c907
3 changed files with 43 additions and 4 deletions

View File

@ -548,6 +548,7 @@ class OptionParser:
self.client_nameOption = self.addOption(JoinedOrSeparateOption('-client_name'))
self.compatibility_versionOption = self.addOption(JoinedOrSeparateOption('-compatibility_version'))
self.current_versionOption = self.addOption(JoinedOrSeparateOption('-current_version'))
self.dependencyFileOption = self.addOption(SeparateOption('-dependency-file'))
self.dylinkerOption = self.addOption(FlagOption('-dylinker'))
self.dylinker_install_nameOption = self.addOption(JoinedOrSeparateOption('-dylinker_install_name'))
self.addOption(JoinedOrSeparateOption('-exported_symbols_list'))
@ -715,6 +716,8 @@ class OptionParser:
self.addOption(JoinedOption('-d', group=self.dGroup))
self.gGroup = OptionGroup('-g')
self.gfullOption = self.addOption(JoinedOption('-gfull', self.gGroup))
self.gusedOption = self.addOption(JoinedOption('-gused', self.gGroup))
self.gstabsOption = self.addOption(JoinedOption('-gstabs', self.gGroup))
self.g0Option = self.addOption(JoinedOption('-g0', self.gGroup))
self.g3Option = self.addOption(JoinedOption('-g3', self.gGroup))
@ -732,9 +735,11 @@ class OptionParser:
self.f_appleKextOption = self.addOption(FlagOption('-fapple-kext', self.fGroup))
self.f_constantCfstringsOption = self.addOption(FlagOption('-fconstant-cfstrings', self.fGroup))
self.f_createProfileOption = self.addOption(FlagOption('-fcreate-profile', self.fGroup))
self.f_eliminateUnusedDebugSymbolsOption = self.addOption(FlagOption('-feliminate-unused-debug-symbols', self.fGroup))
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions', self.fGroup))
self.f_gnuRuntimeOption = self.addOption(FlagOption('-fgnu-runtime', self.fGroup))
self.f_gnuRuntimeOption = self.addOption(FlagOption('-fgnu-runtime', self.fGroup))
self.f_indirectVirtualCallsOption = self.addOption(FlagOption('-findirect-virtual-calls', self.fGroup))
self.f_laxVectorConversionsOption = self.addOption(FlagOption('-flax-vector-conversions', self.fGroup))
self.f_msExtensionsOption = self.addOption(FlagOption('-fms-extensions', self.fGroup))
self.f_mudflapOption = self.addOption(FlagOption('-fmudflap', self.fGroup))
@ -754,6 +759,7 @@ class OptionParser:
self.f_pieOption = self.addOption(FlagOption('-fpie', self.fGroup))
self.f_profileArcsOption = self.addOption(FlagOption('-fprofile-arcs', self.fGroup))
self.f_profileGenerateOption = self.addOption(FlagOption('-fprofile-generate', self.fGroup))
self.f_terminatedVtablesOption = self.addOption(FlagOption('-fterminated-vtables', self.fGroup))
self.f_traditionalOption = self.addOption(FlagOption('-ftraditional', self.fGroup))
self.f_writableStringsOption = self.addOption(FlagOption('-fwritable-strings', self.fGroup))
self.addOption(JoinedOption('-f', self.fGroup))

View File

@ -95,12 +95,46 @@ class Darwin_X86_ToolChain(ToolChain):
if not arch:
return args
# FIXME: We really want to get out of the tool chain level
# argument translation business, as it makes the driver
# functionality much more opaque. For now, we follow gcc
# closely solely for the purpose of easily achieving feature
# parity & testability. Once we have something that works, we
# should reevaluate each translation and try to push it down
# into tool specific logic.
al = Arguments.DerivedArgList(args)
if not args.getLastArg(args.parser.m_macosxVersionMinOption):
al.append(al.makeJoinedArg(self.getMacosxVersionMin(),
args.parser.m_macosxVersionMinOption))
for arg in args:
if arg.opt is args.parser.f_constantCfstringsOption:
# Sob. These is strictly gcc compatible for the time
# being. Apple gcc translates options twice, which means
# that self-expanding options add duplicates.
if arg.opt is args.parser.m_kernelOption:
al.append(arg)
al.append(al.makeFlagArg(args.parser.staticOption))
al.append(al.makeFlagArg(args.parser.staticOption))
elif arg.opt is args.parser.dependencyFileOption:
al.append(al.makeSeparateArg(args.getValue(arg),
args.parser.MFOption))
elif arg.opt is args.parser.gfullOption:
al.append(al.makeFlagArg(args.parser.gOption))
al.append(al.makeFlagArg(args.parser.f_noEliminateUnusedDebugSymbolsOption))
elif arg.opt is args.parser.gusedOption:
al.append(al.makeFlagArg(args.parser.gOption))
al.append(al.makeFlagArg(args.parser.f_eliminateUnusedDebugSymbolsOption))
elif arg.opt is args.parser.f_appleKextOption:
al.append(arg)
al.append(al.makeFlagArg(args.parser.staticOption))
al.append(al.makeFlagArg(args.parser.staticOption))
elif arg.opt is args.parser.f_terminatedVtablesOption:
al.append(al.makeFlagArg(args.parser.f_appleKextOption))
al.append(al.makeFlagArg(args.parser.staticOption))
elif arg.opt is args.parser.f_indirectVirtualCallsOption:
al.append(al.makeFlagArg(args.parser.f_appleKextOption))
al.append(al.makeFlagArg(args.parser.staticOption))
elif arg.opt is args.parser.f_constantCfstringsOption:
al.append(al.makeFlagArg(args.parser.m_constantCfstringsOption))
elif arg.opt is args.parser.f_noConstantCfstringsOption:
al.append(al.makeFlagArg(args.parser.m_noConstantCfstringsOption))

View File

@ -619,9 +619,8 @@ class Darwin_X86_LinkTool(Tool):
def addLinkArgs(self, cmd_args, arch, arglist):
# Derived from link spec.
if arglist.getLastArg(arglist.parser.staticOption):
cmd_args.append('-static')
else:
arglist.addAllArgs(cmd_args, arglist.parser.staticOption)
if not arglist.getLastArg(arglist.parser.staticOption):
cmd_args.append('-dynamic')
if arglist.getLastArg(arglist.parser.f_gnuRuntimeOption):
# FIXME: Replace -lobjc in forward args with