diff --git a/.gitmodules b/.gitmodules
index b80b4c2dc..2984830b0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,16 +2,16 @@
path = app-shared/flutter
url = https://github.com/flutter/flutter.git
[submodule "boost"]
- path = p2p/boost
+ path = lib-shared/boost
url = https://github.com/boostorg/boost.git
[submodule "cppcoro"]
- path = p2p/cppcoro
+ path = lib-shared/cppcoro
url = https://github.com/lewissbaker/cppcoro.git
[submodule "jsoncpp"]
- path = p2p/jsoncpp
+ path = lib-shared/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp.git
[submodule "abseil-cpp"]
- path = min-webrtc/abseil-cpp
+ path = lib-shared/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
[submodule "libsrtp"]
path = min-webrtc/libsrtp
@@ -20,10 +20,10 @@
path = min-webrtc/webrtc
url = https://webrtc.googlesource.com/src
[submodule "openvpn3"]
- path = p2p/openvpn3
+ path = lib-protocol/openvpn3
url = https://github.com/OpenVPN/openvpn3.git
[submodule "lz4"]
- path = p2p/lz4
+ path = lib-protocol/lz4
url = https://github.com/lz4/lz4.git
[submodule "openzeppelin-solidity"]
path = openzeppelin-solidity
@@ -35,25 +35,25 @@
path = vpn-shared/libevent
url = https://github.com/libevent/libevent.git
[submodule "lwip"]
- path = p2p/lwip
+ path = lib-protocol/lwip
url = https://git.savannah.nongnu.org/git/lwip.git
[submodule "boringtun"]
- path = p2p/boringtun
+ path = lib-protocol/boringtun
url = https://github.com/cloudflare/boringtun.git
[submodule "tor"]
path = vpn-shared/tor
url = https://git.torproject.org/tor.git
[submodule "libutp"]
- path = p2p/libutp
+ path = lib-protocol/libutp
url = https://github.com/bittorrent/libutp.git
[submodule "flutter-desktop-embedding"]
path = app-shared/flutter-desktop-embedding
url = https://github.com/google/flutter-desktop-embedding
[submodule "url"]
- path = p2p/url
+ path = lib-shared/url
url = https://github.com/cpp-netlib/url
[submodule "secp256k1"]
- path = p2p/secp256k1
+ path = lib-shared/secp256k1
url = https://github.com/bitcoin-core/secp256k1.git
[submodule "openssl"]
path = min-openssl/openssl
@@ -65,16 +65,16 @@
path = min-zlib/libz
url = https://chromium.googlesource.com/chromium/src/third_party/zlib.git
[submodule "eEVM"]
- path = p2p/eEVM
+ path = lib-shared/eEVM
url = https://github.com/microsoft/eEVM.git
[submodule "tap-windows6"]
- path = p2p/tap-windows6
+ path = lib-protocol/tap-windows6
url = https://github.com/OpenVPN/tap-windows6
[submodule "sqlite"]
- path = p2p/sqlite
+ path = lib-shared/sqlite
url = https://github.com/mackyle/sqlite.git
[submodule "SPCDNS"]
- path = p2p/SPCDNS
+ path = lib-protocol/SPCDNS
url = https://github.com/spc476/SPCDNS
[submodule "wireshark"]
path = min-wireshark/wireshark
@@ -94,12 +94,6 @@
[submodule "gnulib"]
path = min-glib/gnulib
url = https://git.savannah.gnu.org/git/gnulib.git
-[submodule "libcxxabi"]
- path = env/libcxxabi
- url = https://github.com/llvm-mirror/libcxxabi.git
-[submodule "libcxx"]
- path = env/libcxx
- url = https://github.com/llvm-mirror/libcxx.git
[submodule "pkg-config"]
path = env/pkg-config
url = https://gitlab.freedesktop.org/pkg-config/pkg-config.git
@@ -107,23 +101,20 @@
path = vpn-shared/quickjs
url = https://github.com/bellard/quickjs.git
[submodule "intx"]
- path = p2p/intx
+ path = lib-shared/intx
url = https://github.com/chfast/intx.git
[submodule "expected"]
- path = p2p/expected
+ path = lib-shared/expected
url = https://github.com/TartanLlama/expected.git
[submodule "curl"]
- path = p2p/curl
+ path = lib-protocol/curl
url = https://github.com/curl/curl.git
[submodule "challenge-bypass-ristretto-ffi"]
- path = p2p/challenge-bypass-ristretto-ffi
+ path = lib-protocol/challenge-bypass-ristretto-ffi
url = https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git
[submodule "icu"]
path = min-icu4c/icu
url = https://github.com/unicode-org/icu.git
-[submodule "googletest"]
- path = min-zlib/googletest
- url = https://chromium.googlesource.com/external/github.com/google/googletest.git
[submodule "v8"]
path = min-v8/v8
url = https://chromium.googlesource.com/v8/v8
@@ -131,7 +122,7 @@
path = min-v8/trace_event
url = https://chromium.googlesource.com/chromium/src/base/trace_event/common.git
[submodule "protobuf"]
- path = p2p/protobuf
+ path = lib-protocol/protobuf
url = https://chromium.googlesource.com/external/github.com/google/protobuf
[submodule "jinja2"]
path = min-v8/jinja2
@@ -140,19 +131,19 @@
path = min-v8/markupsafe
url = https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git
[submodule "fmt"]
- path = p2p/fmt
+ path = lib-shared/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "leveldb"]
path = tst-explore/leveldb
url = https://github.com/google/leveldb.git
[submodule "c-ares"]
- path = p2p/c-ares
+ path = lib-protocol/c-ares
url = https://github.com/c-ares/c-ares.git
[submodule "SHA3IUF"]
- path = p2p/SHA3IUF
+ path = lib-shared/SHA3IUF
url = https://github.com/brainhub/SHA3IUF.git
[submodule "cpp-jwt"]
- path = p2p/cpp-jwt
+ path = lib-protocol/cpp-jwt
url = https://github.com/arun11299/cpp-jwt.git
[submodule "cairo"]
path = min-cairo/cairo
@@ -164,7 +155,7 @@
path = min-cairo/pixman
url = https://gitlab.freedesktop.org/pixman/pixman.git
[submodule "chains"]
- path = p2p/chains
+ path = lib-protocol/chains
url = https://github.com/ethereum-lists/chains.git
[submodule "engine"]
path = app-shared/engine
@@ -173,16 +164,16 @@
path = min-krypton/vpn-libraries
url = https://github.com/google/vpn-libraries.git
[submodule "compile-time-regular-expressions"]
- path = p2p/ctre
+ path = lib-shared/ctre
url = https://github.com/hanickadot/compile-time-regular-expressions.git
[submodule "trezor-common"]
- path = p2p/trezor-common
+ path = lib-protocol/trezor-common
url = https://github.com/trezor/trezor-common.git
[submodule "bech32"]
- path = p2p/bech32
+ path = lib-shared/bech32
url = https://github.com/sipa/bech32.git
[submodule "pugixml"]
- path = p2p/pugixml
+ path = lib-protocol/pugixml
url = https://github.com/zeux/pugixml.git
[submodule "mediasoup"]
path = eng-mediasoup/mediasoup
@@ -197,7 +188,7 @@
path = min-webrtc/crc32c
url = https://github.com/google/crc32c.git
[submodule "snappy"]
- path = p2p/snappy
+ path = lib-protocol/snappy
url = https://github.com/google/snappy.git
[submodule "pcre2"]
path = min-pcre2/pcre2
@@ -226,6 +217,12 @@
[submodule "mingw-w64"]
path = env/mingw-w64
url = https://git.code.sf.net/p/mingw-w64/mingw-w64
-[submodule "base"]
- path = min-v8/base
- url = https://chromium.googlesource.com/chromium/src/base
+[submodule "FP16"]
+ path = min-v8/FP16
+ url = https://github.com/Maratyszcza/FP16.git
+[submodule "boringssl"]
+ path = min-boringssl/boringssl
+ url = https://boringssl.googlesource.com/boringssl
+[submodule "llvm-project"]
+ path = env/llvm-project
+ url = https://github.com/llvm/llvm-project.git
diff --git a/app-ios/env b/app-ios/env
index f8b6ffdfe..971e97aa3 120000
--- a/app-ios/env
+++ b/app-ios/env
@@ -1 +1 @@
-vpn/shared/p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/app-macos/env b/app-macos/env
index f8b6ffdfe..971e97aa3 120000
--- a/app-macos/env
+++ b/app-macos/env
@@ -1 +1 @@
-vpn/shared/p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/app-windows/makefile b/app-windows/makefile
index bd6bf916c..311556351 100644
--- a/app-windows/makefile
+++ b/app-windows/makefile
@@ -31,6 +31,9 @@ source += $(wildcard $(pwd)/source/*.rc)
$(call include,shared/target-win.mk)
+# XXX: due to flutter window_size plugin
+cflags += -Wno-deprecated-declarations
+
include env/output.mk
$(output)/package/$(name)$(exe): $(patsubst %,$(output)/$(machine)/%,$(object) $(linked))
diff --git a/cli-shared/env b/cli-shared/env
index db4309187..971e97aa3 120000
--- a/cli-shared/env
+++ b/cli-shared/env
@@ -1 +1 @@
-vpn/p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/p2p/source/android.cpp b/env/android.cpp
similarity index 97%
rename from p2p/source/android.cpp
rename to env/android.cpp
index 7675f280d..2636e63b5 100644
--- a/p2p/source/android.cpp
+++ b/env/android.cpp
@@ -20,8 +20,6 @@
/* }}} */
-#ifdef __ANDROID__
-
// some rust projects depend indirectly on the nix crate
// and rust object files have leaky translation units :(
// so linking the archive tries to pull in these symbols
@@ -35,5 +33,3 @@ extern "C" int getgrgid_r(gid_t gid, struct group *grp, char *buffer, size_t buf
extern "C" int getgrnam_r(const char *name, struct group *grp, char *buffer, size_t bufsize, struct group **result) {
orc_insist(false);
}
-
-#endif
diff --git a/env/extra/__config_site b/env/extra/__config_site
new file mode 100644
index 000000000..00b0dd9b1
--- /dev/null
+++ b/env/extra/__config_site
@@ -0,0 +1,3 @@
+#define _LIBCPP_ABI_VERSION 2
+#define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
+#define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
diff --git a/env/libcxx b/env/libcxx
deleted file mode 160000
index 2076f539f..000000000
--- a/env/libcxx
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2076f539f410805ef88692b9c0ce0a0b882a7680
diff --git a/env/libcxx b/env/libcxx
new file mode 120000
index 000000000..2981ba46b
--- /dev/null
+++ b/env/libcxx
@@ -0,0 +1 @@
+llvm-project/libcxx
\ No newline at end of file
diff --git a/env/libcxxabi b/env/libcxxabi
deleted file mode 160000
index a88633b46..000000000
--- a/env/libcxxabi
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a88633b46c401e6be38b93cf08660f137f86664d
diff --git a/env/libcxxabi b/env/libcxxabi
new file mode 120000
index 000000000..50b90ee6b
--- /dev/null
+++ b/env/libcxxabi
@@ -0,0 +1 @@
+llvm-project/libcxxabi
\ No newline at end of file
diff --git a/env/llvm-project b/env/llvm-project
new file mode 160000
index 000000000..c4c5e79dd
--- /dev/null
+++ b/env/llvm-project
@@ -0,0 +1 @@
+Subproject commit c4c5e79dd4b4c78eee7cffd9b0d7394b5bedcf12
diff --git a/env/submodule.sh b/env/submodule.sh
index be48ef39a..a22a43895 100755
--- a/env/submodule.sh
+++ b/env/submodule.sh
@@ -1,7 +1,6 @@
#!/bin/bash
set -e
# XXX: flutter needs deep for an unknown reason; maybe this can be fixed?
-# XXX: googletest broke recently and doesn't even support HEAD and I sigh
# XXX: the other repositories need uploadpack.allowReachableSHA1InWant :(
-git submodule update --init --recursive "$@" -- app-shared/flutter min-cairo/libpng min-glib/{gnulib,libiconv} min-zlib/googletest p2p/lwip srv-worker/glibc vpn-shared/{libssh,tor}
+git submodule update --init --recursive "$@" -- app-shared/flutter min-cairo/libpng min-glib/{gnulib,libiconv} lib-protocol/lwip srv-worker/glibc vpn-shared/{libssh,tor}
git submodule update --init --recursive "$@" --depth 1
diff --git a/env/target-and.mk b/env/target-and.mk
index 3c33b14e7..d8029e9dd 100644
--- a/env/target-and.mk
+++ b/env/target-and.mk
@@ -91,3 +91,5 @@ lflags += -nostdlib++ -lc++abi
lflags += -lm -llog
wflags += -L$(CURDIR)/env/android
+
+source += env/android.cpp
diff --git a/env/target-cxx.mk b/env/target-cxx.mk
index 81c46af92..5ca57ff65 100644
--- a/env/target-cxx.mk
+++ b/env/target-cxx.mk
@@ -9,11 +9,18 @@
# }}}
+pwd/env := $(pwd)
+
xflags += -nostdinc++
xflags += -isystem $(CURDIR)/$(pwd)/libcxx/include
xflags += -isystem $(CURDIR)/$(pwd)/libcxxabi/include
+xflags += -isystem $(CURDIR)/$(pwd)/extra
+
+cflags/$(pwd)/libcxx/ += -I$(CURDIR)/$(pwd/env)/libcxx/src
+cflags/$(pwd)/libcxxabi/ += -I$(CURDIR)/$(pwd/env)/libcxx/src
source += $(wildcard $(pwd)/libcxx/src/*.cpp)
+source += $(wildcard $(pwd)/libcxx/src/ryu/*.cpp)
qflags += -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
cflags/$(pwd)/libcxx/ += -D_LIBCPP_BUILDING_LIBRARY=
@@ -26,15 +33,14 @@ else
cflags/$(pwd)/libcxx/ += -D__GLIBCXX__
endif
-cflags/$(pwd)/libcxx/src/exception.cpp += -Wno-\#warnings
-cflags/$(pwd)/libcxxabi/src/cxa_thread_atexit.cpp += -Wno-pointer-bool-conversion
+source += $(pwd)/libcxxabi/src/abort_message.cpp
+source += $(pwd)/libcxxabi/src/cxa_demangle.cpp
+source += $(pwd)/libcxxabi/src/cxa_guard.cpp
+source += $(pwd)/libcxxabi/src/cxa_virtual.cpp
-source += env/libcxxabi/src/abort_message.cpp
-source += env/libcxxabi/src/cxa_demangle.cpp
-source += env/libcxxabi/src/cxa_guard.cpp
-source += env/libcxxabi/src/cxa_virtual.cpp
-
-ifneq ($(target),win)
+ifeq ($(target),win)
+source += $(pwd)/libcxx/src/support/win32/thread_win32.cpp
+else
# this requires _LIBCXXABI_WEAK to be defined
-source += env/libcxxabi/src/cxa_thread_atexit.cpp
+source += $(pwd)/libcxxabi/src/cxa_thread_atexit.cpp
endif
diff --git a/env/target-lld.mk b/env/target-lld.mk
index bd1c399f6..0f303493b 100644
--- a/env/target-lld.mk
+++ b/env/target-lld.mk
@@ -12,7 +12,12 @@
include $(pwd)/target-gnu.mk
wflags += -fuse-ld=lld
-lflags += -Wl,--icf=all
lflags += -Wl,--error-limit=0
+ifeq ($(filter nostrip,$(debug)),)
+lflags += -Wl,--icf=all
+else
+lflags += -Wl,--icf=none
+endif
+
export LLD_VERSION := Linker: LLD
diff --git a/env/target-lnx.mk b/env/target-lnx.mk
index 3b336de50..0796e5415 100644
--- a/env/target-lnx.mk
+++ b/env/target-lnx.mk
@@ -79,12 +79,8 @@ endef
$(each)
ifeq ($(distro),)
-ifneq ($(centos/$(machine)),)
-distro := centos6 $(machine) $(centos/$(machine))
-else
distro := ubuntu bionic 7
endif
-endif
sysroot += $(output)/sysroot
diff --git a/eth-sender/lib b/eth-sender/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/eth-sender/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/eth-sender/makefile b/eth-sender/makefile
index 3fdb928dc..175c4d809 100644
--- a/eth-sender/makefile
+++ b/eth-sender/makefile
@@ -35,7 +35,7 @@ cflags += -I$(pwd)/source
# XXX: this literally crashes clang-tidy and I haven't filed the bug
checks/$(pwd)/source/main.cpp += -bugprone-unchecked-optional-access
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
include env/output.mk
$(output)/%/cj$(exe): $(patsubst %,$(output)/$$*/%,$(object) $(linked))
diff --git a/eth-sender/p2p b/eth-sender/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/eth-sender/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/p2p/SPCDNS b/lib-protocol/SPCDNS
similarity index 100%
rename from p2p/SPCDNS
rename to lib-protocol/SPCDNS
diff --git a/p2p/boringtun b/lib-protocol/boringtun
similarity index 100%
rename from p2p/boringtun
rename to lib-protocol/boringtun
diff --git a/lib-protocol/boringtun.mk b/lib-protocol/boringtun.mk
new file mode 100644
index 000000000..7b1f707d3
--- /dev/null
+++ b/lib-protocol/boringtun.mk
@@ -0,0 +1,23 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+linked += $(pwd)/boringtun/boringtun/librust.a
+cflags += -I$(pwd)/boringtun/boringtun/src
+features/$(pwd)/boringtun/boringtun += ffi-bindings
diff --git a/p2p/c-ares b/lib-protocol/c-ares
similarity index 100%
rename from p2p/c-ares
rename to lib-protocol/c-ares
diff --git a/p2p/c-ares.mk b/lib-protocol/c-ares.mk
similarity index 100%
rename from p2p/c-ares.mk
rename to lib-protocol/c-ares.mk
diff --git a/p2p/chains b/lib-protocol/chains
similarity index 100%
rename from p2p/chains
rename to lib-protocol/chains
diff --git a/p2p/challenge-bypass-ristretto-ffi b/lib-protocol/challenge-bypass-ristretto-ffi
similarity index 100%
rename from p2p/challenge-bypass-ristretto-ffi
rename to lib-protocol/challenge-bypass-ristretto-ffi
diff --git a/p2p/cpp-jwt b/lib-protocol/cpp-jwt
similarity index 100%
rename from p2p/cpp-jwt
rename to lib-protocol/cpp-jwt
diff --git a/p2p/curl b/lib-protocol/curl
similarity index 100%
rename from p2p/curl
rename to lib-protocol/curl
diff --git a/p2p/extra/arch/cc.h b/lib-protocol/extra/arch/cc.h
similarity index 100%
rename from p2p/extra/arch/cc.h
rename to lib-protocol/extra/arch/cc.h
diff --git a/p2p/extra/google/protobuf b/lib-protocol/extra/google/protobuf
similarity index 100%
rename from p2p/extra/google/protobuf
rename to lib-protocol/extra/google/protobuf
diff --git a/p2p/extra/inet.h b/lib-protocol/extra/inet.h
similarity index 100%
rename from p2p/extra/inet.h
rename to lib-protocol/extra/inet.h
diff --git a/p2p/extra/lwipopts.h b/lib-protocol/extra/lwipopts.h
similarity index 100%
rename from p2p/extra/lwipopts.h
rename to lib-protocol/extra/lwipopts.h
diff --git a/p2p/extra/ndisguid.h b/lib-protocol/extra/ndisguid.h
similarity index 100%
rename from p2p/extra/ndisguid.h
rename to lib-protocol/extra/ndisguid.h
diff --git a/p2p/extra/openvpn/netconf/hwaddr.hpp b/lib-protocol/extra/openvpn/netconf/hwaddr.hpp
similarity index 100%
rename from p2p/extra/openvpn/netconf/hwaddr.hpp
rename to lib-protocol/extra/openvpn/netconf/hwaddr.hpp
diff --git a/p2p/extra/ovpncli.hpp b/lib-protocol/extra/ovpncli.hpp
similarity index 100%
rename from p2p/extra/ovpncli.hpp
rename to lib-protocol/extra/ovpncli.hpp
diff --git a/p2p/extra/snappy-stubs-public.h b/lib-protocol/extra/snappy-stubs-public.h
similarity index 100%
rename from p2p/extra/snappy-stubs-public.h
rename to lib-protocol/extra/snappy-stubs-public.h
diff --git a/p2p/extra/sockets.h b/lib-protocol/extra/sockets.h
similarity index 100%
rename from p2p/extra/sockets.h
rename to lib-protocol/extra/sockets.h
diff --git a/p2p/extra/third_party/protobuf b/lib-protocol/extra/third_party/protobuf
similarity index 100%
rename from p2p/extra/third_party/protobuf
rename to lib-protocol/extra/third_party/protobuf
diff --git a/p2p/extra/wincrypt.h b/lib-protocol/extra/wincrypt.h
similarity index 100%
rename from p2p/extra/wincrypt.h
rename to lib-protocol/extra/wincrypt.h
diff --git a/p2p/field.h b/lib-protocol/field.h
similarity index 100%
rename from p2p/field.h
rename to lib-protocol/field.h
diff --git a/lib-protocol/jwt.mk b/lib-protocol/jwt.mk
new file mode 100644
index 000000000..c9c5ee2dd
--- /dev/null
+++ b/lib-protocol/jwt.mk
@@ -0,0 +1,21 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+cflags += -I$(pwd)/cpp-jwt/include
diff --git a/p2p/krypton b/lib-protocol/krypton
similarity index 100%
rename from p2p/krypton
rename to lib-protocol/krypton
diff --git a/p2p/libutp b/lib-protocol/libutp
similarity index 100%
rename from p2p/libutp
rename to lib-protocol/libutp
diff --git a/lib-protocol/libutp.mk b/lib-protocol/libutp.mk
new file mode 100644
index 000000000..ad68deac4
--- /dev/null
+++ b/lib-protocol/libutp.mk
@@ -0,0 +1,34 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(filter-out \
+ %/libutp_inet_ntop.cpp \
+,$(wildcard $(pwd)/libutp/*.cpp))
+
+cflags += -I$(pwd)/libutp
+cflags/$(pwd)/libutp/ += -Wno-unused-const-variable
+cflags/$(pwd)/libutp/ += -Wno-unused-variable
+
+ifeq ($(target),win)
+source += $(pwd)/libutp/libutp_inet_ntop.cpp
+cflags += -DWIN32
+else
+cflags += -DPOSIX=5
+endif
diff --git a/p2p/lwip b/lib-protocol/lwip
similarity index 100%
rename from p2p/lwip
rename to lib-protocol/lwip
diff --git a/lib-protocol/lwip.mk b/lib-protocol/lwip.mk
new file mode 100644
index 000000000..e3d9a45cf
--- /dev/null
+++ b/lib-protocol/lwip.mk
@@ -0,0 +1,47 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(wildcard $(pwd)/lwip/src/api/*.c)
+source += $(wildcard $(pwd)/lwip/src/core/*.c)
+source += $(wildcard $(pwd)/lwip/src/core/ipv4/*.c)
+source += $(wildcard $(pwd)/lwip/src/core/ipv6/*.c)
+source += $(pwd)/lwip/src/netif/ethernet.c
+
+ifeq ($(target),and)
+cflags/$(pwd)/lwip/ += -Wno-missing-braces
+endif
+
+ifeq ($(target),win)
+source += $(pwd)/lwip/contrib/ports/win32/sys_arch.c
+cflags/$(pwd)/lwip/contrib/ports/win32/sys_arch.c += -UWIN32_LEAN_AND_MEAN
+cflags += -I$(pwd)/lwip/contrib/ports/win32/include
+else
+source += $(pwd)/lwip/contrib/ports/unix/port/sys_arch.c
+cflags += -I$(pwd)/lwip/contrib/ports/unix/port/include
+endif
+
+cflags += -I$(pwd)/lwip/src/include
+
+cflags += -DLWIP_ERRNO_STDINCLUDE
+cflags += -DLWIP_TCP
+
+ifeq ($(target),lnx)
+cflags += -DTCP_USER_TIMEOUT=18
+endif
diff --git a/p2p/lwip.sh b/lib-protocol/lwip.sh
similarity index 100%
rename from p2p/lwip.sh
rename to lib-protocol/lwip.sh
diff --git a/p2p/lz4 b/lib-protocol/lz4
similarity index 100%
rename from p2p/lz4
rename to lib-protocol/lz4
diff --git a/p2p/openvpn3 b/lib-protocol/openvpn3
similarity index 100%
rename from p2p/openvpn3
rename to lib-protocol/openvpn3
diff --git a/p2p/openvpn3.mk b/lib-protocol/openvpn3.mk
similarity index 100%
rename from p2p/openvpn3.mk
rename to lib-protocol/openvpn3.mk
diff --git a/p2p/protobuf b/lib-protocol/protobuf
similarity index 100%
rename from p2p/protobuf
rename to lib-protocol/protobuf
diff --git a/p2p/protobuf.mk b/lib-protocol/protobuf.mk
similarity index 100%
rename from p2p/protobuf.mk
rename to lib-protocol/protobuf.mk
diff --git a/p2p/pugixml b/lib-protocol/pugixml
similarity index 100%
rename from p2p/pugixml
rename to lib-protocol/pugixml
diff --git a/lib-protocol/pugixml.mk b/lib-protocol/pugixml.mk
new file mode 100644
index 000000000..72eb0e8b9
--- /dev/null
+++ b/lib-protocol/pugixml.mk
@@ -0,0 +1,23 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(pwd)/pugixml/src/pugixml.cpp
+cflags += -I$(pwd)/pugixml/src
+cflags += -DPUGIXML_HAS_LONG_LONG
diff --git a/lib-protocol/ristretto.mk b/lib-protocol/ristretto.mk
new file mode 100644
index 000000000..a4c1ea532
--- /dev/null
+++ b/lib-protocol/ristretto.mk
@@ -0,0 +1,23 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+linked += $(pwd)/challenge-bypass-ristretto-ffi/librust.a
+cflags += -I$(pwd)/challenge-bypass-ristretto-ffi/src
+source += $(pwd)/challenge-bypass-ristretto-ffi/src/wrapper.cpp
diff --git a/lib-protocol/shared b/lib-protocol/shared
new file mode 120000
index 000000000..005659d22
--- /dev/null
+++ b/lib-protocol/shared
@@ -0,0 +1 @@
+../lib-shared
\ No newline at end of file
diff --git a/p2p/snappy b/lib-protocol/snappy
similarity index 100%
rename from p2p/snappy
rename to lib-protocol/snappy
diff --git a/lib-protocol/snappy.mk b/lib-protocol/snappy.mk
new file mode 100644
index 000000000..b56f730d0
--- /dev/null
+++ b/lib-protocol/snappy.mk
@@ -0,0 +1,23 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(pwd)/snappy/snappy.cc
+source += $(pwd)/snappy/snappy-sinksource.cc
+cflags += -I$(pwd)/snappy
diff --git a/p2p/source/acceptor.hpp b/lib-protocol/source/acceptor.hpp
similarity index 100%
rename from p2p/source/acceptor.hpp
rename to lib-protocol/source/acceptor.hpp
diff --git a/p2p/source/adapter.hpp b/lib-protocol/source/adapter.hpp
similarity index 100%
rename from p2p/source/adapter.hpp
rename to lib-protocol/source/adapter.hpp
diff --git a/p2p/source/base.cpp b/lib-protocol/source/base.cpp
similarity index 100%
rename from p2p/source/base.cpp
rename to lib-protocol/source/base.cpp
diff --git a/p2p/source/base.hpp b/lib-protocol/source/base.hpp
similarity index 100%
rename from p2p/source/base.hpp
rename to lib-protocol/source/base.hpp
diff --git a/p2p/source/baton.cpp b/lib-protocol/source/baton.cpp
similarity index 100%
rename from p2p/source/baton.cpp
rename to lib-protocol/source/baton.cpp
diff --git a/p2p/source/baton.hpp b/lib-protocol/source/baton.hpp
similarity index 100%
rename from p2p/source/baton.hpp
rename to lib-protocol/source/baton.hpp
diff --git a/p2p/source/bearer.hpp b/lib-protocol/source/bearer.hpp
similarity index 100%
rename from p2p/source/bearer.hpp
rename to lib-protocol/source/bearer.hpp
diff --git a/p2p/source/beast.hpp b/lib-protocol/source/beast.hpp
similarity index 100%
rename from p2p/source/beast.hpp
rename to lib-protocol/source/beast.hpp
diff --git a/p2p/source/bench.hpp b/lib-protocol/source/bench.hpp
similarity index 100%
rename from p2p/source/bench.hpp
rename to lib-protocol/source/bench.hpp
diff --git a/p2p/source/binance.cpp b/lib-protocol/source/binance.cpp
similarity index 100%
rename from p2p/source/binance.cpp
rename to lib-protocol/source/binance.cpp
diff --git a/p2p/source/bonded.hpp b/lib-protocol/source/bonded.hpp
similarity index 100%
rename from p2p/source/bonded.hpp
rename to lib-protocol/source/bonded.hpp
diff --git a/p2p/source/boring.cpp b/lib-protocol/source/boring.cpp
similarity index 100%
rename from p2p/source/boring.cpp
rename to lib-protocol/source/boring.cpp
diff --git a/p2p/source/boring.hpp b/lib-protocol/source/boring.hpp
similarity index 100%
rename from p2p/source/boring.hpp
rename to lib-protocol/source/boring.hpp
diff --git a/p2p/source/butcher.hpp b/lib-protocol/source/butcher.hpp
similarity index 100%
rename from p2p/source/butcher.hpp
rename to lib-protocol/source/butcher.hpp
diff --git a/p2p/source/cache.hpp b/lib-protocol/source/cache.hpp
similarity index 100%
rename from p2p/source/cache.hpp
rename to lib-protocol/source/cache.hpp
diff --git a/p2p/source/cairo.hpp b/lib-protocol/source/cairo.hpp
similarity index 100%
rename from p2p/source/cairo.hpp
rename to lib-protocol/source/cairo.hpp
diff --git a/p2p/source/candidate.cpp b/lib-protocol/source/candidate.cpp
similarity index 100%
rename from p2p/source/candidate.cpp
rename to lib-protocol/source/candidate.cpp
diff --git a/p2p/source/chain.cpp b/lib-protocol/source/chain.cpp
similarity index 100%
rename from p2p/source/chain.cpp
rename to lib-protocol/source/chain.cpp
diff --git a/p2p/source/chain.hpp b/lib-protocol/source/chain.hpp
similarity index 100%
rename from p2p/source/chain.hpp
rename to lib-protocol/source/chain.hpp
diff --git a/p2p/source/chainlink.cpp b/lib-protocol/source/chainlink.cpp
similarity index 100%
rename from p2p/source/chainlink.cpp
rename to lib-protocol/source/chainlink.cpp
diff --git a/p2p/source/chainlink.hpp b/lib-protocol/source/chainlink.hpp
similarity index 100%
rename from p2p/source/chainlink.hpp
rename to lib-protocol/source/chainlink.hpp
diff --git a/p2p/source/channel.cpp b/lib-protocol/source/channel.cpp
similarity index 100%
rename from p2p/source/channel.cpp
rename to lib-protocol/source/channel.cpp
diff --git a/p2p/source/channel.hpp b/lib-protocol/source/channel.hpp
similarity index 100%
rename from p2p/source/channel.hpp
rename to lib-protocol/source/channel.hpp
diff --git a/p2p/source/chart.cpp b/lib-protocol/source/chart.cpp
similarity index 100%
rename from p2p/source/chart.cpp
rename to lib-protocol/source/chart.cpp
diff --git a/p2p/source/chart.hpp b/lib-protocol/source/chart.hpp
similarity index 100%
rename from p2p/source/chart.hpp
rename to lib-protocol/source/chart.hpp
diff --git a/p2p/source/cipher.cpp b/lib-protocol/source/cipher.cpp
similarity index 100%
rename from p2p/source/cipher.cpp
rename to lib-protocol/source/cipher.cpp
diff --git a/p2p/source/cipher.hpp b/lib-protocol/source/cipher.hpp
similarity index 100%
rename from p2p/source/cipher.hpp
rename to lib-protocol/source/cipher.hpp
diff --git a/p2p/source/coinbase.cpp b/lib-protocol/source/coinbase.cpp
similarity index 100%
rename from p2p/source/coinbase.cpp
rename to lib-protocol/source/coinbase.cpp
diff --git a/p2p/source/configuration.hpp b/lib-protocol/source/configuration.hpp
similarity index 100%
rename from p2p/source/configuration.hpp
rename to lib-protocol/source/configuration.hpp
diff --git a/p2p/source/connection.hpp b/lib-protocol/source/connection.hpp
similarity index 100%
rename from p2p/source/connection.hpp
rename to lib-protocol/source/connection.hpp
diff --git a/p2p/source/contract.hpp b/lib-protocol/source/contract.hpp
similarity index 100%
rename from p2p/source/contract.hpp
rename to lib-protocol/source/contract.hpp
diff --git a/p2p/source/currency.cpp b/lib-protocol/source/currency.cpp
similarity index 100%
rename from p2p/source/currency.cpp
rename to lib-protocol/source/currency.cpp
diff --git a/p2p/source/currency.hpp b/lib-protocol/source/currency.hpp
similarity index 100%
rename from p2p/source/currency.hpp
rename to lib-protocol/source/currency.hpp
diff --git a/p2p/source/datagram.cpp b/lib-protocol/source/datagram.cpp
similarity index 100%
rename from p2p/source/datagram.cpp
rename to lib-protocol/source/datagram.cpp
diff --git a/p2p/source/datagram.hpp b/lib-protocol/source/datagram.hpp
similarity index 100%
rename from p2p/source/datagram.hpp
rename to lib-protocol/source/datagram.hpp
diff --git a/p2p/source/defragment.cpp b/lib-protocol/source/defragment.cpp
similarity index 100%
rename from p2p/source/defragment.cpp
rename to lib-protocol/source/defragment.cpp
diff --git a/p2p/source/defragment.hpp b/lib-protocol/source/defragment.hpp
similarity index 100%
rename from p2p/source/defragment.hpp
rename to lib-protocol/source/defragment.hpp
diff --git a/p2p/source/dns.cpp b/lib-protocol/source/dns.cpp
similarity index 100%
rename from p2p/source/dns.cpp
rename to lib-protocol/source/dns.cpp
diff --git a/p2p/source/dns.hpp b/lib-protocol/source/dns.hpp
similarity index 100%
rename from p2p/source/dns.hpp
rename to lib-protocol/source/dns.hpp
diff --git a/p2p/source/drain.hpp b/lib-protocol/source/drain.hpp
similarity index 100%
rename from p2p/source/drain.hpp
rename to lib-protocol/source/drain.hpp
diff --git a/p2p/source/duplex.cpp b/lib-protocol/source/duplex.cpp
similarity index 100%
rename from p2p/source/duplex.cpp
rename to lib-protocol/source/duplex.cpp
diff --git a/p2p/source/duplex.hpp b/lib-protocol/source/duplex.hpp
similarity index 100%
rename from p2p/source/duplex.hpp
rename to lib-protocol/source/duplex.hpp
diff --git a/p2p/source/encoding.cpp b/lib-protocol/source/encoding.cpp
similarity index 100%
rename from p2p/source/encoding.cpp
rename to lib-protocol/source/encoding.cpp
diff --git a/p2p/source/encoding.hpp b/lib-protocol/source/encoding.hpp
similarity index 100%
rename from p2p/source/encoding.hpp
rename to lib-protocol/source/encoding.hpp
diff --git a/p2p/source/endpoint.cpp b/lib-protocol/source/endpoint.cpp
similarity index 100%
rename from p2p/source/endpoint.cpp
rename to lib-protocol/source/endpoint.cpp
diff --git a/p2p/source/endpoint.hpp b/lib-protocol/source/endpoint.hpp
similarity index 100%
rename from p2p/source/endpoint.hpp
rename to lib-protocol/source/endpoint.hpp
diff --git a/p2p/source/ethereum.cpp b/lib-protocol/source/ethereum.cpp
similarity index 100%
rename from p2p/source/ethereum.cpp
rename to lib-protocol/source/ethereum.cpp
diff --git a/p2p/source/ethereum.hpp b/lib-protocol/source/ethereum.hpp
similarity index 100%
rename from p2p/source/ethereum.hpp
rename to lib-protocol/source/ethereum.hpp
diff --git a/p2p/source/event.hpp b/lib-protocol/source/event.hpp
similarity index 100%
rename from p2p/source/event.hpp
rename to lib-protocol/source/event.hpp
diff --git a/p2p/source/execute.hpp b/lib-protocol/source/execute.hpp
similarity index 100%
rename from p2p/source/execute.hpp
rename to lib-protocol/source/execute.hpp
diff --git a/p2p/source/executor.cpp b/lib-protocol/source/executor.cpp
similarity index 100%
rename from p2p/source/executor.cpp
rename to lib-protocol/source/executor.cpp
diff --git a/p2p/source/executor.hpp b/lib-protocol/source/executor.hpp
similarity index 100%
rename from p2p/source/executor.hpp
rename to lib-protocol/source/executor.hpp
diff --git a/p2p/source/fetcher.hpp b/lib-protocol/source/fetcher.hpp
similarity index 100%
rename from p2p/source/fetcher.hpp
rename to lib-protocol/source/fetcher.hpp
diff --git a/p2p/source/fiat.hpp b/lib-protocol/source/fiat.hpp
similarity index 100%
rename from p2p/source/fiat.hpp
rename to lib-protocol/source/fiat.hpp
diff --git a/p2p/source/file.hpp b/lib-protocol/source/file.hpp
similarity index 100%
rename from p2p/source/file.hpp
rename to lib-protocol/source/file.hpp
diff --git a/p2p/source/forge.cpp b/lib-protocol/source/forge.cpp
similarity index 100%
rename from p2p/source/forge.cpp
rename to lib-protocol/source/forge.cpp
diff --git a/p2p/source/forge.hpp b/lib-protocol/source/forge.hpp
similarity index 100%
rename from p2p/source/forge.hpp
rename to lib-protocol/source/forge.hpp
diff --git a/p2p/source/format.hpp b/lib-protocol/source/format.hpp
similarity index 100%
rename from p2p/source/format.hpp
rename to lib-protocol/source/format.hpp
diff --git a/p2p/source/function.hpp b/lib-protocol/source/function.hpp
similarity index 100%
rename from p2p/source/function.hpp
rename to lib-protocol/source/function.hpp
diff --git a/p2p/source/huobi.cpp b/lib-protocol/source/huobi.cpp
similarity index 100%
rename from p2p/source/huobi.cpp
rename to lib-protocol/source/huobi.cpp
diff --git a/p2p/source/huobi.hpp b/lib-protocol/source/huobi.hpp
similarity index 100%
rename from p2p/source/huobi.hpp
rename to lib-protocol/source/huobi.hpp
diff --git a/p2p/source/jsonrpc.hpp b/lib-protocol/source/jsonrpc.hpp
similarity index 100%
rename from p2p/source/jsonrpc.hpp
rename to lib-protocol/source/jsonrpc.hpp
diff --git a/p2p/source/kraken.cpp b/lib-protocol/source/kraken.cpp
similarity index 100%
rename from p2p/source/kraken.cpp
rename to lib-protocol/source/kraken.cpp
diff --git a/p2p/source/layer.hpp b/lib-protocol/source/layer.hpp
similarity index 100%
rename from p2p/source/layer.hpp
rename to lib-protocol/source/layer.hpp
diff --git a/p2p/source/link.hpp b/lib-protocol/source/link.hpp
similarity index 100%
rename from p2p/source/link.hpp
rename to lib-protocol/source/link.hpp
diff --git a/p2p/source/load.cpp b/lib-protocol/source/load.cpp
similarity index 100%
rename from p2p/source/load.cpp
rename to lib-protocol/source/load.cpp
diff --git a/p2p/source/load.hpp b/lib-protocol/source/load.hpp
similarity index 100%
rename from p2p/source/load.hpp
rename to lib-protocol/source/load.hpp
diff --git a/p2p/source/local.cpp b/lib-protocol/source/local.cpp
similarity index 100%
rename from p2p/source/local.cpp
rename to lib-protocol/source/local.cpp
diff --git a/p2p/source/local.hpp b/lib-protocol/source/local.hpp
similarity index 100%
rename from p2p/source/local.hpp
rename to lib-protocol/source/local.hpp
diff --git a/p2p/source/locator.cpp b/lib-protocol/source/locator.cpp
similarity index 100%
rename from p2p/source/locator.cpp
rename to lib-protocol/source/locator.cpp
diff --git a/p2p/source/locator.hpp b/lib-protocol/source/locator.hpp
similarity index 100%
rename from p2p/source/locator.hpp
rename to lib-protocol/source/locator.hpp
diff --git a/p2p/source/logical_.hpp b/lib-protocol/source/logical_.hpp
similarity index 100%
rename from p2p/source/logical_.hpp
rename to lib-protocol/source/logical_.hpp
diff --git a/p2p/source/lwip.cpp b/lib-protocol/source/lwip.cpp
similarity index 100%
rename from p2p/source/lwip.cpp
rename to lib-protocol/source/lwip.cpp
diff --git a/p2p/source/lwip.hpp b/lib-protocol/source/lwip.hpp
similarity index 100%
rename from p2p/source/lwip.hpp
rename to lib-protocol/source/lwip.hpp
diff --git a/p2p/source/manager.hpp b/lib-protocol/source/manager.hpp
similarity index 100%
rename from p2p/source/manager.hpp
rename to lib-protocol/source/manager.hpp
diff --git a/p2p/source/market.cpp b/lib-protocol/source/market.cpp
similarity index 100%
rename from p2p/source/market.cpp
rename to lib-protocol/source/market.cpp
diff --git a/p2p/source/market.hpp b/lib-protocol/source/market.hpp
similarity index 100%
rename from p2p/source/market.hpp
rename to lib-protocol/source/market.hpp
diff --git a/p2p/source/markup.hpp b/lib-protocol/source/markup.hpp
similarity index 100%
rename from p2p/source/markup.hpp
rename to lib-protocol/source/markup.hpp
diff --git a/p2p/source/memory.cpp b/lib-protocol/source/memory.cpp
similarity index 100%
rename from p2p/source/memory.cpp
rename to lib-protocol/source/memory.cpp
diff --git a/p2p/source/memory.hpp b/lib-protocol/source/memory.hpp
similarity index 100%
rename from p2p/source/memory.hpp
rename to lib-protocol/source/memory.hpp
diff --git a/p2p/source/negotiate.cpp b/lib-protocol/source/negotiate.cpp
similarity index 100%
rename from p2p/source/negotiate.cpp
rename to lib-protocol/source/negotiate.cpp
diff --git a/p2p/source/nest.hpp b/lib-protocol/source/nest.hpp
similarity index 100%
rename from p2p/source/nest.hpp
rename to lib-protocol/source/nest.hpp
diff --git a/p2p/source/nested.cpp b/lib-protocol/source/nested.cpp
similarity index 100%
rename from p2p/source/nested.cpp
rename to lib-protocol/source/nested.cpp
diff --git a/p2p/source/nested.hpp b/lib-protocol/source/nested.hpp
similarity index 100%
rename from p2p/source/nested.hpp
rename to lib-protocol/source/nested.hpp
diff --git a/p2p/source/parallel.hpp b/lib-protocol/source/parallel.hpp
similarity index 100%
rename from p2p/source/parallel.hpp
rename to lib-protocol/source/parallel.hpp
diff --git a/p2p/source/peer.cpp b/lib-protocol/source/peer.cpp
similarity index 100%
rename from p2p/source/peer.cpp
rename to lib-protocol/source/peer.cpp
diff --git a/p2p/source/peer.hpp b/lib-protocol/source/peer.hpp
similarity index 100%
rename from p2p/source/peer.hpp
rename to lib-protocol/source/peer.hpp
diff --git a/p2p/source/pile.hpp b/lib-protocol/source/pile.hpp
similarity index 100%
rename from p2p/source/pile.hpp
rename to lib-protocol/source/pile.hpp
diff --git a/p2p/source/pirate.hpp b/lib-protocol/source/pirate.hpp
similarity index 100%
rename from p2p/source/pirate.hpp
rename to lib-protocol/source/pirate.hpp
diff --git a/p2p/source/port.hpp b/lib-protocol/source/port.hpp
similarity index 100%
rename from p2p/source/port.hpp
rename to lib-protocol/source/port.hpp
diff --git a/p2p/source/pricing.hpp b/lib-protocol/source/pricing.hpp
similarity index 100%
rename from p2p/source/pricing.hpp
rename to lib-protocol/source/pricing.hpp
diff --git a/p2p/source/protocol.cpp b/lib-protocol/source/protocol.cpp
similarity index 100%
rename from p2p/source/protocol.cpp
rename to lib-protocol/source/protocol.cpp
diff --git a/p2p/source/protocol.hpp b/lib-protocol/source/protocol.hpp
similarity index 100%
rename from p2p/source/protocol.hpp
rename to lib-protocol/source/protocol.hpp
diff --git a/p2p/source/query.hpp b/lib-protocol/source/query.hpp
similarity index 100%
rename from p2p/source/query.hpp
rename to lib-protocol/source/query.hpp
diff --git a/p2p/source/reader.hpp b/lib-protocol/source/reader.hpp
similarity index 100%
rename from p2p/source/reader.hpp
rename to lib-protocol/source/reader.hpp
diff --git a/p2p/source/regex.hpp b/lib-protocol/source/regex.hpp
similarity index 100%
rename from p2p/source/regex.hpp
rename to lib-protocol/source/regex.hpp
diff --git a/p2p/source/remote.cpp b/lib-protocol/source/remote.cpp
similarity index 100%
rename from p2p/source/remote.cpp
rename to lib-protocol/source/remote.cpp
diff --git a/p2p/source/remote.hpp b/lib-protocol/source/remote.hpp
similarity index 100%
rename from p2p/source/remote.hpp
rename to lib-protocol/source/remote.hpp
diff --git a/p2p/source/request.cpp b/lib-protocol/source/request.cpp
similarity index 100%
rename from p2p/source/request.cpp
rename to lib-protocol/source/request.cpp
diff --git a/p2p/source/request.hpp b/lib-protocol/source/request.hpp
similarity index 100%
rename from p2p/source/request.hpp
rename to lib-protocol/source/request.hpp
diff --git a/p2p/source/response.hpp b/lib-protocol/source/response.hpp
similarity index 100%
rename from p2p/source/response.hpp
rename to lib-protocol/source/response.hpp
diff --git a/p2p/source/retry.hpp b/lib-protocol/source/retry.hpp
similarity index 100%
rename from p2p/source/retry.hpp
rename to lib-protocol/source/retry.hpp
diff --git a/p2p/source/segwit.cpp b/lib-protocol/source/segwit.cpp
similarity index 100%
rename from p2p/source/segwit.cpp
rename to lib-protocol/source/segwit.cpp
diff --git a/p2p/source/segwit.hpp b/lib-protocol/source/segwit.hpp
similarity index 100%
rename from p2p/source/segwit.hpp
rename to lib-protocol/source/segwit.hpp
diff --git a/p2p/source/sequence.hpp b/lib-protocol/source/sequence.hpp
similarity index 100%
rename from p2p/source/sequence.hpp
rename to lib-protocol/source/sequence.hpp
diff --git a/p2p/source/sewer.hpp b/lib-protocol/source/sewer.hpp
similarity index 100%
rename from p2p/source/sewer.hpp
rename to lib-protocol/source/sewer.hpp
diff --git a/p2p/source/signed.hpp b/lib-protocol/source/signed.hpp
similarity index 100%
rename from p2p/source/signed.hpp
rename to lib-protocol/source/signed.hpp
diff --git a/p2p/source/site.cpp b/lib-protocol/source/site.cpp
similarity index 100%
rename from p2p/source/site.cpp
rename to lib-protocol/source/site.cpp
diff --git a/p2p/source/site.hpp b/lib-protocol/source/site.hpp
similarity index 100%
rename from p2p/source/site.hpp
rename to lib-protocol/source/site.hpp
diff --git a/p2p/source/sleep.cpp b/lib-protocol/source/sleep.cpp
similarity index 100%
rename from p2p/source/sleep.cpp
rename to lib-protocol/source/sleep.cpp
diff --git a/p2p/source/sleep.hpp b/lib-protocol/source/sleep.hpp
similarity index 100%
rename from p2p/source/sleep.hpp
rename to lib-protocol/source/sleep.hpp
diff --git a/p2p/source/socket.hpp b/lib-protocol/source/socket.hpp
similarity index 100%
rename from p2p/source/socket.hpp
rename to lib-protocol/source/socket.hpp
diff --git a/p2p/source/spawn.cpp b/lib-protocol/source/spawn.cpp
similarity index 100%
rename from p2p/source/spawn.cpp
rename to lib-protocol/source/spawn.cpp
diff --git a/p2p/source/spawn.hpp b/lib-protocol/source/spawn.hpp
similarity index 100%
rename from p2p/source/spawn.hpp
rename to lib-protocol/source/spawn.hpp
diff --git a/p2p/source/specific.hpp b/lib-protocol/source/specific.hpp
similarity index 100%
rename from p2p/source/specific.hpp
rename to lib-protocol/source/specific.hpp
diff --git a/p2p/source/station.cpp b/lib-protocol/source/station.cpp
similarity index 100%
rename from p2p/source/station.cpp
rename to lib-protocol/source/station.cpp
diff --git a/p2p/source/station.hpp b/lib-protocol/source/station.hpp
similarity index 100%
rename from p2p/source/station.hpp
rename to lib-protocol/source/station.hpp
diff --git a/p2p/source/store.cpp b/lib-protocol/source/store.cpp
similarity index 100%
rename from p2p/source/store.cpp
rename to lib-protocol/source/store.cpp
diff --git a/p2p/source/store.hpp b/lib-protocol/source/store.hpp
similarity index 100%
rename from p2p/source/store.hpp
rename to lib-protocol/source/store.hpp
diff --git a/p2p/source/structured.hpp b/lib-protocol/source/structured.hpp
similarity index 100%
rename from p2p/source/structured.hpp
rename to lib-protocol/source/structured.hpp
diff --git a/p2p/source/sync.hpp b/lib-protocol/source/sync.hpp
similarity index 100%
rename from p2p/source/sync.hpp
rename to lib-protocol/source/sync.hpp
diff --git a/p2p/source/tag.hpp b/lib-protocol/source/tag.hpp
similarity index 100%
rename from p2p/source/tag.hpp
rename to lib-protocol/source/tag.hpp
diff --git a/p2p/source/threads.cpp b/lib-protocol/source/threads.cpp
similarity index 100%
rename from p2p/source/threads.cpp
rename to lib-protocol/source/threads.cpp
diff --git a/p2p/source/threads.hpp b/lib-protocol/source/threads.hpp
similarity index 100%
rename from p2p/source/threads.hpp
rename to lib-protocol/source/threads.hpp
diff --git a/p2p/source/ticket.hpp b/lib-protocol/source/ticket.hpp
similarity index 100%
rename from p2p/source/ticket.hpp
rename to lib-protocol/source/ticket.hpp
diff --git a/p2p/source/token.cpp b/lib-protocol/source/token.cpp
similarity index 100%
rename from p2p/source/token.cpp
rename to lib-protocol/source/token.cpp
diff --git a/p2p/source/token.hpp b/lib-protocol/source/token.hpp
similarity index 100%
rename from p2p/source/token.hpp
rename to lib-protocol/source/token.hpp
diff --git a/p2p/source/trace.cpp b/lib-protocol/source/trace.cpp
similarity index 100%
rename from p2p/source/trace.cpp
rename to lib-protocol/source/trace.cpp
diff --git a/p2p/source/trace.hpp b/lib-protocol/source/trace.hpp
similarity index 100%
rename from p2p/source/trace.hpp
rename to lib-protocol/source/trace.hpp
diff --git a/p2p/source/translate.hpp b/lib-protocol/source/translate.hpp
similarity index 100%
rename from p2p/source/translate.hpp
rename to lib-protocol/source/translate.hpp
diff --git a/p2p/source/transport.cpp b/lib-protocol/source/transport.cpp
similarity index 100%
rename from p2p/source/transport.cpp
rename to lib-protocol/source/transport.cpp
diff --git a/p2p/source/transport.hpp b/lib-protocol/source/transport.hpp
similarity index 100%
rename from p2p/source/transport.hpp
rename to lib-protocol/source/transport.hpp
diff --git a/p2p/source/trezor.cpp b/lib-protocol/source/trezor.cpp
similarity index 100%
rename from p2p/source/trezor.cpp
rename to lib-protocol/source/trezor.cpp
diff --git a/p2p/source/trezor.hpp b/lib-protocol/source/trezor.hpp
similarity index 100%
rename from p2p/source/trezor.hpp
rename to lib-protocol/source/trezor.hpp
diff --git a/p2p/source/try.hpp b/lib-protocol/source/try.hpp
similarity index 100%
rename from p2p/source/try.hpp
rename to lib-protocol/source/try.hpp
diff --git a/p2p/source/tube.hpp b/lib-protocol/source/tube.hpp
similarity index 100%
rename from p2p/source/tube.hpp
rename to lib-protocol/source/tube.hpp
diff --git a/p2p/source/unique.cpp b/lib-protocol/source/unique.cpp
similarity index 100%
rename from p2p/source/unique.cpp
rename to lib-protocol/source/unique.cpp
diff --git a/p2p/source/unique.hpp b/lib-protocol/source/unique.hpp
similarity index 100%
rename from p2p/source/unique.hpp
rename to lib-protocol/source/unique.hpp
diff --git a/p2p/source/uniswap.cpp b/lib-protocol/source/uniswap.cpp
similarity index 100%
rename from p2p/source/uniswap.cpp
rename to lib-protocol/source/uniswap.cpp
diff --git a/p2p/source/uniswap.hpp b/lib-protocol/source/uniswap.hpp
similarity index 100%
rename from p2p/source/uniswap.hpp
rename to lib-protocol/source/uniswap.hpp
diff --git a/p2p/source/updated.hpp b/lib-protocol/source/updated.hpp
similarity index 100%
rename from p2p/source/updated.hpp
rename to lib-protocol/source/updated.hpp
diff --git a/p2p/source/updater.hpp b/lib-protocol/source/updater.hpp
similarity index 100%
rename from p2p/source/updater.hpp
rename to lib-protocol/source/updater.hpp
diff --git a/p2p/source/valve.cpp b/lib-protocol/source/valve.cpp
similarity index 100%
rename from p2p/source/valve.cpp
rename to lib-protocol/source/valve.cpp
diff --git a/p2p/source/valve.hpp b/lib-protocol/source/valve.hpp
similarity index 100%
rename from p2p/source/valve.hpp
rename to lib-protocol/source/valve.hpp
diff --git a/lib-protocol/spcdns.mk b/lib-protocol/spcdns.mk
new file mode 100644
index 000000000..6ea629731
--- /dev/null
+++ b/lib-protocol/spcdns.mk
@@ -0,0 +1,24 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(pwd)/SPCDNS/src/codec.c
+source += $(pwd)/SPCDNS/src/mappings.c
+source += $(pwd)/SPCDNS/src/output.c
+cflags += -I$(pwd)/SPCDNS/src
diff --git a/p2p/tap-windows6 b/lib-protocol/tap-windows6
similarity index 100%
rename from p2p/tap-windows6
rename to lib-protocol/tap-windows6
diff --git a/lib-protocol/target.mk b/lib-protocol/target.mk
new file mode 100644
index 000000000..ac5e98cdf
--- /dev/null
+++ b/lib-protocol/target.mk
@@ -0,0 +1,42 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+$(call include,shared/target.mk)
+
+source += $(wildcard $(pwd)/source/*.cpp)
+cflags += -I$(pwd)/source
+cflags += -I$(pwd)/extra
+
+ifeq ($(target),and)
+cflags/$(pwd)/source/lwip.cpp += -Wno-missing-braces
+endif
+
+$(call include,boringtun.mk)
+$(call include,c-ares.mk)
+$(call include,jwt.mk)
+$(call include,krypton/target.mk)
+$(call include,libutp.mk)
+$(call include,lwip.mk)
+$(call include,openvpn3.mk)
+$(call include,pugixml.mk)
+$(call include,ristretto.mk)
+$(call include,spcdns.mk)
+$(call include,trezor.mk)
+$(call include,webrtc/target.mk)
diff --git a/p2p/trezor-common b/lib-protocol/trezor-common
similarity index 100%
rename from p2p/trezor-common
rename to lib-protocol/trezor-common
diff --git a/lib-protocol/trezor.mk b/lib-protocol/trezor.mk
new file mode 100644
index 000000000..59c22a5b7
--- /dev/null
+++ b/lib-protocol/trezor.mk
@@ -0,0 +1,31 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+include $(pwd)/protobuf.mk
+
+$(eval $(call protobuf,,$(pwd)/trezor-common/protob))
+source += $(output)/pb/messages.pb.cc
+header += $(output)/pb/messages.pb.h
+source += $(output)/pb/messages-common.pb.cc
+header += $(output)/pb/messages-common.pb.h
+source += $(output)/pb/messages-ethereum.pb.cc
+header += $(output)/pb/messages-ethereum.pb.h
+source += $(output)/pb/messages-management.pb.cc
+header += $(output)/pb/messages-management.pb.h
diff --git a/p2p/rtc b/lib-protocol/webrtc
similarity index 100%
rename from p2p/rtc
rename to lib-protocol/webrtc
diff --git a/p2p/SHA3IUF b/lib-shared/SHA3IUF
similarity index 100%
rename from p2p/SHA3IUF
rename to lib-shared/SHA3IUF
diff --git a/min-webrtc/abseil-cpp b/lib-shared/abseil-cpp
similarity index 100%
rename from min-webrtc/abseil-cpp
rename to lib-shared/abseil-cpp
diff --git a/lib-shared/abseil.mk b/lib-shared/abseil.mk
new file mode 100644
index 000000000..07146725a
--- /dev/null
+++ b/lib-shared/abseil.mk
@@ -0,0 +1,29 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+source += $(filter-out \
+ %_benchmark.cc \
+ %_test.cc \
+ %_test_common.cc \
+ %_testing.cc \
+ %/absl/hash/internal/print_hash_of.cc \
+,$(foreach sub,base container crc debugging hash numeric profiling types strings synchronization time,$(wildcard $(pwd)/abseil-cpp/absl/$(sub)/*.cc $(pwd)/abseil-cpp/absl/$(sub)/internal/*.cc)) $(wildcard $(pwd)/abseil-cpp/absl/time/internal/cctz/src/*.cc))
+
+cflags += -I$(pwd)/abseil-cpp
diff --git a/p2p/asio.mk b/lib-shared/asio.mk
similarity index 100%
rename from p2p/asio.mk
rename to lib-shared/asio.mk
diff --git a/p2p/bech32 b/lib-shared/bech32
similarity index 100%
rename from p2p/bech32
rename to lib-shared/bech32
diff --git a/p2p/boost b/lib-shared/boost
similarity index 100%
rename from p2p/boost
rename to lib-shared/boost
diff --git a/lib-shared/boringssl b/lib-shared/boringssl
new file mode 120000
index 000000000..8c0dcd6e2
--- /dev/null
+++ b/lib-shared/boringssl
@@ -0,0 +1 @@
+../min-boringssl
\ No newline at end of file
diff --git a/p2p/cppcoro b/lib-shared/cppcoro
similarity index 100%
rename from p2p/cppcoro
rename to lib-shared/cppcoro
diff --git a/p2p/ctre b/lib-shared/ctre
similarity index 100%
rename from p2p/ctre
rename to lib-shared/ctre
diff --git a/p2p/eEVM b/lib-shared/eEVM
similarity index 100%
rename from p2p/eEVM
rename to lib-shared/eEVM
diff --git a/p2p/expected b/lib-shared/expected
similarity index 100%
rename from p2p/expected
rename to lib-shared/expected
diff --git a/min-webrtc/extra/absl/base/config.h b/lib-shared/extra/absl/base/config.h
similarity index 100%
rename from min-webrtc/extra/absl/base/config.h
rename to lib-shared/extra/absl/base/config.h
diff --git a/min-webrtc/extra/absl/base/options.h b/lib-shared/extra/absl/base/options.h
similarity index 100%
rename from min-webrtc/extra/absl/base/options.h
rename to lib-shared/extra/absl/base/options.h
diff --git a/p2p/extra/fmt/format_header_only.h b/lib-shared/extra/fmt/format_header_only.h
similarity index 100%
rename from p2p/extra/fmt/format_header_only.h
rename to lib-shared/extra/fmt/format_header_only.h
diff --git a/p2p/extra/libsecp256k1-config.h b/lib-shared/extra/libsecp256k1-config.h
similarity index 100%
rename from p2p/extra/libsecp256k1-config.h
rename to lib-shared/extra/libsecp256k1-config.h
diff --git a/p2p/extra/third_party/jsoncpp b/lib-shared/extra/third_party/jsoncpp
similarity index 100%
rename from p2p/extra/third_party/jsoncpp
rename to lib-shared/extra/third_party/jsoncpp
diff --git a/p2p/fmt b/lib-shared/fmt
similarity index 100%
rename from p2p/fmt
rename to lib-shared/fmt
diff --git a/lib-shared/intx b/lib-shared/intx
new file mode 160000
index 000000000..e0732242e
--- /dev/null
+++ b/lib-shared/intx
@@ -0,0 +1 @@
+Subproject commit e0732242e36b3bb08cc8cc23445b2bee7c28b9d0
diff --git a/p2p/jsoncpp b/lib-shared/jsoncpp
similarity index 100%
rename from p2p/jsoncpp
rename to lib-shared/jsoncpp
diff --git a/min-webrtc/ssl b/lib-shared/openssl
similarity index 100%
rename from min-webrtc/ssl
rename to lib-shared/openssl
diff --git a/p2p/secp256k1 b/lib-shared/secp256k1
similarity index 100%
rename from p2p/secp256k1
rename to lib-shared/secp256k1
diff --git a/lib-shared/secp256k1.mk b/lib-shared/secp256k1.mk
new file mode 100644
index 000000000..fa8984c86
--- /dev/null
+++ b/lib-shared/secp256k1.mk
@@ -0,0 +1,36 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+pwd/secp256k1 := $(pwd)/secp256k1
+source += $(pwd/secp256k1)/src/secp256k1.c
+source += $(pwd/secp256k1)/src/precomputed_ecmult.c
+source += $(pwd/secp256k1)/src/precomputed_ecmult_gen.c
+cflags += -I$(pwd/secp256k1)/include
+
+cflags/$(pwd/secp256k1)/ += -I$(pwd/secp256k1)
+cflags/$(pwd/secp256k1)/ += -I$(pwd/secp256k1)/src
+cflags/$(pwd/secp256k1)/ += -Wno-unused-function
+
+cflags += -DSECP256K1_STATIC
+
+cflags += -DENABLE_MODULE_RECOVERY
+cflags += -DENABLE_MODULE_ECDH
+cflags += -DECMULT_WINDOW_SIZE=15
+cflags += -DECMULT_GEN_PREC_BITS=4
diff --git a/p2p/source/address.cpp b/lib-shared/source/address.cpp
similarity index 100%
rename from p2p/source/address.cpp
rename to lib-shared/source/address.cpp
diff --git a/p2p/source/address.hpp b/lib-shared/source/address.hpp
similarity index 100%
rename from p2p/source/address.hpp
rename to lib-shared/source/address.hpp
diff --git a/p2p/source/asio.hpp b/lib-shared/source/asio.hpp
similarity index 100%
rename from p2p/source/asio.hpp
rename to lib-shared/source/asio.hpp
diff --git a/p2p/source/base58.cpp b/lib-shared/source/base58.cpp
similarity index 100%
rename from p2p/source/base58.cpp
rename to lib-shared/source/base58.cpp
diff --git a/p2p/source/base58.hpp b/lib-shared/source/base58.hpp
similarity index 100%
rename from p2p/source/base58.hpp
rename to lib-shared/source/base58.hpp
diff --git a/p2p/source/base64.cpp b/lib-shared/source/base64.cpp
similarity index 100%
rename from p2p/source/base64.cpp
rename to lib-shared/source/base64.cpp
diff --git a/p2p/source/base64.hpp b/lib-shared/source/base64.hpp
similarity index 100%
rename from p2p/source/base64.hpp
rename to lib-shared/source/base64.hpp
diff --git a/p2p/source/buffer.cpp b/lib-shared/source/buffer.cpp
similarity index 100%
rename from p2p/source/buffer.cpp
rename to lib-shared/source/buffer.cpp
diff --git a/p2p/source/buffer.hpp b/lib-shared/source/buffer.hpp
similarity index 100%
rename from p2p/source/buffer.hpp
rename to lib-shared/source/buffer.hpp
diff --git a/p2p/source/category.cpp b/lib-shared/source/category.cpp
similarity index 100%
rename from p2p/source/category.cpp
rename to lib-shared/source/category.cpp
diff --git a/p2p/source/category.hpp b/lib-shared/source/category.hpp
similarity index 100%
rename from p2p/source/category.hpp
rename to lib-shared/source/category.hpp
diff --git a/p2p/source/crypto.cpp b/lib-shared/source/crypto.cpp
similarity index 99%
rename from p2p/source/crypto.cpp
rename to lib-shared/source/crypto.cpp
index c3e6118be..6f8aa1127 100644
--- a/p2p/source/crypto.cpp
+++ b/lib-shared/source/crypto.cpp
@@ -26,6 +26,7 @@
#include
#pragma clang diagnostic pop
+#include
#include
#include
#include
diff --git a/p2p/source/crypto.hpp b/lib-shared/source/crypto.hpp
similarity index 100%
rename from p2p/source/crypto.hpp
rename to lib-shared/source/crypto.hpp
diff --git a/p2p/source/database.hpp b/lib-shared/source/database.hpp
similarity index 100%
rename from p2p/source/database.hpp
rename to lib-shared/source/database.hpp
diff --git a/p2p/source/decimal.hpp b/lib-shared/source/decimal.hpp
similarity index 100%
rename from p2p/source/decimal.hpp
rename to lib-shared/source/decimal.hpp
diff --git a/p2p/source/error.hpp b/lib-shared/source/error.hpp
similarity index 100%
rename from p2p/source/error.hpp
rename to lib-shared/source/error.hpp
diff --git a/p2p/source/fit.hpp b/lib-shared/source/fit.hpp
similarity index 100%
rename from p2p/source/fit.hpp
rename to lib-shared/source/fit.hpp
diff --git a/p2p/source/float.hpp b/lib-shared/source/float.hpp
similarity index 100%
rename from p2p/source/float.hpp
rename to lib-shared/source/float.hpp
diff --git a/p2p/source/integer.hpp b/lib-shared/source/integer.hpp
similarity index 100%
rename from p2p/source/integer.hpp
rename to lib-shared/source/integer.hpp
diff --git a/p2p/source/locked.hpp b/lib-shared/source/locked.hpp
similarity index 100%
rename from p2p/source/locked.hpp
rename to lib-shared/source/locked.hpp
diff --git a/p2p/source/log.cpp b/lib-shared/source/log.cpp
similarity index 100%
rename from p2p/source/log.cpp
rename to lib-shared/source/log.cpp
diff --git a/p2p/source/log.hpp b/lib-shared/source/log.hpp
similarity index 100%
rename from p2p/source/log.hpp
rename to lib-shared/source/log.hpp
diff --git a/p2p/source/main.hpp b/lib-shared/source/main.hpp
similarity index 100%
rename from p2p/source/main.hpp
rename to lib-shared/source/main.hpp
diff --git a/p2p/source/maybe.hpp b/lib-shared/source/maybe.hpp
similarity index 100%
rename from p2p/source/maybe.hpp
rename to lib-shared/source/maybe.hpp
diff --git a/p2p/source/notation.hpp b/lib-shared/source/notation.hpp
similarity index 100%
rename from p2p/source/notation.hpp
rename to lib-shared/source/notation.hpp
diff --git a/p2p/source/scope.hpp b/lib-shared/source/scope.hpp
similarity index 100%
rename from p2p/source/scope.hpp
rename to lib-shared/source/scope.hpp
diff --git a/p2p/source/shared.hpp b/lib-shared/source/shared.hpp
similarity index 100%
rename from p2p/source/shared.hpp
rename to lib-shared/source/shared.hpp
diff --git a/p2p/source/syscall.hpp b/lib-shared/source/syscall.hpp
similarity index 100%
rename from p2p/source/syscall.hpp
rename to lib-shared/source/syscall.hpp
diff --git a/p2p/source/task.cpp b/lib-shared/source/task.cpp
similarity index 100%
rename from p2p/source/task.cpp
rename to lib-shared/source/task.cpp
diff --git a/p2p/source/task.hpp b/lib-shared/source/task.hpp
similarity index 100%
rename from p2p/source/task.hpp
rename to lib-shared/source/task.hpp
diff --git a/p2p/source/time.cpp b/lib-shared/source/time.cpp
similarity index 100%
rename from p2p/source/time.cpp
rename to lib-shared/source/time.cpp
diff --git a/p2p/source/time.hpp b/lib-shared/source/time.hpp
similarity index 100%
rename from p2p/source/time.hpp
rename to lib-shared/source/time.hpp
diff --git a/p2p/source/version.cpp b/lib-shared/source/version.cpp
similarity index 100%
rename from p2p/source/version.cpp
rename to lib-shared/source/version.cpp
diff --git a/p2p/source/version.hpp b/lib-shared/source/version.hpp
similarity index 100%
rename from p2p/source/version.hpp
rename to lib-shared/source/version.hpp
diff --git a/p2p/sqlite b/lib-shared/sqlite
similarity index 100%
rename from p2p/sqlite
rename to lib-shared/sqlite
diff --git a/p2p/sqlite.mk b/lib-shared/sqlite.mk
similarity index 100%
rename from p2p/sqlite.mk
rename to lib-shared/sqlite.mk
diff --git a/p2p/target.mk b/lib-shared/target.mk
similarity index 54%
rename from p2p/target.mk
rename to lib-shared/target.mk
index 9b6089f2e..d61c2b3c7 100644
--- a/p2p/target.mk
+++ b/lib-shared/target.mk
@@ -18,12 +18,18 @@
# }}}
+source += $(wildcard $(pwd)/source/*.cpp)
+cflags += -I$(pwd)/source
+cflags += -I$(pwd)/extra
+
+
+$(call depend,$(pwd)/source/version.cpp.o,@/extra/revision.hpp)
+
+
cflags += -fcoroutines-ts
cflags += -Wno-deprecated-coroutine
cflags += -Wno-deprecated-experimental-coroutine
-cflags += -I$(pwd)/extra
-
cflags += -I$(pwd)/cppcoro/include
@@ -37,12 +43,6 @@ source += $(pwd)/cppcoro/lib/win32.cpp
endif
-source += $(wildcard $(pwd)/source/*.cpp)
-cflags += -I$(pwd)/source
-
-$(call depend,$(pwd)/source/version.cpp.o,@/extra/revision.hpp)
-
-
cflags += -I$(pwd)/expected/include
cflags += -I$(pwd)/url/include
cflags += -I$(pwd)/url/src
@@ -59,38 +59,6 @@ source += $(filter-out \
))
-source += $(wildcard $(pwd)/lwip/src/api/*.c)
-source += $(wildcard $(pwd)/lwip/src/core/*.c)
-source += $(wildcard $(pwd)/lwip/src/core/ipv4/*.c)
-source += $(wildcard $(pwd)/lwip/src/core/ipv6/*.c)
-source += $(pwd)/lwip/src/netif/ethernet.c
-
-ifeq ($(target),win)
-source += $(pwd)/lwip/contrib/ports/win32/sys_arch.c
-cflags/$(pwd)/lwip/contrib/ports/win32/sys_arch.c += -UWIN32_LEAN_AND_MEAN
-cflags += -I$(pwd)/lwip/contrib/ports/win32/include
-else
-source += $(pwd)/lwip/contrib/ports/unix/port/sys_arch.c
-cflags += -I$(pwd)/lwip/contrib/ports/unix/port/include
-endif
-
-cflags += -I$(pwd)/lwip/src/include
-
-cflags += -DLWIP_ERRNO_STDINCLUDE
-cflags += -DLWIP_TCP
-
-ifeq ($(target),lnx)
-cflags += -DTCP_USER_TIMEOUT=18
-endif
-
-
-# Android sockaddr_storage is more indirect
-ifeq ($(target),and)
-cflags/$(pwd)/lwip/ += -Wno-missing-braces
-cflags/$(pwd)/source/lwip.cpp += -Wno-missing-braces
-endif
-
-cflags += -I$(pwd)/BeastHttp/BeastHttp/include
#source += $(pwd)/boost/libs/regex/src/regex_traits_defaults.cpp
source += $(wildcard $(pwd)/boost/libs/filesystem/src/*.cpp)
source += $(wildcard $(pwd)/boost/libs/json/src/*.cpp)
@@ -126,40 +94,6 @@ source += $(pwd)/SHA3IUF/sha3.c
cflags += -I$(pwd)/SHA3IUF
-source += $(filter-out \
- %/libutp_inet_ntop.cpp \
-,$(wildcard $(pwd)/libutp/*.cpp))
-
-cflags += -I$(pwd)/libutp
-cflags/$(pwd)/libutp/ += -Wno-unused-const-variable
-cflags/$(pwd)/libutp/ += -Wno-unused-variable
-
-ifeq ($(target),win)
-source += $(pwd)/libutp/libutp_inet_ntop.cpp
-cflags += -DWIN32
-else
-cflags += -DPOSIX=5
-endif
-
-
-pwd/secp256k1 := $(pwd)/secp256k1
-source += $(pwd/secp256k1)/src/secp256k1.c
-source += $(pwd/secp256k1)/src/precomputed_ecmult.c
-source += $(pwd/secp256k1)/src/precomputed_ecmult_gen.c
-cflags += -I$(pwd/secp256k1)/include
-
-cflags/$(pwd/secp256k1)/ += -I$(pwd/secp256k1)
-cflags/$(pwd/secp256k1)/ += -I$(pwd/secp256k1)/src
-cflags/$(pwd/secp256k1)/ += -Wno-unused-function
-
-cflags += -DSECP256K1_STATIC
-
-cflags += -DENABLE_MODULE_RECOVERY
-cflags += -DENABLE_MODULE_ECDH
-cflags += -DECMULT_WINDOW_SIZE=15
-cflags += -DECMULT_GEN_PREC_BITS=4
-
-
cflags += -I$(pwd)/intx/include
source += $(filter-out %/fmt.cc,$(wildcard $(pwd)/fmt/src/*.cc))
@@ -173,57 +107,18 @@ cflags += -I$(pwd)/eEVM/3rdparty
cflags += -I$(pwd)/eEVM/include
-linked += $(pwd)/challenge-bypass-ristretto-ffi/librust.a
-cflags += -I$(pwd)/challenge-bypass-ristretto-ffi/src
-source += $(pwd)/challenge-bypass-ristretto-ffi/src/wrapper.cpp
-
-
-linked += $(pwd)/boringtun/boringtun/librust.a
-cflags += -I$(pwd)/boringtun/boringtun/src
-features/$(pwd)/boringtun/boringtun += ffi-bindings
-
-
-source += $(pwd)/SPCDNS/src/codec.c
-source += $(pwd)/SPCDNS/src/mappings.c
-source += $(pwd)/SPCDNS/src/output.c
-cflags += -I$(pwd)/SPCDNS/src
-
-
-cflags += -I$(pwd)/cpp-jwt/include
-
-
source += $(pwd)/bech32/ref/c++/bech32.cpp
cflags += -I$(pwd)/bech32/ref/c++
# for (const char& c : hrp) assert(c < 'A' || c > 'Z');
cflags/$(pwd)/bech32/ += -Wno-unused-variable
-
-source += $(pwd)/pugixml/src/pugixml.cpp
-cflags += -I$(pwd)/pugixml/src
-cflags += -DPUGIXML_HAS_LONG_LONG
-
-
-source += $(pwd)/snappy/snappy.cc
-source += $(pwd)/snappy/snappy-sinksource.cc
-cflags += -I$(pwd)/snappy
-
+ifeq ($(crypto),)
+crypto := openssl
+endif
+$(call include,$(crypto)/target.mk)
include $(pwd)/asio.mk
-include $(pwd)/protobuf.mk
-
-$(eval $(call protobuf,,$(pwd)/trezor-common/protob))
-source += $(output)/pb/messages.pb.cc
-header += $(output)/pb/messages.pb.h
-source += $(output)/pb/messages-common.pb.cc
-header += $(output)/pb/messages-common.pb.h
-source += $(output)/pb/messages-ethereum.pb.cc
-header += $(output)/pb/messages-ethereum.pb.h
-source += $(output)/pb/messages-management.pb.cc
-header += $(output)/pb/messages-management.pb.h
-
-$(call include,rtc/target.mk)
-$(call include,krypton/target.mk)
-$(call include,c-ares.mk)
-$(call include,openvpn3.mk)
+$(call include,abseil.mk)
+$(call include,secp256k1.mk)
$(call include,sqlite.mk)
diff --git a/p2p/url b/lib-shared/url
similarity index 100%
rename from p2p/url
rename to lib-shared/url
diff --git a/min-boringssl/boringssl b/min-boringssl/boringssl
new file mode 160000
index 000000000..8ae84b558
--- /dev/null
+++ b/min-boringssl/boringssl
@@ -0,0 +1 @@
+Subproject commit 8ae84b558b3d3af50a323c7e3800998764e77375
diff --git a/min-boringssl/target.mk b/min-boringssl/target.mk
new file mode 100644
index 000000000..7efd06ddc
--- /dev/null
+++ b/min-boringssl/target.mk
@@ -0,0 +1,21 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+cflags += -I$(pwd)/boringssl/src/include
diff --git a/min-icu4c/icu b/min-icu4c/icu
index 39dfee39b..63afc7642 160000
--- a/min-icu4c/icu
+++ b/min-icu4c/icu
@@ -1 +1 @@
-Subproject commit 39dfee39b88a09fcafb33992a5495c4117490644
+Subproject commit 63afc7642582622f4c27925835e9e95828efea76
diff --git a/min-v8/FP16 b/min-v8/FP16
new file mode 160000
index 000000000..581ac1c79
--- /dev/null
+++ b/min-v8/FP16
@@ -0,0 +1 @@
+Subproject commit 581ac1c79dd9d9f6f4e8b2934e7a55c7becf0799
diff --git a/min-v8/_/base b/min-v8/_/base
deleted file mode 120000
index 24312d19b..000000000
--- a/min-v8/_/base
+++ /dev/null
@@ -1 +0,0 @@
-../base
\ No newline at end of file
diff --git a/min-v8/base b/min-v8/base
deleted file mode 160000
index 6ca251cee..000000000
--- a/min-v8/base
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 6ca251cee4cf82f5c33461837005539eeaf684da
diff --git a/min-v8/extra/fp16 b/min-v8/extra/fp16
new file mode 120000
index 000000000..89e586b43
--- /dev/null
+++ b/min-v8/extra/fp16
@@ -0,0 +1 @@
+../FP16/include/fp16
\ No newline at end of file
diff --git a/min-v8/extra/third_party/fp16/src b/min-v8/extra/third_party/fp16/src
new file mode 120000
index 000000000..2a8d35a39
--- /dev/null
+++ b/min-v8/extra/third_party/fp16/src
@@ -0,0 +1 @@
+../../../FP16
\ No newline at end of file
diff --git a/min-v8/target.mk b/min-v8/target.mk
index eef1e4db8..0b1d7292f 100644
--- a/min-v8/target.mk
+++ b/min-v8/target.mk
@@ -16,16 +16,19 @@ $(call include,zlb/target.mk)
$(call include,zlb/google.mk)
-v8sub := codegen compiler/backend debug deoptimizer diagnostics execution
+v8sub := codegen compiler/backend debug deoptimizer diagnostics execution maglev regexp
v8all := $(patsubst ./%,$(pwd/v8)/src/%,$(shell cd $(pwd/v8)/src && find . \
$(foreach sub,$(v8sub),-path "./$(sub)" -prune -o) \
+ -path "./builtins/riscv" -prune -o \
-path "./d8" -prune -o \
-path "./heap/base/asm" -prune -o \
-path "./heap/cppgc/asm" -prune -o \
-path "./inspector" -prune -o \
-path "./torque" -prune -o \
-path "./third_party" -prune -o \
+ -path "./tracing" -prune -o \
+ -path "./wasm/fuzzing" -prune -o \
\
! -path "./builtins/generate-bytecodes-builtins-list.cc" \
! -path "./regexp/gen-regexp-special-case.cc" \
@@ -51,6 +54,11 @@ v8all := $(patsubst ./%,$(pwd/v8)/src/%,$(shell cd $(pwd/v8)/src && find . \
v8all += $(pwd/v8)/src/torque/class-debug-reader-generator.cc
v8all += $(foreach sub,$(v8sub),$(wildcard $(pwd)/v8/src/$(sub)/*.cc))
+v8all += $(wildcard $(pwd)/v8/src/regexp/experimental/*.cc)
+v8all += $(pwd)/v8/src/tracing/trace-event.cc
+v8all += $(pwd)/v8/src/tracing/traced-value.cc
+v8all += $(pwd)/v8/src/tracing/tracing-category-observer.cc
+
v8all := $(filter-out %/deoptimizer-cfi-builtins.cc,$(v8all))
v8all := $(filter-out %/deoptimizer-cfi-empty.cc,$(v8all))
v8all := $(filter-out %/system-jit-win.cc,$(v8all))
@@ -105,6 +113,7 @@ include $(pwd)/target-$(target).mk
# XXX: vflags += -D_LIBCPP_ENABLE_NODISCARD
vflags += -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0
+vflags += -DGOOGLE3
vflags += -DOFFICIAL_BUILD
vflags += -DNVALGRIND
@@ -115,11 +124,15 @@ vflags += -DENABLE_HANDLE_ZAPPING
vflags += -DENABLE_MINOR_MC
vflags += -DVERIFY_HEAP
-vflags += -DV8_31BIT_SMIS_ON_64BIT_ARCH
+# XXX: this seems to be broken now?
+# look at 51bad4ef1d2b8cebca9ea1dbe3cc30e80dabf2cd
+#vflags += -DV8_31BIT_SMIS_ON_64BIT_ARCH
+
vflags += -DV8_ADVANCED_BIGINT_ALGORITHMS
vflags += -DV8_ATOMIC_MARKING_STATE
vflags += -DV8_ATOMIC_OBJECT_FIELD_WRITES
vflags += -DV8_DEPRECATION_WARNINGS
+vflags += -DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
vflags += -DV8_ENABLE_LAZY_SOURCE_POSITIONS
vflags += -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH
vflags += -DV8_ENABLE_WEBASSEMBLY
@@ -136,10 +149,15 @@ ifeq ($(bits/$(machine)),64)
#vflags += -DV8_SHORT_BUILTIN_CALLS
endif
-ifeq ($(machine),x86_64)
+vflags += -DV8_ENABLE_SPARKPLUG
vflags += -DV8_ENABLE_MAGLEV
+vflags += -DV8_ENABLE_TURBOFAN
+
+ifeq ($(machine),x86_64)
+vflags += -DV8_ENABLE_WASM_SIMD256_REVEC
else
-v8src := $(filter-out $(pwd/v8)/src/maglev/%,$(v8src))
+v8src := $(filter-out $(pwd/v8)/src/compiler/revectorizer.cc,$(v8src))
+v8src := $(filter-out $(pwd/v8)/src/compiler/turboshaft/wasm-revec-%,$(v8src))
endif
cflags += -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC
@@ -152,6 +170,7 @@ endif
vflags += -I$(pwd/v8)
vflags += -I$(output)/$(pwd/v8)
+vflags += -I$(pwd)/extra
source += $(v8src)
@@ -165,7 +184,7 @@ vflags += -include cstdint
$(output)/$(pwd/v8)/gen-regexp-special-case: $(pwd)/v8/src/regexp/gen-regexp-special-case.cc $(pwd)/fatal.cc $(output)/icu4c/lib/libicuuc.a $(output)/icu4c/lib/libicudata.a
@mkdir -p $(dir $@)
- clang++ -std=c++14 -pthread -o $@ $^ $(vflags) $(icu4c) -ldl -m$(bits/$(machine))
+ clang++ -std=c++17 -pthread -o $@ $^ $(vflags) $(icu4c) -ldl -m$(bits/$(machine)) -static
$(output)/$(pwd/v8)/special-case.cc: $(output)/$(pwd/v8)/gen-regexp-special-case
@mkdir -p $(dir $@)
@@ -178,7 +197,7 @@ source += $(output)/$(pwd/v8)/special-case.cc
$(output)/$(pwd/v8)/generate-bytecodes-builtins-list: $(pwd)/v8/src/builtins/generate-bytecodes-builtins-list.cc $(pwd)/v8/src/interpreter/bytecodes.cc $(pwd)/v8/src/interpreter/bytecode-operands.cc $(pwd)/fatal.cc
@mkdir -p $(dir $@)
- clang++ -std=c++14 -pthread -o $@ $^ $(vflags) -m$(bits/$(machine))
+ clang++ -std=c++17 -pthread -o $@ $^ $(vflags) -m$(bits/$(machine))
$(output)/$(pwd/v8)/builtins-generated/bytecodes-builtins-list.h: $(output)/$(pwd/v8)/generate-bytecodes-builtins-list
@mkdir -p $(dir $@)
@@ -194,15 +213,15 @@ torque := $(patsubst ./%,%,$(sort $(shell cd $(pwd)/v8 && find . -name '*.tq')))
# XXX: this now needs to be per target (due to -m$(bits))
-$(output)/$(pwd/v8)/torque: $(wildcard $(pwd)/v8/src/torque/*.cc) $(pwd)/v8/src/base/functional.cc $(pwd)/fatal.cc
+$(output)/$(pwd/v8)/torque: $(wildcard $(pwd)/v8/src/torque/*.cc) $(pwd)/fatal.cc
@rm -rf $(dir $@)
@mkdir -p $(dir $@)
- clang++ -std=c++14 -pthread -o $@ $^ $(vflags) -m$(bits/$(machine))
+ clang++ -std=c++17 -pthread -o $@ $^ $(vflags) -m$(bits/$(machine))
tqsrc := $(patsubst %.tq,%-tq-csa.cc,$(torque))
-#tqsrc += class-debug-readers.cc
+tqsrc += class-debug-readers.cc
tqsrc += class-verifiers.cc
-#tqsrc += debug-macros.cc
+tqsrc += debug-macros.cc
tqsrc += exported-macros-assembler.cc
tqsrc += $(patsubst %.cc,%.h,$(tqsrc))
tqsrc += $(patsubst %.tq,%-tq.cc,$(torque))
@@ -238,7 +257,6 @@ header += $(filter %.h %.inc,$(tqsrc))
cflags += -I$(pwd/v8)/src
cflags += -I$(pwd/v8)/include
-cflags += -I$(pwd)/_
cflags += -I$(pwd)/extra
# XXX: this is un-breaking something the -iquote for sed hacks is breaking in cppgc
@@ -262,4 +280,6 @@ cflags/$(pwd/v8)/ += -Wno-builtin-assume-aligned-alignment
# XXX: they might have already changed many of these cases
cflags/$(pwd/v8)/ += -Wno-unused-but-set-variable
+cflags += -Wno-invalid-offsetof
+
archive += $(pwd/v8)/
diff --git a/min-v8/trace_event b/min-v8/trace_event
index 35f06510a..521ac34eb 160000
--- a/min-v8/trace_event
+++ b/min-v8/trace_event
@@ -1 +1 @@
-Subproject commit 35f06510a6a088054ba3417b0f9f7ee4a120db55
+Subproject commit 521ac34ebd795939c7e16b37d9d3ddb40e8ed556
diff --git a/min-v8/v8 b/min-v8/v8
index 5974242ae..b3a476aa4 160000
--- a/min-v8/v8
+++ b/min-v8/v8
@@ -1 +1 @@
-Subproject commit 5974242ae2141744091e5c6adcc95c8d9f6cee81
+Subproject commit b3a476aa45ab28fd96e47b299c0c5fa54867a91a
diff --git a/min-webrtc/extra/third_party/absl b/min-webrtc/extra/third_party/absl
deleted file mode 120000
index 7be2b5fd6..000000000
--- a/min-webrtc/extra/third_party/absl
+++ /dev/null
@@ -1 +0,0 @@
-../../abseil-cpp/absl
\ No newline at end of file
diff --git a/min-webrtc/target.mk b/min-webrtc/target.mk
index 9e04c6aaf..acb9b0073 100644
--- a/min-webrtc/target.mk
+++ b/min-webrtc/target.mk
@@ -153,28 +153,6 @@ webrtc += $(wildcard $(pwd)/webrtc/stats/*.cc)
webrtc += $(wildcard $(pwd)/webrtc/system_wrappers/source/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/base/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/base/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/crc/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/crc/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/debugging/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/debugging/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/numeric/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/numeric/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/profiling/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/profiling/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/types/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/types/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/strings/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/strings/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/synchronization/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/synchronization/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/time/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/time/internal/*.cc)
-webrtc += $(wildcard $(pwd)/abseil-cpp/absl/time/internal/cctz/src/*.cc)
-cflags += -I$(pwd)/abseil-cpp
-
-
pwd/libsrtp := $(pwd)/libsrtp
webrtc += $(wildcard $(pwd/libsrtp)/srtp/*.c)
cflags += -I$(pwd/libsrtp)/include
@@ -284,5 +262,3 @@ cflags/$(pwd/webrtc)/rtc_base/checks.cc += -Wno-unused-result
include $(pwd)/target-$(target).mk
-
-$(call include,ssl/target.mk)
diff --git a/min-wireshark/libgcrypt b/min-wireshark/libgcrypt
index ccfa9f2c1..3f5989014 160000
--- a/min-wireshark/libgcrypt
+++ b/min-wireshark/libgcrypt
@@ -1 +1 @@
-Subproject commit ccfa9f2c1427b40483984198c3df41f8057f69f8
+Subproject commit 3f5989014a1b7c01aced88897d878ce5105d15df
diff --git a/min-wireshark/libgpg-error b/min-wireshark/libgpg-error
index 220a427b4..a5f0e0b2f 160000
--- a/min-wireshark/libgpg-error
+++ b/min-wireshark/libgpg-error
@@ -1 +1 @@
-Subproject commit 220a427b4f997ef6af1b2d4e82ef1dc96e0cd6ff
+Subproject commit a5f0e0b2f7897fc6ef1ab847146e16ef64d1d4a7
diff --git a/min-zlib/extra/base/debug/debugging_buildflags.h b/min-zlib/extra/base/debug/debugging_buildflags.h
deleted file mode 100644
index e69de29bb..000000000
diff --git a/min-zlib/extra/base/logging_buildflags.h b/min-zlib/extra/base/logging_buildflags.h
deleted file mode 100644
index 9478e4817..000000000
--- a/min-zlib/extra/base/logging_buildflags.h
+++ /dev/null
@@ -1 +0,0 @@
-#define BUILDFLAG(x) x
diff --git a/min-zlib/extra/build/chromeos_buildflags.h b/min-zlib/extra/build/chromeos_buildflags.h
deleted file mode 100644
index 9478e4817..000000000
--- a/min-zlib/extra/build/chromeos_buildflags.h
+++ /dev/null
@@ -1 +0,0 @@
-#define BUILDFLAG(x) x
diff --git a/min-zlib/extra/testing/gtest b/min-zlib/extra/testing/gtest
deleted file mode 120000
index e6b68b23d..000000000
--- a/min-zlib/extra/testing/gtest
+++ /dev/null
@@ -1 +0,0 @@
-../../googletest/googletest
\ No newline at end of file
diff --git a/min-zlib/extra/third_party/googletest/src b/min-zlib/extra/third_party/googletest/src
deleted file mode 120000
index 4e2a71acc..000000000
--- a/min-zlib/extra/third_party/googletest/src
+++ /dev/null
@@ -1 +0,0 @@
-../../../googletest
\ No newline at end of file
diff --git a/min-zlib/googletest b/min-zlib/googletest
deleted file mode 160000
index 2d16ed055..000000000
--- a/min-zlib/googletest
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2d16ed055d09c3689d44b272adc097393de948a0
diff --git a/modules b/modules
index 1b2859869..23a37195f 100755
--- a/modules
+++ b/modules
@@ -10,25 +10,23 @@ function tag() {
echo "${head[$1]}"
}
-tag p2p/boost 'boost-[0-9.]*'
+tag lib-shared/boost 'boost-[0-9.]*'
tag min-openssl/openssl 'OpenSSL_[0-9_]*[a-z]'
-tag p2p/sqlite 'version-[0-9.]*'
-
-# to upgrade to a later version of libc++ would require LLVM as submodule
-head[env/libcxx]=origin/release_90
-head[env/libcxxabi]=origin/release_90
+tag lib-shared/sqlite 'version-[0-9.]*'
head[app-shared/flutter]=3.13.9
head[app-shared/engine]=$(cat app-shared/flutter/bin/internal/engine.version)
+head[min-v8/v8]=$(sed -e '/url = "https:\/\/github.com\/v8\/v8\//!d;s/^.*\///;s/\.tar\.gz",$//' srv-worker/workerd/WORKSPACE)
+head[srv-worker/capnproto]=$(sed -e '/url.*"https:\/\/github.com\/capnproto\/capnproto\//!d;s/^.*\///;s/".*//' srv-worker/workerd/WORKSPACE)
+
# cairo and pixman decided to drop autotools, which is really annoying :/
-# intx is stuck due to use of concepts (so need a newer version of libc++)
# libgcrypt is stuck on aarch64 Android due to https://dev.gnupg.org/T7111
# libgpg-error is stuck due to libgcrypt as it breaks the older detection
# url is stuck due to https://forums.developer.apple.com/thread/120977 :/
# (I tried to use a local copy of libcxx on Apple, but crashed on iOS 14)
-head[p2p/url]=7c822cb9873b1422e09be5131f30e9d83d487096
+head[lib-shared/url]=7c822cb9873b1422e09be5131f30e9d83d487096
git submodule foreach -q 'echo $displaypath' | while read -r sub; do (
cd "${sub}"
diff --git a/p2p/intx b/p2p/intx
deleted file mode 160000
index 8296dd711..000000000
--- a/p2p/intx
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8296dd711603056cd16412b68da6f9ab26dd59c0
diff --git a/srv-daemon/env b/srv-daemon/env
index 9e1ff3db4..971e97aa3 120000
--- a/srv-daemon/env
+++ b/srv-daemon/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/srv-daemon/lib b/srv-daemon/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/srv-daemon/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/srv-daemon/makefile b/srv-daemon/makefile
index 63b5d7c11..81cdba2d0 100644
--- a/srv-daemon/makefile
+++ b/srv-daemon/makefile
@@ -53,7 +53,7 @@ source += $(wildcard $(pwd)/source/*.cpp)
cflags += -I$(pwd)/extra
cflags += -I$(pwd)/source
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
cflags += -Iall/vpn-shared/source
ifeq ($(target),lnx)
diff --git a/srv-daemon/p2p b/srv-daemon/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/srv-daemon/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/srv-daemon/source/engine.cpp b/srv-daemon/source/engine.cpp
index a468745e3..80802f02a 100644
--- a/srv-daemon/source/engine.cpp
+++ b/srv-daemon/source/engine.cpp
@@ -60,7 +60,7 @@ int Engine() {
const Fd zygote(memfd_create("zygote", MFD_CLOEXEC));
- const size_t arena(512*megabyte);
+ const size_t arena(768*megabyte);
orc_syscall(ftruncate(zygote, arena));
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast,performance-no-int-to-ptr)
@@ -306,6 +306,7 @@ int Engine() {
switch (run->exit_reason) {
case KVM_EXIT_INTR:
std::cout << "INTR" << std::endl;
+ dump();
break;
case KVM_EXIT_MMIO: {
@@ -313,16 +314,17 @@ int Engine() {
orc_assert(run->mmio.is_write);
orc_assert(run->mmio.len == sizeof(uintptr_t));
switch (const auto command = *reinterpret_cast(run->mmio.data)) {
- case 0: {
+ case 0: case 1: {
struct kvm_guest_debug debug{};
- debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
+ debug.control = command == 0 ? 0 : KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
+ debug.control = 0;
orc_syscall(ioctl(cpu, KVM_SET_GUEST_DEBUG, &debug));
} break;
- case 1: {
+ case 2: {
std::cout << "abort()" << std::endl;
return 0;
} break;
- case 2: {
+ case 3: {
std::cout << buffer << std::flush;
} break;
default:
diff --git a/srv-gateway/env b/srv-gateway/env
index 9e1ff3db4..971e97aa3 120000
--- a/srv-gateway/env
+++ b/srv-gateway/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/srv-gateway/lib b/srv-gateway/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/srv-gateway/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/srv-gateway/makefile b/srv-gateway/makefile
index 1df8b112a..e10a3600a 100644
--- a/srv-gateway/makefile
+++ b/srv-gateway/makefile
@@ -44,7 +44,7 @@ record: $(output)/$(machine)/orchid$(exe)
report: $(output)/$(machine)/orchid$(exe)
perf report --sort=cpu
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
source += $(wildcard source/*.cpp)
diff --git a/srv-gateway/p2p b/srv-gateway/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/srv-gateway/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/srv-kernel/source/main.cpp b/srv-kernel/source/main.cpp
index a53d418a3..f2914b5cc 100644
--- a/srv-kernel/source/main.cpp
+++ b/srv-kernel/source/main.cpp
@@ -29,8 +29,12 @@
#include
#include
+#include
#include
+#include
+#include
+#include
#include
#include
@@ -46,6 +50,8 @@ namespace orc {
__asm__ volatile ("dc cvac, %0" : : "r" (code) : "memory")
#elif defined(__x86_64__) || defined(__i386__)
#define Clear(code)
+#else
+#error
#endif
#if defined(__x86_64__)
@@ -95,7 +101,7 @@ __attribute__((__noreturn__))
extern "C" void abort() {
// NOLINTNEXTLINE(google-build-using-namespace)
using namespace orc;
- *control_ = 1;
+ *control_ = 2;
}
#pragma clang diagnostic pop
@@ -118,6 +124,17 @@ extern "C" size_t strlen(const char *data) {
if (data[size] == '\0')
return size;
}
+
+// this code was stolen directly from the GNU man page
+// if it isn't correct, I'm going to be so upset... ;P
+extern "C" char *strncpy(char *dest, const char *src, size_t n) {
+ size_t i;
+ for (i = 0; i < n && src[i] != '\0'; i++)
+ dest[i] = src[i];
+ for ( ; i < n; i++)
+ dest[i] = '\0';
+ return dest;
+}
// NOLINTEND(readability-inconsistent-declaration-parameter-name)
// }}}
@@ -232,7 +249,7 @@ extern "C" size_t printf(const char *format, ...) {
auto value(vsnprintf(state_.buffer_, kilopage_, format, args));
va_end(args);
Clear(state_.buffer_);
- *control_ = 2;
+ *control_ = 3;
return value;
}
// NOLINTEND(cppcoreguidelines-pro-type-vararg,cert-dcl50-cpp)
@@ -301,12 +318,12 @@ extern "C" long enosys(uintptr_t nr, uintptr_t lr, uintptr_t fp) {
// }}}
// page fault {{{
#if defined(__aarch64__)
-extern "C" uintptr_t efault(uintptr_t sr, uintptr_t lr, uintptr_t fp, uintptr_t x0) {
+extern "C" uintptr_t efault(uintptr_t sr, uintptr_t lr, uintptr_t fp, uintptr_t xN) {
// https://developer.arm.com/documentation/ddi0595/2021-12/AArch64-Registers/ESR-EL1--Exception-Syndrome-Register--EL1-?lang=en#fieldset_0-24_0_10
- printf("efault(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", sr, lr, fp, x0);
+ printf("efault(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", sr, lr, fp, xN);
backtrace(lr, reinterpret_cast(fp));
abort();
- return x0;
+ return xN;
}
#endif
// }}}
@@ -358,7 +375,10 @@ template
#error
#endif
- return Scan_(table, base >> pagebits_, code);
+ //*control_ = 0;
+ const auto done(Scan_(table, base >> pagebits_, code));
+ //*control_ = 1;
+ return done;
}
template
@@ -489,26 +509,67 @@ uintptr_t $brk(uintptr_t brk) {
}
// }}}
+bool isU(const void *data) {
+ // XXX: verify null-terminated
+ // (safe as we don't use this)
+ return true;
+}
+
+bool isU(const void *data, size_t size) {
+ return reinterpret_cast(data) >= 0 &&
+ reinterpret_cast(data) + size >= data;
+}
+
+constexpr auto stacklim_(8192ul*1024ul);
+
long $prlimit64(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit) {
orc_assert(pid == 0);
orc_assert(resource == RLIMIT_STACK);
orc_assert(new_limit == nullptr);
+ orc_assert(isU(old_limit, sizeof(*old_limit)));
- old_limit->rlim_cur = 8192ul*1024ul;
+ old_limit->rlim_cur = stacklim_;
old_limit->rlim_max = RLIM64_INFINITY;
return 0;
}
+int $uname(struct utsname *data) {
+ orc_assert(isU(data, sizeof(*data)));
+
+ strncpy(data->sysname, "Linux", sizeof(data->sysname));
+ strncpy(data->nodename, "V8", sizeof(data->nodename));
+ strncpy(data->release, "4.4.0", sizeof(data->release));
+ strncpy(data->version, "", sizeof(data->version));
+ strncpy(data->machine, "x86_64", sizeof(data->machine));
+ strncpy(data->domainname, "example.com", sizeof(data->domainname));
+ return 0;
+}
+
+constexpr pid_t pid_(1);
+pid_t $getpid() { return pid_; }
+pid_t $gettid() { return pid_; }
+
+uid_t $getuid() { return 501; }
+uid_t $geteuid() { return 501; }
+
+gid_t $getgid() { return 501; }
+gid_t $getegid() { return 501; }
+
+/*int*/ long $sched_getaffinity(pid_t pid, size_t size, cpu_set_t *mask) {
+ //printf("sched_getaffinity(%d, %zu)\n", pid, size);
+ orc_assert(pid == 0 || pid == pid_);
+ orc_assert(size == sizeof(*mask));
+ orc_assert(isU(mask, sizeof(*mask)));
+ CPU_ZERO(mask);
+ CPU_SET(0, mask);
+ return size;
+}
+
long $exit_group(int status) {
printf("exit_group(0x%x)\n", status);
abort();
}
-bool isU(const void *data, size_t size) {
- return reinterpret_cast(data) >= 0 &&
- reinterpret_cast(data) + size >= data;
-}
-
#ifdef __x86_64__
long $arch_prctl(int code, unsigned long address) {
switch (code) {
@@ -523,8 +584,49 @@ long $arch_prctl(int code, unsigned long address) {
}
#endif
+/*int*/ long $clock_gettime(clockid_t clk_id, struct timespec *tp) {
+ orc_assert(clk_id == CLOCK_MONOTONIC || clk_id == CLOCK_MONOTONIC_COARSE);
+ orc_assert(isU(tp, sizeof(*tp)));
+
+ // XXX: implement time!!!
+ tp->tv_sec = 1000;
+ tp->tv_nsec = 0;
+ return 0;
+}
+
+#if 0
+#elif defined(__aarch64__)
+ssize_t $readlinkat(int fd, const char *path, char *data, size_t size) {
+ orc_assert(isU(path));
+ orc_assert(isU(data, size));
+ //printf("readlinkat(%d, \"%s\")\n", fd, path);
+ return -ENOENT;
+}
+#elif defined(__x86_64__)
+ssize_t $readlink(const char *path, char *data, size_t size) {
+ orc_assert(isU(path));
+ orc_assert(isU(data, size));
+ //printf("readlink(\"%s\")\n", path);
+ return -ENOENT;
+}
+#else
+#error
+#endif
+
+/*int*/ long $openat(int fd, const char *path, int flags, mode_t mode) {
+ orc_assert(isU(path));
+ //printf("openat(%d, \"%s\", %d, %o)\n", fd, path, flags, mode);
+ return -ENOENT;
+}
+
+size_t $read(int fd, void *data, size_t size) {
+ orc_assert(isU(data, size));
+ printf("read(%d, %p, %zu)\n", fd, data, size);
+ abort();
+}
+
size_t $write(int fd, const void *data, size_t size) {
- printf("write(%d, %p, %zu)\n", fd, data, size);
+ //printf("write(%d, %p, %zu)\n", fd, data, size);
orc_assert(fd == 1 || fd == 2);
orc_assert(isU(data, size));
orc_assert(size <= kilopage_ - 1);
@@ -532,7 +634,17 @@ size_t $write(int fd, const void *data, size_t size) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index)
state_.buffer_[size] = '\0';
Clear(state_.buffer_);
- *control_ = 2;
+ *control_ = 3;
+ return size;
+}
+
+ssize_t $getrandom(void *data, size_t size, unsigned int flags) {
+ orc_assert(flags == 0);
+ for (size_t i(0); i != size; ++i)
+ // XXX: https://xkcd.com/221/
+ // chosen by fair dice roll.
+ // guaranteed to be random.
+ reinterpret_cast(data)[i] = 4;
return size;
}
@@ -625,16 +737,17 @@ void service() {
push %%r10; push %%r11
cmp %1, %%rax
- jge abort
+ jge .Lenosys
mov %0, %%rcx
- mov (%%rcx, %%rax, 8), %%rax
+ mov (%%rcx, %%rax, 8), %%r11
- cmp $0, %%rax
- je abort
+ cmp $0, %%r11
+ je .Lenosys
mov %%r10, %%rcx
- call *%%rax
+ call *%%r11
+ .Lreturn:
pop %%r11; pop %%r10
pop %%r9; pop %%r8
@@ -645,6 +758,13 @@ void service() {
// XXX: protect interrupts!!
pop %%rsp
sysretq
+
+ .Lenosys:
+ mov %%rax, %%rdi
+ //mrs elr_el1, %%rsi
+ //mov x29, %%rdx
+ call enosys
+ jmp .Lreturn
)" : : "i" (state_.syscalls_), "i" (sizeof(state_.syscalls_) / sizeof(*state_.syscalls_)), "i" (state_.tables_)
#else
#error
@@ -654,27 +774,59 @@ void service() {
// }}}
// executable loader {{{
extern "C" void main() {
+ //*control_ = 1;
+
state_.tables_[0][0] = 0x0;
state_.tables_[0][1] = 0x0;
Clear(state_.tables_[0]);
state_.more_ = reinterpret_cast(&state_ + 1);
+
// XXX: randomize this address
state_.stop_ = 0x555555b2d000;
+ // XXX: guarantee value in range
+ state_.stop_ &= ~MASK(pagebits_);
+
+ #define syscall(name) \
+ state_.syscalls_[__NR_##name] = reinterpret_cast(&$##name)
+
+ syscall(mmap);
+ syscall(madvise);
+ syscall(munmap);
+ syscall(mprotect);
+ syscall(brk);
+
+ syscall(prlimit64);
+ syscall(uname);
+
+ syscall(getpid); syscall(gettid);
+ syscall(getuid); syscall(geteuid);
+ syscall(getgid); syscall(getegid);
+
+ syscall(sched_getaffinity);
- state_.syscalls_[__NR_mmap] = reinterpret_cast(&$mmap);
- state_.syscalls_[__NR_madvise] = reinterpret_cast(&$madvise);
- state_.syscalls_[__NR_munmap] = reinterpret_cast(&$munmap);
- state_.syscalls_[__NR_mprotect] = reinterpret_cast(&$mprotect);
- state_.syscalls_[__NR_brk] = reinterpret_cast(&$brk);
+ syscall(exit_group);
- state_.syscalls_[__NR_prlimit64] = reinterpret_cast(&$prlimit64);
- state_.syscalls_[__NR_exit_group] = reinterpret_cast(&$exit_group);
#if defined(__x86_64__)
- state_.syscalls_[__NR_arch_prctl] = reinterpret_cast(&$arch_prctl);
+ syscall(arch_prctl);
#endif
- state_.syscalls_[__NR_write] = reinterpret_cast(&$write);
+ syscall(clock_gettime);
+
+#if 0
+#elif defined(__aarch64__)
+ syscall(readlinkat);
+#elif defined(__x86_64__)
+ syscall(readlink);
+#else
+#endif
+
+ syscall(openat);
+
+ syscall(read);
+ syscall(write);
+
+ syscall(getrandom);
const auto null(orc_syscall($mmap(0, megapage_, 0, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0)));
orc_assert(null == 0);
@@ -719,8 +871,10 @@ extern "C" void main() {
entry = rest | PofK(copy) | 0x1;
});
+ //*control_ = 0;
memset(reinterpret_cast(start), 0, offset);
memset(reinterpret_cast(start + offset + command.p_filesz), 0, size - offset - command.p_filesz);
+ //*control_ = 1;
}
Scan(start + size, total - size, [&](uintptr_t page, uintptr_t &entry) {
@@ -729,27 +883,27 @@ extern "C" void main() {
});
}
- struct rlimit limit{};
- $prlimit64(0, RLIMIT_STACK, nullptr, &limit);
- const size_t size(limit.rlim_cur);
-
- auto stack(reinterpret_cast(reinterpret_cast(orc_syscall($mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) + size));
+ auto stack(reinterpret_cast(reinterpret_cast(orc_syscall($mmap(0, stacklim_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) + stacklim_));
// NOLINTBEGIN(clang-analyzer-core.NullDereference)
// https://articles.manugarg.com/aboutelfauxiliaryvectors
// https://lwn.net/Articles/519085/
+ // marker
+
// random
- // XXX: https://xkcd.com/221/
- // chosen by fair dice roll.
- // guaranteed to be random.
- *--stack = 0x4444444444444444;
- *--stack = 0x4444444444444444;
- const auto random(stack);
+ const auto random(stack -= 2);
+ orc_syscall($getrandom(random, sizeof(*stack) * 2, 0));
+
+ // padding
// auxv
*--stack = AT_NULL;
+
+ *--stack = kilopage_;
+ *--stack = AT_PAGESZ;
+
*--stack = reinterpret_cast(random);
*--stack = AT_RANDOM;
@@ -795,10 +949,16 @@ extern "C" void main() {
.balign 0x800
vectors:
.space 0x200
- .space 0x200
+
b %3
.balign 0x80
- .space 0x380
+ .space 0x180
+
+ b %3
+ .balign 0x80
+ .space 0x180
+
+ .space 0x200
)" : : "r" (stack), "r" (entry), "i" (atexit), "i" (service), "r" (state_.tables_) : "x0"
#elif defined(__x86_64__)
// sysdeps/x86_64/start.S
diff --git a/srv-worker/capnproto b/srv-worker/capnproto
index 08d082653..24371b79b 160000
--- a/srv-worker/capnproto
+++ b/srv-worker/capnproto
@@ -1 +1 @@
-Subproject commit 08d0826533c72ae9d9182cb2dd33d5ccd20e4e46
+Subproject commit 24371b79b467686641aa64afa340bdad03b05830
diff --git a/srv-worker/capnproto.mk b/srv-worker/capnproto.mk
new file mode 100644
index 000000000..22e4724c7
--- /dev/null
+++ b/srv-worker/capnproto.mk
@@ -0,0 +1,43 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+$(output)/capnproto/Makefile: $(pwd)/capnproto/c++/configure
+ mkdir -p $(dir $@)
+ cd $(dir $@) && $(CURDIR)/$< --enable-static \
+ CC='clang -m$(bits/$(machine))' CXX='clang++ -m$(bits/$(machine))'
+
+export PATH := $(CURDIR)/$(output)/capnproto:$(PATH)
+
+capnp := $(output)/capnproto/capnp
+
+$(capnp): $(output)/capnproto/Makefile
+ $(MAKE) -C $(dir $<)
+
+$(output)/capnp/%.capnp.h: %.capnp $(capnp)
+ @mkdir -p $(output)/capnp
+ capnp compile \
+ -I$(pwd)/capnproto/c++/src \
+ -I$(pwd)/workerd/src \
+ $< -oc++:$(output)/capnp
+
+cflags += -I$(pwd)/capnproto/c++/src
+cflags += -I$(output)/capnp/capnproto/c++/src
+
+source += $(shell find $(pwd)/capnproto/c++/src/kj -name '*.c++' -not -name '*test.c++')
diff --git a/srv-worker/jemalloc.mk b/srv-worker/jemalloc.mk
new file mode 100644
index 000000000..82f48290c
--- /dev/null
+++ b/srv-worker/jemalloc.mk
@@ -0,0 +1,34 @@
+# Orchid - WebRTC P2P VPN Market (on Ethereum)
+# Copyright (C) 2017-2020 The Orchid Authors
+
+# GNU Affero General Public License, Version 3 {{{ */
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+# }}}
+
+
+w_jemalloc += --disable-cxx
+w_jemalloc += --disable-libdl
+w_jemalloc += --disable-stats
+w_jemalloc += --disable-syscall
+w_jemalloc += --enable-debug
+w_jemalloc += --with-malloc-conf=tcache:false
+
+w_jemalloc += ac_cv_func_sbrk=no
+w_jemalloc += force_tls=0
+
+jemalloc := lib/libjemalloc_pic.a
+$(output)/%/$(pwd)/jemalloc/$(jemalloc): $(output)/%/$(pwd)/jemalloc/Makefile
+ $(MAKE) -C $(dir $<) $(jemalloc)
+linked += $(pwd)/jemalloc/$(jemalloc)
diff --git a/srv-worker/lib b/srv-worker/lib
new file mode 120000
index 000000000..005659d22
--- /dev/null
+++ b/srv-worker/lib
@@ -0,0 +1 @@
+../lib-shared
\ No newline at end of file
diff --git a/srv-worker/libc.cpp b/srv-worker/libc.cpp
index 57056343c..18690ba98 100644
--- a/srv-worker/libc.cpp
+++ b/srv-worker/libc.cpp
@@ -20,353 +20,6 @@
/* }}} */
-#undef _FORTIFY_SOURCE
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include // XXX
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include "scope.hpp"
-
-#define orc_trace() do { \
- std::cout << "_trace()@" << __FILE__ << ":" << __LINE__ << std::endl; \
-} while (false)
-
-#define __(x) extern "C" __typeof(x) __##x __attribute__((alias(#x)));
-
-// NOLINTBEGIN(readability-inconsistent-declaration-parameter-name)
-
-// *dir -> error {{{
-DIR *opendir(const char *name) {
- return nullptr; } __(opendir)
-int closedir(DIR *dirp) {
- errno = EINVAL; return -1; } __(closedir)
-struct dirent *readdir(DIR *dirp) {
- return nullptr; } __(readdir)
-// }}}
-// FILE {{{
-int open(const char *pathname, int flags, ...) {
- errno = ENOENT; return -1; } __(open)
-int close(int fd) {
- errno = EBADF; return -1; } __(close)
-ssize_t read(int fd, void *buf, size_t count) {
- errno = EBADF; return -1; } __(read)
-
-#if 0
-ssize_t write(int fd, const void *buf, size_t count) {
- __builtin_debugtrap();
- errno = EBADF; return -1;
-} __(write)
-#endif
-
-off_t lseek(int fd, off_t offset, int whence) {
- errno = EBADF; return -1; } __(lseek)
-off64_t lseek64(int fd, off64_t offset, int whence) {
- errno = EBADF; return -1; } __(lseek64)
-
-FILE *fopen(const char *pathname, const char *mode) {
- errno = ENOENT; return nullptr; }
-FILE *fdopen(int fd, const char *mode) {
- errno = ENOENT; return nullptr; }
-int fclose(FILE *stream) {
- errno = EBADF; return EOF; }
-
-FILE *stdin = reinterpret_cast(1);
-FILE *stdout = reinterpret_cast(2);
-FILE *stderr = reinterpret_cast(3);
-
-int fileno(FILE *stream) {
- if (false);
- else if (stream == stdout)
- return 1;
- else if (stream == stderr)
- return 2;
- else abort();
-} __(fileno)
-
-size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
- const auto total(nmemb * size);
- // for some reason libcxx loves to call fwrite with 0 items during some kind of sync operation
- if (total == 0) return 0;
- // clang (incorrectly) rewrites fprintf() with constant format string to #,1 instead of 1,# :/
- // https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
- // https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/InstCombine/fprintf-1.ll
- // https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
- // https://virtuallyfun.com/wordpress/2018/03/01/fread-and-fwrite-demystified-stdio-on-unix-v7/
- // https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/libc/stdio/rdwr.c
- // https://retrocomputing.stackexchange.com/questions/16633/is-this-the-reason-why-fread-fwrite-has-2-size-t-arguments
- // https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/iofwrite.c;h=640b0a7c2be46e05b7c4750ce6f0330ad6e39d3d;hb=HEAD
- const auto writ(write(fileno(stream), ptr, total));
- return writ >= 0 ? writ / size : 0;
-}
-
-int fputc(int c, FILE *stream) {
- return fwrite(&c, 1, 1, stream) == 1 ? c : EOF;
-}
-
-int fputs(const char *s, FILE *stream) {
- return fwrite(s, 1, strlen(s), stream);
-}
-
-int fflush(FILE *stream) {
- return 0;
-}
-
-char *fgets(char *s, int size, FILE *stream) { abort(); }
-size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) { abort(); }
-size_t fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *stream) { abort(); } __(fread_unlocked)
-int fscanf(FILE *stream, const char *format, ...) { abort(); }
-int fseek(FILE *stream, long offset, int whence) { abort(); }
-int fseeko(FILE *stream, off_t offset, int whence) { abort(); }
-long ftell(FILE *stream) { abort(); }
-off_t ftello(FILE *stream) { abort(); } __(ftello)
-int getc(FILE *stream) { abort(); }
-void rewind(FILE *stream) { abort(); }
-int setvbuf(FILE *stream, char *buf, int mode, size_t size) { abort(); }
-FILE *tmpfile(void) { abort(); }
-int ungetc(int c, FILE *stream) { abort(); }
-// }}}
-// get* -> stub {{{
-char *secure_getenv(const char *name) { return nullptr; }
-char *getenv(const char *name) { return secure_getenv(name); }
-
-static const pid_t pid_(1);
-pid_t getpid() { return pid_; } __(getpid)
-
-static const gid_t gid_(500);
-gid_t getgid() { return gid_; } __(getgid)
-gid_t getegid() { return gid_; } __(getegid)
-
-static const uid_t uid_(500);
-uid_t getuid() { return uid_; } __(getuid)
-uid_t geteuid() { return uid_; } __(geteuid)
-// }}}
-// *link -> error {{{
-ssize_t readlink(const char *pathname, char *buf, size_t bufsiz) {
- errno = ENOENT; return -1; }
-int unlink(const char *pathname) {
- errno = ENOENT; return -1; }
-// }}}
-// pthread_* {{{
-int pthread_atfork(void (*) (), void (*) (), void (*) ()) { return 0; }
-int pthread_attr_destroy(pthread_attr_t *) { return 0; }
-int pthread_attr_init(pthread_attr_t *) { return 0; }
-int pthread_attr_setstacksize(pthread_attr_t *, size_t) { return 0; }
-int pthread_cond_broadcast(pthread_cond_t *) { return 0; }
-int pthread_cond_destroy(pthread_cond_t *) { return 0; }
-int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *) { return 0; }
-int pthread_cond_signal(pthread_cond_t *) { return 0; }
-int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *) { abort(); } // XXX
-int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) { abort(); }
-int pthread_condattr_destroy(pthread_condattr_t *) { return 0; }
-int pthread_condattr_init(pthread_condattr_t *) { return 0; }
-int pthread_condattr_setclock(pthread_condattr_t *, clockid_t) { return 0; }
-int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *) { abort(); }
-int pthread_equal(pthread_t, pthread_t) { return 1; }
-int pthread_join(pthread_t, void **) { abort(); }
-int pthread_kill(pthread_t, int) { abort(); }
-int pthread_mutex_destroy(pthread_mutex_t *) { return 0; }
-int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *) { return 0; }
-int pthread_mutex_lock(pthread_mutex_t *) { return 0; }
-int pthread_mutex_trylock(pthread_mutex_t *) { return 0; } __(pthread_mutex_lock)
-int pthread_mutex_unlock(pthread_mutex_t *) { return 0; } __(pthread_mutex_unlock)
-int pthread_mutexattr_destroy(pthread_mutexattr_t *) { return 0; }
-int pthread_mutexattr_init(pthread_mutexattr_t *) { return 0; }
-int pthread_mutexattr_settype(pthread_mutexattr_t *, int) { return 0; }
-int pthread_rwlock_destroy(pthread_rwlock_t *) { return 0; }
-int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *) { return 0; } __(pthread_rwlock_init)
-int pthread_rwlock_rdlock(pthread_rwlock_t *) { return 0; } __(pthread_rwlock_rdlock)
-int pthread_rwlock_tryrdlock(pthread_rwlock_t *) { return 0; }
-int pthread_rwlock_unlock(pthread_rwlock_t *) { return 0; } __(pthread_rwlock_unlock)
-int pthread_rwlock_wrlock(pthread_rwlock_t *) { return 0; } __(pthread_rwlock_wrlock)
-pthread_t pthread_self() { return 0; }
-void pthread_testcancel() {} __(pthread_testcancel)
-int pthread_setname_np(pthread_t, const char *) { return 0; }
-// }}}
-// pthread_once {{{
-int pthread_once (pthread_once_t *control, void (*routine)()) {
- if (*control == PTHREAD_ONCE_INIT) {
- *control = ~PTHREAD_ONCE_INIT;
- (*routine)();
- }
- return 0;
-} __(pthread_once)
-// }}}
-// pthread_*specific {{{
-static unsigned specific_(0);
-static const void *specifics_[64];
-
-int pthread_key_create(pthread_key_t *key, void (*)(void *)) {
- if (specific_ == sizeof(specifics_) / sizeof(specifics_[0])) abort();
- *key = specific_++;
- return 0;
-} __(pthread_key_create)
-
-int pthread_key_delete(pthread_key_t key) {
- return 0;
-}
-
-void *pthread_getspecific(pthread_key_t key) {
- return const_cast(specifics_[key]);
-}
-
-int pthread_setspecific(pthread_key_t key, const void *value) {
- specifics_[key] = value;
- return 0;
-}
-// }}}
-// sched* -> return {{{
-int __sched_cpucount(size_t, const cpu_set_t *) { return 1; }
-int sched_getcpu() { return 0; }
-int sched_setaffinity(pid_t, size_t, const cpu_set_t *) { return 0; }
-int sched_getaffinity(pid_t, size_t, cpu_set_t *) { return 0; }
-// }}}
-// sem_* {{{
-int sem_destroy(sem_t *) { return 0; }
-int sem_init(sem_t *, int, unsigned int) { return 0; }
-// XXX: implement EOVERFLOW
-int sem_post(sem_t *) { return 0; }
-int sem_wait(sem_t *) { abort(); }
-// }}}
-// *sig* -> abort {{{
-int pthread_sigmask(int, const sigset_t *, sigset_t *) { abort(); }
-int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { abort(); } __(sigaction)
-int sigemptyset(sigset_t *) { abort(); }
-int sigfillset(sigset_t *) { abort(); }
-sighandler_t signal(int signum, sighandler_t handler) { abort(); }
-// }}}
-// *stat -> error {{{
-int stat(const char *pathname, struct stat *statbuf) {
- errno = ENOENT; return -1; }
-int stat64(const char *pathname, struct stat64 *statbuf) {
- errno = ENOENT; return -1; } __(stat64)
-int fstat(int fd, struct stat *statbuf) {
- errno = EBADF; return -1; }
-int fstat64(int fd, struct stat64 *statbuf) {
- errno = EBADF; return -1; } __(fstat64)
-int lstat(const char *pathname, struct stat *statbuf) {
- errno = ENOENT; return -1; } __(lstat)
-int lstat64(const char *pathname, struct stat64 *statbuf) {
- errno = ENOENT; return -1; } __(lstat64)
-// }}}
-// sysconf {{{
-long sysconf(int name) {
- switch (name) {
- case _SC_NPROCESSORS_CONF:
- return 1;
- case _SC_NPROCESSORS_ONLN:
- return 1;
- case _SC_PAGESIZE:
- return 0x1000;
- case _SC_PHYS_PAGES:
- return 0x1000; // XXX
- case _SC_THREAD_STACK_MIN:
- return 0x10000; // XXX
- default:
- abort();
- errno = EINVAL;
- return -1;
- }
-}
-
-extern "C" __typeof(sysconf) __sysconf __attribute__((alias("sysconf")));
-// }}}
-// *time* {{{
-int clock_gettime(clockid_t clk_id, struct timespec *tp) {
- switch (clk_id) {
- case CLOCK_MONOTONIC:
- case CLOCK_MONOTONIC_COARSE:
- break;
- default: errno = EINVAL; return -1;
- }
-
- if (tp == nullptr) { errno = EFAULT; return -1; }
- // XXX: implement time!!!
- tp->tv_sec = 1000;
- tp->tv_nsec = 0;
- return 0;
-}
-
-int gettimeofday(struct timeval *tv, void *tz) {
- struct timespec tp;
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == -1) return -1;
- if (tz != nullptr) abort();
- tv->tv_sec = tp.tv_sec;
- tv->tv_usec = tp.tv_nsec / 1000;
- return 0;
-}
-
-time_t time(time_t *tloc) {
- struct timespec tp;
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == -1) return -1;
- if (tloc != nullptr) *tloc = tp.tv_sec;
- return tp.tv_sec;
-}
-// }}}
-
-extern "C" const char *_dl_get_origin () { return "/_"; }
-
+// XXX: consider implementing kernel-side
extern "C" void __tls_pre_init_tp() {}
extern "C" void __tls_init_tp() {}
-
-int prctl(int option, ...) { abort(); }
-
-long syscall(long number, ...) {
- switch (number) {
- case SYS_gettid:
- return pid_;
- default: abort();
- }
-}
-
-char *getcwd(char *buf, size_t size) {
- if (size < 2) { errno = ERANGE; return nullptr; }
- buf[0] = '/'; buf[1] = '\0'; return buf;
-} __(getcwd)
-
-
-int uname(struct utsname *buf) {
- snprintf(buf->sysname, sizeof(buf->sysname) - 1, "Linux");
- snprintf(buf->nodename, sizeof(buf->nodename) - 1, "V8");
- snprintf(buf->release, sizeof(buf->release) - 1, "4.4.0");
- snprintf(buf->version, sizeof(buf->version) - 1, "");
- snprintf(buf->machine, sizeof(buf->machine) - 1, "x86_64");
- snprintf(buf->domainname, sizeof(buf->domainname) - 1, "example.com");
- return 0;
-} __(uname)
-
-
-int raise(int sig) { abort(); }
-
-int kill(pid_t pid, int sig) {
- if (pid != pid_) abort();
- return raise(sig);
-}
-
-
-int sched_yield(void) { abort(); } __(sched_yield)
-
-int usleep(useconds_t usec) {
- if (usec != 0) abort();
- return 0;
-}
-
-// NOLINTEND(readability-inconsistent-declaration-parameter-name)
diff --git a/srv-worker/makefile b/srv-worker/makefile
index 31d639dfa..fb56f14fc 100644
--- a/srv-worker/makefile
+++ b/srv-worker/makefile
@@ -21,6 +21,7 @@
args :=
distro := ubuntu jammy 11
+crypto := boringssl
include env/target.mk
binary := $(output)/$(machine)/worker$(exe)
@@ -30,637 +31,56 @@ all: $(binary)
.PHONY: debug
debug: $(binary)
- lldb-14 -o 'b malloc_error_break' -o 'run $(args)' $<
+ lldb -o 'b malloc_error_break' -o 'run $(args)' $<
.PHONY: test
test: $(binary)
- strace -ff -e 'trace=!write' $< 2>&1 #| sed -e '0,/^execve(/d;/^orc_trace(/d;/^+++ /d;s/\(mmap([^,]*\),[^,]*/\1/;s/mmap(0x\([0-9a-f]*\),\(.*\)= 0x\1/mmap(0X,\2= 0X/;s/\(mmap(NULL,.*\)= 0x[0-9a-f]*/\1= 0X/;s///;s/^\(madvise\|mprotect\)(0x[0-9a-z]*, [0-9]*, /\1(/;s/^munmap(0x[0-9a-f]*, [0-9]*) */munmap() /' | sort | uniq -c | sort -nr
+ strace -ff -e 'trace=!write' $< 2>&1 | ./syscalls.sh
source += $(wildcard $(pwd)/source/*.cpp)
source += $(pwd)/libc.cpp
cflags += -I$(pwd)/source
-lflags += -nodefaultlibs
lflags += -static-pie
cflags += -ftls-model=local-exec
-lflags += -lm
lflags := $(filter-out -pthread,$(lflags))
-lflags += -lstdc++
-lflags += -lgcc
-lflags += -lgcc_eh
-
-
-# linked += {{{
-ifeq ($(machine),x86_64)
-linked += libc/cacheinfo.o
-linked += libc/dl-cet.o
-linked += libc/varshift.o
-
-linked += libc/float1282mpn.o
-linked += libc/mpn2float128.o
-linked += libc/strtof128.o
-linked += libc/strtof128_l.o
-linked += libc/strtof128_nan.o
-
-linked += libc/memchr-avx2.o
-linked += libc/memchr-avx2-rtm.o
-linked += libc/memchr-evex.o
-linked += libc/memchr-evex-rtm.o
-linked += libc/memchr-sse2.o
-linked += libc/memcmp-avx2-movbe.o
-linked += libc/memcmp-avx2-movbe-rtm.o
-linked += libc/memcmp-evex-movbe.o
-linked += libc/memcmp-sse2.o
-linked += libc/memcmp-sse4.o
-linked += libc/memcmp-ssse3.o
-linked += libc/memcpy-ssse3.o
-linked += libc/memcpy-ssse3-back.o
-linked += libc/memcpy_chk-nonshared.o
-linked += libc/memmove-avx-unaligned-erms.o
-linked += libc/memmove-avx-unaligned-erms-rtm.o
-linked += libc/memmove-avx512-no-vzeroupper.o
-linked += libc/memmove-avx512-unaligned-erms.o
-linked += libc/memmove-evex-unaligned-erms.o
-linked += libc/memmove-sse2-unaligned-erms.o
-linked += libc/memmove-ssse3.o
-linked += libc/memmove-ssse3-back.o
-linked += libc/memmove_chk-nonshared.o
-linked += libc/memset-avx2-unaligned-erms.o
-linked += libc/memset-avx2-unaligned-erms-rtm.o
-linked += libc/memset-avx512-no-vzeroupper.o
-linked += libc/memset-avx512-unaligned-erms.o
-linked += libc/memset-evex-unaligned-erms.o
-linked += libc/memset-sse2-unaligned-erms.o
-linked += libc/rawmemchr-avx2.o
-linked += libc/rawmemchr-avx2-rtm.o
-linked += libc/rawmemchr-evex.o
-linked += libc/rawmemchr-evex-rtm.o
-linked += libc/rawmemchr-sse2.o
-linked += libc/stpcpy-avx2.o
-linked += libc/stpcpy-avx2-rtm.o
-linked += libc/stpcpy-evex.o
-linked += libc/stpcpy-sse2.o
-linked += libc/stpcpy-sse2-unaligned.o
-linked += libc/stpcpy-ssse3.o
-linked += libc/strcasecmp_l-avx.o
-linked += libc/strcasecmp_l-nonascii.o
-linked += libc/strcasecmp_l-sse2.o
-linked += libc/strcasecmp_l-sse4_2.o
-linked += libc/strcasecmp_l-ssse3.o
-linked += libc/strcat-avx2.o
-linked += libc/strcat-avx2-rtm.o
-linked += libc/strcat-evex.o
-linked += libc/strcat-sse2.o
-linked += libc/strcat-sse2-unaligned.o
-linked += libc/strcat-ssse3.o
-linked += libc/strchr-avx2.o
-linked += libc/strchr-avx2-rtm.o
-linked += libc/strchr-evex.o
-linked += libc/strchr-sse2-no-bsf.o
-linked += libc/strchr-sse2.o
-linked += libc/strchrnul-avx2.o
-linked += libc/strchrnul-avx2-rtm.o
-linked += libc/strchrnul-evex.o
-linked += libc/strchrnul-sse2.o
-linked += libc/strcmp-avx2.o
-linked += libc/strcmp-avx2-rtm.o
-linked += libc/strcmp-evex.o
-linked += libc/strcmp-sse2.o
-linked += libc/strcmp-sse2-unaligned.o
-linked += libc/strcmp-sse4_2.o
-linked += libc/strcmp-ssse3.o
-linked += libc/strcpy-avx2.o
-linked += libc/strcpy-avx2-rtm.o
-linked += libc/strcpy-evex.o
-linked += libc/strcpy-sse2.o
-linked += libc/strcpy-sse2-unaligned.o
-linked += libc/strcpy-ssse3.o
-linked += libc/strcspn-c.o
-linked += libc/strcspn-sse2.o
-linked += libc/strlen-avx2.o
-linked += libc/strlen-avx2-rtm.o
-linked += libc/strlen-evex.o
-linked += libc/strlen-sse2.o
-linked += libc/strncase_l-avx.o
-linked += libc/strncase_l-nonascii.o
-linked += libc/strncase_l-sse2.o
-linked += libc/strncase_l-sse4_2.o
-linked += libc/strncase_l-ssse3.o
-linked += libc/strncat-avx2.o
-linked += libc/strncat-avx2-rtm.o
-linked += libc/strncat-c.o
-linked += libc/strncat-evex.o
-linked += libc/strncat-sse2-unaligned.o
-linked += libc/strncat-ssse3.o
-linked += libc/strncmp-avx2.o
-linked += libc/strncmp-avx2-rtm.o
-linked += libc/strncmp-evex.o
-linked += libc/strncmp-sse2.o
-linked += libc/strncmp-sse4_2.o
-linked += libc/strncmp-ssse3.o
-linked += libc/strncpy-avx2.o
-linked += libc/strncpy-avx2-rtm.o
-linked += libc/strncpy-c.o
-linked += libc/strncpy-evex.o
-linked += libc/strncpy-sse2-unaligned.o
-linked += libc/strncpy-ssse3.o
-linked += libc/strnlen-avx2.o
-linked += libc/strnlen-avx2-rtm.o
-linked += libc/strnlen-evex.o
-linked += libc/strnlen-sse2.o
-linked += libc/strrchr-avx2.o
-linked += libc/strrchr-avx2-rtm.o
-linked += libc/strrchr-evex.o
-linked += libc/strrchr-sse2.o
-linked += libc/strspn-c.o
-linked += libc/strspn-sse2.o
-linked += libc/strstr-sse2-unaligned.o
-linked += libc/wcschr-avx2.o
-linked += libc/wcschr-avx2-rtm.o
-linked += libc/wcschr-evex.o
-linked += libc/wcschr-sse2.o
-linked += libc/wcslen-avx2.o
-linked += libc/wcslen-avx2-rtm.o
-linked += libc/wcslen-evex.o
-linked += libc/wcslen-sse2.o
-linked += libc/wcslen-sse4_1.o
-linked += libc/wcsnlen-avx2.o
-linked += libc/wcsnlen-avx2-rtm.o
-linked += libc/wcsnlen-c.o
-linked += libc/wcsnlen-evex.o
-linked += libc/wcsnlen-sse4_1.o
-linked += libc/wmemchr-avx2.o
-linked += libc/wmemchr-avx2-rtm.o
-linked += libc/wmemchr-evex.o
-linked += libc/wmemchr-evex-rtm.o
-linked += libc/wmemchr-sse2.o
-linked += libc/wmemcmp-avx2-movbe.o
-linked += libc/wmemcmp-avx2-movbe-rtm.o
-linked += libc/wmemcmp-evex-movbe.o
-linked += libc/wmemcmp-c.o
-linked += libc/wmemcmp-sse4.o
-linked += libc/wmemcmp-ssse3.o
-endif
-
-ifeq ($(machine),arm64)
-linked += libc/dl-bti.o
-linked += libc/getauxval.o
-linked += libc/strchrnul.o
-linked += libc/sysdep.o
-
-linked += libc/memchr_generic.o
-linked += libc/memchr_nosimd.o
-linked += libc/memcpy_a64fx.o
-linked += libc/memcpy_advsimd.o
-linked += libc/memcpy_falkor.o
-linked += libc/memcpy_generic.o
-linked += libc/memcpy_thunderx.o
-linked += libc/memcpy_thunderx2.o
-linked += libc/memcpy_chk.o
-linked += libc/memset_a64fx.o
-linked += libc/memset_emag.o
-linked += libc/memset_falkor.o
-linked += libc/memset_generic.o
-linked += libc/memset_kunpeng.o
-linked += libc/strlen_asimd.o
-linked += libc/strlen_mte.o
-endif
-
-ifeq ($(machine),armhf)
-linked += libc/getauxval.o
-linked += libc/libc-do-syscall.o
-linked += libc/sysdep.o
-
-linked += libc/memchr_neon.o
-linked += libc/memchr_noneon.o
-linked += libc/memcpy_neon.o
-linked += libc/memcpy_vfp.o
-endif
-
-linked += libc/dl-reloc-static-pie.o
-linked += libc/libc-start.o
-
-linked += libc/abort.o
-linked += libc/assert.o
-linked += libc/atexit.o
-linked += libc/backtrace.o
-linked += libc/backtracesyms.o
-linked += libc/cancellation.o
-linked += libc/chk_fail.o
-linked += libc/cxa_atexit.o
-linked += libc/errno.o
-linked += libc/errno-loc.o
-linked += libc/exit.o
-linked += libc/_exit.o
-linked += libc/fortify_fail.o
-linked += libc/libc_fatal.o
-linked += libc/msort.o
-linked += libc/qsort.o
-linked += libc/stack_chk_fail.o
-
-linked += libc/SYS_libc.o
-linked += libc/argz-addsep.o
-linked += libc/argz-create.o
-linked += libc/argz-ctsep.o
-linked += libc/brk.o
-linked += libc/check_fds.o
-linked += libc/ctype.o
-linked += libc/ctype-info.o
-linked += libc/dcgettext.o
-linked += libc/dcigettext.o
-linked += libc/elision-conf.o
-linked += libc/enbl-secure.o
-linked += libc/errlist.o
-linked += libc/explodename.o
-linked += libc/filedoalloc.o
-linked += libc/fileops.o
-linked += libc/finddomain.o
-linked += libc/genops.o
-linked += libc/getdents64.o
-linked += libc/getpagesize.o
-linked += libc/getrlimit64.o
-linked += libc/global-locale.o
-linked += libc/hash-string.o
-linked += libc/init-first.o
-linked += libc/init-misc.o
-linked += libc/iofclose.o
-linked += libc/iofgets_u.o
-linked += libc/iofopen.o
-linked += libc/iofwide.o
-linked += libc/iogetdelim.o
-linked += libc/iogetline.o
-linked += libc/isatty.o
-linked += libc/l10nflist.o
-linked += libc/lc-ctype.o
-linked += libc/libc-cleanup.o
-linked += libc/libc-tls.o
-linked += libc/libc_dlerror_result.o
-linked += libc/libc_early_init.o
-linked += libc/loadarchive.o
-linked += libc/loadmsgcat.o
-linked += libc/localealias.o
-linked += libc/localename.o
-linked += libc/lowlevellock.o
-linked += libc/nptl-stack.o
-linked += libc/nptl_deallocate_tsd.o
-linked += libc/nptl_nthreads.o
-linked += libc/plural-exp.o
-linked += libc/plural.o
-linked += libc/prof-freq.o
-linked += libc/profil.o
-linked += libc/pthread_keys.o
-linked += libc/pthread_mutex_conf.o
-linked += libc/pthread_setcancelstate.o
-linked += libc/pthread_sigmask.o
-linked += libc/rtld_static_init.o
-linked += libc/sbrk.o
-linked += libc/sched_getp.o
-linked += libc/sched_gets.o
-linked += libc/sched_primax.o
-linked += libc/sched_primin.o
-linked += libc/sched_sets.o
-linked += libc/scratch_buffer_set_array_size.o
-linked += libc/setitimer.o
-linked += libc/sigjmp.o
-linked += libc/sigprocmask.o
-linked += libc/single_threaded.o
-linked += libc/stdfiles.o
-linked += libc/_strerror.o
-linked += libc/strops.o
-linked += libc/tcgetattr.o
-linked += libc/tlsdesc.o
-linked += libc/tpp.o
-linked += libc/tsearch.o
-linked += libc/vars.o
-linked += libc/vtables.o
-linked += libc/wfiledoalloc.o
-linked += libc/wfileops.o
-linked += libc/wgenops.o
-
-linked += libc/alloc_buffer_alloc_array.o
-linked += libc/alloc_buffer_create_failure.o
-linked += libc/alt_digit.o
-linked += libc/era.o
-linked += libc/gmtime.o
-linked += libc/lc-time-cleanup.o
-linked += libc/localtime.o
-linked += libc/mktime.o
-linked += libc/offtime.o
-linked += libc/strftime.o
-linked += libc/strftime_l.o
-linked += libc/tzfile.o
-linked += libc/tzset.o
-
-linked += libc/div.o
-linked += libc/s_ldexp.o
-linked += libc/s_scalbn.o
-
-linked += libc/memchr.o
-linked += libc/memcmp.o
-linked += libc/memcpy.o
-linked += libc/memmem.o
-linked += libc/memmove.o
-linked += libc/memmove_chk.o
-linked += libc/mempcpy.o
-linked += libc/memset.o
-linked += libc/rawmemchr.o
-linked += libc/stpcpy.o
-linked += libc/strcasecmp.o
-linked += libc/strcasecmp_l.o
-linked += libc/strcat.o
-linked += libc/strchr.o
-linked += libc/strchrnul.o
-linked += libc/strcmp.o
-linked += libc/strcpy.o
-linked += libc/strcspn.o
-linked += libc/strdup.o
-linked += libc/strlen.o
-linked += libc/strncase_l.o
-linked += libc/strncat.o
-linked += libc/strncmp.o
-linked += libc/strncpy.o
-linked += libc/strndup.o
-linked += libc/strnlen.o
-linked += libc/strrchr.o
-linked += libc/strsep.o
-linked += libc/strspn.o
-linked += libc/strstr.o
-linked += libc/strtok_r.o
-linked += libc/wcrtomb.o
-linked += libc/wcschr.o
-linked += libc/wcschrnul.o
-linked += libc/wcslen.o
-linked += libc/wcsmbsload.o
-linked += libc/wcsnlen.o
-linked += libc/wcsnrtombs.o
-linked += libc/wmemchr.o
-linked += libc/wmemcpy.o
-linked += libc/wmemcpy_chk.o
-linked += libc/wmemmove.o
-linked += libc/wmemmove_chk.o
-linked += libc/wmempcpy.o
-linked += libc/wmemset.o
-
-linked += libc/mbrlen.o
-linked += libc/mbrtowc.o
-linked += libc/mbsnrtowcs.o
-linked += libc/mbsrtowcs.o
-linked += libc/mbsrtowcs_l.o
-linked += libc/mbtowc.o
-
-linked += libc/add_n.o
-linked += libc/addmul_1.o
-linked += libc/atoi.o
-linked += libc/cmp.o
-linked += libc/fpioconst.o
-linked += libc/grouping.o
-linked += libc/_itoa.o
-linked += libc/itoa-digits.o
-linked += libc/itoa-udigits.o
-linked += libc/lshift.o
-linked += libc/mb_cur_max.o
-linked += libc/mpn2dbl.o
-linked += libc/mpn2flt.o
-linked += libc/mpn2ldbl.o
-linked += libc/mul.o
-linked += libc/mul_1.o
-linked += libc/mul_n.o
-linked += libc/rshift.o
-linked += libc/strtod.o
-linked += libc/strtod_l.o
-linked += libc/strtod_nan.o
-linked += libc/strtof.o
-linked += libc/strtof_l.o
-linked += libc/strtof_nan.o
-linked += libc/strtol.o
-linked += libc/strtol_l.o
-linked += libc/strtold.o
-linked += libc/strtold_l.o
-linked += libc/strtold_nan.o
-linked += libc/strtoul.o
-linked += libc/strtoul_l.o
-linked += libc/sub_n.o
-linked += libc/submul_1.o
-linked += libc/tens_in_limb.o
-
-linked += libc/madvise.o
-linked += libc/mmap.o
-linked += libc/mmap64.o
-linked += libc/mprotect.o
-linked += libc/mremap.o
-linked += libc/munmap.o
-
-ifeq (,)
-linked += libc/libc_multiple_threads.o
-linked += libc/write.o
-endif
-
-linked += libc/C-address.o
-linked += libc/C-collate.o
-linked += libc/C-ctype.o
-linked += libc/C-identification.o
-linked += libc/C-measurement.o
-linked += libc/C-messages.o
-linked += libc/C-monetary.o
-linked += libc/C-name.o
-linked += libc/C-numeric.o
-linked += libc/C-paper.o
-linked += libc/C-telephone.o
-linked += libc/C-time.o
-linked += libc/C_name.o
-
-linked += libc/catgets.o
-linked += libc/findlocale.o
-linked += libc/freelocale.o
-linked += libc/loadlocale.o
-linked += libc/newlocale.o
-linked += libc/open_catalog.o
-linked += libc/setlocale.o
-linked += libc/uselocale.o
-linked += libc/xlocale.o
-
-linked += libc/dl-addr.o
-linked += libc/dl-addr-obj.o
-linked += libc/dl-cache.o
-linked += libc/dl-call-libc-early-init.o
-linked += libc/dl-close.o
-linked += libc/dl-debug.o
-linked += libc/dl-debug-symbols.o
-linked += libc/dl-deps.o
-linked += libc/dl-error.o
-linked += libc/dl-exception.o
-linked += libc/dl-execstack.o
-linked += libc/dl-find_object.o
-linked += libc/dl-init.o
-linked += libc/dl-iteratephdr.o
-linked += libc/dl-libc.o
-linked += libc/dl-load.o
-linked += libc/dl-lookup.o
-linked += libc/dl-lookup-direct.o
-linked += libc/dl-minimal-malloc.o
-linked += libc/dl-misc.o
-linked += libc/dl-object.o
-linked += libc/dl-open.o
-linked += libc/dl-printf.o
-linked += libc/dl-profile.o
-linked += libc/dl-profstub.o
-linked += libc/dl-reloc.o
-linked += libc/dl-runtime.o
-linked += libc/dl-scope.o
-linked += libc/dl-setup_hash.o
-linked += libc/dl-sort-maps.o
-linked += libc/dl-support.o
-linked += libc/dl-sym.o
-linked += libc/dl-sysdep.o
-linked += libc/dl-thread_gscope_wait.o
-linked += libc/dl-tls.o
-linked += libc/dl-tlsdesc.o
-linked += libc/dl-trampoline.o
-linked += libc/dl-tunables.o
-linked += libc/dl-version.o
-
-linked += libc/dladdr.o
-linked += libc/dladdr1.o
-linked += libc/dlclose.o
-linked += libc/dlerror.o
-linked += libc/dlinfo.o
-linked += libc/dlmopen.o
-linked += libc/dlopen.o
-linked += libc/dlsym.o
-linked += libc/dlvsym.o
-
-linked += libc/bsd-_setjmp.o
-linked += libc/__longjmp.o
-linked += libc/longjmp.o
-linked += libc/setjmp.o
-
-linked += libc/alloca_cutoff.o
-linked += libc/environ.o
-linked += libc/setenv.o
-
-linked += libc/gconv.o
-linked += libc/gconv_builtin.o
-linked += libc/gconv_cache.o
-linked += libc/gconv_charset.o
-linked += libc/gconv_close.o
-linked += libc/gconv_conf.o
-linked += libc/gconv_db.o
-linked += libc/gconv_dl.o
-linked += libc/gconv_open.o
-linked += libc/gconv_simple.o
-linked += libc/gconv_trans.o
-
-linked += libc/asprintf.o
-linked += libc/btowc.o
-linked += libc/dbl2mpn.o
-linked += libc/divrem.o
-linked += libc/fprintf.o
-linked += libc/fxprintf.o
-linked += libc/funlockfile.o
-linked += libc/iofflush.o
-linked += libc/iopadn.o
-linked += libc/iovsprintf.o
-linked += libc/iowpadn.o
-linked += libc/isoc99_sscanf.o
-linked += libc/isoc99_vsscanf.o
-linked += libc/itowa-digits.o
-linked += libc/lc-monetary.o
-linked += libc/lc-numeric.o
-linked += libc/ldbl2mpn.o
-linked += libc/printf.o
-linked += libc/printf-parsemb.o
-linked += libc/printf-parsewc.o
-linked += libc/printf_fp.o
-linked += libc/printf_fphex.o
-linked += libc/readonly-area.o
-linked += libc/reg-modifier.o
-linked += libc/reg-printf.o
-linked += libc/reg-type.o
-linked += libc/scratch_buffer_grow_preserve.o
-linked += libc/snprintf.o
-linked += libc/sprintf.o
-linked += libc/towctrans.o
-linked += libc/vasprintf.o
-linked += libc/vasprintf_chk.o
-linked += libc/vfprintf-internal.o
-linked += libc/vfprintf_chk.o
-linked += libc/vfscanf-internal.o
-linked += libc/vfwprintf-internal.o
-linked += libc/vprintf_chk.o
-linked += libc/vsnprintf.o
-linked += libc/vsnprintf_chk.o
-linked += libc/wcsrtombs.o
-linked += libc/wctrans.o
-
-linked += libc/ctype_l.o
-linked += libc/localeconv.o
-linked += libc/wcfuncs_l.o
-linked += libc/wctob.o
-linked += libc/wmemcmp.o
-
-ifeq (,)
-linked += libc/close_nocancel.o
-linked += libc/pread64_nocancel.o
-linked += libc/open64_nocancel.o
-linked += libc/fcntl_nocancel.o
-linked += libc/write_nocancel.o
-linked += libc/read_nocancel.o
-endif
-# }}}
-
-
cflags/$(pwd)/source/main.cpp += -Wno-deprecated-enum-enum-conversion
+cflags += -I$(pwd)/extra
$(call include,cv8/target.mk)
+$(call include,lib/target.mk)
+# XXX: I might not need this anymore
cflags += -D_LIBCPP_HAS_NO_STDIN=
+# XXX: I might not need this anymore
w_icu4c += ac_cv_var_timezone=no
w_icu4c += ac_cv_var___timezone=no
w_icu4c += ac_cv_var_tzname=no
w_icu4c += ac_cv_var__tzname=no
w_icu4c += ac_cv_func_tzset=no
+include jemalloc.mk
-w_jemalloc += --disable-cxx
-w_jemalloc += --disable-libdl
-w_jemalloc += --disable-stats
-w_jemalloc += --disable-syscall
-w_jemalloc += --enable-debug
-w_jemalloc += --with-malloc-conf=tcache:false
-
-w_jemalloc += ac_cv_func_sbrk=no
-w_jemalloc += force_tls=0
-
-jemalloc := lib/libjemalloc_pic.a
-$(output)/%/$(pwd)/jemalloc/$(jemalloc): $(output)/%/$(pwd)/jemalloc/Makefile
- $(MAKE) -C $(dir $<) $(jemalloc)
-linked += $(pwd)/jemalloc/$(jemalloc)
+include capnproto.mk
-ifeq ($(machine),x86_64)
-lib := $(output)/sysroot/usr/lib/$(host/$(machine))
-else
-lib := $(output)/sysroot/usr/$(host/$(machine))/lib
-endif
-
-$(output)/$(machine)/libc.: $(output)/sysroot
- @rm -rf $(basename $@)
- @mkdir -p $(basename $@)
- cd $(basename $@) && $(ar/$(machine)) -x $(CURDIR)/$(lib)/libc.a
- @touch $@
-
-$(output)/$(machine)/libc/%.o: $(output)/$(machine)/libc.
- @
+cflags += -I$(pwd)/workerd/src
+cflags += -I$(output)/capnp/workerd/src
+#source += $(filter-out %-test.c++,$(wildcard $(pwd)/workerd/src/workerd/api/crypto-impl-*.c++))
+header += $(output)/capnp/$(pwd)/capnproto/c++/src/capnp/compat/byte-stream.capnp.h
+header += $(output)/capnp/$(pwd)/capnproto/c++/src/capnp/compat/http-over-capnp.capnp.h
-$(call include,ssl/target.mk)
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/io/actor-storage.capnp.h
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/io/compatibility-date.capnp.h
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/io/outcome.capnp.h
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/io/script-version.capnp.h
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/io/worker-interface.capnp.h
-cflags += -I$(pwd)/capnproto/c++/src
-cflags += -I$(pwd)/workerd/src
-#source += $(wildcard $(pwd)/workerd/src/workerd/api/crypto-impl-aes.c++)
+header += $(output)/capnp/$(pwd)/workerd/src/workerd/jsg/modules.capnp.h
include env/output.mk
diff --git a/srv-worker/source/main.cpp b/srv-worker/source/main.cpp
index f4c14a06a..c868853c4 100644
--- a/srv-worker/source/main.cpp
+++ b/srv-worker/source/main.cpp
@@ -22,6 +22,8 @@
#include
+#include
+
#include
#include
@@ -29,6 +31,7 @@
#include "src/snapshot/snapshot.h"
#include "scope.hpp"
+#include "syscall.hpp"
void Test(const v8::FunctionCallbackInfo &args) {
const auto isolate(args.GetIsolate());
@@ -47,11 +50,7 @@ int main(int argc, char *argv[], char **envp) {
v8::V8::InitializeExternalStartupData(argv[0]);
v8::V8::SetEntropySource([](unsigned char *data, size_t size) {
- // XXX: this is not security critical for our daemon, but might have effects on user code
- // there isn't a good source of entropy right now in the worker process; I should add one
- // NOLINTNEXTLINE(cert-msc32-c,cert-msc51-cpp)
- static const std::independent_bits_engine engine;
- std::generate(data, data + size, engine);
+ orc_assert(orc_syscall(getrandom(data, size, 0)) == size);
return true;
});
diff --git a/srv-worker/source/scope.hpp b/srv-worker/source/scope.hpp
deleted file mode 120000
index 86f83e0db..000000000
--- a/srv-worker/source/scope.hpp
+++ /dev/null
@@ -1 +0,0 @@
-../../p2p/source/scope.hpp
\ No newline at end of file
diff --git a/srv-worker/ssl b/srv-worker/ssl
deleted file mode 120000
index febdfe4ce..000000000
--- a/srv-worker/ssl
+++ /dev/null
@@ -1 +0,0 @@
-../min-openssl
\ No newline at end of file
diff --git a/srv-worker/syscalls.sh b/srv-worker/syscalls.sh
new file mode 100755
index 000000000..a95072f0d
--- /dev/null
+++ b/srv-worker/syscalls.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+sed -e '0,/^execve(/d;/^orc_trace(/d;/^+++ /d;s/\(mmap([^,]*\),[^,]*/\1/;s/mmap(0x\([0-9a-f]*\),\(.*\)= 0x\1/mmap(0X,\2= 0X/;s/\(mmap(NULL,.*\)= 0x[0-9a-f]*/\1= 0X/;s///;s/^\(madvise\|mprotect\)(0x[0-9a-z]*, [0-9]*, /\1(/;s/^munmap(0x[0-9a-f]*, [0-9]*) */munmap() /' | sort | uniq -c | sort -nr
diff --git a/tst-ethereum/lib b/tst-ethereum/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-ethereum/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-ethereum/makefile b/tst-ethereum/makefile
index f248e7607..10ff9dd66 100644
--- a/tst-ethereum/makefile
+++ b/tst-ethereum/makefile
@@ -32,7 +32,7 @@ test: $(output)/$(machine)/orchid$(exe)
source += $(wildcard source/*.cpp)
cflags += -Isource
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
include env/output.mk
$(output)/%/orchid$(exe): $(patsubst %,$(output)/$$*/%,$(object) $(linked))
diff --git a/tst-ethereum/p2p b/tst-ethereum/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-ethereum/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/tst-explore/env b/tst-explore/env
index 9e1ff3db4..971e97aa3 120000
--- a/tst-explore/env
+++ b/tst-explore/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-explore/lib b/tst-explore/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-explore/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-explore/makefile b/tst-explore/makefile
index 8b2ae4c1d..837b7bd0c 100644
--- a/tst-explore/makefile
+++ b/tst-explore/makefile
@@ -37,7 +37,7 @@ debug: $(output)/$(machine)/orchid$(exe)
lldb -o 'run $(args)' $<
$(call include,cro/target.mk)
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
source += $(wildcard $(pwd)/source/*.cpp)
diff --git a/tst-explore/p2p b/tst-explore/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-explore/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/tst-finance/env b/tst-finance/env
index 9e1ff3db4..971e97aa3 120000
--- a/tst-finance/env
+++ b/tst-finance/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-finance/lib b/tst-finance/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-finance/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-finance/makefile b/tst-finance/makefile
index 5cfcba3f9..4d6128293 100644
--- a/tst-finance/makefile
+++ b/tst-finance/makefile
@@ -33,15 +33,15 @@ test: $(output)/$(machine)/orchid$(exe)
debug: $(output)/$(machine)/orchid$(exe)
lldb -o 'run $(args)' $<
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
$(call include,zlb/target.mk)
source += $(wildcard source/*.cpp)
-cflags += -I$(pwd)/p2p/boost/libs/iostreams/include
+cflags += -I$(pwd)/lib/boost/libs/iostreams/include
-source += $(pwd)/p2p/boost/libs/iostreams/src/gzip.cpp
-source += $(pwd)/p2p/boost/libs/iostreams/src/zlib.cpp
+source += $(pwd)/lib/boost/libs/iostreams/src/gzip.cpp
+source += $(pwd)/lib/boost/libs/iostreams/src/zlib.cpp
include env/output.mk
diff --git a/tst-finance/p2p b/tst-finance/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-finance/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/tst-metadata/env b/tst-metadata/env
index 9e1ff3db4..971e97aa3 120000
--- a/tst-metadata/env
+++ b/tst-metadata/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-metadata/lib b/tst-metadata/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-metadata/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-metadata/makefile b/tst-metadata/makefile
index 6ce152c29..2de41eb6f 100644
--- a/tst-metadata/makefile
+++ b/tst-metadata/makefile
@@ -33,7 +33,7 @@ test: $(output)/$(machine)/orchid$(exe)
debug: $(output)/$(machine)/orchid$(exe)
lldb -o 'run $(args)' $<
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
source += $(wildcard source/*.cpp)
diff --git a/tst-metadata/p2p b/tst-metadata/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-metadata/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/tst-network/env b/tst-network/env
index db4309187..971e97aa3 120000
--- a/tst-network/env
+++ b/tst-network/env
@@ -1 +1 @@
-vpn/p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-openvpn3/env b/tst-openvpn3/env
index db4309187..971e97aa3 120000
--- a/tst-openvpn3/env
+++ b/tst-openvpn3/env
@@ -1 +1 @@
-vpn/p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-openvpn3/makefile b/tst-openvpn3/makefile
index cf92c346e..c26014629 100644
--- a/tst-openvpn3/makefile
+++ b/tst-openvpn3/makefile
@@ -35,8 +35,8 @@ test: $(output)/$(machine)/orchid$(exe)
debug: $(output)/$(machine)/orchid$(exe)
sudo lldb -o 'run $(args)' $<
-source += $(wildcard vpn/p2p/lz4/lib/*.c)
-cflags += -Ivpn/p2p/lz4/lib
+source += $(wildcard vpn/lib/lz4/lib/*.c)
+cflags += -Ivpn/lib/lz4/lib
cflags += -DUSE_ASIO
cflags += -DUSE_ASIO_THREADLOCAL
@@ -44,20 +44,20 @@ cflags += -DHAVE_LZ4
cflags += -DUSE_OPENSSL
cflags += -D'OPENVPN_PACKET_LOG="packet.log"'
-cflags += -Ivpn/p2p/openvpn3
-cflags += -Ivpn/p2p/openvpn3/client
+cflags += -Ivpn/lib/openvpn3
+cflags += -Ivpn/lib/openvpn3/client
ifeq ($(target),ios)
-cflags/vpn/p2p/openvpn3 += -ObjC++
+cflags/vpn/lib/openvpn3 += -ObjC++
endif
-cflags += -Ivpn/p2p/source
+cflags += -Ivpn/lib/source
-$(call include,vpn/p2p/asio.mk)
-$(call include,vpn/p2p/rtc/openssl.mk)
+$(call include,vpn/lib/asio.mk)
+$(call include,vpn/lib/webrtc/openssl.mk)
-source += vpn/p2p/openvpn3/test/ovpncli/cli.cpp
-source += vpn/p2p/source/log.cpp
+source += vpn/lib/openvpn3/test/ovpncli/cli.cpp
+source += vpn/lib/source/log.cpp
ifeq ($(target),mac)
lflags += -framework CoreServices
diff --git a/tst-share/env b/tst-share/env
index 9e1ff3db4..971e97aa3 120000
--- a/tst-share/env
+++ b/tst-share/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-share/lib b/tst-share/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-share/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-share/makefile b/tst-share/makefile
index 14bede858..c5cc6dd21 100644
--- a/tst-share/makefile
+++ b/tst-share/makefile
@@ -36,7 +36,7 @@ test: $(output)/$(machine)/orchid$(exe)
debug: $(output)/$(machine)/orchid$(exe)
lldb -o 'run $(args)' $<
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
source += $(wildcard $(pwd)/source/*.cpp)
diff --git a/tst-share/p2p b/tst-share/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-share/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/tst-ticket/env b/tst-ticket/env
index 9e1ff3db4..971e97aa3 120000
--- a/tst-ticket/env
+++ b/tst-ticket/env
@@ -1 +1 @@
-p2p/rtc/env
\ No newline at end of file
+../env
\ No newline at end of file
diff --git a/tst-ticket/lib b/tst-ticket/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/tst-ticket/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/tst-ticket/makefile b/tst-ticket/makefile
index fe195aac0..dd22e2e9a 100644
--- a/tst-ticket/makefile
+++ b/tst-ticket/makefile
@@ -34,7 +34,7 @@ test: $(output)/$(machine)/ticket$(exe)
debug: $(output)/$(machine)/ticket$(exe)
lldb -o 'run $(args)' $<
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
source += $(wildcard source/*.cpp)
diff --git a/tst-ticket/p2p b/tst-ticket/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/tst-ticket/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/vpn-shared/lib b/vpn-shared/lib
new file mode 120000
index 000000000..e563ee719
--- /dev/null
+++ b/vpn-shared/lib
@@ -0,0 +1 @@
+../lib-protocol
\ No newline at end of file
diff --git a/vpn-shared/p2p b/vpn-shared/p2p
deleted file mode 120000
index 86974347a..000000000
--- a/vpn-shared/p2p
+++ /dev/null
@@ -1 +0,0 @@
-../p2p
\ No newline at end of file
diff --git a/vpn-shared/target.mk b/vpn-shared/target.mk
index 253d2e49a..c15564c5c 100644
--- a/vpn-shared/target.mk
+++ b/vpn-shared/target.mk
@@ -42,4 +42,4 @@ endif
$(call include,libevent.mk)
$(call include,wsk/target.mk)
-$(call include,p2p/target.mk)
+$(call include,lib/target.mk)
diff --git a/vpn-shared/tor.mk b/vpn-shared/tor.mk
index 22e6860ca..fd434b2a7 100644
--- a/vpn-shared/tor.mk
+++ b/vpn-shared/tor.mk
@@ -33,7 +33,8 @@ deps += $(pwd)/libevent/.libs/libevent_core.a
w_tor += tor_cv_library_zlib_dir="(system)"
p_tor += -I@/openssl/include
-p_tor += -I$(CURDIR)/$(pwd)/p2p/rtc/openssl/include
+# XXX: I don't think openssl is in this folder anymore
+p_tor += -I$(CURDIR)/$(pwd)/lib/webrtc/openssl/include
deps += openssl/include/openssl/opensslconf.h
l_tor += -L@/openssl
deps += openssl/libssl.a