[all-commits] [llvm/llvm-project] db1988: [ELF] Don't change binding to STB_WEAK for an unde...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Oct 8 08:31:56 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: db1988f038843ad047fdab5b9f818306b06ea80a
      https://github.com/llvm/llvm-project/commit/db1988f038843ad047fdab5b9f818306b06ea80a
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-10-08 (Thu, 08 Oct 2020)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/test/ELF/weak-undef-lib.s

  Log Message:
  -----------
  [ELF] Don't change binding to STB_WEAK for an undefined specified by -u

Similar to D66992.
In GNU ld, a -u specified symbol is a STB_DEFAULT undefined.
It cannot be changed to STB_WEAK by a later STB_WEAK undefined in a regular object file.

The behavior is consistent with our model because -u means "we need to fetch a lazy definition".
It should not be altered just because there is also a STB_WEAK undefined.

Note, our -u semantics are still different from GNU ld (https://github.com/ClangBuiltLinux/linux/issues/515):
we don't force the specified symbol to appear in .symtab This is a deliberate decision.

Reviewed By: grimar

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




More information about the All-commits mailing list