[PATCH] D90214: [llvm-readobj/elf] - Fix a crash when dumping a dynamic relocation that refer to a symbol past the EOF.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 02:29:23 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test:380
+## This symbol is located right before the EOF, so we can dump it.
+      - Symbol: 0x14
+        Type:   R_X86_64_NONE
----------------
grimar wrote:
> jhenderson wrote:
> > I'm a little confused - why isn't this symbol something like 0x1 or 0x2? If the .dynsym is the very last thing in the output, then the at-EOF index should be the number of dynamic symbols.
> I've investigated it and found multiple reasons:
> 
> 1) There is a `.dynstr` section, which we also write after.
> 2) Also we write the content of `.strtab` and `.shstrtab` implicit sections (both are empty and has size == 1).
>     Here I think that the fact we still write the content of `.shstrtab`  with `NoHeaders: true` is a bug.
>     We don't add section names to it already, but we should just drop it from the output.
> 3) We still:
>     a) Align the start of the section header table, what affects the output size. (BUG)
>     b) We still write it. (BUG)
> 
> I am going to fix it. Though it will be a separate independent set of changes.
Sounds reasonable, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90214/new/

https://reviews.llvm.org/D90214



More information about the llvm-commits mailing list