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

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Mar 14 21:34:47 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 122ba9f100705213774cff2038db953ff8174d91
      https://github.com/llvm/llvm-project/commit/122ba9f100705213774cff2038db953ff8174d91
  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

(cherry picked from commit 8fe3e70e810b409dce36f6d415e86f0f9b1cf22d)



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