From 68db123a2f37a66aea218fa48a5bab8ea6b12951 Mon Sep 17 00:00:00 2001 From: "felix.morgner@ost.ch" Date: Sat, 7 Oct 2023 10:45:45 +0200 Subject: x86_64: implement first bootable kernel --- cmake/Platforms/x86_64.cmake | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmake/Platforms/x86_64.cmake (limited to 'cmake') diff --git a/cmake/Platforms/x86_64.cmake b/cmake/Platforms/x86_64.cmake new file mode 100644 index 0000000..9e727cf --- /dev/null +++ b/cmake/Platforms/x86_64.cmake @@ -0,0 +1,23 @@ +execute_process(COMMAND "x86_64-none-elf-g++" "-print-file-name=crtbegin.o" + OUTPUT_VARIABLE CRT_BEGIN + ERROR_QUIET +) +string(STRIP "${CRT_BEGIN}" CRT_BEGIN) +mark_as_advanced(CRT_BEGIN) + +string(REGEX REPLACE "/crtbegin.o" "" CMAKE_SYSROOT "${CRT_BEGIN}") +mark_as_advanced(CMAKE_SYSROOT) + +set(CMAKE_CXX_FLAGS_INIT "-m64 -mno-red-zone -mcmodel=large") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostartfiles") +set(CMAKE_CXX_LINK_EXECUTABLE + " \ + \ + \ + \ + ${CMAKE_SYSROOT}/crtbegin.o \ + \ + -o \ + \ + ${CMAKE_SYSROOT}/crtend.o" +) -- cgit v1.2.3