[gnu.g++.bug] collect.c can't handle extended symbols

andrew@frip.WV.TEK.COM (Andrew Klossner) (09/02/89)

collect.c doesn't deal correctly with extended symbols in COFF object
files, e.g., the output from 'gcc -g' or 'g++ -g0'.

The loop:

	for (symindex = 0; symindex < symbols; symindex++ ) {

	  SYMENT symbol;
	  char *symbol_name;
	  extern char *ldgetname();
	  
	  ldtbread(ldptr, symindex, &symbol);
		...
	}

should instead look like this:

	symindex = 0;
	while (symindex < symbols) {

	  SYMENT symbol;
	  char *symbol_name;
	  extern char *ldgetname();
	  
	  ldtbread(ldptr, symindex, &symbol);
		...
	  symindex += 1 + symbol.n_numaux;
	}

so that "auxiliary" symbol table entries will be skipped.
This is necessary because ldgetname can core-dump on an auxiliary entry.

  -=- Andrew Klossner   (uunet!tektronix!frip.WV.TEK!andrew)    [UUCP]
                        (andrew%frip.wv.tek.com@relay.cs.net)   [ARPA]

pcg@thor.cs.aber.ac.uk (Piercarlo Grandi) (09/03/89)

In article <4428@orca.WV.TEK.COM> andrew@frip.WV.TEK.COM (Andrew Klossner) writes:

   collect.c doesn't deal correctly with extended symbols in COFF object
   files, e.g., the output from 'gcc -g' or 'g++ -g0'.

As I do not like symbolic debuggers (I vastly prefer
instrumenting the source, or assembler debuggers to look at
system dependent problems), I have not bothered much with the
various problems of '-g0' for 'g++' under system V.

However, here is another one: 'g++' allows arguments to
procedures to be unnamed; no name is generated for them in the
symtab entry, and the assembler complains about illegal syntax. A
'fake' name ought to be generated.

Reproduce-by:

	main(auto int, auto char *argv[])
	{
	}

--
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk