RFC: Two llvm-readobj behaviour queries

Hi all,

I just was discussing a couple of features in llvm-readobj and whether we should change them slightly:

  1. llvm-readobj --all currently matches GNU readelf’s --all switch in that it is equivalent to specifying a bundle of different options (including --file-headers, --program-headers, --symbols, --version-info etc). However, --all does not actually specify “all” dump types. For example, it doesn’t dump ELF section groups or the addrsig section (–elf-section-groups and --addrsig respectively). I’d propose that it should dump all relevant dumping information. Ideally, I’d suggest this difference for both llvm-readobj and llvm-readelf, but I can understand nervousness in the additional dumps that this would produce in llvm-readelf versus GNU readelf.

  2. llvm-readobj --notes prints the SHT_NOTE sections unless the ELF type is ET_CORE, in which case it prints the contents of the PT_NOTE segments and NOT the SHT_NOTE sections. It seems to me like there’s no good reason to not try both for all file formats. For example, it’s perfectly reasonable to have PT_NOTE segments in an ET_EXEC or ET_DYN object file. What would people think about removing this distinction? In this case, I’d propose printing all PT_NOTE segments and all SHT_NOTE sections not in PT_NOTE segments. In all likelihood, this would produce no different behaviour to the old behaviour.

Thoughts?

James

Hi all,

I just was discussing a couple of features in llvm-readobj and whether we should change them slightly:

1) llvm-readobj --all currently matches GNU readelf's --all switch in that it is equivalent to specifying a bundle of different options (including --file-headers, --program-headers, --symbols, --version-info etc). However, --all does not actually specify "all" dump types. For example, it doesn't dump ELF section groups or the addrsig section (--elf-section-groups and --addrsig respectively). I'd propose that it should dump all relevant dumping information. Ideally, I'd suggest this difference for both llvm-readobj and llvm-readelf, but I can understand nervousness in the additional dumps that this would produce in llvm-readelf versus GNU readelf.

2) llvm-readobj --notes prints the SHT_NOTE sections unless the ELF type is ET_CORE, in which case it prints the contents of the PT_NOTE segments and NOT the SHT_NOTE sections. It seems to me like there's no good reason to not try both for all file formats. For example, it's perfectly reasonable to have PT_NOTE segments in an ET_EXEC or ET_DYN object file. What would people think about removing this distinction? In this case, I'd propose printing all PT_NOTE segments and all SHT_NOTE sections not in PT_NOTE segments. In all likelihood, this would produce no different behaviour to the old behaviour.

Thoughts?

I agree with both proposals. Although I suspect that people parsing
the output of GNU readelf won't be using the --all switch I think it
is reasonable to keep the option sets the same.

Peter

Hi all,

I just was discussing a couple of features in llvm-readobj and whether we should change them slightly:

  1. llvm-readobj --all currently matches GNU readelf’s --all switch in that it is equivalent to specifying a bundle of different options (including --file-headers, --program-headers, --symbols, --version-info etc). However, --all does not actually specify “all” dump types. For example, it doesn’t dump ELF section groups or the addrsig section (–elf-section-groups and --addrsig respectively). I’d propose that it should dump all relevant dumping information. Ideally, I’d suggest this difference for both llvm-readobj and llvm-readelf, but I can understand nervousness in the additional dumps that this would produce in llvm-readelf versus GNU readelf.

  2. llvm-readobj --notes prints the SHT_NOTE sections unless the ELF type is ET_CORE, in which case it prints the contents of the PT_NOTE segments and NOT the SHT_NOTE sections. It seems to me like there’s no good reason to not try both for all file formats. For example, it’s perfectly reasonable to have PT_NOTE segments in an ET_EXEC or ET_DYN object file. What would people think about removing this distinction? In this case, I’d propose printing all PT_NOTE segments and all SHT_NOTE sections not in PT_NOTE segments. In all likelihood, this would produce no different behaviour to the old behaviour.

Thoughts?

James

I’m fine with both changes.

For the first, I prefer llvm-readelf --all mimics gnu readelf.

  • Michael Spencer