[AArch64][X86] Allow 64-bit label differences lower to IMAGE_REL_*_REL32
authorFangrui Song <i@maskray.me>
Mon, 21 Jun 2021 21:32:25 +0000 (14:32 -0700)
committerFangrui Song <i@maskray.me>
Mon, 21 Jun 2021 21:32:25 +0000 (14:32 -0700)
commitc618692218d16e88fa20df56b29a8dd09c9e9db7
treec47199aeb2e870d782cc6cde3bd14aacf1aa34dd
parent3996311ee1b0a3c29a3ffcf9400e12ca76a846d9
[AArch64][X86] Allow 64-bit label differences lower to IMAGE_REL_*_REL32

`IMAGE_REL_ARM64_REL64/IMAGE_REL_AMD64_REL64` do not exist and `.quad a - .` is
currently not representable.

For instrumentation, `.quad a - .` is useful representing a cross-section
reference in a metadata section, to allow ELF medium/large code models. The COFF
limitation makes such generic instrumentations inconvenient. I plan to make a
PGO/coverage metadata section field relative in D104556.

Differential Revision: https://reviews.llvm.org/D104564
llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp
llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
llvm/test/MC/AArch64/coff-relocations.s
llvm/test/MC/COFF/cross-section-relative-err.s
llvm/test/MC/COFF/cross-section-relative.s