[PATCH] D57045: [llvm-objcopy] [COFF] Error out on use of unhandled options

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 03:50:53 PST 2019


mstorsjo created this revision.
mstorsjo added reviewers: jhenderson, alexshap, jakehehrlich, rupprecht.

Prefer erroring out than silently not doing what was requested.

The current set of implemented options are the only ones used in my test corpus.


Repository:
  rL LLVM

https://reviews.llvm.org/D57045

Files:
  tools/llvm-objcopy/COFF/COFFObjcopy.cpp


Index: tools/llvm-objcopy/COFF/COFFObjcopy.cpp
===================================================================
--- tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+++ tools/llvm-objcopy/COFF/COFFObjcopy.cpp
@@ -188,6 +188,21 @@
   if (!Config.AddGnuDebugLink.empty())
     addGnuDebugLink(Obj, Config.AddGnuDebugLink);
 
+  if (!Config.BuildIdLinkDir.empty() || Config.BuildIdLinkInput ||
+      Config.BuildIdLinkOutput || !Config.SplitDWO.empty() ||
+      !Config.SymbolsPrefix.empty() || !Config.AddSection.empty() ||
+      !Config.DumpSection.empty() || !Config.KeepSection.empty() ||
+      !Config.SymbolsToGlobalize.empty() || !Config.SymbolsToKeep.empty() ||
+      !Config.SymbolsToLocalize.empty() || !Config.SymbolsToWeaken.empty() ||
+      !Config.SymbolsToKeepGlobal.empty() || !Config.SectionsToRename.empty() ||
+      !Config.SymbolsToRename.empty() || Config.ExtractDWO ||
+      Config.KeepFileSymbols || Config.LocalizeHidden || Config.PreserveDates ||
+      Config.StripDWO || Config.StripNonAlloc || Config.StripSections ||
+      Config.Weaken || Config.DecompressDebugSections) {
+    return createStringError(llvm::errc::invalid_argument,
+                             "Option not supported by llvm-objcopy for COFF");
+  }
+
   return Error::success();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57045.182880.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190122/c3993072/attachment.bin>


More information about the llvm-commits mailing list