aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <alexshap@fb.com>2021-02-11 13:46:49 -0800
committerAlexander Shaposhnikov <alexshap@fb.com>2021-02-16 17:52:12 -0800
commitcdcb60a820571f7384920fb534ce23e7568bfc03 (patch)
treee31f8b935204a90ee3b6802e59f33f15ea89fd2c /llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
parentc62b737ad655f189cf76f4324ba04317133d6648 (diff)
downloadllvm-cdcb60a820571f7384920fb534ce23e7568bfc03.zip
llvm-cdcb60a820571f7384920fb534ce23e7568bfc03.tar.gz
llvm-cdcb60a820571f7384920fb534ce23e7568bfc03.tar.bz2
[llvm-libtool] Emit warnings for files without symbols
1. Emit warnings for files without symbols. 2. Add -no_warning_for_no_symbols. Test plan: make check-all Differential revision: https://reviews.llvm.org/D95843
Diffstat (limited to 'llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp')
-rw-r--r--llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
index 1ff6328e..0217364 100644
--- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
+++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
@@ -89,6 +89,11 @@ static cl::opt<bool>
VersionOption("V", cl::desc("Print the version number and exit"),
cl::cat(LibtoolCategory));
+static cl::opt<bool> NoWarningForNoSymbols(
+ "no_warning_for_no_symbols",
+ cl::desc("Do not warn about files that have no symbols"),
+ cl::cat(LibtoolCategory), cl::init(false));
+
static const std::array<std::string, 3> StandardSearchDirs{
"/lib",
"/usr/lib",
@@ -251,6 +256,9 @@ static Error verifyAndAddMachOObject(MembersPerArchitectureMap &Members,
return Error::success();
}
+ if (!NoWarningForNoSymbols && O->symbols().empty())
+ WithColor::warning() << Member.MemberName + " has no symbols\n";
+
uint64_t FileCPUID = getCPUID(FileCPUType, FileCPUSubtype);
Members[FileCPUID].push_back(std::move(Member));
return Error::success();