This is the mail archive of the gcc-bugs@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]

Problems with AIX and shared libs



Hi all !

I'm trying to compile EGCS 1.1.2 on an AIX 4.1.5 platform with the
--enable-shared option enabled.

The build of the compiler works flawlessly, but when I want to
compile a simple hello world program using iostreams ( e.g.
any program linked with the stdc++ library ), the execution of
the produced binary fails with the following message :

Could not load program a.out
Could not load library .
Error was: Permission denied

The same program compiled with the -static flag works fine.

I wish to make it clear that I've applied the fix for APAR IX75823
on the AIX linker and the LIBPATH environment variable is correctly
set.

I think the build of the stdc++ shared library could be broken.

Here is the verbose output of g++ :

-----------------------------------------------------------

spezia@garfield:~/perso/test/dyn> g++ -v hello.cc
Reading specs from
/softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/cpp -lang-c++
-v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91
-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_LONG_LONG -D_IBMR2 -D_POWER
-D_AIX -D_AIX32 -D_AIX41 -D_LONG_LONG -Asystem(unix) -Asystem(aix)
-D__EXCEPTIONS -D__CHAR_UNSIGNED__ -D_ARCH_COM hello.cc /tmp/cc51RO5e.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release)
#include "..." search starts here:
#include <...> search starts here:
 /softs/egcs/include/g++
 /usr/local/include
 /softs/egcs/powerpc-ibm-aix4.1.5.0/include
 /softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/include
 /usr/include
End of search list.
 /softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/cc1plus
/tmp/cc51RO5e.ii -quiet -dumpbase hello.cc -version -o /tmp/ccrJdZdb.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(powerpc-ibm-aix4.1.5.0) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).
 as -u -mcom -o /tmp/cchbl4o2.o /tmp/ccrJdZdb.s
 /softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/collect2
-bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect /lib/crt0.o
-L/softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66
-L/softs/egcs/powerpc-ibm-aix4.1.5.0/lib -L/softs/egcs/lib /tmp/cchbl4o2.o
-lstdc++ -lm
/softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/libgcc.a -lc
/softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66/libgcc.a

-----------------------------------------------------------

spezia@garfield:~/perso/test/dyn> dump -H a.out
a.out:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x0000000a       0x0000001c       0x0000009f

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00000260       0x00000083       0x000002ff


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER

0
/softs/egcs/lib/gcc-lib/powerpc-ibm-aix4.1.5.0/egcs-2.91.66:/softs/egcs/pow
erpc-ibm-aix4.1.5.0/lib:/softs/egcs/lib:/usr/lib:/lib

1                                    libc.a              shr.o

2                                    libstdc++.a


Ok, all is normal here.

-----------------------------------------------------------

spezia@garfield:~/perso/test/dyn> dump -H /softs/egcs/lib/libstdc++.a

2:52PM
/softs/egcs/lib/libstdc++.a:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x000004e7       0x00000eb3       0x00000044

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x0001262c       0x0000a5eb       0x00012670


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER

0      /users/spezia/perso/egcsbuild/gcc:/usr/lib:/lib

1                                    libc.a              shr.o

2                                    .


Note that the number 2 entry in the import file strings table seems to be
wrong ;
it's probably the reason of my problem.

-----------------------------------------------------------

Does anyone succeed in using dynamic linking on such a platform ?

Best regards,
DS




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