[PATCH] D74955: [obj2yaml] - Dump SHT_STRTAB, SHT_SYMTAB and SHT_DYNSYM sections.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 01:57:22 PST 2020


jhenderson added a comment.

In D74955#1891281 <https://reviews.llvm.org/D74955#1891281>, @grimar wrote:

> In D74955#1890908 <https://reviews.llvm.org/D74955#1890908>, @jhenderson wrote:
>
> > I don't have a clear solution to this yet, as I agree we shouldn't throw away important information like section addresses when using obj2yaml. I'm not concerned by the section header order, as that technically has no impact on anything (as long as section indexes in other things are updated correctly).
>
>
> In my use case the order is important. In short: I've experimented with a code to dump program headers and make an object produced
>  after `obj->obj2yaml->yaml2obj->obj` operation have the same segments, sections in segments etc. 
>  In this case it is important to keep the order and addresses of allocatable implicit sections.
>
> > Could we perhaps only list the implicit sections when they have a non-default value for something (i.e. a value that would be different from when they are not specified, such as a non-zero address)?
>
> A non-zero address for allocatable sections is pretty common. I.e. we will always print .dynsym/.dynstr sections..
>
> My concern is also that reading SHT_STRTAB/SHT_SYMTAB/SHT_DYNSYM and printing
>  different from "default" ones is a much more complicated logic than simply dumping them as `RawContentSection`, like this patch does.
>
> What if we introduce an option, e.g. `--dump-implicit-sec`  to dump them? It could be used for test cases creating
>  purposes and hide such details what should work good for a general case probably.


Okay, you make a fair amount of sense. I don't think a switch is necessarily needed. That being said, perhaps we could limit this to the dynamic symbol table and dynamic string table? I feel like .symtab and the non-dynamic string table(s) do not need printing, since they will normally be at the end, don't have addresses, and will just cause unnecessary noise if in the YAML. I think you'll find the number of tests impacted will subsequently reduce significantly. Perhaps then a switch (e.g. --explicit-symtab-strtab) would be wise to enable dumping these sections. What do you think?


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

https://reviews.llvm.org/D74955





More information about the llvm-commits mailing list