[libcilkrts, build] Only use visibility if supported

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Nov 14 15:16:00 GMT 2013


libcilkrts.so fails to link on Solaris 9/x86 with Sun as since this
configuration lacks visibility support:

Text relocation remains                         referenced
    against symbol                  offset      in file
__cilkrts_get_tls_worker            0x41        .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x254       .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x5c9       .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x609       .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x6e7       .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x774       .libs/cilk-abi.o
__cilkrts_get_tls_worker            0x271       .libs/cilk-abi-cilk-for.o
__cilkrts_get_tls_worker            0x361       .libs/cilk-abi-cilk-for.o
__cilkrts_get_tls_worker            0x10        .libs/cilk_api.o
__cilkrts_get_tls_worker            0xc1        .libs/cilk_api.o
__cilkrts_get_tls_worker            0x194       .libs/cilk_api.o
__cilkrts_get_tls_worker            0x241       .libs/cilk_api.o
__cilkrts_get_tls_worker            0x324       .libs/cilk_api.o
__cilkrts_get_tls_worker            0x706       .libs/reducer_impl.o
__cilkrts_get_tls_worker            0x893       .libs/reducer_impl.o
[...]
__cilkrts_bump_worker_rank_internal 0x32c       .libs/cilk_api.o
__cilkrts_init_worker_sysdep        0x262c      .libs/scheduler.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status
make[2]: *** [libcilkrts.la] Error 1

During the build, one sees many warnings like this:

/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c: In function '__cilkrt
s_enter_frame_fast':
/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c:144:1: warning: visibi
lity attribute not supported in this configuration; ignored [-Wattributes]

This can be cured by actually checking if a given configuration supports
__attribute((visibility)) instead of just assuming gcc on Unix systems
does.  The following patch does just that.

Tested by reconfiguring and rebuilding libcilkrts on i386-pc-solaris2.9
(which now builds) and i386-pc-solaris2.11 (where elfdump -s still show
many symbols as protected as they should be).

Ok for mainline?

	Rainer


2013-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (libcilkrts_cv_have_attribute_visibility): Check
	for __attribute__((visibility)).
	* configure: Regenerate.
	* include/cilk/common.h (CILK_EXPORT, CILK_EXPORT_DATA): Only use
	__attribute__((visibility)) if HAVE_ATTRIBUTE_VISIBILITY.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcilkrts-visibility.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131114/2b6d60d2/attachment.bin>
-------------- next part --------------

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Gcc-patches mailing list