[all-commits] [llvm/llvm-project] e390bd: [ELF] Suppress --no-allow-shlib-undefined diagnost...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jan 22 10:10:00 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e390bda9782b461f10433aa6728acf87521e22a5
      https://github.com/llvm/llvm-project/commit/e390bda9782b461f10433aa6728acf87521e22a5
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-01-22 (Mon, 22 Jan 2024)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/Writer.cpp
    M lld/test/ELF/allow-shlib-undefined.s

  Log Message:
  -----------
  [ELF] Suppress --no-allow-shlib-undefined diagnostic when a SharedSymbol is overridden by a hidden visibility Defined which is later discarded

Commit 1981b1b6b92f7579a30c9ed32dbdf3bc749c1b40 unexpectedly strengthened
--no-allow-shlib-undefined to catch a kind of ODR violation.
More precisely, when all three conditions are met, the new
`--no-allow-shlib-undefined` code reports an error.

* There is a DSO undef that has been satisfied by a definition from
  another DSO.
* The `SharedSymbol` is overridden by a non-exported (usually of hidden
  visibility) definition in a relocatable object file (`Defined`).
* The section containing the `Defined` is garbage-collected (it is not
  part of `.dynsym` and is not marked as live).

Technically, the hidden Defined in the executable can be intentional: it
can be meant to remain non-exported and not interact with any dynamic
symbols of the same name that might exist in other DSOs. To allow for
such use cases, allocate a new bit in
Symbol and relax the --no-allow-shlib-undefined check to before
commit 1981b1b6b92f7579a30c9ed32dbdf3bc749c1b40.




More information about the All-commits mailing list