tools/nolibc: add support for constructors and destructors
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 5 Oct 2023 16:17:29 +0000 (18:17 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Thu, 12 Oct 2023 19:14:16 +0000 (21:14 +0200)
commit63aa531716268f22f0a60fbb65c005494dcde387
treeea27f9c9b7df0f3c361a291b9bd902ea7c499e43
parenteddfc3c74214a7e6f4a3e56ad0cf5dab5d23f287
tools/nolibc: add support for constructors and destructors

With the startup code moved to C, implementing support for
constructors and deconstructors is fairly easy to implement.

Examples for code size impact:

   text    data     bss     dec     hex filename
  21837     104      88   22029    560d nolibc-test.before
  22135     120      88   22343    5747 nolibc-test.after
  21970     104      88   22162    5692 nolibc-test.after-only-crt.h-changes

The sections are defined by [0].

[0] https://refspecs.linuxfoundation.org/elf/gabi4+/ch5.dynamic.html

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/lkml/20231007-nolibc-constructors-v2-1-ef84693efbc1@weissschuh.net/
tools/include/nolibc/crt.h
tools/testing/selftests/nolibc/nolibc-test.c