[gnu.utils.bug] bug in ld

glenne@HPLSLA.HP.COM (Glenn Engel) (02/07/90)

>
>Glenn,
>
>I've a bug report for the -M option of ld below. The obvious address for
>email to a bug list for util failed (bug-util@prep.ai.mit.edu) - could you
>forward it to the right one, or perhaps you know the person at FSF looking
>after utils ?
>
>Dave
>
>--------------
When the -M ( show load map etc. ) option of the GNU linker, ld is used,
the program sometimes dumps core when printing the local symbols of modules
containing SET elements. I believe the version to be 0.01.

I am not knowledgeable enough concerning SET ELEMENTS to suggest a proper
fix which prints correct output for the SET_ELEMENT symbol, but the
following prevents the problem:

In ld.c, function "list_file_locals( entry, outfile )", the third test of
the if statement, "&& ! SET_ELEMENT_P( p->n_type )" has been added as a fix.
Set elements have their n_un.n_strx entry corrupted by this stage, causing
the fprintf to dump core.


|  for (p = entry->symbols; p < end; p++)
|    /* If this is a definition,
|       update it if necessary by this file's start address.  */
|
|    if (!(p->n_type & (N_STAB | N_EXT )) && ! SET_ELEMENT_P( p->n_type))
|      fprintf (outfile, "  %s: 0x%x\n",
|	       entry->strings + p->n_un.n_strx, p->n_value);
|      
|  entry->strings = 0;		/* All done with them.  */