* [Xenomai-core] [PATCH] Mark libs with nodlopen when using initial-exec TLS
@ 2008-11-21 10:24 Jan Kiszka
2008-11-21 10:42 ` Gilles Chanteperdrix
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2008-11-21 10:24 UTC (permalink / raw)
To: xenomai-core
Some naive optimist once claim that the dynamic linker would detect if
we try to dlopen some Xenomai lib (directly or indirectly) which uses
the optimised initial-exec TLS variables. He was wrong of course. It
takes the special marker nodlopen to achieve this, and that's what the
patch below does when and where required.
Jan
---
ChangeLog | 3 +++
configure.in | 3 +++
src/skins/native/Makefile.am | 2 +-
src/skins/posix/Makefile.am | 2 +-
src/skins/psos+/Makefile.am | 2 +-
src/skins/rtai/Makefile.am | 2 +-
src/skins/rtdm/Makefile.am | 2 +-
src/skins/uitron/Makefile.am | 2 +-
src/skins/vrtx/Makefile.am | 2 +-
src/skins/vxworks/Makefile.am | 2 +-
10 files changed, 14 insertions(+), 8 deletions(-)
Index: xenomai/configure.in
===================================================================
--- xenomai.orig/configure.in
+++ xenomai/configure.in
@@ -762,6 +762,7 @@ LIBS="$LIBS -lrt"
AC_CHECK_FUNCS([shm_open shm_unlink])
LIBS="$save_LIBS"
+XENO_DLOPEN_CONSTRAINT=
AC_ARG_WITH([__thread],
AC_HELP_STRING([--without-__thread],
[do not use TLS features (allows for dlopen'ing Xenomai libs)]),
@@ -782,6 +783,7 @@ EOF
rm -f conftest*])
if test "$libc_cv_gcc___thread" = yes; then
AC_DEFINE(HAVE___THREAD,1,[config])
+ XENO_DLOPEN_CONSTRAINT="-Wl,-z -Wl,nodlopen"
fi
fi
@@ -803,6 +805,7 @@ AC_SUBST(XENO_USER_CFLAGS)
AC_SUBST(XENO_USER_LDFLAGS)
AC_SUBST(XENO_USER_APP_CFLAGS)
AC_SUBST(XENO_USER_APP_LDFLAGS)
+AC_SUBST(XENO_DLOPEN_CONSTRAINT)
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
['$(top_srcdir)/src/skins/posix/posix.wrappers'])
AC_SUBST(XENO_POSIX_WRAPPERS)
Index: xenomai/src/skins/native/Makefile.am
===================================================================
--- xenomai.orig/src/skins/native/Makefile.am
+++ xenomai/src/skins/native/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libnative.la
-libnative_la_LDFLAGS = -version-info 3:0:0 -lpthread
+libnative_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 3:0:0 -lpthread
libnative_la_SOURCES = \
alarm.c \
Index: xenomai/src/skins/posix/Makefile.am
===================================================================
--- xenomai.orig/src/skins/posix/Makefile.am
+++ xenomai/src/skins/posix/Makefile.am
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = libpthread_rt.la
CPPFLAGS+=-I$(top_srcdir)/ksrc/skins
-libpthread_rt_la_LDFLAGS = -version-info 1:0:0 -lpthread
+libpthread_rt_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 1:0:0 -lpthread
libpthread_rt_la_SOURCES = \
init.c \
Index: xenomai/src/skins/psos+/Makefile.am
===================================================================
--- xenomai.orig/src/skins/psos+/Makefile.am
+++ xenomai/src/skins/psos+/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libpsos.la
-libpsos_la_LDFLAGS = -version-info 0:0:0 -lpthread
+libpsos_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0 -lpthread
libpsos_la_SOURCES = \
asr.c \
Index: xenomai/src/skins/rtai/Makefile.am
===================================================================
--- xenomai.orig/src/skins/rtai/Makefile.am
+++ xenomai/src/skins/rtai/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = librtai.la
-librtai_la_LDFLAGS = -version-info 0:0:0
+librtai_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0
librtai_la_SOURCES = init.c \
shm.c
Index: xenomai/src/skins/rtdm/Makefile.am
===================================================================
--- xenomai.orig/src/skins/rtdm/Makefile.am
+++ xenomai/src/skins/rtdm/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = librtdm.la
-librtdm_la_LDFLAGS = -version-info 1:0:0 -lpthread
+librtdm_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 1:0:0 -lpthread
librtdm_la_SOURCES = \
core.c \
Index: xenomai/src/skins/uitron/Makefile.am
===================================================================
--- xenomai.orig/src/skins/uitron/Makefile.am
+++ xenomai/src/skins/uitron/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libuitron.la
-libuitron_la_LDFLAGS = -version-info 0:0:0 -lpthread
+libuitron_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0 -lpthread
libuitron_la_SOURCES = \
flag.c \
Index: xenomai/src/skins/vrtx/Makefile.am
===================================================================
--- xenomai.orig/src/skins/vrtx/Makefile.am
+++ xenomai/src/skins/vrtx/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libvrtx.la
-libvrtx_la_LDFLAGS = -version-info 0:0:0 -lpthread
+libvrtx_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0 -lpthread
libvrtx_la_SOURCES = \
event.c \
Index: xenomai/src/skins/vxworks/Makefile.am
===================================================================
--- xenomai.orig/src/skins/vxworks/Makefile.am
+++ xenomai/src/skins/vxworks/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libvxworks.la
-libvxworks_la_LDFLAGS = -version-info 1:0:0 -lpthread
+libvxworks_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 1:0:0 -lpthread
libvxworks_la_SOURCES = \
errnoLib.c \
Index: xenomai/ChangeLog
===================================================================
--- xenomai.orig/ChangeLog
+++ xenomai/ChangeLog
@@ -1,5 +1,8 @@
2008-11-21 Jan Kiszka <jan.kiszka@domain.hid>
+ * configure.in, src/skins/*/Makefile.am: Mark libs with nodlopen
+ if initial-exec __thread variables are used.
+
* ksrc/nucleus/shadow.c (xnshadow_map): Reject already mapped
tasks with -EBUSY.
--
Siemens AG, Corporate Technology, CT SE 2 ES-OS
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] [PATCH] Mark libs with nodlopen when using initial-exec TLS
2008-11-21 10:24 [Xenomai-core] [PATCH] Mark libs with nodlopen when using initial-exec TLS Jan Kiszka
@ 2008-11-21 10:42 ` Gilles Chanteperdrix
2008-11-21 11:49 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2008-11-21 10:42 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
Jan Kiszka wrote:
> Some naive optimist once claim that the dynamic linker would detect if
> we try to dlopen some Xenomai lib (directly or indirectly) which uses
> the optimised initial-exec TLS variables. He was wrong of course. It
> takes the special marker nodlopen to achieve this, and that's what the
> patch below does when and where required.
Ok. But I think we should document somewhere the fact that dlopening
Xenomai libs will not work because of __thread.
--
Gilles.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] [PATCH] Mark libs with nodlopen when using initial-exec TLS
2008-11-21 10:42 ` Gilles Chanteperdrix
@ 2008-11-21 11:49 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2008-11-21 11:49 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Some naive optimist once claim that the dynamic linker would detect if
>> we try to dlopen some Xenomai lib (directly or indirectly) which uses
>> the optimised initial-exec TLS variables. He was wrong of course. It
>> takes the special marker nodlopen to achieve this, and that's what the
>> patch below does when and where required.
>
> Ok. But I think we should document somewhere the fact that dlopening
> Xenomai libs will not work because of __thread.
There will be a follow-up on this soon, because dlopen causes more
problems, namely to the POSIX skin.
Jan
--
Siemens AG, Corporate Technology, CT SE 2 ES-OS
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-21 11:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 10:24 [Xenomai-core] [PATCH] Mark libs with nodlopen when using initial-exec TLS Jan Kiszka
2008-11-21 10:42 ` Gilles Chanteperdrix
2008-11-21 11:49 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.