Commit c1aac39e authored by Sean McGovern's avatar Sean McGovern Committed by Luca Barbato

build: add Solaris symbol versioning

The versioning facility in the Solaris linker differs from Linux in 3 ways:

1. It does not support globs in linker scripts for
symbol versioning -- this is a GNU extension.

2. The linker argument is '-M', instead of '--version-script'.

3. It is picky about line endings.
Each symbol or directive must be on a line of it's own.

Let's use make_sunver.pl from GCC to generate a version script that works
correctly with the Solaris linker. It's function is to correctly expand the
globs in the original generated version script.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent b9ece15a
......@@ -56,7 +56,9 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
$(Q)echo '#include "$*.h"' >$@
%.ver: %.v
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ | sed -e 's/:/:\
/' -e 's/; /;\
/g' > $@
%.c %.h: TAG = GEN
......
......@@ -52,7 +52,7 @@ $(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.gcno *.gcda
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ver-sol2 *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
......
This diff is collapsed.
......@@ -3611,6 +3611,7 @@ case $target_os in
echo "hwcap_1 = OVERRIDE;" > mapfile &&
add_ldflags -Wl,-M,mapfile
nm_default='nm -P -g'
SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
;;
netbsd)
disable symver
......@@ -4650,10 +4651,14 @@ enabled xmm_clobber_test &&
-Wl,--wrap,sws_scale ||
disable xmm_clobber_test
echo "X{};" > $TMPV
echo "X { local: *; };" > $TMPV
if test_ldflags -Wl,--version-script,$TMPV; then
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
check_cc <<EOF && enable symver_asm_label
elif test_ldflags -Wl,-M,$TMPV; then
append SHFLAGS '-Wl,-M,\$(SUBDIR)lib\$(NAME).ver-sol2'
fi
check_cc <<EOF && enable symver_asm_label
void ff_foo(void) __asm__ ("av_foo@VERSION");
void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
EOF
......@@ -4661,7 +4666,6 @@ EOF
__asm__(".symver ff_foo,av_foo@VERSION");
void ff_foo(void) {}
EOF
fi
if [ -z "$optflags" ]; then
if enabled small; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment