[SeaBIOS] Re: [PATCH v2] Use readelf -WSrs instead of objdump -thr so that llvm-readelf can be used as a replacement

2020-04-06 Thread Fangrui Song

On 2020-04-06, Kevin O'Connor wrote:

On Wed, Apr 01, 2020 at 06:12:09PM -0700, Fangrui Song wrote:

objdump -h relies heavily on BFD internals and the BFD flags are difficult to 
emulate in llvm-objdump.
llvm-objdump -h has a different output (https://reviews.llvm.org/D57146)

Switch to readelf, which is generally better than objdump when dumping ELF 
section/symbol information.

Signed-off-by: Fangrui Song 


At a high-level, this change makes sense to me.  What Linux
distros/versions have you tested this on?  (Or, do you have reason to
believe the readelf output has been stable for many years?)

-Kevin


Tested on Debian testing.

readelf -S -r -s output is stable. It just prints raw ELF fields.
objdump -t -h -r output is not. The output goes through various BFD 
abstractions.
 "CONTENTS, ALLOC, LOAD, READONLY, DATA" -> these are really BFD_* constants.
  The genuine ELF values are SHT_PROGBITS, SHF_ALLOC, non-SHF_WRITE, etc.

  The LMA column is not really recorded in ELF. objdump internally does
  some translation like sh_addr-p_vaddr+p_paddr.

I made llvm-objdump's output closer to objdump as long as it is reasonable.
https://github.com/llvm/llvm-project/commits/master/llvm/tools/llvm-objdump/llvm-objdump.cpp?author=maskray
These BFD flags may be difficult to implement and may not provide enough value.
I actually claim myself as a maintainer of llvm-{readobj,objdump,...}
and have reported many binutils issues as well.

llvm-readelf, on the other side, has great compatibility with GNU readelf.
___
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org


[SeaBIOS] Re: [PATCH v2] Use readelf -WSrs instead of objdump -thr so that llvm-readelf can be used as a replacement

2020-04-06 Thread Kevin O'Connor
On Wed, Apr 01, 2020 at 06:12:09PM -0700, Fangrui Song wrote:
> objdump -h relies heavily on BFD internals and the BFD flags are difficult to 
> emulate in llvm-objdump.
> llvm-objdump -h has a different output (https://reviews.llvm.org/D57146)
> 
> Switch to readelf, which is generally better than objdump when dumping ELF 
> section/symbol information.
> 
> Signed-off-by: Fangrui Song 

At a high-level, this change makes sense to me.  What Linux
distros/versions have you tested this on?  (Or, do you have reason to
believe the readelf output has been stable for many years?)

-Kevin
___
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org