public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: mengqinggang <mengqinggang@loongson.cn>, binutils@sourceware.org
Cc: xuchenghua@loongson.cn, liuzhensong@loongson.cn,
	chenglulu@loongson.cn,  i.swmail@xen0n.name, maskray@google.com
Subject: Re: [PATCH v1 6/6] LoongArch: ld: Add support for linker relaxation.
Date: Mon, 05 Dec 2022 16:31:24 +0800	[thread overview]
Message-ID: <e2e462fa959c8463241132243e9197eeff97dc18.camel@xry111.site> (raw)
In-Reply-To: <20221205080453.1352069-7-mengqinggang@loongson.cn>

On Mon, 2022-12-05 at 16:04 +0800, mengqinggang wrote:
> diff --git a/ld/testsuite/ld-loongarch-elf/relax.s b/ld/testsuite/ld-
> loongarch-elf/relax.s
> new file mode 100644
> index 00000000000..a99bd4de5af
> --- /dev/null
> +++ b/ld/testsuite/ld-loongarch-elf/relax.s
> @@ -0,0 +1,50 @@
> +# m.c: printf global int a, compile with gcc -fpic.
> +# la.local and la.global would be relaxed to pcaddi.

Remove things not needed for testing, such as the .cfi and .ident
directives.  Maybe it can be simplified to something like

.data
.global a
.type a, @object
a:
  .word 123

.text
.global main
.type main, @function
main:
  la.global $a0, a
  ld.w $a0, $a0, 0
  xori $a0, $a0, 123
  jr $ra

> +
> +       .file   "m.c"
> +       .text
> +       .globl  a
> +       .data
> +       .align  2
> +       .type   a, @object
> +       .size   a, 4
> +a:
> +       .word   123
> +       .section        .rodata
> +       .align  3
> +.LC0:
> +       .ascii  "%d\012\000"
> +       .text
> +       .align  2
> +       .globl  main
> +       .type   main, @function
> +main:
> +.LFB0 = .
> +       .cfi_startproc
> +       addi.d  $r3,$r3,-16
> +       .cfi_def_cfa_offset 16
> +       st.d    $r1,$r3,8
> +       stptr.d $r22,$r3,0
> +       .cfi_offset 1, -8
> +       .cfi_offset 22, -16
> +       addi.d  $r22,$r3,16
> +       .cfi_def_cfa 22, 0
> +       la.global       $r12,a
> +       ldptr.w $r12,$r12,0
> +       or      $r5,$r12,$r0
> +       la.local        $r4,.LC0
> +       #bl     %plt(printf)
> +       or      $r12,$r0,$r0
> +       or      $r4,$r12,$r0
> +       ld.d    $r1,$r3,8
> +       .cfi_restore 1
> +       ldptr.d $r22,$r3,0
> +       .cfi_restore 22
> +       addi.d  $r3,$r3,16
> +       .cfi_def_cfa_register 3
> +       jr      $r1
> +       .cfi_endproc
> +.LFE0:
> +       .size   main, .-main
> +       .ident  "GCC: (GNU) 13.0.0 20221023 (experimental)"
> +       .section        .note.GNU-stack,"",@progbits

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2022-12-05  8:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  8:04 [PATCH v1 0/6] LoongArch linker relaxation support mengqinggang
2022-12-05  8:04 ` [PATCH v1 1/6] LoongArch: include: Add support for linker relaxation mengqinggang
2022-12-05  8:24   ` Xi Ruoyao
2022-12-06  2:59     ` mengqinggang
2022-12-05  8:04 ` [PATCH v1 2/6] LoongArch: bfd: " mengqinggang
2022-12-05  8:04 ` [PATCH v1 3/6] LoongArch: opcodes: " mengqinggang
2022-12-05  9:43   ` Andreas Schwab
2022-12-05  8:04 ` [PATCH v1 4/6] LoongArch: binutils: " mengqinggang
2022-12-05  8:04 ` [PATCH v1 5/6] LoongArch: gas: " mengqinggang
2022-12-05  9:47   ` Andreas Schwab
2022-12-05  8:04 ` [PATCH v1 6/6] LoongArch: ld: " mengqinggang
2022-12-05  8:31   ` Xi Ruoyao [this message]
2022-12-05  8:43 ` [PATCH v1 0/6] LoongArch linker relaxation support Xi Ruoyao
2022-12-06  1:58   ` mengqinggang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2e462fa959c8463241132243e9197eeff97dc18.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=binutils@sourceware.org \
    --cc=chenglulu@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=maskray@google.com \
    --cc=mengqinggang@loongson.cn \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).