Skip to content

Commit 78c2449

Browse files
committed
Makefile: use -f{function,data}-sections, don’t rename sections
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.
1 parent da2dabf commit 78c2449

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Makefile

+2-6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ CFLAGS+=-std=c99 -DESP8266
4343

4444
CFLAGS += -Wall -Os -g -O2 -Wpointer-arith -Wl,-EL -nostdlib -mlongcalls -mno-text-section-literals -D__ets__ -DICACHE_FLASH
4545

46+
CFLAGS += -ffunction-sections -fdata-sections
47+
4648
MFORCE32 := $(shell $(CC) --help=target | grep mforce-l32)
4749
ifneq ($(MFORCE32),)
4850
# If the compiler supports the -mforce-l32 flag, the compiler will generate correct code for loading
@@ -62,12 +64,6 @@ all: $(AXTLS_AR)
6264
$(AXTLS_AR): | $(BIN_DIR)
6365

6466
$(AXTLS_AR): $(OBJ_FILES)
65-
for file in $(OBJ_FILES); do \
66-
$(OBJCOPY) \
67-
--rename-section .text=.irom0.text \
68-
--rename-section .literal=.irom0.literal \
69-
$$file; \
70-
done
7167
$(AR) cru $@ $^
7268

7369
$(BIN_DIR):

0 commit comments

Comments
 (0)