[PATCH] dwarf: Bail out if debug info needs relocation
Alan Modra
amodra@gmail.com
Tue Sep 11 15:04:00 GMT 2018
On Tue, Sep 11, 2018 at 06:48:13AM -0700, H.J. Lu wrote:
> On Mon, Sep 10, 2018 at 7:17 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Fri, Sep 07, 2018 at 12:58:32PM -0700, H.J. Lu wrote:
> >> PR ld/23425
> >> * dwarf2.c (find_abstract_instance): Bail out if debug info
> >> needs relocation.
> >> ---
> >> bfd/dwarf2.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >>
> >> diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
> >> index 8fadb5c4b6..bce5db9c7e 100644
> >> --- a/bfd/dwarf2.c
> >> +++ b/bfd/dwarf2.c
> >> @@ -2839,6 +2839,9 @@ find_abstract_instance (struct comp_unit * unit,
> >> total = info_ptr_end - info_ptr;
> >> if (!die_ref || die_ref >= total)
> >> {
> >> + /* Bail out if the debug info needs relocation. */
> >> + if ((unit->stash->sec->flags & SEC_RELOC))
> >> + return TRUE;
> >> _bfd_error_handler
> >> (_("DWARF error: invalid abstract instance DIE ref"));
> >> bfd_set_error (bfd_error_bad_value);
> >
> > Every .debug_info section will have relocations, so this completely
> > disables the error checking here. Too much sweeping under the rug.
>
> It disables error checking on relocatable files, not on executables
> nor shared objects.
>
> > I believe the problem is described by the comment just above this
> > code: "We only support DW_FORM_ref_addr within the same file".
> >
>
> I don't believe find_abstract_instance should check if there are
> relocation errors in a relocatable file. What does my patch
> change in binutils behavior?
ld will no longer report errors on corrupted ref_addr debug info.
Also, we need to do more than just disable an error to fix PR23425.
I'll post a patch with more explanation in a little while.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list