[PATCH] D155732: [MC][COFF][AArch64] Avoid incorrect IMAGE_REL_ARM64_BRANCH26 relocations.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 10:38:40 PDT 2023


MaskRay added inline comments.


================
Comment at: llvm/lib/MC/WinCOFFObjectWriter.cpp:961
+      // instruction to symbol A and drop the relocation.  Set to the
+      // correct relative offset.
+      FixedValue = Layout.getSymbolOffset(A) - Reloc.Data.VirtualAddress;
----------------
efriedma wrote:
> We shouldn't end up in recordRelocation for branches where the source and destination are in the same section, I think.
Ideally we should reuse the temporary symbol, not creating a new one.

The ELF approach is to omit temporary symbols only when unused by relocations (see `ELFWriter::isInSymtab`).

COFF D14975 may give some insights as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155732/new/

https://reviews.llvm.org/D155732



More information about the llvm-commits mailing list