[PATCH] DWARF: Skip if abbrev number isn't found for for DWARF5

Alan Modra amodra@gmail.com
Thu Mar 18 06:14:28 GMT 2021


On Wed, Mar 17, 2021 at 09:25:51PM -0700, H.J. Lu via Binutils wrote:
> --- a/bfd/dwarf2.c
> +++ b/bfd/dwarf2.c
> @@ -3420,10 +3420,14 @@ scan_unit_for_symbols (struct comp_unit *unit)
>  	  /* Avoid multiple reports of the same missing abbrev.  */
>  	  if (abbrev_number != previous_failed_abbrev)
>  	    {
> -	      _bfd_error_handler
> -		(_("DWARF error: could not find abbrev number %u"),
> -		 abbrev_number);
> +	      /* NB: DWARF5 may have references to other CUs.  */
> +	      if (unit->version < 5)
> +		_bfd_error_handler
> +		  (_("DWARF error: could not find abbrev number %u"),
> +		   abbrev_number);
>  	      previous_failed_abbrev = abbrev_number;
> +	      if (unit->version >= 5)
> +		goto skip;
>  	    }
>  	  bfd_set_error (bfd_error_bad_value);
>  	  goto fail;

This doesn't feel right to me.  Why are we looking for an abbrev in
the wrong CU?  Presumably if the reader can do that, then it might
interpret a lower number abbrev wrongly.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list