From 6fd48ca2ce8305f27d6875032e314572ae288d49 Mon Sep 17 00:00:00 2001 From: Shawn Anastasio Date: Fri, 2 Oct 2020 13:42:16 -0500 Subject: [PATCH 1/2] software: Use -fno-stack-protector This allows riscv*-gnu-linux toolchains to be used to build LiteX software. Without this, references to undefined stack guard symbols get generated and linking fails. --- litex/soc/software/common.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/software/common.mak b/litex/soc/software/common.mak index 802a48b8d..ec14f40d2 100644 --- a/litex/soc/software/common.mak +++ b/litex/soc/software/common.mak @@ -50,7 +50,7 @@ INCLUDES = -I$(SOC_DIRECTORY)/software/include/base \ -I$(SOC_DIRECTORY)/software \ -I$(BUILDINC_DIRECTORY) \ -I$(CPU_DIRECTORY) -COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) +COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc -fno-stack-protector $(INCLUDES) CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY) From fa82d97aa59db1b81a20f376742a7874d0d37b94 Mon Sep 17 00:00:00 2001 From: Shawn Anastasio Date: Fri, 2 Oct 2020 18:30:46 -0500 Subject: [PATCH 2/2] cores/cpu: Add riscv*-unknown-linux-gnu triple, fix riscv-linux-gnu Add riscv*-unknown-linux-gnu to known triples, and fix the existing riscv-linux-gnu by removing the incorrect -gcc suffix from the triple. --- litex/soc/cores/cpu/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/litex/soc/cores/cpu/__init__.py b/litex/soc/cores/cpu/__init__.py index fe2bc18cf..6efac88b8 100644 --- a/litex/soc/cores/cpu/__init__.py +++ b/litex/soc/cores/cpu/__init__.py @@ -38,21 +38,24 @@ class CPUNone(CPU): CPU_GCC_TRIPLE_RISCV32 = ( "riscv64-unknown-elf", + "riscv64-unknown-linux-gnu", "riscv32-unknown-elf", + "riscv32-unknown-linux-gnu", "riscv64-elf", "riscv32-elf", "riscv-none-embed", "riscv64-linux", - "riscv64-linux-gnu-gcc", + "riscv64-linux-gnu", "riscv-sifive-elf", "riscv64-none-elf", ) CPU_GCC_TRIPLE_RISCV64 = ( "riscv64-unknown-elf", + "riscv64-unknown-linux-gnu", "riscv64-elf", "riscv64-linux", - "riscv64-linux-gnu-gcc", + "riscv64-linux-gnu", "riscv-sifive-elf", "riscv64-none-elf", )