[all-commits] [llvm/llvm-project] a2359a: [ELF] Fix PROVIDE_HIDDEN -shared regression with b...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Oct 15 09:20:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a2359a865a9f48e19511af0b0cfc5cf209808de9
      https://github.com/llvm/llvm-project/commit/a2359a865a9f48e19511af0b0cfc5cf209808de9
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-10-15 (Tue, 15 Oct 2024)

  Changed paths:
    M lld/ELF/LinkerScript.cpp
    M lld/ELF/LinkerScript.h
    M lld/test/ELF/linkerscript/provide-defined.s

  Log Message:
  -----------
  [ELF] Fix PROVIDE_HIDDEN -shared regression with bitcode file references

The inaccurate #111945 condition fixes a PROVIDE regression (#111478)
but introduces another regression: in a DSO link, if a symbol referenced
only by bitcode files is defined as PROVIDE_HIDDEN, lld would not set
the visibility correctly, leading to an assertion failure in
DynamicReloc::getSymIndex (https://reviews.llvm.org/D123985).
This is because `(sym->isUsedInRegularObj || sym->exportDynamic)` is
initially false (bitcode undef does not set `isUsedInRegularObj`) then
true (in `addSymbol`, after LTO compilation).

Fix this by making the condition accurate: use a map to track defined
symbols.

Reviewers: smithp35

Reviewed By: smithp35

Pull Request: https://github.com/llvm/llvm-project/pull/112386



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