This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] [RISCV] Support subtraction of .uleb128.
- From: Kito Cheng <kito dot cheng at gmail dot com>
- To: Kuan-Lin Chen <kuanlinchentw at gmail dot com>
- Cc: Nelson Chu <nelson dot chu at sifive dot com>, Jim Wilson <jimw at sifive dot com>, Palmer Dabbelt <palmerdabbelt at google dot com>, "binutils at sourceware dot org Development" <binutils at sourceware dot org>
- Date: Mon, 6 Jan 2020 16:36:54 +0800
- Subject: Re: [PATCH] [RISCV] Support subtraction of .uleb128.
- References: <CAJr6u0h3bsoK+-WXzs+ZHUi-GNb06MY8nDKD9=1JRFEGRp5r=A@mail.gmail.com> <mhng-41e79fc2-7d82-4ff8-9e22-2bc8b4980ba9@palmerdabbelt-glaptop> <CAJr6u0hFBQSRzatQbU_B-rPwj1Ja9a6qQJWtEeZQM6tvfkRDBg@mail.gmail.com> <CAFyWVaZMWXtGB9vx-OM6f-P5hy_OpKTTHJ+b4V6iUu8p5MOD-w@mail.gmail.com> <CAJYME4HkAD92NwayWGRzO9XOgmkO=9Yep+LuhnYoA-=9RODDFA@mail.gmail.com> <CAJr6u0i+b4AmyWCJ-ke1NMziFFX7fTZN+E35yq+eKg5PbxbC5g@mail.gmail.com>
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 <kuanlinchentw@gmail.com>
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 <nelson.chu@sifive.com> 於 2019年12月18日 週三 上午9:50寫道:
> >
> > 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 != rel->r_offset)
> > + {
> > - (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
> > - input_bfd, howto->name);
> > - bfd_set_error (bfd_error_bad_value);
> > + msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
> > + r = bfd_reloc_dangerous;
> > + break;
> > + }
> > + relocation = relocation - uleb128_vma;
> > + uleb128_rel = NULL;
> > + break;
> > + }
> > +
> > + case R_RISCV_SUB_ULEB128:
> > + if (uleb128_rel)
> > + {
> > + if (uleb128_rel->r_offset != rel->r_offset)
> > + {
> > - (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
> > - input_bfd, howto->name);
> > - bfd_set_error (bfd_error_bad_value);
> > + msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
> > + r = bfd_reloc_dangerous;
> > + break;
> > + }
> > + relocation = uleb128_vma - relocation;
> > + uleb128_rel = NULL;
> > + break;
> > + }
> >
> > Thanks and regards
> > Nelson
>
>
>
> --
> Best regards,
> Kuan-Lin Chen.
> kuanlinchentw@gmail.com
>