[gnu.gcc.bug] gcc v1.34 on 386i with coff encapsulation

Leisner.Henr@XEROX.COM (Marty) (04/20/89)

I'm trying to bring up to gas v1.31 and the gnu linker with gcc v1.34 on a
sun386i (as a step towards doing cross-developing for other systems).

I'm still not there yet (if anyone has done this, please let me know how
you did it).

The script libconvert has a problem -- the sun386i libc.a object names are
longer than 15 characters, so that libconvert doesn't apply robotussin  to
all the objects.  Changing
< for i in *.o
to
> for i in *
is adequate.

Robotussin seems to be having problems with the sun objects.


For the empty program, the sun C compiler produces (cc -S foo.c)
        .file   "foo.c"
        .version        "sun386-1.0"
        .optim
.LL0:
        .data
	
and the assembler produces the following (in objdump):
mlsun% objdump -t foo.o
 
 
                        ***SYMBOL TABLE INFORMATION***
[Index] m1  Name        Value      Scnum   Type   Sclass  Numaux  Name
[Index] m2  Offset      Value      Scnum   Type   Sclass  Numaux  Name
[Index] a              Tagndx     Misc    Misc     Fcnary       Fcnary
Tvdnx
 
foo.o:
[0]     m1  .file     0x00000000      -2  0x0000   0x67    1  .file
[1]     a    779054950   0x0063  0x0000  0x00000000  0x00000000  0
[2]     m1  .text     0x00000000       1  0x0000   0x03    1  .text
[3]     a           0   0x0000  0x0000  0x00000000  0x00000000  0
[4]     m1  .data     0x00000000       2  0x0000   0x03    1  .data
[5]     a           0   0x0000  0x0000  0x00000000  0x00000000  0
[6]     m1  .bss      0x00000000       3  0x0000   0x03    1  .bss
[7]     a           0   0x0000  0x0000  0x00000000  0x00000000  0
[8]     m1  .comment  0x00000000       4  0x0000   0x03    1  .comment
[9]     a          12   0x0000  0x0000  0x00000000  0x00000000  0
[10]    m1  -lg       0x00000000      -1  0x0000   0x02    0  -lg
 
 
 I have no idea what the -lg symbol is in section number -1.

When converting the libraries, the gnu linker barfed on these -lg symbols.

I patched robutussin to discard symbols where the section number was -1 -- 
patches look like:
    symbol_count = 0;
    for (i = 0; i < coff_header.f_nsyms; ++i)
      {
        if (coff_sym_listp[i].n_scnum != N_DEBUG
!         && coff_sym_listp[i].n_name[0] != '.')
        {
          if (verbose_flag)
            printf ("map %d to %d\n", i, symbol_count);
 --- 267,280 ----
    symbol_count = 0;
    for (i = 0; i < coff_header.f_nsyms; ++i)
      {
+ #ifdef DEBUG
+       printf("%s in scnum %d\n", coff_sym_listp[i].n_name,
coff_sym_listp[i].n
_scnum);
+ #endif
+
        if (coff_sym_listp[i].n_scnum != N_DEBUG
!         && coff_sym_listp[i].n_name[0] != '.'
!         && coff_sym_listp[i].n_scnum != -1)
!
        {
          if (verbose_flag)
            printf ("map %d to %d\n", i, symbol_count);
***************
*** 383,389 ****
    for (i = 0; i < coff_header.f_nsyms; ++i)
      {
        if (coff_sym_listp[i].n_scnum != N_DEBUG
!         && coff_sym_listp[i].n_name[0] != '.')
        {
          if (coff_sym_listp[i].n_zeroes == 0)
            {
--- 390,397 ----
    for (i = 0; i < coff_header.f_nsyms; ++i)
      {
        if (coff_sym_listp[i].n_scnum != N_DEBUG
!         && coff_sym_listp[i].n_name[0] != '.'
!         && coff_sym_listp[i].n_scnum != -1)
        {
          if (coff_sym_listp[i].n_zeroes == 0)
            {
	    
I'm not sure I understand these -lg symbols but gnu ld definitely didn't
like them.

Anyway, I can now get trivial C programs to link but they core dump.

Before I continue on this adventure, anyone have any advise?
	    
marty
ARPA:	leisner.henr@xerox.com
GV:  leisner.henr
NS:  martin leisner:wbst139:xerox
UUCP:	hplabs!arisia!leisner