[lld] [llvm] [dyndbg][LLD][ELF] Initial LLD support for dynamic debugging (PR #214188)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 09:06:37 PDT 2026
================
@@ -1914,6 +1918,41 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// called after processSymbolAssignments() because it needs to know whether
// a linker-script-defined symbol is absolute.
scanRelocations<ELFT>(ctx);
+
+ // Process symbols referenced by the embedded unoptimized part of dynamic
+ // debugging.
+ if (ctx.hasDynDbg) {
+ bool ignoreUnresolved =
+ (ctx.arg.unresolvedSymbols == UnresolvedPolicy::Ignore);
+ bool warnOnly = (ctx.arg.unresolvedSymbols == UnresolvedPolicy::Warn);
+ for (Symbol *sym : ctx.symtab->getSymbols()) {
+ if (!sym->isDynDbgRef)
+ continue;
+
+ if (sym->isUndefined()) {
+ if (ignoreUnresolved || sym->isWeak())
+ continue;
+
+ static InputSection dummy(ctx.internalFile, dynDbgSecName, 0, 0, 0, 0,
----------------
smithp35 wrote:
For my understanding this presumably comes up when there's a reference from file without dynamic debugging, and a file with dynamic debugging. The symbol records the first so we don't have a dynDbgSec?
I couldn't spot any tests for this case. Would be good to add some in another test file?
https://github.com/llvm/llvm-project/pull/214188
More information about the llvm-commits
mailing list