improve and provide a header for bootstrapping
Hello,
the following patches allow a variety of options additional to the linker magic involved for hijacking the aplications main function.
the original method will still continue to work, differences are
* the code dealing with retrieving the commandline arguments
is moved into libcobale/libmercury. Making the necessary per-application code much smaller.
* the implementation was moved into a header, with several macros
controlling functionality (not everyone wants to define a main function).
The approach I use personally is to compile and link my own bootstrap code, which is preferable in many build systems as source-files are understood while objects files generally need some special care. (And it cant hurt if the compiler flags match exactly).
As example:
----- add this to your file containing main
int xenomai_init_getargv(int *argc, char *const** argv);
int main(int argc, char *const argv[])
{
#if defined(__COBALT__) || defined(__MERCURY__)
xenomai_init_getargv(&argc, &argv);
#endif
....
}----- create another file, lets call it mybootstrap.c
#define _XENOMAI_BOOTSTRAP_GLIBC_CONSTRUCTORS
#include <xenomai/bootstrap-template.h>
----------------------------------------------
Norbert
[PATCH 1/2] separate bootstrap code to get commandline, move it into [PATCH 2/2] add a header to create flexible bootstrap code
PATCH 1/2 separate bootstrap code to get commandline, move it into library
to allow fallbacks, define a macro to indicate the function exists in the library
--- include/xenomai/init.h | 4 +++ lib/boilerplate/init/bootstrap.c | 48 ++++++++++++++++--------- lib/boilerplate/setup.c | 62 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 17 deletions(-)
include/xenomai/init.h +4 -0
@@ -25,6 +25,10 @@extern "C" {#endif +#define _XENOMAI_INIT_HASFETCHARGV + +int xenomai_init_fetchargv (int *argcp,char *const **argvp); +void xenomai_init (int *argcp,char *const **argvp);void xenomai_init_dso (int *argcp,char *const **argvp);
lib/boilerplate/init/bootstrap.c +31 -17
108 lines not on this page · raw message
lib/boilerplate/setup.c +62 -0
71 lines not on this page · raw message
--
2.19.1
PATCH 2/2 add a header to create flexible bootstrap code
In reply to Norbert LangeThe previously existing bootstrap objects
will be created by including said header.
The functionality is configurable with macros,
the minimum is an early constructor callingxenomai_init and a function to retrieve the
modified commandline arguments.
Further the functions and symbols can be created,
that will be needed for the ld wrapping trick
--- include/xenomai/Makefile.am | 7 +- include/xenomai/bootstrap-template.h | 274 +++++++++++++++++++++++++++ include/xenomai/init.h | 2 + lib/boilerplate/init/Makefile.am | 3 +- lib/boilerplate/init/bootstrap-pic.c | 2 + lib/boilerplate/init/bootstrap.c | 189 +----------------- 6 files changed, 286 insertions(+), 191 deletions(-) create mode 100644 include/xenomai/bootstrap-template.h create mode 100644 lib/boilerplate/init/bootstrap-pic.c
include/xenomai/Makefile.am +4 -3
@@ -1,6 +1,7 @@ includesubdir = $(includedir)/xenomai -includesub_HEADERS = \ - init.h \ - tunables.h \ +includesub_HEADERS = \ + bootstrap-template.h \ + init.h \ + tunables.h \ version.h
include/xenomai/bootstrap-template.h new file +274 -0
274 lines not on this page · raw message
include/xenomai/init.h +2 -0
@@ -29,6 +29,8 @@ extern "C" {int xenomai_init_fetchargv (int *argcp,char *const **argvp); +int xenomai_bootstrap_getargv (int *argc,char *const ** argv); +void xenomai_init (int *argcp,char *const **argvp);void xenomai_init_dso (int *argcp,char *const **argvp);
lib/boilerplate/init/Makefile.am +1 -2
@@ -9,10 +9,9 @@ libbootstrap_a_CPPFLAGS = \ noinst_LTLIBRARIES = libbootstrap-pic.la -libbootstrap_pic_la_SOURCES = bootstrap.c +libbootstrap_pic_la_SOURCES = bootstrap-pic.c libbootstrap_pic_la_CPPFLAGS = \ - -D__BOOTSTRAP_DSO__ \ @XENO_USER_CFLAGS@ \ -I$(top_srcdir)/include \ -I$(top_srcdir)/lib
lib/boilerplate/init/bootstrap-pic.c new file +2 -0
@@ -0,0 +1,2 @@ +#define _XENOMAI_BOOTSTRAP_DSO +#include <xenomai/bootstrap-template.h>
lib/boilerplate/init/bootstrap.c +3 -186
189 lines not on this page · raw message
--
2.19.1
Quoted 40 lines · Norbert Lange
Hello,
the following patches allow a variety of options additional to the linker magic involved for hijacking the aplications main function.
the original method will still continue to work, differences are
* the code dealing with retrieving the commandline arguments
is moved into libcobale/libmercury. Making the necessary per-application code much smaller.* the implementation was moved into a header, with several macros
controlling functionality (not everyone wants to define a main function).The approach I use personally is to compile and link my own bootstrap code, which is preferable in many build systems as source-files are understood while objects files generally need some special care. (And it cant hurt if the compiler flags match exactly).
As example:
----- add this to your file containing main
int
xenomai_init_getargv(int *argc, char *const** argv);int
main(int argc, char *const argv[])
{#if defined(__COBALT__) || defined(__MERCURY__) xenomai_init_getargv(&argc, &argv); #endif .... }----- create another file, lets call it
mybootstrap.c#define
_XENOMAI_BOOTSTRAP_GLIBC_CONSTRUCTORS
#include <xenomai/bootstrap-template.h>
Quoted 8 lines
----------------------------------------------
Norbert
[PATCH 1/2] separate bootstrap code to get commandline, move it into [PATCH 2/2] add a header to create flexible bootstrap code
I need to look more carefully at the details and your use case, but my first impression is that at least patch 2 is not very beautiful due to that large template header. Could you explain again why explicitly calling the bootstrap code in a library is not sufficient?
Also note that this pattern may make it harder to maintain a compatible interface along updates, increasing the risk of having to recompile your application, rather than just replacing some central library, when Xenomai changes.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Am Fr., 26. Okt. 2018 um 15:48 Uhr schrieb Jan Kiszka <[email protected]>:
Quoted 51 lines · Norbert Lange
Quoted 40 lines
Hello,
the following patches allow a variety of options additional to the linker magic involved for hijacking the aplications main function.
the original method will still continue to work, differences are
* the code dealing with retrieving the commandline arguments
is moved into libcobale/libmercury. Making the necessary per-application code much smaller.* the implementation was moved into a header, with several macros
controlling functionality (not everyone wants to define a main function).The approach I use personally is to compile and link my own bootstrap code, which is preferable in many build systems as source-files are understood while objects files generally need some special care. (And it cant hurt if the compiler flags match exactly).
As example:
----- add this to your file containing main
int
xenomai_init_getargv(int *argc, char *const** argv);int
main(int argc, char *const argv[])
{#if defined(__COBALT__) || defined(__MERCURY__) xenomai_init_getargv(&argc, &argv); #endif .... }----- create another file, lets call it
mybootstrap.c#define
_XENOMAI_BOOTSTRAP_GLIBC_CONSTRUCTORS
#include <xenomai/bootstrap-template.h>Quoted 8 lines
----------------------------------------------
Norbert
[PATCH 1/2] separate bootstrap code to get commandline, move it into [PATCH 2/2] add a header to create flexible bootstrap code
Quoted 4 lines
I need to look more carefully at the details and your use case, but my first impression is that at least patch 2 is not very beautiful due to that large template header. Could you explain again why explicitly calling the bootstrap code in a library is not sufficient?
Just so that we are on the same page, the bootstrap code thats generated looks like this
(in a couple variants):
----------------
#include <xenomai/init.h>
static int early_argc;
static char *const *early_argv;
int xenomai_bootstrap_getargv(int *argc, char *const** argv) {
if (early_argc)
{
*argc = early_argc;
*argv = early_argv;
return 1;
}
return 0;
}
__bootstrap_ctor static void xenomai_bootstrap(void) {
char *const *argv;
int argc;
if (xenomai_init_fetchargv(&argc, &argv) != 0) return;xenomai_init(&argc, &argv);early_argc = argc;early_argv = argv;
}
----------------------
I believe what you meant with bootstrap code is called with 'xenomai_init', and I dont plan to touch or replace that.
The code further replicates the code from lib/boilerplate/init/bootstrap.c, with the important difference, that you can chose not to define a main function and assorted wrappers (one of my main motivations is to disable/separate that).
Quoted 4 lines
Also note that this pattern may make it harder to maintain a compatible interface along updates, increasing the risk of having to recompile your application, rather than just replacing some central library, when Xenomai changes.
before Patch #2:
your-app --links-> lib/xenomai/bootstrap.o --calls->xenomai_init
after Patch #2 (and an optional variant):
your-app --contains-> include/xenomai/bootstrap-template.h --calls->xenomai_init
this means I need no precompiled object 'lib/xenomai/bootstrap.o', and the ABI to the libs has not changed.
You call a large header with functions not beautiful, I would call precompiled objects and the linker wrapping not beautiful. If we are pragmatic, with Patch #2 you can pick between 2 not beautiful solutions =)
Patch #1 is the one changing the ABI in a not BW-compatible manner (adds one function),
but Patch #2 arguably improves on that, as the .o objects from a compiler have no ABI stability guarantee whatsoever.
Further I can freely use no-pic/pic/pie and other ABI-changing settings, as there is no need to link a object
with potentially incompatible ABI (compiler,-version or settings).
Norbert
So any update on this.
Do you have something similar to patchwork to keep up on those loose email-threads?
Norbert
Quoted 119 lines
-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Norbert Lange
Sent: Freitag, 26. Oktober 2018 18:36
To: [email protected]
Cc: Xenomai <[email protected]>
Subject: Re: improve and provide a header for bootstrappingE-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
Am Fr., 26. Okt. 2018 um 15:48 Uhr schrieb Jan Kiszka <[email protected]>:
Quoted 11 lines · Norbert Lange
Quoted 9 lines
Hello,
the following patches allow a variety of options additional to the linker magic involved for hijacking the aplications main function.
the original method will still continue to work, differences are
* the code dealing with retrieving the commandline arguments
is moved into libcobale/libmercury. Making the necessary per-application
Quoted 4 lines
Quoted 4 lines
code much smaller.
* the implementation was moved into a header, with several macros
controlling functionality (not everyone wants to define a mainfunction).
Quoted 33 lines
Quoted 24 lines
The approach I use personally is to compile and link my own bootstrap code, which is preferable in many build systems as source-files are understood while objects files generally need some special care. (And it cant hurt if the compiler flags match exactly).
As example:
----- add this to your file containing main
int
xenomai_init_getargv(int *argc, char *const** argv);int
main(int argc, char *const argv[]){ #ifdefined(__COBALT__)||defined(__MERCURY__)
xenomai_init_getargv(&argc, &argv); #endif
....
}----- create another file, lets call it
mybootstrap.c#define
_XENOMAI_BOOTSTRAP_GLIBC_CONSTRUCTORS
#include <xenomai/bootstrap-template.h>Quoted 8 lines
----------------------------------------------
Norbert
[PATCH 1/2] separate bootstrap code to get commandline, move it into [PATCH 2/2] add a header to create flexible bootstrap code
Quoted 4 lines
I need to look more carefully at the details and your use case, but my first impression is that at least patch 2 is not very beautiful due to that large template header. Could you explain again why explicitly calling the bootstrap code in a library is not sufficient?
Just so that we are on the same page, the bootstrap code thats generated looks like this (in a couple variants):
----------------
#include <xenomai/init.h>static int
early_argc;
static char *const*early_argv;int
xenomai_bootstrap_getargv(int *argc, char *const** argv){ if (early_argc) { *argc =early_argc; *argv =early_argv; return 1; } return 0; }
__bootstrap_ctorstatic voidxenomai_bootstrap(void){ char *const *argv; int argc; if (xenomai_init_fetchargv(&argc, &argv)!= 0) return;xenomai_init(&argc, &argv);early_argc= argc;early_argv= argv; }
----------------------I believe what you meant with bootstrap code is called with '
xenomai_init', and I dont plan to touch or replace that.The code further replicates the code from
lib/boilerplate/init/bootstrap.c, with the important difference, that you can chose not to define a main function and assorted wrappers (one of my main motivations is to disable/separate that).Quoted 4 lines
Also note that this pattern may make it harder to maintain a compatible interface along updates, increasing the risk of having to recompile your application, rather than just replacing some central library,
when Xenomai changes.
before Patch #2:
your-app --links->lib/xenomai/bootstrap.o--calls->xenomai_initafter Patch #2 (and an optional variant):
your-app --contains->include/xenomai/bootstrap-template.h--calls->xenomai_initthis means I need no precompiled object '
lib/xenomai/bootstrap.o', and the ABI to the libs has not changed.You call a large header with functions not beautiful, I would call precompiled objects and the linker wrapping not beautiful.
If we are pragmatic, with Patch #2 you can pick between 2 not beautiful solutions =)Patch #1 is the one changing the ABI in a not BW-compatible manner (adds one function), but Patch #2 arguably improves on that, as the .o objects from a compiler have no ABI stability guarantee whatsoever.
Quoted 5 lines
Further I can freely use no-pic/pic/pie and other ABI-changing settings, as there is no need to link a object with potentially incompatible ABI (compiler,- version or settings).
Norbert
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
Quoted 3 lines · Lange Norbert
So any update on this.
Do you have something similar to patchwork to keep up on those loose email-threads?
This was less a patch tracking issue than the missing decision how to address the topic.
On the one hand, I see a desire to control bootstrapping in more details. On the other hand, I wonder how much *additional* control is practically needed - did you study --no-auto-init sufficiently? And I wonder how much new interfaces we want to open up that way.
Providing a user interface based on larger code templates does not make me feel comfortable at all. That's why I'm reluctant to move into that direction.
Philippe is busy these days, but maybe later he - as the original designer of this code - can comment on the envisioned use cases and potential limitations.
Jan
Quoted 148 lines
Quoted 119 lines
-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Norbert Lange
Sent: Freitag, 26. Oktober 2018 18:36
To: [email protected]
Cc: Xenomai <[email protected]>
Subject: Re: improve and provide a header for bootstrappingE-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
Am Fr., 26. Okt. 2018 um 15:48 Uhr schrieb Jan Kiszka <[email protected]>:
Quoted 11 lines · Norbert Lange
Quoted 9 lines
Hello,
the following patches allow a variety of options additional to the linker magic involved for hijacking the aplications main function.
the original method will still continue to work, differences are
* the code dealing with retrieving the commandline arguments
is moved into libcobale/libmercury. Making the necessary per-application
Quoted 4 lines
Quoted 4 lines
code much smaller.
* the implementation was moved into a header, with several macros
controlling functionality (not everyone wants to define a mainfunction).
Quoted 33 lines
Quoted 24 lines
The approach I use personally is to compile and link my own bootstrap code, which is preferable in many build systems as source-files are understood while objects files generally need some special care. (And it cant hurt if the compiler flags match exactly).
As example:
----- add this to your file containing main
int
xenomai_init_getargv(int *argc, char *const** argv);int
main(int argc, char *const argv[]){ #ifdefined(__COBALT__)||defined(__MERCURY__)
xenomai_init_getargv(&argc, &argv); #endif
....
}----- create another file, lets call it
mybootstrap.c#define
_XENOMAI_BOOTSTRAP_GLIBC_CONSTRUCTORS
#include <xenomai/bootstrap-template.h>Quoted 8 lines
----------------------------------------------
Norbert
[PATCH 1/2] separate bootstrap code to get commandline, move it into [PATCH 2/2] add a header to create flexible bootstrap code
Quoted 4 lines
I need to look more carefully at the details and your use case, but my first impression is that at least patch 2 is not very beautiful due to that large template header. Could you explain again why explicitly calling the bootstrap code in a library is not sufficient?
Just so that we are on the same page, the bootstrap code thats generated looks like this (in a couple variants):
----------------
#include <xenomai/init.h>static int
early_argc;
static char *const*early_argv;int
xenomai_bootstrap_getargv(int *argc, char *const** argv){ if (early_argc) { *argc =early_argc; *argv =early_argv; return 1; } return 0; }
__bootstrap_ctorstatic voidxenomai_bootstrap(void){ char *const *argv; int argc; if (xenomai_init_fetchargv(&argc, &argv)!= 0) return;xenomai_init(&argc, &argv);early_argc= argc;early_argv= argv; }
----------------------I believe what you meant with bootstrap code is called with '
xenomai_init', and I dont plan to touch or replace that.The code further replicates the code from
lib/boilerplate/init/bootstrap.c, with the important difference, that you can chose not to define a main function and assorted wrappers (one of my main motivations is to disable/separate that).Quoted 4 lines
Also note that this pattern may make it harder to maintain a compatible interface along updates, increasing the risk of having to recompile your application, rather than just replacing some central library,
when Xenomai changes.
before Patch #2:
your-app --links->lib/xenomai/bootstrap.o--calls->xenomai_initafter Patch #2 (and an optional variant):
your-app --contains->include/xenomai/bootstrap-template.h--calls->xenomai_initthis means I need no precompiled object '
lib/xenomai/bootstrap.o', and the ABI to the libs has not changed.You call a large header with functions not beautiful, I would call precompiled objects and the linker wrapping not beautiful.
If we are pragmatic, with Patch #2 you can pick between 2 not beautiful solutions =)Patch #1 is the one changing the ABI in a not BW-compatible manner (adds one function), but Patch #2 arguably improves on that, as the .o objects from a compiler have no ABI stability guarantee whatsoever.
Quoted 5 lines
Further I can freely use no-pic/pic/pie and other ABI-changing settings, as there is no need to link a object with potentially incompatible ABI (compiler,- version or settings).
Norbert
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 15 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Dienstag, 4. Dezember 2018 17:30
To: Lange Norbert <[email protected]>
Cc: Xenomai <[email protected]>; Philippe Gerum <[email protected]>
Subject: Re: improve and provide a header for bootstrappingE-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
Quoted 8 lines
Quoted 2 lines · Lange Norbert
So any update on this.
Do you have something similar to patchwork to keep up on those looseemail-threads?
Quoted 1 line
This was less a patch tracking issue than the missing decision how to address the topic.
I understand that, but there is still a lack of feedback. (And I already brought that topic up some months ago, so there is some redundancy explaining it again).
Quoted 4 lines
On the one hand, I see a desire to control bootstrapping in more details. On the other hand, I wonder how much *additional* control is practically needed - did you study --no-auto-init sufficiently? And I wonder how much new interfaces we want to open up that way.
Yes I know --no-auto-init, but that’s only one side of the story. What are you doing in place of auto-init?
To me, the most sensible approach is to place building blocks in the xenomai Headers and libraries.
* parsing of the commandline args got moved from the bootstrap (lib/boilerplate/init/bootstrap.c)
to the DSO. Don’t want to replicate this everywhere
* the setup code from bootstrapping is separated from the main wrapping magic (currently this is either both or none)
That’s currently done with a header, as quite frankly proving object code does not scale well with compilerflags and options.
What I generally want is to easily add the setup code into an application, while avoiding the additional wrapping magic. The cause of action is either to do everything myself or try to modulize the upstream bootstrapping.
In terms of external interfaces, only 'xenomai_init_fetchargv' would be added to libcobalt/libmercury. A second function 'xenomai_bootstrap_getargv' is defined by the bootstrapping code, to be consumed by the application (or can be ignored).
Quoted 7 lines
Providing a user interface based on larger code templates does not make me feel comfortable at all. That's why I'm reluctant to move into that direction.
Philippe is busy these days, but maybe later he - as the original designer of this code - can comment on the envisioned use cases and potential limitations.
Norbert
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
Quoted 18 lines · Lange Norbert
Quoted 18 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Dienstag, 4. Dezember 2018 17:30
To: Lange Norbert <[email protected]>
Cc: Xenomai <[email protected]>; Philippe Gerum <[email protected]>
Subject: Re: improve and provide a header for bootstrappingE-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
Quoted 2 lines · Lange Norbert
So any update on this.
Do you have something similar to patchwork to keep up on those loose
Quoted 8 lines
Quoted 5 lines
email-threads?
Quoted 1 line
This was less a patch tracking issue than the missing decision how to address the topic.
I understand that, but there is still a lack of feedback. (And I already brought that topic up some months ago, so there is some redundancy explaining it again).
Just saw your first round from April which didn't get any feedback at all - not optimal, I agree.
Quoted 8 lines
Quoted 5 lines
On the one hand, I see a desire to control bootstrapping in more details. On the other hand, I wonder how much *additional* control is practically needed - did you study --no-auto-init sufficiently? And I wonder how much new interfaces we want to open up that way.
Yes I know --no-auto-init, but that’s only one side of the story. What are you doing in place of auto-init?
Call xenomai_init() - or what are you missing then?
Quoted 5 lines
To me, the most sensible approach is to place building blocks in the xenomai Headers and libraries.
* parsing of the commandline args got moved from the bootstrap (
lib/boilerplate/init/bootstrap.c)
to the DSO. Don’t want to replicate this everywhere
Are you using command line parameters to tune the Xenomai core?
Quoted 9 lines
* the setup code from bootstrapping is separated from the main wrapping magic (currently this is either both or none)
That’s currently done with a header, as quite frankly proving object code does not scale well with compilerflags and options.What I generally want is to easily add the setup code into an application, while avoiding the additional wrapping magic. The cause of action is either to do everything myself or try to modulize the upstream bootstrapping.
In terms of external interfaces, only '
xenomai_init_fetchargv' would be added to libcobalt/libmercury. A second function 'xenomai_bootstrap_getargv' is defined by the bootstrapping code, to be consumed by the application (or can be ignored).
In fact, the other reason I'm reluctant to create new interfaces here is that I don't believe hooking into the command line of the main process is a good interface for a library like Xenomai in the first place. We had problems with that before, and I would rather like to think about moving away from it. Without all that parameter parsing, xenomai_init would take void as arguments, and we had no need for moving code around here.
A better interface for Xenomai would actually be prefixed (e.g. "XENO_") environment variables, because they do not interfere with the process' command line and can be picked up or even modified without much effort at any point between application start and xenomai initialization.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 41 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Dienstag, 4. Dezember 2018 18:59
To: Lange Norbert <[email protected]>
Cc: Xenomai <[email protected]>; Philippe Gerum <[email protected]>
Subject: Re: improve and provide a header for bootstrappingE-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
Quoted 7 lines · Lange Norbert
Quoted 7 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Dienstag, 4. Dezember 2018 17:30
To: Lange Norbert <[email protected]>
Cc: Xenomai <[email protected]>; Philippe GerumQuoted 3 lines
Quoted 3 lines
Subject: Re: improve and provide a header for bootstrapping
E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE,
PLEASE
Quoted 1 line
Quoted 1 line
EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR
ATTACHMENTS.
Quoted 11 lines
Quoted 10 lines · Lange Norbert
Quoted 2 lines
So any update on this.
Do you have something similar to patchwork to keep up on those looseemail-threads?
Quoted 1 line
This was less a patch tracking issue than the missing decision how to address the topic.
Quoted 6 lines
Quoted 2 lines
I understand that, but there is still a lack of feedback. (And I already brought that topic up some months ago, so there is some
redundancy explaining it again).
Just saw your first round from April which didn't get any feedback at all - not optimal, I agree.
Some public issue tracker would be badly needed IMHO
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
On the one hand, I see a desire to control bootstrapping in more details. On the other hand, I wonder how much *additional* control is practically needed - did you study --no-auto-init sufficiently? And I wonder how much new interfaces we want to open up that way.
Yes I know --no-auto-init, but that’s only one side of the story. What are you doing in place of auto-init?
Call
xenomai_init()- or what are you missing then?
Call it when from where? If its called manually from main, then you must not use xenomai from "constructor" functions (global C++ object initializers). And its slightly different for DSOs.
What I would want is a template for this, like aa minimum:
__bootstrap_ctor static void xenomai_bootstrap(void) {
#ifdef _XENOMAI_BOOTSTRAP_DSO
xenomai_init_dso(...);
#else
xenomai_init(....);#endif
}
__bootstrap_ctor, xenomai_init_dso, xenomai_init all are interface details, that would fit best in an upstream header.
Quoted 9 lines
Quoted 5 lines
To me, the most sensible approach is to place building blocks in the xenomai Headers and libraries.
* parsing of the commandline args got moved from the bootstrap
(
lib/boilerplate/init/bootstrap.c)Quoted 1 line
to the DSO. Don’t want to replicate this everywhere
Are you using command line paramete - main funtionrs to tune the Xenomai core?
No, and *I* don’t want to. The larger context is https://github.com/nolange/cmake_xenomai/tree/master/patchset,
I would want to have CMake support, which should include the existing usecases.
The aim would be to have CMake automatically use the right bootstrap method, And be agnostic to compiler settings (means I would want to compile the boostrap code identical to the rest of the application).
Quoted 16 lines
Quoted 2 lines
* the setup code from bootstrapping is separated from the main wrapping
magic (currently this is either both or none)
Quoted 1 line
That’s currently done with a header, as quite frankly proving object code
does not scale well with compilerflags and options.
Quoted 2 lines
What I generally want is to easily add the setup code into an application,
while avoiding the additional wrapping magic.
Quoted 1 line
The cause of action is either to do everything myself or try to modulize the
upstream bootstrapping.
Quoted 2 lines
In terms of external interfaces, only '
xenomai_init_fetchargv' would beadded to libcobalt/libmercury.
Quoted 2 lines
A second function '
xenomai_bootstrap_getargv' is defined by the bootstrapping code, to be consumed by the application (or can be ignored).
Quoted 6 lines
In fact, the other reason I'm reluctant to create new interfaces here is that I don't believe hooking into the command line of the main process is a good interface for a library like Xenomai in the first place. We had problems with that before, and I would rather like to think about moving away from it. Without all that parameter parsing,
xenomai_initwould take void as arguments, and we had no need for moving code around here.
How about backwards compatibility (otherwise I agree)? I was trying to stay 100% compatible with the old approach while allowing modifications.
Quoted 5 lines
A better interface for Xenomai would actually be prefixed (e.g. "
XENO_") environment variables, because they do not interfere with the process' command line and can be picked up or even modified without much effort at any point between application start and xenomai initialization.
Env variables are kinda invisible for the user though, and I would not want to tweak parameters (or be able to) outside of development.
What about ripping out every automatism and make this explicit? Ie.xenomai_init taking an array of tuneable parameters.
The app can then decide where it fetches those parameter from,
Some (MIT-licensed) template functions could be available in Xenomai. That way you don’t add any technological debt to the interface.
(I would prefer these to be installed as source, and compiled with applications.)
A nice solution would be libraries you can LD_PRELOAD, which intercept The xenomai_init call to add parameters
Norbert
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________