On Tue, Aug 2, 2016 at 2:04 AM, Christian Mauderer <christian.maude...@embedded-brains.de> wrote: > Hello, > > I have a second waf problem beneath the one already discussed in the > other thread: Is it possible to do some object file manipulation before > linking? To be exact I would need to rename some of the sections in the > object files. > This might be one for a waf expert. I would try something like how IDL files are twice-processed https://waf.io/book/#_mixing_extensions_and_c_c_features
We had to do something like that to get the FilesystemImage generated, e.g. examples-v2.git/filesystem/fat_ramdisk/wscript. But I don't know if this is applicable to object files, since those have to be created first. You might be able to define a custom task to deal with .o files, or define a custom "link_task". > > If you want to stop reading, you can do it here. The following is only > some background Information why this is necessary: > > Currently I'm porting the user space tool pfctl to set up the firewall > pf to libbsd. For all initialized (zero or value) global or static > variables I basically use the following method: > > - put all variables into one named linker section > - save the section before calling the main > - restore the section after calling main > > I'll add a more detailed description for the method that I used to port > into the libbsd.txt as soon as I'm finished with the work. > > > I have made some changes that I was trying to upstream to FreeBSD. The > changes are quite similar to the ones for other programs: > > - Make const what can be const. > - Make global variables static if possible. > - Move some static variables out of function scope. > > I've suggested these changes on the FreeBSD mailing list here: > > https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049772.html > > The last one (moving the static variables out of the functions) was > necessary so I could easily add an attribute to the variables. Due to > the fact that it is not really an improvement, it has started some > discussion: > > https://lists.freebsd.org/pipermail/freebsd-hackers/2016-August/049821.html > > The method described there would not work for us. But we should be able > to rename some of the sections. Compared to my current method (adding an > attribute to every variable) this would make it simpler to update to a > newer version with some changed global variables. So it's worth a try. > > Kind regards, > > Christian Mauderer > > -- > -------------------------------------------- > embedded brains GmbH > Christian Mauderer > Dornierstr. 4 > D-82178 Puchheim > Germany > email: christian.maude...@embedded-brains.de > Phone: +49-89-18 94 741 - 18 > Fax: +49-89-18 94 741 - 08 > PGP: Public key available on request. > > Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel