aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-06-11 14:23:57 +0930
committerAlan Modra <amodra@gmail.com>2021-06-15 13:24:57 +0930
commit93df3340fd5ad32f784214fc125de71811da72ff (patch)
tree573e4cdcb23a0dd6db96fba29bd3e19962935678 /ld/testsuite
parent79afa8caab2eef71b6463e04d2d2f2152106cd93 (diff)
downloadgdb-93df3340fd5ad32f784214fc125de71811da72ff.zip
gdb-93df3340fd5ad32f784214fc125de71811da72ff.tar.gz
gdb-93df3340fd5ad32f784214fc125de71811da72ff.tar.bz2
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.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-pie/vaddr-0.d2
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/testsuite/ld-pie/vaddr-0.d b/ld/testsuite/ld-pie/vaddr-0.d
index e072222..69f7b10 100644
--- a/ld/testsuite/ld-pie/vaddr-0.d
+++ b/ld/testsuite/ld-pie/vaddr-0.d
@@ -5,5 +5,5 @@
ELF Header:
#...
- Type: DYN \(Shared object file\)
+ Type: DYN \(Position-Independent Executable file\)
#pass