[07/14] Sparc: use BFD_RELOC_<n>_PLT_PCREL in favor of custom types

Message ID 15304a9b-1ac6-43cf-936e-d62fd5f58b1a@suse.com
State New
Headers
Series bfd: a little bit of reloc enum cleanup |

Commit Message

Jan Beulich Nov. 28, 2025, 11:32 a.m. UTC
  No reason to have separate types when the generic ones have no (other)
meaning for this target.
  

Comments

Jose E. Marchesi Nov. 28, 2025, 12:15 p.m. UTC | #1
OK.
Thanks.

> No reason to have separate types when the generic ones have no (other)
> meaning for this target.
>
> --- a/bfd/bfd-in2.h
> +++ b/bfd/bfd-in2.h
> @@ -3440,8 +3440,6 @@ enum bfd_reloc_code_real
>    BFD_RELOC_SPARC_6,
>    BFD_RELOC_SPARC_5,
>  #define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
> -  BFD_RELOC_SPARC_PLT32,
> -  BFD_RELOC_SPARC_PLT64,
>    BFD_RELOC_SPARC_HIX22,
>    BFD_RELOC_SPARC_LOX10,
>    BFD_RELOC_SPARC_H44,
> --- a/bfd/elfxx-sparc.c
> +++ b/bfd/elfxx-sparc.c
> @@ -387,7 +387,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *a
>      case BFD_RELOC_SPARC_UA32:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_UA32];
>  
> -    case BFD_RELOC_SPARC_PLT32:
> +    case BFD_RELOC_32_PLT_PCREL:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_PLT32];
>  
>      case BFD_RELOC_SPARC_10:
> @@ -438,7 +438,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *a
>      case BFD_RELOC_SPARC_DISP64:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_DISP64];
>  
> -    case BFD_RELOC_SPARC_PLT64:
> +    case BFD_RELOC_64_PLT_PCREL:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_PLT64];
>  
>      case BFD_RELOC_SPARC_HIX22:
> --- a/bfd/libbfd.h
> +++ b/bfd/libbfd.h
> @@ -1174,8 +1174,6 @@ static const char *const bfd_reloc_code_
>    "BFD_RELOC_SPARC_7",
>    "BFD_RELOC_SPARC_6",
>    "BFD_RELOC_SPARC_5",
> -  "BFD_RELOC_SPARC_PLT32",
> -  "BFD_RELOC_SPARC_PLT64",
>    "BFD_RELOC_SPARC_HIX22",
>    "BFD_RELOC_SPARC_LOX10",
>    "BFD_RELOC_SPARC_H44",
> --- a/bfd/reloc.c
> +++ b/bfd/reloc.c
> @@ -1667,10 +1667,6 @@ ENUMEQX
>    BFD_RELOC_SPARC_DISP64
>    BFD_RELOC_64_PCREL
>  ENUMX
> -  BFD_RELOC_SPARC_PLT32
> -ENUMX
> -  BFD_RELOC_SPARC_PLT64
> -ENUMX
>    BFD_RELOC_SPARC_HIX22
>  ENUMX
>    BFD_RELOC_SPARC_LOX10
> --- a/gas/config/tc-sparc.c
> +++ b/gas/config/tc-sparc.c
> @@ -3915,8 +3915,8 @@ tc_gen_reloc (asection *section, fixS *f
>      case BFD_RELOC_16_PCREL:
>      case BFD_RELOC_32_PCREL:
>      case BFD_RELOC_64_PCREL:
> -    case BFD_RELOC_SPARC_PLT32:
> -    case BFD_RELOC_SPARC_PLT64:
> +    case BFD_RELOC_32_PLT_PCREL:
> +    case BFD_RELOC_64_PLT_PCREL:
>      case BFD_RELOC_VTABLE_ENTRY:
>      case BFD_RELOC_VTABLE_INHERIT:
>      case BFD_RELOC_SPARC_TLS_GD_HI22:
> @@ -4904,8 +4904,8 @@ cons_fix_new_sparc (fragS *frag,
>        else if (*sparc_cons_special_reloc == 'p')
>  	switch (nbytes)
>  	  {
> -	  case 4: r = BFD_RELOC_SPARC_PLT32; break;
> -	  case 8: r = BFD_RELOC_SPARC_PLT64; break;
> +	  case 4: r = BFD_RELOC_32_PLT_PCREL; break;
> +	  case 8: r = BFD_RELOC_64_PLT_PCREL; break;
>  	  }
>        else
>  	switch (nbytes)
  

Patch

--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3440,8 +3440,6 @@  enum bfd_reloc_code_real
   BFD_RELOC_SPARC_6,
   BFD_RELOC_SPARC_5,
 #define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
-  BFD_RELOC_SPARC_PLT32,
-  BFD_RELOC_SPARC_PLT64,
   BFD_RELOC_SPARC_HIX22,
   BFD_RELOC_SPARC_LOX10,
   BFD_RELOC_SPARC_H44,
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -387,7 +387,7 @@  _bfd_sparc_elf_reloc_type_lookup (bfd *a
     case BFD_RELOC_SPARC_UA32:
       return &_bfd_sparc_elf_howto_table[R_SPARC_UA32];
 
-    case BFD_RELOC_SPARC_PLT32:
+    case BFD_RELOC_32_PLT_PCREL:
       return &_bfd_sparc_elf_howto_table[R_SPARC_PLT32];
 
     case BFD_RELOC_SPARC_10:
@@ -438,7 +438,7 @@  _bfd_sparc_elf_reloc_type_lookup (bfd *a
     case BFD_RELOC_SPARC_DISP64:
       return &_bfd_sparc_elf_howto_table[R_SPARC_DISP64];
 
-    case BFD_RELOC_SPARC_PLT64:
+    case BFD_RELOC_64_PLT_PCREL:
       return &_bfd_sparc_elf_howto_table[R_SPARC_PLT64];
 
     case BFD_RELOC_SPARC_HIX22:
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1174,8 +1174,6 @@  static const char *const bfd_reloc_code_
   "BFD_RELOC_SPARC_7",
   "BFD_RELOC_SPARC_6",
   "BFD_RELOC_SPARC_5",
-  "BFD_RELOC_SPARC_PLT32",
-  "BFD_RELOC_SPARC_PLT64",
   "BFD_RELOC_SPARC_HIX22",
   "BFD_RELOC_SPARC_LOX10",
   "BFD_RELOC_SPARC_H44",
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1667,10 +1667,6 @@  ENUMEQX
   BFD_RELOC_SPARC_DISP64
   BFD_RELOC_64_PCREL
 ENUMX
-  BFD_RELOC_SPARC_PLT32
-ENUMX
-  BFD_RELOC_SPARC_PLT64
-ENUMX
   BFD_RELOC_SPARC_HIX22
 ENUMX
   BFD_RELOC_SPARC_LOX10
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -3915,8 +3915,8 @@  tc_gen_reloc (asection *section, fixS *f
     case BFD_RELOC_16_PCREL:
     case BFD_RELOC_32_PCREL:
     case BFD_RELOC_64_PCREL:
-    case BFD_RELOC_SPARC_PLT32:
-    case BFD_RELOC_SPARC_PLT64:
+    case BFD_RELOC_32_PLT_PCREL:
+    case BFD_RELOC_64_PLT_PCREL:
     case BFD_RELOC_VTABLE_ENTRY:
     case BFD_RELOC_VTABLE_INHERIT:
     case BFD_RELOC_SPARC_TLS_GD_HI22:
@@ -4904,8 +4904,8 @@  cons_fix_new_sparc (fragS *frag,
       else if (*sparc_cons_special_reloc == 'p')
 	switch (nbytes)
 	  {
-	  case 4: r = BFD_RELOC_SPARC_PLT32; break;
-	  case 8: r = BFD_RELOC_SPARC_PLT64; break;
+	  case 4: r = BFD_RELOC_32_PLT_PCREL; break;
+	  case 8: r = BFD_RELOC_64_PLT_PCREL; break;
 	  }
       else
 	switch (nbytes)