1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

Kernel+Toolchain: Use .init_array section for global constructors

Before this change, our dynamic linker's global constructor handler
relied on the GNU linker implicitly including the content of `.ctors`
section inside `.init_array`. The mold linker does not do this, so
global constructors would fail to be called in the mold-built userland.

There is no point in sticking to `.ctors`, as most other systems already
use the superior `.init_array` scheme. This commit changes the kernel
linker script to not discard this new section, and enables it by default
in our toolchain.
This commit is contained in:
Daniel Bertalan 2022-01-19 19:12:50 +01:00 committed by Brian Gianforcaro
parent eeb74e2578
commit 5576e9c4c5
3 changed files with 4 additions and 1 deletions

View file

@ -379,6 +379,7 @@ pushd "$DIR/Build/$ARCH"
--enable-default-pie \
--enable-lto \
--enable-threads=posix \
--enable-initfini-array \
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
echo "XXX build gcc and libgcc"