[PATCH] D80854: [lld-macho] Properly handle & validate relocation r_length

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 21:46:28 PDT 2020


int3 created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
int3 added a child revision: D80855: [lld-macho] Support non-pcrel section relocs.
int3 added reviewers: ruiu, pcc, MaskRay, christylee, smeenai, alexshap, Ktwu, gkm.

We should be reading / writing our addends / relocated addresses based on
r_length, and not just based on the type of the relocation. But since only
some r_length values are valid for a given reloc type, I've also added some
validation.

ld64 has code to allow for r_length = 0 in X86_64_RELOC_BRANCH relocs, but I'm
not sure how to create such a relocation...

Depends on D80414 <https://reviews.llvm.org/D80414>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80854

Files:
  lld/MachO/Arch/X86_64.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputSection.cpp
  lld/MachO/InputSection.h
  lld/MachO/Target.h
  lld/test/MachO/invalid/invalid-relocation-length.yaml
  lld/test/MachO/invalid/invalid-relocation-pcrel.yaml
  lld/test/MachO/invalid/invalid-relocation.yaml
  lld/test/MachO/x86-64-reloc-unsigned.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80854.267429.patch
Type: text/x-patch
Size: 10445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200530/cffcf415/attachment.bin>


More information about the llvm-commits mailing list