[all-commits] [llvm/llvm-project] 8f089f: [MC] Emit unused undefined symbol even if its bind...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Nov 8 14:47:56 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f089f2099d39021bbfb76a2cd575612382a7cf6
      https://github.com/llvm/llvm-project/commit/8f089f2099d39021bbfb76a2cd575612382a7cf6
  Author: Fangrui Song <maskray at google.com>
  Date:   2019-11-08 (Fri, 08 Nov 2019)

  Changed paths:
    M lld/test/ELF/ppc64-abs64-dyn.s
    M lld/test/ELF/ppc64-relocs.s
    M llvm/lib/MC/ELFObjectWriter.cpp
    M llvm/test/MC/ELF/undef.s
    M llvm/test/MC/ELF/weakref.s

  Log Message:
  -----------
  [MC] Emit unused undefined symbol even if its binding is not set

Recommit r373168, which was reverted by r373242. This actually exposed a
boringssl bug which has been fixed for more than one month.

For the following two cases, we currently suppress the symbols. This
patch emits them (compatible with GNU as).

* `test2_a = undef`: if `undef` is otherwise unused.
* `.hidden hidden`: if `hidden` is unused. This is the main point of the
  patch, because omitting the symbol would cause a linker semantic
  difference.

It causes a behavior change that is not compatible with GNU as:

.weakref foo1, bar1

When neither foo1 nor bar1 is used, we now emit bar1, which is arguably
more consistent.

Another change is that we will emit .TOC. for .TOC. at tocbase .  For this
directive, suppressing .TOC. can be seen as a size optimization, but we
choose to drop it for simplicity and consistency.




More information about the All-commits mailing list