* AIX & shared libstdc++ @ 1997-10-07 2:18 Andrey Slepuhin 1997-10-07 11:41 ` David Edelsohn 0 siblings, 1 reply; 9+ messages in thread From: Andrey Slepuhin @ 1997-10-07 2:18 UTC (permalink / raw) To: egcs Hi, I tried to build egcs-970929 on AIX 4.2.1 configured with --enable-shared option. The resulting shared libstdc++ was only ~600K instead of ~3M static one. This is because AIX linker does not know what symbols must be exported. Passing option -bexpall to linker did not solve the problem, so I tried to build export file manually by hacking makeC++SharedLib script. After removing some symbols causing linker warnings from resulting export file, I obtain shared libstdc++ with size ~2.3M and I can successfully link my programs with this library. I'm not sure that all my operation were correct and I can't check if all necessary symbols are included into the export file. But it seems to me, that the only way to receive correct shared version of libstdc++ on AIX is to use explicit export file. Any help will be appreciated. Regards, Andrey Slepuhin, Moscow State University PS: Passing option -unix to linker is incorrect on AIX, because AIX linker recognize it as option -u with a parameter "nix". As a result there are many linker warnings. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-07 2:18 AIX & shared libstdc++ Andrey Slepuhin @ 1997-10-07 11:41 ` David Edelsohn 1997-10-07 23:14 ` Andrey Slepuhin 0 siblings, 1 reply; 9+ messages in thread From: David Edelsohn @ 1997-10-07 11:41 UTC (permalink / raw) To: Andrey Slepuhin; +Cc: egcs >>>>> Andrey Slepuhin writes: Andrey> I tried to build egcs-970929 on AIX 4.2.1 configured with Andrey> --enable-shared Andrey> option. The resulting shared libstdc++ was only ~600K instead of ~3M Andrey> static one. Andrey> This is because AIX linker does not know what symbols must be exported. Andrey> Passing option -bexpall to linker did not solve the problem, so I tried Andrey> to build export file manually by hacking makeC++SharedLib script. After Andrey> removing some symbols causing linker warnings from resulting export Andrey> file, Andrey> I obtain shared libstdc++ with size ~2.3M and I can successfully link my Andrey> programs with this library. Andrey> I'm not sure that all my operation were correct and I can't check if all Andrey> necessary symbols are included into the export file. But it seems to me, Andrey> that the only way to receive correct shared version of libstdc++ on AIX Andrey> is to use explicit export file. Any help will be appreciated. I am somewhat surprised that -bexpall does not export all necessary symbols. That is not the default because it can cause significant bloat and is not the way that XLC operates. AIX linker performs garbage collection on symbols and removes any symbols which are not referenced or exported. If -bexpall does not trivially work around the problem, one must use something like makeC++SharedLib. Note: IBM's C++ compiler and G++ use different name mangling schemes, so assumptions about the internal structure of C++ symbols is incorrect. Andrey> PS: Passing option -unix to linker is incorrect on AIX, because AIX Andrey> linker Andrey> recognize it as option -u with a parameter "nix". As a result there Andrey> are Andrey> many linker warnings. Who is passing -unix option to linker? That is not in the GCC specs. Does libstdc++ assume that? David ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-07 11:41 ` David Edelsohn @ 1997-10-07 23:14 ` Andrey Slepuhin 1997-10-07 23:14 ` David Edelsohn 0 siblings, 1 reply; 9+ messages in thread From: Andrey Slepuhin @ 1997-10-07 23:14 UTC (permalink / raw) To: David Edelsohn; +Cc: egcs David Edelsohn wrote: > I am somewhat surprised that -bexpall does not export all > necessary symbols. That is not the default because it can cause > significant bloat and is not the way that XLC operates. AIX linker > performs garbage collection on symbols and removes any symbols which are > not referenced or exported. If -bexpall does not trivially work around > the problem, one must use something like makeC++SharedLib. Note: IBM's > C++ compiler and G++ use different name mangling schemes, so assumptions > about the internal structure of C++ symbols is incorrect. Some times ago I experimented on building shared libs with GCC 2.7.2 and I had to hack makeC++SharedLib to do this. So, I was surprised that I obtain export list without any problems. The only things I cannot understand are the following: 1) I obtain many warnings about undefined symbols which are really class names themselves (for example, range_error), so I remove these symbols from export file. 2) When linking programs with shared libstdc++, I obtain warnings about multiple defined symbols like __eh<something>. After removing these symbols all my test programs linked and worked fine. 3) I am worried about shared libstdc++ size (2.3M instead of 3M static). This can be caused differences in library structure (for example a large number of separate modules in ar file), but I cannot check this. > Andrey> PS: Passing option -unix to linker is incorrect on AIX, because AIX > Andrey> linker > Andrey> recognize it as option -u with a parameter "nix". As a result there > Andrey> are > Andrey> many linker warnings. > > Who is passing -unix option to linker? That is not in the GCC > specs. Does libstdc++ assume that? Yes. Jason Merrill said that this option is needed for gnu ld. Did you try to build egcs configured with --with-gnu-ld option? Andrey. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-07 23:14 ` Andrey Slepuhin @ 1997-10-07 23:14 ` David Edelsohn 0 siblings, 0 replies; 9+ messages in thread From: David Edelsohn @ 1997-10-07 23:14 UTC (permalink / raw) To: pooh; +Cc: David Edelsohn, egcs >>>>> Andrey Slepuhin writes: Andrey> 1) I obtain many warnings about undefined symbols which are really class names Andrey> themselves (for example, range_error), so I remove these symbols from export Andrey> file. This may depend on the type of symbol. I do not know how class names appear as symbols and how this would appear in an exports list. A class name is not an actual method or member. Andrey> 2) When linking programs with shared libstdc++, I obtain warnings about Andrey> multiple defined symbols like __eh<something>. After removing these symbols Andrey> all my test programs linked and worked fine. As mentioned in the README.RS6000 file, AIX 4.1 linker became much more pedantic about warning of duplicate symbols. These always have been there and should not affect correctness of the resulting executable. Andrey> 3) I am worried about shared libstdc++ size (2.3M instead of 3M static). This Andrey> can be caused differences in library structure (for example a large number of Andrey> separate modules in ar file), but I cannot check this. *Shrug* David ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <3439FE5B.53F1D3CC.cygnus.egcs@msu.ru>]
* Re: AIX & shared libstdc++ [not found] <3439FE5B.53F1D3CC.cygnus.egcs@msu.ru> @ 1997-10-07 3:15 ` Jason Merrill 1997-10-07 3:48 ` Andrey Slepuhin 1997-10-09 9:26 ` Andrey Slepuhin 0 siblings, 2 replies; 9+ messages in thread From: Jason Merrill @ 1997-10-07 3:15 UTC (permalink / raw) To: Andrey Slepuhin, egcs >>>>> Andrey Slepuhin <pooh@msu.ru> writes: > I tried to build egcs-970929 on AIX 4.2.1 configured with > --enable-shared > option. The resulting shared libstdc++ was only ~600K instead of ~3M > static one. > This is because AIX linker does not know what symbols must be exported. > PS: Passing option -unix to linker is incorrect on AIX, because AIX > linker recognize it as option -u with a parameter "nix". As a result > there are many linker warnings. GCC support for shared libraries on AIX requires GNU ld, which supports the -unix flag. Jason ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-07 3:15 ` Jason Merrill @ 1997-10-07 3:48 ` Andrey Slepuhin 1997-10-09 9:26 ` Andrey Slepuhin 1 sibling, 0 replies; 9+ messages in thread From: Andrey Slepuhin @ 1997-10-07 3:48 UTC (permalink / raw) To: Jason Merrill; +Cc: egcs Jason Merrill wrote: > GCC support for shared libraries on AIX requires GNU ld, which supports the > -unix flag. The following line: * configure.in: Don't configure --with-gnu-ld on AIX in file ChangeLog is not overrided yet (though it is dated Apr 25 1996 :-)). Does anybody checked whether current snapshot can be configured with this option? Can this be done with current version of binutils? And the last: is shared libraries support with native ld possible in principle? Andrey ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-07 3:15 ` Jason Merrill 1997-10-07 3:48 ` Andrey Slepuhin @ 1997-10-09 9:26 ` Andrey Slepuhin 1997-10-09 15:14 ` Ian Lance Taylor 1 sibling, 1 reply; 9+ messages in thread From: Andrey Slepuhin @ 1997-10-09 9:26 UTC (permalink / raw) To: Jason Merrill; +Cc: egcs Hi, I tried to compile egcs-971008 on AIX 4.2.1 configured with option --with-gnu-ld. 1) I had problems when installing binutils 2.8.1 because function finfo() already defined in unistd.h with parameters different from finfo() that comes with binutils distribution (solved by renaming this function and all calls to it). 2) Compilation was successful except the attempt of making unexistent target "libs" in libraries/soft-float/powerpc/libstdc++/Makefile (why???). Shared libstdc++ was created successfully with a size ~2.5M 3) Even the simple test program failed to run with message about exec format error due to bad text alignment. It seems to me that problem is not with egcs but with gnu ld which generates invalid executables. Any help is appreciated. Andrey. PS: egcs-970929, with manually built shared libstdc++ (with native ld) still works without errors. I just successfully compiled and tested omniORB2, and it seems that combination of shared libstdc++, multithreading and exceptions works fine. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-09 9:26 ` Andrey Slepuhin @ 1997-10-09 15:14 ` Ian Lance Taylor 1997-10-13 5:05 ` Andrey Slepuhin 0 siblings, 1 reply; 9+ messages in thread From: Ian Lance Taylor @ 1997-10-09 15:14 UTC (permalink / raw) To: pooh; +Cc: jason, egcs Date: Thu, 09 Oct 1997 20:01:20 +0400 From: Andrey Slepuhin <pooh@msu.ru> 3) Even the simple test program failed to run with message about exec format error due to bad text alignment. It seems to me that problem is not with egcs but with gnu ld which generates invalid executables. Any help is appreciated. You're right; the GNU linker doesn't work on AIX 4.2. It's possible that the appended patch to ld/emultempl/aix.em will fix the immediate problem. There may be other problems. Ian Index: aix.em =================================================================== RCS file: /cvs/cvsfiles/devo/ld/emultempl/aix.em,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- aix.em 1997/06/16 16:56:24 1.20 +++ aix.em 1997/09/04 16:43:35 1.21 @@ -361,8 +361,8 @@ exp_nameop (NAME, "."), exp_intop (0xfff))); t = exp_binop ('&', - exp_binop ('+', t, exp_intop (7)), - exp_intop (~ (bfd_vma) 7)); + exp_binop ('+', t, exp_intop (31)), + exp_intop (~ (bfd_vma) 31)); lang_section_start (".data", t); } break; @@ -382,8 +382,8 @@ exp_intop (val), exp_nameop (SIZEOF_HEADERS, NULL)); t = exp_binop ('&', - exp_binop ('+', t, exp_intop (7)), - exp_intop (~ (bfd_vma) 7)); + exp_binop ('+', t, exp_intop (31)), + exp_intop (~ (bfd_vma) 31)); lang_section_start (".text", t); } break; ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: AIX & shared libstdc++ 1997-10-09 15:14 ` Ian Lance Taylor @ 1997-10-13 5:05 ` Andrey Slepuhin 0 siblings, 0 replies; 9+ messages in thread From: Andrey Slepuhin @ 1997-10-13 5:05 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: egcs Ian Lance Taylor wrote: > > Date: Thu, 09 Oct 1997 20:01:20 +0400 > From: Andrey Slepuhin <pooh@msu.ru> > > 3) Even the simple test program failed to run with message about exec > format error due to bad text alignment. > It seems to me that problem is not with egcs but with gnu ld which > generates > invalid executables. Any help is appreciated. > > You're right; the GNU linker doesn't work on AIX 4.2. It's possible > that the appended patch to ld/emultempl/aix.em will fix the immediate > problem. There may be other problems. Thanks for the help - it seems that your patch works fine. At least I just successfully build omniORB2 with egcs-971008 configured with --enable-shared --with-gnu-ld. The only problem was with multiple defined symbol _mutex_global_np in pthread.h (native linker ignores multiple defined symbols; this symbol is not defined as extern - this looks like IBM bug). Andrey. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1997-10-13 5:05 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1997-10-07 2:18 AIX & shared libstdc++ Andrey Slepuhin 1997-10-07 11:41 ` David Edelsohn 1997-10-07 23:14 ` Andrey Slepuhin 1997-10-07 23:14 ` David Edelsohn [not found] <3439FE5B.53F1D3CC.cygnus.egcs@msu.ru> 1997-10-07 3:15 ` Jason Merrill 1997-10-07 3:48 ` Andrey Slepuhin 1997-10-09 9:26 ` Andrey Slepuhin 1997-10-09 15:14 ` Ian Lance Taylor 1997-10-13 5:05 ` Andrey Slepuhin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).