Re: [PATCH v2] elf: Set this_idx to -1 for invalid relocations

"H.J. Lu" <[email protected]> Tue, 4 Aug 2026 06:20:22 +0800
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAMe9rOqWD59U751X8wp3h80MYETKnf9u1O79qjFEM5EZ61WGTA@mail.gmail.com>
On Mon, Aug 3, 2026 at 8:51=E2=80=AFPM Alan Modra <[email protected]> wrote:
>
> On Mon, Aug 03, 2026 at 07:58:27AM +0800, H.J. Lu wrote:
> > On Mon, Aug 3, 2026 at 7:43=E2=80=AFAM Alan Modra <[email protected]> wr=
ote:
> > >
> > > On Sun, Aug 02, 2026 at 08:55:00AM +0800, H.J. Lu wrote:
> > > > On Sun, Aug 2, 2026 at 6:18=E2=80=AFAM H.J. Lu <[email protected]=
> wrote:
> > > > >
> > > > > When invalid relocation is reported by elf_link_read_relocs_from_=
section
> > > > > called from lang_gc_sections:
> > > > >
> > > > > ld: pr34448-bug_18.o: bad reloc symbol index (0xf2000005 >=3D 0x1=
3) for
> > > > > offset 0x4 in section `.text.get_tls[get_tls]'
> > > > >
> > > > > the same error is reported again:
> > > > >
> > > > > ld: pr34448-bug_18.o: bad reloc symbol index (0xf2000005 >=3D 0x1=
3) for
> > > > > offset 0x4 in section `.text.get_tls[get_tls]'
> > >
> > > Using this_idx as a flag is a bad idea.
> > >
> > > I also think that no one should be too concerned about error messages
> > > from fuzzed object files, so if you are going to fix this minor
> > > problem do so in a way that won't potentially break the linker.
> > >
> >
> > Then should linker stop when seeing a fuzzed object file, instead of ke=
ep
> > going and crash later?
>
> How is this relevant to a patch about duplicate error messages?
>

If we don't care too much about fuzzed object files, why doesn't linker
stop when seeing them?

--=20
H.J.