From 6a75a14ce51255ec81349d5d8b112246e39e96cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Sat, 7 Jun 2014 03:13:55 +0200 Subject: [PATCH] x86: garbage collect section if not debugging --- boards/qemu-i386/Makefile.include | 5 +---- boards/x86-multiboot-common/Makefile.include | 16 +++++++++++----- boards/x86-multiboot-common/linker.ld | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/boards/qemu-i386/Makefile.include b/boards/qemu-i386/Makefile.include index b8f48a7338..1413f9b392 100644 --- a/boards/qemu-i386/Makefile.include +++ b/boards/qemu-i386/Makefile.include @@ -11,9 +11,6 @@ DEBUGGER = $(TERMPROG) all: -all-debug: export CFLAGS += -ggdb3 -O0 -all-debug: all - debug-kdbg: DEBUGGER_FLAGS="kdbg -r :1234 -- $(ELFFILE)" debug-kdbg: debug @@ -26,4 +23,4 @@ debug-tui: debug debug-gdb: debug DEBUGGER_FLAGS = "x-terminal-emulator -e gdb -ex 'target remote :1234' --args $(ELFFILE)" -debug: +debug: diff --git a/boards/x86-multiboot-common/Makefile.include b/boards/x86-multiboot-common/Makefile.include index 87937b1c4d..f868a6bb95 100644 --- a/boards/x86-multiboot-common/Makefile.include +++ b/boards/x86-multiboot-common/Makefile.include @@ -55,12 +55,18 @@ export OFLAGS = -O binary LINKFLAGS += -m32 -nostdlib -nostdinc -nostartfiles -nodefaultlibs \ --prefix=$(NEWLIB_BASE) \ -Wl,-rpath,$(NEWLIB_BASE)/lib \ - -T $(RIOTBASE)/boards/x86-multiboot-common/linker.ld + -T$(RIOTBASE)/boards/x86-multiboot-common/linker.ld UNDEF += $(BINDIR)x86-multiboot-common_base/startup.o -#CFLAGS += -ffunction-sections -fdata-sections -#LINKFLAGS += -Wl,--gc-sections -#CFLAGS += -Wall -Wextra -Werror -pedantic -pedantic-errors \ - BASELIBS += $(NEWLIB_BASE)/lib/libc.a \ $(NEWLIB_BASE)/lib/libm.a + +all: + +all-debug: export CFLAGS += -ggdb3 -O0 +all-debug: all + +ifeq (, $(filter all-debug, $(MAKECMDGOALS))) + CFLAGS += -Os -ffunction-sections -fdata-sections + LINKFLAGS += -Wl,--gc-sections +endif diff --git a/boards/x86-multiboot-common/linker.ld b/boards/x86-multiboot-common/linker.ld index 2a9f0a2a85..e6e1fb08b9 100644 --- a/boards/x86-multiboot-common/linker.ld +++ b/boards/x86-multiboot-common/linker.ld @@ -34,7 +34,7 @@ SECTIONS Next we'll put the .text section. */ ._multiboot_header : { - *(._multiboot_header) + KEEP(*(._multiboot_header)) } .note.gnu.build-id :