public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: Xi Ruoyao <xry111@xry111.site>
Cc: liuzhensong <liuzhensong@loongson.cn>,
	binutils@sourceware.org, chenglulu@loongson.cn
Subject: Re: [PATCH] LoongArch: Use copy relocation for %pc_lo12 against external symbol
Date: Thu, 1 Sep 2022 00:42:28 -0700	[thread overview]
Message-ID: <20220901074228.pofoyuc6346dlumu@gmail.com> (raw)
In-Reply-To: <d1089572e821cf1cdb6f7e69223bb32df2ec2a41.camel@xry111.site>

On 2022-09-01, Xi Ruoyao via Binutils wrote:
>On Thu, 2022-09-01 at 09:27 +0800, liuzhensong wrote:
>
>> The R_LARCH_COPY is supported in older versions, we removed this
>> feature and are not going to support.
>
>Hmm, then for
>
>extern int x;
>int f() { return x; }
>
>it will produce a GOT access.  If x is in another TU but not in a shared
>library, such a GOT access and the GOT entry is unneeded.
>
>This will be really a pain for situations like building an OS kernel, or
>with -static or -static-pie.  Even for this simple example, there is no
>way to tell "x" is not in a shared library (maybe, expect LTO or linker
>relaxation, but IIRC LTO or relaxation do not *guarantee* to avoid the
>GOT, just "try to" avoid the GOT).
>
>So is there any serious reason forbidding us from using R_LARCH_COPY? Or
>any options for this "unneeded GOT" issue?
>-- 
>Xi Ruoyao <xry111@xry111.site>
>School of Aerospace Science and Technology, Xidian University

There is a slow trend to eliminate copy relocations for ELF platforms.
If a new port doesn't have copy relocations, leave it.

An architecture can add GOT indirection to PC-relative addressing
optimization if desired.

      parent reply	other threads:[~2022-09-01  7:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 13:22 Xi Ruoyao
2022-08-31 13:41 ` Xi Ruoyao
2022-09-01  1:38   ` liuzhensong
2022-09-01  1:38     ` liuzhensong
2022-09-01  2:12     ` Xi Ruoyao
2022-09-01  2:31       ` liuzhensong
2022-09-01  2:31         ` liuzhensong
2022-09-01  1:27 ` liuzhensong
2022-09-01  1:27   ` liuzhensong
2022-09-01  1:41   ` Xi Ruoyao
2022-09-01  2:09     ` liuzhensong
2022-09-01  7:42     ` Fangrui Song [this message]

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=20220901074228.pofoyuc6346dlumu@gmail.com \
    --to=i@maskray.me \
    --cc=binutils@sourceware.org \
    --cc=chenglulu@loongson.cn \
    --cc=liuzhensong@loongson.cn \
    --cc=xry111@xry111.site \
    /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).