Skip to content

Commit cb752ac

Browse files
authored
Build: Adapt Terapines Zcc(>=4.1.2) compiler options to match STDCLIB makefile variable. (#63)
* [terapines.mk] Use different --config options for each STDCLIB (Require after zcc 4.1.2). * [zcc] Remove the -fuse-size-lib compile flag This option is no longer effective in zcc version 4.1.2 and later. This option searches for C libraries under the size directory and is now being deprecated. * Build: Update the built-in basic library link option of ZCC Toolchain * docs: Add the version description of zcc toolchain to prevent users from making mistakes during use
1 parent e9dee56 commit cb752ac

File tree

9 files changed

+23
-16
lines changed

9 files changed

+23
-16
lines changed

Build/toolchain/terapines.mk

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Required Version: ZCC Toolchain Version >= 4.1.2
2+
# If the zcc toolchain version is less than 4.1.2, use nuclei-sdk v0.8.0
13
CC := zcc
24
CXX := z++
35
OBJDUMP := llvm-objdump
@@ -18,18 +20,18 @@ ifneq ($(findstring newlib,$(STDCLIB)),)
1820
ifeq ($(STDCLIB),newlib_full)
1921
LDLIBS += -lc -lclang_rt.builtins
2022
else ifeq ($(STDCLIB),newlib_fast)
21-
LDLIBS += -lc_nano -lclang_rt.builtins
23+
LDLIBS += -lc_small -lclang_rt.builtins_small
2224
STDCLIB_LDFLAGS += -u _printf_float -u _scanf_float
2325
else ifeq ($(STDCLIB),newlib_small)
24-
LDLIBS += -lc_nano -lclang_rt.builtins
26+
LDLIBS += -lc_small -lclang_rt.builtins_small
2527
STDCLIB_LDFLAGS += -u _printf_float
2628
else ifeq ($(STDCLIB),newlib_nano)
27-
LDLIBS += -lc_nano -lclang_rt.builtins
29+
LDLIBS += -lc_nano -lclang_rt.builtins_nano
2830
# work around for relocation R_RISCV_PCREL_HI20 out of range: -524289 is not in [-524288, 524287]; references _printf_float when compile with rv64
2931
# If it report above error, you can add -u _printf_float
3032
STDCLIB_LDFLAGS += #-u _printf_float
3133
else
32-
LDLIBS += -lc_nano -lclang_rt.builtins
34+
LDLIBS += -lc_small -lclang_rt.builtins_small
3335
STDCLIB_LDFLAGS += #-u _printf_float
3436
endif
3537
###
@@ -47,7 +49,7 @@ else ifeq ($(STDCLIB),nospec)
4749
COMMON_FLAGS +=
4850
###
4951
else
50-
LDLIBS += -lc_nano -lclang_rt.builtins
52+
LDLIBS += -lc_small -lclang_rt.builtins_small
5153
STDCLIB_LDFLAGS += -u _printf_float
5254
###
5355
endif

SoC/evalsoc/Common/npk.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ buildconfig:
572572
condition: $( startswith(${stdclib}, "newlib") && ${semihost} == 1 )
573573

574574
- type: zcc
575-
description: Terapines ZCC Toolchain
575+
description: Terapines ZCC Toolchain # Required Version: ZCC Toolchain Version >= 4.1.2
576576
toolchain_name: Terapines ZCC
577577
common_flags: # flags need to be combined together across all packages
578578
# Enable experimental extensions for zcc
@@ -586,16 +586,16 @@ buildconfig:
586586
condition: $( startswith(${stdclib}, "newlib") )
587587
- flags: -lc -lclang_rt.builtins
588588
condition: $( ${stdclib} == "newlib_full" )
589-
- flags: -lc_nano -lclang_rt.builtins -u _printf_float -u _scanf_float
589+
- flags: -lc_small -lclang_rt.builtins_small
590590
condition: $( ${stdclib} == "newlib_fast" )
591-
- flags: -lc_nano -lclang_rt.builtins -u _printf_float
591+
- flags: -lc_small -lclang_rt.builtins_small
592592
condition: $( ${stdclib} == "newlib_small" )
593-
- flags: -lc_nano -lclang_rt.builtins -u _printf_float
593+
- flags: -lc_small -lclang_rt.builtins_small
594594
condition: $( startswith(${stdclib}, "libncrt") )
595595
- flags: -fuse-ld=lld
596596
- flags: -u __on_exit_args
597597
condition: $( startswith(${stdclib}, "newlib") )
598-
- flags: -lc_nano -lclang_rt.builtins
598+
- flags: -lc_nano -lclang_rt.builtins_nano
599599
condition: $( ${stdclib} == "newlib_nano" )
600600
- flags: -lsemihost
601601
condition: $( ${semihost} == 1 )

application/baremetal/benchmark/coremark/npk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ buildconfig:
104104
common_flags: # flags need to be combined together across all packages
105105
- flags: -O3 -flto -falign-functions=4 -falign-loops=4 -flate-loop-unroll -malign-branch
106106
ldflags:
107-
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
107+
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2
108108

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
BENCH_FLAGS ?= -O3 -flto -falign-functions=4 -falign-loops=4 -flate-loop-unroll -malign-branch
2-
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
2+
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2

application/baremetal/benchmark/dhrystone/npk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ buildconfig:
9696
9797
condition: $( ${dhry_mode} == 'best' )
9898
ldflags:
99-
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
99+
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2

application/baremetal/benchmark/dhrystone/toolchain_terapines.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ BENCH_FLAGS ?= -O3 -ffast-math -flto -finline -fno-builtin-printf -funroll-loops
55
else ifeq ($(DHRY_MODE),inline)
66
BENCH_FLAGS ?= -O3 -flto -finline -fno-builtin-printf -funroll-loops -falign-functions=4 -falign-loops=4 -finline-functions -flate-loop-unroll -malign-branch
77
endif
8-
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
8+
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2

application/baremetal/benchmark/dhrystone_v2.2/npk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ buildconfig:
4545
common_flags: # flags need to be combined together across all packages
4646
- flags: -O3 -Wno-implicit-int -Wno-implicit-function-declaration
4747
ldflags:
48-
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
48+
- flags: -Wl,-mllvm,--align-all-nofallthru-blocks=2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
BENCH_FLAGS ?= -O3
2-
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2 -fuse-size-lib
2+
LDFLAGS += -Wl,-mllvm,--align-all-nofallthru-blocks=2

doc/source/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ This is release version of ``0.8.1`` of Nuclei SDK.
112112

113113
- Fix build system :ref:`develop_buildsystem_var_core` support table format error
114114

115+
* Build System
116+
117+
- Update to support Zcc version 4.1.2 and above as well as the new C library configuration
118+
119+
115120
V0.8.0
116121
------
117122

0 commit comments

Comments
 (0)