[all-commits] [llvm/llvm-project] 704962: [ELF] --retain-symbols-file: keep listed symbols i...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jul 14 00:08:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70496276d0f441999b61e84ca22e59d61fa43582
      https://github.com/llvm/llvm-project/commit/70496276d0f441999b61e84ca22e59d61fa43582
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/MarkLive.cpp
    M lld/ELF/SymbolTable.cpp
    M lld/ELF/Writer.cpp
    M lld/docs/ReleaseNotes.rst
    M lld/docs/ld.lld.1
    M lld/test/ELF/retain-symbols-file.s
    M lld/test/ELF/version-script-warn.s

  Log Message:
  -----------
  [ELF] --retain-symbols-file: keep listed symbols in .symtab, not .dynsym (#209063)

Commit c0fc25307143dd06c12fb2f5ebdb1dade7290ccf (2017) implements
--retain-symbols-file with symbol version machinery
`{local: *; global: listed;}`, which removes unlisted symbols from
.dynsym and leaves .symtab untouched. GNU ld does the opposite: it keeps
only the listed symbols in .symtab and does not touch .dynsym.

Reuse the --discard-{locals,all} mechanism to reimplement the feature,
matching GNU ld.
Use --export-dynamic-symbol or a version script to control .dynsym.

Extend `markUsedSymbols` to mark referenced globals as well, so
--emit-relocs/-r keep a valid symbol index.

Fix #91055



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