[PATCH] Emit .debug_str and DW_FORM_strp where appropriate

Jakub Jelinek jakub@redhat.com
Thu Nov 8 11:02:00 GMT 2001


On Thu, Nov 08, 2001 at 10:23:06AM -0800, Richard Henderson wrote:
> On Thu, Nov 08, 2001 at 12:09:58PM -0500, Jakub Jelinek wrote:
> > +/* If assembler supports SHF_MERGE, we want strings in .debug_str section
> > +   merged.  */
> > +
> > +#ifdef HAVE_GAS_SHF_MERGE
> > +#define DEBUG_STR_SECTION_FLAGS \
> > +  (SECTION_DEBUG | SECTION_MERGE | SECTION_STRINGS | 1)
> > +#endif
> 
> Any reason not to have this in dwarf2out.c?

Will change that.

> > +  /* If we emitted any DW_FORM_strp form attribute, output string
> > +     table too.  */
> > +  if (debug_str_hash)
> > +    ht_forall (debug_str_hash, output_indirect_string, NULL);
> 
> Perhaps move the named_section_flags call here outside the loop?

The reason was that I don't want to switch to .debug_str (thus creating it),
if there are no strings to be output. But even if debug_str_hash is not
NULL, there might be no DW_FORM_strp strings in the hash table.

> Or perhaps make the argument be 
> 
>   if (debug_str_hash)
>     {
>       bool changed_section = false;
>       ht_forall (debug_str_hash, output_indirect_string, &changed_section);
>     }
> 
>   ...
> 
>   if (!*changed_section_p)
>     {
>       *changed_section_p = true;
>       named_section (...);
>     }

I can change this, but named_section_flags will do the same alone, won't
it?

  if (in_section != in_named || strcmp (name, in_named_name) != 0)

	Jakub



More information about the Gcc-patches mailing list