[PATCH] D131290: [llvm-objdump] Create name for fake sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 14:11:25 PDT 2022


MaskRay added a comment.

Does GNU objdump use `load0`?

  % objdump -h llvm/test/Object/Inputs/no-sections.elf-x86-64 
  
  llvm/test/Object/Inputs/no-sections.elf-x86-64:     file format elf64-x86-64
  
  Sections:
  Idx Name          Size      VMA               LMA               File off  Algn

I think `PT_LOAD#0` looks good to me, but I don't object to matching GNU objdump for the commonly used PT_LOAD.
There is a small issue that we have to invent names for `PT_*` values, for values that GNU objdump doesn't hard code.
This is probably an area whether 100% compatibility doesn't matter.



================
Comment at: llvm/include/llvm/Object/ELF.h:185
   std::vector<Elf_Shdr> FakeSections;
+  std::vector<char> FakeSectionStrings;
 
----------------
Use `SmallString<0> FakeSectionStrings`.

Prefer `SmallString` because `std::string` has a small string optimization which isn't useful for this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131290



More information about the llvm-commits mailing list