From 78c24497f9eaf22cd30523ac58f9c9988ade0347 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sat, 29 Apr 2017 22:26:08 +0800 Subject: [PATCH] =?UTF-8?q?Makefile:=20use=20-f{function,data}-sections,?= =?UTF-8?q?=20don=E2=80=99t=20rename=20sections?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Platform- and application-specific section placement is best done in the application makefiles and linker scripts. On the other hand, compiling with split sections allows code and data usage to be reduced without tuning specific options in config file. --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c3f51ac1d..4d975ea3b 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ CFLAGS+=-std=c99 -DESP8266 CFLAGS += -Wall -Os -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mno-text-section-literals -D__ets__ -DICACHE_FLASH +CFLAGS += -ffunction-sections -fdata-sections + MFORCE32 := $(shell $(CC) --help=target | grep mforce-l32) ifneq ($(MFORCE32),) # If the compiler supports the -mforce-l32 flag, the compiler will generate correct code for loading @@ -62,12 +64,6 @@ all: $(AXTLS_AR) $(AXTLS_AR): | $(BIN_DIR) $(AXTLS_AR): $(OBJ_FILES) - for file in $(OBJ_FILES); do \ - $(OBJCOPY) \ - --rename-section .text=.irom0.text \ - --rename-section .literal=.irom0.literal \ - $$file; \ - done $(AR) cru $@ $^ $(BIN_DIR):