public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: liuzhensong <liuzhensong@loongson.cn>, binutils@sourceware.org
Cc: WANG Xuerui <i.swmail@xen0n.name>, chenglulu@loongson.cn
Subject: Re: [PATCH] LoongArch: Use copy relocation for %pc_lo12 against external symbol
Date: Thu, 01 Sep 2022 09:41:17 +0800	[thread overview]
Message-ID: <d1089572e821cf1cdb6f7e69223bb32df2ec2a41.camel@xry111.site> (raw)
In-Reply-To: <e0fad4d1-cf0f-bae6-186c-ad6a3b601d03@loongson.cn>

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

  parent reply	other threads:[~2022-09-01  1:41 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 [this message]
2022-09-01  2:09     ` liuzhensong
2022-09-01  7:42     ` Fangrui Song

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=d1089572e821cf1cdb6f7e69223bb32df2ec2a41.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=binutils@sourceware.org \
    --cc=chenglulu@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@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).