[PATCH] D85430: [llvm-readobj] - Refine logic of the symbol table locating in printRelocationsHelper().
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 06:05:17 PDT 2020
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.
This removes the last `unwrapOrError` call from the `printRelocationsHelper`.
There is a little complexity because of `SHT_RELR/SHT_ANDROID_RELR` sections.
Normally, their `sh_link` is set to `0`, because such sections contains only relative relocations
and they do not need a symbol table to be associated with them.
Also, with `--raw-relr` there is no need to decode `RELR` relocations at all, hence we also do not need
to locate a symbol table too.
At the same time, the `SHT_RELR` gABI proposal (https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg)
says that sh_link field of the `SHT_RELR` section contains the index of the associated symbol table.
So this patch implements the following for `SHT_RELR/SHT_ANDROID_RELR` sections:
1. When the `--raw-relr` is specified, we do not attempt to locate a symbol table. It allows us to dump the section even ehen sh_link is broken.
2. Without the `--raw-relr`, we fall back to the common code that tries to locate a symbol table and reports a warning on a failure.
Related code, invoked by `printRelocationsHelper` was slightly updated.
(signatures has been changed to `Elf_Shdr *SymTab` -> `Elf_Shdr &SymTab`
to emphasise the requirement of a a non-null symtab).
Depends on D85303 <https://reviews.llvm.org/D85303>.
https://reviews.llvm.org/D85430
Files:
llvm/test/tools/llvm-readobj/ELF/packed-relocs.test
llvm/test/tools/llvm-readobj/ELF/relocations.test
llvm/test/tools/llvm-readobj/ELF/relr-relocs.test
llvm/tools/llvm-readobj/ELFDumper.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85430.283588.patch
Type: text/x-patch
Size: 20561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200806/003991cd/attachment.bin>
More information about the llvm-commits
mailing list