[PATCH] D92260: [ELF] Error for undefined foo at v1

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 22:29:12 PST 2020


MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson, psmith.
Herald added subscribers: llvm-commits, dmgreen, steven_wu, hiraditya, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay requested review of this revision.

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.

This patch implements the error.

Depends on D92258 <https://reviews.llvm.org/D92258>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92260

Files:
  lld/ELF/Relocations.cpp
  lld/test/ELF/lto/version-script2.ll
  lld/test/ELF/symver.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92260.308140.patch
Type: text/x-patch
Size: 4762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201128/b222515c/attachment.bin>


More information about the llvm-commits mailing list