From 3285e21cfd0ea0c9c89e1143421d07029e098790 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 26 Jun 2018 17:54:27 -0700 Subject: [PATCH 1/5] Merge #12686: Add -ftrapv to CFLAGS and CXXFLAGS when --enable-debug is used. Enable -ftrapv in Travis. 98d842cb52 travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d13db Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389 --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 7b988610c0..7a439b38ff 100644 --- a/configure.ac +++ b/configure.ac @@ -331,6 +331,7 @@ if test "x$enable_debug" = xyes; then AX_CHECK_PREPROC_FLAG([-DDEBUG_CORE],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_CORE"]],,[[$CXXFLAG_WERROR]]) AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"]],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-ftrapv],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"],,[[$CXXFLAG_WERROR]]) else # We always enable at at least -g1 debug info to support proper stacktraces in crash infos # Stacktraces will be suboptimal due to optimization, but better than nothing. Also, -fno-omit-frame-pointer From 089cabbd2d0f59d5516e63cdb57240c76d8f27e8 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 23 Jul 2018 12:42:40 +0200 Subject: [PATCH 2/5] Merge #13719: Avoid creating a temporary vector for size-prefixed elements 84547fa6d408bdda1685f6d5972232bb19d97a7d Avoid creating a temporary vector for size-prefixed elements (Pieter Wuille) Pull request description: This is a simple improvement to the PSBT serialization code, avoiding the need for temporary vectors everywhere. Tree-SHA512: 9f7243b7169ec8ba00ffad31af03c016ab84e4f76ebac810167f91f5e8008f3827ad59fbcee0cb2bd2334fc26466eb222404af24e7fb6ec040fd78229ebe0fd1 --- src/script/sign.h | 18 ++++++++---------- src/serialize.h | 8 ++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/script/sign.h b/src/script/sign.h index cdd58d5f81..61b7ab6d0d 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -133,26 +133,24 @@ struct SignatureData { void MergeSignatureData(SignatureData sigdata); }; -// Takes a stream and multiple arguments and serializes them into a vector and then into the stream +// Takes a stream and multiple arguments and serializes them as if first serialized into a vector and then into the stream // The resulting output into the stream has the total serialized length of all of the objects followed by all objects concatenated with each other. template void SerializeToVector(Stream& s, const X&... args) { - std::vector ret; - CVectorWriter ss(SER_NETWORK, PROTOCOL_VERSION, ret, 0); - SerializeMany(ss, args...); - s << ret; + WriteCompactSize(s, GetSerializeSizeMany(s, args...)); + SerializeMany(s, args...); } // Takes a stream and multiple arguments and unserializes them first as a vector then each object individually in the order provided in the arguments template void UnserializeFromVector(Stream& s, X&... args) { - std::vector data; - s >> data; - CDataStream ss(data, SER_NETWORK, PROTOCOL_VERSION); - UnserializeMany(ss, args...); - if (!ss.eof()) { + size_t expected_size = ReadCompactSize(s); + size_t remaining_before = s.size(); + UnserializeMany(s, args...); + size_t remaining_after = s.size(); + if (remaining_after + expected_size != remaining_before) { throw std::ios_base::failure("Size of value was not the stated size"); } } diff --git a/src/serialize.h b/src/serialize.h index 4c4c38f95c..f87f40a181 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1502,4 +1502,12 @@ size_t GetSerializeSize(const S& s, const T& t) return (CSizeComputer(s.GetType(), s.GetVersion()) << t).size(); } +template +size_t GetSerializeSizeMany(const S& s, const T&... t) +{ + CSizeComputer sc(s.GetType(), s.GetVersion()); + SerializeMany(sc, t...); + return sc.size(); +} + #endif // BITCOIN_SERIALIZE_H From c68f422bd97b0542a4815253c0fbe177f1b126c3 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 13 Aug 2018 07:29:32 -0400 Subject: [PATCH 3/5] Merge #13928: qa: blocktools enforce named args for amount cf9ed307e6 qa: blocktools enforce named args for amount (MarcoFalke) Pull request description: Since #13669 changed some signatures, I think it might be worthwhile to enforce named args for primitive types such as amounts. Tree-SHA512: 2733e7b6a20590b54bd54e81a09e3f5e2fadf4390bed594916b70729bcf485b048266012c1203369e0968032a2c6a2719107ac17ee925d8939af3df916eab1a6 --- test/functional/feature_cltv.py | 4 ++-- test/functional/feature_csv_activation.py | 13 ++++++------- test/functional/feature_dersig.py | 7 +++---- test/functional/feature_nulldummy.py | 8 ++++---- test/functional/mempool_reorg.py | 12 ++++++------ test/functional/mempool_resurrect.py | 4 ++-- test/functional/mempool_spend_coinbase.py | 2 +- test/functional/test_framework/blocktools.py | 12 +++++------- 8 files changed, 29 insertions(+), 33 deletions(-) diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py index 0d3de388f1..9eb7348622 100755 --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -95,7 +95,7 @@ class BIP65Test(BitcoinTestFramework): self.log.info("Test that an invalid-according-to-CLTV transaction can still appear in a block") spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0], - self.nodeaddress, 1.0) + self.nodeaddress, amount=1.0) cltv_invalidate(spendtx) spendtx.rehash() @@ -128,7 +128,7 @@ class BIP65Test(BitcoinTestFramework): block.nVersion = 4 spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1], - self.nodeaddress, 1.0) + self.nodeaddress, amount=1.0) cltv_invalidate(spendtx) spendtx.rehash() diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py index eb5e1706f5..11603a9694 100755 --- a/test/functional/feature_csv_activation.py +++ b/test/functional/feature_csv_activation.py @@ -93,15 +93,14 @@ def sign_transaction(node, unsignedtx): return tx def create_bip112special(node, input, txversion, address): - tx = create_transaction(node, input, address, Decimal("499.98")) + tx = create_transaction(node, input, address, amount=Decimal("499.98")) tx.nVersion = txversion signtx = sign_transaction(node, tx) signtx.vin[0].scriptSig = CScript([-1, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(signtx.vin[0].scriptSig))) return signtx def send_generic_input_tx(node, coinbases, address): - amount = Decimal("499.99") - return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount)))) + return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount=Decimal("499.99"))))) def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0): """Returns a list of bip68 transactions with different bits set.""" @@ -109,7 +108,7 @@ def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0): assert len(bip68inputs) >= 16 for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): locktime = relative_locktime(sdf, srhb, stf, srlb) - tx = create_transaction(node, bip68inputs[i], address, Decimal("499.98")) + tx = create_transaction(node, bip68inputs[i], address, amount=Decimal("499.98")) tx.nVersion = txversion tx.vin[0].nSequence = locktime + locktime_delta tx = sign_transaction(node, tx) @@ -124,7 +123,7 @@ def create_bip112txs(node, bip112inputs, varyOP_CSV, txversion, address, locktim assert len(bip112inputs) >= 16 for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): locktime = relative_locktime(sdf, srhb, stf, srlb) - tx = create_transaction(node, bip112inputs[i], address, Decimal("499.98")) + tx = create_transaction(node, bip112inputs[i], address, amount=Decimal("499.98")) if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta else: # vary nSequence instead, OP_CSV is fixed @@ -276,10 +275,10 @@ class BIP68_112_113Test(BitcoinTestFramework): # Test both version 1 and version 2 transactions for all tests # BIP113 test transaction will be modified before each use to put in appropriate block time - bip113tx_v1 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("499.98")) + bip113tx_v1 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("499.98")) bip113tx_v1.vin[0].nSequence = 0xFFFFFFFE bip113tx_v1.nVersion = 1 - bip113tx_v2 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("499.98")) + bip113tx_v2 = create_transaction(self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("499.98")) bip113tx_v2.vin[0].nSequence = 0xFFFFFFFE bip113tx_v2.nVersion = 2 diff --git a/test/functional/feature_dersig.py b/test/functional/feature_dersig.py index 618d05fee8..502be35fc0 100755 --- a/test/functional/feature_dersig.py +++ b/test/functional/feature_dersig.py @@ -77,7 +77,7 @@ class BIP66Test(BitcoinTestFramework): self.log.info("Test that a transaction with non-DER signature can still appear in a block") spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0], - self.nodeaddress, 1.0) + self.nodeaddress, amount=1.0) unDERify(spendtx) spendtx.rehash() @@ -112,7 +112,7 @@ class BIP66Test(BitcoinTestFramework): block.nVersion = 3 spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1], - self.nodeaddress, 1.0) + self.nodeaddress, amount=1.0) unDERify(spendtx) spendtx.rehash() @@ -138,8 +138,7 @@ class BIP66Test(BitcoinTestFramework): assert b'Non-canonical DER signature' in self.nodes[0].p2p.last_message["reject"].reason self.log.info("Test that a version 3 block with a DERSIG-compliant transaction is accepted") - block.vtx[1] = create_transaction(self.nodes[0], - self.coinbase_txids[1], self.nodeaddress, 1.0) + block.vtx[1] = create_transaction(self.nodes[0], self.coinbase_txids[1], self.nodeaddress, amount=1.0) block.hashMerkleRoot = block.calc_merkle_root() block.rehash() block.solve() diff --git a/test/functional/feature_nulldummy.py b/test/functional/feature_nulldummy.py index 25c88790c9..c7e89ad3af 100755 --- a/test/functional/feature_nulldummy.py +++ b/test/functional/feature_nulldummy.py @@ -59,14 +59,14 @@ class NULLDUMMYTest(BitcoinTestFramework): self.lastblocktime = self.mocktime + 429 self.log.info("Test 1: NULLDUMMY compliant base transactions should be accepted to mempool and mined before activation [430]") - test1txs = [create_transaction(self.nodes[0], coinbase_txid[0], self.ms_address, 49)] + test1txs = [create_transaction(self.nodes[0], coinbase_txid[0], self.ms_address, amount=49)] txid1 = self.nodes[0].sendrawtransaction(test1txs[0].serialize().hex(), 0) - test1txs.append(create_transaction(self.nodes[0], txid1, self.ms_address, 48)) + test1txs.append(create_transaction(self.nodes[0], txid1, self.ms_address, amount=48)) txid2 = self.nodes[0].sendrawtransaction(test1txs[1].serialize().hex(), 0) self.block_submit(self.nodes[0], test1txs, True) self.log.info("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation") - test2tx = create_transaction(self.nodes[0], txid2, self.ms_address, 47) + test2tx = create_transaction(self.nodes[0], txid2, self.ms_address, amount=47) trueDummy(test2tx) assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, test2tx.serialize().hex(), 0) @@ -74,7 +74,7 @@ class NULLDUMMYTest(BitcoinTestFramework): self.block_submit(self.nodes[0], [test2tx], True) self.log.info("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation") - test4tx = create_transaction(self.nodes[0], test2tx.hash, self.address, 46) + test4tx = create_transaction(self.nodes[0], test2tx.hash, self.address, amount=46) test6txs=[CTransaction(test4tx)] trueDummy(test4tx) assert_raises_rpc_error(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, test4tx.serialize().hex(), 0) diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py index 5c0b040833..8b73a40271 100755 --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -42,9 +42,9 @@ class MempoolCoinbaseTest(BitcoinTestFramework): # and make sure the mempool code behaves correctly. b = [ self.nodes[0].getblockhash(n) for n in range(101, 105) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spend_101_raw = create_raw_transaction(self.nodes[0], coinbase_txids[1], node1_address, 499.99) - spend_102_raw = create_raw_transaction(self.nodes[0], coinbase_txids[2], node0_address, 499.99) - spend_103_raw = create_raw_transaction(self.nodes[0], coinbase_txids[3], node0_address, 499.99) + spend_101_raw = create_raw_transaction(self.nodes[0], coinbase_txids[1], node1_address, amount=499.99) + spend_102_raw = create_raw_transaction(self.nodes[0], coinbase_txids[2], node0_address, amount=499.99) + spend_103_raw = create_raw_transaction(self.nodes[0], coinbase_txids[3], node0_address, amount=499.99) # Create a transaction which is time-locked to two blocks in the future timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 499.9}) @@ -60,11 +60,11 @@ class MempoolCoinbaseTest(BitcoinTestFramework): spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw) self.nodes[0].generate(1) # Time-locked transaction is still too immature to spend - assert_raises_rpc_error(-26,'non-final', self.nodes[0].sendrawtransaction, timelock_tx) + assert_raises_rpc_error(-26, 'non-final', self.nodes[0].sendrawtransaction, timelock_tx) # Create 102_1 and 103_1: - spend_102_1_raw = create_raw_transaction(self.nodes[0], spend_102_id, node1_address, 499.98) - spend_103_1_raw = create_raw_transaction(self.nodes[0], spend_103_id, node1_address, 499.98) + spend_102_1_raw = create_raw_transaction(self.nodes[0], spend_102_id, node1_address, amount=499.98) + spend_103_1_raw = create_raw_transaction(self.nodes[0], spend_103_id, node1_address, amount=499.98) # Broadcast and mine 103_1: spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw) diff --git a/test/functional/mempool_resurrect.py b/test/functional/mempool_resurrect.py index ccf8d2e24e..453a31db23 100755 --- a/test/functional/mempool_resurrect.py +++ b/test/functional/mempool_resurrect.py @@ -30,13 +30,13 @@ class MempoolCoinbaseTest(BitcoinTestFramework): b = [ self.nodes[0].getblockhash(n) for n in range(1, 4) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spends1_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, 500) for txid in coinbase_txids ] + spends1_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, amount=500) for txid in coinbase_txids ] spends1_id = [ self.nodes[0].sendrawtransaction(tx, 0, False, True) for tx in spends1_raw ] blocks = [] blocks.extend(self.nodes[0].generate(1)) - spends2_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, 499.99) for txid in spends1_id ] + spends2_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, amount=499.99) for txid in spends1_id ] spends2_id = [ self.nodes[0].sendrawtransaction(tx, 0, False, True) for tx in spends2_raw ] blocks.extend(self.nodes[0].generate(1)) diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py index 4955065f1e..08f3bf78ec 100755 --- a/test/functional/mempool_spend_coinbase.py +++ b/test/functional/mempool_spend_coinbase.py @@ -36,7 +36,7 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework): # is too immature to spend. b = [ self.nodes[0].getblockhash(n) for n in range(101, 103) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spends_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, 500 - Decimal('0.00001')) for txid in coinbase_txids ] + spends_raw = [ create_raw_transaction(self.nodes[0], txid, node0_address, amount=500 - Decimal('0.00001')) for txid in coinbase_txids ] spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0]) diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 3877e508ad..6aa7df17f9 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -70,7 +70,7 @@ def create_coinbase(height, pubkey=None, dip4_activated=False): coinbase.calc_sha256() return coinbase -def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CScript()): +def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript()): """Return one-input, one-output transaction object spending the prevtx's n-th output with the given amount. @@ -83,26 +83,24 @@ def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CS tx.calc_sha256() return tx -def create_transaction(node, txid, to_address, amount): +def create_transaction(node, txid, to_address, *, amount): """ Return signed transaction spending the first output of the input txid. Note that the node must be able to sign for the output that is being spent, and the node must not be running multiple wallets. """ - raw_tx = create_raw_transaction(node, txid, to_address, amount) + raw_tx = create_raw_transaction(node, txid, to_address, amount=amount) tx = CTransaction() tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx))) return tx -def create_raw_transaction(node, txid, to_address, amount): +def create_raw_transaction(node, txid, to_address, *, amount): """ Return raw signed transaction spending the first output of the input txid. Note that the node must be able to sign for the output that is being spent, and the node must not be running multiple wallets. """ - inputs = [{"txid": txid, "vout": 0}] - outputs = {to_address: amount} - rawtx = node.createrawtransaction(inputs, outputs) + rawtx = node.createrawtransaction(inputs=[{"txid": txid, "vout": 0}], outputs={to_address: amount}) signresult = node.signrawtransactionwithwallet(rawtx) assert_equal(signresult["complete"], True) return signresult['hex'] From 87112fd95f47491bd105bf42cdf219b9e4d9cbd2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 12 Jul 2018 17:44:13 +0200 Subject: [PATCH 4/5] Merge #13177: GCC-7 and glibc-2.27 back compat code 253f5929097548fb10ef995002dedbb8dadb6a0d Add stdin, stdout, stderr to ignored export list (Chun Kuan Lee) fc6a9f2ab18ca8466d65d14c263c4f78f9ccebbf Use IN6ADDR_ANY_INIT instead of in6addr_any (Cory Fields) 908c1d7745f0ed117b0374fcc8486f83bf743bfc GCC-7 and glibc-2.27 compat code (Chun Kuan Lee) Pull request description: The `__divmoddi4` code was modified from https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c . I manually find the older glibc version of log2f by objdump, use `.symver` to specify the certain version. Tree-SHA512: e8d875652003618c73e019ccc420e7a25d46f4eaff1c7a1a6bfc1770b3b46f074b368b2cb14df541b5ab124cca41dede4e28fe863a670589b834ef6b8713f9c4 --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 7a439b38ff..8381ae5407 100644 --- a/configure.ac +++ b/configure.ac @@ -842,6 +842,8 @@ if test x$use_glibc_compat != xno; then [ fdelt_type="long int"]) AC_MSG_RESULT($fdelt_type) AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"]) else AC_SEARCH_LIBS([clock_gettime],[rt]) fi @@ -1790,6 +1792,7 @@ AC_SUBST(DEBUG_CPPFLAGS) AC_SUBST(WARN_CXXFLAGS) AC_SUBST(NOWARN_CXXFLAGS) AC_SUBST(DEBUG_CXXFLAGS) +AC_SUBST(COMPAT_LDFLAGS) AC_SUBST(ERROR_CXXFLAGS) AC_SUBST(GPROF_CXXFLAGS) AC_SUBST(GPROF_LDFLAGS) From 4d70755155250b3bbfe1c11ebf81784332b06e83 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 26 Apr 2022 23:39:57 +0300 Subject: [PATCH 5/5] more of/followup 13177 --- configure.ac | 6 ++++++ src/Makefile.am | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8381ae5407..bd5e9bbb0e 100644 --- a/configure.ac +++ b/configure.ac @@ -844,6 +844,12 @@ if test x$use_glibc_compat != xno; then AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"]) AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=log]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=pow]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=pow"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=exp]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=exp"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=exp2]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=exp2"]) + AX_CHECK_LINK_FLAG([[-Wl,--wrap=fcntl]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=fcntl"]) else AC_SEARCH_LIBS([clock_gettime],[rt]) fi diff --git a/src/Makefile.am b/src/Makefile.am index 85189e01c7..944468d728 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -723,9 +723,7 @@ libdash_util_a_SOURCES = \ if GLIBC_BACK_COMPAT libdash_util_a_SOURCES += compat/glibc_compat.cpp -AM_LDFLAGS += -Wl,--wrap=log2f -Wl,--wrap=__divmoddi4 -AM_LDFLAGS += -Wl,--wrap=exp -Wl,--wrap=exp2 -Wl,--wrap=fcntl -AM_LDFLAGS += -Wl,--wrap=log -Wl,--wrap=log2 -Wl,--wrap=pow +AM_LDFLAGS += $(COMPAT_LDFLAGS) endif # cli: shared between dash-cli and dash-qt