[asterisk-commits] kpfleming: branch 1.4 r182808 - in /branches/1.4: ./ build_tools/ include/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 17 20:55:26 CDT 2009


Author: kpfleming
Date: Tue Mar 17 20:55:22 2009
New Revision: 182808

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182808
Log:
Improve the build system to *properly* remove unnecessary symbols from the runtime global namespace. Along the way, change the prefixes on some internal-only API calls to use a common prefix.

With these changes, for a module to export symbols into the global namespace, it must have *both* the AST_MODFLAG_GLOBAL_SYMBOLS flag and a linker script that allows the linker to leave the symbols exposed in the module's .so file (see res_odbc.exports for an example).


Added:
    branches/1.4/default.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/default.exports
    branches/1.4/main/asterisk.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/main/asterisk.exports
    branches/1.4/res/res_adsi.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_adsi.exports
    branches/1.4/res/res_agi.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_agi.exports
    branches/1.4/res/res_features.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_features.exports
    branches/1.4/res/res_jabber.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_jabber.exports
    branches/1.4/res/res_monitor.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_monitor.exports
    branches/1.4/res/res_odbc.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_odbc.exports
    branches/1.4/res/res_smdi.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_smdi.exports
    branches/1.4/res/res_speech.exports
      - copied unchanged from r182801, team/kpfleming/symbol-namespace-cleanup/res/res_speech.exports
Removed:
    branches/1.4/build_tools/strip_nonapi
Modified:
    branches/1.4/Makefile.rules
    branches/1.4/include/asterisk/astobj2.h
    branches/1.4/main/Makefile
    branches/1.4/main/astobj2.c
    branches/1.4/makeopts.in
    branches/1.4/res/res_config_odbc.c
    branches/1.4/res/res_config_pgsql.c
    branches/1.4/res/res_crypto.c
    branches/1.4/res/res_indications.c
    branches/1.4/res/res_musiconhold.c
    branches/1.4/res/res_snmp.c

Modified: branches/1.4/Makefile.rules
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/Makefile.rules?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/Makefile.rules (original)
+++ branches/1.4/Makefile.rules Tue Mar 17 20:55:22 2009
@@ -51,8 +51,13 @@
 # per-target settings will be applied
 CC_CFLAGS=$(PTHREAD_CFLAGS) $(ASTCFLAGS)
 CXX_CFLAGS=$(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_DECLARATION_AFTER_STATEMENT),$(ASTCFLAGS))
