/* * montauk.h * GCC target definitions for x86_64-montauk userspace * Copyright (c) 2026 Daniel Hammer * * Programs are static, non-PIE ET_EXEC images loaded by the kernel * ELF loader (kernel/src/Sched/ElfLoader.cpp) at their linked * address. The loader maps 4 KiB pages, so segments must not be * aligned to the 2 MiB x86-64 default. */ #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do { \ builtin_define("__montauk__"); \ builtin_define("__MONTAUK__"); \ builtin_assert("system=montauk"); \ } while (0) /* The userspace build convention is -mno-red-zone everywhere; keep it as the target default. A later -mred-zone on the command line still overrides this. */ #undef CC1_SPEC #define CC1_SPEC "-mno-red-zone" #undef LINK_SPEC #define LINK_SPEC \ "-m elf_x86_64 -z max-page-size=0x1000 %{shared:-shared} %{!shared:-static}" /* crt1/crti/crtn come from the Montauk libc (sysroot usr/lib); crtbegin/crtend are GCC's. crti/crtn are empty today (the runtime does not run global constructors yet) but are kept in the link so that enabling them later needs no toolchain change. */ #undef STARTFILE_SPEC #define STARTFILE_SPEC "crt1.o%s crti.o%s crtbegin.o%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend.o%s crtn.o%s" #undef LIB_SPEC #define LIB_SPEC "-lc"