# 2021-1-26: created by Davis
#cmake config for compile flag
clear_flags()
set(LINK_FLAGS
        -mcmodel=medany
        -nostartfiles
        -static
        -Wl,--gc-sections
        -Wl,-static
        -Wl,--start-group
        -Wl,--whole-archive
        -Wl,--no-whole-archive
        -Wl,--end-group
        -Wl,-EL
        -nolibc
        -Wl,-nostdlib
        -Wl,--no-relax
#        -z max-page-size=4096
        -T ${ld_path}
        )
set(C_CXX_FLAGS
#        -mabi=lp64d
#        -march=rv64imafc
        -mcmodel=medany
        -fno-common
        -ffunction-sections
        -fdata-sections
        -fstrict-volatile-bitfields
        -fno-zero-initialized-in-bss
        -ffast-math
        -fno-math-errno
        -fsingle-precision-constant
        -O0
        -ggdb
        -std=gnu11
        -Wno-pointer-to-int-cast
        -nostdinc
        # -Wbuiltin-declaration-mismatch
#        -Wall -Werror -O -fno-omit-frame-pointer -ggdb -g -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax
        )
add_compile_flags(LD ${LINK_FLAGS})
add_compile_flags(C ${C_CXX_FLAGS})
add_compile_flags(CXX ${C_CXX_FLAGS})