[PATCH] D92455: [lld-macho] Error out if we encounter a HelpHidden flag in tests

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 20:31:11 PST 2020


int3 created this revision.
int3 added reviewers: lld-macho, thakis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
int3 requested review of this revision.

@thakis caught a bunch of implemented flags for which HelpHidden wasn't
removed. This diff ensures that we prevent those issues going ahead.

I initially considered making `%lld` expand to include
`-fatal_warnings`, but that would've made testing for desired warnings
more awkward. Hence this approach.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92455

Files:
  lld/MachO/Driver.cpp
  lld/test/MachO/load-commands.s
  lld/test/MachO/x86-64-reloc-unsigned.s


Index: lld/test/MachO/x86-64-reloc-unsigned.s
===================================================================
--- lld/test/MachO/x86-64-reloc-unsigned.s
+++ lld/test/MachO/x86-64-reloc-unsigned.s
@@ -3,11 +3,11 @@
 # RUN: %lld -o %t %t.o
 # RUN: llvm-objdump --macho --rebase --full-contents %t | FileCheck %s
 
-# RUN: %lld -fatal_warnings -pie -o %t-pie %t.o
+# RUN: %lld -pie -o %t-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-pie | FileCheck %s --check-prefix=PIE
-# RUN: %lld -fatal_warnings -pie -no_pie -o %t-no-pie %t.o
+# RUN: %lld -pie -no_pie -o %t-no-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-no-pie | FileCheck %s --check-prefix=NO-PIE
-# RUN: %lld -fatal_warnings -no_pie -pie -o %t-no-pie %t.o
+# RUN: %lld -no_pie -pie -o %t-no-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-no-pie | FileCheck %s --check-prefix=NO-PIE
 
 # RUN: %lld -platform_version macos 10.6.0 11.0 -o %t-pie %t.o
Index: lld/test/MachO/load-commands.s
===================================================================
--- lld/test/MachO/load-commands.s
+++ lld/test/MachO/load-commands.s
@@ -2,9 +2,9 @@
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
 # RUN: %lld -o %t/executable %t/test.o
-# RUN: %lld -fatal_warnings -execute -o %t/explicit-executable %t/test.o
-# RUN: %lld -fatal_warnings -bundle -o %t/bundle %t/test.o
-# RUN: %lld -fatal_warnings -dylib -o %t/dylib %t/test.o
+# RUN: %lld -execute -o %t/explicit-executable %t/test.o
+# RUN: %lld -bundle -o %t/bundle %t/test.o
+# RUN: %lld -dylib -o %t/dylib %t/test.o
 
 ## These load commands should be in every final output binary.
 # COMMON-DAG: cmd LC_DYLD_INFO_ONLY
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -556,8 +556,13 @@
     warn("Option `" + opt.getPrefixedName() + "' is ignored.");
     break;
   default:
-    warn("Option `" + opt.getPrefixedName() +
-         "' is not yet implemented. Stay tuned...");
+    Twine msg = "Option `" + opt.getPrefixedName() +
+                "' is not yet implemented. Stay tuned...";
+    if (getenv("LLD_IN_TEST"))
+      error(msg);
+    else
+      warn(msg);
+
     break;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92455.308861.patch
Type: text/x-patch
Size: 2271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201202/2a507789/attachment.bin>


More information about the llvm-commits mailing list