[all-commits] [llvm/llvm-project] f04d92: [X86] Produce R_X86_64_GOTPCRELX for test/binop in...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Oct 24 15:14:39 PDT 2020


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

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
    R llvm/test/MC/ELF/got-relaxed.s
    M llvm/test/MC/ELF/got.s
    A llvm/test/MC/X86/gotpcrelx.s

  Log Message:
  -----------
  [X86] Produce R_X86_64_GOTPCRELX for test/binop instructions (MOV32rm/TEST32rm/...) when -Wa,-mrelax-relocations=yes is enabled

We have been producing R_X86_64_REX_GOTPCRELX (MOV64rm/TEST64rm/...) and
R_X86_64_GOTPCRELX for CALL64m/JMP64m without the REX prefix since 2016 (to be
consistent with GNU as), but not for MOV32rm/TEST32rm/...


  Commit: 398b81067c8202d2b3e4fec23547b6b64d181459
      https://github.com/llvm/llvm-project/commit/398b81067c8202d2b3e4fec23547b6b64d181459
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-10-24 (Sat, 24 Oct 2020)

  Changed paths:
    M lld/ELF/Arch/X86_64.cpp
    M lld/test/ELF/x86-64-gotpc-relax-nopic.s

  Log Message:
  -----------
  [ELF] Don't crash on R_X86_64_GOTPCRELX for test/binop instructions

While MC did not produce R_X86_64_GOTPCRELX for test/binop instructions
(movl/adcl/addl/andl/...) before the previous commit, this code path has been
exercised by -fno-integrated-as for GNU as since 2016: -no-pie relaxing
may incorrectly access loc[-3] and produce a corrupted instruction.

Simply handle test/binop R_X86_64_GOTPCRELX like R_X86_64_GOTPCREL.


Compare: https://github.com/llvm/llvm-project/compare/1e09dbb6a942...398b81067c82


More information about the All-commits mailing list