commit
9e38dc70a4
|
@ -52,6 +52,7 @@ class CPUNone(CPU):
|
||||||
}
|
}
|
||||||
|
|
||||||
CPU_GCC_TRIPLE_RISCV64 = (
|
CPU_GCC_TRIPLE_RISCV64 = (
|
||||||
|
"riscv64-pc-linux-musl",
|
||||||
"riscv64-unknown-elf",
|
"riscv64-unknown-elf",
|
||||||
"riscv64-unknown-linux-gnu",
|
"riscv64-unknown-linux-gnu",
|
||||||
"riscv64-elf",
|
"riscv64-elf",
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -89,9 +90,15 @@ def get_cpu_mak(cpu, compile_software):
|
||||||
raise OSError(msg)
|
raise OSError(msg)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
selected_triple = select_triple(triple)
|
||||||
|
if not clang:
|
||||||
|
binutils_version = re.match("GNU ar \(GNU Binutils\) (.+)", os.popen(selected_triple + "-ar -V").read()).group(1).split(".")
|
||||||
|
if int(binutils_version[1]) >= 2 and int(binutils_version[2]) >= 37 and (not re.search("zicsr", flags)):
|
||||||
|
flags = re.compile("-march=([^ ]+)").sub("-march=\\1_zicsr", flags)
|
||||||
|
|
||||||
# Return informations.
|
# Return informations.
|
||||||
return [
|
return [
|
||||||
("TRIPLE", select_triple(triple)),
|
("TRIPLE", selected_triple),
|
||||||
("CPU", cpu.name),
|
("CPU", cpu.name),
|
||||||
("CPUFAMILY", cpu.family),
|
("CPUFAMILY", cpu.family),
|
||||||
("CPUFLAGS", flags),
|
("CPUFLAGS", flags),
|
||||||
|
|
|
@ -14,6 +14,7 @@ CX_normal := $(CCACHE) clang++ -target $(TRIPLE) -integrated-as
|
||||||
else
|
else
|
||||||
CC_normal := $(CCACHE) $(TARGET_PREFIX)gcc -std=gnu99
|
CC_normal := $(CCACHE) $(TARGET_PREFIX)gcc -std=gnu99
|
||||||
CX_normal := $(CCACHE) $(TARGET_PREFIX)g++
|
CX_normal := $(CCACHE) $(TARGET_PREFIX)g++
|
||||||
|
GCC_INSTALLATION_PATH := $(patsubst %/libgcc.a,%,$(shell $(CC) -print-libgcc-file-name))
|
||||||
endif
|
endif
|
||||||
AR_normal := $(TARGET_PREFIX)gcc-ar
|
AR_normal := $(TARGET_PREFIX)gcc-ar
|
||||||
LD_normal := $(TARGET_PREFIX)ld
|
LD_normal := $(TARGET_PREFIX)ld
|
||||||
|
@ -54,7 +55,13 @@ INCLUDES = -I$(PICOLIBC_DIRECTORY)/newlib/libc/tinystdio \
|
||||||
-I$(BUILDINC_DIRECTORY) \
|
-I$(BUILDINC_DIRECTORY) \
|
||||||
-I$(BUILDINC_DIRECTORY)/../libc \
|
-I$(BUILDINC_DIRECTORY)/../libc \
|
||||||
-I$(CPU_DIRECTORY)
|
-I$(CPU_DIRECTORY)
|
||||||
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -fno-stack-protector -flto $(INCLUDES)
|
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -fno-stack-protector $(INCLUDES)
|
||||||
|
ifneq (,$(GCC_INSTALLATION_PATH))
|
||||||
|
COMMONFLAGS += -nostdinc -I$(GCC_INSTALLATION_PATH)/include -I$(GCC_INSTALLATION_PATH)/include-fixed
|
||||||
|
endif
|
||||||
|
ifeq (,$(findstring musl,$(TRIPLE)))
|
||||||
|
COMMONFLAGS += -flto
|
||||||
|
endif
|
||||||
ifneq ($(CPUFAMILY), arm)
|
ifneq ($(CPUFAMILY), arm)
|
||||||
COMMONFLAGS += -fexceptions
|
COMMONFLAGS += -fexceptions
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue