/* * aarch64-montauk.h * GCC target definitions for aarch64-montauk userspace * (installed as gcc/config/aarch64/montauk.h) * 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 use * the 64 KiB AArch64 default alignment. */ #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do { \ builtin_define("__montauk__"); \ builtin_define("__MONTAUK__"); \ builtin_assert("system=montauk"); \ } while (0) /* Inline LL/SC atomics: outline atomics pick LSE at run time from HWCAP, which Montauk does not provide, and their helpers live in libgcc, which -nostdlib programs never link. Signed plain char, as on x86_64-montauk: the userspace is shared between the architectures and its CP1252 text handling assumes it. -moutline-atomics / -funsigned-char still override. */ #undef CC1_SPEC #define CC1_SPEC "%{!moutline-atomics:-mno-outline-atomics} %{!funsigned-char:-fsigned-char}" #undef LINK_SPEC #define LINK_SPEC \ "-maarch64elf -X -z max-page-size=0x1000 %{shared:-shared} %{!shared:-static}" /* As on x86_64-montauk: crt1/crti/crtn from the Montauk libc, crtbegin/crtend from libgcc. */ #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"