[PATCH] D71647: [llvm-objcopy][MachO] Handle relocation entries where r_extern is 0
Seiya Nuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 21 18:25:09 PDT 2020
seiya marked an inline comment as done.
seiya added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOReader.cpp:220
+ else {
+ assert(Info->r_symbolnum <= Sections.size() &&
+ "Invalid section index.");
----------------
alexshap wrote:
> MaskRay wrote:
> > What if r_symbolnum = 0?
> MachO section indices start from 1, not from 0, that's why (i guess) we have <= Section.size() here and -1 below.
> I'd be good to add an assert that r_symbolnum > 0 in this case.
Yes indices starts from 1. Adding the assertion sounds good idea (btw, we need D77844 landed first since currently yaml2obj fills `r_symbolnum` with zeros, IIRC).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71647/new/
https://reviews.llvm.org/D71647
More information about the llvm-commits
mailing list