core: Remove embedded module support
authorSean Bright <sean.bright@gmail.com>
Fri, 24 Mar 2017 12:43:05 +0000 (08:43 -0400)
committerCorey Farrell <git@cfware.com>
Mon, 27 Mar 2017 14:36:08 +0000 (10:36 -0400)
This has not worked for some time and is no longer actively maintained.

Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99

15 files changed:
Makefile
Makefile.moddir_rules
Makefile.rules
UPGRADE.txt
addons/Makefile
build_tools/cflags.xml
build_tools/embed_modules.xml [deleted file]
codecs/Makefile
configure
configure.ac
include/asterisk/module.h
main/Makefile
main/loader.c
makeopts.in
third-party/Makefile

index 2c7f925..95a3d3d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -253,9 +253,6 @@ SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
 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 @@ ifeq ($(filter %.menuselect,$(MAKECMDGOALS)),)
        menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
 endif
 
-$(MOD_SUBDIRS_EMBED_LDSCRIPT):
-       +@echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
-
-$(MOD_SUBDIRS_EMBED_LDFLAGS):
-       +@echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
-
-$(MOD_SUBDIRS_EMBED_LIBS):
-       +@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 @@ distclean: $(SUBDIRS_DIST_CLEAN) _clean
        @$(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/nmenuselect: menuselect/makeopts .lastclean
 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 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
        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 @@ check-alembic: makeopts
 .PHONY: $(SUBDIRS_CLEAN)
 .PHONY: $(SUBDIRS_UNINSTALL)
 .PHONY: $(SUBDIRS)
-.PHONY: $(MOD_SUBDIRS_EMBED_LDSCRIPT)
-.PHONY: $(MOD_SUBDIRS_EMBED_LDFLAGS)
-.PHONY: $(MOD_SUBDIRS_EMBED_LIBS)
 
 FORCE:
 
index 95e6278..59190be 100644 (file)
 # 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 @@ endif
 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 @@ endif
 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 @@ MOD_ASTCFLAGS=\
        $(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 @@ endif
 $(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,28 +100,6 @@ ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
   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
@@ -177,7 +142,7 @@ dist-clean::
        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>" >> $@
 
index 45989d6..ee8eabd 100644 (file)
@@ -185,18 +185,6 @@ endif
        $(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)
index 1afacf2..62bb801 100644 (file)
 === UPGRADE-14.txt  -- Upgrade info for 13 to 14
 ===========================================================
 
+From 14.4.0 to 14.5.0:
+
+Core:
+ - Support for embedded modules has been removed.  This has not worked in
+   many years.  LOADABLE_MODULES menuselect option is also removed as
+   loadable module support is now always enabled.
+
 From 14.3.0 to 14.4.0:
 
 res_rtp_asterisk:
index a02d35f..d12d0fd 100644 (file)
@@ -59,7 +59,7 @@ endif
 
 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)
index a06d515..f05f428 100644 (file)
                <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 (file)
index a7e4cfd..0000000
+++ /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>
index 684ccc6..64f77eb 100644 (file)
@@ -38,7 +38,7 @@ include $(ASTTOPDIR)/Makefile.moddir_rules
 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 @@ clean::
 .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 @@ $(SUB_LPC10):
 
 
 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
index 078020c..15f127b 100755 (executable)
--- a/configure
+++ b/configure
@@ -704,8 +704,6 @@ AST_NO_STRICT_OVERFLOW
 AST_FORTIFY_SOURCE
 AST_TRAMPOLINES
 AST_DECLARATION_AFTER_STATEMENT
-GC_LDFLAGS
-GC_CFLAGS
 AST_UNDEFINED_SANITIZER
 AST_LEAK_SANITIZER
 AST_THREAD_SANITIZER
@@ -18920,62 +18918,6 @@ CFLAGS="${saved_sanitize_CFLAGS}"
 LDFLAGS="${saved_sanitize_LDFLAGS}"
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
-$as_echo_n "checking for -ffunction-sections support... " >&6; }
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -ffunction-sections"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-       saved_LDFLAGS="${LDFLAGS}"
-       LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --gc-sections support" >&5
-$as_echo_n "checking for --gc-sections support... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-               GC_CFLAGS="-ffunction-sections"
-               GC_LDFLAGS="-Wl,--gc-sections"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-       LDFLAGS="${saved_LDFLAGS}"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS="${saved_CFLAGS}"
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
 $as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
index 890f32d..a57446f 100644 (file)
@@ -1197,29 +1197,6 @@ CFLAGS="${saved_sanitize_CFLAGS}"
 LDFLAGS="${saved_sanitize_LDFLAGS}"
 AC_SUBST(AST_UNDEFINED_SANITIZER)
 
-AC_MSG_CHECKING(for -ffunction-sections support)
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -ffunction-sections"
-AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([], [int x = 1;])],
-       AC_MSG_RESULT(yes)
-       [saved_LDFLAGS="${LDFLAGS}"]
-       [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
-       AC_MSG_CHECKING(for --gc-sections support)
-       AC_LINK_IFELSE(
-               [AC_LANG_PROGRAM([], [int x = 1;])],
-               AC_MSG_RESULT(yes)
-               [GC_CFLAGS="-ffunction-sections"]
-               [[GC_LDFLAGS="-Wl,--gc-sections"]],
-               AC_MSG_RESULT(no)
-       )
-       [LDFLAGS="${saved_LDFLAGS}"],
-       AC_MSG_RESULT(no)
-)
-CFLAGS="${saved_CFLAGS}"
-AC_SUBST(GC_CFLAGS)
-AC_SUBST(GC_LDFLAGS)
-
 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
        AC_MSG_RESULT(yes)
