[PATCH] D62179: [llvm-readelf] - Allow dumping of the .dynamic section even if there is no PT_DYNAMIC header.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 06:44:59 PDT 2019


grimar added a comment.

In D62179#1652778 <https://reviews.llvm.org/D62179#1652778>, @jankratochvil wrote:

> There is a regression - after this patch - at least after its later commit:
>
>   commit 8ac7b2d07bd6042afe0e8618ca8682d7663f4be8
>   Author: George Rimar <grimar at accesssoftek.com>
>   Date:   Wed May 29 10:31:46 2019 +0000
>       [llvm-readelf] - Allow dumping of the .dynamic section even if there is no PT_DYNAMIC header.
>       Differential revision: https://reviews.llvm.org/D62179
>       llvm-svn: 361943
>
>
> llvm-readobj cannot print `.dynsym` of executable without Program Headers. GNU `readelf` can print it fine. We have found it with @kwk because of some unrelated bug in `obj2yaml`/`yaml2obj' dropping Program Headers.
>  On 64-bit Linux one can create a test binary with:
>
>   cp -p /bin/bash /tmp/bashtest;dd if=/dev/zero of=/tmp/bashtest bs=1 count=2 seek=$[0x38] conv=notrunc
>
>
> `llvm-readobj -dyn-symbols` formerly printed for example:
>
>   Symbol {
>     Name: tilde_expand_word (11424)
>     Value: 0xDBE60
>   
>
> while now it prints only:
>
>   warning: Unable to parse DT_GNU_HASH: Virtual address is not in any segment
>   warning: Unable to parse DT_STRTAB: Virtual address is not in any segment
>   warning: Unable to parse DT_SYMTAB: Virtual address is not in any segment
>   warning: Unable to parse DT_JMPREL: Virtual address is not in any segment
>   warning: Unable to parse DT_RELA: Virtual address is not in any segment
>   File: /tmp/bashtest
>   Format: ELF64-x86-64
>   Arch: x86_64
>   AddressSize: 64bit 
>   LoadName:
>   DynamicSymbols [
>   ]
>


I posted a patch to fix this: https://reviews.llvm.org/D67078. Thanks for reporting!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62179





More information about the llvm-commits mailing list