From 6f94df81968f43a9c60476ee186732bb1814d516 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 19 Dec 2016 20:52:50 +0100 Subject: rules.make: add a few options to disable exceptions and to strip unused sections We don't use exception handling nor stack unwinding in the programs here. Some executables are quite large for no benefit. Let's disable exception handling, and strip off eh_frame_hdr, eh_frame, as well as .note.ABI-tag all of which are unused. --- include/rules.make | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/rules.make b/include/rules.make index 715db29..8557d7c 100644 --- a/include/rules.make +++ b/include/rules.make @@ -7,7 +7,7 @@ UCLIBC ?= uclibc CC_ORIG := $(CC) override CC := $(UCLIBC) $(CC) -Os -CFLAGS=$(GCC_ARCH_SMALL) $(GCC_CPU_SMALL) $(GCC_OPT_SMALL) +CFLAGS=$(GCC_ARCH_SMALL) $(GCC_CPU_SMALL) $(GCC_OPT_SMALL) -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables #-mpreferred-stack-boundary=2 -malign-jumps=0 -malign-loops=0 -malign-functions=0 -Os -march=i386 -mcpu=i386 LDFLAGS=-s -Wl,--gc-sections @@ -15,14 +15,15 @@ all: $(OBJS) %: %.c $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< - $(STRIP) -x --strip-unneeded -R .comment -R .note $@ + $(STRIP) -x --strip-unneeded -R .comment -R .note -R .note.ABI-tag $@ + $(STRIP) -R .eh_frame_hdr -R .eh_frame $@ $(OBJDUMP) -h $@ | grep -q '\.data[ ]*00000000' && $(STRIP) -R .data $@ || true $(OBJDUMP) -h $@ | grep -q '\.sbss[ ]*00000000' && $(STRIP) -R .sbss $@ || true #-if [ -n "$(SSTRIP)" ]; then $(SSTRIP) $@ ; fi %-debug: %.c $(CC) $(LDFLAGS) $(CFLAGS) -DDEBUG -o $@ $< - $(STRIP) -x --strip-unneeded -R .comment -R .note $@ + $(STRIP) -x --strip-unneeded -R .comment -R .note -R .note.ABI-tag $@ $(OBJDUMP) -h $@ | grep -q '\.data[ ]*00000000' && $(STRIP) -R .data $@ || true $(OBJDUMP) -h $@ | grep -q '\.sbss[ ]*00000000' && $(STRIP) -R .sbss $@ || true -- 1.7.12.1