module: Re-implement using library constructors/destructors (#2018)

By using constructors/destructors we unify the case of static linking with
that of dynamic linking, and we reuse the build flag FEATURE_INIT_FINI. Using
constructors/destructors also allows us to cover the case where library
constructor/destructor functionality is unavailable, because we can expose the
module registration/unregistration functions as global symbols, to be called
explicitly from within the application.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1952

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
This commit is contained in:
Gabriel "_|Nix|_" Schulhof
2017-09-22 13:35:38 +03:00
committed by Zoltan Herczeg
parent 8d916a44f1
commit 81952f3cd0
11 changed files with 172 additions and 124 deletions
+4
View File
@@ -53,6 +53,9 @@ set(ENABLE_LTO ON CACHE BOOL "Enable LTO build?")
set(ENABLE_STATIC_LINK ON CACHE BOOL "Enable static linking?")
set(ENABLE_STRIP ON CACHE BOOL "Enable stripping all symbols from release binary?")
# Optional features
set(FEATURE_INIT_FINI OFF CACHE BOOL "Enable init/fini arrays?")
# Option overrides
if(JERRY_CMDLINE OR JERRY_CMDLINE_MINIMAL OR UNITTESTS OR DOCTESTS)
set(JERRY_PORT_DEFAULT ON)
@@ -106,6 +109,7 @@ message(STATUS "JERRY_LIBC " ${JERRY_LIBC} ${JERRY_LIBC_MESSAGE})
message(STATUS "JERRY_LIBM " ${JERRY_LIBM} ${JERRY_LIBM_MESSAGE})
message(STATUS "UNITTESTS " ${UNITTESTS})
message(STATUS "DOCTESTS " ${DOCTESTS})
message(STATUS "FEATURE_INIT_FINI " ${FEATURE_INIT_FINI})
# Setup directories
# Project binary dir