b915e7d5e3
This patch modifies the newlib and Contiki C and C++ compiler flags to omit exception handling unwind tables (see http://wiki.dwarfstd.org/index.php?title=Exception_Handling). Removing these tables saves space in debug builds and has not caused any readily-apparent functional changes. Here is the size listing for an example program built without this patch: text data bss dec hex filename 76002 1508 21224 98734 181ae all-timers.galileo Here is the size listing for the same program with this patch: text data bss dec hex filename 72918 1508 21224 95650 175a2 all-timers.galileo The primary motivation for this patch is to help enable UEFI support. The .eh_frame and .eh_frame_hdr sections that are otherwise generated are treated as code sections by the EDK2 GenFw program, since they are read-only alloc sections. They get grouped with the actual code sections, ahead of the data sections. This perturbs symbols and complicates debugging.
34 lines
1 KiB
Text
34 lines
1 KiB
Text
CONTIKI_CPU_DIRS += . init/common
|
|
|
|
CONTIKI_SOURCEFILES += gdt.c helpers.S idt.c cpu.c
|
|
|
|
CC = gcc
|
|
LD = gcc
|
|
AS = as
|
|
OBJCOPY = objcopy
|
|
SIZE = size
|
|
STRIP = strip
|
|
|
|
# Omit exception handling unwind tables (see
|
|
# http://wiki.dwarfstd.org/index.php?title=Exception_Handling). Removing these
|
|
# tables saves space and has not caused any readily-apparent functional
|
|
# changes.
|
|
#
|
|
# Synchronize the unwind table options here with the CFLAGS and CXXFLAGS in
|
|
# ./bsp/libc/build_newlib.sh.
|
|
CFLAGS += -Wall -fno-asynchronous-unwind-tables -fno-unwind-tables
|
|
LDFLAGS += -Wl,-Map=contiki-$(TARGET).map,--build-id=none
|
|
|
|
ifeq ($(BUILD_RELEASE),1)
|
|
CFLAGS += -Os -fno-strict-aliasing -ffunction-sections -fdata-sections
|
|
# XXX: --gc-sections can be very tricky sometimes. If somehow the release
|
|
# binary seems to be broken, check if removing this option fixes the issue.
|
|
LDFLAGS += -Wl,--strip-all,--gc-sections
|
|
else
|
|
CFLAGS += -O0
|
|
ifeq ($(findstring clang,$(CC)),clang)
|
|
CFLAGS += -g
|
|
else
|
|
CFLAGS += -ggdb3
|
|
endif
|
|
endif
|