public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: YunQiang Su <syq@gcc.gnu.org>
To: Fangrui Song <i@maskray.me>
Cc: nickc@redhat.com, binutils@sourceware.org, macro@orcam.me.uk,
	 xry111@xry111.site
Subject: Re: [PATCH v4] MIPS: Support PCREL GOT access
Date: Thu, 18 Apr 2024 18:56:27 +0800	[thread overview]
Message-ID: <CAKcpw6We86FGOBTarQDYT9XiOWxu_dA7tBEkSZ80bxefbx8Rpg@mail.gmail.com> (raw)
In-Reply-To: <DS7PR12MB57650A5401095ED70D3AB0EDCB3D2@DS7PR12MB5765.namprd12.prod.outlook.com>

Fangrui Song <i@maskray.me> 于2024年4月3日周三 12:11写道:
>
> On Sat, Mar 16, 2024 at 1:51 AM YunQiang Su <syq@gcc.gnu.org> wrote:
> >
> > Current if we need to access a GOT entry, we use the
> > got_base + offset. Thus we have GOT and XGOT.
> > From MIPSr6, we have PCREL instructions like ALUIPC,
> > so we have no need to use got_base now.
> > For pre-R6, we can use BAL to get the the value of PC.
>
> Currently loading a GOT entry requires loading the GOT base address
> first, then adding an offset.
> Therefore, (elaborate the reason) we need both GOT and XGOT.
> MIPSr6 introduced PC-relative instructions like ..., which allow us to
> use a pair of .. and .. to materialize the GOT entry address.
>

Thanks.

Currently loading a GOT entry requires loading the GOT base address
first, then adding an offset. Therefore, (elaborate the reason)
we need both GOT and XGOT. MIPSr6 introduced PC-relative instructions
like ALUIPC/AUIPC, which allow us to use a pair of GOTPC_HI and
GOTPC_LO to materialize the GOT entry address.


> > In this patch, we add 8 new relocs:
> >         R_MIPS_GOTPC_HI16, R_MIPS_GOTPC_LO16,
> >         R_MIPS_GOTPC_CALL_HI16, R_MIPS_GOTPC_CALL_LO16,
> >         R_MIPS_GOTPC_AHI16, R_MIPS_GOTPC_ALO16,
> >         R_MIPS_GOTPC_CALL_AHI16, R_MIPS_GOTPC_CALL_ALO16.
> > These asm notes can be used for them:
> >         %gotpc_hi(sym), %gotpc_lo(sym),
> >         %gotpc_call_hi(sym), %gotpc_call_lo(sym),
> >         %gotpc_ahi(sym), %gotpc_alo(sym),
> >         %gotpc_call_ahi(sym), %gotpc_call_alo(sym).
>
> GCC's mips port names assembler relocation operators
> (gas/config/tc-mips.c names them `mips_percent_op`).
> Other ports seem to prefer "modifiers" (assembler modifiers,
> expression modifiers).
>

These percent_op can be used for them


> >         * bfd-in2.h: Add new MIPS GOTPC BFD_RELOC defination.
>
> typo
>
Thanks.

Ping  again.

  parent reply	other threads:[~2024-04-18 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16  8:51 YunQiang Su
2024-03-26  2:18 ` YunQiang Su
2024-04-03  4:04 ` Fangrui Song
     [not found] ` <DS7PR12MB57650A5401095ED70D3AB0EDCB3D2@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-04-18 10:56   ` YunQiang Su [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-02 12:51 YunQiang Su
2024-02-02 13:30 ` Maciej W. Rozycki
2024-02-03  2:03   ` YunQiang Su

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=CAKcpw6We86FGOBTarQDYT9XiOWxu_dA7tBEkSZ80bxefbx8Rpg@mail.gmail.com \
    --to=syq@gcc.gnu.org \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    --cc=macro@orcam.me.uk \
    --cc=nickc@redhat.com \
    --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).