[lld] r257907 - Add the GC commandline options and throw errors if they are used

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 09:39:03 PST 2016


Author: pete
Date: Fri Jan 15 11:39:02 2016
New Revision: 257907

URL: http://llvm.org/viewvc/llvm-project?rev=257907&view=rev
Log:
Add the GC commandline options and throw errors if they are used

Added:
    lld/trunk/test/darwin/cmdline-objc_gc.objtxt
    lld/trunk/test/darwin/cmdline-objc_gc_compaction.objtxt
    lld/trunk/test/darwin/cmdline-objc_gc_only.objtxt
Modified:
    lld/trunk/lib/Driver/DarwinLdDriver.cpp
    lld/trunk/lib/Driver/DarwinLdOptions.td

Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=257907&r1=257906&r2=257907&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Fri Jan 15 11:39:02 2016
@@ -673,6 +673,22 @@ bool DarwinLdDriver::parse(llvm::ArrayRe
     }
   }
 
+  // Handle obsolete ObjC options: -objc_gc_compaction, -objc_gc, -objc_gc_only
+  if (parsedArgs.getLastArg(OPT_objc_gc_compaction)) {
+    diagnostics << "error: -objc_gc_compaction is not supported\n";
+    return false;
+  }
+
+  if (parsedArgs.getLastArg(OPT_objc_gc)) {
+    diagnostics << "error: -objc_gc is not supported\n";
+    return false;
+  }
+
+  if (parsedArgs.getLastArg(OPT_objc_gc_only)) {
+    diagnostics << "error: -objc_gc_only is not supported\n";
+    return false;
+  }
+
   // Handle -pie or -no_pie
   if (llvm::opt::Arg *pie = parsedArgs.getLastArg(OPT_pie, OPT_no_pie)) {
     switch (ctx.outputMachOType()) {

Modified: lld/trunk/lib/Driver/DarwinLdOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdOptions.td?rev=257907&r1=257906&r2=257907&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdOptions.td (original)
+++ lld/trunk/lib/Driver/DarwinLdOptions.td Fri Jan 15 11:39:02 2016
@@ -205,3 +205,9 @@ def single_module : Flag<["-"], "single_
      HelpText<"Default for dylibs">, Group<grp_obsolete>;
 def multi_module : Flag<["-"], "multi_module">,
      HelpText<"Unsupported way to build dylibs">, Group<grp_obsolete>;
+def objc_gc_compaction : Flag<["-"], "objc_gc_compaction">,
+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;
+def objc_gc : Flag<["-"], "objc_gc">,
+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;
+def objc_gc_only : Flag<["-"], "objc_gc_only">,
+     HelpText<"Unsupported ObjC GC option">, Group<grp_obsolete>;

Added: lld/trunk/test/darwin/cmdline-objc_gc.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/darwin/cmdline-objc_gc.objtxt?rev=257907&view=auto
==============================================================================
--- lld/trunk/test/darwin/cmdline-objc_gc.objtxt (added)
+++ lld/trunk/test/darwin/cmdline-objc_gc.objtxt Fri Jan 15 11:39:02 2016
@@ -0,0 +1,15 @@
+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc %s 2>&1 | FileCheck %s
+#
+# Test that the -objc_gc is rejected.
+#
+
+# CHECK: error: -objc_gc is not supported
+
+--- !native
+defined-atoms:
+    - name:              _main
+      type:              code
+      scope:             global
+      content:           [ 0x90 ]
+
+...

Added: lld/trunk/test/darwin/cmdline-objc_gc_compaction.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/darwin/cmdline-objc_gc_compaction.objtxt?rev=257907&view=auto
==============================================================================
--- lld/trunk/test/darwin/cmdline-objc_gc_compaction.objtxt (added)
+++ lld/trunk/test/darwin/cmdline-objc_gc_compaction.objtxt Fri Jan 15 11:39:02 2016
@@ -0,0 +1,15 @@
+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_compaction %s 2>&1 | FileCheck %s
+#
+# Test that the -objc_gc_compaction is rejected.
+#
+
+# CHECK: error: -objc_gc_compaction is not supported
+
+--- !native
+defined-atoms:
+    - name:              _main
+      type:              code
+      scope:             global
+      content:           [ 0x90 ]
+
+...

Added: lld/trunk/test/darwin/cmdline-objc_gc_only.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/darwin/cmdline-objc_gc_only.objtxt?rev=257907&view=auto
==============================================================================
--- lld/trunk/test/darwin/cmdline-objc_gc_only.objtxt (added)
+++ lld/trunk/test/darwin/cmdline-objc_gc_only.objtxt Fri Jan 15 11:39:02 2016
@@ -0,0 +1,15 @@
+# RUN: not lld -flavor darwin -arch x86_64 -objc_gc_only %s 2>&1 | FileCheck %s
+#
+# Test that the -objc_gc_only is rejected.
+#
+
+# CHECK: error: -objc_gc_only is not supported
+
+--- !native
+defined-atoms:
+    - name:              _main
+      type:              code
+      scope:             global
+      content:           [ 0x90 ]
+
+...




More information about the llvm-commits mailing list