* [Xenomai] [PATCH 1/3] Revert "boilerplate/setup: introduce destructors for __setup_call"
2018-04-24 12:37 [Xenomai] [PATCH 0/3] dlopen testcase Henning Schild
@ 2018-04-24 12:37 ` Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 2/3] smokey/dlopen: fix testcase Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 3/3] build: link dlopen libs with "nodelete" Henning Schild
2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2018-04-24 12:37 UTC (permalink / raw)
To: Xenomai
In fact we would need real destructors for all setup_descriptor s. Stop
pretending that we know how to dlclose or destruct.
This reverts commit 5511e76040444af875ae1bb099c13a25b16336fc.
---
include/boilerplate/setup.h | 7 -------
lib/boilerplate/setup.c | 6 ------
2 files changed, 13 deletions(-)
diff --git a/include/boilerplate/setup.h b/include/boilerplate/setup.h
index 83af91f38..7df3cfecc 100644
--- a/include/boilerplate/setup.h
+++ b/include/boilerplate/setup.h
@@ -78,16 +78,10 @@ struct setup_descriptor {
#define __early_ctor __attribute__ ((constructor(210)))
#define __bootstrap_ctor __attribute__ ((constructor(220)))
-#define __setup_dtor __attribute__ ((destructor(200)))
-
#define __setup_call(__name, __id) \
static __setup_ctor void __declare_ ## __name(void) \
{ \
__register_setup_call(&(__name), __id); \
-} \
-static __setup_dtor void __undeclare_ ## __name(void) \
-{ \
- __unregister_setup_call(&(__name), __id); \
}
#define core_setup_call(__name) __setup_call(__name, 0)
@@ -102,7 +96,6 @@ extern "C" {
#endif
void __register_setup_call(struct setup_descriptor *p, int id);
-void __unregister_setup_call(struct setup_descriptor *p, int id);
extern pid_t __node_id;
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 2a6442726..8b363efee 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -701,12 +701,6 @@ void __register_setup_call(struct setup_descriptor *p, int id)
pvlist_prepend(&p->__reserved.next, &setup_list);
}
-void __unregister_setup_call(struct setup_descriptor *p, int id)
-{
- pvlist_remove(&p->__reserved.next);
-}
-
-
const char *get_program_name(void)
{
return basename(__base_setup_data.arg0 ?: "program");
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Xenomai] [PATCH 2/3] smokey/dlopen: fix testcase
2018-04-24 12:37 [Xenomai] [PATCH 0/3] dlopen testcase Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 1/3] Revert "boilerplate/setup: introduce destructors for __setup_call" Henning Schild
@ 2018-04-24 12:37 ` Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 3/3] build: link dlopen libs with "nodelete" Henning Schild
2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2018-04-24 12:37 UTC (permalink / raw)
To: Xenomai
The intention of another binary and fork/exec was to have a binary is
not a xenoami-binary already, to actually test dlopen.
Unfortunately a copy-paste mistake in Makefile.am resulted in dlopentest
being a xenomai application already. Therefore the dlopens tested
something they where not supposed to.
Change Makefile.am to make dlopentest a truly non-xenomai binary. And
change what it is testing accordingly. We do not support dlclose so do
not test it anymore.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
testsuite/smokey/dlopen/Makefile.am | 8 +-------
testsuite/smokey/dlopen/dlopentest.c | 9 ---------
testsuite/smokey/dlopen/libalchemy-test.c | 2 +-
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/testsuite/smokey/dlopen/Makefile.am b/testsuite/smokey/dlopen/Makefile.am
index 70390e589..db5a521d8 100644
--- a/testsuite/smokey/dlopen/Makefile.am
+++ b/testsuite/smokey/dlopen/Makefile.am
@@ -42,16 +42,10 @@ test_PROGRAMS = dlopentest
dlopentest_SOURCES = dlopentest.c
dlopentest_CPPFLAGS = \
- @XENO_USER_CFLAGS@ \
-Wno-format-security \
- -DXENO_TEST_DIR='"$(XENO_TEST_DIR)"' \
- -I$(top_srcdir)/include
-
-dlopentest_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
+ -DXENO_TEST_DIR='"$(XENO_TEST_DIR)"'
dlopentest_LDADD = \
- @XENO_CORE_LDADD@ \
- @XENO_USER_LDADD@ \
-ldl
noinst_LIBRARIES = libdlopen.a
diff --git a/testsuite/smokey/dlopen/dlopentest.c b/testsuite/smokey/dlopen/dlopentest.c
index 43f00e2c2..cbf9b74d8 100644
--- a/testsuite/smokey/dlopen/dlopentest.c
+++ b/testsuite/smokey/dlopen/dlopentest.c
@@ -75,14 +75,5 @@ int main(int argc, char *const argv[])
if (ret)
error(1, errno, "libposix_func: %s", strerror(-ret));
- if (dlclose(handlep))
- fprintf(stderr, "%s", dlerror());
- if (dlclose(handlea))
- fprintf(stderr, "%s", dlerror());
-
- setenv("XENO_TEST_DLOPEN_NO_INIT", "1", 1);
- ret = my_dlcall("libalchemy-test.so", "libalchemy_func", &handlea);
- assert(ret == ENOMEM);
-
return 0;
}
diff --git a/testsuite/smokey/dlopen/libalchemy-test.c b/testsuite/smokey/dlopen/libalchemy-test.c
index 4784e2b1d..3e1eb23ea 100644
--- a/testsuite/smokey/dlopen/libalchemy-test.c
+++ b/testsuite/smokey/dlopen/libalchemy-test.c
@@ -33,7 +33,7 @@ static size_t def_mem_pool_size = SIZE_MAX;
static int alchemy_tune(void)
{
- if (getenv("XENO_TEST_DLOPEN_NO_INIT") || ran_init)
+ if (ran_init)
return 0;
def_mem_pool_size = get_config_tunable(mem_pool_size);
set_config_tunable(mem_pool_size, 2*def_mem_pool_size);
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Xenomai] [PATCH 3/3] build: link dlopen libs with "nodelete"
2018-04-24 12:37 [Xenomai] [PATCH 0/3] dlopen testcase Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 1/3] Revert "boilerplate/setup: introduce destructors for __setup_call" Henning Schild
2018-04-24 12:37 ` [Xenomai] [PATCH 2/3] smokey/dlopen: fix testcase Henning Schild
@ 2018-04-24 12:37 ` Henning Schild
2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2018-04-24 12:37 UTC (permalink / raw)
To: Xenomai
This way a dlclose() will not unmap the libs memory anymore. A real
dlclose() will not work anyways because we lack destructors for all the
stuff we initialize in setup_descriptor->init().
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 82aea1e5a..4f9b1f928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -685,6 +685,7 @@ AC_MSG_RESULT(${CONFIG_XENO_LIBS_DLOPEN:-no})
if test x$CONFIG_XENO_LIBS_DLOPEN = xy; then
AC_DEFINE(CONFIG_XENO_LIBS_DLOPEN,1,[config])
AC_DEFINE_UNQUOTED(CONFIG_XENO_TLS_MODEL,"global-dynamic",[TLS model])
+ XENO_LIB_LDFLAGS="-Wl,-z -Wl,nodelete"
else
AC_DEFINE_UNQUOTED(CONFIG_XENO_TLS_MODEL,"initial-exec",[TLS model])
XENO_LIB_LDFLAGS="-Wl,-z -Wl,nodlopen"
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread