[PATCH] [lld][PECOFF] Fix data directory entry RVA of base relocations section

Ron Ofir ron.ofir at gmail.com
Mon Sep 23 13:22:46 PDT 2013



================
Comment at: lib/ReaderWriter/PECOFF/WriterPECOFF.cpp:429
@@ -429,1 +428,3 @@
+        _file, llvm::COFF::DataDirectoryIndex::BASE_RELOCATION_TABLE, size,
+        addr);
     uint64_t offset = atom->ordinal() * sizeof(llvm::object::data_directory);
----------------
Rui Ueyama wrote:
> Doesn't this fit in 80 char?
83 :(

================
Comment at: lib/ReaderWriter/PECOFF/Atoms.h:257
@@ -254,2 +256,3 @@
+    *(reinterpret_cast<uint32_t *>(&data[0])) = entryAddr;
     *(reinterpret_cast<uint32_t *>(&data[4])) = entrySize;
     return data;
----------------
Rui Ueyama wrote:
> I wrote this code but this seems to be correct only the little endian machine. This would produce invalid binary when the linker is run on a BE machine. We should cast to a pointer to a ulittle32_t rather than a pointer to uint32_t.
Done.


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

BRANCH
  /lld/trunk

ARCANIST PROJECT
  lld



More information about the llvm-commits mailing list