]> granicus.if.org Git - clang/commitdiff
ccc: Darwin/X86: Implement remainder of (non -Z...) generic argument
authorDaniel Dunbar <daniel@zuster.org>
Fri, 16 Jan 2009 20:25:36 +0000 (20:25 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 16 Jan 2009 20:25:36 +0000 (20:25 +0000)
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'. ;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62353 91177308-0d34-0410-b5e6-96231b3b80d8

tools/ccc/ccclib/Arguments.py
tools/ccc/ccclib/ToolChain.py
tools/ccc/ccclib/Tools.py

index a3c25f197bec04e605a564820dbbaf5962cb9976..4a7581a7a19d9421ccd13b38b4b6358de3e5c762 100644 (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))
index 8511328512030550e1d53e60aa3a18b2a1820015..7ca1257f496619c5158d710b88d98885816545a8 100644 (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))
index a12c84a155188b85e49879972b84294f460f66eb..ce87d38255c2f6b802b702d9e726e7ecbb6ba973 100644 (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