From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6468 invoked by alias); 6 Jan 2020 08:37:10 -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 6454 invoked by uid 89); 6 Jan 2020 08:37:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,BODY_8BITS,FREEMAIL_FROM,FREEMAIL_REPLY,GARBLED_BODY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=H*f:1JRFEGRp5r, H*i:CAJr6u0i, H*f:LuhnYoA, H*f:sk:CAJr6u0 X-HELO: mail-wm1-f43.google.com Received: from mail-wm1-f43.google.com (HELO mail-wm1-f43.google.com) (209.85.128.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Jan 2020 08:37:08 +0000 Received: by mail-wm1-f43.google.com with SMTP id 20so14392326wmj.4 for ; Mon, 06 Jan 2020 00:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lrhOR1df69Rr0CFSawrOMoaDkYDKNAgmrh5+qetD8uM=; b=gcZHMWUzEuKx81wJ0TRRV+WfuwHwgJnSwmbrnjynW35dfp5m0dQrM80IbZjGf6jTrL s4fYMqsQiKKWHhsRFnDMEqNKrMvByCaZf4YTyutdgAxVKhWjvYIC12qCudhVOofLw0UQ DMunxDbUAH4OdMfZXDLOBDPp8Y7Xy/u6eZ+TOnumZiCZoJ4h1Gtqr3S/7tCbcx8YnQvw ibiqlDFmbk7gweQKV/DwzCK439vkFh5M36ni4xSONcS1jM1O1iVH1TI9+UMmxwOS6g/z j5s5q/E1zSCwYR7wO2tbkKQwnyBVWWnu4TV/n1EO0QrJvK7RPcpETdNShgF0EhEJbcgF BaqA== MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Mon, 06 Jan 2020 08:37:00 -0000 Message-ID: Subject: Re: [PATCH] [RISCV] Support subtraction of .uleb128. To: Kuan-Lin Chen Cc: Nelson Chu , Jim Wilson , Palmer Dabbelt , "binutils@sourceware.org Development" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00040.txt.bz2 Hi Kuan-Lin: > * testsuite/ld-riscv-elf/uleb128.d: New test. > * testsuite/ld-riscv-elf/uleb128.s: New file. Those two files are not included in the patch, maybe you forgot add? On Mon, Jan 6, 2020 at 4:18 PM Kuan-Lin Chen wrote: > Hi, > > The patch is fixed some problems as your comments in previous mails. > > >The assumption that the uleb128 address size can only decrease with > relaxation is true only if both addresses are in the same section. > I found this kind of subtract is banned in cvt_frag_to_fill for > rs_leb128. Therefore, it doesn't have to restrict by ourselves. > > Thanks for your reviews. > > Nelson Chu =E6=96=BC 2019=E5=B9=B412=E6=9C=8818= =E6=97=A5 =E9=80=B1=E4=B8=89 =E4=B8=8A=E5=8D=889:50=E5=AF=AB=E9=81=93=EF=BC= =9A > > > > There is one minor thing. Maciej has pointed out before that it's > > better done with one the percent-codes to `_bfd_error_handler' rather > > than aborting the link right away, so that any further link errors are > > also reported and you don't have to shake them out one by one. So > > report the relocation error via linker's callback function seems to be > > better. I think maybe we can report a dangerous relocation for the > > mismatched R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128. What I meant > > is that, > > > > + case R_RISCV_SET_ULEB128: > > ... > > + else > > + { > > + if (uleb128_rel->r_offset !=3D rel->r_offset) > > + { > > - (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "), > > - input_bfd, howto->name); > > - bfd_set_error (bfd_error_bad_value); > > + msg =3D ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched.= "); > > + r =3D bfd_reloc_dangerous; > > + break; > > + } > > + relocation =3D relocation - uleb128_vma; > > + uleb128_rel =3D NULL; > > + break; > > + } > > + > > + case R_RISCV_SUB_ULEB128: > > + if (uleb128_rel) > > + { > > + if (uleb128_rel->r_offset !=3D rel->r_offset) > > + { > > - (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "), > > - input_bfd, howto->name); > > - bfd_set_error (bfd_error_bad_value); > > + msg =3D ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched.= "); > > + r =3D bfd_reloc_dangerous; > > + break; > > + } > > + relocation =3D uleb128_vma - relocation; > > + uleb128_rel =3D NULL; > > + break; > > + } > > > > Thanks and regards > > Nelson > > > > -- > Best regards, > Kuan-Lin Chen. > kuanlinchentw@gmail.com >