[PATCH] D118867: [llvm-libtool-darwin] Improve warning message for no symbols

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 17:22:41 PST 2022


keith created this revision.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This more closely mirrors apple's libtool, and also potentially makes it
clearer for multi-arch archives where the issue lies.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118867

Files:
  llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
  llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp


Index: llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
===================================================================
--- llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
+++ llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
@@ -361,8 +361,9 @@
 
       auto *O = dyn_cast<MachOObjectFile>(ObjOrErr->get());
       uint32_t FileCPUType, FileCPUSubtype;
+      StringRef ArchName = O->getArchTriple().getArchName();
       std::tie(FileCPUType, FileCPUSubtype) = MachO::getCPUTypeFromArchitecture(
-          MachO::getArchitectureFromName(O->getArchTriple().getArchName()));
+          MachO::getArchitectureFromName(ArchName));
 
       // If -arch_only is specified then skip this file if it doesn't match
       // the architecture specified.
@@ -371,7 +372,7 @@
       }
 
       if (!NoWarningForNoSymbols && O->symbols().empty())
-        WithColor::warning() << Member.MemberName + " has no symbols\n";
+        WithColor::warning() << "for architecture " + ArchName + " file: '" + Member.MemberName + "' has no symbols\n";
 
       uint64_t FileCPUID = getCPUID(FileCPUType, FileCPUSubtype);
       Builder.Data.MembersPerArchitecture[FileCPUID].push_back(
Index: llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
===================================================================
--- llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
+++ llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
@@ -9,7 +9,7 @@
 # RUN: llvm-libtool-darwin -static -o %t.lib %t-x86_64-empty.o 2>&1 | \
 # RUN:   FileCheck --check-prefix=WARNING %s -DPREFIX=%basename_t.tmp
 
-# WARNING: warning: [[PREFIX]]-x86_64-empty.o has no symbols
+# WARNING: warning: for architecture x86_64 file: '[[PREFIX]]-x86_64-empty.o' has no symbols
 
 # RUN: llvm-libtool-darwin -no_warning_for_no_symbols -static -o %t.lib \
 # RUN:   %t-x86_64-empty.o 2>&1 | \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118867.405504.patch
Type: text/x-patch
Size: 1883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220203/509807ef/attachment.bin>


More information about the llvm-commits mailing list