public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: Nelson Chu <nelson.chu@sifive.com>
Cc: Binutils <binutils@sourceware.org>,
	James Clarke <jrtc27@jrtc27.com>,
	Kito Cheng <kito.cheng@sifive.com>,
	Palmer Dabbelt <palmerdabbelt@google.com>,
	Jim Wilson <jimw@sifive.com>
Subject: Re: [PATCH 2/2] RISC-V: Support assembler modifier %got_pcrel_hi.
Date: Wed, 04 Mar 2020 00:07:00 -0000	[thread overview]
Message-ID: <20200304000721.ujbcawqjzv3eeweq@google.com> (raw)
In-Reply-To: <CAFyWVab0j-HC3KHSS+k1=MYZ1XZjf3kMMOz0thd_hBRXHX48Ow@mail.gmail.com>

On 2020-03-03, Jim Wilson wrote:
>On Tue, Mar 3, 2020@2:22 AM Nelson Chu <nelson.chu@sifive.com> wrote:
>>
>>         gas/
>>         * config/tc-riscv.c: Support the modifier %got_pcrel_hi.
>>         * doc/c-riscv.texi: Add documentation.
>>         * testsuite/gas/riscv/no-relax-reloc.d: Add test case for the new
>>         modifier %got_pcrel_hi.
>>         * testsuite/gas/riscv/no-relax-reloc.s: Likewise.
>>         * testsuite/gas/riscv/relax-reloc.d: Likewise.
>>         * testsuite/gas/riscv/relax-reloc.s: Likewise.
>
>This looks good.  I'd just suggest some minor doc fixes to be
>consistent with suggestions for the first patch.
>
>> +@item %got_pcrel_hi(@var{symbol}
>> +The high 20-bit of relative address between pc and the GOT entry of
>> +@var{symbol}.  This is usually used with the %pcrel_lo to access the GOT entry.
>
>20-bit -> 20 bits
>"the %pcrel_lo" -> "%pcrel_lo" or "the %pcrel_lo modifier"
>
>> +@smallexample
>> +@var{label}:
>> +       auipc           a0, %got_pcrel_hi(@var{symbol}) // R_RISCV_GOT_HI20
>> +       addi/load/store a0, a0, %pcrel_lo(@var{label})  // R_RISCV_PCREL_LO12_I/S
>> +@end smallexample
>> +
>> +Also, the pseudo la instruction with PIC has the similar behavior.
>
>"the similar" -> "similar" or "the same"
>
>Jim

What if %got_pcrel_hi refers to a STB_LOCAL symbol? For example,

auipc a0, %got_pcrel_hi(.L1)

It may be worth a test.

FWIW, llvm-mc -triple=riscv64 -filetype=obj a.s # create a R_RISCV_GOT_HI20 referencing .L1
There is no special treatment.

  reply	other threads:[~2020-03-04  0:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 10:22 [PATCH 0/2] Add description for the RISC-V relocatable modifiers in as doc Nelson Chu
2020-03-03 10:22 ` [PATCH 1/2] RISC-V: Add description for RISC-V Modifiers to " Nelson Chu
2020-03-03 22:12   ` Jim Wilson
2020-03-03 10:22 ` [PATCH 2/2] RISC-V: Support assembler modifier %got_pcrel_hi Nelson Chu
2020-03-03 22:16   ` Jim Wilson
2020-03-04  0:07     ` Fangrui Song [this message]
2020-03-04  1:54       ` Nelson Chu

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=20200304000721.ujbcawqjzv3eeweq@google.com \
    --to=i@maskray.me \
    --cc=binutils@sourceware.org \
    --cc=jimw@sifive.com \
    --cc=jrtc27@jrtc27.com \
    --cc=kito.cheng@sifive.com \
    --cc=nelson.chu@sifive.com \
    --cc=palmerdabbelt@google.com \
    /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).