[PATCH] D70495: [llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verdef section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 04:12:07 PST 2019


grimar added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3982
+
+    const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
+    for (unsigned J = 0; J < D->vd_cnt; ++J) {
----------------
MaskRay wrote:
> Check alignment, probably `D->vd_aux % alignof(VerdAux) == 0`,
> otherwise this may trigger a misaligned exception on some architectures.
Good point!
There was a problem: for me `alignof(Elf_Verdef) == 1`, but I think the alignment for verdef should be 32
Seems it is because, for example, `Elf_Word` is a `packed<uint32_t>` which is `packed_endian_specific_integral`, which use
an array of `char`s for representing the storage buffer. And `alignof(char) == 1`.

I've used hardcoded constants instead. I've added 2 additional errors: one for "unaligned auxiliary entry" and another for
"unaligned version definition entry". Unfortunately I believe there is no way to test the first one with use of yaml2obj.


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

https://reviews.llvm.org/D70495





More information about the llvm-commits mailing list