Skip to content

Commit 92a9f44

Browse files
authored
Merge pull request #9111 from ethereum/emscriptenTest
Switch to emscripten upstream backend.
2 parents 389da30 + 59ee743 commit 92a9f44

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ jobs:
598598

599599
b_ems:
600600
docker:
601-
- image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-1
601+
- image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-2
602602
environment:
603603
TERM: xterm
604604
steps:

.circleci/docker/Dockerfile.emscripten

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@
2626
# contains a Makefile in the docker/ subdirectory that can be used to create the
2727
# required base image using:
2828
#
29-
# make version=1.39.15-fastcomp build
29+
# make version=1.39.15 build
3030
#
31-
# TODO: switch to the upstream backend by removing "-fastcomp".
32-
#
33-
FROM emscripten/emsdk:1.39.15-fastcomp AS base
31+
FROM emscripten/emsdk:1.39.15 AS base
3432

3533
ADD emscripten.jam /usr/src
3634
RUN set -ex; \
@@ -47,6 +45,7 @@ RUN set -ex; \
4745
-DZ3_BUILD_TEST_EXECUTABLES=OFF \
4846
-DZ3_BUILD_EXECUTABLE=OFF \
4947
-DZ3_SINGLE_THREADED=ON \
48+
-DCMAKE_CXX_FLAGS="-s DISABLE_EXCEPTION_CATCHING=0" \
5049
..; \
5150
make; make install; \
5251
rm -r /usr/src/z3; \
@@ -61,6 +60,6 @@ RUN set -ex; \
6160
echo "using emscripten : : em++ ;" >> project-config.jam ; \
6261
./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
6362
--with-system --with-filesystem --with-test --with-program_options \
64-
cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
63+
cxxflags="-s DISABLE_EXCEPTION_CATCHING=0 -Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
6564
--prefix=/emsdk/emscripten/sdk/system install; \
6665
rm -r /usr/src/boost_1_73_0

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Language Features:
88

99
Compiler Features:
1010
* Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism.
11+
* Build system: Switch the emscripten build from the fastcomp backend to the upstream backend.
1112
* Code Generator: Do not introduce new internal source references for small compiler routines.
1213
* Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree (defaults to the root of the filesystem).
1314
* SMTChecker: Support array ``length``.

cmake/EthCompilerSettings.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
include(EthCheckCXXCompilerFlag)
1818

19-
eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support)
20-
if(NOT have_stack_protector_strong_support)
21-
eth_add_cxx_compiler_flag_if_supported(-fstack-protector)
19+
if(NOT EMSCRIPTEN)
20+
eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support)
21+
if(NOT have_stack_protector_strong_support)
22+
eth_add_cxx_compiler_flag_if_supported(-fstack-protector)
23+
endif()
2224
endif()
2325

2426
eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough)
@@ -109,15 +111,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
109111
# Re-enable exception catching (optimisations above -O1 disable it)
110112
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
111113
# Remove any code related to exit (such as atexit)
112-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
114+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXIT_RUNTIME=0")
113115
# Remove any code related to filesystem access
114-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_FILESYSTEM=1")
115-
# Remove variables even if it needs to be duplicated (can improve speed at the cost of size)
116-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s AGGRESSIVE_VARIABLE_ELIMINATION=1")
116+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FILESYSTEM=0")
117117
# Allow memory growth, but disable some optimisations
118118
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
119119
# Disable eval()
120-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1")
120+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DYNAMIC_EXECUTION=0")
121121
# Disable greedy exception catcher
122122
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0")
123123
# Abort if linking results in any undefined symbols

scripts/travis-emscripten/build_emscripten.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ cmake \
5454
-DTESTS=0 \
5555
..
5656
make -j 4 soljson
57+
# Patch soljson.js for backwards compatibility.
58+
# TODO: remove this with 0.7.
59+
# "viiiii" encodes the signature of the callback function.
60+
sed -i -e 's/addFunction(func,sig){/addFunction(func,sig){sig=sig||"viiiii";/' libsolc/soljson.js
5761

5862
cd ..
5963
mkdir -p upload

0 commit comments

Comments
 (0)