From 779831fd05803843fbf9a0788986952c874c861a Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Fri, 22 Mar 2019 17:04:25 +0800 Subject: [PATCH] Use musl for biscuit programs in RISC-V --- Makefile | 2 +- README.md | 1 + biscuit/CMakeLists.txt | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 60c6adb..b17d89a 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ ifneq ($(arch), x86_64) endif biscuit: -ifeq ($(arch), $(filter $(arch), x86_64 aarch64)) +ifeq ($(arch), $(filter $(arch), x86_64 aarch64 riscv64)) @echo Building biscuit programs @mkdir -p biscuit/build @cd biscuit/build && cmake $(cmake_build_args) .. && make diff --git a/README.md b/README.md index 8ff655f..ae632e4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ $ sudo pacman -Syu musl # archlinux $ brew install FileSottile/musl-cross/musl-cross # for ubuntu 16.04, we should build gcc-musl for newest musl-1.1.21 # please see build-gcc-musl.md +# for riscv musl toolchain, please install [musl-riscv-toolchain](https://github.com/jiegec/musl-riscv-toolchain) ``` ```bash diff --git a/biscuit/CMakeLists.txt b/biscuit/CMakeLists.txt index d7e52db..3a7fbd6 100644 --- a/biscuit/CMakeLists.txt +++ b/biscuit/CMakeLists.txt @@ -35,8 +35,8 @@ elseif (${ARCH} STREQUAL riscv32) set(PREFIX riscv64-unknown-elf-) set(CMAKE_C_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany") elseif (${ARCH} STREQUAL riscv64) - set(PREFIX riscv64-unknown-elf-) - set(CMAKE_C_FLAGS "-march=rv64imac -mabi=lp64 -mcmodel=medany") + set(PREFIX riscv64-linux-musl-) + set(CMAKE_C_FLAGS "-march=rv64imafdc -mabi=lp64d -mcmodel=medany") elseif (${ARCH} STREQUAL aarch64) set(PREFIX aarch64-linux-musl-) else () @@ -54,8 +54,10 @@ if (KERNEL_HEADERS_DIR) include_directories(${KERNEL_HEADERS_DIR}/include/uapi) endif () -# Execuatble +# Executable foreach (PATH ${SRCS}) - get_filename_component(NAME ${PATH} NAME_WE) - add_executable(${NAME} ${PATH}) + if (NOT ${ARCH} STREQUAL riscv64 OR NOT "${PATH}" MATCHES "^c/(usertests).c$") + get_filename_component(NAME ${PATH} NAME_WE) + add_executable(${NAME} ${PATH}) + endif () endforeach ()