forked from cryptape/omnilock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use llvm docker * Use -O2 instead of -O3 -O3 makes a lot of cases failed. * Fix test case bug
- Loading branch information
1 parent
63c6291
commit f7988ed
Showing
3 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM debian:bullseye-slim AS intermediate | ||
|
||
# Install dependencies | ||
RUN apt-get -qq update; \ | ||
apt-get install -qqy --no-install-recommends \ | ||
gnupg2 wget ca-certificates apt-transport-https \ | ||
autoconf automake cmake dpkg-dev file make patch libc6-dev libtool | ||
|
||
# Install LLVM | ||
RUN echo "deb https://apt.llvm.org/bullseye llvm-toolchain-bullseye-16 main" \ | ||
> /etc/apt/sources.list.d/llvm.list && \ | ||
wget -qO /etc/apt/trusted.gpg.d/llvm.asc \ | ||
https://apt.llvm.org/llvm-snapshot.gpg.key && \ | ||
apt-get -qq update && \ | ||
apt-get install -qqy -t llvm-toolchain-bullseye-16 clang-16 clang-tidy-16 clang-format-16 lld-16 libc++-16-dev libc++abi-16-dev && \ | ||
for f in /usr/lib/llvm-*/bin/*; do ln -sf "$f" /usr/bin; done && \ | ||
ln -sf clang /usr/bin/cc && \ | ||
ln -sf clang /usr/bin/c89 && \ | ||
ln -sf clang /usr/bin/c99 && \ | ||
ln -sf clang++ /usr/bin/c++ && \ | ||
ln -sf clang++ /usr/bin/g++ && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
FROM intermediate as test | ||
|
||
COPY tests /tests | ||
|
||
RUN /tests/run.sh 16 | ||
|
||
FROM intermediate as final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,10 @@ LD := ld.lld-16 | |
OBJCOPY := llvm-objcopy-16 | ||
CFLAGS := \ | ||
--target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs \ | ||
-fPIC -O3 -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib -fvisibility=hidden -fdata-sections -ffunction-sections \ | ||
-fPIC -O2 -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib -fvisibility=hidden -fdata-sections -ffunction-sections \ | ||
-I deps/secp256k1/src -I deps/secp256k1 -I deps/ckb-c-std-lib -I deps/ckb-c-std-lib/libc -I deps/ckb-c-std-lib/molecule -I c -I build \ | ||
-Wall -Wno-nonnull -Wno-unused-function -g | ||
LDFLAGS := -nostdlib -static --gc-sections | ||
LDFLAGS := -nostdlib -static | ||
SECP256K1_SRC_20210801 := deps/secp256k1-20210801/src/ecmult_static_pre_context.h | ||
|
||
|
||
|
@@ -23,10 +23,13 @@ PROTOCOL_URL := https://raw.githubusercontent.com/nervosnetwork/ckb/${PROTOCOL_V | |
MOLC := moleculec | ||
MOLC_VERSION := 0.7.0 | ||
|
||
CLANG_FORMAT_DOCKER := kason223/clang-format@sha256:3cce35b0400a7d420ec8504558a02bdfc12fd2d10e40206f140c4545059cd95d | ||
BUILDER_DOCKER := xujiandong/ckb-riscv-llvm-toolchain@sha256:6409ab0d3e335c74088b54f4f73252f4b3367ae364d5c7ca7acee82135f5af4d | ||
|
||
all: build/omni_lock build/always_success | ||
|
||
all-via-docker: | ||
docker run --rm -v `pwd`:/code ${BUILDER_DOCKER} bash -c "cd /code && make -f Makefile.clang all" | ||
|
||
build/always_success: c/always_success.c | ||
$(CC) $(OMNI_LOCK_CFLAGS) $(LDFLAGS) -o $@ $< | ||
$(OBJCOPY) --only-keep-debug $@ [email protected] | ||
|
@@ -37,14 +40,14 @@ build/secp256k1_data_info_20210801.h: build/dump_secp256k1_data_20210801 | |
|
||
build/dump_secp256k1_data_20210801: c/dump_secp256k1_data_20210801.c $(SECP256K1_SRC_20210801) | ||
mkdir -p build | ||
gcc -I deps/secp256k1-20210801/src -I deps/secp256k1-20210801 -o $@ $< | ||
$(CC) -I deps/secp256k1-20210801/src -I deps/secp256k1-20210801 -o $@ $< | ||
|
||
|
||
$(SECP256K1_SRC_20210801): | ||
cd deps/secp256k1-20210801 && \ | ||
./autogen.sh && \ | ||
CC=$(CC) LD=$(LD) ./configure --with-bignum=no --with-asm=no \ | ||
--enable-ecmult-static-precomputation --enable-endomorphism --enable-module-recovery && \ | ||
CC=$(CC) LD=$(LD) ./configure --with-asm=no \ | ||
--enable-ecmult-static-precomputation --enable-module-recovery && \ | ||
make src/ecmult_static_pre_context.h src/ecmult_static_context.h | ||
|
||
|
||
|
@@ -59,7 +62,7 @@ ALL_C_SOURCE := $(wildcard c/omni_lock.c c/omni_lock_acp.h c/omni_lock_time_lock | |
c/blake2b_decl_only.h c/cobuild.h c/cobuild.c) | ||
|
||
fmt: | ||
docker run --rm -v `pwd`:/code ${CLANG_FORMAT_DOCKER} bash -c "cd code && clang-format -i -style=Google $(ALL_C_SOURCE)" | ||
docker run --rm -v `pwd`:/code ${BUILDER_DOCKER} bash -c "cd code && clang-format -i -style=Google $(ALL_C_SOURCE)" | ||
git diff --exit-code $(ALL_C_SOURCE) | ||
|
||
mol: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters