[Asterisk-code-review] core: Remove embedded module support (asterisk[master])
Sean Bright
asteriskteam at digium.com
Fri Mar 24 08:52:58 CDT 2017
Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5314 )
Change subject: core: Remove embedded module support
......................................................................
core: Remove embedded module support
This has not worked for some time and is no longer actively maintained.
Change-Id: I13206123c371f4d84d8c9d3c36fea816dc57aeb2
---
M Makefile
M Makefile.moddir_rules
M Makefile.rules
M addons/Makefile
M build_tools/cflags.xml
D build_tools/embed_modules.xml
M codecs/Makefile
M include/asterisk/module.h
M main/Makefile
M main/loader.c
M third-party/Makefile
11 files changed, 25 insertions(+), 287 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/14/5314/1
diff --git a/Makefile b/Makefile
index 2c7f925..95a3d3d 100644
--- a/Makefile
+++ b/Makefile
@@ -253,9 +253,6 @@
SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
SUBDIRS_DIST_CLEAN:=$(SUBDIRS:%=%-dist-clean)
SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
-MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
-MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
-MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
ifneq ($(findstring darwin,$(OSARCH)),)
@@ -344,41 +341,14 @@
menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
endif
-$(MOD_SUBDIRS_EMBED_LDSCRIPT):
- + at echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
-
-$(MOD_SUBDIRS_EMBED_LDFLAGS):
- + at echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
-
-$(MOD_SUBDIRS_EMBED_LIBS):
- + at echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
-
$(MOD_SUBDIRS_MENUSELECT_TREE):
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
-makeopts.embed_rules: menuselect.makeopts
- @echo "Generating embedded module rules ..."
- @rm -f $@
- +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDSCRIPT)
- +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
- +@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
-
-$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h
ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
- ifeq ($(shell grep ^MENUSELECT_EMBED=$$ menuselect.makeopts 2>/dev/null),)
- # Non-windows:
- # ensure that all module subdirectories are processed before 'main' during
- # a parallel build, since if there are modules selected to be embedded the
- # directories containing them must be completed before the main Asterisk
- # binary can be built.
- # If MENUSELECT_EMBED is empty, we don't need this and allow 'main' to be
- # be built with only third_party first.
-main: $(filter-out main,$(MOD_SUBDIRS))
- else
main: third-party
- endif
else
# Windows: we need to build main (i.e. the asterisk dll) first,
# followed by res, followed by the other directories, because
@@ -443,7 +413,6 @@
@$(MAKE) -C menuselect dist-clean
@$(MAKE) -C sounds dist-clean
rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
- rm -f makeopts.embed_rules
rm -f config.log config.status config.cache
rm -rf autom4te.cache
rm -f include/asterisk/autoconfig.h
@@ -1033,7 +1002,7 @@
menuselect/makeopts: makeopts .lastclean
+$(MAKE_MENUSELECT) makeopts
-menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc) $(wildcard $(dir)/*.xml)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure makeopts
+menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc) $(wildcard $(dir)/*.xml)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml utils/utils.xml agi/agi.xml configure makeopts
@echo "Generating input for menuselect ..."
@echo "<?xml version=\"1.0\"?>" > $@
@echo >> $@
@@ -1046,7 +1015,6 @@
fi
@cat utils/utils.xml >> $@
@cat agi/agi.xml >> $@
- @cat build_tools/embed_modules.xml >> $@
@cat sounds/sounds.xml >> $@
@echo "</menu>" >> $@
@@ -1097,9 +1065,6 @@
.PHONY: $(SUBDIRS_CLEAN)
.PHONY: $(SUBDIRS_UNINSTALL)
.PHONY: $(SUBDIRS)
-.PHONY: $(MOD_SUBDIRS_EMBED_LDSCRIPT)
-.PHONY: $(MOD_SUBDIRS_EMBED_LDFLAGS)
-.PHONY: $(MOD_SUBDIRS_EMBED_LIBS)
FORCE:
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 95e6278..9e67242 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -18,10 +18,6 @@
# Also note that we can only set one variable per rule, so we have to
# repeat the left hand side to set multiple variables.
-ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
- _ASTCFLAGS+=${GC_CFLAGS}
-endif
-
ifneq ($(findstring STATIC_BUILD,$(MENUSELECT_CFLAGS)),)
STATIC_BUILD=-static
endif
@@ -29,7 +25,7 @@
include $(ASTTOPDIR)/Makefile.rules
# If MODULE_PREFIX is defined, use it to run the standard functions to set
-# C_MODS, CC_MODS, LOADABLE_MODS and EMBEDDED_MODS.
+# C_MODS, CC_MODS and LOADABLE_MODS
# Each word of MODULE_PREFIX is a prefix for filenames that we consider
# valid C or CC modules (eg. app, func ...). Note that the underscore
# is added here, and does not need to be in MODULE_PREFIX
@@ -46,11 +42,7 @@
C_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_C_MODS))
CC_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_CC_MODS))
-ifneq ($(findstring EMBED_$(MENUSELECT_CATEGORY),$(MENUSELECT_EMBED)),)
- EMBEDDED_MODS:=$(C_MODS) $(CC_MODS)
-else
- LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
-endif
+LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
# Both C++ and C++ sources need their module name in AST_MODULE
# We also pass whatever _INCLUDE list is generated by menuselect
@@ -67,7 +59,7 @@
$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$(value $(dep)_INCLUDE))
define MOD_ADD_SOURCE
-$$(if $$(filter $(1),$$(EMBEDDED_MODS)),modules.link,$(1).so): $$(subst $(3),$(5),$(2))
+$(1).so: $$(subst $(3),$(5),$(2))
$$(subst $(3),$(5),$(2)): _ASTCFLAGS+=$$(call MOD_ASTCFLAGS,$(1))
.$(1).moduleinfo: MODULEINFO_EXTRA_OUTPUT=" $$(addprefix $$(SUBDIR)/,$$(subst $(3),$(5),$(2)) $$(subst $(3),$(4),$(2)))"
# The use of wildcard ensures that 'make menuselect' will not fail for modules that
@@ -96,16 +88,11 @@
$(LOADABLE_MODS:%=%.so): LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LIB))
$(LOADABLE_MODS:%=%.so): _ASTLDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LDFLAGS))
-$(EMBEDDED_MODS:%=%.o): _ASTCFLAGS+=-DEMBEDDED_MODULE=$*
-
$(addsuffix .so,$(filter $(LOADABLE_MODS),$(C_MODS))): %.so: %.o
$(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
-modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS)))
-
.PHONY: clean uninstall _all moduleinfo makeopts
-ifneq ($(LOADABLE_MODS),)
_all: $(LOADABLE_MODS:%=%.so)
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
# linker options and extra libraries for cygwin
@@ -113,35 +100,12 @@
LIBS+=-L$(ASTTOPDIR)/main -lasterisk -L$(ASTTOPDIR)/res $($@_LIBS)
# additional libraries in res/
endif
-endif
-
-ifneq ($(EMBEDDED_MODS),)
-_all: modules.link
-__embed_ldscript:
- @echo "../$(SUBDIR)/modules.link"
-__embed_ldflags:
- @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
- @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
-__embed_libs:
- @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
- @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
-else
-__embed_ldscript:
-__embed_ldflags:
-__embed_libs:
-endif
-
-modules.link:
- @rm -f $@
- @for file in $(patsubst %,$(SUBDIR)/%,$(filter %.eo,$^)); do echo "INPUT (../$${file})" >> $@; done
- @for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.eo,$^)); do echo "INPUT (../$${file})" >> $@; done
clean::
rm -f *.so *.o *.oo *.eo *.i *.ii
rm -f .*.d
rm -f *.s *.i
rm -f *.gcda *.gcno
- rm -f modules.link
install:: all
@echo "Installing modules from `basename $(CURDIR)`..."
@@ -177,7 +141,7 @@
echo "</member>" >> $@
.moduleinfo:: $(addsuffix .moduleinfo,$(addprefix .,$(sort $(ALL_C_MODS) $(ALL_CC_MODS)))) $(wildcard $(call tolower,$(MENUSELECT_CATEGORY)).xml)
- @echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" remove_on_change=\"$(SUBDIR)/modules.link\">" > $@
+ @echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\">" > $@
@cat $^ >> $@
@echo "</category>" >> $@
diff --git a/Makefile.rules b/Makefile.rules
index 45989d6..ee8eabd 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -185,18 +185,6 @@
$(ECHO_PREFIX) echo " [LDXX] $^ -> $@"
$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(CXX_LDFLAGS_SO) $^ $(CXX_LIBS)
-%.eo: %.o
- $(ECHO_PREFIX) echo " [EMBED] $< -> $@"
- $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_eo_script $* > .$@.ld
- $(CMD_PREFIX) $(LD) -r -T .$@.ld -o $@ $<
- $(CMD_PREFIX) rm -f .$@.ld
-
-%.eo: %.oo
- $(ECHO_PREFIX) echo " [EMBED] $< -> $@"
- $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_eo_script $* > .$@.ld
- $(CMD_PREFIX) $(LD) -r -T .$@.ld -o $@ $<
- $(CMD_PREFIX) rm -f .$@.ld
-
%: %.o
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $^ $(CXX_LIBS) $(ASTLDFLAGS)
diff --git a/addons/Makefile b/addons/Makefile
index a02d35f..d12d0fd 100644
--- a/addons/Makefile
+++ b/addons/Makefile
@@ -59,7 +59,7 @@
include $(ASTTOPDIR)/Makefile.moddir_rules
-$(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): _ASTCFLAGS+=$(H323CFLAGS)
+chan_ooh323.so: _ASTCFLAGS+=$(H323CFLAGS)
$(call MOD_ADD_C,chan_ooh323,$(H323SOURCE))
$(call MOD_ADD_C,format_mp3,mp3/common.c mp3/dct64_i386.c mp3/decode_ntom.c mp3/layer3.c mp3/tabinit.c mp3/interface.c)
diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml
index a06d515..f05f428 100644
--- a/build_tools/cflags.xml
+++ b/build_tools/cflags.xml
@@ -19,10 +19,6 @@
<member name="STATIC_BUILD" displayname="Build static binaries">
<support_level>extended</support_level>
</member>
- <member name="LOADABLE_MODULES" displayname="Runtime module loading">
- <defaultenabled>yes</defaultenabled>
- <support_level>core</support_level>
- </member>
<member name="DEBUG_FD_LEAKS" displayname="Enable File Descriptor Leak Detection">
<support_level>core</support_level>
</member>
diff --git a/build_tools/embed_modules.xml b/build_tools/embed_modules.xml
deleted file mode 100644
index a7e4cfd..0000000
--- a/build_tools/embed_modules.xml
+++ /dev/null
@@ -1,46 +0,0 @@
- <category name="MENUSELECT_EMBED" displayname="Module Embedding" positive_output="yes" remove_on_change="main/asterisk">
- <member name="EMBED_ADDONS" displayname="Add-ons" remove_on_change="addons/*.o addons/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_APPS" displayname="Applications" remove_on_change="apps/*.o apps/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_BRIDGES" displayname="Bridging Technologies" remove_on_change="bridges/*.o bridges/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_CDR" displayname="Call Detail Recording" remove_on_change="cdr/*.o cdr/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_CHANNELS" displayname="Channels" remove_on_change="channels/*.o channels/*/*.o channels/*.oo channels/*/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_CODECS" displayname="Coders/Decoders" remove_on_change="codecs/*.o codecs/*/*.o codecs/*/*/*.o codecs/*/*.a codecs/*/*/*.a codecs/*.oo codecs/*/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_FORMATS" displayname="File Formats" remove_on_change="formats/*.o formats/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_FUNCS" displayname="Dialplan Functions" remove_on_change="funcs/*.o funcs/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_PBX" displayname="PBX Functionality" remove_on_change="pbx/*.o pbx/*/*.o pbx/*.oo pbx/*/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_RES" displayname="Resource Modules" remove_on_change="res/*.o res/*/*.o res/*.oo res/*/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- <member name="EMBED_TEST" displayname="Test Modules" remove_on_change="tests/*.o tests/*.oo">
- <depend>gnu_ld</depend>
- <support_level>extended</support_level>
- </member>
- </category>
diff --git a/codecs/Makefile b/codecs/Makefile
index 684ccc6..64f77eb 100644
--- a/codecs/Makefile
+++ b/codecs/Makefile
@@ -38,7 +38,7 @@
ifneq ($(GSM_INTERNAL),no)
GSM_INCLUDE := -I$(SUB_GSM)/inc
-$(if $(filter codec_gsm,$(EMBEDDED_MODS)),modules.link,codec_gsm.so): $(SUB_GSM)/lib/libgsm.a
+codec_gsm.so: $(SUB_GSM)/lib/libgsm.a
endif
# Don't run the implicit rules for this target.
@@ -57,7 +57,7 @@
.PHONY: $(SUB_DIRS)
-$(if $(filter codec_lpc10,$(EMBEDDED_MODS)),modules.link,codec_lpc10.so): $(LIBLPC10)
+codec_lpc10.so: $(LIBLPC10)
# Don't run the implicit rules for this target.
$(LIBLPC10): $(SUB_LPC10) ;
@@ -67,7 +67,7 @@
ifneq ($(ILBC_INTERNAL),no)
-$(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC)
+codec_ilbc.so: $(LIBILBC)
else
ILBC_INCLUDE += -DILBC_WEBRTC
endif
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index a80c7f8..84807ff 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -440,64 +440,8 @@
static const __attribute__((unused)) struct ast_module_info *ast_module_info;
#endif
-#if !defined(EMBEDDED_MODULE)
#define __MODULE_INFO_SECTION
#define __MODULE_INFO_GLOBALS
-#else
-/*
- * For embedded modules we need additional information to backup and
- * restore the global variables in the module itself, so we can unload
- * reload the module.
- * EMBEDDED_MODULE is defined as the module name, so the calls to make_var()
- * below will actually define different symbols for each module.
- */
-#define __MODULE_INFO_SECTION __attribute__((section(".embed_module")))
-#define __MODULE_INFO_GLOBALS .backup_globals = __backup_globals, .restore_globals = __restore_globals,
-
-#define make_var_sub(mod, type) __ ## mod ## _ ## type
-#define make_var(mod, type) make_var_sub(mod, type)
-
-extern void make_var(EMBEDDED_MODULE, bss_start);
-extern void make_var(EMBEDDED_MODULE, bss_end);
-extern void make_var(EMBEDDED_MODULE, data_start);
-extern void make_var(EMBEDDED_MODULE, data_end);
-
-static void * __attribute__((section(".embed_module"))) __global_backup;
-
-static int __backup_globals(void)
-{
- size_t data_size = & make_var(EMBEDDED_MODULE, data_end) - & make_var(EMBEDDED_MODULE, data_start);
-
- if (__global_backup)
- return 0;
-
- if (!data_size)
- return 0;
-
- if (!(__global_backup = ast_malloc(data_size)))
- return -1;
-
- memcpy(__global_backup, & make_var(EMBEDDED_MODULE, data_start), data_size);
-
- return 0;
-}
-
-static void __restore_globals(void)
-{
- size_t data_size = & make_var(EMBEDDED_MODULE, data_end) - & make_var(EMBEDDED_MODULE, data_start);
- size_t bss_size = & make_var(EMBEDDED_MODULE, bss_end) - & make_var(EMBEDDED_MODULE, bss_start);
-
- if (bss_size)
- memset(& make_var(EMBEDDED_MODULE, bss_start), 0, bss_size);
-
- if (!data_size || !__global_backup)
- return;
-
- memcpy(& make_var(EMBEDDED_MODULE, data_start), __global_backup, data_size);
-}
-#undef make_var
-#undef make_var_sub
-#endif /* EMBEDDED_MODULE */
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...) \
static struct ast_module_info \
diff --git a/main/Makefile b/main/Makefile
index cf38f5f..cd553cb 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -11,7 +11,7 @@
# the GNU General Public License
#
--include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/makeopts.embed_rules $(ASTTOPDIR)/makeopts
+-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/makeopts
all: asterisk
@@ -48,9 +48,7 @@
AST_LIBS+=$(SYSTEMD_LIB)
ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-musl kfreebsd-gnu),)
- ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
AST_LIBS+=-ldl
- endif
ifneq (x$(CAP_LIB),x)
AST_LIBS+=$(CAP_LIB)
endif
@@ -69,11 +67,7 @@
ASTLINK+=/usr/lib/bundle1.o
else
# These are used for all but Darwin
- ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
- ASTLINK+=-Wl,--export-dynamic
- else
- ASTLINK+=${GC_LDFLAGS}
- endif
+ ASTLINK+=-Wl,--export-dynamic
ifneq ($(findstring BSD,$(OSARCH)),)
LDFLAGS+=-L/usr/local/lib
endif
@@ -172,9 +166,6 @@
stdtime/localtime.o: _ASTCFLAGS+=$(AST_NO_STRICT_OVERFLOW) -Wno-format-nonliteral
-AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
-AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
-AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
OBJS:=$(sort $(OBJS))
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
@@ -325,10 +316,10 @@
tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE)
-$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS)
+$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB) $(LIBEDIT_OBJ)
@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
- $(ECHO_PREFIX) echo " [LD] $(OBJS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) -> $@"
- $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(ASTPJ_LDLIBS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
+ $(ECHO_PREFIX) echo " [LD] $(OBJS) $(LIBEDIT_OBJ) -> $@"
+ $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(ASTPJ_LDLIBS) $(LIBEDIT_OBJ) buildinfo.o $(AST_LIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB)
ifeq ($(GNU_LD),1)
$(MAIN_TGT): asterisk.exports
diff --git a/main/loader.c b/main/loader.c
index dacfce1..5d769bd 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -109,10 +109,6 @@
static char buildopt_sum[33] = AST_BUILDOPT_SUM;
-static unsigned int embedding = 1; /* we always start out by registering embedded modules,
- since they are here before we dlopen() any
- */
-
/*!
* \brief Internal flag to indicate all modules have been initially loaded.
*/
@@ -146,14 +142,6 @@
return mod->info->name;
}
-/*
- * module_list is cleared by its constructor possibly after
- * we start accumulating embedded modules, so we need to
- * use another list (without the lock) to accumulate them.
- * Then we update the main list when embedding is done.
- */
-static struct module_list embedded_module_list;
-
struct loadupdate {
int (*updater)(void);
AST_LIST_ENTRY(loadupdate) entry;
@@ -182,15 +170,7 @@
void ast_module_register(const struct ast_module_info *info)
{
- struct ast_module *mod;
-
- if (embedding) {
- if (!(mod = ast_calloc(1, sizeof(*mod) + strlen(info->name) + 1)))
- return;
- strcpy(mod->resource, info->name);
- } else {
- mod = resource_being_loaded;
- }
+ struct ast_module *mod = resource_being_loaded;
ast_debug(5, "Registering module %s\n", info->name);
@@ -206,18 +186,14 @@
might be unsafe to use the list lock at that point... so
let's avoid it altogether
*/
- if (embedding) {
- AST_DLLIST_INSERT_TAIL(&embedded_module_list, mod, entry);
- } else {
- AST_DLLIST_LOCK(&module_list);
- /* it is paramount that the new entry be placed at the tail of
- the list, otherwise the code that uses dlopen() to load
- dynamic modules won't be able to find out if the module it
- just opened was registered or failed to load
- */
- AST_DLLIST_INSERT_TAIL(&module_list, mod, entry);
- AST_DLLIST_UNLOCK(&module_list);
- }
+ AST_DLLIST_LOCK(&module_list);
+ /* it is paramount that the new entry be placed at the tail of
+ the list, otherwise the code that uses dlopen() to load
+ dynamic modules won't be able to find out if the module it
+ just opened was registered or failed to load
+ */
+ AST_DLLIST_INSERT_TAIL(&module_list, mod, entry);
+ AST_DLLIST_UNLOCK(&module_list);
/* give the module a copy of its own handle, for later use in registrations and the like */
*((struct ast_module **) &(info->self)) = mod;
@@ -431,8 +407,6 @@
return cur;
}
-#ifdef LOADABLE_MODULES
-
/*!
* \brief dlclose(), with failure logging.
*/
@@ -605,8 +579,6 @@
return AST_DLLIST_LAST(&module_list);
}
-#endif
-
int modules_shutdown(void)
{
struct ast_module *mod;
@@ -724,12 +696,10 @@
if (!error && !mod->lib && mod->info && mod->info->restore_globals)
mod->info->restore_globals();
-#ifdef LOADABLE_MODULES
if (!error) {
unload_dynamic_module(mod);
ast_test_suite_event_notify("MODULE_UNLOAD", "Message: %s", resource_name);
}
-#endif
if (!error)
ast_update_use_count();
@@ -1072,7 +1042,6 @@
if (global_symbols_only && !ast_test_flag(mod->info, AST_MODFLAG_GLOBAL_SYMBOLS))
return AST_MODULE_LOAD_SKIP;
} else {
-#ifdef LOADABLE_MODULES
mod = load_dynamic_module(resource_name, global_symbols_only, suppress_logging, resource_heap);
if (mod == MODULE_LOCAL_ONLY) {
return AST_MODULE_LOAD_SKIP;
@@ -1083,17 +1052,11 @@
}
return required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
}
-#else
- ast_log(LOG_WARNING, "Module support is not available. Module '%s' could not be loaded.\n", resource_name);
- return required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
-#endif
}
if (inspect_module(mod)) {
ast_log(LOG_WARNING, "Module '%s' could not be loaded.\n", resource_name);
-#ifdef LOADABLE_MODULES
unload_dynamic_module(mod);
-#endif
return required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
}
@@ -1316,7 +1279,6 @@
int load_modules(unsigned int preload_only)
{
struct ast_config *cfg;
- struct ast_module *mod;
struct load_order_entry *order;
struct ast_variable *v;
unsigned int load_count;
@@ -1324,26 +1286,14 @@
int res = 0;
struct ast_flags config_flags = { 0 };
int modulecount = 0;
-
-#ifdef LOADABLE_MODULES
struct dirent *dirent;
DIR *dir;
-#endif
-
- /* all embedded modules have registered themselves by now */
- embedding = 0;
ast_verb(1, "Asterisk Dynamic Loader Starting:\n");
AST_LIST_HEAD_INIT_NOLOCK(&load_order);
AST_DLLIST_LOCK(&module_list);
-
- if (embedded_module_list.first) {
- module_list.first = embedded_module_list.first;
- module_list.last = embedded_module_list.last;
- embedded_module_list.first = NULL;
- }
cfg = ast_config_load2(AST_MODULE_CONFIG, "" /* core, can't reload */, config_flags);
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
@@ -1366,19 +1316,6 @@
/* check if 'autoload' is on */
if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
- /* if so, first add all the embedded modules that are not already running to the load order */
- AST_DLLIST_TRAVERSE(&module_list, mod, entry) {
- /* if it's not embedded, skip it */
- if (mod->lib)
- continue;
-
- if (mod->flags.running)
- continue;
-
- add_to_load_order(mod->resource, &load_order, 0);
- }
-
-#ifdef LOADABLE_MODULES
/* if we are allowed to load dynamic modules, scan the directory for
for all available modules and add them as well */
if ((dir = opendir(ast_config_AST_MODULE_DIR))) {
@@ -1407,7 +1344,6 @@
ast_log(LOG_WARNING, "Unable to open modules directory '%s'.\n",
ast_config_AST_MODULE_DIR);
}
-#endif
}
/* now scan the config for any modules we are prohibited from loading and
diff --git a/third-party/Makefile b/third-party/Makefile
index f3016f1..59b7c06 100644
--- a/third-party/Makefile
+++ b/third-party/Makefile
@@ -6,7 +6,7 @@
# to prevent accidentally running the package's default install target.
TP_INSTALL_SUBDIRS := pjproject
-.PHONY: all dist-clean distclean install clean moduleinfo makeopts uninstall __embed_libs __embed_ldscript __embed_ldflags $(TP_SUBDIRS)
+.PHONY: all dist-clean distclean install clean moduleinfo makeopts uninstall $(TP_SUBDIRS)
override MAKECMDGOALS?=all
--
To view, visit https://gerrit.asterisk.org/5314
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13206123c371f4d84d8c9d3c36fea816dc57aeb2
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
More information about the asterisk-code-review
mailing list