[PATCH] readelf: Run --got-contents only on ET_DYN/ET_EXEC files
H.J. Lu
hjl.tools@gmail.com
Wed Sep 3 01:07:23 GMT 2025
Update "readelf --got-contents" to skip on non-ET_DYN/ET_EXEC files.
* readelf.c (process_got_section_contents): Skip if not
ET_DYN/ET_EXEC files.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
binutils/readelf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 104e54e1c05..c0fcc04dcd9 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -21023,6 +21023,15 @@ process_got_section_contents (Filedata * filedata)
if (!do_got_section_contents)
return res;
+ switch (filedata->file_header.e_type)
+ {
+ case ET_DYN:
+ case ET_EXEC:
+ break;
+ default:
+ goto out;
+ }
+
switch (filedata->file_header.e_machine)
{
case EM_MIPS:
--
2.51.0
More information about the Binutils
mailing list