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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 14:55:20 PDT 2024


================
@@ -1518,3 +1513,50 @@ void LinkerScript::checkFinalScriptConditions() const {
       checkMemoryRegion(lmaRegion, sec, sec->getLMA());
   }
 }
+
+// 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) {
+  assert(LinkerScript::shouldAddProvideSym(provideSym) &&
----------------
MaskRay wrote:

I am writing a version that uses a stack.

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


More information about the llvm-commits mailing list