Update kernel and makefiles to enable use of GS segment
This commit is contained in:
parent
3a9f308db6
commit
b2b49fbd77
2
kernel
2
kernel
|
@ -1 +1 @@
|
||||||
Subproject commit ba330ffc9abdb07d59ca3c5b386f07e4fb26d870
|
Subproject commit f873fc7e1a20ac9a5630ec031a086903d2917792
|
12
mk/kernel.mk
12
mk/kernel.mk
|
@ -16,21 +16,21 @@ build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src
|
||||||
cd kernel && \
|
cd kernel && \
|
||||||
cargo rustc --lib --target=$(ROOT)/kernel/targets/$(KTARGET).json --release --features live -Z build-std=core,alloc -- -C soft-float -C debuginfo=2 -C lto --emit link=../$@
|
cargo rustc --lib --target=$(ROOT)/kernel/targets/$(KTARGET).json --release --features live -Z build-std=core,alloc -- -C soft-float -C debuginfo=2 -C lto --emit link=../$@
|
||||||
|
|
||||||
build/kernel: kernel/linkers/$(ARCH).ld build/libkernel.a
|
build/kernel: kernel/linkers/$(ARCH).ld mk/kernel_ld.sh build/libkernel.a
|
||||||
export PATH="$(PREFIX_PATH):$$PATH" && \
|
export PATH="$(PREFIX_PATH):$$PATH" && \
|
||||||
$(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel.a && \
|
$(ROOT)/mk/kernel_ld.sh $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel.a && \
|
||||||
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
||||||
$(OBJCOPY) --strip-debug $@
|
$(OBJCOPY) --strip-debug $@
|
||||||
|
|
||||||
build/kernel_coreboot: kernel/linkers/$(ARCH).ld build/libkernel_coreboot.a build/live.o
|
build/kernel_coreboot: kernel/linkers/$(ARCH).ld mk/kernel_ld.sh build/libkernel_coreboot.a build/live.o
|
||||||
export PATH="$(PREFIX_PATH):$$PATH" && \
|
export PATH="$(PREFIX_PATH):$$PATH" && \
|
||||||
$(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_coreboot.a build/live.o && \
|
$(ROOT)/mk/kernel_ld.sh $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_coreboot.a build/live.o && \
|
||||||
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
||||||
$(OBJCOPY) --strip-debug $@
|
$(OBJCOPY) --strip-debug $@
|
||||||
|
|
||||||
build/kernel_live: kernel/linkers/$(ARCH).ld build/libkernel_live.a build/live.o
|
build/kernel_live: kernel/linkers/$(ARCH).ld mk/kernel_ld.sh build/libkernel_live.a build/live.o
|
||||||
export PATH="$(PREFIX_PATH):$$PATH" && \
|
export PATH="$(PREFIX_PATH):$$PATH" && \
|
||||||
$(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_live.a build/live.o && \
|
$(ROOT)/mk/kernel_ld.sh $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_live.a build/live.o && \
|
||||||
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
$(OBJCOPY) --only-keep-debug $@ $@.sym && \
|
||||||
$(OBJCOPY) --strip-debug $@
|
$(OBJCOPY) --strip-debug $@
|
||||||
|
|
||||||
|
|
17
mk/kernel_ld.sh
Executable file
17
mk/kernel_ld.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
LD="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if "${LD}" -z use-gs-for-tls 2>&1 |
|
||||||
|
grep "warning: -z use-gs-for-tls ignored" &> /dev/null
|
||||||
|
then
|
||||||
|
echo "Please update your prefix:" >&2
|
||||||
|
echo " rm -rf prefix" >&2
|
||||||
|
echo " make prefix" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${LD}" -z use-gs-for-tls "$@"
|
Loading…
Reference in a new issue