[PATCH] D98387: [lld-macho] Check address ranges when applying relocations

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 19:43:51 PST 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This diff required fixing `getEmbeddedAddend` to apply sign
extension to 32-bit values. We were previously passing around wrong
64-bit addend values that became "right" after being truncated back to
32-bit.

I've also made `getEmbeddedAddend` return a signed int, which is similar
to what LLD-ELF does for its `getImplicitAddend`.

`reportRangeError`, `checkUInt`, and `checkInt` are counterparts of similar
functions in LLD-ELF.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98387

Files:
  lld/MachO/Arch/ARM64.cpp
  lld/MachO/Arch/X86_64.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/Relocations.cpp
  lld/MachO/Relocations.h
  lld/MachO/Target.h
  lld/test/MachO/invalid/range-check.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98387.329830.patch
Type: text/x-patch
Size: 8171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210311/d000e7d8/attachment.bin>


More information about the llvm-commits mailing list