[PATCH] D33964: [LLVM][llvm-objcopy] Added basic plumbing to get things started

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 01:56:21 PDT 2017


jhenderson added a comment.

In https://reviews.llvm.org/D33964#795981, @jakehehrlich wrote:

> I decided to just skip index zero rather than all SHT_NULL sections. It's equivalent for normal files but also handles strange files that want to have SHT_NULL sections in the middle for some reason.
>
> Having the dummy section be treated as a real section was causing the issue I had to fix with the SHF_ALLOC check so fixing this killed two birds with one stone.


Great! One minor nit, and I think we're nearly there, from my point of view. Also, at things stand, very large proposal 74 ELFs with metadata in the SHT_NULL section will be corrupted silently, I believe, so it might be nice to error if there are too many sections when trying to write.



================
Comment at: tools/llvm-objcopy/Object.cpp:128-129
+    Sec->EntrySize = Shdr.sh_entsize;
+    Sec->Index = Index;
+    Index++;
+    SectionNames->addString(Sec->Name);
----------------
Sec->Index = Index++?


Repository:
  rL LLVM

https://reviews.llvm.org/D33964





More information about the llvm-commits mailing list