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: Mon, 22 May 2023 18:04:17 +0800	[thread overview]
Message-ID: <d9d4e30c-bd27-eb25-9f13-5e631096ade5@loongson.cn> (raw)
In-Reply-To: <3d26b5ef4aa4ec462c3232a21527424b933dd70a.camel@xry111.site>

For -fsection-anchors, I think it is less affected by relax.  Could you 
please
give some special question about this?


On LoongArch architecture, -mno-explicit-relocs may have a higher 
performance
than -mexplicit-relocs for some large program.


在 2023/5/22 下午1:40, Xi Ruoyao 写道:
> On Mon, 2023-05-22 at 09:34 +0800, mengqinggang wrote:
>> This is the v4 version of patches to support loongarch linker relax.
>> This version mainly rebase to the master branch.
>>
>> The binutils, gcc, glibc and Spec2006 testcases is ok.
> Have you tried the kernel and GRUB?  AFAIK they are the most "fragile"
> package regarding to this kind of optimization.  The RISC-V port of them
> uses -mno-relax.
>
>> Now, only the instrunctions expand from macro (la.local, la.global, etc.) at
>> assembly time can be relaxed, because gcc instruction scheduling causes relax
>> unable to handle some special cases. Gcc can add -mno-explicit-relocs option
>> to generate macro instrunction.
> I guess -fsection-anchors (enabled by default with any optimization
> level but -O0) can also affect.  Maybe we should change GCC to use -mno-
> explicit-relocs and maybe -fno-section-anchors for -Os then.  For -O1/-
> O2/-O3 the benefit of scheduling is more important on a modern CPU.
>
>> There are two code sequence can be relaxed in LoongArch. The first one
>> is "pcala12i + addi.d", which can be relaxed to pcaddi. Another one is
>> "pcalau12i + ld.d", which can be relaxed to "pcalau12i + addi.d". And it can be
>> relaxed to pcaddi one more time. Pcaddi instrunction can address a signed 22
>> bits 4-byte alinged offset relative to pc.
>>
>> In the future, the TLS LE code sequence and function call in medium
>> code mode would be relaxed too.
>>
>> For .align directive, some small problems cannot be perfectly solved (see
>> http://maskray.me/blog/2021-03-14-the-dark-side-of-riscv-linker-relaxation).
>>
>>
>> The new relocs document at here:
>>    https://github.com/loongson/LoongArch-Documentation/pull/77
> But the repo is archived so any PR in it should be considered dead.  May
> I "hijack" the discussion to ask the rationale about archiving it?  Note
> that if you want to mean "it's stable and should not be changed w/o a
> major update" you should create a tag and release instead of archiving
> it.  Archiving basically mean "the repo is dead or moved elsewhere".
>
>


  parent reply	other threads:[~2023-05-22 10:04 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 [this message]
2023-05-22 11:04     ` Xi Ruoyao
2023-05-23  2:04       ` mengqinggang
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=d9d4e30c-bd27-eb25-9f13-5e631096ade5@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).