[PATCH] D55329: [llvm-readobj] Little clean up inside `parseDynamicTable`

Xing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 12 23:52:24 PST 2018


Higuoxing added a comment.

In D55329#1328925 <https://reviews.llvm.org/D55329#1328925>, @sidneym wrote:

> FWIW: The check you mention in ELF.cpp is triggered by the following test script.  This causes llvm-readelf to generate an unexpected error message, LLVM ERROR: Virtual address is not in any segment
>
>   cat > 1.c << \!
>   int foo = 10;
>   int main() { return foo; }
>   !
>  
>   cat > script.t << \!
>   PHDRS {
>     CODE_RO PT_LOAD;
>     DATA PT_LOAD;
>     GOT PT_LOAD;
>     DYN PT_LOAD;
>     DYNAMIC PT_DYNAMIC;
>     RELADYN PT_LOAD;
>   }
>   SECTIONS {
>     .text : { *(.text) } :CODE_RO
>     .data : { *(.data) } :DATA
>     .dynamic : { *(.dynamic) }: DYN : DYNAMIC
>     .rela.dyn : {*(.rel.dyn)} : RELADYN
>   }
>   !
>  
>   gcc -c 1.c -fPIC
>   ld -shared 1.o -T script.t -Bsymbolic -pie -soname foo -o foo
>   echo llvm-readelf:
>   llvm-readelf -d foo
>   echo readelf:
>   readelf -d foo
>  
>


Thank you @sidneym, it's very helpful!

I am considering suppress the failure in `llvm-readobj` and just give a warning. I think this tool should give us enough information on binaries and should not crash because of an invalid value, right? But I still have no idea by now ... I don't want break the `ELF.cpp` internal API ...


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55329





More information about the llvm-commits mailing list