-CC_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK)
-CXX_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK)
+
+ifeq ($(GNU_LD),1)
+SO_SUPPRESS_SYMBOLS=-Wl,--version-script,$(if $(wildcard $(subst .so,.exports,$@)),$(subst .so,.exports,$@),$(ASTTOPDIR)/default.exports)
+endif
+
+CC_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $(SO_SUPPRESS_SYMBOLS)
+CXX_LDFLAGS_SO=$(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $(SO_SUPPRESS_SYMBOLS)
 CC_LIBS=$(PTHREAD_LIBS) $(LIBS)
 CXX_LIBS=$(PTHREAD_LIBS) $(LIBS)
 

Modified: branches/1.4/include/asterisk/astobj2.h
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/include/asterisk/astobj2.h?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/include/asterisk/astobj2.h (original)
+++ branches/1.4/include/asterisk/astobj2.h Tue Mar 17 20:55:22 2009
@@ -188,15 +188,15 @@
 #ifndef DEBUG_THREADS
 int ao2_lock(void *a);
 #else
-#define ao2_lock(a) _ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_lock(a) __ao2_lock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_lock(void *a, const char *file, const char *func, int line, const char *var);
 #endif
 
 #ifndef DEBUG_THREADS
 int ao2_trylock(void *a);
 #else
-#define ao2_trylock(a) _ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_trylock(a) __ao2_trylock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_trylock(void *a, const char *file, const char *func, int line, const char *var);
 #endif
 
 /*!
@@ -208,8 +208,8 @@
 #ifndef DEBUG_THREADS
 int ao2_unlock(void *a);
 #else
-#define ao2_unlock(a) _ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
-int _ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
+#define ao2_unlock(a) __ao2_unlock(a, __FILE__, __PRETTY_FUNCTION__, __LINE__, #a)
+int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var);
 #endif
 
 /*!

Modified: branches/1.4/main/Makefile
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/main/Makefile?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/main/Makefile (original)
+++ branches/1.4/main/Makefile Tue Mar 17 20:55:22 2009
@@ -94,6 +94,10 @@
   ASTLINK=
 endif
 
+ifeq ($(GNU_LD),1)
+ASTLINK+=-Wl,--version-script,asterisk.exports
+endif
+
 editline/libedit.a:
 	cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR)
 	$(MAKE) -C editline libedit.a
@@ -133,20 +137,19 @@
   H323LDLIBS=
 endif
 
-asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
+asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) asterisk.exports
 	@$(ASTTOPDIR)/build_tools/make_build_h > $(ASTTOPDIR)/include/asterisk/build.h.tmp
 	@if cmp -s $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; then echo ; else \
 		mv $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; \
 	fi
 	@rm -f $(ASTTOPDIR)/include/asterisk/build.h.tmp
 	@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
-	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
+	$(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS)
 else
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
 endif
-	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/strip_nonapi $@ || rm $@
 
 clean::
 	rm -f asterisk

Modified: branches/1.4/main/astobj2.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/main/astobj2.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/main/astobj2.c (original)
+++ branches/1.4/main/astobj2.c Tue Mar 17 20:55:22 2009
@@ -128,7 +128,7 @@
 #ifndef DEBUG_THREADS
 int ao2_lock(void *user_data)
 #else
-int _ao2_lock(void *user_data, const char *file, const char *func, int line, const char *var)
+int __ao2_lock(void *user_data, const char *file, const char *func, int line, const char *var)
 #endif
 {
 	struct astobj2 *p = INTERNAL_OBJ(user_data);
@@ -150,7 +150,7 @@
 #ifndef DEBUG_THREADS
 int ao2_trylock(void *user_data)
 #else
-int _ao2_trylock(void *user_data, const char *file, const char *func, int line, const char *var)
+int __ao2_trylock(void *user_data, const char *file, const char *func, int line, const char *var)
 #endif
 {
 	struct astobj2 *p = INTERNAL_OBJ(user_data);
@@ -177,7 +177,7 @@
 #ifndef DEBUG_THREADS
 int ao2_unlock(void *user_data)
 #else
-int _ao2_unlock(void *user_data, const char *file, const char *func, int line, const char *var)
+int __ao2_unlock(void *user_data, const char *file, const char *func, int line, const char *var)
 #endif
 {
 	struct astobj2 *p = INTERNAL_OBJ(user_data);

Modified: branches/1.4/makeopts.in
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/makeopts.in?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/makeopts.in (original)
+++ branches/1.4/makeopts.in Tue Mar 17 20:55:22 2009
@@ -42,6 +42,8 @@
 
 PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
 PTHREAD_LIBS=@PTHREAD_LIBS@
+
+GNU_LD=@GNU_LD@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@

Modified: branches/1.4/res/res_config_odbc.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_config_odbc.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_config_odbc.c (original)
+++ branches/1.4/res/res_config_odbc.c Tue Mar 17 20:55:22 2009
@@ -558,7 +558,7 @@
 	return 0;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "ODBC Configuration",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ODBC Configuration",
 		.load = load_module,
 		.unload = unload_module,
 		);

Modified: branches/1.4/res/res_config_pgsql.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_config_pgsql.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_config_pgsql.c (original)
+++ branches/1.4/res/res_config_pgsql.c Tue Mar 17 20:55:22 2009
@@ -835,7 +835,7 @@
 }
 
 /* needs usecount semantics defined */
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "PostgreSQL RealTime Configuration Driver",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PostgreSQL RealTime Configuration Driver",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload

Modified: branches/1.4/res/res_crypto.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_crypto.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_crypto.c (original)
+++ branches/1.4/res/res_crypto.c Tue Mar 17 20:55:22 2009
@@ -624,7 +624,7 @@
 }
 
 /* needs usecount semantics defined */
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Cryptographic Digital Signatures",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Cryptographic Digital Signatures",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload

Modified: branches/1.4/res/res_indications.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_indications.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_indications.c (original)
+++ branches/1.4/res/res_indications.c Tue Mar 17 20:55:22 2009
@@ -399,7 +399,7 @@
 	return ind_load_module();
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Indications Resource",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Indications Resource",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,

Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Tue Mar 17 20:55:22 2009
@@ -1486,7 +1486,7 @@
 	return res;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Music On Hold Resource",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Music On Hold Resource",
 	.load = load_module,
 	.unload = unload_module,
 	.reload = reload,

Modified: branches/1.4/res/res_snmp.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_snmp.c?view=diff&rev=182808&r1=182807&r2=182808
==============================================================================
--- branches/1.4/res/res_snmp.c (original)
+++ branches/1.4/res/res_snmp.c Tue Mar 17 20:55:22 2009
@@ -109,7 +109,7 @@
 	return ((thread != AST_PTHREADT_NULL) ? pthread_join(thread, NULL) : 0);
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "SNMP [Sub]Agent for Asterisk",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "SNMP [Sub]Agent for Asterisk",
 		.load = load_module,
 		.unload = unload_module,
 		);




More information about the asterisk-commits mailing list