[PATCH 2/4] s390: Check sreldynrelro in elf_s390_finish_dynamic_symbol

Jens Remus jremus@linux.ibm.com
Thu Nov 13 13:21:10 GMT 2025


Add check for sreldynrelro being NULL, introduced by commit 5474d94f03ae
("dynrelro section for read-only dynamic symbols copied into
executable") in elf32-s390.c function elf_s390_finish_dynamic_symbol,
also to its elf64-s390.c counterpart.

Found while inspecting and cleaning up differences between elf32-s390.c
and elf64-s390.c.

bfd/
	* elf64-s390.c (elf_s390_finish_dynamic_symbol): Add
	sreldynrelro check from elf32-s390.c.

Fixes: 5474d94f03ae ("dynrelro section for read-only dynamic symbols copied into executable")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 bfd/elf64-s390.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index f72df9f4e122..f5a80e73f113 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3773,7 +3773,8 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
       if (h->dynindx == -1
 	  || (h->root.type != bfd_link_hash_defined
 	      && h->root.type != bfd_link_hash_defweak)
-	  || htab->elf.srelbss == NULL)
+	  || htab->elf.srelbss == NULL
+	  || htab->elf.sreldynrelro == NULL)
 	abort ();
 
       rela.r_offset = (h->root.u.def.value
-- 
2.48.1



More information about the Binutils mailing list