From ec6f0c57e9be52e23cfdcefd3144972022f028e7 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Tue, 23 May 2017 20:41:56 +0200 Subject: [PATCH 1/2] fix(Makefile): call generic objcopy,strip and enforce arch via argument This is necessary on systems where the binaries don't contain the architecture names, which doesn't mean they don't support the required architectures. --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 90c3f56f..10cd55e6 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ release_boot := $(boot_outdir)/release/libboot.a grub_cfg := src/arch/$(arch)/grub.cfg -TIMESTAMP := $(shell /bin/date "+%Y-%m-%d-%H:%M:%S") +TIMESTAMP := $(shell date "+%Y-%m-%d-%H:%M:%S") # wildcard paths wild_iso := target/$(target)/%/sos-$(arch).iso @@ -101,7 +101,7 @@ $(boot): @cd boot && xargo rustc --target $(boot_target) -- \ --emit=obj=target/$(boot_target)/debug/boot32.o # # Place 32-bit bootstrap code into a 64-bit ELF - @x86_64-elf-objcopy -O elf64-x86-64 $(boot_outdir)/debug/boot32.o \ + @objcopy -O elf64-x86-64 $(boot_outdir)/debug/boot32.o \ $(boot_outdir)/debug/boot.o # @x86_64-elf-objcopy --strip-debug -G _start boot/target/boot.o @cd $(boot_outdir)/debug && ar -crus libboot.a boot.o @@ -110,8 +110,8 @@ $(release_boot): @cd boot && xargo rustc --target $(boot_target) -- --release \ --emit=obj=target/$(boot_target)release/boot32.o # # Place 32-bit bootstrap code into a 64-bit ELF - @x86_64-elf-objcopy -O elf64-x86-64 $(boot_outdir)/release/boot32.o $(boot_outdir)/release/boot.o - @x86_64-elf-objcopy --strip-debug -G _start $(boot_outdir)/release/boot.o + @objcopy -O elf64-x86-64 $(boot_outdir)/release/boot32.o $(boot_outdir)/release/boot.o + @objcopy -O elf64-x86-64 --strip-debug -G _start $(boot_outdir)/release/boot.o @cd $(boot_outdir)/release && ar -crus libboot.a boot.o $(release_kernel): $(release_boot) @@ -131,11 +131,11 @@ $(kernel): $(boot) @xargo build --target $(target) $(kernel).debug: $(kernel) - @x86_64-elf-objcopy --only-keep-debug $(kernel) $(kernel).debug + @objcopy -O elf64-x86-64 --only-keep-debug $(kernel) $(kernel).debug $(kernel).bin: $(kernel) $(kernel).debug - @x86_64-elf-strip -g -o $(kernel).bin $(kernel) - @x86_64-elf-objcopy --add-gnu-debuglink=$(kernel).debug $(kernel) + @strip -O elf64-x86-64 -g -o $(kernel).bin $(kernel) + @objcopy -O elf64-x86-64 --add-gnu-debuglink=$(kernel).debug $(kernel) gdb: $(kernel).bin $(kernel).debug ##@utilities Connect to a running QEMU instance with gdb. @rust-os-gdb -ex "target remote tcp:127.0.0.1:1234" $(kernel) From 3c32ffb9d57b7322abf7d12a58e7d48fa880b98b Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Tue, 23 May 2017 20:43:21 +0200 Subject: [PATCH 2/2] fix(x86_64 target): specificy linker as "gcc" This is necessary on systems where clang is installed gcc and is also preferred over gcc. --- x86_64-sos-kernel-gnu.json | 1 + 1 file changed, 1 insertion(+) diff --git a/x86_64-sos-kernel-gnu.json b/x86_64-sos-kernel-gnu.json index 8c073f3a..35a39162 100644 --- a/x86_64-sos-kernel-gnu.json +++ b/x86_64-sos-kernel-gnu.json @@ -8,6 +8,7 @@ "relocation-model": "static", "os": "sos", "arch": "x86_64", + "linker": "gcc", "linker-flavor": "gcc", "pre-link-args": { "gcc": [ "-Tsrc/arch/x86_64/linker.ld"