Module: xenomai-3
Branch: wip/modechk
Commit: 60daa48dfb4c785c7efb166d41a83a161d5ab29a
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=60daa48dfb4c785c7efb166d41a83a161d5ab29a

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Mar 13 10:50:34 2017 +0100

scripts/xeno-config: cobalt: add --[no-]mode-check switch

These switches control whether xeno-config should emit the linker
flags interposing on a set of standard routines which may invoke
regular Linux system calls, triggering an assertion failure on entry
if the caller must switch to secondary mode.

For the assertion failure to trigger, PTHREAD_WARNSW must have been
set for the calling thread.

---

 doc/asciidoc/man1/xeno-config.adoc |   21 +++++++++++++++++++--
 scripts/xeno-config-cobalt.in      |   21 +++++++++++++++++----
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/doc/asciidoc/man1/xeno-config.adoc 
b/doc/asciidoc/man1/xeno-config.adoc
index 62ab888..14acc67 100644
--- a/doc/asciidoc/man1/xeno-config.adoc
+++ b/doc/asciidoc/man1/xeno-config.adoc
@@ -35,7 +35,7 @@ SYNOPSIS
 
 *xeno-config* *--version*
 
-*xeno-config* [*--cc*] [*--ccld*] [*--arch*] [*--prefix*] 
[*--posix|alchemy|rtdm|psos|vxworks|smokey*] [*--compat*] 
[*--auto-init*|*no-auto-init*] [*--auto-init-solib*] [*--cflags*] [*--ldflags*] 
[*--library-dir*|*--libdir*|*--user-libdir*]
+*xeno-config* [*--cc*] [*--ccld*] [*--arch*] [*--prefix*] 
[*--posix|alchemy|rtdm|psos|vxworks|smokey*] [*--compat*] 
[*--auto-init*|*no-auto-init*] [*--auto-init-solib*] 
[*--mode-check*|*no-mode-check*] [*--cflags*] [*--ldflags*] 
[*--library-dir*|*libdir*|*user-libdir*]
 
 DESCRIPTION
 ------------
@@ -130,6 +130,23 @@ This flag makes sense when passed along with --ldflags
 only. *xeno-config* enables the Copperplate auto-init feature by
 default.
 
+*--mode-check*::
+*--no-mode-check*::
+
+Over Cobalt, a set of standard routines which may invoke regular Linux
+system calls can trigger an assertion failure on entry, if the caller
+must leave the real-time mode (aka "secondary mode switch") to execute
+such routine.
+
+The assertion failure is triggered if the calling thread has set the
+PTHREAD_WARNSW flag by a call to +pthread_setmode_np()+.
+
+By default, the mode checking routines are substituted to the original
+ones using the symbol wrapping mechanism also used for interposing on
+POSIX services. *--no-mode-check* disables such substitution.
+
+These flags make sense when passed along with --ldflags only.
+
 *--auto-init-solib*::
 
 This switch enables the auto-initialization feature described above
@@ -140,7 +157,7 @@ used for bootstrapping the initialization.
 The bootstrap code runs when the shared library is attached to a
 running executable, either because it appears in the static
 dependencies of this executable, or when loaded dynamically via the
-dlopen() interface.
++dlopen()+ interface.
 
 *--core*::
 Output the name of the real-time core the current Xenomai installation
diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index c014176..82815e1 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -52,9 +52,10 @@ Options :
         --prefix
         --[skin=]posix|vxworks|psos|alchemy|rtdm|smokey|cobalt
         --auto-init|auto-init-solib|no-auto-init
+        --mode-check|no-mode-check
         --cflags
         --ldflags
-        --lib*-dir,--libdir,--user-libdir
+        --lib*-dir|libdir|user-libdir
         --core
         --info
         --compat
@@ -109,6 +110,7 @@ do_cflags=
 do_setinit=
 do_autoinit=y
 do_autoinit_solib=
+do_mode_check=y
 
 while test $# -gt 0; do
     case "$1" in
@@ -191,6 +193,12 @@ while test $# -gt 0; do
        --compat)
            compat=y
             ;;
+       --mode-check)
+           do_mode_check=y
+           ;;
+       --no-mode-check)
+           do_mode_check=
+           ;;
         *)
          usage 1 1>&2
          ;;
@@ -235,7 +243,10 @@ if test x$do_ldflags = xy; then
        echo "no API specified, missing --skin before --ldflags" 1>&2
        exit 1
     fi
-    ldflags="`dump_wrappers modechk.wrappers`"
+    ldflags=
+    if test x$do_mode_check = xy; then
+       ldflags="`dump_wrappers modechk.wrappers`"
+    fi
     test x$compat = xy && ldflags="-ltrank $ldflags"
     copperplate=
     for skin in $skin_list; do
@@ -244,8 +255,10 @@ if test x$do_ldflags = xy; then
                ldflags="`dump_wrappers cobalt.wrappers` $ldflags"
                ;;
            cobalt)
-               # do NOT wrap POSIX symbols in application code
-               # with --cobalt. On the contrary, --posix does.
+               # do NOT wrap POSIX symbols in application code with
+               # --cobalt. On the contrary, --posix does. This switch
+               # does not affect mode checking wrappers,
+               # --[no-]mode-check does.
                ;;
            vxworks|psos|alchemy|smokey)
                copperplate="-lcopperplate"


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to