From 49f1389a2196a9daf756f2a92a3af0c01722d539 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Thu, 25 Jun 2020 05:31:45 -0400 Subject: [PATCH] Fix ld error in elf maketarget The sdram_init ELF fails to link: powerpc64le-linux-gnu-ld -static -nostdlib -T sdram_init.lds \ --gc-sections -o sdram_init.elf head.o main.o sdram.o console.o \ libc.o sdram_init.lds powerpc64le-linux-gnu-ld: error: linker script file 'sdram_init.lds' appears multiple times make: *** [Makefile:70: sdram_init.elf] Error 1 This is because sdram_init.lds is one of the prerequisites, and thus is contained in $^. However, it is also explicitly specified as part of LDFLAGS, as the argument to -T. Signed-off-by: Boris Shingarov --- litedram/gen-src/sdram_init/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litedram/gen-src/sdram_init/Makefile b/litedram/gen-src/sdram_init/Makefile index 71ca921..b28d7e4 100644 --- a/litedram/gen-src/sdram_init/Makefile +++ b/litedram/gen-src/sdram_init/Makefile @@ -67,7 +67,7 @@ $(OBJ)/libc.o: $(LIBC_OBJ) $(call Q,LD, $(LD) -r -o $@ $^, $@) $(OBJ)/$(PROGRAM).elf: $(OBJECTS) $(OBJ)/libc.o $(OBJ)/$(PROGRAM).lds - $(call Q,LD, $(LD) $(LDFLAGS) -o $@ $^, $@) + $(call Q,LD, $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(OBJ)/libc.o, $@) $(OBJ)/$(PROGRAM).bin: $(OBJ)/$(PROGRAM).elf $(call Q,OC, $(OBJCOPY) -O binary -S $^ $@, $@)