diff options
author | Di Chen <dichen@redhat.com> | 2022-03-01 20:44:38 +0800 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2022-04-19 10:13:11 +0200 |
commit | 5b497d8da4920bf7b63a4aa3752cf580b3ad654c (patch) | |
tree | 974a3f31a9a70946bf9bb4aea89af4ad2b7aa210 /tests | |
parent | 21f089d190ad5f5ebbbbea1a3e1db1acfec1dbe9 (diff) | |
download | elfutils-5b497d8da4920bf7b63a4aa3752cf580b3ad654c.tar.gz |
readelf: Don't consider padding DT_NULL as dynamic section entry
when using `$ eu-readelf -d {FILE}` to get the number of dynamic
section entris, it wrongly counts the padding DT_NULLs as dynamic
section entries. However, DT_NULL Marks end of dynamic section.
They should not be considered as dynamic section entries.
https://sourceware.org/bugzilla/show_bug.cgi?id=28928
Signed-off-by: Di Chen <dichen@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/alldts.c | 5 | ||||
-rwxr-xr-x | tests/run-alldts.sh | 2 | ||||
-rwxr-xr-x | tests/run-readelf-d.sh | 7 |
4 files changed, 12 insertions, 9 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index e49bff05..c734b260 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2022-03-01 Di Chen <dichen@redhat.com> + + * alldts.c (dtflags): Put DT_NULL last. + * run-alldts.sh: NULL comes last. + * run-readelf-d.sh: Adjust Dynamic entries, remove DT_NULL + padding. + 2022-04-14 Mark Wielaard <mark@klomp.org> * run-debuginfod-federation-sqlite.sh: Don't try to corrupt diff --git a/tests/alldts.c b/tests/alldts.c index 3e9f9fe6..d0fe4f24 100644 --- a/tests/alldts.c +++ b/tests/alldts.c @@ -44,7 +44,7 @@ main (void) Dwelf_Strent *shstrtabse; const Elf32_Sword dtflags[] = { - DT_NULL, DT_NEEDED, DT_PLTRELSZ, DT_PLTGOT, + DT_NEEDED, DT_PLTRELSZ, DT_PLTGOT, DT_HASH, DT_STRTAB, DT_SYMTAB, DT_RELA, DT_RELASZ, DT_RELAENT, DT_STRSZ, DT_SYMENT, DT_INIT, DT_FINI, DT_SONAME, DT_RPATH, @@ -61,7 +61,8 @@ main (void) DT_GNU_LIBLIST, DT_CONFIG, DT_DEPAUDIT, DT_AUDIT, DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT, DT_FLAGS_1, DT_VERDEF, DT_VERDEFNUM, - DT_VERNEED, DT_VERNEEDNUM, DT_AUXILIARY, DT_FILTER + DT_VERNEED, DT_VERNEEDNUM, DT_AUXILIARY, DT_FILTER, + DT_NULL }; const int ndtflags = sizeof (dtflags) / sizeof (dtflags[0]); diff --git a/tests/run-alldts.sh b/tests/run-alldts.sh index 6a9a9ece..ce3630b0 100755 --- a/tests/run-alldts.sh +++ b/tests/run-alldts.sh @@ -27,7 +27,6 @@ testrun_compare ${abs_top_builddir}/src/readelf -d testfile-alldts <<\EOF Dynamic segment contains 66 entries: Addr: 0x000001a0 Offset: 0x000078 Link to section: [ 0] '' Type Value - NULL NEEDED Shared library: [(null)] PLTRELSZ 3735928559 (bytes) PLTGOT 0xdeadbeef @@ -93,6 +92,7 @@ Dynamic segment contains 66 entries: VERNEEDNUM 3735928559 AUXILIARY 0xdeadbeef FILTER 0xdeadbeef + NULL EOF exit 0 diff --git a/tests/run-readelf-d.sh b/tests/run-readelf-d.sh index d0b6ed24..69b01c49 100755 --- a/tests/run-readelf-d.sh +++ b/tests/run-readelf-d.sh @@ -34,7 +34,7 @@ testfiles testlib_dynseg.so testrun_compare ${abs_top_builddir}/src/readelf -d testlib_dynseg.so <<\EOF -Dynamic segment contains 28 entries: +Dynamic segment contains 23 entries: Addr: 0x00000000000017e0 Offset: 0x0007e0 Link to section: [ 3] '.dynstr' Type Value PLTGOT 0x00000000000019c8 @@ -60,11 +60,6 @@ Dynamic segment contains 28 entries: VERNEED 0x0000000000000498 VERNEEDNUM 2 NULL - NULL - NULL - NULL - NULL - NULL EOF exit 0 |