[binutils-gdb] S/390: use BFD_RELOC_<n>_PLT_PCREL in favor of custom types

Jan Beulich jbeulich@sourceware.org
Mon Dec 15 09:51:46 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5a414726ce69e5f085203f7a80b358d9164f435c

commit 5a414726ce69e5f085203f7a80b358d9164f435c
Author: Jan Beulich <jbeulich@suse.com>
Date:   Mon Dec 15 10:49:07 2025 +0100

    S/390: use BFD_RELOC_<n>_PLT_PCREL in favor of custom types
    
    No reason to have separate types when the generic ones have no (other)
    meaning for this target.

Diff:
---
 bfd/bfd-in2.h        |  6 ------
 bfd/elf32-s390.c     |  2 +-
 bfd/elf64-s390.c     |  4 ++--
 bfd/libbfd.h         |  2 --
 bfd/reloc.c          |  8 --------
 gas/config/tc-s390.c | 20 ++++++++++----------
 6 files changed, 13 insertions(+), 29 deletions(-)

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index bb5542a63df..0b9cdb996a0 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -5500,9 +5500,6 @@ enum bfd_reloc_code_real
   /* 12 bit GOT offset.  */
   BFD_RELOC_390_GOT12,
 
-  /* 32 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT32,
-
   /* Copy symbol at runtime.  */
   BFD_RELOC_390_COPY,
 
@@ -5551,9 +5548,6 @@ enum bfd_reloc_code_real
   /* 64 bit GOT offset.  */
   BFD_RELOC_390_GOT64,
 
-  /* 64 bit PC relative PLT address.  */
-  BFD_RELOC_390_PLT64,
-
   /* 32 bit rel. offset to GOT entry.  */
   BFD_RELOC_390_GOTENT,
 
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 5e0c783b39a..80939c1c735 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -201,7 +201,7 @@ elf_s390_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
       return &elf_howto_table[(int) R_390_GOT12];
     case BFD_RELOC_32_GOT_PCREL:
       return &elf_howto_table[(int) R_390_GOT32];
