Keep debug info in a .sym file

- Compile time changes
   - Compile libkernel.a with debug info
   - Copy debug info to kernel.sym
   - Strip the kernel of debug symbols
 - Workflow changes
   - Add `debug` option to `make qemu`
This commit is contained in:
Dan Robertson 2017-12-02 19:33:16 +00:00
parent 1f3ebdbd63
commit 804d0ad641
No known key found for this signature in database
GPG key ID: 45C4A652C47E42A5
3 changed files with 8 additions and 3 deletions

2
kernel

@ -1 +1 @@
Subproject commit 578c57840afd1fc32559bfa2372509f2b5910581
Subproject commit 45e8effa8a03fa4abc427a1fafadae25b589e465

View file

@ -1,9 +1,9 @@
build/libkernel.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag
# Temporary fix for https://github.com/redox-os/redox/issues/963 allowing to build on macOS
ifeq ($(UNAME),Darwin)
cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@
cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float -C debuginfo=2 --emit link=../$@
else
cd kernel && INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@
cd kernel && INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float -C debuginfo=2 --emit link=../$@
endif
build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs_live.tag
@ -11,6 +11,8 @@ build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src
build/kernel: kernel/linkers/$(ARCH).ld build/libkernel.a
$(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel.a
objcopy --only-keep-debug $@ $@.sym
objcopy --strip-debug $@
build/kernel_live: kernel/linkers/$(ARCH).ld build/libkernel_live.a build/live.o
$(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_live.a build/live.o

View file

@ -27,6 +27,9 @@ endif
ifneq ($(usb),no)
QEMUFLAGS+=-device nec-usb-xhci,id=xhci -device usb-tablet,bus=xhci.0
endif
ifneq ($(gdb),yes)
QEMUFLAGS+=-s
endif
ifeq ($(UNAME),Linux)
ifneq ($(kvm),no)
QEMUFLAGS+=-enable-kvm -cpu host