File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,17 @@ jobs:
1111 - uses : actions/checkout@v4
1212 with :
1313 submodules : recursive
14- - name : Install llvm 18
14+ - name : Install llvm 21
1515 run : |
16- sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
1716 wget https://apt.llvm.org/llvm.sh
1817 chmod +x llvm.sh
19- sudo ./llvm.sh 18
18+ sudo ./llvm.sh 21
2019 rm llvm.sh
21- - name : Fix llvm-ar path
20+ - name : Fix llvm path
2221 run : |
23- sudo ln -s $(which llvm-ar-18) /usr/bin/llvm-ar || true
22+ sudo ln -sf $(which llvm-ar-21) /usr/bin/llvm-ar
23+ sudo ln -sf $(which clang-21) /usr/bin/clang
2424 - name : Build
2525 run : make
26+ - name : Build with CFI enabled
27+ run : make clean && make CFI=unlabeled
Original file line number Diff line number Diff line change 11CC := clang
22AR := llvm-ar
33
4- CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -mabi=lp64
4+ define get_cfi_cflags
5+ $(if $(1 ) ,\
6+ $(info Info: build with CFI enabled) \
7+ $(eval _CLANG_VERSION := $(shell $(CC ) --version | head -n1 | sed -n 's/.* version \([0-9]* \) \..* /\1/p') ) \
8+ $(if $(shell test $(_CLANG_VERSION ) -ge 21 && echo 1) ,\
9+ --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs_zicfiss1p0_zicfilp1p0 -mabi=lp64 \
10+ -menable-experimental-extensions -fcf-protection=full \
11+ $(if $(filter unlabeled,$(1 ) ) ,\
12+ -mcf-branch-label-scheme=unlabeled,\
13+ $(if $(filter func-sig,$(1 ) ) ,\
14+ -mcf-branch-label-scheme=func-sig,\
15+ $(error Error: CFI is set to '$(1 ) ' but expected 'unlabeled' or 'func-sig') ) ) ,\
16+ $(error Error: CFI requires clang version 21 or above, but found version $(_CLANG_VERSION ) ) ) ,\
17+ --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs -mabi=lp64)
18+ endef
19+
20+ CFLAGS := $(call get_cfi_cflags,$(CFI ) )
21+
522CFLAGS += -Os
623CFLAGS += -fdata-sections -ffunction-sections -fno-builtin -fvisibility=hidden -fomit-frame-pointer
724CFLAGS += -I compiler-rt/lib/builtins
You can’t perform that action at this time.
0 commit comments