This is a discussion on ERROR: TOC overflow. within the AIX Operating System forums, part of the Unix Operating Systems category; --> I have two related/unrelated problems compiling and building Shared Library files (.so). AIX 5.2 IBM(R) VisualAge(R) C++ Version 6.0.0.11 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have two related/unrelated problems compiling and building Shared Library files (.so). AIX 5.2 IBM(R) VisualAge(R) C++ Version 6.0.0.11 When building .so files, I get the following link error (the error doesn't occur when building a static library .a): ld: 0711-781 ERROR: TOC overflow. TOC size: 67904 Maximum size: 65536 make: 1254-004 The error code from the last command is 12. I can bypass this with the -bbigtoc flag; however, this increases the file size and may be a performance hit? Also, I get tons of Duplicate symbol warnings such as this one: ld: 0711-224 WARNING: Duplicate symbol: ..std::basic_string<char,std::char_traits<char>,st d::allocator<char> >::basic_string(const char*) These duplicate symbol warnings appear whether building a library or an executable... the TOC error only occurs when building the .so file. I don't know if they are related -- the TOC error is a serious problem, while currently, the duplicate symbols is a major annoyance (that I feel should not be present). Does anyone have suggestions or insights into how to fix the problems or what would cause the problems? Below are stripped down commands I am using to compile and build the libraries (there are actually lots of .o files). Using xlC_r rather than just xlC because other libraries that I am linking with make use of threading. // Compiling Source Files xlC_r -q64 -c MyFile1.cpp -o MyFile1.o xlC_r -q64 -c MyFile2.cpp -o MyFile2.o // Creating Static Library... ar -ru -X64 -o libMyLibrary.a MyFile1.o MyFile2.o // Creating Shared Library... xlC_r -G -qmkshrobj -q64 -o libMyLibrary.so MyFile1.o MyFile2.o // Eliminates the error building the shared library xlC_r -G -qmkshrobj -q64 -bbigtoc -o libMyLibrary.so MyFile1.o MyFile2.o Hopefully someone can help me get to the root of this problem! Thanks, Kyle |
| |||
| Kyle Kolander wrote: > When building .so files, I get the following link error (the error doesn't > occur when building a static library .a): > > ld: 0711-781 ERROR: TOC overflow. TOC size: 67904 Maximum size: 65536 > make: 1254-004 The error code from the last command is 12. > > I can bypass this with the -bbigtoc flag; however, this increases the file > size and may be a performance hit? Yes, although slight. Your only other choice is to split the code into two modules. > Also, I get tons of Duplicate symbol warnings such as this one: > > ld: 0711-224 WARNING: Duplicate symbol: > .std::basic_string<char,std::char_traits<char>,std ::allocator<char> > >>::basic_string(const char*) That's what happens with C++. AIX 5.3 introduces a new feature for weak symbols, but in the meantime your only options are to (A) ignore them, or (B) use -bh:5 to suppress them. Note that this may also suppress warnings which you want to know about. -- Gary R. Hook __________________________________________________ ______________________ Vocatus atque non vocatus deus aderit |
| |||
| "Gary R. Hook" <noway@nospammers.net> wrote in message news:JFoje.2096$5Z1.1788@newssvr30.news.prodigy.co m... > Kyle Kolander wrote: > > When building .so files, I get the following link error (the error doesn't > > occur when building a static library .a): > > > > ld: 0711-781 ERROR: TOC overflow. TOC size: 67904 Maximum size: 65536 > > make: 1254-004 The error code from the last command is 12. > > > > I can bypass this with the -bbigtoc flag; however, this increases the file > > size and may be a performance hit? > > Yes, although slight. Your only other choice is to split the code > into two modules. > As it turns out, there was an existing header file with a lot of string declarations like: const std::string SOME_STRING = "Some_String"; that was being included in many source files. I modified this design to extern the declarations in the header file and added a source file with the definitions: // in .h extern const std::string SOME_STRING; // in .cpp const std::string SOME_STRING = "Some_String"; This has taken care of the TOC error and drastically reduced the size of our library. Figured I would post the solution in case someone else encounters a similar problem... > > Also, I get tons of Duplicate symbol warnings such as this one: > > > > ld: 0711-224 WARNING: Duplicate symbol: > > .std::basic_string<char,std::char_traits<char>,std ::allocator<char> > > > >>::basic_string(const char*) > > That's what happens with C++. AIX 5.3 introduces a new feature > for weak symbols, but in the meantime your only options are to > (A) ignore them, or (B) use -bh:5 to suppress them. Note that > this may also suppress warnings which you want to know about. > Maybe I am just blind, but did not notice anywhere in documentation about level 5 suppressing duplicate symbols. A co-worker came across a website that explained this option, too. man ld lists the -bh:number option, but did not show a level 5 option or what it specifies. If you don't mind, could you let me know where you found this option? Thanks for help! Kyle > -- > Gary R. Hook > __________________________________________________ ______________________ > Vocatus atque non vocatus deus aderit |
| ||||
| Kyle Kolander wrote: > Maybe I am just blind, but did not notice anywhere in documentation about > level 5 suppressing duplicate symbols. A co-worker came across a website > that explained this option, too. man ld lists the -bh:number option, but > did not > show a level 5 option or what it specifies. If you don't mind, could you > let > me know where you found this option? You're not blind. It's probably not actually written out anywhere. I know from looking at the code, and from my development experience on the AIX kernel. -- Gary R. Hook __________________________________________________ ______________________ Vocatus atque non vocatus deus aderit |