[PATCH] readelf: Fix readelf -Ds for objects using DT_MIPS_XHASH

Xi Ruoyao xry111@xry111.site
Thu Feb 20 11:49:46 GMT 2025


It output nothing because nothing assigns dynamic_info_DT_GNU_HASH:
dynamic_section_mips_val only does so if we pass -d (instead of just
-D).

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 binutils/readelf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 70d0c533f91..52ba2d3c1c8 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13089,6 +13089,10 @@ the .dynstr section doesn't match the DT_STRTAB and DT_STRSZ tags\n"));
 	    }
 	  break;
 
+	case DT_MIPS_XHASH:
+	  if (do_using_dynamic)
+	    filedata->dynamic_info_DT_GNU_HASH = entry->d_un.d_val;
+	  /* Fall through. */
 	default:
 	  if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
 	    filedata->version_info[DT_VERSIONTAGIDX (entry->d_tag)]
-- 
2.48.1



More information about the Binutils mailing list