Weak symbol support on powerpc-ibm-aix5.2.0.0 (binutils 2.15)

Michael Klein michael.klein@fazi.de
Wed Jul 28 09:23:00 GMT 2004


Hi Nick!

> > Are weak symbols unsupported on AIX 5.2 or is this a gas/bfd bug?
>
> It is a bug...
>
> > 	.csect 	.data[RW]
> >
> > 	.globl 	g
> > g:	.long 	0
> >
> > 	.weak 	w
> > w:	.long 	0
>
> Please try the attached patch and let me know how you get on with it.

Thanks!  Looks better now, the "nm -l" output is identical with IBM as
and GNU as.  However, IBM ld doesn't like the generated object file:

$ ld -r gas.o
ld: 0711-562 SEVERE ERROR: Symbol table entry 6 in object gas.o:
        An auxiliary symbol table entry is required for a
        C_EXT or C_HIDEXT entry.

$ gobjdump -t gas.o

gas.o:     file format aixcoff-rs6000

SYMBOL TABLE:
[  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 fake
File
[  2](sec  2)(fl 0x00)(ty   0)(scl 107) (nx 1) 0x00000000 .data
AUX val     8 prmhsh 0 snhsh 0 typ 1 algn 2 clss 5 stb 0 snstb 0
[  4](sec  2)(fl 0x00)(ty   0)(scl   2) (nx 1) 0x00000000 g
AUX indx    2 prmhsh 0 snhsh 0 typ 2 algn 0 clss 5 stb 0 snstb 0
[  6](sec  2)(fl 0x00)(ty   0)(scl 111) (nx 0) 0x00000004 w


$ gobjdump -t as.o

as.o:     file format aixcoff-rs6000

SYMBOL TABLE:
[  0](sec -2)(fl 0x00)(ty c03)(scl 103) (nx 1) 0x00000000 weak.a
File
[  2](sec  1)(fl 0x00)(ty   0)(scl 107) (nx 1) 0x00000000 .data
AUX val     8 prmhsh 0 snhsh 0 typ 1 algn 2 clss 5 stb 0 snstb 0
[  4](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 1) 0x00000000 g
AUX indx    2 prmhsh 0 snhsh 0 typ 2 algn 0 clss 5 stb 0 snstb 0
[  6](sec  1)(fl 0x00)(ty   0)(scl 111) (nx 1) 0x00000004 w
AUX lnno 0 size 0x0 tagndx 2


While GNU ld doesn't complain here, it cannot link trivial C++ code
either (not sure if this is related?):

$ gcc -xc++ -
class C
{
  public: C() {};
};

int main()
{
  C c;
}
^D
/usr/local/lib/gcc/powerpc-ibm-aix5.2.0.0/3.4.1/../../../../powerpc-ibm-aix5.2.0.0/bin/ld: /tmp/cczJxxzl.o: reloc .data:0 not in csect
/tmp/cczJxxzl.o: could not read symbols: Bad value
collect2: ld returned 1 exit status


Regards,

-- 
Michael

#exclude <windows.h>



More information about the Binutils mailing list