https://gcc.gnu.org/g:1b2ece60f28d143dc4eef4c44973d5ff84e7dc6c

commit r16-6799-g1b2ece60f28d143dc4eef4c44973d5ff84e7dc6c
Author: Rainer Orth <[email protected]>
Date:   Thu Jan 15 09:50:04 2026 +0100

    sparc: Remove HAVE_AS_SPARC_UA_PCREL and HAVE_AS_SPARC_UA_PCREL_HIDDEN
    
    The SPARC backend currently has workarounds for two bugs in old versions
    of the assembler and linker.  However, I find both
    HAVE_AS_SPARC_UA_PCREL and HAVE_AS_SPARC_UA_PCREL_HIDDEN are always
    defined as 1 on both Solaris/SPARC and Linux/sparc64.
    
    I've checked all combinations of the assemblers supported on SPARC: the
    Solaris 11.4 FCS as and ld, current Solaris as and ld, gas and gld 2.30
    and 2.45.  The tests work on all of those, so the workarounds can be
    removed.
    
    Bootstrapped on sparc-sun-solaris2.11 (as and gas) and
    sparc64-unknown-linux-gnu.
    
    2026-01-13  Rainer Orth  <[email protected]>
    
            gcc:
            * configure.ac (gcc_cv_as_sparc_ua_pcrel): Remove.
            (gcc_cv_as_sparc_ua_pcrel_hidden): Likewise.
            * configure: Regenerate.
            * config.in: Regenerate.
    
            * config/sparc/sparc.h (ASM_PREFERRED_EH_DATA_FORMAT): Remove
            !HAVE_AS_SPARC_UA_PCREL, !HAVE_AS_SPARC_UA_PCREL_HIDDEN support.
            * config/sparc/sol2.h (ASM_PREFERRED_EH_DATA_FORMAT): Remove.
            * config/sparc/sparc.cc (TARGET_ASM_OUTPUT_DWARF_DTPREL): Remove
            HAVE_AS_SPARC_UA_PCREL guard.

Diff:
---
 gcc/config.in             | 14 -------
 gcc/config/sparc/sol2.h   | 11 ------
 gcc/config/sparc/sparc.cc |  2 +-
 gcc/config/sparc/sparc.h  | 22 +----------
 gcc/configure             | 94 -----------------------------------------------
 gcc/configure.ac          | 46 -----------------------
 6 files changed, 2 insertions(+), 187 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 83ad5675c084..72d2eb1dc800 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -804,20 +804,6 @@
 #endif
 
 
-/* Define if your assembler and linker support unaligned PC relative relocs.
-   */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_SPARC_UA_PCREL
-#endif
-
-
-/* Define if your assembler and linker support unaligned PC relative relocs
-   against hidden symbols. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_SPARC_UA_PCREL_HIDDEN
-#endif
-
-
 /* Define if your assembler supports call36 relocation. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_SUPPORT_CALL36
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
index c04c8f069d02..b985fa8755ae 100644
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -41,17 +41,6 @@ along with GCC; see the file COPYING3.  If not see
 /* Redue ggc-page.cc's chunk size to account for mmap red-zone pages.  */
 #define GGC_QUIRE_SIZE 510
 
-/* Select a format to encode pointers in exception handling data.  CODE
-   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
-   true if the symbol may be affected by dynamic relocations.
-
-   Some Solaris dynamic linkers don't handle unaligned section relative
-   relocs properly, so force them to be aligned.  */
-#ifndef HAVE_AS_SPARC_UA_PCREL
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)              \
-  ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
-#endif
-
 
 
 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc
index 7bed27d35699..f7c355cd4a87 100644
--- a/gcc/config/sparc/sparc.cc
+++ b/gcc/config/sparc/sparc.cc
@@ -877,7 +877,7 @@ char sparc_hard_reg_printed[8];
 #define TARGET_STACK_PROTECT_GUARD hook_tree_void_null
 #endif
 
