[all-commits] [llvm/llvm-project] 8f8b5e: [MC] Error for .globl/.local which change the symb...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Oct 29 09:08:20 PDT 2020


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

  Changed paths:
    M llvm/lib/MC/MCELFStreamer.cpp
    A llvm/test/MC/ELF/symbol-binding-changed.s

  Log Message:
  -----------
  [MC] Error for .globl/.local which change the symbol binding and warn for .weak

GNU as let .weak override .globl since binutils-gdb
5ca547dc2399a0a5d9f20626d4bf5547c3ccfddd (1996) while MC lets the last
directive win (PR38921).

This caused an issue to Linux's powerpc port which has been fixed by
http://git.kernel.org/linus/968339fad422a58312f67718691b717dac45c399

Binding overriding is error-prone. This patch disallows a changed binding.
(https://sourceware.org/pipermail/binutils/2020-March/000299.html )

Our behavior regarding `.globl x; .weak x` matches GNU as. Such usage is
still suspicious but we issue a warning for now. We may upgrade it to an
error in the future.

Reviewed By: jhenderson, nickdesaulniers

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




More information about the All-commits mailing list