[PATCH] D66426: [lld] Enable a watermark of loadable sections to be generated and placed in a note section
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 10:44:12 PDT 2019
rupprecht added a comment.
> Whether or not this change is justified to be made into LLD, I think you'll need a llvm-readobj change to dump the note.
Namely, please add another case here: https://github.com/llvm/llvm-project/blob/master/llvm/tools/llvm-readobj/ELFDumper.cpp#L4495 (and similarly for LLVMStyle::printNotes). I imagine you can repurpose the `getGNUBuildId` method.
> It may be worth a llvm-objcopy change, too. One justification is that this watermark can be used to verify llvm-objcopy does not break things (does not alter SHF_ALLOC sections).
Interesting idea. What patch are you suggesting here?
================
Comment at: lld/ELF/SyntheticSections.cpp:347
+void lld::elf::WatermarkSection::writeTo(uint8_t *buf) {
+ write32(buf, 5); // Name size
+ write32(buf + 4, watermarkSize); // Content size
----------------
MaskRay wrote:
> 5 -> 8, otherwise it is incorrect to use `watermarkBuf = buf + 20;`
http://www.sco.com/developers/gabi/1998-04-29/ch5.pheader.html#note_section
I think 5 is the correct value for namesz; padding exists in the note but is not included in the value of namesz
================
Comment at: lld/ELF/SyntheticSections.cpp:348
+ write32(buf, 5); // Name size
+ write32(buf + 4, watermarkSize); // Content size
+ write32(buf + 8, NT_LLVM_WATERMARK); // Type
----------------
Content -> Descriptor
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66426/new/
https://reviews.llvm.org/D66426
More information about the llvm-commits
mailing list