Commit c22b8a56 authored by Alessandro Rubini's avatar Alessandro Rubini

Makefile: build an intermediate object

Pretty often it happens that during trials we pick wrong external
functions (e.g., "printf") and the final link claims horribly about
dozens of undefined symbols.  By having an intermediate wrc.o we can
easily check which are the symbols we really leave undefined for libc
and libgcc to fill, before they resolve them by asking for something
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent 2c128a1f
......@@ -7,6 +7,7 @@ BOARD = spec
CROSS_COMPILE ?= lm32-elf-
......@@ -93,12 +94,15 @@ all: tools $(OUTPUT).ram $(OUTPUT).vhd
.PRECIOUS: %.elf %.bin
.PHONY: all tools clean gitmodules
$(OUTPUT).elf: $(LDS) silentoldconfig gitmodules $(OBJS)
$(OUTPUT).elf: $(LDS) silentoldconfig gitmodules $(OUTPUT).o
$(CC) $(CFLAGS) -DGIT_REVISION=\"$(REVISION)\" -c revision.c
${CC} -o $@ revision.o $(OBJS) $(LDFLAGS)
${CC} -o $@ revision.o $(OUTPUT).o $(LDFLAGS)
${OBJDUMP} -d $(OUTPUT).elf > $(OUTPUT)_disasm.S
$(SIZE) $@
$(OUTPUT).o: $(OBJS)
$(LD) --gc-sections -e _start -r $(OBJS) -o $@
%.bin: %.elf
${OBJCOPY} -O binary $^ $@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment