* [PATCH] LoongArch: gcc: Modify gas uleb128 support test.
@ 2023-09-14 11:21 Lulu Cheng
2023-09-14 11:45 ` Xi Ruoyao
0 siblings, 1 reply; 5+ messages in thread
From: Lulu Cheng @ 2023-09-14 11:21 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, xuchenghua, mengqinggang
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(+)
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
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] LoongArch: gcc: Modify gas uleb128 support test.
2023-09-14 11:21 [PATCH] LoongArch: gcc: Modify gas uleb128 support test Lulu Cheng
@ 2023-09-14 11:45 ` Xi Ruoyao
2023-09-14 11:54 ` chenglulu
0 siblings, 1 reply; 5+ messages in thread
From: Xi Ruoyao @ 2023-09-14 11:45 UTC (permalink / raw)
To: Lulu Cheng, gcc-patches; +Cc: i, xuchenghua, mengqinggang
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.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] LoongArch: gcc: Modify gas uleb128 support test.
2023-09-14 11:45 ` Xi Ruoyao
@ 2023-09-14 11:54 ` chenglulu
2023-09-14 12:09 ` Xi Ruoyao
0 siblings, 1 reply; 5+ messages in thread
From: chenglulu @ 2023-09-14 11:54 UTC (permalink / raw)
To: Xi Ruoyao, gcc-patches; +Cc: i, xuchenghua, mengqinggang
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.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] LoongArch: gcc: Modify gas uleb128 support test.
2023-09-14 11:54 ` chenglulu
@ 2023-09-14 12:09 ` Xi Ruoyao
2023-09-15 3:59 ` mengqinggang
0 siblings, 1 reply; 5+ messages in thread
From: Xi Ruoyao @ 2023-09-14 12:09 UTC (permalink / raw)
To: chenglulu, gcc-patches; +Cc: i, xuchenghua, mengqinggang
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:
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] LoongArch: gcc: Modify gas uleb128 support test.
2023-09-14 12:09 ` Xi Ruoyao
@ 2023-09-15 3:59 ` mengqinggang
0 siblings, 0 replies; 5+ messages in thread
From: mengqinggang @ 2023-09-15 3:59 UTC (permalink / raw)
To: Xi Ruoyao, chenglulu, gcc-patches; +Cc: i, xuchenghua
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:
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-15 4:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-14 11:21 [PATCH] LoongArch: gcc: Modify gas uleb128 support test Lulu Cheng
2023-09-14 11:45 ` Xi Ruoyao
2023-09-14 11:54 ` chenglulu
2023-09-14 12:09 ` Xi Ruoyao
2023-09-15 3:59 ` mengqinggang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).