[PATCH] [PECOFF][Writer] Emit .reloc section.
Sean Silva
silvas at purdue.edu
Mon Jul 15 14:25:29 PDT 2013
On Mon, Jul 15, 2013 at 2:22 PM, Rui Ueyama <ruiu at google.com> wrote:
> On Mon, Jul 15, 2013 at 2:13 PM, Sean Silva <silvas at purdue.edu> wrote:
>
>>
>>
>> ================
>> Comment at: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:652
>> @@ +651,3 @@
>> + // The first four bytes is the page RVA.
>> + *reinterpret_cast<llvm::support::ulittle32_t *>(&contents[0]) =
>> pageAddr;
>> +
>> ----------------
>> Rui Ueyama wrote:
>> > Sean Silva wrote:
>> > > Do you know that the alignment is correct here? It's only a vector of
>> uint8_t.
>> > Good point! The spec does not say anything about the alignment, and it
>> looks like Windows does not enforce any alignment of the .reloc section.
>> However, the regular binary seems to have an optional empty field at the
>> end of a block to align the block at 32-bit boundary.
>> I was actually concerned about the pointer `&contents[0]` being only
>> uint8_t-aligned, and not ulittle32_t-aligned.
>
>
> I'm not an expert, but if we allocate an array larger than uint32_t, isn't
> it aligned at at least 32 bit boundary even if it's of type array<uint8_t>?
>
>
I think that will be the case in practice. ubsan should catch any alignment
issues though.
-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130715/3eae89fb/attachment.html>
More information about the llvm-commits
mailing list