The Samba-Bugzilla – Bug 11031
-fvisibility=hidden causes Text relocation errors
Last modified: 2015-03-13 08:33:08 UTC
Created attachment 10577 [details]
patch for -fvisibility=hidden
Note that this problem was reported in bug 10261, which is really about a different problem that produces similar error messages. I believe that this problem should have it's own bug report.
Building Samba 4.1.* on Solaris 10 i386 with GCC 4.7.2 produces 'Text relocation remains against symbol' errors. The error messages also include the following:
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status
This is caused by specifying -fvisibility=hidden to the GCC compiler
The test for -fvisibility=hidden on Solaris produces:
[1/1] Compiling test.c
../test.c: In function 'main':
../test.c:1:1: warning: visibility attribute not supported in this
configuration; ignored [-Wattributes]
['/opt/local/bin/gcc', '-I/opt/local/include', '-fvisibility=hidden', '-MD',
'-I/usr/local/include', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1',
'-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '../test.c', '-c', '-o',
But, despite the message saying ignored, the result can not be linked into a
shared library. Adding -Werror=attributes to the gcc command will turn this
into an error.This can be done by patching lib/replace/wscript to change
if conf.CHECK_CFLAGS(['-fvisibility=hidden', '-Werror=attributes']):
Please see the attached patch.
Fixed in bug #11073.