[all-commits] [llvm/llvm-project] 843c2b: [ELF] Error for undefined foo at v1

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Dec 1 09:00:19 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 843c2b2303004c1a7e4fa8037905fbc70601b155
      https://github.com/llvm/llvm-project/commit/843c2b2303004c1a7e4fa8037905fbc70601b155
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-12-01 (Tue, 01 Dec 2020)

  Changed paths:
    M lld/ELF/Relocations.cpp
    M lld/ELF/Symbols.h
    M lld/test/ELF/lto/version-script2.ll
    M lld/test/ELF/symver.s

  Log Message:
  -----------
  [ELF] Error for undefined foo at v1

If an object file has an undefined foo at v1, we emit a dynamic symbol foo.
This is incorrect if at runtime a shared object provides the non-default version foo at v1
(the undefined foo may bind to foo@@v2, for example).

GNU ld issues an error for this case, even if foo at v1 is undefined weak
(https://sourceware.org/bugzilla/show_bug.cgi?id=3351). This behavior makes
sense because to represent an undefined foo at v1, we have to construct a Verneed
entry. However, without knowing the defining filename, we cannot construct a
Verneed entry (Verneed::vn_file is unavailable).

This patch implements the error.

Depends on D92258

Reviewed By: grimar

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




More information about the All-commits mailing list