TOC errors on AIX
Perry Smith
pedzsan@gmail.com
Sun Jul 29 16:48:00 GMT 2012
Hi,
This is an age old topic but I can't find how to solve it. I've searched the past few days.
I'm trying to build passenger on AIX 6.1 TL07 SP03 using gcc 4.5.2 that I built myself. I've used it for a number of months and have built many things.
The short question is how do I get rid of these warnings?
> ld: 0711-768 WARNING: Object ext/apache2/module_libboost_oxt.a[system_calls.o], section 1, function .accept:
> The branch at address 0x2ac0 is not followed by a recognized no-op
> or TOC-reload instruction. The unrecognized instruction is 0x7C601B78.
The link has many errors like this. For whatever reason, passenger builds the same file two different ways and puts them in two different places. Upon closer examination the file that the link is complaining about does in fact have bad code.
The bad compile line is:
> g++ -Iext -fPIC -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -U__STR__ -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 -I/gsa/ausgsa/projects/r/ruby/apache2/include -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="<hash_fun.h>" -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/module_libboost_oxt/oxt/system_calls.o -c ext/oxt/system_calls.cpp
and produces:
> ...
> lwz 5,128(31)
> bl .accept
> mr 0,3
> ...
There needs to be a nop after the bl so the linker / loader can stuff in an instruction to restore the toc.
There are many warnings for this compile as well about the visibility. e.g.
> ext/oxt/system_calls.cpp: In function 'int oxt::syscalls::accept(int, sockaddr*, socklen_t*)':
> ext/oxt/system_calls.cpp:209:1: warning: visibility attribute not supported in this configuration; ignored
The compile line that is good is:
> g++ -Iext -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="<hash_fun.h>" -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/common/libboost_oxt/oxt/system_calls.o -c ext/oxt/system_calls.cpp
which produces good code:
> ...
> lwz 5,128(31)
> bl .accept
> nop
> mr 0,3
> ...
The good compile has no warnings.
I figure it is the -fvisibility that is getting me into trouble but I am not sure if it is safe to just get rid of it. There are also macros in the boost *.hpp files that muck with the visibility setting.
The link line is (if needed):
> g++ -shared ext/apache2/Configuration.o ext/apache2/Bucket.o ext/apache2/Hooks.o ext/apache2/mod_passenger.o -fPIC -o ext/apache2/mod_passenger.so -fPIC -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -U__STR__ -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 -I/gsa/ausgsa/projects/r/ruby/apache2/include -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="<hash_fun.h>" -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS ext/apache2/module_libpassenger_common.a ext/apache2/module_libboost_oxt.a -fPIC -L/gsa/ausgsa/projects/r/ruby/apache2/lib -lapr-1 -Wl,-G -Wl,-brtl -L/gsa/ausgsa/projects/r/ruby/apache2/lib -laprutil-1 -lpthread
Thank you for your help,
Perry
More information about the Gcc
mailing list