index a80c7f8..e614a72 100644 (file)
@@ -303,8 +303,6 @@ struct ast_module_info {
        enum ast_module_load_result (*load)(void);      /*!< register stuff etc. Optional. */
        int (*reload)(void);                    /*!< config etc. Optional. */
        int (*unload)(void);                    /*!< unload. called with the module locked */
-       int (*backup_globals)(void);            /*!< for embedded modules, backup global data */
-       void (*restore_globals)(void);          /*!< for embedded modules, restore global data */
        const char *name;                       /*!< name of the module for loader reference and CLI commands */
        const char *description;                /*!< user friendly description of the module. */
 
@@ -379,8 +377,6 @@ void __ast_module_unref(struct ast_module *mod, const char *file, int line, cons
                load_func,                                                     \
                reload_func,                                                   \
                unload_func,                                                   \
-               NULL,                                                          \
-               NULL,                                                          \
                AST_MODULE,                                                    \
                desc,                                                          \
                keystr,                                                        \
@@ -440,70 +436,9 @@ void __ast_module_unref(struct ast_module *mod, const char *file, int line, cons
 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                           \
-               __MODULE_INFO_SECTION                           \
                __mod_info = {                                  \
-               __MODULE_INFO_GLOBALS                           \
                .name = AST_MODULE,                             \
                .flags = flags_to_set,                          \
                .description = desc,                            \
index cf38f5f..cd553cb 100644 (file)
@@ -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+=$(RT_LIB)
 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 @@ ifneq ($(findstring darwin,$(OSARCH)),)
   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 @@ endif
 
 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 @@ endif
 
 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
index dacfce1..380fe1c 100644 (file)
@@ -109,10 +109,6 @@ static const unsigned char expected_key[] =
 
 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 @@ const char *ast_module_name(const struct ast_module *mod)
        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 @@ static struct ast_module *resource_being_loaded;
 
 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 @@ void ast_module_register(const struct ast_module_info *info)
           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 @@ static struct ast_module *find_resource(const char *resource, int do_lock)
        return cur;
 }
 
-#ifdef LOADABLE_MODULES
-
 /*!
  * \brief dlclose(), with failure logging.
  */
@@ -605,8 +579,6 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
        return AST_DLLIST_LAST(&module_list);
 }
 
-#endif
-
 int modules_shutdown(void)
 {
        struct ast_module *mod;
@@ -721,18 +693,11 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
 
        AST_DLLIST_UNLOCK(&module_list);
 
-       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();
+       }
 
        return res;
 }
@@ -1072,7 +1037,6 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
                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,22 +1047,11 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
                        }
                        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;
-       }
-
-       if (!mod->lib && mod->info->backup_globals && mod->info->backup_globals()) {
-               ast_log(LOG_WARNING, "Module '%s' was unable to backup its global data.\n", resource_name);
                return required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
        }
 
@@ -1316,7 +1269,6 @@ done:
 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,14 +1276,8 @@ int load_modules(unsigned int preload_only)
        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");
 
@@ -1339,12 +1285,6 @@ int load_modules(unsigned int preload_only)
 
        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) {
                ast_log(LOG_WARNING, "No '%s' found, no modules will be loaded.\n", AST_MODULE_CONFIG);
@@ -1366,19 +1306,6 @@ int load_modules(unsigned int preload_only)
 
        /* 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 +1334,6 @@ int load_modules(unsigned int preload_only)
                                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
index 5bc5258..03ef747 100644 (file)
@@ -62,9 +62,6 @@ HOST_OS=@HOST_OS@
 OSARCH=@OSARCH@
 OSREV=@PBX_OSREV@
 
-GC_CFLAGS=@GC_CFLAGS@
-GC_LDFLAGS=@GC_LDFLAGS@
-
 PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
 PTHREAD_LIBS=@PTHREAD_LIBS@
 
index f3016f1..59b7c06 100644 (file)
@@ -6,7 +6,7 @@ TP_SUBDIRS := pjproject
 # 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