Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: strip debug info into a separate file #219

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
cscope.*
*.iso
*.img
*.debug
Makeconf.local
.DS_Store
drivers/acpi/acpica/source/
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ SHELL := bash
RM := rm
LN := ln
SYMLINK := $(LN) -s -f
OBJCOPY := objcopy
STRIP := strip
ifeq ($(SYSTEM), MACOS)
STRIP_OPTS := -S
else
STRIP_OPTS := -s
endif

GRUB_FILE := grub-file
GRUB_MKIMAGE := grub-mkimage
Expand Down Expand Up @@ -146,6 +153,7 @@ OBJS := $(SOURCES:%.c=%.o)
OBJS += $(ASM_SOURCES:%.S=%.o)

TARGET := kernel64.bin
TARGET_DEBUG := $(TARGET).debug

# On Linux systems, we build directly. On non-Linux, we rely on the 'docker%'
# rule below to create an Ubuntu container and perform the Linux-specific build
Expand All @@ -169,6 +177,9 @@ $(TARGET): $(OBJS) $(PREP_LINK_SCRIPT)
$(VERBOSE) rm -rf $(SYMBOLS_NAME).S
@echo "LD " $(TARGET) $(SYMBOLS_NAME).o
$(VERBOSE) $(LD) -T $(PREP_LINK_SCRIPT) -o $@ $(OBJS) $(PFMLIB_LINKER_FLAGS) $(SYMBOLS_NAME).o
@echo "STRIP"
$(VERBOSE) $(OBJCOPY) --only-keep-debug $(TARGET) $(TARGET_DEBUG)
$(VERBOSE) $(STRIP) $(STRIP_OPTS) $(TARGET)

$(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL)
@echo "UNTAR libpfm"
Expand Down Expand Up @@ -203,6 +214,7 @@ clean:
$(VERBOSE) find $(KTF_ROOT) -name cscope.\* -delete
$(VERBOSE) find $(PFMLIB_DIR) -mindepth 1 ! -name $(PFMLIB_NAME)-$(PFMLIB_VER).tar.gz -delete
$(VERBOSE) $(RM) -rf $(ACPICA_DEST_DIR)/source
$(VERBOSE) $(RM) -f $(TARGET_DEBUG)

# Check whether we can use kvm for qemu
ifeq ($(SYSTEM),LINUX)
Expand Down