From 2be88e05c043e8abc1b6a3c94c4699859a7adf68 Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Fri, 2 Apr 2010 18:57:58 +0000
Subject: [PATCH] Allow symbol export filtering to work properly on platforms
 that have symbol prefixes.

Some platforms prefix externally-visible symbols in object files generated
from C sources (most commonly, '_' is the prefix). On these platforms,
the existing symbol export filtering process ends up suppressing all the symbols
that are supposed to be left visible. This patch allows the prefix string
to be supplied to the top-level Makefile in the LINKER_SYMBOL_PREFIX variable,
and then generates the linker scripts as required to include the prefix
supplied.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 Makefile                                      |  8 ++++
 Makefile.moddir_rules                         |  1 +
 Makefile.rules                                |  8 +++-
 apps/app_voicemail.exports                    | 20 ---------
 apps/app_voicemail.exports.in                 | 20 +++++++++
 build_tools/make_linker_version_script        |  4 ++
 main/Makefile                                 |  9 +++-
 main/asterisk.exports                         | 45 -------------------
 main/asterisk.exports.in                      | 45 +++++++++++++++++++
 res/res_adsi.exports                          | 33 --------------
 res/res_adsi.exports.in                       | 33 ++++++++++++++
 ...share.exports => res_ael_share.exports.in} |  0
 res/res_agi.exports                           | 10 -----
 res/res_agi.exports.in                        | 10 +++++
 res/res_calendar.exports                      |  7 ---
 res/res_calendar.exports.in                   |  7 +++
 res/res_fax.exports                           | 11 -----
 res/res_fax.exports.in                        | 11 +++++
 res/res_features.exports                      | 13 ------
 res/res_features.exports.in                   | 13 ++++++
 res/res_jabber.exports                        | 14 ------
 res/res_jabber.exports.in                     | 14 ++++++
 res/res_monitor.exports                       | 11 -----
 res/res_monitor.exports.in                    | 11 +++++
 res/res_odbc.exports                          | 20 ---------
 res/res_odbc.exports.in                       | 20 +++++++++
 res/res_pktccops.exports                      |  6 ---
 res/res_pktccops.exports.in                   |  6 +++
 res/res_smdi.exports                          | 18 --------
 res/res_smdi.exports.in                       | 18 ++++++++
 res/res_speech.exports                        | 21 ---------
 res/res_speech.exports.in                     | 21 +++++++++
 32 files changed, 257 insertions(+), 231 deletions(-)
 delete mode 100644 apps/app_voicemail.exports
 create mode 100644 apps/app_voicemail.exports.in
 create mode 100755 build_tools/make_linker_version_script
 delete mode 100644 main/asterisk.exports
 create mode 100644 main/asterisk.exports.in
 delete mode 100644 res/res_adsi.exports
 create mode 100644 res/res_adsi.exports.in
 rename res/{res_ael_share.exports => res_ael_share.exports.in} (100%)
 delete mode 100644 res/res_agi.exports
 create mode 100644 res/res_agi.exports.in
 delete mode 100644 res/res_calendar.exports
 create mode 100644 res/res_calendar.exports.in
 delete mode 100644 res/res_fax.exports
 create mode 100644 res/res_fax.exports.in
 delete mode 100644 res/res_features.exports
 create mode 100644 res/res_features.exports.in
 delete mode 100644 res/res_jabber.exports
 create mode 100644 res/res_jabber.exports.in
 delete mode 100644 res/res_monitor.exports
 create mode 100644 res/res_monitor.exports.in
 delete mode 100644 res/res_odbc.exports
 create mode 100644 res/res_odbc.exports.in
 delete mode 100644 res/res_pktccops.exports
 create mode 100644 res/res_pktccops.exports.in
 delete mode 100644 res/res_smdi.exports
 create mode 100644 res/res_smdi.exports.in
 delete mode 100644 res/res_speech.exports
 create mode 100644 res/res_speech.exports.in

diff --git a/Makefile b/Makefile
index 6e292718c1..323b20f062 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,14 @@ HTTP_DOCSDIR=/var/www/html
 # Determine by a grep 'ScriptAlias' of your Apache httpd.conf file
 HTTP_CGIDIR=/var/www/cgi-bin
 
+# If your platform's linker expects a prefix on symbols generated from compiling C
+# source files, set LINKER_SYMBOL_PREFIX to that value. On some systems, exported symbols
+# from C source files are prefixed with '_', for example. If this value is not set
+# properly, the linker scripts that live in the '*.exports' files in various places
+# in this tree will unintentionally suppress symbols that should be visible
+# in the final binary objects.
+LINKER_SYMBOL_PREFIX=
+
 # Uncomment this to use the older DSP routines
 #_ASTCFLAGS+=-DOLD_DSP_ROUTINES
 
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 00494a8b51..b883548afa 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -129,6 +129,7 @@ uninstall::
 dist-clean::
 	rm -f .*.moduleinfo .moduleinfo
 	rm -f .*.makeopts .makeopts
+	rm -f *.exports
 
 .%.moduleinfo: %.c
 	@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.so\">" > $@
diff --git a/Makefile.rules b/Makefile.rules
index d917d87082..92d8bb7cc8 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -3,7 +3,7 @@
 # 
 # Makefile rules
 #
-# Copyright (C) 2006-2008, Digium, Inc.
+# Copyright (C) 2006-2010, Digium, Inc.
 #
 # Kevin P. Fleming <kpfleming@digium.com>
 #
@@ -117,10 +117,16 @@ endif
 	$(CMD_PREFIX) $(CXX) -o $@ -E $< $(MAKE_DEPS) $(CXX_CFLAGS)
 
 %.so: %.o
+ifeq ($(GNU_LD),1)
+	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script $* $(LINKER_SYMBOL_PREFIX)
+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)
+endif
 	$(ECHO_PREFIX) echo "   [LDXX] $^ -> $@"
 	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(CXX_LDFLAGS_SO) $^ $(CXX_LIBS)
 
diff --git a/apps/app_voicemail.exports b/apps/app_voicemail.exports
deleted file mode 100644
index 52bce51467..0000000000
--- a/apps/app_voicemail.exports
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-	global:
-		mm_critical;
-		mm_diskerror;
-		mm_dlog;
-		mm_exists;
-		mm_expunged;
-		mm_fatal;
-		mm_flags;
-		mm_list;
-		mm_log;
-		mm_login;
-		mm_lsub;
-		mm_nocritical;
-		mm_notify;
-		mm_searched;
-		mm_status;
-	local:
-		*;
-};
diff --git a/apps/app_voicemail.exports.in b/apps/app_voicemail.exports.in
new file mode 100644
index 0000000000..3520d22166
--- /dev/null
+++ b/apps/app_voicemail.exports.in
@@ -0,0 +1,20 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXmm_critical;
+		LINKER_SYMBOL_PREFIXmm_diskerror;
+		LINKER_SYMBOL_PREFIXmm_dlog;
+		LINKER_SYMBOL_PREFIXmm_exists;
+		LINKER_SYMBOL_PREFIXmm_expunged;
+		LINKER_SYMBOL_PREFIXmm_fatal;
+		LINKER_SYMBOL_PREFIXmm_flags;
+		LINKER_SYMBOL_PREFIXmm_list;
+		LINKER_SYMBOL_PREFIXmm_log;
+		LINKER_SYMBOL_PREFIXmm_login;
+		LINKER_SYMBOL_PREFIXmm_lsub;
+		LINKER_SYMBOL_PREFIXmm_nocritical;
+		LINKER_SYMBOL_PREFIXmm_notify;
+		LINKER_SYMBOL_PREFIXmm_searched;
+		LINKER_SYMBOL_PREFIXmm_status;
+	local:
+		*;
+};
diff --git a/build_tools/make_linker_version_script b/build_tools/make_linker_version_script
new file mode 100755
index 0000000000..8f3c2bb0a5
--- /dev/null
+++ b/build_tools/make_linker_version_script
@@ -0,0 +1,4 @@
+#!/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
diff --git a/main/Makefile b/main/Makefile
index a019a08554..ada40fe61e 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -167,7 +167,7 @@ endif
 
 $(OBJS): _ASTCFLAGS+=-DAST_MODULE=\"core\"
 
-$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) asterisk.exports
+$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
 	$(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) -> $@"
 ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
@@ -176,9 +176,16 @@ else
 	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
 endif
 
+ifeq ($(GNU_LD),1)
+$(MAIN_TGT): asterisk.exports
+asterisk.exports: asterisk.exports.in
+	$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script asterisk $(LINKER_SYMBOL_PREFIX)
+endif
+
 clean::
 	rm -f asterisk
 	rm -f db1-ast/.*.d
