From 020466a43e9fd5cce3a9477dcc95fc019a0b0688 Mon Sep 17 00:00:00 2001 From: Dan Callaghan Date: Tue, 27 Apr 2021 15:31:23 +1000 Subject: [PATCH] soc/software: link with compiler instead of ld The linker does not actually recognise -nodefaultlibs, that is a compiler option. Prior to binutils 2.36, ld treated -nodefaultlibs as a string of short options and ignored them as unrecognised. Starting from binutils 2.36, it reports an error instead: riscv64-unknown-elf-ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?) See also: https://sourceware.org/bugzilla/show_bug.cgi?id=27050 Fixes #825. --- litex/soc/software/bios/Makefile | 2 +- litex/soc/software/demo/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 4ad3692e4..ea1b00b26 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -64,7 +64,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) ../libfatfs/libfatfs.a \ ../liblitesdcard/liblitesdcard.a \ ../liblitesata/liblitesata.a - $(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ + $(CC) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ ../libbase/crt0.o \ $(OBJECTS) \ -L../libcompiler_rt \ diff --git a/litex/soc/software/demo/Makefile b/litex/soc/software/demo/Makefile index a9a99c206..a71fcc295 100644 --- a/litex/soc/software/demo/Makefile +++ b/litex/soc/software/demo/Makefile @@ -18,7 +18,7 @@ all: demo.bin chmod -x $@ demo.elf: $(OBJECTS) - $(LD) $(LDFLAGS) \ + $(CC) $(LDFLAGS) \ -T linker.ld \ -N -o $@ \ $(BUILD_DIR)/software/libbase/crt0.o \