[PATCH] readelf: Check missing DT_REL and DT_RELA dynamic tags

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAMe9rOqTYSQuSHropEaSKymWSMoCe0wcTAJYMqP4QqfnVH15Jg@mail.gmail.com>
PR binutils/34324
* readelf.c (process_relocs): Return error on missing DT_REL and
DT_RELA dynamic tags.


-- 
H.J.
0001-readelf-Check-missing-DT_REL-and-DT_RELA-dynamic-tag.patch (text/x-patch, 963 B)
From 579b3e22794e1d40e00a740855dcd7e94a6ddbe5 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <[email protected]>
Date: Wed, 1 Jul 2026 07:31:42 +0800
Subject: [PATCH] readelf: Check missing DT_REL and DT_RELA dynamic tags

	PR binutils/34324
	* readelf.c (process_relocs): Return error on missing DT_REL and
	DT_RELA dynamic tags.

Signed-off-by: H.J. Lu <[email protected]>
---
 binutils/readelf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index bf94f4d5caa..33b95da8b7e 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10080,8 +10080,9 @@ process_relocs (Filedata * filedata)
 
 	  switch (rel_type)
 	    {
-	    default:
-	      abort ();
+	    case reltype_unknown:
+	      error (_("missing DT_REL and DT_RELA dynamic tags\n"));
+	      return false;
 	    case reltype_rel:
 	      rel_entsz = filedata->dynamic_info[DT_RELENT];
 	      entsz_name = "DT_RELENT";
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.