From 45ebde8b3960ddfc4a2f58361e234fed61d2e398 Mon Sep 17 00:00:00 2001 From: Daniel Kochmanski Date: Sun, 18 Jan 2015 13:57:20 +0100 Subject: [PATCH 1/6] ffi: implement si_unload_foreign_module. Patch is necessary to implement this function in cffi - a few libraries depends on this functionality, and until now it throws an error. Signed-off-by: Daniel Kochmanski --- src/c/ffi.d | 27 +++++++++++++++++++++++++++ src/c/ffi/libraries.d | 18 +++++++++++++----- src/c/symbols_list.h | 1 + src/c/symbols_list2.h | 1 + src/h/external.h | 3 ++- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/c/ffi.d b/src/c/ffi.d index 6adb964cf..ae33ffb23 100644 --- a/src/c/ffi.d +++ b/src/c/ffi.d @@ -728,6 +728,33 @@ si_load_foreign_module(cl_object filename) #endif } +cl_object +si_unload_foreign_module(cl_object module) +{ +#if !defined(ENABLE_DLOPEN) + FEerror("SI:UNLOAD-FOREIGN-MODULE does not work when ECL is statically linked", 0); +#else + cl_object output = ECL_NIL; + + if (ecl_unlikely(ecl_t_of(module) != t_codeblock)) { + FEerror("UNLOAD-FOREIGN-MODULE: Argument is not a foreign module: ~S ", + 1, module); + } +# ifdef ECL_THREADS + mp_get_lock(1, ecl_symbol_value(@'mp::+load-compile-lock+')); + ECL_UNWIND_PROTECT_BEGIN(ecl_process_env()) { +# endif + if (ecl_likely(ecl_library_close(module))) output = ECL_T; +# ifdef ECL_THREADS + (void)0; /* MSVC complains about missing ';' before '}' */ + } ECL_UNWIND_PROTECT_EXIT { + mp_giveup_lock(ecl_symbol_value(@'mp::+load-compile-lock+')); + } ECL_UNWIND_PROTECT_END; +# endif + @(return output) +#endif +} + cl_object si_find_foreign_symbol(cl_object var, cl_object module, cl_object type, cl_object size) { diff --git a/src/c/ffi/libraries.d b/src/c/ffi/libraries.d index 9adb73444..530f1529d 100644 --- a/src/c/ffi/libraries.d +++ b/src/c/ffi/libraries.d @@ -205,7 +205,7 @@ dlopen_wrapper(cl_object block) set_library_error(block); } -static void +static int dlclose_wrapper(cl_object block) { if (block->cblock.handle != NULL) { @@ -219,7 +219,9 @@ dlclose_wrapper(cl_object block) FreeLibrary(block->cblock.handle); #endif block->cblock.handle = NULL; + return TRUE; } + return FALSE; } static cl_object @@ -419,18 +421,23 @@ ecl_library_error(cl_object block) { return block->cblock.error; } -void +bool ecl_library_close(cl_object block) { const cl_env_ptr the_env = ecl_process_env(); + bool success = TRUE; ECL_WITH_GLOBAL_LOCK_BEGIN(the_env) { ecl_disable_interrupts(); - if (block->cblock.refs != ecl_make_fixnum(1)) { + /* is it ever a case? no matter how many times i call + load-foreign-module it seems that block->cblock.refs = 1 */ + if (block->cblock.refs > ecl_make_fixnum(1)) { block->cblock.refs = ecl_one_minus(block->cblock.refs); block = ECL_NIL; } else if (block->cblock.handle != NULL) { - GC_call_with_alloc_lock(dlclose_wrapper, block); + success = GC_call_with_alloc_lock(dlclose_wrapper, block); cl_core.libraries = ecl_remove_eq(block, cl_core.libraries); - } + } else { /* block not loaded */ + success = FALSE; + } ecl_enable_interrupts(); } ECL_WITH_GLOBAL_LOCK_END; if (block != ECL_NIL && block->cblock.self_destruct) { @@ -438,6 +445,7 @@ ecl_library_close(cl_object block) { unlink((char*)block->cblock.name->base_string.self); } } + return success; } void diff --git a/src/c/symbols_list.h b/src/c/symbols_list.h index 47851b5d7..5a5f64cd4 100755 --- a/src/c/symbols_list.h +++ b/src/c/symbols_list.h @@ -1485,6 +1485,7 @@ cl_symbols[] = { {SYS_ "FREE-FOREIGN-DATA", SI_ORDINARY, si_free_foreign_data, 1, OBJNULL}, {SYS_ "MAKE-FOREIGN-DATA-FROM-ARRAY", SI_ORDINARY, si_make_foreign_data_from_array, 1, OBJNULL}, {SYS_ "LOAD-FOREIGN-MODULE", SI_ORDINARY, si_load_foreign_module, 1, OBJNULL}, +{SYS_ "UNLOAD-FOREIGN-MODULE", SI_ORDINARY, si_unload_foreign_module, 1, OBJNULL}, {SYS_ "NULL-POINTER-P", SI_ORDINARY, si_null_pointer_p, 1, OBJNULL}, {SYS_ "SIZE-OF-FOREIGN-ELT-TYPE", SI_ORDINARY, si_size_of_foreign_elt_type, 1, OBJNULL}, {SYS_ "ALIGNMENT-OF-FOREIGN-ELT-TYPE", SI_ORDINARY, si_alignment_of_foreign_elt_type, 1, OBJNULL}, diff --git a/src/c/symbols_list2.h b/src/c/symbols_list2.h index 5d99c948b..70fdd1ae6 100644 --- a/src/c/symbols_list2.h +++ b/src/c/symbols_list2.h @@ -1485,6 +1485,7 @@ cl_symbols[] = { {SYS_ "FREE-FOREIGN-DATA","si_free_foreign_data"}, {SYS_ "MAKE-FOREIGN-DATA-FROM-ARRAY","si_make_foreign_data_from_array"}, {SYS_ "LOAD-FOREIGN-MODULE","si_load_foreign_module"}, +{SYS_ "UNLOAD-FOREIGN-MODULE","si_unload_foreign_module"}, {SYS_ "NULL-POINTER-P","si_null_pointer_p"}, {SYS_ "SIZE-OF-FOREIGN-ELT-TYPE","si_size_of_foreign_elt_type"}, {SYS_ "ALIGNMENT-OF-FOREIGN-ELT-TYPE","si_alignment_of_foreign_elt_type"}, diff --git a/src/h/external.h b/src/h/external.h index e3dee7768..8b79f4aa1 100755 --- a/src/h/external.h +++ b/src/h/external.h @@ -618,7 +618,7 @@ extern ECL_API cl_object ecl_make_codeblock(); extern ECL_API cl_object ecl_library_open(cl_object filename, bool force_reload); extern ECL_API void *ecl_library_symbol(cl_object block, const char *symbol, bool lock); extern ECL_API cl_object ecl_library_error(cl_object block); -extern ECL_API void ecl_library_close(cl_object block); +extern ECL_API bool ecl_library_close(cl_object block); extern ECL_API void ecl_library_close_all(void); /* ffi/mmap.d */ @@ -650,6 +650,7 @@ extern ECL_API cl_object si_null_pointer_p(cl_object f); extern ECL_API cl_object si_size_of_foreign_elt_type(cl_object tag); extern ECL_API cl_object si_alignment_of_foreign_elt_type(cl_object tag); extern ECL_API cl_object si_load_foreign_module(cl_object module); +extern ECL_API cl_object si_unload_foreign_module(cl_object module); extern ECL_API cl_object si_find_foreign_symbol(cl_object var, cl_object module, cl_object type, cl_object size); extern ECL_API cl_object si_call_cfun(cl_narg, cl_object fun, cl_object return_type, cl_object arg_types, cl_object args, ...); extern ECL_API cl_object si_make_dynamic_callback(cl_narg, cl_object fun, cl_object sym, cl_object return_type, cl_object arg_types, ...); From eaf37d9435212ee5b33b42138f857f35afda7e79 Mon Sep 17 00:00:00 2001 From: Daniel Kochmanski Date: Sat, 31 Jan 2015 17:04:58 +0100 Subject: [PATCH 2/6] Add CAS emulation for armel. GCC has problems with detecting arm version, and libatomic_ops doesn't build cleanly for armv5. This patch is taken from PKGBUILDs repository of archlinuxarm distribution. Signed-off-by: Daniel Kochmanski --- src/h/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/h/internal.h b/src/h/internal.h index 50fb8a95d..595d0a243 100755 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -422,6 +422,7 @@ extern void cl_write_object(cl_object x, cl_object stream); #endif /* ECL_THREADS */ #ifdef ECL_THREADS +# define AO_REQUIRE_CAS # ifdef ECL_LIBATOMIC_OPS_H # include # else From c01ae0d629e88377ebcda2377d62fa7309e7463a Mon Sep 17 00:00:00 2001 From: Daniel Kochmanski Date: Sun, 1 Feb 2015 13:13:22 +0100 Subject: [PATCH 3/6] configure: add -p option to mkdir. If build failed at first time (ie due to wrong configure options), second build was failing when trying to recreate some directories. Signed-off-by: Daniel Kochmanski --- src/configure | 2 +- src/configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configure b/src/configure index 56af8c418..75cfc6127 100755 --- a/src/configure +++ b/src/configure @@ -10814,4 +10814,4 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi -for i in $srcdir/c/*/; do mkdir c/`basename $i`; done +for i in $srcdir/c/*/; do mkdir -p c/`basename $i`; done diff --git a/src/configure.in b/src/configure.in index 3546e0891..f95130483 100644 --- a/src/configure.in +++ b/src/configure.in @@ -902,4 +902,4 @@ AC_CONFIG_FILES([ ]) AC_CONFIG_HEADERS([ecl/config.h:ecl/configpre.h]) # FIXME AC_OUTPUT -for i in $srcdir/c/*/; do mkdir c/`basename $i`; done +for i in $srcdir/c/*/; do mkdir -p c/`basename $i`; done From 57a1fd5f5584a43507ca84ec42672cd88911f28e Mon Sep 17 00:00:00 2001 From: Daniel Kochmanski Date: Sun, 1 Feb 2015 14:42:47 +0100 Subject: [PATCH 4/6] gmp: remove broken symlink src/gmp/compile to fix ctags generation. src/gmp/compile is broken symlink (not needed for compilation), which were breaking ctags generation. Removed it. Signed-off-by: Daniel Kochmanski --- src/gmp/compile | 1 - 1 file changed, 1 deletion(-) delete mode 120000 src/gmp/compile diff --git a/src/gmp/compile b/src/gmp/compile deleted file mode 120000 index e0ab062c8..000000000 --- a/src/gmp/compile +++ /dev/null @@ -1 +0,0 @@ -/usr/local/Cellar/automake/1.14/share/automake-1.14/compile \ No newline at end of file From 62c4e540bb5593982de24be6ef3f9ce8c9c8181c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Sat, 21 Feb 2015 19:56:09 +0100 Subject: [PATCH 5/6] Release: bump version to current date. --- msvc/Makefile | 4 ++-- src/configure | 18 +++++++++--------- src/configure.in | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/msvc/Makefile b/msvc/Makefile index 5c53816e8..4a639c65f 100755 --- a/msvc/Makefile +++ b/msvc/Makefile @@ -10,8 +10,8 @@ srcdir = ..\src SHORT_SITE_NAME = LONG_SITE_NAME = -ECL_VERSION = 13.4.1 -ECL_VERSION_NUMBER= 130401 +ECL_VERSION = 15.2.21 +ECL_VERSION_NUMBER= 150221 ARCHITECTURE = PENTIUM4 SOFTWARE_TYPE = NT SOFTWARE_VERSION = 5.0 diff --git a/src/configure b/src/configure index 75cfc6127..020675b3e 100755 --- a/src/configure +++ b/src/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ecl 13.5.1. +# Generated by GNU Autoconf 2.69 for ecl 15.2.21. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -578,8 +578,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ecl' PACKAGE_TARNAME='ecl' -PACKAGE_VERSION='13.5.1' -PACKAGE_STRING='ecl 13.5.1' +PACKAGE_VERSION='15.2.21' +PACKAGE_STRING='ecl 15.2.21' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1365,7 +1365,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ecl 13.5.1 to adapt to many kinds of systems. +\`configure' configures ecl 15.2.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1434,7 +1434,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ecl 13.5.1:";; + short | recursive ) echo "Configuration of ecl 15.2.21:";; esac cat <<\_ACEOF @@ -1611,7 +1611,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ecl configure 13.5.1 +ecl configure 15.2.21 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2198,7 +2198,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ecl $as_me 13.5.1, which was +It was created by ecl $as_me 15.2.21, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -10025,7 +10025,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ecl $as_me 13.5.1, which was +This file was extended by ecl $as_me 15.2.21, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10087,7 +10087,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ecl config.status 13.5.1 +ecl config.status 15.2.21 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/src/configure.in b/src/configure.in index f95130483..434da4904 100644 --- a/src/configure.in +++ b/src/configure.in @@ -8,7 +8,7 @@ dnl AUTOCONF configuration for ECL dnl Giuseppe Attardi 25.1.1994 dnl -AC_INIT([ecl],[13.5.1],[]) +AC_INIT([ecl],[15.2.21],[]) AC_REVISION([$Revision$]) AC_CONFIG_SRCDIR([bare.lsp.in]) AC_CONFIG_AUX_DIR([gmp]) From 040d643c502602dcd45dbc73245c6c63fb245735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Sat, 21 Feb 2015 20:35:51 +0100 Subject: [PATCH 6/6] Release: update ANNOUNCEMENT and update Copyrights. --- ANNOUNCEMENT | 15 +++++++++++++-- Copyright | 1 + src/lsp/top.lsp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ANNOUNCEMENT b/ANNOUNCEMENT index 723e0fe9e..374adbd77 100644 --- a/ANNOUNCEMENT +++ b/ANNOUNCEMENT @@ -35,9 +35,20 @@ Known issues quicklisp and have a C compiler accessible to ECL, you may use (ext:install-c-compiler) to switch back to the Lisp-to-C compiler. +Changes since 13.5.1 +==================== -Changes since last release -========================== +* Features coverity scan model, ffi-unload-module implementation, + probably more. + +* Build system + enhancements, parallel builds, fixes, simplifications, cleanups, + maintenance. minor cleanup, maintenance. + +* Numerous fixes + +Changes since 12.7.1 +==================== Some highlights of this release are: diff --git a/Copyright b/Copyright index 3a5d42c3e..e0527793b 100644 --- a/Copyright +++ b/Copyright @@ -1,5 +1,6 @@ ---- BEGINNING OF COPYRIGHT FOR THE ECL CORE ENVIRONMENT ------------ + Copyright (c) 2015, Daniel Kochmański Copyright (c) 2000, Juan Jose Garcia Ripoll Copyright (c) 1990, 1991, 1993 Giuseppe Attardi Copyright (c) 1984 Taiichi Yuasa and Masami Hagiya diff --git a/src/lsp/top.lsp b/src/lsp/top.lsp index 3e830a666..f71a7ef6e 100644 --- a/src/lsp/top.lsp +++ b/src/lsp/top.lsp @@ -402,6 +402,7 @@ The top-level loop of ECL. It is called by default when ECL is invoked." (format t "~%Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya~@ Copyright (C) 1993 Giuseppe Attardi~@ Copyright (C) 2000 Juan J. Garcia-Ripoll +Copyright (C) 2015 Daniel Kochmański ECL is free software, and you are welcome to redistribute it~@ under certain conditions; see file 'Copyright' for details.") (format *standard-output* "~%Type :h for Help. "))