From f62b05c93c6c539d899d2656c0638d404a036f1a Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 24 Jul 2025 12:28:23 +0000 Subject: x86_64: implement robust C++ global initialization Implement a comprehensive mechanism to ensure correct C++ runtime initialization before the kernel main function is called. This replaces the previous, incomplete reliance on an `_init` function. The new design robustly handles both legacy `.ctors` and modern `.init_array` initialization schemes used by the GNU toolchain. A single C++ function, `invoke_global_constructors`, now iterates through both arrays of function pointers to ensure all types of global initializers are executed. --- arch/x86_64/src/boot/crti.s | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 arch/x86_64/src/boot/crti.s (limited to 'arch/x86_64/src/boot/crti.s') diff --git a/arch/x86_64/src/boot/crti.s b/arch/x86_64/src/boot/crti.s deleted file mode 100644 index 26878fe..0000000 --- a/arch/x86_64/src/boot/crti.s +++ /dev/null @@ -1,13 +0,0 @@ -.code64 - -.section .init -.global _init -_init: - push %rbp - movq %rsp, %rbp - -.section .fini -.global _fini -_fini: - push %rbp - movq %rsp, %rbp -- cgit v1.2.3