[PATCH] D128493: [llvm-readobj][RISCV] Supporting dump PT_RISCV_ATTRIBUTES
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 00:07:48 PDT 2022
MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.
> Supporting dump PT_RISCV_ATTRIBUTES
Support dumping
> But it is weird that riscv gnu toolchain's readelf dumps PT_RISCV_ATTRIBUTES
as RISCV_ATTRIBUT.
riscv gnu toolchain's readelf => GNU readelf
When describing binutils-gdb behavior, prefer the official binutils-gdb to a downstream repository like riscv-gnu-toolchain.
> But it is weird that riscv gnu toolchain's readelf dumps PT_RISCV_ATTRIBUTES as RISCV_ATTRIBUT.
Because it uses something like `%-14.14s` so only the first 14 bytes are printed.
> For target specific program headers, we generally drop the PT_xxxx_prefix. This patch also adopts this approach.
Actually I am unsure we should drop the machine prefix. GNU readelf uses the prefix and it seems clearer to have the prefix.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:1436
+ // E.g. "PT_RISCV_ATTRIBUTES"
+ if (Seg.startswith("PT_RISCV_"))
+ return Seg.drop_front(9).str();
----------------
```
if (Seg.consume_front("PT_RISCV_"))
return Seg.str();
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128493/new/
https://reviews.llvm.org/D128493
More information about the llvm-commits
mailing list