public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: WANG Xuerui <i.swmail@xen0n.name>,
	liuzhensong <liuzhensong@loongson.cn>,
	 binutils@sourceware.org
Cc: maskray@google.com, caiyinyu@loongson.cn, chenglulu@loongson.cn,
	 mengqinggang@loongson.cn, xuchenghua@loongson.cn
Subject: Re: [PATCH] LoongArch: ld: Fix bug not generate plt when link a x.so
Date: Sat, 20 Aug 2022 19:19:07 +0800	[thread overview]
Message-ID: <07816f43429c1191bb2be85cd6d189b4017f836a.camel@xry111.site> (raw)
In-Reply-To: <c9af6f90-c1b4-9aa3-f059-2bf131719f3a@xen0n.name>

On Sat, 2022-08-20 at 18:56 +0800, WANG Xuerui wrote:
> Hi,
> 
> On 8/20/22 17:08, liuzhensong wrote:
> >    bfd/
> >      elfnn-loongarch.c
> 
> Could use some explanation as to why this is a problem, with a minimal
> reproduction example or otherwise how did you encounter this. Because 
> the patch title is not of much help.

I guess this comes from the -mcmodel=medium option (under review at GCC
side), which generates a pair of pcalau12i/jirl instructions for local
function call.  But pcalau12i/jirl is not enough for a global call
(calling a function in DSO from the main image will obviously exceed the
2GiB range) so a PLT entry is needed.

> Also a testsuite addition would probably be nice.

I agree.

/* snip */

> >           if (h != NULL)
> >             {
> > +             /* For pcalau12i + jirl.  */
> > +               {

Why do we ever need this `{`, ...

> > +                 h->needs_plt = 1;
> > +                 if (h->plt.refcount < 0)
> > +                   h->plt.refcount = 0;
> > +                 h->plt.refcount++;
> > +               }

and this `}`?

> > +
> >               h->non_got_ref = 1;
> >               h->pointer_equality_needed = 1;
> >             }

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

      reply	other threads:[~2022-08-20 11:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20  9:08 liuzhensong
2022-08-20 10:56 ` WANG Xuerui
2022-08-20 11:19   ` Xi Ruoyao [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=07816f43429c1191bb2be85cd6d189b4017f836a.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=binutils@sourceware.org \
    --cc=caiyinyu@loongson.cn \
    --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).