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

Sean Silva silvas at purdue.edu
Mon Jul 15 14:13:00 PDT 2013



================
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.


http://llvm-reviews.chandlerc.com/D1126

COMMIT
  http://llvm-reviews.chandlerc.com/rL186336



More information about the llvm-commits mailing list