[all-commits] [llvm/llvm-project] 8fe3e7: [ELF] Eliminate symbols demoted due to /DISCARD/ d...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Mar 14 09:51:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fe3e70e810b409dce36f6d415e86f0f9b1cf22d
      https://github.com/llvm/llvm-project/commit/8fe3e70e810b409dce36f6d415e86f0f9b1cf22d
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M lld/ELF/Writer.cpp
    M lld/test/ELF/linkerscript/discard-section.s

  Log Message:
  -----------
  [ELF] Eliminate symbols demoted due to /DISCARD/ discarded sections (#85167)

#69295 demoted Defined symbols relative to discarded sections.
If such a symbol is unreferenced, the desired behavior is to
eliminate it from .symtab just like --gc-sections discarded
definitions.
Linux kernel's CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y configuration expects
that the unreferenced `unused` is not emitted to .symtab
(https://github.com/ClangBuiltLinux/linux/issues/2006).

For relocations referencing demoted symbols, the symbol index restores
to 0 like older lld (`R_X86_64_64 0` in `discard-section.s`).

Fix #85048



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