feat: build userspace programs with the x86_64-montauk toolchain
Switch all program and library Makefiles from host g++ (or the bare-metal x86_64-elf compiler) to x86_64-montauk-g++/gcc and drop the flags the target now owns: -nostdinc + kernel freestanding -isystem paths, -m64/-march, -fno-PIC, -mno-red-zone, -mcmodel=small, -static, -Wl,-m,elf_x86_64, -z max-page-size, --build-id=none. Deliberate policy flags stay (-ffreestanding, per-app SSE, -nostdlib + link.ld). Program builds now require the montauk toolchain and fail with a pointer to build-montauk-toolchain.sh; lib/ and libs/ keep the host fallback since the toolchain script bootstraps libc through it. Userspace is also now pinned to the cross GCC instead of drifting with the distro compiler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
778f897f1a
commit
648f7111c0
60 files changed
+231
-744
No files matched your search
@@ -4,17 +4,17 @@
|
||||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
|
||||
TOOLCHAIN_PREFIX := $(shell cd ../../.. && pwd)/toolchain/local/bin/x86_64-elf-
|
||||
ifneq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
|
||||
TOOLCHAIN_PREFIX := $(shell cd ../../.. && pwd)/toolchain/local/bin/x86_64-montauk-
|
||||
ifeq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
|
||||
CC = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
||||
CXX = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
||||
LD = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
||||
STRIP = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
||||
else
|
||||
CC := $(TOOLCHAIN_PREFIX)gcc
|
||||
CXX := $(TOOLCHAIN_PREFIX)g++
|
||||
LD := $(TOOLCHAIN_PREFIX)ld
|
||||
STRIP := $(TOOLCHAIN_PREFIX)strip
|
||||
else
|
||||
CC := gcc
|
||||
CXX := g++
|
||||
LD := ld
|
||||
STRIP := strip
|
||||
endif
|
||||
|
||||
PROG_INC := ../../include
|
||||
@@ -31,7 +31,6 @@ CXXFLAGS := \
|
||||
-Wextra \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-unused-function \
|
||||
-nostdinc \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
@@ -41,19 +40,13 @@ CXXFLAGS := \
|
||||
-fno-exceptions \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-msse \
|
||||
-msse2 \
|
||||
-mno-red-zone \
|
||||
-mcmodel=small \
|
||||
-MMD -MP \
|
||||
-DGUI_DIALOGS_LIBRARY_BUILD \
|
||||
-I $(PROG_INC) \
|
||||
-isystem $(PROG_INC)/libc \
|
||||
-I ../../lib/bearssl/inc \
|
||||
-isystem ../../../kernel/freestnd-c-hdrs/x86_64/include \
|
||||
-isystem ../../../kernel/freestnd-cxx-hdrs/x86_64/include
|
||||
-I ../../lib/bearssl/inc
|
||||
|
||||
LDFLAGS := \
|
||||
-shared \
|
||||
@@ -62,15 +55,13 @@ LDFLAGS := \
|
||||
--hash-style=sysv \
|
||||
-u dialogs_run_request \
|
||||
-u dialogs_message_box \
|
||||
-m elf_x86_64 \
|
||||
-z max-page-size=0x1000
|
||||
-m elf_x86_64
|
||||
|
||||
LIBC_CFLAGS := \
|
||||
-std=gnu11 \
|
||||
-g -O2 -pipe \
|
||||
-Wall \
|
||||
-Wno-unused-parameter \
|
||||
-nostdinc \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
@@ -78,12 +69,8 @@ LIBC_CFLAGS := \
|
||||
-fvisibility=hidden \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-msse \
|
||||
-msse2 \
|
||||
-mno-red-zone \
|
||||
-mcmodel=small \
|
||||
-isystem $(PROG_INC)/libc \
|
||||
-isystem $(GCC_INCLUDE)
|
||||
|
||||
|
||||
Reference in new issue
Block a user