[all-commits] [llvm/llvm-project] 6b6c3a: [test] Add explicit dso_local to function declarat...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Dec 5 14:54:56 PST 2020


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

  Changed paths:
    M llvm/test/CodeGen/AArch64/extern-weak.ll
    M llvm/test/CodeGen/AArch64/funcptr_cast.ll
    M llvm/test/CodeGen/AArch64/tagged-globals-static.ll
    M llvm/test/CodeGen/SystemZ/la-01.ll
    M llvm/test/CodeGen/X86/add.ll
    M llvm/test/CodeGen/X86/avx-vzeroupper.ll
    M llvm/test/CodeGen/X86/avx512-i1test.ll
    M llvm/test/CodeGen/X86/bmi.ll
    M llvm/test/CodeGen/X86/bool-zext.ll
    M llvm/test/CodeGen/X86/btq.ll
    M llvm/test/CodeGen/X86/callbr-asm-branch-folding.ll
    M llvm/test/CodeGen/X86/cmp.ll
    M llvm/test/CodeGen/X86/conditional-tailcall.ll
    M llvm/test/CodeGen/X86/copy-eflags.ll
    M llvm/test/CodeGen/X86/dagcombine-shifts.ll
    M llvm/test/CodeGen/X86/fold-rmw-ops.ll
    M llvm/test/CodeGen/X86/fp-strict-scalar-cmp.ll
    M llvm/test/CodeGen/X86/fp-une-cmp.ll
    M llvm/test/CodeGen/X86/fp128-i128.ll
    M llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
    M llvm/test/CodeGen/X86/memcmp-minsize.ll
    M llvm/test/CodeGen/X86/memcmp-more-load-pairs.ll
    M llvm/test/CodeGen/X86/memcmp-optsize.ll
    M llvm/test/CodeGen/X86/memcmp-pgso.ll
    M llvm/test/CodeGen/X86/memcmp.ll
    M llvm/test/CodeGen/X86/mov-zero-to-xor.ll
    M llvm/test/CodeGen/X86/musttail-tailcc.ll
    M llvm/test/CodeGen/X86/neg_cmp.ll
    M llvm/test/CodeGen/X86/nomerge.ll
    M llvm/test/CodeGen/X86/peep-test-4.ll
    M llvm/test/CodeGen/X86/pr37063.ll
    M llvm/test/CodeGen/X86/pr38865.ll
    M llvm/test/CodeGen/X86/pr47024.ll
    M llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
    M llvm/test/CodeGen/X86/retpoline-external.ll
    M llvm/test/CodeGen/X86/shrink-compare-pgso.ll
    M llvm/test/CodeGen/X86/shrink-compare.ll
    M llvm/test/CodeGen/X86/shrinkwrap-callbr.ll
    M llvm/test/CodeGen/X86/sibcall-win64.ll
    M llvm/test/CodeGen/X86/sibcall.ll
    M llvm/test/CodeGen/X86/sqrt-partial.ll
    M llvm/test/CodeGen/X86/sse-fcopysign.ll
    M llvm/test/CodeGen/X86/statepoint-vreg-details.ll
    M llvm/test/CodeGen/X86/statepoint-vreg-unlimited-tied-opnds.ll
    M llvm/test/CodeGen/X86/tail-call-deref.ll
    M llvm/test/CodeGen/X86/tail-dup-asm-goto.ll
    M llvm/test/CodeGen/X86/tail-opts.ll
    M llvm/test/CodeGen/X86/tailcall-assume.ll
    M llvm/test/CodeGen/X86/tailcall-extract.ll
    M llvm/test/CodeGen/X86/tailcall-tailcc.ll
    M llvm/test/CodeGen/X86/win64_sibcall.ll
    M llvm/test/CodeGen/X86/xor-icmp.ll
    M llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll

  Log Message:
  -----------
  [test] Add explicit dso_local to function declarations in static relocation model tests

They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.

For such function declarations, clang -fno-pic emits the dso_local specifier.
Adding explicit dso_local makes these tests align with the clang behavior and
helps implementing an option to use GOT indirection when taking the address of a
function symbol in -fno-pic (to avoid a canonical PLT entry (SHN_UNDEF with
non-zero st_value)).


  Commit: a084c0388e2a59b9556f2de0083333232da3f1d6
      https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-12-05 (Sat, 05 Dec 2020)

  Changed paths:
    M llvm/lib/Target/TargetMachine.cpp
    M llvm/lib/Target/X86/X86Subtarget.cpp
    M llvm/test/CodeGen/AArch64/tiny_model.ll
    M llvm/test/CodeGen/ARM/fast-isel-call.ll
    M llvm/test/CodeGen/RISCV/mir-target-flags.ll
    M llvm/test/CodeGen/X86/abi-isel.ll
    M llvm/test/CodeGen/X86/absolute-cmp.ll
    M llvm/test/CodeGen/X86/absolute-constant.ll
    M llvm/test/CodeGen/X86/code-model-elf.ll
    M llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
    M llvm/test/CodeGen/X86/csr-split.ll
    M llvm/test/CodeGen/X86/fp-stack-direct-ret.ll
    M llvm/test/CodeGen/X86/jump_sign.ll
    M llvm/test/CodeGen/X86/linux-preemption.ll
    M llvm/test/CodeGen/X86/no-plt.ll
    M llvm/test/CodeGen/X86/or-branch.ll
    M llvm/test/CodeGen/X86/retpoline.ll
    M llvm/test/CodeGen/X86/slow-incdec.ll
    M llvm/test/CodeGen/X86/tailcall.ll

  Log Message:
  -----------
  [TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm

clang/lib/CodeGen/CodeGenModule sets dso_local on applicable function declarations,
we don't need to duplicate the work in TargetMachine:shouldAssumeDSOLocal.
(Actually the long-term goal (started by r324535) is to drop TargetMachine::shouldAssumeDSOLocal.)

By not implying dso_local, we will respect dso_local/dso_preemptable specifiers
set by the frontend. This allows the proposed -fno-direct-access-external-data
option to work with -fno-pic and prevent a canonical PLT entry (SHN_UNDEF with non-zero st_value)
when taking the address of a function symbol.

This patch should be NFC in terms of the Clang emitted assembly because the case
we don't set dso_local is a case Clang sets dso_local. However, some tests don't
set dso_local on some function declarations and expose some differences. Most
tests have been fixed to be more robust in the previous commit.


Compare: https://github.com/llvm/llvm-project/compare/bfda69416c6d...a084c0388e2a


More information about the All-commits mailing list