+	rm -f asterisk.exports
 	@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
 	@$(MAKE) -C db1-ast clean
 	@$(MAKE) -C stdtime clean
diff --git a/main/asterisk.exports b/main/asterisk.exports
deleted file mode 100644
index 284bf36f25..0000000000
--- a/main/asterisk.exports
+++ /dev/null
@@ -1,45 +0,0 @@
-{
-	global:
-		ast_*;
-		_ast_*;
-		__ast_*;
-		pbx_*;
-		astman_*;
-		ao2_*;
-		__ao2_*;
-		option_debug;
-		option_verbose;
-		dahdi_chan_name;
-		dahdi_chan_name_len;
-		dahdi_chan_mode;
-		callerid_*;
-		cid_di;
-		cid_dr;
-		clidsb;
-		MD5*;
-		sched_*;
-		io_*;
-		jb_*;
-		aes_*;
-		config_*;
-		tdd_*;
-		term_*;
-		channelreloadreason2txt;
-		devstate2str;
-		__manager_event;
-		dialed_interface_info;
-		strsep;
-		setenv;
-		unsetenv;
-		strcasestr;
-		strnlen;
-		strndup;
-		vasprintf;
-		asprintf;
-		strtoq;
-		getloadavg;
-		ntohll;
-		htonll;
-	local:
-		*;
-};
diff --git a/main/asterisk.exports.in b/main/asterisk.exports.in
new file mode 100644
index 0000000000..ef1dcddc26
--- /dev/null
+++ b/main/asterisk.exports.in
@@ -0,0 +1,45 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_*;
+		LINKER_SYMBOL_PREFIX_ast_*;
+		LINKER_SYMBOL_PREFIX__ast_*;
+		LINKER_SYMBOL_PREFIXpbx_*;
+		LINKER_SYMBOL_PREFIXastman_*;
+		LINKER_SYMBOL_PREFIXao2_*;
+		LINKER_SYMBOL_PREFIX__ao2_*;
+		LINKER_SYMBOL_PREFIXoption_debug;
+		LINKER_SYMBOL_PREFIXoption_verbose;
+		LINKER_SYMBOL_PREFIXdahdi_chan_name;
+		LINKER_SYMBOL_PREFIXdahdi_chan_name_len;
+		LINKER_SYMBOL_PREFIXdahdi_chan_mode;
+		LINKER_SYMBOL_PREFIXcallerid_*;
+		LINKER_SYMBOL_PREFIXcid_di;
+		LINKER_SYMBOL_PREFIXcid_dr;
+		LINKER_SYMBOL_PREFIXclidsb;
+		LINKER_SYMBOL_PREFIXMD5*;
+		LINKER_SYMBOL_PREFIXsched_*;
+		LINKER_SYMBOL_PREFIXio_*;
+		LINKER_SYMBOL_PREFIXjb_*;
+		LINKER_SYMBOL_PREFIXaes_*;
+		LINKER_SYMBOL_PREFIXconfig_*;
+		LINKER_SYMBOL_PREFIXtdd_*;
+		LINKER_SYMBOL_PREFIXterm_*;
+		LINKER_SYMBOL_PREFIXchannelreloadreason2txt;
+		LINKER_SYMBOL_PREFIXdevstate2str;
+		LINKER_SYMBOL_PREFIX__manager_event;
+		LINKER_SYMBOL_PREFIXdialed_interface_info;
+		LINKER_SYMBOL_PREFIXstrsep;
+		LINKER_SYMBOL_PREFIXsetenv;
+		LINKER_SYMBOL_PREFIXunsetenv;
+		LINKER_SYMBOL_PREFIXstrcasestr;
+		LINKER_SYMBOL_PREFIXstrnlen;
+		LINKER_SYMBOL_PREFIXstrndup;
+		LINKER_SYMBOL_PREFIXvasprintf;
+		LINKER_SYMBOL_PREFIXasprintf;
+		LINKER_SYMBOL_PREFIXstrtoq;
+		LINKER_SYMBOL_PREFIXgetloadavg;
+		LINKER_SYMBOL_PREFIXntohll;
+		LINKER_SYMBOL_PREFIXhtonll;
+	local:
+		*;
+};
diff --git a/res/res_adsi.exports b/res/res_adsi.exports
deleted file mode 100644
index a4119dc1fd..0000000000
--- a/res/res_adsi.exports
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-	global:
-		ast_adsi_available;
-		ast_adsi_begin_download;
-		ast_adsi_channel_restore;
-		ast_adsi_clear_screen;
-		ast_adsi_clear_soft_keys;
-		ast_adsi_connect_session;
-		ast_adsi_data_mode;
-		ast_adsi_disconnect_session;
-		ast_adsi_display;
-		ast_adsi_download_connect;
-		ast_adsi_download_disconnect;
-		ast_adsi_end_download;
-		ast_adsi_get_cpeid;
-		ast_adsi_get_cpeinfo;
-		ast_adsi_input_control;
-		ast_adsi_input_format;
-		ast_adsi_load_session;
-		ast_adsi_load_soft_key;
-		ast_adsi_print;
-		ast_adsi_query_cpeid;
-		ast_adsi_query_cpeinfo;
-		ast_adsi_read_encoded_dtmf;
-		ast_adsi_set_keys;
-		ast_adsi_set_line;
-		ast_adsi_transmit_message;
-		ast_adsi_transmit_message_full;
-		ast_adsi_unload_session;
-		ast_adsi_voice_mode;
-	local:
-		*;
-};
diff --git a/res/res_adsi.exports.in b/res/res_adsi.exports.in
new file mode 100644
index 0000000000..480f0ead87
--- /dev/null
+++ b/res/res_adsi.exports.in
@@ -0,0 +1,33 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_adsi_available;
+		LINKER_SYMBOL_PREFIXast_adsi_begin_download;
+		LINKER_SYMBOL_PREFIXast_adsi_channel_restore;
+		LINKER_SYMBOL_PREFIXast_adsi_clear_screen;
+		LINKER_SYMBOL_PREFIXast_adsi_clear_soft_keys;
+		LINKER_SYMBOL_PREFIXast_adsi_connect_session;
+		LINKER_SYMBOL_PREFIXast_adsi_data_mode;
+		LINKER_SYMBOL_PREFIXast_adsi_disconnect_session;
+		LINKER_SYMBOL_PREFIXast_adsi_display;
+		LINKER_SYMBOL_PREFIXast_adsi_download_connect;
+		LINKER_SYMBOL_PREFIXast_adsi_download_disconnect;
+		LINKER_SYMBOL_PREFIXast_adsi_end_download;
+		LINKER_SYMBOL_PREFIXast_adsi_get_cpeid;
+		LINKER_SYMBOL_PREFIXast_adsi_get_cpeinfo;
+		LINKER_SYMBOL_PREFIXast_adsi_input_control;
+		LINKER_SYMBOL_PREFIXast_adsi_input_format;
+		LINKER_SYMBOL_PREFIXast_adsi_load_session;
+		LINKER_SYMBOL_PREFIXast_adsi_load_soft_key;
+		LINKER_SYMBOL_PREFIXast_adsi_print;
+		LINKER_SYMBOL_PREFIXast_adsi_query_cpeid;
+		LINKER_SYMBOL_PREFIXast_adsi_query_cpeinfo;
+		LINKER_SYMBOL_PREFIXast_adsi_read_encoded_dtmf;
+		LINKER_SYMBOL_PREFIXast_adsi_set_keys;
+		LINKER_SYMBOL_PREFIXast_adsi_set_line;
+		LINKER_SYMBOL_PREFIXast_adsi_transmit_message;
+		LINKER_SYMBOL_PREFIXast_adsi_transmit_message_full;
+		LINKER_SYMBOL_PREFIXast_adsi_unload_session;
+		LINKER_SYMBOL_PREFIXast_adsi_voice_mode;
+	local:
+		*;
+};
diff --git a/res/res_ael_share.exports b/res/res_ael_share.exports.in
similarity index 100%
rename from res/res_ael_share.exports
rename to res/res_ael_share.exports.in
diff --git a/res/res_agi.exports b/res/res_agi.exports
deleted file mode 100644
index a305cf2b90..0000000000
--- a/res/res_agi.exports
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-	global:
-		*ast_agi_register;
-		*ast_agi_unregister;
-		*ast_agi_register_multiple;
-		*ast_agi_unregister_multiple;
-		*ast_agi_send;
-	local:
-		*;
-};
diff --git a/res/res_agi.exports.in b/res/res_agi.exports.in
new file mode 100644
index 0000000000..cf4d276ddc
--- /dev/null
+++ b/res/res_agi.exports.in
@@ -0,0 +1,10 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIX*ast_agi_register;
+		LINKER_SYMBOL_PREFIX*ast_agi_unregister;
+		LINKER_SYMBOL_PREFIX*ast_agi_register_multiple;
+		LINKER_SYMBOL_PREFIX*ast_agi_unregister_multiple;
+		LINKER_SYMBOL_PREFIX*ast_agi_send;
+	local:
+		*;
+};
diff --git a/res/res_calendar.exports b/res/res_calendar.exports
deleted file mode 100644
index 021d395b35..0000000000
--- a/res/res_calendar.exports
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-	global:
-		ast_*;
-		calendar_config;
-	local:
-		*;
-};
diff --git a/res/res_calendar.exports.in b/res/res_calendar.exports.in
new file mode 100644
index 0000000000..7fbe4ca78a
--- /dev/null
+++ b/res/res_calendar.exports.in
@@ -0,0 +1,7 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_*;
+		LINKER_SYMBOL_PREFIXcalendar_config;
+	local:
+		*;
+};
diff --git a/res/res_fax.exports b/res/res_fax.exports
deleted file mode 100644
index 0ffe0b3273..0000000000
--- a/res/res_fax.exports
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-	global:
-		ast_fax_tech_register;
-		ast_fax_tech_unregister;
-		ast_fax_session_unreference;
-		ast_fax_minrate;
-		ast_fax_maxrate;
-		ast_fax_state_to_str;
-	local:
-		*;
-};
diff --git a/res/res_fax.exports.in b/res/res_fax.exports.in
new file mode 100644
index 0000000000..7cd569007a
--- /dev/null
+++ b/res/res_fax.exports.in
@@ -0,0 +1,11 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_fax_tech_register;
+		LINKER_SYMBOL_PREFIXast_fax_tech_unregister;
+		LINKER_SYMBOL_PREFIXast_fax_session_unreference;
+		LINKER_SYMBOL_PREFIXast_fax_minrate;
+		LINKER_SYMBOL_PREFIXast_fax_maxrate;
+		LINKER_SYMBOL_PREFIXast_fax_state_to_str;
+	local:
+		*;
+};
diff --git a/res/res_features.exports b/res/res_features.exports
deleted file mode 100644
index 344a652c8e..0000000000
--- a/res/res_features.exports
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-	global:
-		ast_bridge_call;
-		ast_masq_park_call;
-		ast_park_call;
-		ast_parking_ext;
-		ast_pickup_call;
-		ast_pickup_ext;
-		ast_register_feature;
-		ast_unregister_feature;
-	local:
-		*;
-};
diff --git a/res/res_features.exports.in b/res/res_features.exports.in
new file mode 100644
index 0000000000..0575e98e51
--- /dev/null
+++ b/res/res_features.exports.in
@@ -0,0 +1,13 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_bridge_call;
+		LINKER_SYMBOL_PREFIXast_masq_park_call;
+		LINKER_SYMBOL_PREFIXast_park_call;
+		LINKER_SYMBOL_PREFIXast_parking_ext;
+		LINKER_SYMBOL_PREFIXast_pickup_call;
+		LINKER_SYMBOL_PREFIXast_pickup_ext;
+		LINKER_SYMBOL_PREFIXast_register_feature;
+		LINKER_SYMBOL_PREFIXast_unregister_feature;
+	local:
+		*;
+};
diff --git a/res/res_jabber.exports b/res/res_jabber.exports
deleted file mode 100644
index c20bd02565..0000000000
--- a/res/res_jabber.exports
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-	global:
-		ast_aji_create_chat;
-		ast_aji_disconnect;
-		ast_aji_get_client;
-		ast_aji_get_clients;
-		ast_aji_increment_mid;
-		ast_aji_invite_chat;
-		ast_aji_join_chat;
-		ast_aji_send;
-		ast_aji_send_chat;
-	local:
-		*;
-};
diff --git a/res/res_jabber.exports.in b/res/res_jabber.exports.in
new file mode 100644
index 0000000000..a021ac5939
--- /dev/null
+++ b/res/res_jabber.exports.in
@@ -0,0 +1,14 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_aji_create_chat;
+		LINKER_SYMBOL_PREFIXast_aji_disconnect;
+		LINKER_SYMBOL_PREFIXast_aji_get_client;
+		LINKER_SYMBOL_PREFIXast_aji_get_clients;
+		LINKER_SYMBOL_PREFIXast_aji_increment_mid;
+		LINKER_SYMBOL_PREFIXast_aji_invite_chat;
+		LINKER_SYMBOL_PREFIXast_aji_join_chat;
+		LINKER_SYMBOL_PREFIXast_aji_send;
+		LINKER_SYMBOL_PREFIXast_aji_send_chat;
+	local:
+		*;
+};
diff --git a/res/res_monitor.exports b/res/res_monitor.exports
deleted file mode 100644
index 0c97f6a808..0000000000
--- a/res/res_monitor.exports
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-	global:
-		*ast_monitor_change_fname;
-		*ast_monitor_pause;
-		*ast_monitor_setjoinfiles;
-		*ast_monitor_start;
-		*ast_monitor_stop;
-		*ast_monitor_unpause;
-	local:
-		*;
-};
diff --git a/res/res_monitor.exports.in b/res/res_monitor.exports.in
new file mode 100644
index 0000000000..4a40724425
--- /dev/null
+++ b/res/res_monitor.exports.in
@@ -0,0 +1,11 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIX*ast_monitor_change_fname;
+		LINKER_SYMBOL_PREFIX*ast_monitor_pause;
+		LINKER_SYMBOL_PREFIX*ast_monitor_setjoinfiles;
+		LINKER_SYMBOL_PREFIX*ast_monitor_start;
+		LINKER_SYMBOL_PREFIX*ast_monitor_stop;
+		LINKER_SYMBOL_PREFIX*ast_monitor_unpause;
+	local:
+		*;
+};
diff --git a/res/res_odbc.exports b/res/res_odbc.exports
deleted file mode 100644
index 0512ab809f..0000000000
--- a/res/res_odbc.exports
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-	global:
-		ast_odbc_ast_str_SQLGetData;
-		ast_odbc_backslash_is_escape;
-		ast_odbc_clear_cache;
-		ast_odbc_direct_execute;
-		ast_odbc_find_column;
-		ast_odbc_find_table;
-		ast_odbc_prepare_and_execute;
-		ast_odbc_release_obj;
-		ast_odbc_request_obj;
-		_ast_odbc_request_obj;
-		ast_odbc_request_obj2;
-		_ast_odbc_request_obj2;
-		ast_odbc_retrieve_transaction_obj;
-		ast_odbc_sanity_check;
-		ast_odbc_smart_execute;
-	local:
-		*;
-};
diff --git a/res/res_odbc.exports.in b/res/res_odbc.exports.in
new file mode 100644
index 0000000000..ad674beb17
--- /dev/null
+++ b/res/res_odbc.exports.in
@@ -0,0 +1,20 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_odbc_ast_str_SQLGetData;
+		LINKER_SYMBOL_PREFIXast_odbc_backslash_is_escape;
+		LINKER_SYMBOL_PREFIXast_odbc_clear_cache;
+		LINKER_SYMBOL_PREFIXast_odbc_direct_execute;
+		LINKER_SYMBOL_PREFIXast_odbc_find_column;
+		LINKER_SYMBOL_PREFIXast_odbc_find_table;
+		LINKER_SYMBOL_PREFIXast_odbc_prepare_and_execute;
+		LINKER_SYMBOL_PREFIXast_odbc_release_obj;
+		LINKER_SYMBOL_PREFIXast_odbc_request_obj;
+		LINKER_SYMBOL_PREFIX_ast_odbc_request_obj;
+		LINKER_SYMBOL_PREFIXast_odbc_request_obj2;
+		LINKER_SYMBOL_PREFIX_ast_odbc_request_obj2;
+		LINKER_SYMBOL_PREFIXast_odbc_retrieve_transaction_obj;
+		LINKER_SYMBOL_PREFIXast_odbc_sanity_check;
+		LINKER_SYMBOL_PREFIXast_odbc_smart_execute;
+	local:
+		*;
+};
diff --git a/res/res_pktccops.exports b/res/res_pktccops.exports
deleted file mode 100644
index 72cd65ba8d..0000000000
--- a/res/res_pktccops.exports
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-	global:
-		ast_pktccops_gate_alloc;
-	local:
-		*;
-};
diff --git a/res/res_pktccops.exports.in b/res/res_pktccops.exports.in
new file mode 100644
index 0000000000..1892e5bc64
--- /dev/null
+++ b/res/res_pktccops.exports.in
@@ -0,0 +1,6 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_pktccops_gate_alloc;
+	local:
+		*;
+};
diff --git a/res/res_smdi.exports b/res/res_smdi.exports
deleted file mode 100644
index e140aba9f1..0000000000
--- a/res/res_smdi.exports
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-	global:
-		*ast_smdi_interface_find;
-		*ast_smdi_interface_unref;
-		*ast_smdi_md_message_destroy;
-		*ast_smdi_md_message_pop;
-		*ast_smdi_md_message_putback;
-		*ast_smdi_md_message_wait;
-		*ast_smdi_mwi_message_destroy;
-		*ast_smdi_mwi_message_pop;
-		*ast_smdi_mwi_message_putback;
-		*ast_smdi_mwi_message_wait;
-		*ast_smdi_mwi_message_wait_station;
-		*ast_smdi_mwi_set;
-		*ast_smdi_mwi_unset;
-	local:
-		*;
-};
diff --git a/res/res_smdi.exports.in b/res/res_smdi.exports.in
new file mode 100644
index 0000000000..ef0ba5df58
--- /dev/null
+++ b/res/res_smdi.exports.in
@@ -0,0 +1,18 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIX*ast_smdi_interface_find;
+		LINKER_SYMBOL_PREFIX*ast_smdi_interface_unref;
+		LINKER_SYMBOL_PREFIX*ast_smdi_md_message_destroy;
+		LINKER_SYMBOL_PREFIX*ast_smdi_md_message_pop;
+		LINKER_SYMBOL_PREFIX*ast_smdi_md_message_putback;
+		LINKER_SYMBOL_PREFIX*ast_smdi_md_message_wait;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_message_destroy;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_message_pop;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_message_putback;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_message_wait;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_message_wait_station;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_set;
+		LINKER_SYMBOL_PREFIX*ast_smdi_mwi_unset;
+	local:
+		*;
+};
diff --git a/res/res_speech.exports b/res/res_speech.exports
deleted file mode 100644
index 2266607357..0000000000
--- a/res/res_speech.exports
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-	global:
-		ast_speech_change;
-		ast_speech_change_results_type;
-		ast_speech_change_state;
-		ast_speech_destroy;
-		ast_speech_dtmf;
-		ast_speech_grammar_activate;
-		ast_speech_grammar_deactivate;
-		ast_speech_grammar_load;
-		ast_speech_grammar_unload;
-		ast_speech_new;
-		ast_speech_register;
-		ast_speech_results_free;
-		ast_speech_results_get;
-		ast_speech_start;
-		ast_speech_unregister;
-		ast_speech_write;
-	local:
-		*;
-};
diff --git a/res/res_speech.exports.in b/res/res_speech.exports.in
new file mode 100644
index 0000000000..2bdb6398bb
--- /dev/null
+++ b/res/res_speech.exports.in
@@ -0,0 +1,21 @@
+{
+	global:
+		LINKER_SYMBOL_PREFIXast_speech_change;
+		LINKER_SYMBOL_PREFIXast_speech_change_results_type;
+		LINKER_SYMBOL_PREFIXast_speech_change_state;
+		LINKER_SYMBOL_PREFIXast_speech_destroy;
+		LINKER_SYMBOL_PREFIXast_speech_dtmf;
+		LINKER_SYMBOL_PREFIXast_speech_grammar_activate;
+		LINKER_SYMBOL_PREFIXast_speech_grammar_deactivate;
+		LINKER_SYMBOL_PREFIXast_speech_grammar_load;
+		LINKER_SYMBOL_PREFIXast_speech_grammar_unload;
+		LINKER_SYMBOL_PREFIXast_speech_new;
+		LINKER_SYMBOL_PREFIXast_speech_register;
+		LINKER_SYMBOL_PREFIXast_speech_results_free;
+		LINKER_SYMBOL_PREFIXast_speech_results_get;
+		LINKER_SYMBOL_PREFIXast_speech_start;
+		LINKER_SYMBOL_PREFIXast_speech_unregister;
+		LINKER_SYMBOL_PREFIXast_speech_write;
+	local:
+		*;
+};
-- 
GitLab