-#if !TARGET_SUN_TLS && defined(HAVE_AS_SPARC_UA_PCREL)
+#if !TARGET_SUN_TLS
 #undef TARGET_ASM_OUTPUT_DWARF_DTPREL
 #define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel
 #endif
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 32d6a8c3d861..c5a45b058692 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1279,32 +1279,13 @@ do {                                                    
                \
 
 /* Select a format to encode pointers in exception handling data.  CODE
    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
-   true if the symbol may be affected by dynamic relocations.
-
-   If assembler and linker properly support .uaword %r_disp32(foo),
-   then use PC relative 32-bit relocations instead of absolute relocs
-   for shared libraries.  On sparc64, use pc relative 32-bit relocs even
-   for binaries, to save memory.
-
-   binutils 2.12 would emit a R_SPARC_DISP32 dynamic relocation if the
-   symbol %r_disp32() is against was not local, but .hidden.  In that
-   case, we have to use DW_EH_PE_absptr for pic personality.  */
-#ifdef HAVE_AS_SPARC_UA_PCREL
-#ifdef HAVE_AS_SPARC_UA_PCREL_HIDDEN
+   true if the symbol may be affected by dynamic relocations.  */
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                      \
   (flag_pic                                                            \
    ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4\
    : ((TARGET_ARCH64 && ! GLOBAL)                                      \
       ? (DW_EH_PE_pcrel | DW_EH_PE_sdata4)                             \
       : DW_EH_PE_absptr))
-#else
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                      \
-  (flag_pic                                                            \
-   ? (GLOBAL ? DW_EH_PE_absptr : (DW_EH_PE_pcrel | DW_EH_PE_sdata4))   \
-   : ((TARGET_ARCH64 && ! GLOBAL)                                      \
-      ? (DW_EH_PE_pcrel | DW_EH_PE_sdata4)                             \
-      : DW_EH_PE_absptr))
-#endif
 
 /* Emit a PC-relative relocation.  */
 #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL)      \
@@ -1314,7 +1295,6 @@ do {                                                      
                \
     assemble_name (FILE, LABEL);                       \
     fputc (')', FILE);                                 \
   } while (0)
-#endif
 
 /* Addressing modes, and classification of registers for them.  */
 
diff --git a/gcc/configure b/gcc/configure
index 80d95e2b821b..40d40cb8daad 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29221,100 +29221,6 @@ $as_echo "#define HAVE_AS_SPARC_GOTDATA_OP 1" 
>>confdefs.h
 fi
 
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for unaligned 
pcrel relocs" >&5
-$as_echo_n "checking assembler for unaligned pcrel relocs... " >&6; }
-if ${gcc_cv_as_sparc_ua_pcrel+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_sparc_ua_pcrel=no
-  if test x"$gcc_cv_as" != x; then
-    $as_echo '.text
-foo:
-       nop
-.data
-.align 4
-.byte 0
-.uaword %r_disp32(foo)' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -K PIC -o conftest.o conftest.s 
>&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-       if test x$gcc_cv_ld != x \
-       && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
-        gcc_cv_as_sparc_ua_pcrel=yes
-       fi
-       rm -f conftest
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_sparc_ua_pcrel" >&5
-$as_echo "$gcc_cv_as_sparc_ua_pcrel" >&6; }
-if test $gcc_cv_as_sparc_ua_pcrel = yes; then
-
-$as_echo "#define HAVE_AS_SPARC_UA_PCREL 1" >>confdefs.h
-
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for 
unaligned pcrel relocs against hidden symbols" >&5
-$as_echo_n "checking assembler for unaligned pcrel relocs against hidden 
symbols... " >&6; }
-if ${gcc_cv_as_sparc_ua_pcrel_hidden+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_as_sparc_ua_pcrel_hidden=no
-  if test x"$gcc_cv_as" != x; then
-    $as_echo '.data
-.align 4
-.byte 0x31
-.uaword %r_disp32(foo)
-.byte 0x32, 0x33, 0x34
-.global foo
-.hidden foo
-foo:
-.skip 4' > conftest.s
-    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -K PIC -o conftest.o conftest.s 
>&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }
-    then
-       if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
-        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
-        && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
-           | grep ' 31000000 07323334' > /dev/null 2>&1; then
-           if $gcc_cv_objdump -R conftest 2> /dev/null \
-              | grep 'DISP32' > /dev/null 2>&1; then
-               :
-           else
-               gcc_cv_as_sparc_ua_pcrel_hidden=yes
-           fi
-        fi
-        rm -f conftest
-    else
-      echo "configure: failed program was" >&5
-      cat conftest.s >&5
-    fi
-    rm -f conftest.o conftest.s
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$gcc_cv_as_sparc_ua_pcrel_hidden" >&5
-$as_echo "$gcc_cv_as_sparc_ua_pcrel_hidden" >&6; }
-if test $gcc_cv_as_sparc_ua_pcrel_hidden = yes; then
-
-$as_echo "#define HAVE_AS_SPARC_UA_PCREL_HIDDEN 1" >>confdefs.h
-
-fi
-
-
-fi
- # unaligned pcrel relocs
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for offsetable 
%lo()" >&5
 $as_echo_n "checking assembler for offsetable %lo()... " >&6; }
 if ${gcc_cv_as_sparc_offsetable_lo10+:} false; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c47e16865337..85272df5a246 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4754,52 +4754,6 @@ bar:
       [AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
                [Define if your assembler and linker support GOTDATA_OP 
relocs.])])
 
-    gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs],
-      gcc_cv_as_sparc_ua_pcrel,
-      [-K PIC],
-[.text
-foo:
-       nop
-.data
-.align 4
-.byte 0
-.uaword %r_disp32(foo)],
-      [if test x$gcc_cv_ld != x \
-       && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
-        gcc_cv_as_sparc_ua_pcrel=yes
-       fi
-       rm -f conftest],
-      [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
-               [Define if your assembler and linker support unaligned PC 
relative relocs.])
-
-      gcc_GAS_CHECK_FEATURE([unaligned pcrel relocs against hidden symbols],
-       gcc_cv_as_sparc_ua_pcrel_hidden,
-       [-K PIC],
-[.data
-.align 4
-.byte 0x31
-.uaword %r_disp32(foo)
-.byte 0x32, 0x33, 0x34
-.global foo
-.hidden foo
-foo:
-.skip 4],
-       [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
-        && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \
-        && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \
-           | grep ' 31000000 07323334' > /dev/null 2>&1; then
-           if $gcc_cv_objdump -R conftest 2> /dev/null \
-              | grep 'DISP32' > /dev/null 2>&1; then
-               :
-           else
-               gcc_cv_as_sparc_ua_pcrel_hidden=yes
-           fi
-        fi
-        rm -f conftest],
-        [AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1,
-                  [Define if your assembler and linker support unaligned PC 
relative relocs against hidden symbols.])])
-    ]) # unaligned pcrel relocs
-
     gcc_GAS_CHECK_FEATURE([offsetable %lo()],
       gcc_cv_as_sparc_offsetable_lo10,
       [-xarch=v9],

Reply via email to