Module: xenomai-jki
Branch: for-forge
Commit: a6e5d9695b54db835f9598f6e9f8252ac3c4a677
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=a6e5d9695b54db835f9598f6e9f8252ac3c4a677

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Feb  5 17:33:18 2016 +0100

boilerplate: Allow for enabling Xenomai only in shared libs

Normally, one builds shared libraries with Xenomai awareness by adding
--no-auto-init to xeno-config. This drops bootstrap.o from the linking
steps because - normally - the main application performs the
initialization.

However, if the main application is Xenomai-free and only dlopen() would
pull in Xenomai services via a shared library, we face two problems:

- bootstrap.o is not built with position-independence support

- libboilerplate contains __real_main that expects the main symbol which
  cannot be found from a shared library

This patch solves both issues.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 lib/boilerplate/init/Makefile.am |    1 +
 lib/boilerplate/wrappers.c       |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/boilerplate/init/Makefile.am b/lib/boilerplate/init/Makefile.am
index 7a58f54..8c09e28 100644
--- a/lib/boilerplate/init/Makefile.am
+++ b/lib/boilerplate/init/Makefile.am
@@ -4,6 +4,7 @@ libbootstrap_a_SOURCES = bootstrap.c
 
 libbootstrap_a_CPPFLAGS =              \
        @XENO_USER_CFLAGS@              \
+       -fPIC                           \
        -I$(top_srcdir)/include         \
        -I$(top_srcdir)/lib
 
diff --git a/lib/boilerplate/wrappers.c b/lib/boilerplate/wrappers.c
index 9d2490c..db8d5f7 100644
--- a/lib/boilerplate/wrappers.c
+++ b/lib/boilerplate/wrappers.c
@@ -17,7 +17,10 @@
  */
 #include <boilerplate/compiler.h>
 
-int main(int argc, char *const argv[]);
+__weak int main(int argc, char *const argv[])
+{
+       return 0;
+}
 
 int __real_main(int argc, char *const argv[]);
 


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

Reply via email to