From 9620f040cb9332573bb9d33e733de234f4007e26 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sat, 12 Feb 2022 15:00:50 -0800 Subject: [PATCH] [build] Build user programes with libc++ et al Adding -lc++ -lc++abi -lunwind to user programs. Also, to support this, start building using the custom toolchain and its new x86_64-jsix-elf target triplet. --- configs/base.yaml | 6 +++--- configs/kernel-debug.yaml | 5 ++++- configs/user-debug.yaml | 7 ++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/configs/base.yaml b/configs/base.yaml index 6750045..36fd0e1 100644 --- a/configs/base.yaml +++ b/configs/base.yaml @@ -1,8 +1,8 @@ --- variables: - cc: clang - cxx: clang++ - ld: ld.lld + cc: "${source_root}/sysroot/bin/clang" + cxx: "${source_root}/sysroot/bin/clang++" + ld: "${source_root}/sysroot/bin/ld.lld" ar: ar nasm: nasm objcopy: objcopy diff --git a/configs/kernel-debug.yaml b/configs/kernel-debug.yaml index 9360c5c..255f8d8 100644 --- a/configs/kernel-debug.yaml +++ b/configs/kernel-debug.yaml @@ -5,7 +5,9 @@ variables: asflags: [ "-I${source_root}/src/kernel/" ] ccflags: [ - "--target=x86_64-unknown-elf", + "--target=x86_64-jsix-elf", + "-fno-stack-protector", + "-I${source_root}/external", "-nostdinc", @@ -47,6 +49,7 @@ variables: "-g", "-nostdlib", "-Bstatic", + "--no-eh-frame-hdr", "-z", "norelro", "-z", "separate-code" ] diff --git a/configs/user-debug.yaml b/configs/user-debug.yaml index d9b56bd..8eb123b 100644 --- a/configs/user-debug.yaml +++ b/configs/user-debug.yaml @@ -5,8 +5,10 @@ variables: asflags: [ "-I${source_root}/src/kernel/" ] ccflags: [ + "--target=x86_64-jsix-elf", "-mno-sse", "-fno-omit-frame-pointer", + "-fno-stack-protector", "-g", @@ -30,5 +32,8 @@ variables: "-Bstatic", "--sysroot='${source_root}/sysroot'", "-L", "${source_root}/sysroot/lib", - "-z", "separate-code" ] + "-z", "separate-code", + "-lc++", "-lc++abi", "-lunwind", + "--no-dependent-libraries", + ]