-    case BFD_RELOC_390_PLT32:
+    case BFD_RELOC_32_PLT_PCREL:
       return &elf_howto_table[(int) R_390_PLT32];
     case BFD_RELOC_390_COPY:
       return &elf_howto_table[(int) R_390_COPY];
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 440e60af5be..9e58bb21e70 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -215,7 +215,7 @@ elf_s390_reloc_type_lookup (bfd *abfd,
       return &elf_howto_table[(int) R_390_GOT12];
     case BFD_RELOC_32_GOT_PCREL:
       return &elf_howto_table[(int) R_390_GOT32];
-    case BFD_RELOC_390_PLT32:
+    case BFD_RELOC_32_PLT_PCREL:
       return &elf_howto_table[(int) R_390_PLT32];
     case BFD_RELOC_390_COPY:
       return &elf_howto_table[(int) R_390_COPY];
@@ -257,7 +257,7 @@ elf_s390_reloc_type_lookup (bfd *abfd,
       return &elf_howto_table[(int) R_390_PC64];
     case BFD_RELOC_390_GOT64:
       return &elf_howto_table[(int) R_390_GOT64];
-    case BFD_RELOC_390_PLT64:
+    case BFD_RELOC_64_PLT_PCREL:
       return &elf_howto_table[(int) R_390_PLT64];
     case BFD_RELOC_390_GOTENT:
       return &elf_howto_table[(int) R_390_GOTENT];
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 795241a6361..e6bb146e7d0 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2491,7 +2491,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_RX_RELAX",
   "BFD_RELOC_390_12",
   "BFD_RELOC_390_GOT12",
-  "BFD_RELOC_390_PLT32",
   "BFD_RELOC_390_COPY",
   "BFD_RELOC_390_GLOB_DAT",
   "BFD_RELOC_390_JMP_SLOT",
@@ -2508,7 +2507,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_390_PLT32DBL",
   "BFD_RELOC_390_GOTPCDBL",
   "BFD_RELOC_390_GOT64",
-  "BFD_RELOC_390_PLT64",
   "BFD_RELOC_390_GOTENT",
   "BFD_RELOC_390_GOTOFF64",
   "BFD_RELOC_390_GOTPLT12",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 9bf431a9f2f..2fca454d26f 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -5146,10 +5146,6 @@ ENUM
   BFD_RELOC_390_GOT12
 ENUMDOC
   12 bit GOT offset.
-ENUM
-  BFD_RELOC_390_PLT32
-ENUMDOC
-  32 bit PC relative PLT address.
 ENUM
   BFD_RELOC_390_COPY
 ENUMDOC
@@ -5214,10 +5210,6 @@ ENUM
   BFD_RELOC_390_GOT64
 ENUMDOC
   64 bit GOT offset.
-ENUM
-  BFD_RELOC_390_PLT64
-ENUMDOC
-  64 bit PC relative PLT address.
 ENUM
   BFD_RELOC_390_GOTENT
 ENUMDOC
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index ca6a20726ef..2d699037651 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1114,9 +1114,9 @@ s390_lit_suffix (char **str_p, expressionS *exp_p, elf_suffix_type suffix)
   else if (suffix == ELF_SUFFIX_PLT)
     {
       if (nbytes == 4)
-	reloc = BFD_RELOC_390_PLT32;
+	reloc = BFD_RELOC_32_PLT_PCREL;
       else if (nbytes == 8)
-	reloc = BFD_RELOC_390_PLT64;
+	reloc = BFD_RELOC_64_PLT_PCREL;
     }
 
   if (suffix != ELF_SUFFIX_NONE && reloc == BFD_RELOC_UNUSED)
@@ -1272,7 +1272,7 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */)
 		{
 		  BFD_RELOC_UNUSED, 		/* ELF_SUFFIX_NONE  */
 		  BFD_RELOC_32_GOT_PCREL,	/* ELF_SUFFIX_GOT  */
-		  BFD_RELOC_390_PLT32,		/* ELF_SUFFIX_PLT  */
+		  BFD_RELOC_32_PLT_PCREL,	/* ELF_SUFFIX_PLT  */
 		  BFD_RELOC_UNUSED,		/* ELF_SUFFIX_GOTENT  */
 		  BFD_RELOC_32_GOTOFF,		/* ELF_SUFFIX_GOTOFF  */
 		  BFD_RELOC_390_GOTPLT32,	/* ELF_SUFFIX_GOTPLT  */
@@ -1292,7 +1292,7 @@ s390_elf_cons (int nbytes /* 1=.byte, 2=.word, 4=.long */)
 		{
 		  BFD_RELOC_UNUSED, 		/* ELF_SUFFIX_NONE  */
 		  BFD_RELOC_390_GOT64,		/* ELF_SUFFIX_GOT  */
-		  BFD_RELOC_390_PLT64,		/* ELF_SUFFIX_PLT  */
+		  BFD_RELOC_64_PLT_PCREL,	/* ELF_SUFFIX_PLT  */
 		  BFD_RELOC_UNUSED,		/* ELF_SUFFIX_GOTENT  */
 		  BFD_RELOC_390_GOTOFF64,	/* ELF_SUFFIX_GOTOFF  */
 		  BFD_RELOC_390_GOTPLT64,	/* ELF_SUFFIX_GOTPLT  */
@@ -2390,9 +2390,9 @@ tc_s390_fix_adjustable (fixS *fixP)
       || fixP->fx_r_type == BFD_RELOC_390_PLT12DBL
       || fixP->fx_r_type == BFD_RELOC_390_PLT16DBL
       || fixP->fx_r_type == BFD_RELOC_390_PLT24DBL
-      || fixP->fx_r_type == BFD_RELOC_390_PLT32
+      || fixP->fx_r_type == BFD_RELOC_32_PLT_PCREL
       || fixP->fx_r_type == BFD_RELOC_390_PLT32DBL
-      || fixP->fx_r_type == BFD_RELOC_390_PLT64
+      || fixP->fx_r_type == BFD_RELOC_64_PLT_PCREL
       || fixP->fx_r_type == BFD_RELOC_390_GOT12
       || fixP->fx_r_type == BFD_RELOC_390_GOT20
       || fixP->fx_r_type == BFD_RELOC_390_GOT16
@@ -2454,12 +2454,12 @@ tc_s390_force_relocation (struct fix *fixp)
     case BFD_RELOC_390_GOTPCDBL:
     case BFD_RELOC_390_GOT64:
     case BFD_RELOC_390_GOTENT:
-    case BFD_RELOC_390_PLT32:
+    case BFD_RELOC_32_PLT_PCREL:
     case BFD_RELOC_390_PLT12DBL:
     case BFD_RELOC_390_PLT16DBL:
     case BFD_RELOC_390_PLT24DBL:
     case BFD_RELOC_390_PLT32DBL:
-    case BFD_RELOC_390_PLT64:
+    case BFD_RELOC_64_PLT_PCREL:
     case BFD_RELOC_390_GOTPLT12:
     case BFD_RELOC_390_GOTPLT16:
     case BFD_RELOC_390_GOTPLT20:
@@ -2730,7 +2730,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 	  break;
 	case BFD_RELOC_32_GOT_PCREL:
 	case BFD_RELOC_390_PLTOFF32:
-	case BFD_RELOC_390_PLT32:
+	case BFD_RELOC_32_PLT_PCREL:
 	case BFD_RELOC_390_GOTPLT32:
 	  if (fixP->fx_done)
 	    md_number_to_chars (where, value, 4);
@@ -2757,7 +2757,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 
 	case BFD_RELOC_390_GOT64:
 	case BFD_RELOC_390_PLTOFF64:
-	case BFD_RELOC_390_PLT64:
+	case BFD_RELOC_64_PLT_PCREL:
 	case BFD_RELOC_390_GOTPLT64:
 	  if (fixP->fx_done)
 	    md_number_to_chars (where, value, 8);


More information about the Binutils-cvs mailing list