[PATCH] D72027: [XCOFF][AIX] Support basic relocation type on AIX
Jason Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 14:17:39 PST 2020
jasonliu marked 2 inline comments as done.
jasonliu added inline comments.
================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:706
+ Sec->FileOffsetToRelocations = RawPointer;
+ assert(Sec->RelocationCount <
+ (UINT32_MAX / XCOFF::RelocationSerializationSize32) &&
----------------
daltenty wrote:
> nit: shouldn't these exceeding 32-bit assertions be report_fatal_errors? The user isn't going to get back a usable object file if this is the case.
When I rethink the assertions, I think we could remove
1. assert(Sec->RelocationCount < (UINT32_MAX / XCOFF::RelocationSerializationSize32))
because RelocationCount is uint16_t, and XCOFF::RelocationSerializationSize32 is always 10. So it won't be able to overflow RelocationSizeInSec which is a uint32_t.
2. assert(RawPointer <= UINT32_MAX - RelocationSizeInSec)
because RawPointer gets its initial value from RelocationEntryOffset(uint32_t), so adding any uint32_t is not going to overflow RawPointer which is uint64_t.
I will make "assert(RawPointer <= UINT32_MAX);" a fatal_error.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72027/new/
https://reviews.llvm.org/D72027
More information about the llvm-commits
mailing list