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.
This commit is contained in:
Dan Callaghan 2021-04-27 15:31:23 +10:00
parent 4c26dbe98f
commit 020466a43e
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
../libfatfs/libfatfs.a \ ../libfatfs/libfatfs.a \
../liblitesdcard/liblitesdcard.a \ ../liblitesdcard/liblitesdcard.a \
../liblitesata/liblitesata.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 \ ../libbase/crt0.o \
$(OBJECTS) \ $(OBJECTS) \
-L../libcompiler_rt \ -L../libcompiler_rt \

View File

@ -18,7 +18,7 @@ all: demo.bin
chmod -x $@ chmod -x $@
demo.elf: $(OBJECTS) demo.elf: $(OBJECTS)
$(LD) $(LDFLAGS) \ $(CC) $(LDFLAGS) \
-T linker.ld \ -T linker.ld \
-N -o $@ \ -N -o $@ \
$(BUILD_DIR)/software/libbase/crt0.o \ $(BUILD_DIR)/software/libbase/crt0.o \