Skip to content

Commit 240b580

Browse files
committed
Update gitian build, glibc back compat, cleanup
Implemented a version of these pull requests from upstream: bitcoin/bitcoin#13177 bitcoin/bitcoin#13171
1 parent 96460dd commit 240b580

7 files changed

Lines changed: 66 additions & 36 deletions

File tree

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ if test x$use_glibc_compat != xno; then
549549
[ fdelt_type="long int"])
550550
AC_MSG_RESULT($fdelt_type)
551551
AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
552+
AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"])
553+
AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"])
552554
else
553555
AC_SEARCH_LIBS([clock_gettime],[rt])
554556
fi
@@ -1236,6 +1238,7 @@ AC_SUBST(DRIVENET_CLI_NAME)
12361238
AC_SUBST(DRIVENET_TX_NAME)
12371239

12381240
AC_SUBST(RELDFLAGS)
1241+
AC_SUBST(COMPAT_LDFLAGS)
12391242
AC_SUBST(ERROR_CXXFLAGS)
12401243
AC_SUBST(HARDENED_CXXFLAGS)
12411244
AC_SUBST(HARDENED_CPPFLAGS)

contrib/devtools/symbol-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
# Ignore symbols that are exported as part of every executable
4949
IGNORE_EXPORTS = {
50-
b'_edata', b'_end', b'_init', b'__bss_start', b'_fini', b'_IO_stdin_used'
50+
b'_edata', b'_end', b'_init', b'__bss_start', b'_fini', b'_IO_stdin_used', 'stdin', 'stdout', 'stderr'
5151
}
5252
READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
5353
CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')

contrib/gitian-build.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ then
236236
if [[ -n "$USE_LXC" ]]
237237
then
238238
sudo apt-get install lxc
239-
bin/make-base-vm --suite trusty --arch amd64 --lxc
239+
bin/make-base-vm --suite bionic --arch amd64 --lxc
240240
else
241-
bin/make-base-vm --suite trusty --arch amd64
241+
bin/make-base-vm --suite bionic --arch amd64
242242
fi
243243
popd
244244
fi
@@ -254,12 +254,12 @@ if [[ $build = true ]]
254254
then
255255
# Make output folder
256256
mkdir -p ./bitcoin-binaries/${VERSION}
257-
257+
258258
# Build Dependencies
259259
echo ""
260260
echo "Building Dependencies"
261261
echo ""
262-
pushd ./gitian-builder
262+
pushd ./gitian-builder
263263
mkdir -p inputs
264264
wget -N -P inputs $osslPatchUrl
265265
wget -N -P inputs $osslTarUrl
@@ -328,10 +328,10 @@ then
328328
echo "Verifying v${VERSION} Windows"
329329
echo ""
330330
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-win.yml
331-
# Mac OSX
331+
# Mac OSX
332332
echo ""
333333
echo "Verifying v${VERSION} Mac OSX"
334-
echo ""
334+
echo ""
335335
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml
336336
# Signed Windows
337337
echo ""
@@ -342,14 +342,14 @@ then
342342
echo ""
343343
echo "Verifying v${VERSION} Signed Mac OSX"
344344
echo ""
345-
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-signed ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml
345+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-signed ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml
346346
popd
347347
fi
348348

349349
# Sign binaries
350350
if [[ $sign = true ]]
351351
then
352-
352+
353353
pushd ./gitian-builder
354354
# Sign Windows
355355
if [[ $windows = true ]]

contrib/gitian-descriptors/gitian-linux.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
name: "DriveNet-linux-0.21"
33
enable_cache: true
44
suites:
5-
- "trusty"
5+
- "bionic"
66
architectures:
77
- "amd64"
88
packages:
99
- "curl"
1010
- "g++-aarch64-linux-gnu"
11-
- "g++-4.8-aarch64-linux-gnu"
12-
- "gcc-4.8-aarch64-linux-gnu"
11+
- "g++-8-aarch64-linux-gnu"
12+
- "gcc-8-aarch64-linux-gnu"
1313
- "binutils-aarch64-linux-gnu"
1414
- "g++-arm-linux-gnueabihf"
15-
- "g++-4.8-arm-linux-gnueabihf"
16-
- "gcc-4.8-arm-linux-gnueabihf"
15+
- "g++-8-arm-linux-gnueabihf"
16+
- "gcc-8-arm-linux-gnueabihf"
1717
- "binutils-arm-linux-gnueabihf"
18-
- "g++-4.8-multilib"
19-
- "gcc-4.8-multilib"
18+
- "g++-8-multilib"
19+
- "gcc-8-multilib"
2020
- "binutils-gold"
21-
- "git-core"
21+
- "git"
2222
- "pkg-config"
2323
- "autoconf"
2424
- "libtool"

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ libdrivenet_util_a_SOURCES = \
371371

