Ensure that linker version scripts (used for symbol export control) always exist.
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 8 Apr 2010 16:35:10 +0000 (16:35 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 8 Apr 2010 16:35:10 +0000 (16:35 +0000)
Using wildcard matching in the Makefile is not adequate to determine whether
an export file should exist for a module or not, so instead we'll just
create one if the module needs one, or copy the default one if it does not.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256428 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile.rules
build_tools/make_linker_version_script

index 92d8bb7..f76d84b 100644 (file)
@@ -55,7 +55,7 @@ CC_CFLAGS=$(PTHREAD_CFLAGS) $(_ASTCFLAGS) $(ASTCFLAGS)
 CXX_CFLAGS=$(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_DECLARATION_AFTER_STATEMENT),$(_ASTCFLAGS) $(ASTCFLAGS))
 
 ifeq ($(GNU_LD),1)
-SO_SUPPRESS_SYMBOLS=-Wl,--version-script,$(if $(wildcard $(subst .so,.exports,$@)),$(subst .so,.exports,$@),$(ASTTOPDIR)/default.exports),--warn-common
+SO_SUPPRESS_SYMBOLS=-Wl,--version-script,$(subst .so,.exports,$@),--warn-common
 ifneq ($(wildcard $(subst .so,.dynamics,$@)),)
 SO_SUPPRESS_SYMBOLS+=-Wl,--dynamic-list,$(subst .so,.dynamics,$@)
 endif
@@ -118,14 +118,14 @@ endif
 
 %.so: %.o
 ifeq ($(GNU_LD),1)
-       $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* $(LINKER_SYMBOL_PREFIX)
+       $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
 endif
        $(ECHO_PREFIX) echo "   [LD] $^ -> $@"
        $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(CC_LDFLAGS_SO) $^ $(CC_LIBS)
 
 %.so: %.oo
 ifeq ($(GNU_LD),1)
-       $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* $(LINKER_SYMBOL_PREFIX)
+       $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* "$(LINKER_SYMBOL_PREFIX)" "$(ASTTOPDIR)"
 endif
        $(ECHO_PREFIX) echo "   [LDXX] $^ -> $@"
        $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(CXX_LDFLAGS_SO) $^ $(CXX_LIBS)
index 8f3c2bb..871ff47 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
 
-test -f ${1}.exports.in && ${AWK} "{sub(\"LINKER_SYMBOL_PREFIX\", \"${2}\"); print;}" ${1}.exports.in > ${1}.exports
-test -f ${1}.exports.in || rm -f ${1}.exports
+test -f ${1}.exports.in && ${AWK} "{sub(\"LINKER_SYMBOL_PREFIX\", \"${2}\"); print;}" ${1}.exports.in > ${1}.exports && exit 0
+test -f ${1}.exports.in || rm -f ${1}.exports && cp ${3}/default.exports ${1}.exports && exit 0
+