fix compile on Linux

master
WangRunji 6 years ago
parent b9d884a0e6
commit 87862e9fd6

@ -20,18 +20,18 @@ if (${ARCH} STREQUAL i386)
if(APPLE)
set(PREFIX i386-elf-)
endif ()
set(CMAKE_C_FLAGS "-fno-builtin -Wall -ggdb -nostdinc -m32")
set(CMAKE_C_FLAGS "-m32")
elseif (${ARCH} STREQUAL x86_64)
if(APPLE)
set(PREFIX x86_64-elf-)
endif ()
set(CMAKE_C_FLAGS "-fno-builtin -Wall -ggdb -nostdinc -m64")
set(CMAKE_C_FLAGS "-m64")
elseif (${ARCH} STREQUAL riscv32)
set(PREFIX riscv64-unknown-elf-)
set(CMAKE_C_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany -std=gnu99 -fno-builtin -Wall -nostdinc -fno-stack-protector -ffunction-sections -fdata-sections")
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 -std=gnu99 -fno-builtin -Wall -nostdinc -fno-stack-protector -ffunction-sections -fdata-sections")
set(CMAKE_C_FLAGS "-march=rv64imac -mabi=lp64 -mcmodel=medany")
elseif (${ARCH} STREQUAL aarch64)
set(PREFIX aarch64-none-elf-)
else()
@ -39,7 +39,9 @@ else()
endif ()
set(CMAKE_C_COMPILER ${PREFIX}gcc)
set(CMAKE_RANLIB ${PREFIX}ranlib)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin -nostdinc -fno-stack-protector -ggdb -Wall")
set(CMAKE_EXE_LINKER_FLAGS "-nostdlib")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # get rid of '-rdynamic' on Linux
# Library
add_library(ulib ${LIBS})

Loading…
Cancel
Save