]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - ld/ChangeLog
readelf: report DF_1_PIE as "Position-Independent Executable"
authorAlan Modra <amodra@gmail.com>
Fri, 11 Jun 2021 04:53:57 +0000 (14:23 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 15 Jun 2021 03:54:57 +0000 (13:24 +0930)
commit93df3340fd5ad32f784214fc125de71811da72ff
tree573e4cdcb23a0dd6db96fba29bd3e19962935678
parent79afa8caab2eef71b6463e04d2d2f2152106cd93
readelf: report DF_1_PIE as "Position-Independent Executable"

I finally found time to teach readelf to identify PIEs in the file
header display and program header display.  So in place of
"DYN (Shared object file)" which isn't completely true, show
"DYN (Position-Independent Executable file)".

It requires a little bit of untangling code in readelf due to
process_program_headers setting up dynamic_addr and dynamic_size,
needed to scan .dynamic for the DT_FLAGS_1 entry, and
process_program_headers itself wanting to display the file type in
some cases.  At first I modified process_program_header using a
"probe" parameter similar to get_section_headers in order to inhibit
output, but decided it was cleaner to separate out
locate_dynamic_sections.

binutils/
* readelf.c (locate_dynamic_section, is_pie): New functions.
(get_file_type): Replace e_type parameter with filedata.  Call
is_pie for ET_DYN.  Update all callers.
(process_program_headers): Use local variables dynamic_addr and
dynamic_size, updating filedata on exit from function.  Set
dynamic_size of 1 to indicate no dynamic section or segment.
Update tests of dynamic_size throughout.
* testsuite/binutils-all/x86-64/pr27708.dump: Update expected output.
ld/
* testsuite/ld-pie/vaddr-0.d: Update expected output.
gdb/
* testsuite/lib/gdb.exp (exec_is_pie): Match new PIE readelf output.
binutils/ChangeLog
binutils/readelf.c
binutils/testsuite/binutils-all/x86-64/pr27708.dump
gdb/ChangeLog
gdb/testsuite/lib/gdb.exp
ld/ChangeLog
ld/testsuite/ld-pie/vaddr-0.d