[PATCH] dwarf: Bail out if debug info needs relocation

Alan Modra amodra@gmail.com
Tue Sep 11 02:18:00 GMT 2018
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.

I believe the problem is described by the comment just above this
code: "We only support DW_FORM_ref_addr within the same file".

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list