[all-commits] [llvm/llvm-project] 1fe126: [dyndbg][LLD][ELF] Initial LLD support for dynamic...

Andrew Ng via All-commits all-commits at lists.llvm.org
Fri Sep 11 06:49:18 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fe126ef2d6330b7459704e28b2cb3f9bb92b63c
      https://github.com/llvm/llvm-project/commit/1fe126ef2d6330b7459704e28b2cb3f9bb92b63c
  Author: Andrew Ng <andrew.ng at sony.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M lld/Common/CommonLinkerContext.cpp
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    M lld/ELF/LinkerScript.cpp
    M lld/ELF/MarkLive.cpp
    M lld/ELF/Relocations.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/SyntheticSections.h
    M lld/ELF/Writer.cpp
    A lld/test/ELF/dynamic-debug.test
    A lld/test/ELF/invalid-dynamic-debug.test
    A lld/test/ELF/trace-symbols-dynamic-debug.test
    M llvm/include/llvm/BinaryFormat/ELF.h

  Log Message:
  -----------
  [dyndbg][LLD][ELF] Initial LLD support for dynamic debugging (#214188)

LLVM's Dynamic Debugging feature (`llvm/docs/DynamicDebugging.md`)
generates optimized relocatable files with an unoptimized relocatable
copy of the functions from its translation unit embedded in a
`SHT_LLVM_DYNDBG_ELF` section named `.debug_llvm_dyndbg`. The
unoptimized functions in the "inner" embedded relocatable reference the
functions and data of the "outer" optimized relocatable.

When LLD encounters dynamic debugging objects, a nested "inner"
relocatable link is run with the embedded "inner" unoptimized objects.
The output is embedded in a `SHT_LLVM_DYNDBG_ELF` section named
`.debug_llvm_dyndbg` and described by an `NT_LLVM_DYNAMIC_DEBUGGING`
note in the "outer" output. The "inner" relocatable link more closely
resembles a final link rather than a regular relocatable `-r` one,
unless the "outer" link is itself a relocatable `-r` link.

The embedded "inner" objects' undefined symbols are added to the "outer"
symbol table so that the "outer" link resolves the dependencies of the
"inner" relocatable link. Symbols referenced by "inner" relocations from
an allocated section are assigned a PLT/GOT entry as appropriate and are
diagnosed when unresolved. In this initial implementation, these symbols
also act as `--gc-sections` roots for the "outer" link and
`--gc-sections` is not supported for the "inner" relocatable link.

ICF is disabled so that individual functions can be patched when
debugging with dynamic debugging without affecting other identical
functions.

RFC: https://discourse.llvm.org/t/90113



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list