[PATCH 04/10] s390: Sync minor cleanups between {elf32|elf64}-s390.c

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


Over time elf32-s390.c and elf64-s390.c have diverged in some areas.

Apply cleanups from one to the other.  This simplifies comparison of
elf32-s390.c and elf64-s390.c, as it reduces the number of differences.

Non-functional change.

bfd/
	* elf32-s390.c (elf_s390_reloc_type_lookup): Return NULL instead
	of 0.
	(s390_elf_ldisp_reloc): Remove ATTRIBUTE_UNUSED from abfd and
	data as they are both used.
	(GOT, PLT): Correct comment regarding first three GOT entries.
	(elf_s390_check_relocs): Move isym.
	(elf_s390_relocate_section): Remove blank in pointer
	dereference.
	(elf_s390_finish_dynamic_symbol): Remove duplicate comment that
	got moved a few lines below.
	(elf_s390_grok_prstatus): Remove blanks from pointer argument
	definitions, use size_t, enhance comment on case 224, remove
	superfluous break.
	* elf64-s390.c (elf_s390_info_to_howto): Remove ATTRIBUTE_UNUSED
	from abdf as it is used.
	(elf_s390_check_relocs): End "fall through" comments with a dot.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 bfd/elf32-s390.c | 24 +++++++++---------------
 bfd/elf64-s390.c |  8 ++++----
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 43beb5438ecb..214166bcd529 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -298,7 +298,7 @@ elf_s390_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
     default:
       break;
     }
-  return 0;
+  return NULL;
 }
 
 static reloc_howto_type *
@@ -372,10 +372,10 @@ s390_tls_reloc (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Handle the large displacement relocs.  */
 static bfd_reloc_status_type
-s390_elf_ldisp_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+s390_elf_ldisp_reloc (bfd *abfd,
 		      arelent *reloc_entry,
 		      asymbol *symbol,
-		      void * data ATTRIBUTE_UNUSED,
+		      void * data,
 		      asection *input_section,
 		      bfd *output_bfd,
 		      char **error_message ATTRIBUTE_UNUSED)
@@ -452,7 +452,7 @@ elf_s390_is_local_label_name (bfd *abfd, const char *name)
 
 #define RELA_ENTRY_SIZE sizeof (Elf32_External_Rela)
 
-/* The first three entries in a procedure linkage table are reserved,
+/* The first three entries in a global offset table are reserved,
    and the initial contents are unimportant (we zero them out).
    Subsequent entries look like this.  See the SVR4 ABI 386
    supplement to see how this works.  */
@@ -892,7 +892,6 @@ elf_s390_check_relocs (bfd *abfd,
   asection *sreloc;
   bfd_signed_vma *local_got_refcounts;
   int tls_type, old_tls_type;
-  Elf_Internal_Sym *isym;
 
   if (bfd_link_relocatable (info))
     return true;
@@ -912,6 +911,7 @@ elf_s390_check_relocs (bfd *abfd,
       unsigned int r_type;
       unsigned int r_symndx;
       struct elf_link_hash_entry *h;
+      Elf_Internal_Sym *isym;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
 
@@ -2476,7 +2476,7 @@ elf_s390_relocate_section (bfd *output_bfd,
 		 up.  */
 	      relocation = (htab->elf.iplt->output_section->vma
 			    + htab->elf.iplt->output_offset
-			    + h ->plt.offset);
+			    + h->plt.offset);
 	      goto do_relocation;
 	    }
 	  /* Fall through.  */
@@ -3475,11 +3475,6 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
 		       + htab->elf.sgot->output_offset
 		       + (h->got.offset &~ (bfd_vma) 1));
 
-      /* If this is a static link, or it is a -Bsymbolic link and the
-	 symbol is defined locally or was forced to be local because
-	 of a version file, we just want to emit a RELATIVE reloc.
-	 The entry in the global offset table will already have been
-	 initialized in the relocate_section function.  */
       if (h->def_regular && s390_is_ifunc_symbol_p (h))
 	{
 	  if (bfd_link_pic (info))
@@ -3750,17 +3745,17 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
 /* Support for core dump NOTE sections.  */
 
 static bool
-elf_s390_grok_prstatus (bfd * abfd, Elf_Internal_Note * note)
+elf_s390_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
 {
   int offset;
-  unsigned int size;
+  size_t size;
 
   switch (note->descsz)
     {
     default:
       return false;
 
-    case 224:			/* S/390 Linux.  */
+    case 224:			/* sizeof(struct elf_prstatus) on s390 */
       /* pr_cursig */
       elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
@@ -3793,7 +3788,6 @@ elf_s390_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 	= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
       elf_tdata (abfd)->core->command
 	= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
-      break;
     }
 
   /* Note that for some reason, a spurious space is tacked
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index bcc2e29bf9d5..50ab703dd118 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -357,7 +357,7 @@ elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
    and elf64-s390.c has its own copy.  */
 
 static bool
-elf_s390_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+elf_s390_info_to_howto (bfd *abfd,
 			arelent *cache_ptr,
 			Elf_Internal_Rela *dst)
 {
@@ -1109,7 +1109,7 @@ elf_s390_check_relocs (bfd *abfd,
 	case R_390_TLS_IEENT:
 	  if (bfd_link_dll (info))
 	    info->flags |= DF_STATIC_TLS;
-	  /* Fall through */
+	  /* Fall through.  */
 
 	case R_390_GOT12:
 	case R_390_GOT16:
@@ -1179,7 +1179,7 @@ elf_s390_check_relocs (bfd *abfd,
 
 	  if (r_type != R_390_TLS_IE64)
 	    break;
-	  /* Fall through */
+	  /* Fall through.  */
 
 	case R_390_TLS_LE64:
 	  /* For static linking and executables this reloc will be
@@ -1191,7 +1191,7 @@ elf_s390_check_relocs (bfd *abfd,
 	  if (!bfd_link_dll (info))
 	    break;
 	  info->flags |= DF_STATIC_TLS;
-	  /* Fall through */
+	  /* Fall through.  */
 
 	case R_390_8:
 	case R_390_16:
-- 
2.48.1



More information about the Binutils mailing list