Message ID | 20230914112102.10247-1-chenglulu@loongson.cn |
---|---|
State | New |
Headers | show |
Series | LoongArch: gcc: Modify gas uleb128 support test. | expand |
On Thu, 2023-09-14 at 19:21 +0800, Lulu Cheng wrote: > diff --git a/gcc/configure.ac b/gcc/configure.ac > index 09082e8ccae..072fe1d2b48 100644 > --- a/gcc/configure.ac > +++ b/gcc/configure.ac > @@ -3226,6 +3226,19 @@ L2: > .uleb128 0x8000000000000000 > ], > [[ > +case "$target" in > + loongarch*-*-*) > + if test "x$gcc_cv_ld" != x; then > + ac_try='$gcc_cv_ld conftest.o -o conftest -e 0x0 >&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 > + mv conftest conftest.o > + fi > +esac Phew. Randomly modifying configure and paste the modification into configure.ac is not the correct way to modify configure.ac. ac_* are autoconf internal names so we cannot use them.
Sorry, it's my problem. We will modify it as soon as possible. Thanks! 在 2023/9/14 下午7:45, Xi Ruoyao 写道: > On Thu, 2023-09-14 at 19:21 +0800, Lulu Cheng wrote: >> diff --git a/gcc/configure.ac b/gcc/configure.ac >> index 09082e8ccae..072fe1d2b48 100644 >> --- a/gcc/configure.ac >> +++ b/gcc/configure.ac >> @@ -3226,6 +3226,19 @@ L2: >> .uleb128 0x8000000000000000 >> ], >> [[ >> +case "$target" in >> + loongarch*-*-*) >> + if test "x$gcc_cv_ld" != x; then >> + ac_try='$gcc_cv_ld conftest.o -o conftest -e 0x0 >&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 >> + mv conftest conftest.o >> + fi >> +esac > Phew. Randomly modifying configure and paste the modification into > configure.ac is not the correct way to modify configure.ac. > > ac_* are autoconf internal names so we cannot use them. >
On Thu, 2023-09-14 at 19:54 +0800, chenglulu wrote:
> Sorry, it's my problem. We will modify it as soon as possible.
Try this:
diff --git a/gcc/configure.ac b/gcc/configure.ac
index cb4be11facd..10027a4aaaa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3229,10 +3229,18 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
gcc_AC_INITFINI_ARRAY
+# Some assemblers (GNU as for LoongArch) generates relocations for
+# leb128 symbol arithmetic for relaxation, we need to disable relaxation
+# probing leb128 support then.
+gcc_GAS_CHECK_FEATURE([-mno-relax support],
+ gcc_cv_as_mno_relax,[-mno-relax],[.text],,
+ [check_leb128_asflags=-mno-relax])
+
# Check if we have .[us]leb128, and support symbol arithmetic with it.
# Older versions of GAS and some non-GNU assemblers, have a bugs handling
# these directives, even when they appear to accept them.
-gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,,
+gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,
+[$check_leb128_asflags],
[ .data
.uleb128 L2 - L1
L1:
Thank you very much, we will send a new patch use this. 在 2023/9/14 下午8:09, Xi Ruoyao 写道: > On Thu, 2023-09-14 at 19:54 +0800, chenglulu wrote: >> Sorry, it's my problem. We will modify it as soon as possible. > Try this: > > diff --git a/gcc/configure.ac b/gcc/configure.ac > index cb4be11facd..10027a4aaaa 100644 > --- a/gcc/configure.ac > +++ b/gcc/configure.ac > @@ -3229,10 +3229,18 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) > > gcc_AC_INITFINI_ARRAY > > +# Some assemblers (GNU as for LoongArch) generates relocations for > +# leb128 symbol arithmetic for relaxation, we need to disable relaxation > +# probing leb128 support then. > +gcc_GAS_CHECK_FEATURE([-mno-relax support], > + gcc_cv_as_mno_relax,[-mno-relax],[.text],, > + [check_leb128_asflags=-mno-relax]) > + > # Check if we have .[us]leb128, and support symbol arithmetic with it. > # Older versions of GAS and some non-GNU assemblers, have a bugs handling > # these directives, even when they appear to accept them. > -gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,, > +gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, > +[$check_leb128_asflags], > [ .data > .uleb128 L2 - L1 > L1: > > >
diff --git a/gcc/configure b/gcc/configure index c7b26d1927d..d4763e6fd18 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24638,6 +24638,19 @@ L2: test $ac_status = 0; }; } then +case "$target" in + loongarch*-*-*) + if test "x$gcc_cv_ld" != x; then + ac_try='$gcc_cv_ld conftest.o -o conftest -e 0x0 >&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 + mv conftest conftest.o + fi +esac + if test "x$gcc_cv_objdump" != x; then if $gcc_cv_objdump -s conftest.o 2>/dev/null \ | grep '04800a8e 78808080 80808080 808001' >/dev/null; then diff --git a/gcc/configure.ac b/gcc/configure.ac index 09082e8ccae..072fe1d2b48 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3226,6 +3226,19 @@ L2: .uleb128 0x8000000000000000 ], [[ +case "$target" in + loongarch*-*-*) + if test "x$gcc_cv_ld" != x; then + ac_try='$gcc_cv_ld conftest.o -o conftest -e 0x0 >&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 + mv conftest conftest.o + fi +esac + if test "x$gcc_cv_objdump" != x; then if $gcc_cv_objdump -s conftest.o 2>/dev/null \ | grep '04800a8e 78808080 80808080 808001' >/dev/null; then
From: mengqinggang <mengqinggang@loongson.cn> Add "ld conftest.o -o conftest" process, then the "objdump -dr" contents is right. Because gas write zero to objdec file and generate R_LARCH_ADD_ULEB128/R_LARCH_SUB_ULEB128 reloc pair to calcualte uleb128 format symbol subtraction after ld relaxation. gcc/ChangeLog: * configure: Regenerate. * configure.ac: Add "ld conftest.o -o conftest" process. --- gcc/configure | 13 +++++++++++++ gcc/configure.ac | 13 +++++++++++++ 2 files changed, 26 insertions(+)