[lld] [ELF] Fix unnecessary inclusion of unreferenced provide symbols (PR #84512)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 20:16:14 PDT 2024


================
@@ -2659,6 +2659,58 @@ static void postParseObjectFile(ELFFileBase *file) {
   }
 }
 
+// Returns true if the provide symbol should be added to the link.
+bool shouldAddProvideSym(StringRef symName) {
+  Symbol *b = symtab.find(symName);
+  return b && !b->isDefined() && !b->isCommon();
+}
+
+// Add symbols referred by the provide symbol to the symbol table.
+// This function must only be called for provide symbols that should be added
+// to the link.
+static void
+addProvideSymReferences(StringRef provideSym,
+                        llvm::StringSet<> &addedRefsFromProvideSym) {
+
----------------
MaskRay wrote:

delete blank line

https://github.com/llvm/llvm-project/pull/84512


More information about the llvm-commits mailing list