[PATCH] [PECOFF][Writer] Emit .reloc section.

Rui Ueyama ruiu at google.com
Mon Jul 15 14:22:37 PDT 2013


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>?


> http://llvm-reviews.chandlerc.com/D1126
>
> COMMIT
>   http://llvm-reviews.chandlerc.com/rL186336
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130715/6bac7244/attachment.html>


More information about the llvm-commits mailing list