372372
if GLIBC_BACK_COMPAT
373373
libdrivenet_util_a_SOURCES += compat/glibc_compat.cpp
374+
AM_LDFLAGS += $(COMPAT_LDFLAGS)
374375
endif
375376

376377
# cli: shared between drivenet-cli and drivenet-qt

src/compat/glibc_compat.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#endif
88

99
#include <cstddef>
10+
#include <cstdint>
1011

1112
#if defined(HAVE_SYS_SELECT_H)
1213
#include <sys/select.h>
@@ -27,3 +28,47 @@ extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
2728
return a / __NFDBITS;
2829
}
2930
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
31+
32+
#if defined(__i386__) || defined(__arm__)
33+
34+
extern "C" int64_t __udivmoddi4(uint64_t u, uint64_t v, uint64_t* rp);
35+
36+
extern "C" int64_t __wrap___divmoddi4(int64_t u, int64_t v, int64_t* rp)
37+
{
38+
int32_t c1 = 0, c2 = 0;
39+
int64_t uu = u, vv = v;
40+
int64_t w;
41+
int64_t r;
42+
43+
if (uu < 0) {
44+
c1 = ~c1, c2 = ~c2, uu = -uu;
45+
}
46+
if (vv < 0) {
47+
c1 = ~c1, vv = -vv;
48+
}
49+
50+
w = __udivmoddi4(uu, vv, (uint64_t*)&r);
51+
if (c1)
52+
w = -w;
53+
if (c2)
54+
r = -r;
55+
56+
*rp = r;
57+
return w;
58+
}
59+
#endif
60+
61+
extern "C" float log2f_old(float x);
62+
#ifdef __i386__
63+
__asm(".symver log2f_old,log2f@GLIBC_2.1");
64+
#elif defined(__amd64__)
65+
__asm(".symver log2f_old,log2f@GLIBC_2.2.5");
66+
#elif defined(__arm__)
67+
__asm(".symver log2f_old,log2f@GLIBC_2.4");
68+
#elif defined(__aarch64__)
69+
__asm(".symver log2f_old,log2f@GLIBC_2.17");
70+
#endif
71+
extern "C" float __wrap_log2f(float x)
72+
{
73+
return log2f_old(x);
74+
}

src/validation.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5263,9 +5263,6 @@ bool LoadDepositCache()
52635263
return false;
52645264
}
52655265

5266-
// TODO log this
5267-
uint64_t fileSize = fs::file_size(path);
5268-
52695266
std::vector<SidechainDeposit> vDeposit;
52705267
try {
52715268
int nVersionRequired, nVersionThatWrote;
@@ -5341,9 +5338,6 @@ bool LoadWTPrimeCache()
53415338
return false;
53425339
}
53435340

5344-
// TODO log this
5345-
uint64_t fileSize = fs::file_size(path);
5346-
53475341
std::vector<CTransactionRef> vWTPrime;
53485342
try {
53495343
int nVersionRequired, nVersionThatWrote;
@@ -5412,9 +5406,6 @@ bool LoadSidechainActivationStatusCache()
54125406
return false;
54135407
}
54145408

5415-
// TODO log this
5416-
uint64_t fileSize = fs::file_size(path);
5417-
54185409
std::vector<SidechainActivationStatus> vActivationStatus;
54195410
try {
54205411
int nVersionRequired, nVersionThatWrote;
@@ -5480,9 +5471,6 @@ bool LoadActiveSidechainCache()
54805471
return false;
54815472
}
54825473

5483-
// TODO log this
5484-
uint64_t fileSize = fs::file_size(path);
5485-
54865474
std::vector<Sidechain> vSidechain;
54875475
try {
54885476
int nVersionRequired, nVersionThatWrote;
@@ -5547,9 +5535,6 @@ bool LoadSidechainProposalCache()
55475535
return false;
55485536
}
55495537

5550-
// TODO log this
5551-
uint64_t fileSize = fs::file_size(path);
5552-
55535538
std::vector<SidechainProposal> vProposal;
55545539
try {
55555540
int nVersionRequired, nVersionThatWrote;
@@ -5614,9 +5599,6 @@ bool LoadSidechainActivationHashCache()
56145599
return false;
56155600
}
56165601

5617-
// TODO log this
5618-
uint64_t fileSize = fs::file_size(path);
5619-
56205602
std::vector<uint256> vHash;
56215603
try {
56225604
int nVersionRequired, nVersionThatWrote;
@@ -5635,7 +5617,6 @@ bool LoadSidechainActivationHashCache()
56355617
}
56365618
}
56375619
catch (const std::exception& e) {
5638-
// TODO log this
56395620
LogPrintf("%s: Exception: %s\n", __func__, e.what());
56405621
return false;
56415622
}

0 commit comments

Comments
 (0)