This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems linking c++ statically on AIX using gcc 3.2


Hello GnuCompilerCoders,

using
	Reading specs from
/data/mk/gcc/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.2/specs
	Configured with:
../configure --prefix=/data/mk/gcc --enable-languages=c,c++ --with-gnu-as --
with-gnu-ld : (reconfigured)
../configure --prefix=/data/mk/gcc --enable-languages=c,c++ --with-gnu-as --
with-gnu-ld
	Thread model: aix
	gcc version 3.2
and binutils 2.13 (ld & as)

I have problems statically linking C++ object files together.

bash-2.05$ cat libtest.cpp

#include <stdio.h>
#include "testlib.h"
int main() {
        printf("Hello from main\n");
        testlib();
}

bash-2.05$ cat testlib.h

void testlib();

bash-2.05$ cat testlib.cpp

#include <stdio.h>
void testlib() {
        printf("Hello from testlib\n");
}

bash-2.05$ g++ -g      -fPIC  -c libtest.cpp -o libtest.o

bash-2.05$ g++ -g      -fPIC  -c testlib.cpp -o testlib.o

bash-2.05$ g++ -fPIC libtest.o testlib.o -o libtest

bash-2.05$ ./libtest
exec(): 0509-036 Cannot load program ./libtest because of the following
errors:
        0509-140 Relocation failed for
/data/mk/gcc/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.2/../../../libstdc++.a(lib
stdc++.so.5) because:
        0509-141   Relocation entry 135 (at address 10000FB8)
                   has an invalid l_rsecnm field.
        0509-141   Relocation entry 136 (at address 10000FDC)
                   has an invalid l_rsecnm field.
        0509-141   Relocation entry 137 (at address 10000FEC)
                   has an invalid l_rsecnm field.
        0509-141   Relocation entry 138 (at address 10001038)
                   has an invalid l_rsecnm field.
...
        0509-141   Relocation entry 273 (at address 10002704)
                   has an invalid l_rsecnm field.
        0509-141   Relocation entry 274 (at address 10002744)
                   has an invalid l_rsecnm field.
        0509-021 Additional errors occurred but are not reported.
        0509-191 Examine .loader section relocation entries with the
                 'dump -Rv' command.

Doing the same with .c / gcc works fine.

Linking on AIX is tricky. But using gnu ld it shouldn't be THAT tricky?

Can anyone give me a hint to what the problem (or the solution) is?

gives
Mads


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]