@@ -2,24 +2,25 @@ CC := clang
22AR := llvm-ar
33
44ifdef CFI
5- $(info Info : build with CFI enabled)
6- CLANG_VERSION := $(shell $(CC ) --version | head -n1 | sed -n 's/.* version \([0-9]* \) \..*/\1/p')
7- ifeq ($(shell test $(CLANG_VERSION ) -ge 21; echo $$? ) ,0)
8- CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs_zicfiss1p0_zicfilp1p0 -mabi=lp64
9- CFLAGS += -menable-experimental-extensions -fcf-protection=full
10- ifeq ($(CFI ) ,unlabeled)
11- CFLAGS += -mcf-branch-label-scheme=unlabeled
12- else ifeq ($(CFI),func-sig)
13- CFLAGS += -mcf-branch-label-scheme=func-sig
5+ $(info Info : build with CFI enabled)
6+ CLANG_VERSION := $(shell $(CC ) --version | head -n1 | sed -n 's/.* version \([0-9]* \) \..*/\1/p')
7+ ifeq ($(shell test $(CLANG_VERSION) -ge 21; echo $$?),0)
8+ CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs_zicfiss1p0_zicfilp1p0 -mabi=lp64
9+ CFLAGS += -menable-experimental-extensions -fcf-protection=full
10+ ifeq ($(CFI),unlabeled)
11+ CFLAGS += -mcf-branch-label-scheme=unlabeled
12+ else ifeq ($(CFI),func-sig)
13+ CFLAGS += -mcf-branch-label-scheme=func-sig
14+ else
15+ $(error Error : CFI is set to '$(CFI ) ' but expected 'unlabeled' or 'func-sig')
16+ endif
17+ else
18+ $(error Error : CFI requires clang version 21 or above, but found version $(CLANG_VERSION ) )
19+ endif
1420else
15- $(error Error : CFI is set to '$(CFI ) ' but expected 'unlabeled' or 'func-sig')
16- endif
17- else
18- $(error Error : CFI requires clang version 21 or above, but found version $(CLANG_VERSION ) )
19- endif
20- else
21- CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -mabi=lp64
21+ CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -mabi=lp64
2222endif
23+
2324CFLAGS += -Os
2425CFLAGS += -fdata-sections -ffunction-sections -fno-builtin -fvisibility=hidden -fomit-frame-pointer
2526CFLAGS += -I compiler-rt/lib/builtins
0 commit comments