From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29940 invoked by alias); 4 Mar 2020 00:07:27 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 29932 invoked by uid 89); 4 Mar 2020 00:07:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=H*f:sk:CAFyWVa, H*i:sk:CAFyWVa, HX-HELO:sk:mail-pf, H*r:100 X-HELO: mail-pf1-f194.google.com Received: from mail-pf1-f194.google.com (HELO mail-pf1-f194.google.com) (209.85.210.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Mar 2020 00:07:25 +0000 Received: by mail-pf1-f194.google.com with SMTP id y26so952756pfn.11 for ; Tue, 03 Mar 2020 16:07:24 -0800 (PST) Return-Path: Received: from localhost ([2620:15c:2d1:100:5984:9ed:74e:4727]) by smtp.gmail.com with ESMTPSA id h7sm27154536pfq.36.2020.03.03.16.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2020 16:07:22 -0800 (PST) Date: Wed, 04 Mar 2020 00:07:00 -0000 From: Fangrui Song To: Nelson Chu Cc: Binutils , James Clarke , Kito Cheng , Palmer Dabbelt , Jim Wilson Subject: Re: [PATCH 2/2] RISC-V: Support assembler modifier %got_pcrel_hi. Message-ID: <20200304000721.ujbcawqjzv3eeweq@google.com> References: <1583230959-11401-1-git-send-email-nelson.chu@sifive.com> <1583230959-11401-3-git-send-email-nelson.chu@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-SW-Source: 2020-03/txt/msg00058.txt On 2020-03-03, Jim Wilson wrote: >On Tue, Mar 3, 2020@2:22 AM Nelson Chu 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.