From 7fb3d6c42c786d0b7691fd5747bc859b9f15b08e Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 12 Jan 2022 10:05:32 +0500 Subject: [PATCH] Use vendored cross-compiler --- config/i386 | 16 +++++++++++++++- config/x86_64 | 16 +++++++++++++++- examples/kernel-multiboot2-grub/Makefile | 2 +- examples/kernel-multiboot2-limine/Makefile | 2 +- examples/kernel-stivale2-limine/Makefile | 2 +- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/config/i386 b/config/i386 index adb8843..2f75b37 100755 --- a/config/i386 +++ b/config/i386 @@ -1,3 +1,17 @@ #!/bin/sh -exec ./configure --host='i386-elf' --enable-assert --enable-guard --with-libc AR=`which i386-elf-ar` CC=`which i386-elf-gcc` RANLIB=`which i386-elf-ranlib` CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector' +set -e + +ARCH='i386' +HOST="$ARCH-elf" +REPO="$(pwd)" +PREFIX="$REPO/vendor/cross" +BIN="$PREFIX/bin" + +export AR="$BIN/$HOST-ar" +export CC="$BIN/$HOST-gcc" +export RANLIB="$BIN/$HOST-ranlib" + +export CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector' + +./configure --host="$HOST" --enable-assert --enable-guard --with-libc diff --git a/config/x86_64 b/config/x86_64 index 77e5e42..452a36e 100755 --- a/config/x86_64 +++ b/config/x86_64 @@ -1,3 +1,17 @@ #!/bin/sh -exec ./configure --host='x86_64-elf' --enable-assert --enable-guard --with-libc AR=`which x86_64-elf-ar` CC=`which x86_64-elf-gcc` RANLIB=`which x86_64-elf-ranlib` CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector' +set -e + +ARCH='x86_64' +HOST="$ARCH-elf" +REPO="$(pwd)" +PREFIX="$REPO/vendor/cross" +BIN="$PREFIX/bin" + +export AR="$BIN/$HOST-ar" +export CC="$BIN/$HOST-gcc" +export RANLIB="$BIN/$HOST-ranlib" + +export CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector' + +./configure --host="$HOST" --enable-assert --enable-guard --with-libc diff --git a/examples/kernel-multiboot2-grub/Makefile b/examples/kernel-multiboot2-grub/Makefile index aaeae20..3b429ae 100644 --- a/examples/kernel-multiboot2-grub/Makefile +++ b/examples/kernel-multiboot2-grub/Makefile @@ -1,6 +1,6 @@ all: run -CCPREFIX = i386-elf- +CCPREFIX = ../../vendor/cross/bin/i386-elf- AS = $(CCPREFIX)as CC = $(CCPREFIX)gcc diff --git a/examples/kernel-multiboot2-limine/Makefile b/examples/kernel-multiboot2-limine/Makefile index b265645..9826e1e 100644 --- a/examples/kernel-multiboot2-limine/Makefile +++ b/examples/kernel-multiboot2-limine/Makefile @@ -1,6 +1,6 @@ all: run -CCPREFIX = i386-elf- +CCPREFIX = ../../vendor/cross/bin/i386-elf- AS = $(CCPREFIX)as CC = $(CCPREFIX)gcc diff --git a/examples/kernel-stivale2-limine/Makefile b/examples/kernel-stivale2-limine/Makefile index 0484313..3cfe350 100644 --- a/examples/kernel-stivale2-limine/Makefile +++ b/examples/kernel-stivale2-limine/Makefile @@ -1,6 +1,6 @@ all: run -CCPREFIX = x86_64-elf- +CCPREFIX = ../../vendor/cross/bin/x86_64-elf- AS = $(CCPREFIX)as CC = $(CCPREFIX)gcc