[all-commits] [llvm/llvm-project] e32f04: [ELF] Parse SHT_GNU_verneed and respect versioned ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat May 23 09:56:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e32f04cdc95224589f30148599c362ba37bae7b6
      https://github.com/llvm/llvm-project/commit/e32f04cdc95224589f30148599c362ba37bae7b6
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-05-23 (Sat, 23 May 2020)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    M lld/ELF/InputFiles.h
    A lld/test/ELF/invalid/verneed-shared.yaml
    A lld/test/ELF/verneed-shared.s

  Log Message:
  -----------
  [ELF] Parse SHT_GNU_verneed and respect versioned undefined symbols in shared objects

An undefined symbol in a shared object can be versioned, like `f at v1`.
We currently insert `f` as an Undefined into the symbol table, but we
should insert `f at v1` instead.

The string `v1` is inferred from SHT_GNU_versym and SHT_GNU_verneed.
This patch implements the functionality.

Failing to do this can cause two issues:

* If a versioned symbol referenced by a shared object is defined in the
  executable, we will fail to export it.
* If a versioned symbol referenced by a shared object in another object
  file, --no-allow-shlib-undefined may spuriously report an
  "undefined reference to " error. See https://bugs.llvm.org/show_bug.cgi?id=44842
  (Linking -lfftw3 -lm on Arch Linux can cause
  `undefined reference to __log_finite`)

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D80059




More information about the All-commits mailing list