[7/8] bfd/Sparc: drop 64-bit BFD_RELOC_* aliases

Message ID 5c321840-a3cd-4b47-841d-23e7bd8beae6@suse.com
State New
Headers
Series bfd: another little bit of reloc enum cleanup |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Jan Beulich March 13, 2026, 9:58 a.m. UTC
  For other relocations (e.g. BFD_RELOC_{8,16,32}{,_PCREL} or
BFD_RELOC_32_PCREL_S2) the generic enumerator is used. Plus use of such
aliases obfuscates where the generic types are actually in use.
---
With this no users of ENUMEQ{,X} exist anymore. We could hance drop
support for them from doc/*.str. Unless anyone forsees any new use?
  

Comments

Jose E. Marchesi March 13, 2026, 1:20 p.m. UTC | #1
Hi Jan.

> For other relocations (e.g. BFD_RELOC_{8,16,32}{,_PCREL} or
> BFD_RELOC_32_PCREL_S2) the generic enumerator is used. Plus use of such
> aliases obfuscates where the generic types are actually in use.

The SPARC change LGTM.  Thanks.

> ---
> With this no users of ENUMEQ{,X} exist anymore. We could hance drop
> support for them from doc/*.str. Unless anyone forsees any new use?

FWIW I would remove the unused infrastructure.  It is pretty trivial in
this case to restore the definitions of ENUMEQ and ENUMEQX whenever
needed.

>
> --- a/bfd/bfd-in2.h
> +++ b/bfd/bfd-in2.h
> @@ -3413,7 +3413,6 @@ enum bfd_reloc_code_real
>    BFD_RELOC_SPARC_BASE22,
>  
>    /* SPARC64 relocations.  */
> -#define BFD_RELOC_SPARC_64 BFD_RELOC_64
>    BFD_RELOC_SPARC_10,
>    BFD_RELOC_SPARC_11,
>    BFD_RELOC_SPARC_OLO10,
> @@ -3428,7 +3427,6 @@ enum bfd_reloc_code_real
>    BFD_RELOC_SPARC_7,
>    BFD_RELOC_SPARC_6,
>    BFD_RELOC_SPARC_5,
> -#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
>    BFD_RELOC_SPARC_HIX22,
>    BFD_RELOC_SPARC_LOX10,
>    BFD_RELOC_SPARC_H44,
> --- a/bfd/elfxx-sparc.c
> +++ b/bfd/elfxx-sparc.c
> @@ -396,7 +396,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *a
>      case BFD_RELOC_SPARC_11:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_11];
>  
> -    case BFD_RELOC_SPARC_64:
> +    case BFD_RELOC_64:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_64];
>  
>      case BFD_RELOC_SPARC_OLO10:
> @@ -435,7 +435,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *a
>      case BFD_RELOC_SPARC_6:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_6];
>  
> -    case BFD_RELOC_SPARC_DISP64:
> +    case BFD_RELOC_64_PCREL:
>        return &_bfd_sparc_elf_howto_table[R_SPARC_DISP64];
>  
>      case BFD_RELOC_64_PLT_PCREL:
> --- a/bfd/reloc.c
> +++ b/bfd/reloc.c
> @@ -1628,10 +1628,7 @@ ENUMX
>  ENUMDOC
>    I think these are specific to SPARC a.out (e.g., Sun 4).
>  
> -ENUMEQ
> -  BFD_RELOC_SPARC_64
> -  BFD_RELOC_64
> -ENUMX
> +ENUM
>    BFD_RELOC_SPARC_10
>  ENUMX
>    BFD_RELOC_SPARC_11
> @@ -1659,9 +1656,6 @@ ENUMX
>    BFD_RELOC_SPARC_6
>  ENUMX
>    BFD_RELOC_SPARC_5
> -ENUMEQX
> -  BFD_RELOC_SPARC_DISP64
> -  BFD_RELOC_64_PCREL
>  ENUMX
>    BFD_RELOC_SPARC_HIX22
>  ENUMX
  

Patch

--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3413,7 +3413,6 @@  enum bfd_reloc_code_real
   BFD_RELOC_SPARC_BASE22,
 
   /* SPARC64 relocations.  */
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
   BFD_RELOC_SPARC_10,
   BFD_RELOC_SPARC_11,
   BFD_RELOC_SPARC_OLO10,
@@ -3428,7 +3427,6 @@  enum bfd_reloc_code_real
   BFD_RELOC_SPARC_7,
   BFD_RELOC_SPARC_6,
   BFD_RELOC_SPARC_5,
-#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
   BFD_RELOC_SPARC_HIX22,
   BFD_RELOC_SPARC_LOX10,
   BFD_RELOC_SPARC_H44,
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -396,7 +396,7 @@  _bfd_sparc_elf_reloc_type_lookup (bfd *a
     case BFD_RELOC_SPARC_11:
       return &_bfd_sparc_elf_howto_table[R_SPARC_11];
 
-    case BFD_RELOC_SPARC_64:
+    case BFD_RELOC_64:
       return &_bfd_sparc_elf_howto_table[R_SPARC_64];
 
     case BFD_RELOC_SPARC_OLO10:
@@ -435,7 +435,7 @@  _bfd_sparc_elf_reloc_type_lookup (bfd *a
     case BFD_RELOC_SPARC_6:
       return &_bfd_sparc_elf_howto_table[R_SPARC_6];
 
-    case BFD_RELOC_SPARC_DISP64:
+    case BFD_RELOC_64_PCREL:
       return &_bfd_sparc_elf_howto_table[R_SPARC_DISP64];
 
     case BFD_RELOC_64_PLT_PCREL:
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1628,10 +1628,7 @@  ENUMX
 ENUMDOC
   I think these are specific to SPARC a.out (e.g., Sun 4).
 
-ENUMEQ
-  BFD_RELOC_SPARC_64
-  BFD_RELOC_64
-ENUMX
+ENUM
   BFD_RELOC_SPARC_10
 ENUMX
   BFD_RELOC_SPARC_11
@@ -1659,9 +1656,6 @@  ENUMX
   BFD_RELOC_SPARC_6
 ENUMX
   BFD_RELOC_SPARC_5
-ENUMEQX
-  BFD_RELOC_SPARC_DISP64
-  BFD_RELOC_64_PCREL
 ENUMX
   BFD_RELOC_SPARC_HIX22
 ENUMX