[PATCH] [PECOFF] Fill size field of IMAGE_DATA_DIRECTORY
Ron Ofir
ron.ofir at gmail.com
Fri Jul 26 12:48:00 PDT 2013
================
Comment at: Atoms.h:255-257
@@ +254,5 @@
+ std::vector<uint8_t> assembleRawContent(uint64_t entrySize) {
+ std::vector<uint8_t> data = std::vector<uint8_t>(8, 0);
+ *(reinterpret_cast<uint32_t *>(&data[4])) = entrySize;
+ return data;
+ }
----------------
Richard wrote:
> Seems like elsewhere in the COFF code I've been reviewing lately we have similar noisy expressions where we desire a vector of bytes and have to jam in binary data. Can we get a generic binary blob builder that prevents us from having to write these same kinds of expressions across the different COFF code? Maybe even such a thing is useful to more than just COFF output files?
>
> Come to think of it, I'm not even sure this code will generate a proper COFF executable on a machine that doesn't have the same byte order as an x86 machine. Won't this break our ability to cross-compile?
I thought it would be useful for other tasks too, but I couldn't find any such class in the LLVM code base, so I guess it isn't?
You're right, a platform-independent way of doing buffer IO would be good. What about stl::streambuf? Or maybe it won't be platform-independent?
http://llvm-reviews.chandlerc.com/D1228
More information about the llvm-commits
mailing list