Remove HAVE_AS_SPARC_GOTDATA_OP

Since the introduction of gcc_cv_as_flags on SPARC,
HAVE_AS_SPARC_GOTDATA_OP became undefined on sparcv9-sun-solaris2.11
with the native assembler.  This happens because /bin/as is now invoked
with -m64, but the test fails to assemble:

/bin/as: "gotdata_op.s", line 8: error: detect global register use not covered .register pseudo-op

While the test can be adjusted by the addition of

	.register %g2, #scratch

which makes it work with both as -m32/-m64 and gas --32/--64, it
turns out the whole workaround has become unnecessary:

When trying all combinations of as/ld with -m32/-m64, with both the
original Solaris 11.4 as/ld and the current one, as well as gas/gld
2.20.1, 2.30, and 2.46, the only cases where the test fails are when
using gld 2.20.1.  Solaris/SPARC requires binutils 2.30 now, and 2.20.1
can be considered ancient history on Linux/sparc64, too.  Therefore the
test and the code guarded by it can just go.

Bootstrapped without regressions on sparc{,v9}-sun-solaris2.11 and
sparc64-unknown-linux-gnu.

2026-02-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* configure.ac <sparc*-*-*> (gcc_cv_as_sparc_gotdata_op): Remove.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/sparc/sparc.md [!HAVE_AS_SPARC_GOTDATA_OP]: Remove.
This commit is contained in:
Rainer Orth
2026-02-14 16:21:23 +01:00
parent 8a9490979b
commit d37f4b2a1a
4 changed files with 0 additions and 106 deletions

View File

@@ -804,12 +804,6 @@
#endif
/* Define if your assembler and linker support GOTDATA_OP relocs. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_SPARC_GOTDATA_OP
#endif
/* Define if your assembler supports call36 relocation. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_SUPPORT_CALL36

View File

@@ -1713,11 +1713,7 @@
UNSPEC_MOVE_PIC)))]
"flag_pic"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "xor\t%1, %%gdop_lox10(%a2), %0";
#else
return "or\t%1, %%lo(%a2), %0";
#endif
})
(define_insn "movsi_high_pic"
@@ -1725,11 +1721,7 @@
(high:SI (unspec:SI [(match_operand 1 "" "")] UNSPEC_MOVE_PIC)))]
"flag_pic && check_pic (1)"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "sethi\t%%gdop_hix22(%a1), %0";
#else
return "sethi\t%%hi(%a1), %0";
#endif
})
(define_insn "movsi_pic_gotdata_op"
@@ -1740,11 +1732,7 @@
UNSPEC_MOVE_GOTDATA))]
"flag_pic && check_pic (1)"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "ld\t[%1 + %2], %0, %%gdop(%a3)";
#else
return "ld\t[%1 + %2], %0";
#endif
}
[(set_attr "type" "load")
(set_attr "subtype" "regular")])
@@ -1934,11 +1922,7 @@
UNSPEC_MOVE_PIC)))]
"TARGET_ARCH64 && flag_pic"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "xor\t%1, %%gdop_lox10(%a2), %0";
#else
return "or\t%1, %%lo(%a2), %0";
#endif
})
(define_insn "movdi_high_pic"
@@ -1946,11 +1930,7 @@
(high:DI (unspec:DI [(match_operand 1 "" "")] UNSPEC_MOVE_PIC)))]
"TARGET_ARCH64 && flag_pic && check_pic (1)"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "sethi\t%%gdop_hix22(%a1), %0";
#else
return "sethi\t%%hi(%a1), %0";
#endif
})
(define_insn "movdi_pic_gotdata_op"
@@ -1961,11 +1941,7 @@
UNSPEC_MOVE_GOTDATA))]
"TARGET_ARCH64 && flag_pic && check_pic (1)"
{
#ifdef HAVE_AS_SPARC_GOTDATA_OP
return "ldx\t[%1 + %2], %0, %%gdop(%a3)";
#else
return "ldx\t[%1 + %2], %0";
#endif
}
[(set_attr "type" "load")
(set_attr "subtype" "regular")])

50
gcc/configure vendored
View File

@@ -29226,56 +29226,6 @@ if test $gcc_cv_as_sparc_relax = yes; then
$as_echo "#define HAVE_AS_RELAX_OPTION 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GOTDATA_OP relocs" >&5
$as_echo_n "checking assembler for GOTDATA_OP relocs... " >&6; }
if ${gcc_cv_as_sparc_gotdata_op+:} false; then :
$as_echo_n "(cached) " >&6
else
gcc_cv_as_sparc_gotdata_op=no
if test x"$gcc_cv_as" != x; then
$as_echo '.text
.align 4
foo:
nop
bar:
sethi %gdop_hix22(foo), %g1
xor %g1, %gdop_lox10(foo), %g1
ld [%l7 + %g1], %g2, %gdop(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
if test x$gcc_cv_objdump != x; then
if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
| grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
gcc_cv_as_sparc_gotdata_op=no
else
gcc_cv_as_sparc_gotdata_op=yes
fi
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_gotdata_op" >&5
$as_echo "$gcc_cv_as_sparc_gotdata_op" >&6; }
if test $gcc_cv_as_sparc_gotdata_op = yes; then
$as_echo "#define HAVE_AS_SPARC_GOTDATA_OP 1" >>confdefs.h
fi

View File

@@ -4730,32 +4730,6 @@ EOF
[AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
[Define if your assembler supports -relax option.])])
gcc_GAS_CHECK_FEATURE([GOTDATA_OP relocs],
gcc_cv_as_sparc_gotdata_op,
[-K PIC],
[.text
.align 4
foo:
nop
bar:
sethi %gdop_hix22(foo), %g1
xor %g1, %gdop_lox10(foo), %g1
ld [[%l7 + %g1]], %g2, %gdop(foo)],
[if test x$gcc_cv_ld != x \
&& $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then
if test x$gcc_cv_objdump != x; then
if $gcc_cv_objdump -s -j .text conftest 2> /dev/null \
| grep ' 03000004 82186004 c405c001'> /dev/null 2>&1; then
gcc_cv_as_sparc_gotdata_op=no
else
gcc_cv_as_sparc_gotdata_op=yes
fi
fi
fi
rm -f conftest],
[AC_DEFINE(HAVE_AS_SPARC_GOTDATA_OP, 1,
[Define if your assembler and linker support GOTDATA_OP relocs.])])
gcc_GAS_CHECK_FEATURE([offsetable %lo()],
gcc_cv_as_sparc_offsetable_lo10,
[-xarch=v9],