[lld] r218703 - [mach-o] create __unwind_info section on x86_64

Tim Northover t.p.northover at gmail.com
Fri Oct 17 15:59:52 PDT 2014


Hi Rui,

<sniiiiiiiiiiiiiiiip>
>> +  void addCommonEncodings(std::vector<uint32_t> &commonEncodings) {
>> +    using normalized::write32;
>> +
>> +    _contents.resize(_commonEncodingsOffset +
>> +                     commonEncodings.size() * sizeof(uint32_t));
>> +    int32_t *commonEncodingsArea =
>> +        (int32_t *)&_contents[_commonEncodingsOffset];
>
>
> It doesn't seem to be guaranteed that _commonEncodingsOffset is a valid
> index. If I add
>
>   assert(_commonEncodingsOffset < _contents.size());
>
> many tests start failing.

I'd actually expect _commonEncodingsOffset == _contents.size() in all
cases (and an assert seems to confirm this). We've added the top-level
header, the next bytes (which we' rather like to be contiguous for
efficiency reasons) are the common encodings, so we resize the buffer
to give them room.

Cheers.

Tim.

<sniiiiiiiiiiiiiiiiiiipetty>



More information about the llvm-commits mailing list