shared c++ lib on powerpc-ibm-aix4.1.5.0. Done by hand!
Paul Maragakis
plm@mpq.mpg.de
Mon Dec 8 05:14:00 GMT 1997
>
>
> In message < 9712051744.AA39970@mpqibmr1.mpq.mpg.de >you write:
> > Hello,
> >
> > I reinstalled egcs with shared enabled. Plenty of unexpected things
> > this time! In the end you find a summary of all regression test
> > failures. By inspection of the log files, it seems that standard c++
> > streams cannot be linked!
> It could be the problem mentioned in ths faq entry:
>
> http://www.cygnus.com/egcs/faq.html#rpath
> jeff
>
Hello,
What follows refers to AIX 4.1.5, and egcs-1.0. It will interest you.
I could install the shared c++ library on AIX by hand. Since it is my
first attempt with creating shared libraries on AIX, it is a hack.
Result is beautiful! A test executable size dropped to 10 KB
unstripped, and 2.3 KB stripped, which makes it smaller than the
corresponding xlC compiler size (6 KB stripped). By briefly going
through the egcs build output, I decided that the library was not
build correctly. I checked AIX instructions on how to do a shared
library, and this is what I did:
Get a list of the exported symbols:
cd objdir/libraries/libstdc++/
for i in `cat piclist`; do \
nm -BChg $i | grep " D " | cut -c14- >> libnewstdc++.exp; \
done
Link the shared object:
ld -o libnewstdc++.so `cat piclist` -bE:libnewstdc++.exp -bM:SRE \
-lm -L [path to egcs gcc library ...gcc-lib/powerpc-ibm... ]
-lgcc -lc
Put into an archive so that linking goes with normal procedures:
ar qv libnewstdc++.a libnewstdc++.so
then put the libnewstdc++.a into your egcs library directory, and
compile and link the usual way:
//##### Example file hello.C
#include <iostream.h>
int main()
{
cout << "Hello world!" << endl;
return 0;
}
egcs-path/c++ -c hello.C -o hello.o
gives:
-rw-r--r-- 1 plm mpq00 1290 Dec 8 13:50 hello.o
egcs-path/c++ -o hello hello.o -lnewstdc++
gives:
-rwxr-xr-x 1 plm mpq00 9087 Dec 8 13:52 hello
strip hello
gives:
-rwxr-xr-x 1 plm mpq00 2240 Dec 8 13:52 hello
./hello
gives:
Hello world!
compare these to the egcs static sizes:
-rwxr-xr-x 1 plm mpq00 693141 Dec 8 14:05 hello.o
-rwxr-xr-x 1 plm mpq00 693257 Dec 8 14:06 hello
-rwxr-xr-x 1 plm mpq00 146462 Dec 8 14:07 hello (stripped)
and xlC sizes:
-rw-r--r-- 1 plm mpq00 1518 Dec 8 14:07 hello.o
-rwxr-xr-x 1 plm mpq00 10470 Dec 8 14:08 hello
-rwxr-xr-x 1 plm mpq00 6042 Dec 8 14:08 hello (stripped)
Hope somebody can formalize and optimize the above procedure to put it
into the real distribution (I really have no time till New Year!). I
will try the testsuite with the new library late at night (European
time), and report the results soon. Any quick idea on the minimum
changes needed are appreciated (I guess just substituting the build
directory library with the new library should do).
Since I am still not on the egcs list, please cc me on any
answers/comments.
Keep up your incredible work!
--
Paul
More information about the Gcc
mailing list