Skip to content
This repository was archived by the owner on May 27, 2020. It is now read-only.

Commit d31d2df

Browse files
committed
Add support for debug builds
Apparently all I needed to do was disable function sections and LTO
1 parent c108367 commit d31d2df

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ path = "efi"
1313
name = "akira"
1414
crate-type = ["staticlib"]
1515

16+
[profile.dev]
17+
panic = "abort"
18+
1619
[profile.release]
1720
panic = "abort"
1821
lto = true

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Either 'debug' or 'release'
2+
PROFILE := release
3+
14
TARGET := x86_64-efi-pe
25

36
AR := $(TARGET)-ar
@@ -8,11 +11,12 @@ LD := $(TARGET)-ld
811
# $2: Extra options
912
cargo = \
1013
OVERRIDE_TARGET=$(TARGET) \
11-
OVERRIDE_PROFILE=release \
14+
OVERRIDE_PROFILE=$(PROFILE) \
1215
OVERRIDE_RUSTC=$(shell which rustc) \
1316
OVERRIDE_RUSTDOC=$(shell which rustdoc) \
1417
PATH="$(realpath rustc-override):$$PATH" \
15-
cargo $1 --target $(realpath $(TARGET).json) --release $2
18+
cargo $1 --target $(realpath $(TARGET).json) $(PROFILE_FLAG) $2
19+
PROFILE_FLAG := $(if $(filter release,$(PROFILE)),--release,)
1620

1721
# Runs `cargo rustc` with the specified options
1822
# $1: Options passed to Cargo
@@ -32,7 +36,7 @@ all: akira.gpt akira.iso
3236

3337
# Abbreviations for intermediate build files
3438
LIBCORE_RLIB := core/target/$(TARGET)/libcore.rlib
35-
LIBAKIRA_A := target/$(TARGET)/release/libakira.a
39+
LIBAKIRA_A := target/$(TARGET)/$(PROFILE)/libakira.a
3640
BOOTX64_EFI := build/efi/boot/bootx64.efi
3741

3842
# When any of these files change, the main crate will be rebuilt

x86_64-efi-pe.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"os": "efi",
66
"arch": "x86_64",
77
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
8+
"function-sections": false,
89
"linker": "x86_64-efi-pe-ld",
910
"ar": "x86_64-efi-pe-ar",
1011
"pre-link-args": ["-m64"],

0 commit comments

Comments
 (0)