public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: mengqinggang <mengqinggang@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, binutils@sourceware.org
Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn,
	liuzhensong@loongson.cn, i.swmail@xen0n.name, maskray@google.com
Subject: Re: [PATCH v4 0/6] LoongArch linker relaxation support.
Date: Tue, 23 May 2023 10:04:56 +0800	[thread overview]
Message-ID: <70136a83-7363-16a8-bf8d-cf1b23df92a7@loongson.cn> (raw)
In-Reply-To: <060f66e4ff7860b7cbff91b8ccb9cfedd39337a3.camel@xry111.site>

For -mexplicit-relocs, two addi.d may share one pcalau12i after gcc
scheduling like this:

     pcalau12i $t0, %pc_hi20(a)
     beq $t1, $t2, L1
     addi.d $t0, %pc_lo12(a)
L1:
     addi.d $t0, %pc_lo12(a)

If the first pcalau12i and addi.d be relaxed to pcaddi, the last
addi.d would get error address.


I guess riscv function call relaxation has the same question.
Riscv function call using 'call' instruction in  -mexplicit-relocs and
-mno-explicit-relocs. And R_RISCV_CALL relocation size is 8
bytes, so it can directly process two instructions expand from
'call' instruction.


在 2023/5/22 下午7:04, Xi Ruoyao 写道:
> On Mon, 2023-05-22 at 18:04 +0800, mengqinggang wrote:
>> For -fsection-anchors, I think it is less affected by relax.  Could
>> you
>> please
>> give some special question about this?
> Alright, it seems I'd misunderstood -fsection-anchors with -mno-
> explicit-relocs.  It generates things like:
>
> la.pcrel t0, .ANCHOR0 + 8
> la.pcrel t1, .ANCHOR0 + 16
>
> Not
>
> la.pcrel t2, .ANCHOR0
> addi.d t0, t2, 8
> addi.d t1, t2, 16
>
> which may puzzle the relaxation pass.
>
>> On LoongArch architecture, -mno-explicit-relocs may have a higher
>> performance
>> than -mexplicit-relocs for some large program.
> I'd consider this situation "bad" as a distro maintainer will need to
> decide this on per-package or even per-link-unit basis if (s)he really
> wants to squeeze the last drop of the performance...  Is there any
> possibility to make both scheduling and relaxation work?
>
>


  reply	other threads:[~2023-05-23  2:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  1:34 mengqinggang
2023-05-22  1:34 ` [PATCH v4 1/6] LoongArch: include: Add support for linker relaxation mengqinggang
2023-05-22  1:34 ` [PATCH v4 2/6] LoongArch: bfd: " mengqinggang
2023-05-22  1:34 ` [PATCH v4 3/6] LoongArch: opcodes: " mengqinggang
2023-05-22  5:43   ` Xi Ruoyao
2023-05-22  1:34 ` [PATCH v4 4/6] LoongArch: binutils: " mengqinggang
2023-05-22  5:44   ` Xi Ruoyao
2023-05-22  1:34 ` [PATCH v4 5/6] LoongArch: gas: " mengqinggang
2023-05-22  1:34 ` [PATCH v4 6/6] LoongArch: ld: " mengqinggang
2023-05-22  5:40 ` [PATCH v4 0/6] LoongArch linker relaxation support Xi Ruoyao
2023-05-22  8:14   ` mengqinggang
2023-05-22  8:18   ` Andreas Schwab
2023-05-22 10:04   ` mengqinggang
2023-05-22 11:04     ` Xi Ruoyao
2023-05-23  2:04       ` mengqinggang [this message]
2023-05-24  9: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=70136a83-7363-16a8-bf8d-cf1b23df92a7@loongson.cn \
    --to=mengqinggang@loongson.cn \
    --cc=binutils@sourceware.org \
    --cc=chenglulu@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=maskray@google.com \
    --cc=xry111@xry111.site \
    --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).