From d9aab0fa6045572036a740fcdb7cfb09b0166488 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:15:23 +0300 Subject: [PATCH 001/116] refactor: Rename `masternode_state_t` and turn it into enum class --- src/masternode/node.cpp | 54 ++++++++++++++++++++--------------------- src/masternode/node.h | 18 +++++++------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/masternode/node.cpp b/src/masternode/node.cpp index aa0a5de2f2..8ffe2c2f9a 100644 --- a/src/masternode/node.cpp +++ b/src/masternode/node.cpp @@ -65,19 +65,19 @@ CActiveMasternodeManager::CActiveMasternodeManager(const CBLSSecretKey& sk, CCon std::string CActiveMasternodeManager::GetStateString() const { switch (WITH_READ_LOCK(cs, return m_state)) { - case MASTERNODE_WAITING_FOR_PROTX: + case MasternodeState::WAITING_FOR_PROTX: return "WAITING_FOR_PROTX"; - case MASTERNODE_POSE_BANNED: + case MasternodeState::POSE_BANNED: return "POSE_BANNED"; - case MASTERNODE_REMOVED: + case MasternodeState::REMOVED: return "REMOVED"; - case MASTERNODE_OPERATOR_KEY_CHANGED: + case MasternodeState::OPERATOR_KEY_CHANGED: return "OPERATOR_KEY_CHANGED"; - case MASTERNODE_PROTX_IP_CHANGED: + case MasternodeState::PROTX_IP_CHANGED: return "PROTX_IP_CHANGED"; - case MASTERNODE_READY: + case MasternodeState::READY: return "READY"; - case MASTERNODE_ERROR: + case MasternodeState::SOME_ERROR: return "ERROR"; default: return "UNKNOWN"; @@ -88,19 +88,19 @@ std::string CActiveMasternodeManager::GetStatus() const { READ_LOCK(cs); switch (m_state) { - case MASTERNODE_WAITING_FOR_PROTX: + case MasternodeState::WAITING_FOR_PROTX: return "Waiting for ProTx to appear on-chain"; - case MASTERNODE_POSE_BANNED: + case MasternodeState::POSE_BANNED: return "Masternode was PoSe banned"; - case MASTERNODE_REMOVED: + case MasternodeState::REMOVED: return "Masternode removed from list"; - case MASTERNODE_OPERATOR_KEY_CHANGED: + case MasternodeState::OPERATOR_KEY_CHANGED: return "Operator key changed or revoked"; - case MASTERNODE_PROTX_IP_CHANGED: + case MasternodeState::PROTX_IP_CHANGED: return "IP address specified in ProTx changed"; - case MASTERNODE_READY: + case MasternodeState::READY: return "Ready"; - case MASTERNODE_ERROR: + case MasternodeState::SOME_ERROR: return "Error. " + m_error; default: return "Unknown"; @@ -116,14 +116,14 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) // Check that our local network configuration is correct if (!fListen && Params().RequireRoutableExternalIP()) { // listen option is probably overwritten by something else, no good - m_state = MASTERNODE_ERROR; + m_state = MasternodeState::SOME_ERROR; m_error = "Masternode must accept connections from outside. Make sure listen configuration option is not overwritten by some another parameter."; LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", m_error); return; } if (!GetLocalAddress(m_info.service)) { - m_state = MASTERNODE_ERROR; + m_state = MasternodeState::SOME_ERROR; return; } @@ -137,9 +137,9 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) if (!mnList.IsMNValid(dmn->proTxHash)) { if (mnList.IsMNPoSeBanned(dmn->proTxHash)) { - m_state = MASTERNODE_POSE_BANNED; + m_state = MasternodeState::POSE_BANNED; } else { - m_state = MASTERNODE_REMOVED; + m_state = MasternodeState::REMOVED; } return; } @@ -147,7 +147,7 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) LogPrintf("CActiveMasternodeManager::Init -- proTxHash=%s, proTx=%s\n", dmn->proTxHash.ToString(), dmn->ToString()); if (m_info.service != dmn->pdmnState->addr) { - m_state = MASTERNODE_ERROR; + m_state = MasternodeState::SOME_ERROR; m_error = "Local address does not match the address from ProTx"; LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", m_error); return; @@ -157,7 +157,7 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) LogPrintf("CActiveMasternodeManager::Init -- Checking inbound connection to '%s'\n", m_info.service.ToStringAddrPort()); std::unique_ptr sock = CreateSock(m_info.service); if (!sock) { - m_state = MASTERNODE_ERROR; + m_state = MasternodeState::SOME_ERROR; m_error = "Could not create socket to connect to " + m_info.service.ToStringAddrPort(); LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", m_error); return; @@ -166,7 +166,7 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) sock->Reset(); if (!fConnected && Params().RequireRoutableExternalIP()) { - m_state = MASTERNODE_ERROR; + m_state = MasternodeState::SOME_ERROR; m_error = "Could not connect to " + m_info.service.ToStringAddrPort(); LogPrintf("CActiveMasternodeManager::Init -- ERROR: %s\n", m_error); return; @@ -175,7 +175,7 @@ void CActiveMasternodeManager::InitInternal(const CBlockIndex* pindex) m_info.proTxHash = dmn->proTxHash; m_info.outpoint = dmn->collateralOutpoint; m_info.legacy = dmn->pdmnState->nVersion == CProRegTx::LEGACY_BLS_VERSION; - m_state = MASTERNODE_READY; + m_state = MasternodeState::READY; } void CActiveMasternodeManager::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) @@ -183,10 +183,10 @@ void CActiveMasternodeManager::UpdatedBlockTip(const CBlockIndex* pindexNew, con if (!DeploymentDIP0003Enforced(pindexNew->nHeight, Params().GetConsensus())) return; const auto [cur_state, cur_protx_hash] = WITH_READ_LOCK(cs, return std::make_pair(m_state, m_info.proTxHash)); - if (cur_state == MASTERNODE_READY) { + if (cur_state == MasternodeState::READY) { auto oldMNList = Assert(m_dmnman)->GetListForBlock(pindexNew->pprev); auto newMNList = m_dmnman->GetListForBlock(pindexNew); - auto reset = [this, pindexNew] (masternode_state_t state) -> void { + auto reset = [this, pindexNew](MasternodeState state) -> void { LOCK(cs); m_state = state; m_info.proTxHash = uint256(); @@ -197,18 +197,18 @@ void CActiveMasternodeManager::UpdatedBlockTip(const CBlockIndex* pindexNew, con if (!newMNList.IsMNValid(cur_protx_hash)) { // MN disappeared from MN list - return reset(MASTERNODE_REMOVED); + return reset(MasternodeState::REMOVED); } auto oldDmn = oldMNList.GetMN(cur_protx_hash); auto newDmn = newMNList.GetMN(cur_protx_hash); if (newDmn->pdmnState->pubKeyOperator != oldDmn->pdmnState->pubKeyOperator) { // MN operator key changed or revoked - return reset(MASTERNODE_OPERATOR_KEY_CHANGED); + return reset(MasternodeState::OPERATOR_KEY_CHANGED); } if (newDmn->pdmnState->addr != oldDmn->pdmnState->addr) { // MN IP changed - return reset(MASTERNODE_PROTX_IP_CHANGED); + return reset(MasternodeState::PROTX_IP_CHANGED); } } else { // MN might have (re)appeared with a new ProTx or we've found some peers diff --git a/src/masternode/node.h b/src/masternode/node.h index 49f8c970d4..713161ee06 100644 --- a/src/masternode/node.h +++ b/src/masternode/node.h @@ -31,19 +31,19 @@ struct CActiveMasternodeInfo { class CActiveMasternodeManager final : public CValidationInterface { public: - enum masternode_state_t { - MASTERNODE_WAITING_FOR_PROTX, - MASTERNODE_POSE_BANNED, - MASTERNODE_REMOVED, - MASTERNODE_OPERATOR_KEY_CHANGED, - MASTERNODE_PROTX_IP_CHANGED, - MASTERNODE_READY, - MASTERNODE_ERROR, + enum class MasternodeState { + WAITING_FOR_PROTX, + POSE_BANNED, + REMOVED, + OPERATOR_KEY_CHANGED, + PROTX_IP_CHANGED, + READY, + SOME_ERROR, }; private: mutable SharedMutex cs; - masternode_state_t m_state GUARDED_BY(cs) {MASTERNODE_WAITING_FOR_PROTX}; + MasternodeState m_state GUARDED_BY(cs){MasternodeState::WAITING_FOR_PROTX}; CActiveMasternodeInfo m_info GUARDED_BY(cs); std::string m_error GUARDED_BY(cs); From 0cf7d4a65efb05c6465abd1298134bc60d4a1420 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:15:35 +0300 Subject: [PATCH 002/116] refactor: Turn `ReadResult` into enum class --- src/flat-database.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/flat-database.h b/src/flat-database.h index b17947b7fa..db9dad1939 100644 --- a/src/flat-database.h +++ b/src/flat-database.h @@ -21,8 +21,7 @@ template class CFlatDB { private: - - enum ReadResult { + enum class ReadResult { Ok, FileError, HashReadError, @@ -82,7 +81,7 @@ class CFlatDB CAutoFile filein(file, SER_DISK, CLIENT_VERSION); if (filein.IsNull()) { // It is not actually error, maybe it's a first initialization of core. - return FileError; + return ReadResult::FileError; } // use file size to size memory buffer @@ -102,7 +101,7 @@ class CFlatDB } catch (std::exception &e) { error("%s: Deserialize or I/O error - %s", __func__, e.what()); - return HashReadError; + return ReadResult::HashReadError; } filein.fclose(); @@ -113,7 +112,7 @@ class CFlatDB if (hashIn != hashTmp) { error("%s: Checksum mismatch, data corrupted", __func__); - return IncorrectHash; + return ReadResult::IncorrectHash; } @@ -127,7 +126,7 @@ class CFlatDB if (strMagicMessage != strMagicMessageTmp) { error("%s: Invalid magic message", __func__); - return IncorrectMagicMessage; + return ReadResult::IncorrectMagicMessage; } @@ -138,7 +137,7 @@ class CFlatDB if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp))) { error("%s: Invalid network magic number", __func__); - return IncorrectMagicNumber; + return ReadResult::IncorrectMagicNumber; } // de-serialize data into T object @@ -147,28 +146,25 @@ class CFlatDB catch (std::exception &e) { objToLoad.Clear(); error("%s: Deserialize or I/O error - %s", __func__, e.what()); - return IncorrectFormat; + return ReadResult::IncorrectFormat; } LogPrintf("Loaded info from %s %dms\n", strFilename, GetTimeMillis() - nStart); LogPrintf(" %s\n", objToLoad.ToString()); - return Ok; + return ReadResult::Ok; } [[nodiscard]] bool Read(T& objToLoad) { ReadResult readResult = CoreRead(objToLoad); - if (readResult == FileError) + if (readResult == ReadResult::FileError) LogPrintf("Missing file %s, will try to recreate\n", strFilename); - else if (readResult != Ok) - { + else if (readResult != ReadResult::Ok) { LogPrintf("ERROR: CFlatDB::Read Error reading %s: ", strFilename); - if(readResult == IncorrectFormat) - { + if (readResult == ReadResult::IncorrectFormat) { LogPrintf("%s: Magic is ok but data has invalid format, will try to recreate\n", __func__); - } - else { + } else { LogPrintf("%s: File format is unknown or invalid, please fix it manually\n", __func__); // program should exit with an error return false; From 38b304c7b0f2e91a82277bfcc9b879ab75cdbf20 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:22:59 +0300 Subject: [PATCH 003/116] refactor: Make bls worker aggregator batch size const (rename it accordingly) --- src/bls/bls_worker.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index 0785c5f130..f5197e8fa5 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -124,7 +124,7 @@ bool CBLSWorker::GenerateContributions(int quorumThreshold, Span ids, BL // input vector is stored. This means that the input vector must stay alive for the whole lifetime of the Aggregator template struct Aggregator : public std::enable_shared_from_this> { - size_t batchSize{16}; + const size_t BATCH_SIZE{16}; std::shared_ptr > inputVec; bool parallel; @@ -164,7 +164,7 @@ struct Aggregator : public std::enable_shared_from_this> { // If parallel=true, then this will return fast, otherwise this will block until aggregation is done void Start() { - size_t batchCount = (inputVec->size() + batchSize - 1) / batchSize; + size_t batchCount = (inputVec->size() + BATCH_SIZE - 1) / BATCH_SIZE; if (!parallel) { if (inputVec->size() == 1) { @@ -191,8 +191,8 @@ struct Aggregator : public std::enable_shared_from_this> { // increment wait counter as otherwise the first finished async aggregation might signal that we're done IncWait(); for (size_t i = 0; i < batchCount; i++) { - size_t start = i * batchSize; - size_t count = std::min(batchSize, inputVec->size() - start); + size_t start = i * BATCH_SIZE; + size_t count = std::min(BATCH_SIZE, inputVec->size() - start); AsyncAggregateAndPushAggQueue(inputVec, start, count, false); } // this will decrement the wait counter and in most cases NOT finish, as async work is still in progress @@ -272,24 +272,24 @@ struct Aggregator : public std::enable_shared_from_this> { throw; } - if (++aggQueueSize >= batchSize) { + if (++aggQueueSize >= BATCH_SIZE) { // we've collected enough intermediate results to form a new batch. std::shared_ptr > newBatch; { std::unique_lock l(m); - if (aggQueueSize < batchSize) { + if (aggQueueSize < BATCH_SIZE) { // some other worker thread grabbed this batch return; } - newBatch = std::make_shared >(batchSize); + newBatch = std::make_shared>(BATCH_SIZE); // collect items for new batch - for (size_t i = 0; i < batchSize; i++) { + for (size_t i = 0; i < BATCH_SIZE; i++) { T* p = nullptr; bool s = aggQueue.pop(p); assert(s); (*newBatch)[i] = p; } - aggQueueSize -= batchSize; + aggQueueSize -= BATCH_SIZE; } // push new batch to work queue. del=true this time as these items are intermediate results and need to be deleted From 88c3a13674c720db348c7d73e4b771a96f9cab51 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:31:08 +0300 Subject: [PATCH 004/116] refactor: Use `switch..case` instead of `if` in `AvailableCoins` --- src/wallet/wallet.cpp | 46 ++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 576703ab60..3449332970 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2693,22 +2693,36 @@ void CWallet::AvailableCoins(std::vector &vCoins, const CCoinControl* c for (unsigned int i = 0; i < pcoin->tx->vout.size(); i++) { bool found = false; - if (nCoinType == CoinType::ONLY_FULLY_MIXED) { - if (!CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue)) continue; - found = IsFullyMixed(COutPoint(wtxid, i)); - } else if(nCoinType == CoinType::ONLY_READY_TO_MIX) { - if (!CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue)) continue; - found = !IsFullyMixed(COutPoint(wtxid, i)); - } else if(nCoinType == CoinType::ONLY_NONDENOMINATED) { - if (CoinJoin::IsCollateralAmount(pcoin->tx->vout[i].nValue)) continue; // do not use collateral amounts - found = !CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue); - } else if(nCoinType == CoinType::ONLY_MASTERNODE_COLLATERAL) { - found = dmn_types::IsCollateralAmount(pcoin->tx->vout[i].nValue); - } else if(nCoinType == CoinType::ONLY_COINJOIN_COLLATERAL) { - found = CoinJoin::IsCollateralAmount(pcoin->tx->vout[i].nValue); - } else { - found = true; - } + switch (nCoinType) { + case CoinType::ONLY_FULLY_MIXED: { + found = CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue) && + IsFullyMixed(COutPoint(wtxid, i)); + break; + } + case CoinType::ONLY_READY_TO_MIX: { + found = CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue) && + !IsFullyMixed(COutPoint(wtxid, i)); + break; + } + case CoinType::ONLY_NONDENOMINATED: { + // NOTE: do not use collateral amounts + found = !CoinJoin::IsCollateralAmount(pcoin->tx->vout[i].nValue) && + !CoinJoin::IsDenominatedAmount(pcoin->tx->vout[i].nValue); + break; + } + case CoinType::ONLY_MASTERNODE_COLLATERAL: { + found = dmn_types::IsCollateralAmount(pcoin->tx->vout[i].nValue); + break; + } + case CoinType::ONLY_COINJOIN_COLLATERAL: { + found = CoinJoin::IsCollateralAmount(pcoin->tx->vout[i].nValue); + break; + } + case CoinType::ALL_COINS: { + found = true; + break; + } + } // no default case, so the compiler can warn about missing cases if(!found) continue; // Only consider selected coins if add_inputs is false From ae675d5314b846ea0a1f0d807f9ffb9aeca5527f Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:14:48 +0300 Subject: [PATCH 005/116] refactor: Drop redundant `SplitBy` --- src/governance/classes.cpp | 44 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/governance/classes.cpp b/src/governance/classes.cpp index e26d412e0d..ea08265482 100644 --- a/src/governance/classes.cpp +++ b/src/governance/classes.cpp @@ -20,21 +20,6 @@ #include -// SPLIT UP STRING BY DELIMITER -std::vector SplitBy(const std::string& strCommand, const std::string& strDelimit) -{ - std::vector vParts = SplitString(strCommand, strDelimit); - - for (int q = 0; q < (int)vParts.size(); q++) { - if (strDelimit.find(vParts[q]) != std::string::npos) { - vParts.erase(vParts.begin() + q); - --q; - } - } - - return vParts; -} - CAmount ParsePaymentAmount(const std::string& strAmount) { CAmount nAmount = 0; @@ -196,23 +181,20 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c { // SPLIT UP ADDR/AMOUNT STRINGS AND PUT IN VECTORS - std::vector vecParsed1; - std::vector vecParsed2; - std::vector vecParsed3; - vecParsed1 = SplitBy(strPaymentAddresses, "|"); - vecParsed2 = SplitBy(strPaymentAmounts, "|"); - vecParsed3 = SplitBy(strProposalHashes, "|"); + const auto vecPaymentAddresses = SplitString(strPaymentAddresses, "|"); + const auto vecPaymentAmounts = SplitString(strPaymentAmounts, "|"); + const auto vecProposalHashes = SplitString(strProposalHashes, "|"); // IF THESE DON'T MATCH, SOMETHING IS WRONG - if (vecParsed1.size() != vecParsed2.size() || vecParsed1.size() != vecParsed3.size()) { + if (vecPaymentAddresses.size() != vecPaymentAmounts.size() || vecPaymentAddresses.size() != vecProposalHashes.size()) { std::ostringstream ostr; ostr << "CSuperblock::ParsePaymentSchedule -- Mismatched payments, amounts and proposalHashes"; LogPrintf("%s\n", ostr.str()); throw std::runtime_error(ostr.str()); } - if (vecParsed1.empty()) { + if (vecPaymentAddresses.empty()) { std::ostringstream ostr; ostr << "CSuperblock::ParsePaymentSchedule -- Error no payments"; LogPrintf("%s\n", ostr.str()); @@ -225,26 +207,28 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c AMOUNTS = [AMOUNT1|2|3|4|5|6] */ - for (int i = 0; i < (int)vecParsed1.size(); i++) { - CTxDestination dest = DecodeDestination(vecParsed1[i]); + for (int i = 0; i < (int)vecPaymentAddresses.size(); i++) { + CTxDestination dest = DecodeDestination(vecPaymentAddresses[i]); if (!IsValidDestination(dest)) { std::ostringstream ostr; - ostr << "CSuperblock::ParsePaymentSchedule -- Invalid Dash Address : " << vecParsed1[i]; + ostr << "CSuperblock::ParsePaymentSchedule -- Invalid Dash Address : " << vecPaymentAddresses[i]; LogPrintf("%s\n", ostr.str()); throw std::runtime_error(ostr.str()); } - CAmount nAmount = ParsePaymentAmount(vecParsed2[i]); + CAmount nAmount = ParsePaymentAmount(vecPaymentAmounts[i]); uint256 proposalHash; - if (!ParseHashStr(vecParsed3[i], proposalHash)){ + if (!ParseHashStr(vecProposalHashes[i], proposalHash)) { std::ostringstream ostr; - ostr << "CSuperblock::ParsePaymentSchedule -- Invalid proposal hash : " << vecParsed3[i]; + ostr << "CSuperblock::ParsePaymentSchedule -- Invalid proposal hash : " << vecProposalHashes[i]; LogPrintf("%s\n", ostr.str()); throw std::runtime_error(ostr.str()); } - LogPrint(BCLog::GOBJECT, "CSuperblock::ParsePaymentSchedule -- i = %d, amount string = %s, nAmount = %lld, proposalHash = %s\n", i, vecParsed2[i], nAmount, proposalHash.ToString()); + LogPrint(BCLog::GOBJECT, /* Continued */ + "CSuperblock::ParsePaymentSchedule -- i = %d, amount string = %s, nAmount = %lld, proposalHash = %s\n", + i, vecPaymentAmounts[i], nAmount, proposalHash.ToString()); CGovernancePayment payment(dest, nAmount, proposalHash); if (payment.IsValid()) { From 6370c7a9e5bfadbe7d55bef3b50df61103bbaa39 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:32:26 +0300 Subject: [PATCH 006/116] refactor: Tidy up `CGovernanceVote` a bit --- src/governance/vote.cpp | 20 +++----------------- src/governance/vote.h | 16 +++++----------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/governance/vote.cpp b/src/governance/vote.cpp index 0e4647566a..6f5e1f1709 100644 --- a/src/governance/vote.cpp +++ b/src/governance/vote.cpp @@ -85,27 +85,13 @@ vote_signal_enum_t CGovernanceVoting::ConvertVoteSignal(const std::string& strVo return it->second; } -CGovernanceVote::CGovernanceVote() : - fValid(true), - fSynced(false), - nVoteSignal(int(VOTE_SIGNAL_NONE)), - masternodeOutpoint(), - nParentHash(), - nVoteOutcome(int(VOTE_OUTCOME_NONE)), - nTime(0), - vchSig() -{ -} - -CGovernanceVote::CGovernanceVote(const COutPoint& outpointMasternodeIn, const uint256& nParentHashIn, vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn) : - fValid(true), - fSynced(false), +CGovernanceVote::CGovernanceVote(const COutPoint& outpointMasternodeIn, const uint256& nParentHashIn, + vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn) : nVoteSignal(eVoteSignalIn), masternodeOutpoint(outpointMasternodeIn), nParentHash(nParentHashIn), nVoteOutcome(eVoteOutcomeIn), - nTime(GetAdjustedTime()), - vchSig() + nTime(GetAdjustedTime()) { UpdateHash(); } diff --git a/src/governance/vote.h b/src/governance/vote.h index dca602356a..55573784a0 100644 --- a/src/governance/vote.h +++ b/src/governance/vote.h @@ -63,27 +63,21 @@ class CGovernanceVote friend bool operator<(const CGovernanceVote& vote1, const CGovernanceVote& vote2); private: - bool fValid; //if the vote is currently valid / counted - bool fSynced; //if we've sent this to our peers - int nVoteSignal; // see VOTE_ACTIONS above + int nVoteSignal{VOTE_SIGNAL_NONE}; // see VOTE_ACTIONS above COutPoint masternodeOutpoint; uint256 nParentHash; - int nVoteOutcome; // see VOTE_OUTCOMES above - int64_t nTime; + int nVoteOutcome{VOTE_OUTCOME_NONE}; // see VOTE_OUTCOMES above + int64_t nTime{0}; std::vector vchSig; /** Memory only. */ - const uint256 hash; + const uint256 hash{0}; void UpdateHash() const; public: - CGovernanceVote(); + CGovernanceVote() = default; CGovernanceVote(const COutPoint& outpointMasternodeIn, const uint256& nParentHashIn, vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn); - bool IsValid() const { return fValid; } - - bool IsSynced() const { return fSynced; } - int64_t GetTimestamp() const { return nTime; } vote_signal_enum_t GetSignal() const { return vote_signal_enum_t(nVoteSignal); } From 38a0b5ac04cfef2421457dee8dc44b887ef73d41 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 2 Nov 2024 00:18:57 +0300 Subject: [PATCH 007/116] refactor: Move `HasChainLock()` calls out of loops --- src/llmq/instantsend.cpp | 3 ++- src/validation.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/llmq/instantsend.cpp b/src/llmq/instantsend.cpp index 713e874be5..bf76757fb2 100644 --- a/src/llmq/instantsend.cpp +++ b/src/llmq/instantsend.cpp @@ -1124,13 +1124,14 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr& pb } if (m_mn_sync.IsBlockchainSynced()) { + const bool has_chainlock = clhandler.HasChainLock(pindex->nHeight, pindex->GetBlockHash()); for (const auto& tx : pblock->vtx) { if (tx->IsCoinBase() || tx->vin.empty()) { // coinbase and TXs with no inputs can't be locked continue; } - if (!IsLocked(tx->GetHash()) && !clhandler.HasChainLock(pindex->nHeight, pindex->GetBlockHash())) { + if (!IsLocked(tx->GetHash()) && !has_chainlock) { ProcessTx(*tx, true, Params().GetConsensus()); // TX is not locked, so make sure it is tracked AddNonLockedTx(tx, pindex); diff --git a/src/validation.cpp b/src/validation.cpp index 58ef87b637..fda0a2b1f7 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2186,11 +2186,12 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state, if (m_isman->RejectConflictingBlocks()) { // Require other nodes to comply, send them some data in case they are missing it. + const bool has_chainlock = m_clhandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash()); for (const auto& tx : block.vtx) { // skip txes that have no inputs if (tx->vin.empty()) continue; while (llmq::CInstantSendLockPtr conflictLock = m_isman->GetConflictingLock(*tx)) { - if (m_clhandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash())) { + if (has_chainlock) { LogPrint(BCLog::ALL, "ConnectBlock(DASH): chain-locked transaction %s overrides islock %s\n", tx->GetHash().ToString(), ::SerializeHash(*conflictLock).ToString()); m_isman->RemoveConflictingLock(::SerializeHash(*conflictLock), *conflictLock); From 519966efff46e8582dee69c1e233ca0c29b67bf9 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 1 Nov 2024 15:16:42 +0300 Subject: [PATCH 008/116] refactor: Refactor `CCbTx` python class to match c++ declaration --- .../feature_dip4_coinbasemerkleroots.py | 2 +- test/functional/feature_llmq_rotation.py | 2 +- test/functional/test_framework/messages.py | 44 ++++++++++--------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/test/functional/feature_dip4_coinbasemerkleroots.py b/test/functional/feature_dip4_coinbasemerkleroots.py index 844e26ea61..ac45de1176 100755 --- a/test/functional/feature_dip4_coinbasemerkleroots.py +++ b/test/functional/feature_dip4_coinbasemerkleroots.py @@ -204,7 +204,7 @@ def test_getmnlistdiff_quorums(self, baseBlockHash, blockHash, baseQuorumList, e cbtx = CCbTx() cbtx.deserialize(BytesIO(d.cbTx.vExtraPayload)) - if cbtx.version >= 2: + if cbtx.nVersion >= 2: hashes = [] for qc in newQuorumList.values(): hashes.append(hash256(qc.serialize())) diff --git a/test/functional/feature_llmq_rotation.py b/test/functional/feature_llmq_rotation.py index 31e637686b..3d933eb8e4 100755 --- a/test/functional/feature_llmq_rotation.py +++ b/test/functional/feature_llmq_rotation.py @@ -252,7 +252,7 @@ def test_getmnlistdiff_quorums(self, baseBlockHash, blockHash, baseQuorumList, e cbtx = CCbTx() cbtx.deserialize(BytesIO(d.cbTx.vExtraPayload)) - if cbtx.version >= 2: + if cbtx.nVersion >= 2: hashes = [] for qc in newQuorumList.values(): hashes.append(hash256(qc.serialize())) diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index ac0cb3faa2..ae2c405e6e 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -1094,14 +1094,14 @@ def __repr__(self): class CCbTx: - __slots__ = ("version", "height", "merkleRootMNList", "merkleRootQuorums", "bestCLHeightDiff", "bestCLSignature", "lockedAmount") + __slots__ = ("nVersion", "nHeight", "merkleRootMNList", "merkleRootQuorums", "bestCLHeightDiff", "bestCLSignature", "assetLockedAmount") - def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQuorums=None, bestCLHeightDiff=None, bestCLSignature=None, lockedAmount=None): + def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQuorums=None, bestCLHeightDiff=None, bestCLSignature=None, assetLockedAmount=None): self.set_null() if version is not None: - self.version = version + self.nVersion = version if height is not None: - self.height = height + self.nHeight = height if merkleRootMNList is not None: self.merkleRootMNList = merkleRootMNList if merkleRootQuorums is not None: @@ -1110,42 +1110,46 @@ def __init__(self, version=None, height=None, merkleRootMNList=None, merkleRootQ self.bestCLHeightDiff = bestCLHeightDiff if bestCLSignature is not None: self.bestCLSignature = bestCLSignature - if lockedAmount is not None: - self.lockedAmount = lockedAmount + if assetLockedAmount is not None: + self.assetLockedAmount = assetLockedAmount def set_null(self): - self.version = 0 - self.height = 0 + self.nVersion = 0 + self.nHeight = 0 self.merkleRootMNList = None + self.merkleRootQuorums = None self.bestCLHeightDiff = 0 self.bestCLSignature = b'\x00' * 96 - self.lockedAmount = 0 + self.assetLockedAmount = 0 def deserialize(self, f): - self.version = struct.unpack("= 2: + if self.nVersion >= 2: self.merkleRootQuorums = deser_uint256(f) - if self.version >= 3: + if self.nVersion >= 3: self.bestCLHeightDiff = deser_compact_size(f) self.bestCLSignature = f.read(96) - self.lockedAmount = struct.unpack("= 2: + if self.nVersion >= 2: r += ser_uint256(self.merkleRootQuorums) - if self.version >= 3: + if self.nVersion >= 3: r += ser_compact_size(self.bestCLHeightDiff) r += self.bestCLSignature - r += struct.pack(" Date: Fri, 1 Nov 2024 15:25:14 +0300 Subject: [PATCH 009/116] refactor: Introduce `get_chain_conf_names` --- .../test_framework/test_framework.py | 15 ++------- test/functional/test_framework/util.py | 32 +++++++++++-------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 024ab330ef..a9a063b593 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -48,6 +48,7 @@ check_json_precision, copy_datadir, force_finish_mnsync, + get_chain_conf_names, get_datadir_path, initialize_datadir, p2p_port, @@ -610,19 +611,7 @@ def dynamically_initialize_datadir(self, node_p2p_port, node_rpc_port): if entry not in ['chainstate', 'blocks', 'indexes', 'evodb']: os.remove(os.path.join(new_data_dir, self.chain, entry)) - # Translate chain name to config name - if self.chain == 'testnet3': - chain_name_conf_arg = 'testnet' - chain_name_conf_section = 'test' - chain_name_conf_arg_value = '1' - elif self.chain == 'devnet': - chain_name_conf_arg = 'devnet' - chain_name_conf_section = 'devnet' - chain_name_conf_arg_value = 'devnet1' - else: - chain_name_conf_arg = self.chain - chain_name_conf_section = self.chain - chain_name_conf_arg_value = '1' + (chain_name_conf_arg, chain_name_conf_arg_value, chain_name_conf_section) = get_chain_conf_names(self.chain) with open(os.path.join(new_data_dir, "dash.conf"), 'w', encoding='utf8') as f: f.write("{}={}\n".format(chain_name_conf_arg, chain_name_conf_arg_value)) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 9b427cf40b..54578d6cce 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -381,19 +381,7 @@ def initialize_datadir(dirname, n, chain): def write_config(config_path, *, n, chain, extra_config=""): - # Translate chain subdirectory name to config name - if chain == 'testnet3': - chain_name_conf_arg = 'testnet' - chain_name_conf_section = 'test' - chain_name_conf_arg_value = '1' - elif chain == 'devnet': - chain_name_conf_arg = 'devnet' - chain_name_conf_section = 'devnet' - chain_name_conf_arg_value = 'devnet1' - else: - chain_name_conf_arg = chain - chain_name_conf_section = chain - chain_name_conf_arg_value = '1' + (chain_name_conf_arg, chain_name_conf_arg_value, chain_name_conf_section) = get_chain_conf_names(chain) with open(config_path, 'w', encoding='utf8') as f: if chain_name_conf_arg: f.write("{}={}\n".format(chain_name_conf_arg, chain_name_conf_arg_value)) @@ -494,6 +482,24 @@ def get_chain_folder(datadir, chain): pass return chain +def get_chain_conf_names(chain): + """ + Translate chain name to config names + """ + if chain == 'testnet3': + arg = 'testnet' + value = '1' + section = 'test' + elif chain == 'devnet': + arg = 'devnet' + value = 'devnet1' + section = 'devnet' + else: + arg = chain + value = '1' + section = chain + return (arg, value, section) + def get_bip9_details(node, key): """Return extra info about bip9 softfork""" return node.getblockchaininfo()['softforks'][key]['bip9'] From c32fac079f8b887b9a6e274a2eb3b47c5ee01d93 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 4 Nov 2024 17:27:00 +0300 Subject: [PATCH 010/116] refactor: more `CGovernanceVote` cleanups --- src/governance/governance.cpp | 12 ++++-------- src/governance/object.cpp | 2 +- src/governance/vote.cpp | 14 ++++++------- src/governance/vote.h | 37 ++++++++++++++++++----------------- src/interfaces/node.h | 2 +- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 7318708ecc..6b02357540 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -548,14 +548,10 @@ std::vector CGovernanceManager::GetCurrentVotes(const uint256& vote_rec_t voteRecord; if (!govobj.GetCurrentMNVotes(mnpair.first, voteRecord)) continue; - for (const auto& voteInstancePair : voteRecord.mapInstances) { - int signal = voteInstancePair.first; - int outcome = voteInstancePair.second.eOutcome; - int64_t nCreationTime = voteInstancePair.second.nCreationTime; - - CGovernanceVote vote = CGovernanceVote(mnpair.first, nParentHash, (vote_signal_enum_t)signal, (vote_outcome_enum_t)outcome); - vote.SetTime(nCreationTime); - + for (const auto& [signal, vote_instance] : voteRecord.mapInstances) { + CGovernanceVote vote = CGovernanceVote(mnpair.first, nParentHash, (vote_signal_enum_t)signal, + vote_instance.eOutcome); + vote.SetTime(vote_instance.nCreationTime); vecResult.push_back(vote); } } diff --git a/src/governance/object.cpp b/src/governance/object.cpp index a41fb48d00..6ae0ed619b 100644 --- a/src/governance/object.cpp +++ b/src/governance/object.cpp @@ -90,7 +90,7 @@ bool CGovernanceObject::ProcessVote(CMasternodeMetaMan& mn_metaman, CGovernanceM exception = CGovernanceException(ostr.str(), GOVERNANCE_EXCEPTION_WARNING); return false; } - if (eSignal > MAX_SUPPORTED_VOTE_SIGNAL) { + if (eSignal < VOTE_SIGNAL_NONE || eSignal >= VOTE_SIGNAL_UNKNOWN) { std::ostringstream ostr; ostr << "CGovernanceObject::ProcessVote -- Unsupported vote signal: " << CGovernanceVoting::ConvertSignalToString(vote.GetSignal()); LogPrintf("%s\n", ostr.str()); diff --git a/src/governance/vote.cpp b/src/governance/vote.cpp index 6f5e1f1709..5cfa2b1ac1 100644 --- a/src/governance/vote.cpp +++ b/src/governance/vote.cpp @@ -87,10 +87,10 @@ vote_signal_enum_t CGovernanceVoting::ConvertVoteSignal(const std::string& strVo CGovernanceVote::CGovernanceVote(const COutPoint& outpointMasternodeIn, const uint256& nParentHashIn, vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn) : - nVoteSignal(eVoteSignalIn), masternodeOutpoint(outpointMasternodeIn), nParentHash(nParentHashIn), nVoteOutcome(eVoteOutcomeIn), + nVoteSignal(eVoteSignalIn), nTime(GetAdjustedTime()) { UpdateHash(); @@ -197,15 +197,15 @@ bool CGovernanceVote::IsValid(const CDeterministicMNList& tip_mn_list, bool useV return false; } - // support up to MAX_SUPPORTED_VOTE_SIGNAL, can be extended - if (nVoteSignal > MAX_SUPPORTED_VOTE_SIGNAL) { - LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- Client attempted to vote on invalid signal(%d) - %s\n", nVoteSignal, GetHash().ToString()); + if (nVoteSignal < VOTE_SIGNAL_NONE || nVoteSignal >= VOTE_SIGNAL_UNKNOWN) { + LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- Client attempted to vote on invalid signal(%d) - %s\n", + nVoteSignal, GetHash().ToString()); return false; } - // 0=none, 1=yes, 2=no, 3=abstain. Beyond that reject votes - if (nVoteOutcome > 3) { - LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- Client attempted to vote on invalid outcome(%d) - %s\n", nVoteSignal, GetHash().ToString()); + if (nVoteOutcome < VOTE_OUTCOME_NONE || nVoteOutcome >= VOTE_OUTCOME_UNKNOWN) { + LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- Client attempted to vote on invalid outcome(%d) - %s\n", + nVoteOutcome, GetHash().ToString()); return false; } diff --git a/src/governance/vote.h b/src/governance/vote.h index 55573784a0..2b86c19471 100644 --- a/src/governance/vote.h +++ b/src/governance/vote.h @@ -18,24 +18,25 @@ class CKeyID; class PeerManager; // INTENTION OF MASTERNODES REGARDING ITEM -enum vote_outcome_enum_t : uint8_t { - VOTE_OUTCOME_NONE = 0, - VOTE_OUTCOME_YES = 1, - VOTE_OUTCOME_NO = 2, - VOTE_OUTCOME_ABSTAIN = 3 +enum vote_outcome_enum_t : int { + VOTE_OUTCOME_NONE = 0, + VOTE_OUTCOME_YES, + VOTE_OUTCOME_NO, + VOTE_OUTCOME_ABSTAIN, + VOTE_OUTCOME_UNKNOWN }; - +template<> struct is_serializable_enum : std::true_type {}; // SIGNAL VARIOUS THINGS TO HAPPEN: -enum vote_signal_enum_t : uint8_t { - VOTE_SIGNAL_NONE = 0, - VOTE_SIGNAL_FUNDING = 1, // -- fund this object for it's stated amount - VOTE_SIGNAL_VALID = 2, // -- this object checks out in sentinel engine - VOTE_SIGNAL_DELETE = 3, // -- this object should be deleted from memory entirely - VOTE_SIGNAL_ENDORSED = 4, // -- officially endorsed by the network somehow (delegation) +enum vote_signal_enum_t : int { + VOTE_SIGNAL_NONE = 0, + VOTE_SIGNAL_FUNDING, // -- fund this object for it's stated amount + VOTE_SIGNAL_VALID, // -- this object checks out in sentinel engine + VOTE_SIGNAL_DELETE, // -- this object should be deleted from memory entirely + VOTE_SIGNAL_ENDORSED, // -- officially endorsed by the network somehow (delegation) + VOTE_SIGNAL_UNKNOWN }; - -static constexpr int MAX_SUPPORTED_VOTE_SIGNAL = VOTE_SIGNAL_ENDORSED; +template<> struct is_serializable_enum : std::true_type {}; /** * Governance Voting @@ -63,10 +64,10 @@ class CGovernanceVote friend bool operator<(const CGovernanceVote& vote1, const CGovernanceVote& vote2); private: - int nVoteSignal{VOTE_SIGNAL_NONE}; // see VOTE_ACTIONS above COutPoint masternodeOutpoint; uint256 nParentHash; - int nVoteOutcome{VOTE_OUTCOME_NONE}; // see VOTE_OUTCOMES above + vote_outcome_enum_t nVoteOutcome{VOTE_OUTCOME_NONE}; + vote_signal_enum_t nVoteSignal{VOTE_SIGNAL_NONE}; int64_t nTime{0}; std::vector vchSig; @@ -80,9 +81,9 @@ class CGovernanceVote int64_t GetTimestamp() const { return nTime; } - vote_signal_enum_t GetSignal() const { return vote_signal_enum_t(nVoteSignal); } + vote_signal_enum_t GetSignal() const { return nVoteSignal; } - vote_outcome_enum_t GetOutcome() const { return vote_outcome_enum_t(nVoteOutcome); } + vote_outcome_enum_t GetOutcome() const { return nVoteOutcome; } const uint256& GetParentHash() const { return nParentHash; } diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 11d6a936d0..0b9abd07b7 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -39,7 +39,7 @@ enum class TransactionError; struct CNodeStateStats; struct NodeContext; -enum vote_signal_enum_t : uint8_t; +enum vote_signal_enum_t : int; namespace interfaces { class Handler; From 808d215926f81a05377335c69413167e55e7b9e7 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 6 Nov 2024 10:58:47 +0300 Subject: [PATCH 011/116] fix: set correct locale in guix ci container --- contrib/containers/guix/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/containers/guix/Dockerfile b/contrib/containers/guix/Dockerfile index 102b5162c8..4b09a24c12 100644 --- a/contrib/containers/guix/Dockerfile +++ b/contrib/containers/guix/Dockerfile @@ -31,7 +31,7 @@ ENV PATH="/usr/local/bin:/usr/local/guix/current/bin:$PATH" # Application Setup # https://guix.gnu.org/manual/en/html_node/Application-Setup.html ENV GUIX_LOCPATH="/usr/local/guix/profile" \ - LC_ALL="C" + LC_ALL="en_US.UTF-8" RUN guix_file_name=guix-binary-${guix_version}.$(uname -m)-linux.tar.xz && \ eval "guix_checksum=\${guix_checksum_$(uname -m)}" && \ From 0c988f06d86b587d9f8babb2f0792d7011ff8188 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 12:58:09 +0000 Subject: [PATCH 012/116] merge bitcoin#21089: Add support for powerpc64{,le} continuation of 9c8f5f71 from dash#5237 --- contrib/guix/guix-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index 227e1cf644..415e97c57d 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -74,7 +74,7 @@ mkdir -p "$VERSION_BASE" ################ # Default to building for all supported HOSTs (overridable by environment) -export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu +export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu powerpc64-linux-gnu powerpc64le-linux-gnu x86_64-w64-mingw32 x86_64-apple-darwin arm64-apple-darwin}" From 6a54603ca309742d78c36b0a5ed4fead9d57815f Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 15 May 2023 17:07:20 +0100 Subject: [PATCH 013/116] merge bitcoin#27670: remove redundant glibc patches --- contrib/guix/manifest.scm | 4 +- contrib/guix/patches/glibc-ldd-x86_64.patch | 10 - .../patches/glibc-versioned-locpath.patch | 241 ------------------ 3 files changed, 1 insertion(+), 254 deletions(-) delete mode 100644 contrib/guix/patches/glibc-ldd-x86_64.patch delete mode 100644 contrib/guix/patches/glibc-versioned-locpath.patch diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index beea4d6a17..68aa0d4701 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -526,9 +526,7 @@ inspecting signatures in Mach-O binaries.") (sha256 (base32 "0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6")) - (patches (search-our-patches "glibc-ldd-x86_64.patch" - "glibc-versioned-locpath.patch" - "glibc-2.27-fcommon.patch" + (patches (search-our-patches "glibc-2.27-fcommon.patch" "glibc-2.27-guix-prefix.patch")))))) (define (fix-ppc64-nx-default lief) diff --git a/contrib/guix/patches/glibc-ldd-x86_64.patch b/contrib/guix/patches/glibc-ldd-x86_64.patch deleted file mode 100644 index a23b095caa..0000000000 --- a/contrib/guix/patches/glibc-ldd-x86_64.patch +++ /dev/null @@ -1,10 +0,0 @@ -By default, 'RTDLLIST' in 'ldd' refers to 'lib64/ld-linux-x86-64.so', whereas -it's in 'lib/' for us. This patch fixes that. - ---- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed -+++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed -@@ -1,3 +1,3 @@ - /LD_TRACE_LOADED_OBJECTS=1/a\ - add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" --s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_ -+s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \2\4-x86-64\6 \2x32\4-x32\6"_ diff --git a/contrib/guix/patches/glibc-versioned-locpath.patch b/contrib/guix/patches/glibc-versioned-locpath.patch deleted file mode 100644 index 5afefd8fb3..0000000000 --- a/contrib/guix/patches/glibc-versioned-locpath.patch +++ /dev/null @@ -1,241 +0,0 @@ -The format of locale data can be incompatible between libc versions, and -loading incompatible data can lead to 'setlocale' returning EINVAL at best -or triggering an assertion failure at worst. See -https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html -for background information. - -To address that, this patch changes libc to honor a new 'GUIX_LOCPATH' -variable, and to look for locale data in version-specific sub-directories of -that variable. So, if GUIX_LOCPATH=/foo:/bar, locale data is searched for in -/foo/X.Y and /bar/X.Y, where X.Y is the libc version number. - -That way, a single 'GUIX_LOCPATH' setting can work even if different libc -versions coexist on the system. - ---- a/locale/newlocale.c -+++ b/locale/newlocale.c -@@ -30,6 +30,7 @@ - /* Lock for protecting global data. */ - __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden) - -+extern error_t compute_locale_search_path (char **, size_t *); - - /* Use this when we come along an error. */ - #define ERROR_RETURN \ -@@ -48,7 +49,6 @@ __newlocale (int category_mask, const char *locale, locale_t base) - locale_t result_ptr; - char *locale_path; - size_t locale_path_len; -- const char *locpath_var; - int cnt; - size_t names_len; - -@@ -102,17 +102,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base) - locale_path = NULL; - locale_path_len = 0; - -- locpath_var = getenv ("LOCPATH"); -- if (locpath_var != NULL && locpath_var[0] != '\0') -- { -- if (__argz_create_sep (locpath_var, ':', -- &locale_path, &locale_path_len) != 0) -- return NULL; -- -- if (__argz_add_sep (&locale_path, &locale_path_len, -- _nl_default_locale_path, ':') != 0) -- return NULL; -- } -+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) -+ return NULL; - - /* Get the names for the locales we are interested in. We either - allow a composite name or a single name. */ -diff --git a/locale/setlocale.c b/locale/setlocale.c -index e4de907e1f..47b6233fc5 100644 ---- a/locale/setlocale.c -+++ b/locale/setlocale.c -@@ -215,12 +215,65 @@ setdata (int category, struct __locale_data *data) - } - } - -+/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as -+ a colon-separated list. Return ENOMEN on error, zero otherwise. */ -+error_t -+compute_locale_search_path (char **locale_path, size_t *locale_path_len) -+{ -+ char* guix_locpath_var = getenv ("GUIX_LOCPATH"); -+ char *locpath_var = getenv ("LOCPATH"); -+ -+ if (guix_locpath_var != NULL && guix_locpath_var[0] != '\0') -+ { -+ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These -+ entries are systematically prefixed with "/X.Y" where "X.Y" is the -+ libc version. */ -+ if (__argz_create_sep (guix_locpath_var, ':', -+ locale_path, locale_path_len) != 0 -+ || __argz_suffix_entries (locale_path, locale_path_len, -+ "/" VERSION) != 0) -+ goto bail_out; -+ } -+ -+ if (locpath_var != NULL && locpath_var[0] != '\0') -+ { -+ char *reg_locale_path = NULL; -+ size_t reg_locale_path_len = 0; -+ -+ if (__argz_create_sep (locpath_var, ':', -+ ®_locale_path, ®_locale_path_len) != 0) -+ goto bail_out; -+ -+ if (__argz_append (locale_path, locale_path_len, -+ reg_locale_path, reg_locale_path_len) != 0) -+ goto bail_out; -+ -+ free (reg_locale_path); -+ } -+ -+ if (*locale_path != NULL) -+ { -+ /* Append the system default locale directory. */ -+ if (__argz_add_sep (locale_path, locale_path_len, -+ _nl_default_locale_path, ':') != 0) -+ goto bail_out; -+ } -+ -+ return 0; -+ -+ bail_out: -+ free (*locale_path); -+ *locale_path = NULL; -+ *locale_path_len = 0; -+ -+ return ENOMEM; -+} -+ - char * - setlocale (int category, const char *locale) - { - char *locale_path; - size_t locale_path_len; -- const char *locpath_var; - char *composite; - - /* Sanity check for CATEGORY argument. */ -@@ -251,18 +304,11 @@ setlocale (int category, const char *locale) - locale_path = NULL; - locale_path_len = 0; - -- locpath_var = getenv ("LOCPATH"); -- if (locpath_var != NULL && locpath_var[0] != '\0') -+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) - { -- if (__argz_create_sep (locpath_var, ':', -- &locale_path, &locale_path_len) != 0 -- || __argz_add_sep (&locale_path, &locale_path_len, -- _nl_default_locale_path, ':') != 0) -- { -- __libc_rwlock_unlock (__libc_setlocale_lock); -- return NULL; -- } -+ __libc_rwlock_unlock (__libc_setlocale_lock); -+ return NULL; - } - - if (category == LC_ALL) - { -diff --git a/string/Makefile b/string/Makefile -index aa2da9ca72..de752a1539 100644 ---- a/string/Makefile -+++ b/string/Makefile -@@ -40,7 +40,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \ - swab strfry memfrob memmem rawmemchr strchrnul \ - $(addprefix argz-,append count create ctsep next \ - delete extract insert stringify \ -- addsep replace) \ -+ addsep replace suffix) \ - envz basename \ - strcoll_l strxfrm_l string-inlines memrchr \ - xpg-strerror strerror_l explicit_bzero -diff --git a/string/argz-suffix.c b/string/argz-suffix.c -new file mode 100644 -index 0000000000..505b0f248c ---- /dev/null -+++ b/string/argz-suffix.c -@@ -0,0 +1,56 @@ -+/* Copyright (C) 2015 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ Contributed by Ludovic Courtès . -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library 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 -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+ -+error_t -+__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix) -+ -+{ -+ size_t suffix_len = strlen (suffix); -+ size_t count = __argz_count (*argz, *argz_len); -+ size_t new_argz_len = *argz_len + count * suffix_len; -+ char *new_argz = malloc (new_argz_len); -+ -+ if (new_argz) -+ { -+ char *p = new_argz, *entry; -+ -+ for (entry = *argz; -+ entry != NULL; -+ entry = argz_next (*argz, *argz_len, entry)) -+ { -+ p = stpcpy (p, entry); -+ p = stpcpy (p, suffix); -+ p++; -+ } -+ -+ free (*argz); -+ *argz = new_argz; -+ *argz_len = new_argz_len; -+ -+ return 0; -+ } -+ else -+ return ENOMEM; -+} -+weak_alias (__argz_suffix_entries, argz_suffix_entries) -diff --git a/string/argz.h b/string/argz.h -index 9c496f5ef5..1010a439d8 100644 ---- a/string/argz.h -+++ b/string/argz.h -@@ -108,6 +108,16 @@ extern error_t argz_replace (char **__restrict __argz, - const char *__restrict __str, - const char *__restrict __with, - unsigned int *__restrict __replace_count); -+ -+/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success, -+ and ENOMEN if memory cannot be allocated. */ -+extern error_t __argz_suffix_entries (char **__restrict __argz, -+ size_t *__restrict __argz_len, -+ const char *__restrict __suffix); -+extern error_t argz_suffix_entries (char **__restrict __argz, -+ size_t *__restrict __argz_len, -+ const char *__restrict __suffix); -+ - - /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there - are no more. If entry is NULL, then the first entry is returned. This From d3d7a0562a925d575352855a12e795d8f83ac202 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:30:00 +0000 Subject: [PATCH 014/116] merge bitcoin#24031: don't compress macOS DMG --- .gitignore | 1 - Makefile.am | 9 +--- configure.ac | 1 - contrib/guix/libexec/build.sh | 16 +------ contrib/guix/libexec/codesign.sh | 7 +-- contrib/guix/manifest.scm | 2 - contrib/macdeploy/README.md | 11 +---- depends/packages/native_libdmg-hfsplus.mk | 24 ---------- depends/packages/packages.mk | 2 +- .../remove-libcrypto-dependency.patch | 45 ------------------- 10 files changed, 7 insertions(+), 111 deletions(-) delete mode 100644 depends/packages/native_libdmg-hfsplus.mk delete mode 100644 depends/patches/native_libdmg-hfsplus/remove-libcrypto-dependency.patch diff --git a/.gitignore b/.gitignore index 949403cc23..9a73e23bdb 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,6 @@ libconftest.dylib* *.log *.trs *.dmg -*.iso *.json.h *.raw.h diff --git a/Makefile.am b/Makefile.am index b9a89fa762..ef535b86c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ if ENABLE_MAN SUBDIRS += doc/man endif .PHONY: deploy FORCE -.INTERMEDIATE: $(OSX_TEMP_ISO) $(COVERAGE_INFO) +.INTERMEDIATE: $(COVERAGE_INFO) export PYTHONPATH @@ -37,7 +37,6 @@ space := $(empty) $(empty) OSX_APP=Dash-Qt.app OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) OSX_DMG = $(OSX_VOLNAME).dmg -OSX_TEMP_ISO = $(OSX_DMG:.dmg=).temp.iso OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/dash.icns OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed @@ -127,19 +126,15 @@ deploydir: $(OSX_DMG) else !BUILD_DARWIN APP_DIST_DIR=$(top_builddir)/dist -$(OSX_TEMP_ISO): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt +$(OSX_DMG): deploydir $(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -o $@ $(APP_DIST_DIR) -- $(if $(SOURCE_DATE_EPOCH),-volume_date all_file_dates =$(SOURCE_DATE_EPOCH)) -$(OSX_DMG): $(OSX_TEMP_ISO) - $(DMG) dmg "$<" "$@" - $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt endif !BUILD_DARWIN -appbundle: $(OSX_APP_BUILT) deploy: $(OSX_DMG) endif diff --git a/configure.ac b/configure.ac index 4081edea60..0acc144585 100644 --- a/configure.ac +++ b/configure.ac @@ -846,7 +846,6 @@ case $host in AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) AC_PATH_TOOL([OTOOL], [otool], otool) AC_PATH_PROGS([XORRISOFS], [xorrisofs], xorrisofs) - AC_PATH_PROGS([DMG], [dmg], dmg) dnl libtool will try to strip the static lib, which is a problem for dnl cross-builds because strip attempts to call a hard-coded ld, diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index f963578db5..6be7484daf 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -81,19 +81,6 @@ prepend_to_search_env_var() { export "${1}=${2}${!1:+:}${!1}" } -case "$HOST" in - *darwin*) - # When targeting darwin, zlib is required by native_libdmg-hfsplus. - zlib_store_path=$(store_path "zlib") - zlib_static_store_path=$(store_path "zlib" static) - - prepend_to_search_env_var LIBRARY_PATH "${zlib_static_store_path}/lib:${zlib_store_path}/lib" - prepend_to_search_env_var C_INCLUDE_PATH "${zlib_store_path}/include" - prepend_to_search_env_var CPLUS_INCLUDE_PATH "${zlib_store_path}/include" - prepend_to_search_env_var OBJC_INCLUDE_PATH "${zlib_store_path}/include" - prepend_to_search_env_var OBJCPLUS_INCLUDE_PATH "${zlib_store_path}/include" -esac - # Set environment variables to point the CROSS toolchain to the right # includes/libs for $HOST case "$HOST" in @@ -326,8 +313,7 @@ mkdir -p "$DISTSRC" make deploydir ${V:+V=1} mkdir -p "unsigned-app-${HOST}" cp --target-directory="unsigned-app-${HOST}" \ - contrib/macdeploy/detached-sig-create.sh \ - "${BASEPREFIX}/${HOST}"/native/bin/dmg + contrib/macdeploy/detached-sig-create.sh mv --target-directory="unsigned-app-${HOST}" dist ( cd "unsigned-app-${HOST}" diff --git a/contrib/guix/libexec/codesign.sh b/contrib/guix/libexec/codesign.sh index 91183fb53c..ef5ed90322 100755 --- a/contrib/guix/libexec/codesign.sh +++ b/contrib/guix/libexec/codesign.sh @@ -77,14 +77,11 @@ mkdir -p "$DISTSRC" # Apply detached codesignatures to dist/ (in-place) signapple apply dist/Dash-Qt.app codesignatures/osx/dist - # Make an uncompressed DMG from dist/ + # Make a DMG from dist/ xorrisofs -D -l -V "$(< osx_volname)" -no-pad -r -dir-mode 0755 \ - -o uncompressed.dmg \ + -o "${OUTDIR}/${DISTNAME}-${HOST}.dmg" \ dist \ -- -volume_date all_file_dates ="$SOURCE_DATE_EPOCH" - - # Compress uncompressed.dmg and output to OUTDIR - ./dmg dmg uncompressed.dmg "${OUTDIR}/${DISTNAME}-${HOST}.dmg" ;; *) exit 1 diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 68aa0d4701..e874c4787a 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -585,8 +585,6 @@ parse, modify and abstract ELF, PE and MachO formats.") bzip2 gzip xz - zlib - (list zlib "static") ;; Build tools cmake-minimal gnu-make diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md index d201e327e9..a6fae6e018 100644 --- a/contrib/macdeploy/README.md +++ b/contrib/macdeploy/README.md @@ -97,16 +97,7 @@ redistributed. [`xorrisofs`](https://www.gnu.org/software/xorriso/) is used to create the DMG. -`xorrisofs` cannot compress DMGs, so afterwards, the DMG tool from the -`libdmg-hfsplus` project is used to compress it. There are several bugs in this -tool and its maintainer has seemingly abandoned the project. - -The DMG tool has the ability to create DMGs from scratch as well, but this functionality is -broken. Only the compression feature is currently used. Ideally, the creation could be fixed -and `xorrisofs` would no longer be necessary. - -Background images and other features can be added to DMG files by inserting a -`.DS_Store` during creation. +A background image is added to DMG files by inserting a `.DS_Store` during creation. As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a requirement in order to satisfy the new Gatekeeper requirements. Because this private key cannot be diff --git a/depends/packages/native_libdmg-hfsplus.mk b/depends/packages/native_libdmg-hfsplus.mk deleted file mode 100644 index c7c8adef41..0000000000 --- a/depends/packages/native_libdmg-hfsplus.mk +++ /dev/null @@ -1,24 +0,0 @@ -package=native_libdmg-hfsplus -$(package)_version=7ac55ec64c96f7800d9818ce64c79670e7f02b67 -$(package)_download_path=https://github.com/planetbeing/libdmg-hfsplus/archive -$(package)_file_name=$($(package)_version).tar.gz -$(package)_sha256_hash=56fbdc48ec110966342f0ecddd6f8f89202f4143ed2a3336e42bbf88f940850c -$(package)_build_subdir=build -$(package)_patches=remove-libcrypto-dependency.patch - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/remove-libcrypto-dependency.patch && \ - mkdir build -endef - -define $(package)_config_cmds - $($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -Wl,--build-id=none" -DCMAKE_SKIP_RPATH="ON" -DCMAKE_EXE_LINKER_FLAGS="-static" -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" .. -endef - -define $(package)_build_cmds - $(MAKE) -C dmg -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) -C dmg install -endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index bdf235b19b..2e07037ea7 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -27,7 +27,7 @@ usdt_linux_packages=systemtap darwin_native_packages = native_ds_store native_mac_alias ifneq ($(build_os),darwin) -darwin_native_packages += native_cctools native_libtapi native_libdmg-hfsplus +darwin_native_packages += native_cctools native_libtapi ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),) darwin_native_packages+= native_clang diff --git a/depends/patches/native_libdmg-hfsplus/remove-libcrypto-dependency.patch b/depends/patches/native_libdmg-hfsplus/remove-libcrypto-dependency.patch deleted file mode 100644 index f346c8f2cf..0000000000 --- a/depends/patches/native_libdmg-hfsplus/remove-libcrypto-dependency.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 3e5fd3fb56bc9ff03beb535979e33dcf83fe1f70 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Thu, 8 May 2014 12:39:42 -0400 -Subject: [PATCH] dmg: remove libcrypto dependency - ---- - dmg/CMakeLists.txt | 16 ---------------- - 1 file changed, 16 deletions(-) - -diff --git a/dmg/CMakeLists.txt b/dmg/CMakeLists.txt -index eec62d6..3969f64 100644 ---- a/dmg/CMakeLists.txt -+++ b/dmg/CMakeLists.txt -@@ -1,12 +1,5 @@ --INCLUDE(FindOpenSSL) - INCLUDE(FindZLIB) - --FIND_LIBRARY(CRYPTO_LIBRARIES crypto -- PATHS -- /usr/lib -- /usr/local/lib -- ) -- - IF(NOT ZLIB_FOUND) - message(FATAL_ERROR "zlib is required for dmg!") - ENDIF(NOT ZLIB_FOUND) -@@ -18,15 +11,6 @@ link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs) - - add_library(dmg adc.c base64.c checksum.c dmgfile.c dmglib.c filevault.c io.c partition.c resources.c udif.c) - --IF(OPENSSL_FOUND) -- add_definitions(-DHAVE_CRYPT) -- include_directories(${OPENSSL_INCLUDE_DIR}) -- target_link_libraries(dmg ${CRYPTO_LIBRARIES}) -- IF(WIN32) -- TARGET_LINK_LIBRARIES(dmg gdi32) -- ENDIF(WIN32) --ENDIF(OPENSSL_FOUND) -- - target_link_libraries(dmg common hfs z) - - add_executable(dmg-bin dmg.c) --- -2.22.0 - From eb0ae0828af6423c148235633c8becdf0e24f415 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 8 Nov 2022 12:56:14 +0000 Subject: [PATCH 015/116] merge bitcoin#26470: Clean up `libexec/build.sh` --- contrib/guix/libexec/build.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 6be7484daf..be2dbe40b4 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -71,16 +71,12 @@ unset CPLUS_INCLUDE_PATH unset OBJC_INCLUDE_PATH unset OBJCPLUS_INCLUDE_PATH -export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64:${NATIVE_GCC_STATIC}/lib:${NATIVE_GCC_STATIC}/lib64" +export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib" export C_INCLUDE_PATH="${NATIVE_GCC}/include" export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include" export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" -prepend_to_search_env_var() { - export "${1}=${2}${!1:+:}${!1}" -} - # Set environment variables to point the CROSS toolchain to the right # includes/libs for $HOST case "$HOST" in From ac8bd5ae5f9244832343631b508fd0096c184582 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:58:17 +0000 Subject: [PATCH 016/116] refactor: move lief definitions to expected location Should help upcoming commits render their diffs correctly --- contrib/guix/manifest.scm | 68 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index e874c4787a..de6f7cfb66 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -203,6 +203,40 @@ chain for " target " development.")) (search-our-patches "nsis-gcc-10-memmove.patch" "nsis-disable-installer-reloc.patch"))) +(define (fix-ppc64-nx-default lief) + (package-with-extra-patches lief + (search-our-patches "lief-fix-ppc64-nx-default.patch"))) + +(define-public lief + (package + (name "python-lief") + (version "0.12.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/lief-project/LIEF.git") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1xzbh3bxy4rw1yamnx68da1v5s56ay4g081cyamv67256g0qy2i1")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'parallel-jobs + ;; build with multiple cores + (lambda _ + (substitute* "setup.py" (("self.parallel if self.parallel else 1") (number->string (parallel-job-count))))))))) + (native-inputs + `(("cmake" ,cmake))) + (home-page "https://github.com/lief-project/LIEF") + (synopsis "Library to Instrument Executable Formats") + (description "Python library to to provide a cross platform library which can +parse, modify and abstract ELF, PE and MachO formats.") + (license license:asl2.0))) + (define osslsigncode (package (name "osslsigncode") @@ -529,40 +563,6 @@ inspecting signatures in Mach-O binaries.") (patches (search-our-patches "glibc-2.27-fcommon.patch" "glibc-2.27-guix-prefix.patch")))))) -(define (fix-ppc64-nx-default lief) - (package-with-extra-patches lief - (search-our-patches "lief-fix-ppc64-nx-default.patch"))) - -(define-public lief - (package - (name "python-lief") - (version "0.12.1") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/lief-project/LIEF.git") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1xzbh3bxy4rw1yamnx68da1v5s56ay4g081cyamv67256g0qy2i1")))) - (build-system python-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'parallel-jobs - ;; build with multiple cores - (lambda _ - (substitute* "setup.py" (("self.parallel if self.parallel else 1") (number->string (parallel-job-count))))))))) - (native-inputs - `(("cmake" ,cmake))) - (home-page "https://github.com/lief-project/LIEF") - (synopsis "Library to Instrument Executable Formats") - (description "Python library to to provide a cross platform library which can -parse, modify and abstract ELF, PE and MachO formats.") - (license license:asl2.0))) - (packages->manifest (append (list ;; The Basics From 3799509603bb9a4233a119bad3e8f75bb65e8c9b Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:23:07 +0000 Subject: [PATCH 017/116] merge bitcoin#27296: import/sync python-lief (0.12.3) package definition from upstream --- contrib/containers/ci/Dockerfile | 2 +- contrib/guix/manifest.scm | 63 +++++++++++++++++--------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index d8ba16d76f..deb86c2323 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -76,7 +76,7 @@ RUN pip3 install \ codespell==1.17.1 \ flake8==3.8.3 \ jinja2 \ - lief==0.12.1 \ + lief==0.12.3 \ pyzmq \ vulture==2.3 \ mypy==0.781 \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index de6f7cfb66..3005ff1793 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -207,35 +207,40 @@ chain for " target " development.")) (package-with-extra-patches lief (search-our-patches "lief-fix-ppc64-nx-default.patch"))) -(define-public lief +;; Our python-lief package can be removed once we are using +;; guix 83bfdb409787cb2737e68b093a319b247b7858e6 or later. +;; Note we currently use cmake-minimal. +(define-public python-lief (package - (name "python-lief") - (version "0.12.1") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/lief-project/LIEF.git") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1xzbh3bxy4rw1yamnx68da1v5s56ay4g081cyamv67256g0qy2i1")))) - (build-system python-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'parallel-jobs - ;; build with multiple cores - (lambda _ - (substitute* "setup.py" (("self.parallel if self.parallel else 1") (number->string (parallel-job-count))))))))) - (native-inputs - `(("cmake" ,cmake))) - (home-page "https://github.com/lief-project/LIEF") - (synopsis "Library to Instrument Executable Formats") - (description "Python library to to provide a cross platform library which can -parse, modify and abstract ELF, PE and MachO formats.") - (license license:asl2.0))) + (name "python-lief") + (version "0.12.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/lief-project/LIEF") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "11i6hqmcjh56y554kqhl61698n9v66j2qk1c1g63mv2w07h2z661")))) + (build-system python-build-system) + (native-inputs (list cmake-minimal)) + (arguments + (list + #:tests? #f ;needs network + #:phases #~(modify-phases %standard-phases + (replace 'build + (lambda _ + (invoke + "python" "setup.py" "--sdk" "build" + (string-append + "-j" (number->string (parallel-job-count))))))))) + (home-page "https://github.com/lief-project/LIEF") + (synopsis "Library to instrument executable formats") + (description + "@code{python-lief} is a cross platform library which can parse, modify +and abstract ELF, PE and MachO formats.") + (license license:asl2.0))) (define osslsigncode (package @@ -601,7 +606,7 @@ inspecting signatures in Mach-O binaries.") ;; Git git-minimal ;; Tests - (fix-ppc64-nx-default lief)) + (fix-ppc64-nx-default python-lief)) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) ;; Windows From 70e62830a142408c74e2b051665dbbfa147e3cc4 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 3 Aug 2022 10:54:15 +0100 Subject: [PATCH 018/116] merge bitcoin#27179: use osslsigncode 2.5 --- contrib/guix/libexec/codesign.sh | 1 + contrib/guix/manifest.scm | 21 ++++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/contrib/guix/libexec/codesign.sh b/contrib/guix/libexec/codesign.sh index ef5ed90322..c097628690 100755 --- a/contrib/guix/libexec/codesign.sh +++ b/contrib/guix/libexec/codesign.sh @@ -70,6 +70,7 @@ mkdir -p "$DISTSRC" osslsigncode attach-signature \ -in "$infile" \ -out "${OUTDIR}/${infile_base/-unsigned}" \ + -CAfile "$GUIX_ENVIRONMENT/etc/ssl/certs/ca-certificates.crt" \ -sigin codesignatures/win/"$infile_base".pem done ;; diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 3005ff1793..b33f0b455d 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -28,6 +28,7 @@ (gnu packages bison) (gnu packages tls) (gnu packages version-control) + (guix build-system cmake) (guix build-system gnu) (guix build-system python) (guix build-system trivial) @@ -245,27 +246,20 @@ and abstract ELF, PE and MachO formats.") (define osslsigncode (package (name "osslsigncode") - (version "2.0") + (version "2.5") (source (origin (method url-fetch) (uri (string-append "https://github.com/mtrojnar/" name "/archive/" version ".tar.gz")) (sha256 (base32 - "0byri6xny770wwb2nciq44j5071122l14bvv65axdd70nfjf0q2s")))) - (build-system gnu-build-system) - (native-inputs - `(("pkg-config" ,pkg-config) - ("autoconf" ,autoconf) - ("automake" ,automake) - ("libtool" ,libtool))) + "03by9706gg0an6dn48pljx38vcb76ziv11bgm8ilwsf293x2k4hv")))) + (build-system cmake-build-system) (inputs - `(("openssl" ,openssl))) + `(("openssl", openssl))) (arguments - `(#:configure-flags - `("--without-gsf" - "--without-curl" - "--disable-dependency-tracking"))) + '(#:configure-flags + (list "-DCMAKE_DISABLE_FIND_PACKAGE_CURL=TRUE"))) (home-page "https://github.com/mtrojnar/osslsigncode") (synopsis "Authenticode signing and timestamping tool") (description "osslsigncode is a small tool that implements part of the @@ -613,6 +607,7 @@ inspecting signatures in Mach-O binaries.") (list zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") (make-nsis-for-gcc-10 nsis-x86_64) + nss-certs osslsigncode)) ((string-contains target "-linux-") (list (make-bitcoin-cross-toolchain target))) From d439e4612fd30895bc8e131d0370e243604526f5 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:28:07 +0000 Subject: [PATCH 019/116] merge bitcoin#27813: Update `python-lief` package to 0.13.2 --- contrib/containers/ci/Dockerfile | 2 +- contrib/devtools/security-check.py | 6 +-- contrib/guix/manifest.scm | 37 +++++++++++-------- .../patches/lief-fix-ppc64-nx-default.patch | 29 --------------- 4 files changed, 26 insertions(+), 48 deletions(-) delete mode 100644 contrib/guix/patches/lief-fix-ppc64-nx-default.patch diff --git a/contrib/containers/ci/Dockerfile b/contrib/containers/ci/Dockerfile index deb86c2323..f80a1b5174 100644 --- a/contrib/containers/ci/Dockerfile +++ b/contrib/containers/ci/Dockerfile @@ -76,7 +76,7 @@ RUN pip3 install \ codespell==1.17.1 \ flake8==3.8.3 \ jinja2 \ - lief==0.12.3 \ + lief==0.13.2 \ pyzmq \ vulture==2.3 \ mypy==0.781 \ diff --git a/contrib/devtools/security-check.py b/contrib/devtools/security-check.py index 16ef3a0c7b..cb49dba3b1 100755 --- a/contrib/devtools/security-check.py +++ b/contrib/devtools/security-check.py @@ -113,7 +113,7 @@ def check_ELF_control_flow(binary) -> bool: main = binary.get_function_address('main') content = binary.get_content_from_virtual_address(main, 4, lief.Binary.VA_TYPES.AUTO) - if content == [243, 15, 30, 250]: # endbr64 + if content.tolist() == [243, 15, 30, 250]: # endbr64 return True return False @@ -142,7 +142,7 @@ def check_PE_control_flow(binary) -> bool: content = binary.get_content_from_virtual_address(virtual_address, 4, lief.Binary.VA_TYPES.VA) - if content == [243, 15, 30, 250]: # endbr64 + if content.tolist() == [243, 15, 30, 250]: # endbr64 return True return False @@ -190,7 +190,7 @@ def check_MACHO_control_flow(binary) -> bool: ''' content = binary.get_content_from_virtual_address(binary.entrypoint, 4, lief.Binary.VA_TYPES.AUTO) - if content == [243, 15, 30, 250]: # endbr64 + if content.tolist() == [243, 15, 30, 250]: # endbr64 return True return False diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index b33f0b455d..77bb75fc02 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -22,6 +22,7 @@ (gnu packages moreutils) (gnu packages pkg-config) (gnu packages python) + ((gnu packages python-build) #:select (python-tomli)) (gnu packages python-crypto) (gnu packages python-web) (gnu packages shells) @@ -204,38 +205,44 @@ chain for " target " development.")) (search-our-patches "nsis-gcc-10-memmove.patch" "nsis-disable-installer-reloc.patch"))) -(define (fix-ppc64-nx-default lief) - (package-with-extra-patches lief - (search-our-patches "lief-fix-ppc64-nx-default.patch"))) - -;; Our python-lief package can be removed once we are using -;; guix 83bfdb409787cb2737e68b093a319b247b7858e6 or later. -;; Note we currently use cmake-minimal. +;; While LIEF is packaged in Guix, we maintain our own package, +;; to simplify building, and more easily apply updates. +;; Moreover, the Guix's package uses cmake, which caused build +;; failure; see https://github.com/bitcoin/bitcoin/pull/27296. (define-public python-lief (package (name "python-lief") - (version "0.12.3") + (version "0.13.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/lief-project/LIEF") (commit version))) (file-name (git-file-name name version)) + (modules '((guix build utils))) + (snippet + '(begin + ;; Configure build for Python bindings. + (substitute* "api/python/config-default.toml" + (("(ninja = )true" all m) + (string-append m "false")) + (("(parallel-jobs = )0" all m) + (string-append m (number->string (parallel-job-count))))))) (sha256 (base32 - "11i6hqmcjh56y554kqhl61698n9v66j2qk1c1g63mv2w07h2z661")))) + "0y48x358ppig5xp97ahcphfipx7cg9chldj2q5zrmn610fmi4zll")))) (build-system python-build-system) - (native-inputs (list cmake-minimal)) + (native-inputs (list cmake-minimal python-tomli)) (arguments (list #:tests? #f ;needs network #:phases #~(modify-phases %standard-phases + (add-before 'build 'change-directory + (lambda _ + (chdir "api/python"))) (replace 'build (lambda _ - (invoke - "python" "setup.py" "--sdk" "build" - (string-append - "-j" (number->string (parallel-job-count))))))))) + (invoke "python" "setup.py" "build")))))) (home-page "https://github.com/lief-project/LIEF") (synopsis "Library to instrument executable formats") (description @@ -600,7 +607,7 @@ inspecting signatures in Mach-O binaries.") ;; Git git-minimal ;; Tests - (fix-ppc64-nx-default python-lief)) + python-lief) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) ;; Windows diff --git a/contrib/guix/patches/lief-fix-ppc64-nx-default.patch b/contrib/guix/patches/lief-fix-ppc64-nx-default.patch deleted file mode 100644 index 101bc1ddc0..0000000000 --- a/contrib/guix/patches/lief-fix-ppc64-nx-default.patch +++ /dev/null @@ -1,29 +0,0 @@ -Correct default for Binary::has_nx on ppc64 - -From the Linux kernel source: - - * This is the default if a program doesn't have a PT_GNU_STACK - * program header entry. The PPC64 ELF ABI has a non executable stack - * stack by default, so in the absence of a PT_GNU_STACK program header - * we turn execute permission off. - -This patch can be dropped the next time we update LIEF. - -diff --git a/src/ELF/Binary.cpp b/src/ELF/Binary.cpp -index a90be1ab..fd2d9764 100644 ---- a/src/ELF/Binary.cpp -+++ b/src/ELF/Binary.cpp -@@ -1084,7 +1084,12 @@ bool Binary::has_nx() const { - return segment->type() == SEGMENT_TYPES::PT_GNU_STACK; - }); - if (it_stack == std::end(segments_)) { -- return false; -+ if (header().machine_type() == ARCH::EM_PPC64) { -+ // The PPC64 ELF ABI has a non-executable stack by default. -+ return true; -+ } else { -+ return false; -+ } - } - - return !(*it_stack)->has(ELF_SEGMENT_FLAGS::PF_X); From 5d51aa940d729c91b9712f238c5d8b2aaa93d2ae Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sat, 3 Jun 2023 08:11:56 +0100 Subject: [PATCH 020/116] merge bitcoin#27811: Clean up manifest --- contrib/guix/manifest.scm | 44 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 77bb75fc02..63b2a1aded 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -1,12 +1,10 @@ -(use-modules (gnu) - (gnu packages) +(use-modules (gnu packages) (gnu packages autotools) - (gnu packages base) - (gnu packages bash) - (gnu packages certs) - (gnu packages cdrom) - (gnu packages check) - (gnu packages cmake) + ((gnu packages bash) #:select (bash-minimal)) + (gnu packages bison) + ((gnu packages certs) #:select (nss-certs)) + ((gnu packages cdrom) #:select (xorriso)) + ((gnu packages cmake) #:select (cmake-minimal)) (gnu packages commencement) (gnu packages compression) (gnu packages cross-base) @@ -14,32 +12,27 @@ (gnu packages file) (gnu packages gawk) (gnu packages gcc) - (gnu packages gnome) - (gnu packages installers) - (gnu packages linux) + ((gnu packages installers) #:select (nsis-x86_64)) + ((gnu packages linux) #:select (linux-libre-headers-5.15 util-linux)) (gnu packages llvm) (gnu packages mingw) (gnu packages moreutils) (gnu packages pkg-config) - (gnu packages python) + ((gnu packages python) #:select (python-minimal)) ((gnu packages python-build) #:select (python-tomli)) - (gnu packages python-crypto) - (gnu packages python-web) - (gnu packages shells) - (gnu packages bison) - (gnu packages tls) - (gnu packages version-control) + ((gnu packages python-crypto) #:select (python-asn1crypto)) + ((gnu packages python-web) #:select (python-requests)) + ((gnu packages tls) #:select (openssl)) + ((gnu packages version-control) #:select (git-minimal)) (guix build-system cmake) (guix build-system gnu) (guix build-system python) (guix build-system trivial) - (guix download) (guix gexp) (guix git-download) ((guix licenses) #:prefix license:) (guix packages) - (guix profiles) - (guix utils)) + ((guix utils) #:select (substitute-keyword-arguments))) (define-syntax-rule (search-our-patches file-name ...) "Return the list of absolute file names corresponding to each @@ -255,12 +248,13 @@ and abstract ELF, PE and MachO formats.") (name "osslsigncode") (version "2.5") (source (origin - (method url-fetch) - (uri (string-append "https://github.com/mtrojnar/" - name "/archive/" version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/mtrojnar/osslsigncode") + (commit version))) (sha256 (base32 - "03by9706gg0an6dn48pljx38vcb76ziv11bgm8ilwsf293x2k4hv")))) + "1j47vwq4caxfv0xw68kw5yh00qcpbd56d7rq6c483ma3y7s96yyz")))) (build-system cmake-build-system) (inputs `(("openssl", openssl))) From ed1f7fe812e20b54bc58222312d885291110b952 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:33:56 +0000 Subject: [PATCH 021/116] merge bitcoin#28069: Remove librt usage from release binaries --- configure.ac | 2 - contrib/devtools/symbol-check.py | 1 - contrib/guix/manifest.scm | 3 +- .../guix/patches/glibc-2.27-no-librt.patch | 53 +++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 contrib/guix/patches/glibc-2.27-no-librt.patch diff --git a/configure.ac b/configure.ac index 0acc144585..08006d3c98 100644 --- a/configure.ac +++ b/configure.ac @@ -959,8 +959,6 @@ if test x$ac_cv_sys_large_files != x && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" fi -AC_SEARCH_LIBS([clock_gettime],[rt]) - if test "x$enable_gprof" = xyes; then dnl -pg is incompatible with -pie. Since hardening and profiling together doesn't make sense, dnl we simply make them mutually exclusive here. Additionally, hardened toolchains may force diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index fd070b2823..7cc377b982 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -101,7 +101,6 @@ 'libc.so.6', # C library 'libpthread.so.0', # threading 'libm.so.6', # math library -'librt.so.1', # real-time (clock) 'libatomic.so.1', 'ld-linux-x86-64.so.2', # 64-bit dynamic linker 'ld-linux.so.2', # 32-bit dynamic linker diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 63b2a1aded..38d1c231dc 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -561,7 +561,8 @@ inspecting signatures in Mach-O binaries.") (base32 "0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6")) (patches (search-our-patches "glibc-2.27-fcommon.patch" - "glibc-2.27-guix-prefix.patch")))))) + "glibc-2.27-guix-prefix.patch" + "glibc-2.27-no-librt.patch")))))) (packages->manifest (append diff --git a/contrib/guix/patches/glibc-2.27-no-librt.patch b/contrib/guix/patches/glibc-2.27-no-librt.patch new file mode 100644 index 0000000000..4f2092ba7e --- /dev/null +++ b/contrib/guix/patches/glibc-2.27-no-librt.patch @@ -0,0 +1,53 @@ +This patch can be dropped when we are building with glibc 2.30+. + +commit 6e41ef56c9baab719a02f1377b1e7ce7bff61e73 +Author: Florian Weimer +Date: Fri Feb 8 10:21:56 2019 +0100 + + rt: Turn forwards from librt to libc into compat symbols [BZ #24194] + + As the result of commit 6e6249d0b461b952d0f544792372663feb6d792a + ("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17, + clock_gettime, clock_getres, clock_settime, clock_getcpuclockid, + clock_nanosleep were added to libc, and the file rt/clock-compat.c + was added with forwarders to the actual implementations in libc. + These forwarders were wrapped in + + #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17) + + so that they are not present for newer architectures (such as + powerpc64le) with a 2.17 or later ABI baseline. But the forwarders + were not marked as compatibility symbols. As a result, on older + architectures, historic configure checks such as + + AC_CHECK_LIB(rt, clock_gettime) + + still cause linking against librt, even though this is completely + unnecessary. It also creates a needless porting hazard because + architectures behave differently when it comes to symbol availability. + + Reviewed-by: Carlos O'Donell + +diff --git a/rt/clock-compat.c b/rt/clock-compat.c +index f816973c05..11e71aa890 100644 +--- a/rt/clock-compat.c ++++ b/rt/clock-compat.c +@@ -30,14 +30,16 @@ + #if HAVE_IFUNC + # undef INIT_ARCH + # define INIT_ARCH() +-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) ++# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \ ++ compat_symbol (librt, name, name, GLIBC_2_2); + #else + # define COMPAT_REDIRECT(name, proto, arglist) \ + int \ + name proto \ + { \ + return __##name arglist; \ +- } ++ } \ ++ compat_symbol (librt, name, name, GLIBC_2_2); + #endif + + COMPAT_REDIRECT (clock_getres, From b45a1276588775d255ccf4967bf089f729f53ea3 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:38:26 +0100 Subject: [PATCH 022/116] merge bitcoin#28294: pre time-machine bump changes (Windows) --- contrib/guix/manifest.scm | 53 +++++++++---------- ...store.patch => gcc-remap-guix-store.patch} | 0 2 files changed, 25 insertions(+), 28 deletions(-) rename contrib/guix/patches/{gcc-10-remap-guix-store.patch => gcc-remap-guix-store.patch} (100%) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 38d1c231dc..6190b52c67 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -41,20 +41,6 @@ FILE-NAME found in ./patches relative to the current file." ((%patch-path (list (string-append (dirname (current-filename)) "/patches")))) (list (search-patch file-name) ...))) -(define (make-ssp-fixed-gcc xgcc) - "Given a XGCC package, return a modified package that uses the SSP function -from glibc instead of from libssp.so. Our `symbol-check' script will complain if -we link against libssp.so, and thus will ensure that this works properly. - -Taken from: -http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html" - (package - (inherit xgcc) - (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:make-flags flags) - `(cons "gcc_cv_libc_provides_ssp=yes" ,flags)))))) - (define (make-gcc-rpath-link xgcc) "Given a XGCC package, return a modified package that replace each instance of -rpath in the default system spec that's inserted by Guix with -rpath-link" @@ -72,9 +58,10 @@ http://www.linuxfromscratch.org/hlfs/view/development/chapter05/gcc-pass1.html" (("-rpath=") "-rpath-link=")) #t)))))))) -(define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) +(define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) (define (explicit-cross-configure package) + (define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) (package-with-extra-configure-variable package "--build" building-on)) (define (make-cross-toolchain target @@ -154,26 +141,20 @@ desirable for building Dash Core release binaries." base-libc base-gcc)) -(define (make-gcc-with-pthreads gcc) - (package-with-extra-configure-variable - (package-with-extra-patches gcc - (search-our-patches "gcc-10-remap-guix-store.patch")) - "--enable-threads" "posix")) - -(define (make-mingw-w64-cross-gcc cross-gcc) - (package-with-extra-patches cross-gcc - (search-our-patches "vmov-alignment.patch" +(define (gcc-mingw-patches gcc) + (package-with-extra-patches gcc + (search-our-patches "gcc-remap-guix-store.patch" + "vmov-alignment.patch" "gcc-broken-longjmp.patch"))) (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" (let* ((xbinutils (cross-binutils target)) (pthreads-xlibc mingw-w64-x86_64-winpthreads) - (pthreads-xgcc (make-gcc-with-pthreads - (cross-gcc target - #:xgcc (make-ssp-fixed-gcc (make-mingw-w64-cross-gcc base-gcc)) + (pthreads-xgcc (cross-gcc target + #:xgcc (gcc-mingw-patches mingw-w64-base-gcc) #:xbinutils xbinutils - #:libc pthreads-xlibc)))) + #:libc pthreads-xlibc))) ;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and ;; XGCC (package @@ -547,6 +528,22 @@ inspecting signatures in Mach-O binaries.") "--enable-stack-protector" "strong") "--enable-bind-now" "yes")) +(define-public mingw-w64-base-gcc + (package + (inherit base-gcc) + (arguments + (substitute-keyword-arguments (package-arguments base-gcc) + ((#:configure-flags flags) + `(append ,flags + ;; https://gcc.gnu.org/install/configure.html + (list "--enable-threads=posix", + building-on))) + ((#:make-flags flags) + ;; Uses the SSP functions from glibc instead of from libssp.so. + ;; Our 'symbol-check' script will complain if we link against libssp.so, + ;; and thus will ensure that this works properly. + `(cons "gcc_cv_libc_provides_ssp=yes" ,flags)))))) + (define-public glibc-2.28 (package (inherit glibc-2.31) diff --git a/contrib/guix/patches/gcc-10-remap-guix-store.patch b/contrib/guix/patches/gcc-remap-guix-store.patch similarity index 100% rename from contrib/guix/patches/gcc-10-remap-guix-store.patch rename to contrib/guix/patches/gcc-remap-guix-store.patch From ef9c4bdc60bc1ff0ccc53efcd426be8a9c7f0697 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:08:11 +0100 Subject: [PATCH 023/116] merge bitcoin#28324: pre time-machine bump changes (Linux) --- contrib/guix/manifest.scm | 118 ++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 6190b52c67..242a330c53 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -41,29 +41,8 @@ FILE-NAME found in ./patches relative to the current file." ((%patch-path (list (string-append (dirname (current-filename)) "/patches")))) (list (search-patch file-name) ...))) -(define (make-gcc-rpath-link xgcc) - "Given a XGCC package, return a modified package that replace each instance of --rpath in the default system spec that's inserted by Guix with -rpath-link" - (package - (inherit xgcc) - (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'pre-configure 'replace-rpath-with-rpath-link - (lambda _ - (substitute* (cons "gcc/config/rs6000/sysv4.h" - (find-files "gcc/config" - "^gnu-user.*\\.h$")) - (("-rpath=") "-rpath-link=")) - #t)))))))) - (define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) -(define (explicit-cross-configure package) - (define building-on (string-append (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu")) - (package-with-extra-configure-variable package "--build" building-on)) - (define (make-cross-toolchain target base-gcc-for-libc base-kernel-headers @@ -73,9 +52,9 @@ FILE-NAME found in ./patches relative to the current file." (let* ((xbinutils (cross-binutils target)) ;; 1. Build a cross-compiling gcc without targeting any libc, derived ;; from BASE-GCC-FOR-LIBC - (xgcc-sans-libc (explicit-cross-configure (cross-gcc target - #:xgcc base-gcc-for-libc - #:xbinutils xbinutils))) + (xgcc-sans-libc (cross-gcc target + #:xgcc base-gcc-for-libc + #:xbinutils xbinutils)) ;; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived ;; from BASE-KERNEL-HEADERS (xkernel (cross-kernel-headers target @@ -84,17 +63,17 @@ FILE-NAME found in ./patches relative to the current file." xbinutils)) ;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL, ;; derived from BASE-LIBC - (xlibc (explicit-cross-configure (cross-libc target - base-libc - xgcc-sans-libc - xbinutils - xkernel))) + (xlibc (cross-libc target + base-libc + xgcc-sans-libc + xbinutils + xkernel)) ;; 4. Build a cross-compiling gcc targeting XLIBC, derived from ;; BASE-GCC - (xgcc (explicit-cross-configure (cross-gcc target - #:xgcc base-gcc - #:xbinutils xbinutils - #:libc xlibc)))) + (xgcc (cross-gcc target + #:xgcc base-gcc + #:xbinutils xbinutils + #:libc xlibc))) ;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and ;; XGCC (package @@ -118,21 +97,12 @@ chain for " target " development.")) (define base-gcc gcc-10) (define base-linux-kernel-headers linux-libre-headers-5.15) -;; https://gcc.gnu.org/install/configure.html -(define (hardened-gcc gcc) - (package-with-extra-configure-variable ( - package-with-extra-configure-variable ( - package-with-extra-configure-variable gcc - "--enable-initfini-array" "yes") - "--enable-default-ssp" "yes") - "--enable-default-pie" "yes")) - (define* (make-bitcoin-cross-toolchain target #:key - (base-gcc-for-libc base-gcc) + (base-gcc-for-libc linux-base-gcc) (base-kernel-headers base-linux-kernel-headers) - (base-libc (hardened-glibc glibc-2.28)) - (base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc)))) + (base-libc glibc-2.28) + (base-gcc linux-base-gcc)) "Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values desirable for building Dash Core release binaries." (make-cross-toolchain target @@ -517,17 +487,6 @@ and endian independent.") inspecting signatures in Mach-O binaries.") (license license:expat)))) -;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html -;; We don't use --disable-werror directly, as that would be passed through to bash, -;; and cause it's build to fail. -(define (hardened-glibc glibc) - (package-with-extra-configure-variable ( - package-with-extra-configure-variable ( - package-with-extra-configure-variable glibc - "enable_werror" "no") - "--enable-stack-protector" "strong") - "--enable-bind-now" "yes")) - (define-public mingw-w64-base-gcc (package (inherit base-gcc) @@ -544,6 +503,30 @@ inspecting signatures in Mach-O binaries.") ;; and thus will ensure that this works properly. `(cons "gcc_cv_libc_provides_ssp=yes" ,flags)))))) +(define-public linux-base-gcc + (package + (inherit base-gcc) + (arguments + (substitute-keyword-arguments (package-arguments base-gcc) + ((#:configure-flags flags) + `(append ,flags + ;; https://gcc.gnu.org/install/configure.html + (list "--enable-initfini-array=yes", + "--enable-default-ssp=yes", + "--enable-default-pie=yes", + building-on))) + ((#:phases phases) + `(modify-phases ,phases + ;; Given a XGCC package, return a modified package that replace each instance of + ;; -rpath in the default system spec that's inserted by Guix with -rpath-link + (add-after 'pre-configure 'replace-rpath-with-rpath-link + (lambda _ + (substitute* (cons "gcc/config/rs6000/sysv4.h" + (find-files "gcc/config" + "^gnu-user.*\\.h$")) + (("-rpath=") "-rpath-link=")) + #t)))))))) + (define-public glibc-2.28 (package (inherit glibc-2.31) @@ -559,7 +542,28 @@ inspecting signatures in Mach-O binaries.") "0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6")) (patches (search-our-patches "glibc-2.27-fcommon.patch" "glibc-2.27-guix-prefix.patch" - "glibc-2.27-no-librt.patch")))))) + "glibc-2.27-no-librt.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments glibc) + ((#:configure-flags flags) + `(append ,flags + ;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html + (list "--enable-stack-protector=all", + "--enable-bind-now", + "--disable-werror", + building-on))) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'configure 'set-etc-rpc-installation-directory + (lambda* (#:key outputs #:allow-other-keys) + ;; Install the rpc data base file under `$out/etc/rpc'. + ;; Otherwise build will fail with "Permission denied." + (let ((out (assoc-ref outputs "out"))) + (substitute* "sunrpc/Makefile" + (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) + (string-append out "/etc/rpc" suffix "\n")) + (("^install-others =.*$") + (string-append "install-others = " out "/etc/rpc\n")))))))))))) (packages->manifest (append From 0ac25311d56fea07ab71c2fc27c8cb5da35076e4 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:23:25 +0000 Subject: [PATCH 024/116] merge bitcoin#28328: update time-machine --- contrib/guix/libexec/build.sh | 3 +- contrib/guix/libexec/prelude.bash | 2 +- contrib/guix/manifest.scm | 31 ++- contrib/guix/patches/gcc-broken-longjmp.patch | 70 ----- .../patches/glibc-2.27-powerpc-ldbrx.patch | 245 ++++++++++++++++++ .../nsis-disable-installer-reloc.patch | 30 --- 6 files changed, 263 insertions(+), 118 deletions(-) delete mode 100644 contrib/guix/patches/gcc-broken-longjmp.patch create mode 100644 contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch delete mode 100644 contrib/guix/patches/nsis-disable-installer-reloc.patch diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index be2dbe40b4..c357a9da49 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -54,7 +54,8 @@ BASEPREFIX="${PWD}/depends" store_path() { grep --extended-regexp "/[^-]{32}-${1}-[^-]+${2:+-${2}}" "${GUIX_ENVIRONMENT}/manifest" \ | head --lines=1 \ - | sed --expression='s|^[[:space:]]*"||' \ + | sed --expression='s|\x29*$||' \ + --expression='s|^[[:space:]]*"||' \ --expression='s|"[[:space:]]*$||' } diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index f9b541b510..a31db6c04d 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=998eda3067c7d21e0d9bb3310d2f5a14b8f1c681 \ + --commit=160f78a4d92205df986ed9efcce7d3aac188cb24 \ --cores="$JOBS" \ --keep-failed \ --fallback \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 242a330c53..001b8d1a43 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -58,16 +58,16 @@ FILE-NAME found in ./patches relative to the current file." ;; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived ;; from BASE-KERNEL-HEADERS (xkernel (cross-kernel-headers target - base-kernel-headers - xgcc-sans-libc - xbinutils)) + #:linux-headers base-kernel-headers + #:xgcc xgcc-sans-libc + #:xbinutils xbinutils)) ;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL, ;; derived from BASE-LIBC (xlibc (cross-libc target - base-libc - xgcc-sans-libc - xbinutils - xkernel)) + #:libc base-libc + #:xgcc xgcc-sans-libc + #:xbinutils xbinutils + #:xheaders xkernel)) ;; 4. Build a cross-compiling gcc targeting XLIBC, derived from ;; BASE-GCC (xgcc (cross-gcc target @@ -114,8 +114,7 @@ desirable for building Dash Core release binaries." (define (gcc-mingw-patches gcc) (package-with-extra-patches gcc (search-our-patches "gcc-remap-guix-store.patch" - "vmov-alignment.patch" - "gcc-broken-longjmp.patch"))) + "vmov-alignment.patch"))) (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" @@ -146,8 +145,7 @@ chain for " target " development.")) (define (make-nsis-for-gcc-10 base-nsis) (package-with-extra-patches base-nsis - (search-our-patches "nsis-gcc-10-memmove.patch" - "nsis-disable-installer-reloc.patch"))) + (search-our-patches "nsis-gcc-10-memmove.patch"))) ;; While LIEF is packaged in Guix, we maintain our own package, ;; to simplify building, and more easily apply updates. @@ -247,7 +245,7 @@ thus should be able to compile on most platforms where these exist.") (define-public python-oscrypto (package (name "python-oscrypto") - (version "1.2.1") + (version "1.3.0") (source (origin (method git-fetch) @@ -257,7 +255,7 @@ thus should be able to compile on most platforms where these exist.") (file-name (git-file-name name version)) (sha256 (base32 - "1d4d8s4z340qhvb3g5m5v3436y3a71yc26wk4749q64m09kxqc3l")) + "1v5wkmzcyiqy39db8j2dvkdrv2nlsc48556h73x4dzjwd6kg4q0a")) (patches (search-our-patches "oscrypto-hard-code-openssl.patch")))) (build-system python-build-system) (native-search-paths @@ -542,7 +540,8 @@ inspecting signatures in Mach-O binaries.") "0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6")) (patches (search-our-patches "glibc-2.27-fcommon.patch" "glibc-2.27-guix-prefix.patch" - "glibc-2.27-no-librt.patch")))) + "glibc-2.27-no-librt.patch" + "glibc-2.27-powerpc-ldbrx.patch")))) (arguments (substitute-keyword-arguments (package-arguments glibc) ((#:configure-flags flags) @@ -590,7 +589,7 @@ inspecting signatures in Mach-O binaries.") ;; Build tools cmake-minimal gnu-make - libtool-2.4.7 + libtool autoconf-2.71 automake pkg-config @@ -599,7 +598,7 @@ inspecting signatures in Mach-O binaries.") gcc-toolchain-10 (list gcc-toolchain-10 "static") ;; Scripting - python-minimal ;; (3.9) + python-minimal ;; (3.10) ;; Git git-minimal ;; Tests diff --git a/contrib/guix/patches/gcc-broken-longjmp.patch b/contrib/guix/patches/gcc-broken-longjmp.patch deleted file mode 100644 index 56568813c0..0000000000 --- a/contrib/guix/patches/gcc-broken-longjmp.patch +++ /dev/null @@ -1,70 +0,0 @@ -commit eb5698897c52702498938592d7f76e67d126451f -Author: Eric Botcazou -Date: Wed May 5 22:48:51 2021 +0200 - - Fix PR target/100402 - - This is a regression for 64-bit Windows present from mainline down to the 9 - branch and introduced by the fix for PR target/99234. Again SEH, but with - a twist related to the way MinGW implements setjmp/longjmp, which turns out - to be piggybacked on SEH with recent versions of MinGW, i.e. the longjmp - performs a bona-fide unwinding of the stack, because it calls RtlUnwindEx - with the second argument initially passed to setjmp, which is the result of - __builtin_frame_address (0) in the MinGW header file: - - define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0)) - - This means that we directly expose the frame pointer to the SEH machinery - here (unlike with regular exception handling where we use an intermediate - CFA) and thus that we cannot do whatever we want with it. The old code - would leave it unaligned, i.e. not multiple of 16, whereas the new code - aligns it, but this breaks for some reason; at least it appears that a - .seh_setframe directive with 0 as second argument always works, so the - fix aligns it this way. - - gcc/ - PR target/100402 - * config/i386/i386.c (ix86_compute_frame_layout): For a SEH target, - always return the establisher frame for __builtin_frame_address (0). - gcc/testsuite/ - * gcc.c-torture/execute/20210505-1.c: New test. - - This patch can be dropped when we are building with GCC 10.4.0 or later. - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 2f838840e96..06ad1b2274e 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -6356,12 +6356,29 @@ ix86_compute_frame_layout (void) - area, see the SEH code in config/i386/winnt.c for the rationale. */ - frame->hard_frame_pointer_offset = frame->sse_reg_save_offset; - -- /* If we can leave the frame pointer where it is, do so. Also, return -+ /* If we can leave the frame pointer where it is, do so; however return - the establisher frame for __builtin_frame_address (0) or else if the -- frame overflows the SEH maximum frame size. */ -+ frame overflows the SEH maximum frame size. -+ -+ Note that the value returned by __builtin_frame_address (0) is quite -+ constrained, because setjmp is piggybacked on the SEH machinery with -+ recent versions of MinGW: -+ -+ # elif defined(__SEH__) -+ # if defined(__aarch64__) || defined(_ARM64_) -+ # define setjmp(BUF) _setjmp((BUF), __builtin_sponentry()) -+ # elif (__MINGW_GCC_VERSION < 40702) -+ # define setjmp(BUF) _setjmp((BUF), mingw_getsp()) -+ # else -+ # define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0)) -+ # endif -+ -+ and the second argument passed to _setjmp, if not null, is forwarded -+ to the TargetFrame parameter of RtlUnwindEx by longjmp (after it has -+ built an ExceptionRecord on the fly describing the setjmp buffer). */ - const HOST_WIDE_INT diff - = frame->stack_pointer_offset - frame->hard_frame_pointer_offset; -- if (diff <= 255) -+ if (diff <= 255 && !crtl->accesses_prior_frames) - { - /* The resulting diff will be a multiple of 16 lower than 255, - i.e. at most 240 as required by the unwind data structure. */ diff --git a/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch b/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch new file mode 100644 index 0000000000..26716054c8 --- /dev/null +++ b/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch @@ -0,0 +1,245 @@ +From 50b0b3c9ff71ffd7ebbd74ae46844c3566478123 Mon Sep 17 00:00:00 2001 +From: "Gabriel F. T. Gomes" +Date: Mon, 27 May 2019 15:21:22 -0300 +Subject: [PATCH] powerpc: Fix build failures with current GCC + +Since GCC commit 271500 (svn), also known as the following commit on the +git mirror: + +commit e154242724b084380e3221df7c08fcdbd8460674 +Author: amodra +Date: Wed May 22 04:34:26 2019 +0000 + + [RS6000] Don't pass -many to the assembler + +glibc builds are failing when an assembly implementation does not +declare the correct '.machine' directive, or when no such directive is +declared at all. For example, when a POWER6 instruction is used, but +'.machine power6' is not declared, the assembler will fail with an error +similar to the following: + + ../sysdeps/powerpc/powerpc64/power8/strcmp.S: Assembler messages: + 24 ../sysdeps/powerpc/powerpc64/power8/strcmp.S:55: Error: unrecognized opcode: `cmpb' + +This patch adds '.machine powerN' directives where none existed, as well +as it updates '.machine power7' directives on POWER8 files, because the +minimum binutils version required to build glibc (binutils 2.25) now +provides this machine version. It also adds '-many' to the assembler +command used to build tst-set_ppr.c. + +Tested for powerpc, powerpc64, and powerpc64le, as well as with +build-many-glibcs.py for powerpc targets. + +Reviewed-by: Tulio Magno Quites Machado Filho +--- + sysdeps/powerpc/Makefile | 5 +++ + sysdeps/powerpc/powerpc64/power4/memcmp.S | 7 ++++ + sysdeps/powerpc/powerpc64/power7/strncmp.S | 1 + + .../powerpc/powerpc64/power8/fpu/s_llround.S | 1 + + sysdeps/powerpc/powerpc64/power8/strcasecmp.S | 36 ++++++------------- + sysdeps/powerpc/powerpc64/power8/strcasestr.S | 14 ++------ + sysdeps/powerpc/powerpc64/power8/strcmp.S | 1 + + 7 files changed, 28 insertions(+), 37 deletions(-) + +diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile +index 6aa683b03f..23126147df 100644 +--- a/sysdeps/powerpc/Makefile ++++ b/sysdeps/powerpc/Makefile +@@ -45,6 +45,11 @@ ifeq ($(subdir),misc) + sysdep_headers += sys/platform/ppc.h + tests += test-gettimebase + tests += tst-set_ppr ++ ++# This test is expected to run and exit with EXIT_UNSUPPORTED on ++# processors that do not implement the Power ISA 2.06 or greater. ++# But the test makes use of instructions from Power ISA 2.06 and 2.07. ++CFLAGS-tst-set_ppr.c += -Wa,-many + endif + + ifneq (,$(filter %le,$(config-machine))) +diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S +index e5319f101f..38dcf4c9a1 100644 +--- a/sysdeps/powerpc/powerpc64/power4/memcmp.S ++++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S +@@ -26,7 +26,14 @@ + # define MEMCMP memcmp + #endif + ++#ifndef __LITTLE_ENDIAN__ + .machine power4 ++#else ++/* Little endian is only available since POWER8, so it's safe to ++ specify .machine as power8 (or older), even though this is a POWER4 ++ file. Since the little-endian code uses 'ldbrx', power7 is enough. */ ++ .machine power7 ++#endif + ENTRY_TOCLESS (MEMCMP, 4) + CALL_MCOUNT 3 + +diff --git a/sysdeps/powerpc/powerpc64/power7/strncmp.S b/sysdeps/powerpc/powerpc64/power7/strncmp.S +index 0c7429d19f..10f898c5a3 100644 +--- a/sysdeps/powerpc/powerpc64/power7/strncmp.S ++++ b/sysdeps/powerpc/powerpc64/power7/strncmp.S +@@ -28,6 +28,7 @@ + const char *s2 [r4], + size_t size [r5]) */ + ++ .machine power7 + ENTRY_TOCLESS (STRNCMP, 5) + CALL_MCOUNT 3 + +diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S +index a22fc63bb3..84c76ba0f9 100644 +--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S ++++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S +@@ -26,6 +26,7 @@ + + /* long long [r3] llround (float x [fp1]) */ + ++ .machine power8 + ENTRY_TOCLESS (__llround) + CALL_MCOUNT 0 + frin fp1,fp1 /* Round to nearest +-0.5. */ +diff --git a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S +index 3a2efe2a64..eeacd40c7f 100644 +--- a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S ++++ b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S +@@ -91,21 +91,7 @@ + 3: \ + TOLOWER() + +-#ifdef _ARCH_PWR8 +-# define VCLZD_V8_v7 vclzd v8, v7; +-# define MFVRD_R3_V1 mfvrd r3, v1; +-# define VSUBUDM_V9_V8 vsubudm v9, v9, v8; +-# define VPOPCNTD_V8_V8 vpopcntd v8, v8; +-# define VADDUQM_V7_V8 vadduqm v9, v7, v8; +-#else +-# define VCLZD_V8_v7 .long 0x11003fc2 +-# define MFVRD_R3_V1 .long 0x7c230067 +-# define VSUBUDM_V9_V8 .long 0x112944c0 +-# define VPOPCNTD_V8_V8 .long 0x110047c3 +-# define VADDUQM_V7_V8 .long 0x11274100 +-#endif +- +- .machine power7 ++ .machine power8 + + ENTRY (__STRCASECMP) + #ifdef USE_AS_STRNCASECMP +@@ -265,15 +251,15 @@ L(different): + #ifdef __LITTLE_ENDIAN__ + /* Count trailing zero. */ + vspltisb v8, -1 +- VADDUQM_V7_V8 ++ vadduqm v9, v7, v8 + vandc v8, v9, v7 +- VPOPCNTD_V8_V8 ++ vpopcntd v8, v8 + vspltb v6, v8, 15 + vcmpequb. v6, v6, v1 + blt cr6, L(shift8) + #else + /* Count leading zero. */ +- VCLZD_V8_v7 ++ vclzd v8, v7 + vspltb v6, v8, 7 + vcmpequb. v6, v6, v1 + blt cr6, L(shift8) +@@ -291,7 +277,7 @@ L(skipsum): + /* Merge and move to GPR. */ + vmrglb v6, v6, v7 + vslo v1, v6, v1 +- MFVRD_R3_V1 ++ mfvrd r3, v1 + /* Place the characters that are different in first position. */ + sldi rSTR2, rRTN, 56 + srdi rSTR2, rSTR2, 56 +@@ -301,7 +287,7 @@ L(skipsum): + vslo v6, v5, v8 + vslo v7, v4, v8 + vmrghb v1, v6, v7 +- MFVRD_R3_V1 ++ mfvrd r3, v1 + srdi rSTR2, rRTN, 48 + sldi rSTR2, rSTR2, 56 + srdi rSTR2, rSTR2, 56 +@@ -320,15 +306,15 @@ L(null_found): + #ifdef __LITTLE_ENDIAN__ + /* Count trailing zero. */ + vspltisb v8, -1 +- VADDUQM_V7_V8 ++ vadduqm v9, v7, v8 + vandc v8, v9, v7 +- VPOPCNTD_V8_V8 ++ vpopcntd v8, v8 + vspltb v6, v8, 15 + vcmpequb. v6, v6, v10 + blt cr6, L(shift_8) + #else + /* Count leading zero. */ +- VCLZD_V8_v7 ++ vclzd v8, v7 + vspltb v6, v8, 7 + vcmpequb. v6, v6, v10 + blt cr6, L(shift_8) +@@ -343,10 +329,10 @@ L(skipsum1): + vspltisb v10, 7 + vslb v10, v10, v10 + vsldoi v9, v0, v10, 1 +- VSUBUDM_V9_V8 ++ vsubudm v9, v9, v8 + vspltisb v8, 8 + vsldoi v8, v0, v8, 1 +- VSUBUDM_V9_V8 ++ vsubudm v9, v9, v8 + /* Shift and remove junk after null character. */ + #ifdef __LITTLE_ENDIAN__ + vslo v5, v5, v9 +diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S +index 9fc24c29f9..e10f06fd86 100644 +--- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S ++++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S +@@ -73,18 +73,8 @@ + vor reg, v8, reg; \ + vcmpequb. v6, reg, v4; + +-/* TODO: change these to the actual instructions when the minimum required +- binutils allows it. */ +-#ifdef _ARCH_PWR8 +-#define VCLZD_V8_v7 vclzd v8, v7; +-#else +-#define VCLZD_V8_v7 .long 0x11003fc2 +-#endif +- + #define FRAMESIZE (FRAME_MIN_SIZE+48) +-/* TODO: change this to .machine power8 when the minimum required binutils +- allows it. */ +- .machine power7 ++ .machine power8 + ENTRY (STRCASESTR, 4) + CALL_MCOUNT 2 + mflr r0 /* Load link register LR to r0. */ +@@ -291,7 +281,7 @@ L(nullchk1): + vcmpequb. v6, v0, v7 + /* Shift r3 by 16 bytes and proceed. */ + blt cr6, L(shift16) +- VCLZD_V8_v7 ++ vclzd v8, v7 + #ifdef __LITTLE_ENDIAN__ + vspltb v6, v8, 15 + #else +diff --git a/sysdeps/powerpc/powerpc64/power8/strcmp.S b/sysdeps/powerpc/powerpc64/power8/strcmp.S +index 15e7351d1b..d592266d1d 100644 +--- a/sysdeps/powerpc/powerpc64/power8/strcmp.S ++++ b/sysdeps/powerpc/powerpc64/power8/strcmp.S +@@ -31,6 +31,7 @@ + 64K as default, the page cross handling assumes minimum page size of + 4k. */ + ++ .machine power8 + ENTRY_TOCLESS (STRCMP, 4) + li r0,0 + +-- +2.41.0 diff --git a/contrib/guix/patches/nsis-disable-installer-reloc.patch b/contrib/guix/patches/nsis-disable-installer-reloc.patch deleted file mode 100644 index 4914527e56..0000000000 --- a/contrib/guix/patches/nsis-disable-installer-reloc.patch +++ /dev/null @@ -1,30 +0,0 @@ -Patch NSIS so that it's installer stubs, produced at NSIS build time, -do not contain .reloc sections, which will exist by default when using -binutils/ld 2.36+. - -This ultimately fixes an issue when running the installer with the -"Force randomization for images (Mandatory ASLR)" setting active. - -This patch has not yet been sent upstream, because it's not clear if this -is the best fix, for the underlying issue, which seems to be that makensis -doesn't account for .reloc sections when it builds installers. - -The existence of a reloc section shouldn't be a problem, and, if anything, -is actually a requirement for working ASLR. All other Windows binaries we -produce contain them, and function correctly when under the same -"Force randomization for images (Mandatory ASLR)" setting. - -See: -https://github.com/bitcoin/bitcoin/issues/25726 -https://sourceforge.net/p/nsis/bugs/1131/ - ---- a/SCons/Config/gnu -+++ b/SCons/Config/gnu -@@ -102,6 +102,7 @@ stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables - stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries - stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align - stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file -+stub_env.Append(LINKFLAGS = ['-Wl,--disable-reloc-section']) - - conf = FlagsConfigure(stub_env) - conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248) From 09498259d3fa1f4ea2267a0ed58aad0e5b1c008a Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:27:24 +0000 Subject: [PATCH 025/116] revert: add exception for 32-bit ARM builds which need glibc 2.28 reverts: - 853583019b3960f04bf4d0c0a8d56462ec847f0b We're going to be updating to glibc 2.31 in the next commit --- contrib/devtools/test-symbol-check.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/contrib/devtools/test-symbol-check.py b/contrib/devtools/test-symbol-check.py index a5f23e7754..6d5f693090 100755 --- a/contrib/devtools/test-symbol-check.py +++ b/contrib/devtools/test-symbol-check.py @@ -38,11 +38,6 @@ def test_ELF(self): executable = 'test1' cc = determine_wellknown_cmd('CC', 'gcc') - # there's no way to do this test for ARM at the moment; we build for - # ARM in a glibc 2.31 envinonment and we allow all symbols from 2.28. - if 'arm' in get_machine(cc): - self.skipTest("test not available for 32-bit ARM") - # -lutil is part of the libc6 package so a safe bet that it's installed # it's also out of context enough that it's unlikely to ever become a real dependency source = 'test2.c' From 1edd1215ef3e5f13decc6ff9c43753872c95faf2 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 20:44:22 +0000 Subject: [PATCH 026/116] merge bitcoin#29987: build with glibc 2.31 --- contrib/devtools/symbol-check.py | 14 +- contrib/devtools/test-security-check.py | 34 +-- contrib/guix/manifest.scm | 23 +- contrib/guix/patches/glibc-2.27-fcommon.patch | 34 --- .../guix/patches/glibc-2.27-no-librt.patch | 53 ---- .../patches/glibc-2.27-powerpc-ldbrx.patch | 245 ------------------ ...x-prefix.patch => glibc-guix-prefix.patch} | 8 +- doc/dependencies.md | 2 +- doc/release-notes-6383.md | 5 + 9 files changed, 42 insertions(+), 376 deletions(-) delete mode 100644 contrib/guix/patches/glibc-2.27-fcommon.patch delete mode 100644 contrib/guix/patches/glibc-2.27-no-librt.patch delete mode 100644 contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch rename contrib/guix/patches/{glibc-2.27-guix-prefix.patch => glibc-guix-prefix.patch} (78%) create mode 100644 doc/release-notes-6383.md diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index 7cc377b982..33f481f77b 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -15,20 +15,20 @@ import lief -# Debian 11 (Bullseye) EOL: est. 2026 https://wiki.debian.org/LTS +# Debian 11 (Bullseye) EOL: 2026. https://wiki.debian.org/LTS # -# - libgcc version 10.2.1 (https://packages.debian.org/search?suite=bullseye&arch=any&searchon=names&keywords=libgcc-s1) -# - libc version 2.31 (https://packages.debian.org/search?suite=bullseye&arch=any&searchon=names&keywords=libc6) +# - libgcc version 10.2.1 (https://packages.debian.org/bullseye/libgcc-s1) +# - libc version 2.31 (https://packages.debian.org/source/bullseye/glibc) # # Ubuntu 20.04 (Focal) EOL: 2030. https://wiki.ubuntu.com/ReleaseTeam # -# - libgcc version 10.3.0 (https://packages.ubuntu.com/focal/libgcc1) +# - libgcc version 10.5.0 (https://packages.ubuntu.com/focal/libgcc1) # - libc version 2.31 (https://packages.ubuntu.com/focal/libc6) # -# CentOS Stream 9 EOL: est. 2027 https://www.centos.org/cl-vs-cs +# CentOS Stream 9 EOL: 2027. https://www.centos.org/cl-vs-cs/#end-of-life # -# - libgcc version 12.2.1 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages) -# - libc version 2.34 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages) +# - libgcc version 12.2.1 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/) +# - libc version 2.34 (https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/) # # See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for more info. diff --git a/contrib/devtools/test-security-check.py b/contrib/devtools/test-security-check.py index 9f45365c3b..7bfe08e391 100755 --- a/contrib/devtools/test-security-check.py +++ b/contrib/devtools/test-security-check.py @@ -58,32 +58,32 @@ def test_ELF(self): arch = get_arch(cc, source, executable) if arch == lief.ARCHITECTURES.X86: - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), - (1, executable+': failed PIE NX RELRO Canary CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), - (1, executable+': failed PIE RELRO Canary CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + (1, executable+': failed PIE NX RELRO CONTROL_FLOW')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), (1, executable+': failed PIE RELRO CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-pie','-fPIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + (1, executable+': failed PIE RELRO CONTROL_FLOW')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-pie','-fPIE', '-Wl,-z,separate-code']), (1, executable+': failed RELRO CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,noseparate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,noseparate-code']), (1, executable+': failed separate_code CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code']), (1, executable+': failed CONTROL_FLOW')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code', '-fcf-protection=full']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code', '-fcf-protection=full']), (0, '')) else: - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), - (1, executable+': failed PIE NX RELRO Canary')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fno-stack-protector','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), - (1, executable+': failed PIE RELRO Canary')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-zexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + (1, executable+': failed PIE NX RELRO')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), + (1, executable+': failed PIE RELRO')) + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-no-pie','-fno-PIE', '-Wl,-z,separate-code']), (1, executable+': failed PIE RELRO')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-znorelro','-pie','-fPIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-znorelro','-pie','-fPIE', '-Wl,-z,separate-code']), (1, executable+': failed RELRO')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,noseparate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,noseparate-code']), (1, executable+': failed separate_code')) - self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-fstack-protector-all','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code']), + self.assertEqual(call_security_check(cc, source, executable, ['-Wl,-znoexecstack','-Wl,-zrelro','-Wl,-z,now','-pie','-fPIE', '-Wl,-z,separate-code']), (0, '')) clean_files(source, executable) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 001b8d1a43..e50574015f 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -101,7 +101,7 @@ chain for " target " development.")) #:key (base-gcc-for-libc linux-base-gcc) (base-kernel-headers base-linux-kernel-headers) - (base-libc glibc-2.28) + (base-libc glibc-2.31) (base-gcc linux-base-gcc)) "Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values desirable for building Dash Core release binaries." @@ -525,23 +525,21 @@ inspecting signatures in Mach-O binaries.") (("-rpath=") "-rpath-link=")) #t)))))))) -(define-public glibc-2.28 +(define-public glibc-2.31 + (let ((commit "8e30f03744837a85e33d84ccd34ed3abe30d37c3")) (package - (inherit glibc-2.31) - (version "2.28") + (inherit glibc) ;; 2.35 + (version "2.31") (source (origin (method git-fetch) (uri (git-reference (url "https://sourceware.org/git/glibc.git") - (commit "c9e58ae23402eb82877de90fd8a18519c086ed87"))) - (file-name (git-file-name "glibc" "c9e58ae23402eb82877de90fd8a18519c086ed87")) + (commit commit))) + (file-name (git-file-name "glibc" commit)) (sha256 (base32 - "0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6")) - (patches (search-our-patches "glibc-2.27-fcommon.patch" - "glibc-2.27-guix-prefix.patch" - "glibc-2.27-no-librt.patch" - "glibc-2.27-powerpc-ldbrx.patch")))) + "1zi0s9yy5zkisw823vivn7zlj8w6g9p3mm7lmlqiixcxdkz4dbn6")) + (patches (search-our-patches "glibc-guix-prefix.patch")))) (arguments (substitute-keyword-arguments (package-arguments glibc) ((#:configure-flags flags) @@ -557,12 +555,13 @@ inspecting signatures in Mach-O binaries.") (lambda* (#:key outputs #:allow-other-keys) ;; Install the rpc data base file under `$out/etc/rpc'. ;; Otherwise build will fail with "Permission denied." + ;; Can be removed when we are building 2.32 or later. (let ((out (assoc-ref outputs "out"))) (substitute* "sunrpc/Makefile" (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) (string-append out "/etc/rpc" suffix "\n")) (("^install-others =.*$") - (string-append "install-others = " out "/etc/rpc\n")))))))))))) + (string-append "install-others = " out "/etc/rpc\n"))))))))))))) (packages->manifest (append diff --git a/contrib/guix/patches/glibc-2.27-fcommon.patch b/contrib/guix/patches/glibc-2.27-fcommon.patch deleted file mode 100644 index 817aa85bb9..0000000000 --- a/contrib/guix/patches/glibc-2.27-fcommon.patch +++ /dev/null @@ -1,34 +0,0 @@ -commit 264a4a0dbe1f4369db315080034b500bed66016c -Author: fanquake -Date: Fri May 6 11:03:04 2022 +0100 - - build: use -fcommon to retain legacy behaviour with GCC 10 - - GCC 10 started using -fno-common by default, which causes issues with - the powerpc builds using gibc 2.27. A patch was commited to glibc to fix - the issue, 18363b4f010da9ba459b13310b113ac0647c2fcc but is non-trvial - to backport, and was broken in at least one way, see the followup in - commit 7650321ce037302bfc2f026aa19e0213b8d02fe6. - - For now, retain the legacy GCC behaviour by passing -fcommon when - building glibc. - - https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html. - https://sourceware.org/git/?p=glibc.git;a=commit;h=18363b4f010da9ba459b13310b113ac0647c2fcc - https://sourceware.org/git/?p=glibc.git;a=commit;h=7650321ce037302bfc2f026aa19e0213b8d02fe6 - - This patch can be dropped when we are building with glibc 2.31+. - -diff --git a/Makeconfig b/Makeconfig -index 86a71e5802..aa2166be60 100644 ---- a/Makeconfig -+++ b/Makeconfig -@@ -896,7 +896,7 @@ ifeq "$(strip $(+cflags))" "" - endif # $(+cflags) == "" - - +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \ -- $(+stack-protector) -+ $(+stack-protector) -fcommon - +gcc-nowarn := -w - - # Don't duplicate options if we inherited variables from the parent. diff --git a/contrib/guix/patches/glibc-2.27-no-librt.patch b/contrib/guix/patches/glibc-2.27-no-librt.patch deleted file mode 100644 index 4f2092ba7e..0000000000 --- a/contrib/guix/patches/glibc-2.27-no-librt.patch +++ /dev/null @@ -1,53 +0,0 @@ -This patch can be dropped when we are building with glibc 2.30+. - -commit 6e41ef56c9baab719a02f1377b1e7ce7bff61e73 -Author: Florian Weimer -Date: Fri Feb 8 10:21:56 2019 +0100 - - rt: Turn forwards from librt to libc into compat symbols [BZ #24194] - - As the result of commit 6e6249d0b461b952d0f544792372663feb6d792a - ("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17, - clock_gettime, clock_getres, clock_settime, clock_getcpuclockid, - clock_nanosleep were added to libc, and the file rt/clock-compat.c - was added with forwarders to the actual implementations in libc. - These forwarders were wrapped in - - #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17) - - so that they are not present for newer architectures (such as - powerpc64le) with a 2.17 or later ABI baseline. But the forwarders - were not marked as compatibility symbols. As a result, on older - architectures, historic configure checks such as - - AC_CHECK_LIB(rt, clock_gettime) - - still cause linking against librt, even though this is completely - unnecessary. It also creates a needless porting hazard because - architectures behave differently when it comes to symbol availability. - - Reviewed-by: Carlos O'Donell - -diff --git a/rt/clock-compat.c b/rt/clock-compat.c -index f816973c05..11e71aa890 100644 ---- a/rt/clock-compat.c -+++ b/rt/clock-compat.c -@@ -30,14 +30,16 @@ - #if HAVE_IFUNC - # undef INIT_ARCH - # define INIT_ARCH() --# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) -+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \ -+ compat_symbol (librt, name, name, GLIBC_2_2); - #else - # define COMPAT_REDIRECT(name, proto, arglist) \ - int \ - name proto \ - { \ - return __##name arglist; \ -- } -+ } \ -+ compat_symbol (librt, name, name, GLIBC_2_2); - #endif - - COMPAT_REDIRECT (clock_getres, diff --git a/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch b/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch deleted file mode 100644 index 26716054c8..0000000000 --- a/contrib/guix/patches/glibc-2.27-powerpc-ldbrx.patch +++ /dev/null @@ -1,245 +0,0 @@ -From 50b0b3c9ff71ffd7ebbd74ae46844c3566478123 Mon Sep 17 00:00:00 2001 -From: "Gabriel F. T. Gomes" -Date: Mon, 27 May 2019 15:21:22 -0300 -Subject: [PATCH] powerpc: Fix build failures with current GCC - -Since GCC commit 271500 (svn), also known as the following commit on the -git mirror: - -commit e154242724b084380e3221df7c08fcdbd8460674 -Author: amodra -Date: Wed May 22 04:34:26 2019 +0000 - - [RS6000] Don't pass -many to the assembler - -glibc builds are failing when an assembly implementation does not -declare the correct '.machine' directive, or when no such directive is -declared at all. For example, when a POWER6 instruction is used, but -'.machine power6' is not declared, the assembler will fail with an error -similar to the following: - - ../sysdeps/powerpc/powerpc64/power8/strcmp.S: Assembler messages: - 24 ../sysdeps/powerpc/powerpc64/power8/strcmp.S:55: Error: unrecognized opcode: `cmpb' - -This patch adds '.machine powerN' directives where none existed, as well -as it updates '.machine power7' directives on POWER8 files, because the -minimum binutils version required to build glibc (binutils 2.25) now -provides this machine version. It also adds '-many' to the assembler -command used to build tst-set_ppr.c. - -Tested for powerpc, powerpc64, and powerpc64le, as well as with -build-many-glibcs.py for powerpc targets. - -Reviewed-by: Tulio Magno Quites Machado Filho ---- - sysdeps/powerpc/Makefile | 5 +++ - sysdeps/powerpc/powerpc64/power4/memcmp.S | 7 ++++ - sysdeps/powerpc/powerpc64/power7/strncmp.S | 1 + - .../powerpc/powerpc64/power8/fpu/s_llround.S | 1 + - sysdeps/powerpc/powerpc64/power8/strcasecmp.S | 36 ++++++------------- - sysdeps/powerpc/powerpc64/power8/strcasestr.S | 14 ++------ - sysdeps/powerpc/powerpc64/power8/strcmp.S | 1 + - 7 files changed, 28 insertions(+), 37 deletions(-) - -diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile -index 6aa683b03f..23126147df 100644 ---- a/sysdeps/powerpc/Makefile -+++ b/sysdeps/powerpc/Makefile -@@ -45,6 +45,11 @@ ifeq ($(subdir),misc) - sysdep_headers += sys/platform/ppc.h - tests += test-gettimebase - tests += tst-set_ppr -+ -+# This test is expected to run and exit with EXIT_UNSUPPORTED on -+# processors that do not implement the Power ISA 2.06 or greater. -+# But the test makes use of instructions from Power ISA 2.06 and 2.07. -+CFLAGS-tst-set_ppr.c += -Wa,-many - endif - - ifneq (,$(filter %le,$(config-machine))) -diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S -index e5319f101f..38dcf4c9a1 100644 ---- a/sysdeps/powerpc/powerpc64/power4/memcmp.S -+++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S -@@ -26,7 +26,14 @@ - # define MEMCMP memcmp - #endif - -+#ifndef __LITTLE_ENDIAN__ - .machine power4 -+#else -+/* Little endian is only available since POWER8, so it's safe to -+ specify .machine as power8 (or older), even though this is a POWER4 -+ file. Since the little-endian code uses 'ldbrx', power7 is enough. */ -+ .machine power7 -+#endif - ENTRY_TOCLESS (MEMCMP, 4) - CALL_MCOUNT 3 - -diff --git a/sysdeps/powerpc/powerpc64/power7/strncmp.S b/sysdeps/powerpc/powerpc64/power7/strncmp.S -index 0c7429d19f..10f898c5a3 100644 ---- a/sysdeps/powerpc/powerpc64/power7/strncmp.S -+++ b/sysdeps/powerpc/powerpc64/power7/strncmp.S -@@ -28,6 +28,7 @@ - const char *s2 [r4], - size_t size [r5]) */ - -+ .machine power7 - ENTRY_TOCLESS (STRNCMP, 5) - CALL_MCOUNT 3 - -diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S -index a22fc63bb3..84c76ba0f9 100644 ---- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S -+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S -@@ -26,6 +26,7 @@ - - /* long long [r3] llround (float x [fp1]) */ - -+ .machine power8 - ENTRY_TOCLESS (__llround) - CALL_MCOUNT 0 - frin fp1,fp1 /* Round to nearest +-0.5. */ -diff --git a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S -index 3a2efe2a64..eeacd40c7f 100644 ---- a/sysdeps/powerpc/powerpc64/power8/strcasecmp.S -+++ b/sysdeps/powerpc/powerpc64/power8/strcasecmp.S -@@ -91,21 +91,7 @@ - 3: \ - TOLOWER() - --#ifdef _ARCH_PWR8 --# define VCLZD_V8_v7 vclzd v8, v7; --# define MFVRD_R3_V1 mfvrd r3, v1; --# define VSUBUDM_V9_V8 vsubudm v9, v9, v8; --# define VPOPCNTD_V8_V8 vpopcntd v8, v8; --# define VADDUQM_V7_V8 vadduqm v9, v7, v8; --#else --# define VCLZD_V8_v7 .long 0x11003fc2 --# define MFVRD_R3_V1 .long 0x7c230067 --# define VSUBUDM_V9_V8 .long 0x112944c0 --# define VPOPCNTD_V8_V8 .long 0x110047c3 --# define VADDUQM_V7_V8 .long 0x11274100 --#endif -- -- .machine power7 -+ .machine power8 - - ENTRY (__STRCASECMP) - #ifdef USE_AS_STRNCASECMP -@@ -265,15 +251,15 @@ L(different): - #ifdef __LITTLE_ENDIAN__ - /* Count trailing zero. */ - vspltisb v8, -1 -- VADDUQM_V7_V8 -+ vadduqm v9, v7, v8 - vandc v8, v9, v7 -- VPOPCNTD_V8_V8 -+ vpopcntd v8, v8 - vspltb v6, v8, 15 - vcmpequb. v6, v6, v1 - blt cr6, L(shift8) - #else - /* Count leading zero. */ -- VCLZD_V8_v7 -+ vclzd v8, v7 - vspltb v6, v8, 7 - vcmpequb. v6, v6, v1 - blt cr6, L(shift8) -@@ -291,7 +277,7 @@ L(skipsum): - /* Merge and move to GPR. */ - vmrglb v6, v6, v7 - vslo v1, v6, v1 -- MFVRD_R3_V1 -+ mfvrd r3, v1 - /* Place the characters that are different in first position. */ - sldi rSTR2, rRTN, 56 - srdi rSTR2, rSTR2, 56 -@@ -301,7 +287,7 @@ L(skipsum): - vslo v6, v5, v8 - vslo v7, v4, v8 - vmrghb v1, v6, v7 -- MFVRD_R3_V1 -+ mfvrd r3, v1 - srdi rSTR2, rRTN, 48 - sldi rSTR2, rSTR2, 56 - srdi rSTR2, rSTR2, 56 -@@ -320,15 +306,15 @@ L(null_found): - #ifdef __LITTLE_ENDIAN__ - /* Count trailing zero. */ - vspltisb v8, -1 -- VADDUQM_V7_V8 -+ vadduqm v9, v7, v8 - vandc v8, v9, v7 -- VPOPCNTD_V8_V8 -+ vpopcntd v8, v8 - vspltb v6, v8, 15 - vcmpequb. v6, v6, v10 - blt cr6, L(shift_8) - #else - /* Count leading zero. */ -- VCLZD_V8_v7 -+ vclzd v8, v7 - vspltb v6, v8, 7 - vcmpequb. v6, v6, v10 - blt cr6, L(shift_8) -@@ -343,10 +329,10 @@ L(skipsum1): - vspltisb v10, 7 - vslb v10, v10, v10 - vsldoi v9, v0, v10, 1 -- VSUBUDM_V9_V8 -+ vsubudm v9, v9, v8 - vspltisb v8, 8 - vsldoi v8, v0, v8, 1 -- VSUBUDM_V9_V8 -+ vsubudm v9, v9, v8 - /* Shift and remove junk after null character. */ - #ifdef __LITTLE_ENDIAN__ - vslo v5, v5, v9 -diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S -index 9fc24c29f9..e10f06fd86 100644 ---- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S -+++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S -@@ -73,18 +73,8 @@ - vor reg, v8, reg; \ - vcmpequb. v6, reg, v4; - --/* TODO: change these to the actual instructions when the minimum required -- binutils allows it. */ --#ifdef _ARCH_PWR8 --#define VCLZD_V8_v7 vclzd v8, v7; --#else --#define VCLZD_V8_v7 .long 0x11003fc2 --#endif -- - #define FRAMESIZE (FRAME_MIN_SIZE+48) --/* TODO: change this to .machine power8 when the minimum required binutils -- allows it. */ -- .machine power7 -+ .machine power8 - ENTRY (STRCASESTR, 4) - CALL_MCOUNT 2 - mflr r0 /* Load link register LR to r0. */ -@@ -291,7 +281,7 @@ L(nullchk1): - vcmpequb. v6, v0, v7 - /* Shift r3 by 16 bytes and proceed. */ - blt cr6, L(shift16) -- VCLZD_V8_v7 -+ vclzd v8, v7 - #ifdef __LITTLE_ENDIAN__ - vspltb v6, v8, 15 - #else -diff --git a/sysdeps/powerpc/powerpc64/power8/strcmp.S b/sysdeps/powerpc/powerpc64/power8/strcmp.S -index 15e7351d1b..d592266d1d 100644 ---- a/sysdeps/powerpc/powerpc64/power8/strcmp.S -+++ b/sysdeps/powerpc/powerpc64/power8/strcmp.S -@@ -31,6 +31,7 @@ - 64K as default, the page cross handling assumes minimum page size of - 4k. */ - -+ .machine power8 - ENTRY_TOCLESS (STRCMP, 4) - li r0,0 - --- -2.41.0 diff --git a/contrib/guix/patches/glibc-2.27-guix-prefix.patch b/contrib/guix/patches/glibc-guix-prefix.patch similarity index 78% rename from contrib/guix/patches/glibc-2.27-guix-prefix.patch rename to contrib/guix/patches/glibc-guix-prefix.patch index dc515907ff..60e12ca525 100644 --- a/contrib/guix/patches/glibc-2.27-guix-prefix.patch +++ b/contrib/guix/patches/glibc-guix-prefix.patch @@ -4,19 +4,13 @@ hash for the same package will differ when on different architectures. In order to be reproducible regardless of the architecture used to build the package, map all guix store prefixes to something fixed, e.g. /usr. -We might be able to drop this in favour of using --with-nonshared-cflags -when we begin using newer versions of glibc. - --- a/Makeconfig +++ b/Makeconfig -@@ -992,6 +992,10 @@ object-suffixes := +@@ -1007,6 +1007,7 @@ object-suffixes := CPPFLAGS-.o = $(pic-default) # libc.a must be compiled with -fPIE/-fpie for static PIE. CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) $(pie-default) -+ -+# Map Guix store paths to /usr +CFLAGS-.o += `find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;` -+ libtype.o := lib%.a object-suffixes += .o ifeq (yes,$(build-shared)) diff --git a/doc/dependencies.md b/doc/dependencies.md index 9d45291783..d271c4bf75 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -11,7 +11,7 @@ These are the dependencies currently used by Dash Core. You can find instruction | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | | FreeType | [2.11.0](https://download.savannah.gnu.org/releases/freetype) | | No | | [Yes](https://github.com/dashpay/dash/blob/develop/depends/packages/qt.mk) (Android only) | | GCC | | [7+](https://gcc.gnu.org/) (C++17 support) | | | | -| glibc | | [2.28](https://www.gnu.org/software/libc/) | | | | | +| glibc | | [2.31](https://www.gnu.org/software/libc/) | | | | | | HarfBuzz-NG | | | | | [Yes](https://github.com/dashpay/dash/blob/develop/depends/packages/qt.mk) | | libevent | [2.1.12-stable](https://github.com/libevent/libevent/releases) | [2.0.21](https://github.com/bitcoin/bitcoin/pull/18676) | No | | | | libnatpmp | git commit [4536032...](https://github.com/miniupnp/libnatpmp/tree/4536032ae32268a45c073a4d5e91bbab4534773a) | | No | | | diff --git a/doc/release-notes-6383.md b/doc/release-notes-6383.md new file mode 100644 index 0000000000..c6f685f2b4 --- /dev/null +++ b/doc/release-notes-6383.md @@ -0,0 +1,5 @@ +Compatibility +============= + +The minimum required glibc to run Dash Core is now 2.31. This means that RHEL 8 and Ubuntu 18.04 (Bionic) +are no-longer supported. From 38c71d88b4b0b92e9f7763bf8afa4da661094d23 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 27 Aug 2023 15:08:56 +0100 Subject: [PATCH 027/116] merge bitcoin#28370: remove GCC 10 workaround from NSIS --- contrib/guix/manifest.scm | 6 +---- .../guix/patches/nsis-gcc-10-memmove.patch | 23 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 contrib/guix/patches/nsis-gcc-10-memmove.patch diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index e50574015f..eda51765ab 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -143,10 +143,6 @@ chain for " target " development.")) (home-page (package-home-page pthreads-xgcc)) (license (package-license pthreads-xgcc))))) -(define (make-nsis-for-gcc-10 base-nsis) - (package-with-extra-patches base-nsis - (search-our-patches "nsis-gcc-10-memmove.patch"))) - ;; While LIEF is packaged in Guix, we maintain our own package, ;; to simplify building, and more easily apply updates. ;; Moreover, the Guix's package uses cmake, which caused build @@ -607,7 +603,7 @@ inspecting signatures in Mach-O binaries.") ;; Windows (list zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") - (make-nsis-for-gcc-10 nsis-x86_64) + nsis-x86_64 nss-certs osslsigncode)) ((string-contains target "-linux-") diff --git a/contrib/guix/patches/nsis-gcc-10-memmove.patch b/contrib/guix/patches/nsis-gcc-10-memmove.patch deleted file mode 100644 index a1aadfd4f3..0000000000 --- a/contrib/guix/patches/nsis-gcc-10-memmove.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit f6df41524e703dc471e283e566a48e05a735b7f2 -Author: Anders -Date: Sat Jun 27 23:18:45 2020 +0000 - - Don't let GCC 10 generate memmove calls (bug #1248) - - git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7189 212acab6-be3b-0410-9dea-997c60f758d6 - -diff --git a/SCons/Config/gnu b/SCons/Config/gnu -index bfcb362d..21fa446b 100644 ---- a/SCons/Config/gnu -+++ b/SCons/Config/gnu -@@ -103,6 +103,10 @@ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries - stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align - stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file - -+conf = FlagsConfigure(stub_env) -+conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248) -+conf.Finish() -+ - stub_uenv = stub_env.Clone() - stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE']) - From d36c9b646613f61c597eddc27466cbf449c58612 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:26:08 +0000 Subject: [PATCH 028/116] merge bitcoin#28759: update signapple to latest master --- contrib/guix/manifest.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index eda51765ab..70f51e1374 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -21,7 +21,6 @@ ((gnu packages python) #:select (python-minimal)) ((gnu packages python-build) #:select (python-tomli)) ((gnu packages python-crypto) #:select (python-asn1crypto)) - ((gnu packages python-web) #:select (python-requests)) ((gnu packages tls) #:select (openssl)) ((gnu packages version-control) #:select (git-minimal)) (guix build-system cmake) @@ -450,7 +449,7 @@ and endian independent.") (license license:expat))) (define-public python-signapple - (let ((commit "8a945a2e7583be2665cf3a6a89d665b70ecd1ab6")) + (let ((commit "7a96b4171a360abf0f0f56e499f8f9ed2116280d")) (package (name "python-signapple") (version (git-version "0.1" "1" commit)) @@ -463,14 +462,13 @@ and endian independent.") (file-name (git-file-name name commit)) (sha256 (base32 - "0fr1hangvfyiwflca6jg5g8zvg3jc9qr7vd2c12ff89pznf38dlg")))) + "0aa4k180jnpal15yhncnm3g3z9gzmi7qb25q5l0kaj444a1p2pm4")))) (build-system python-build-system) (propagated-inputs `(("python-asn1crypto" ,python-asn1crypto) ("python-oscrypto" ,python-oscrypto) ("python-certvalidator" ,python-certvalidator) ("python-elfesteem" ,python-elfesteem) - ("python-requests" ,python-requests) ("python-macholib" ,python-macholib))) ;; There are no tests, but attempting to run python setup.py test leads to ;; problems, just disable the test From c3718700abb0e305f9048413c5175d57984c54c0 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:22:59 +0000 Subject: [PATCH 029/116] merge bitcoin#28580: update time-machine --- contrib/guix/libexec/prelude.bash | 2 +- contrib/guix/manifest.scm | 24 +----------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index a31db6c04d..a28cdae7dc 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=160f78a4d92205df986ed9efcce7d3aac188cb24 \ + --commit=77386bdbfe6b0c649c05ab37f08051d1ab3e5074 \ --cores="$JOBS" \ --keep-failed \ --fallback \ diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 70f51e1374..f94a637677 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -21,6 +21,7 @@ ((gnu packages python) #:select (python-minimal)) ((gnu packages python-build) #:select (python-tomli)) ((gnu packages python-crypto) #:select (python-asn1crypto)) + ((gnu packages python-xyz) #:select (python-altgraph)) ((gnu packages tls) #:select (openssl)) ((gnu packages version-control) #:select (git-minimal)) (guix build-system cmake) @@ -377,29 +378,6 @@ certificates or paths. Supports various options, including: validation at a specific moment in time, whitelisting and revocation checks.") (license license:expat)))) -(define-public python-altgraph - (package - (name "python-altgraph") - (version "0.17") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/ronaldoussoren/altgraph") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "09sm4srvvkw458pn48ga9q7ykr4xlz7q8gh1h9w7nxpf001qgpwb")))) - (build-system python-build-system) - (home-page "https://github.com/ronaldoussoren/altgraph") - (synopsis "Python graph (network) package") - (description "altgraph is a fork of graphlib: a graph (network) package for -constructing graphs, BFS and DFS traversals, topological sort, shortest paths, -etc. with graphviz output.") - (license license:expat))) - - (define-public python-macholib (package (name "python-macholib") From d4b10a38130ccb298a6f5a1482a7ee7ea24733c1 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:15:19 +0000 Subject: [PATCH 030/116] merge bitcoin#28786: switch to 6.1 kernel headers over 5.15 --- contrib/guix/manifest.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index f94a637677..b49b8f15b6 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -13,7 +13,7 @@ (gnu packages gawk) (gnu packages gcc) ((gnu packages installers) #:select (nsis-x86_64)) - ((gnu packages linux) #:select (linux-libre-headers-5.15 util-linux)) + ((gnu packages linux) #:select (linux-libre-headers-6.1 util-linux)) (gnu packages llvm) (gnu packages mingw) (gnu packages moreutils) @@ -95,7 +95,7 @@ chain for " target " development.")) (license (package-license xgcc))))) (define base-gcc gcc-10) -(define base-linux-kernel-headers linux-libre-headers-5.15) +(define base-linux-kernel-headers linux-libre-headers-6.1) (define* (make-bitcoin-cross-toolchain target #:key From a701b06435dca890c80ff7727d02869fb2b89385 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:43:33 +0100 Subject: [PATCH 031/116] merge bitcoin#29078: Bump guix time-machine to unlock riscv64 metal --- contrib/guix/libexec/prelude.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index a28cdae7dc..36a28f2eac 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=77386bdbfe6b0c649c05ab37f08051d1ab3e5074 \ + --commit=d5ca4d4fd713a9f7e17e074a1e37dda99bbb09fc \ --cores="$JOBS" \ --keep-failed \ --fallback \ From 59a125a5ad1ebd84c46a83d9c810f8a6b2836a53 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:58:44 +0100 Subject: [PATCH 032/116] merge bitcoin#27897: use GCC 12.3.0 to build releases --- contrib/guix/guix-build | 3 +- contrib/guix/manifest.scm | 24 +++++++++----- contrib/guix/patches/vmov-alignment.patch | 38 +++++++++++++++++------ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index 415e97c57d..1fef7400f5 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -74,7 +74,8 @@ mkdir -p "$VERSION_BASE" ################ # Default to building for all supported HOSTs (overridable by environment) -export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu powerpc64-linux-gnu powerpc64le-linux-gnu +# powerpc64le-linux-gnu currently disabled due non-determinism issues across build arches. +export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu powerpc64-linux-gnu x86_64-w64-mingw32 x86_64-apple-darwin arm64-apple-darwin}" diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index b49b8f15b6..ca03dc0385 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -94,7 +94,7 @@ chain for " target " development.")) (home-page (package-home-page xgcc)) (license (package-license xgcc))))) -(define base-gcc gcc-10) +(define base-gcc gcc-12) (define base-linux-kernel-headers linux-libre-headers-6.1) (define* (make-bitcoin-cross-toolchain target @@ -565,9 +565,6 @@ inspecting signatures in Mach-O binaries.") automake pkg-config bison - ;; Native GCC 10 toolchain - gcc-toolchain-10 - (list gcc-toolchain-10 "static") ;; Scripting python-minimal ;; (3.10) ;; Git @@ -576,14 +573,25 @@ inspecting signatures in Mach-O binaries.") python-lief) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) - ;; Windows - (list zip + (list ;; Native GCC 12 toolchain + gcc-toolchain-12 + (list gcc-toolchain-12 "static") + zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") nsis-x86_64 nss-certs osslsigncode)) ((string-contains target "-linux-") - (list (make-bitcoin-cross-toolchain target))) + (list ;; Native GCC 12 toolchain + gcc-toolchain-12 + (list gcc-toolchain-12 "static") + (make-bitcoin-cross-toolchain target))) ((string-contains target "darwin") - (list clang-toolchain-10 binutils xorriso python-signapple)) + (list ;; Native GCC 10 toolchain + gcc-toolchain-10 + (list gcc-toolchain-10 "static") + binutils + clang-toolchain-10 + python-signapple + xorriso)) (else '()))))) diff --git a/contrib/guix/patches/vmov-alignment.patch b/contrib/guix/patches/vmov-alignment.patch index 7976b864af..96e1cb7cd1 100644 --- a/contrib/guix/patches/vmov-alignment.patch +++ b/contrib/guix/patches/vmov-alignment.patch @@ -168,14 +168,19 @@ Based on a patch originally by Claude Heiland-Allen default: gcc_unreachable (); } ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -4981,13 +4981,13 @@ - switch (type) +--- a/gcc/config/i386/i386.cc ++++ b/gcc/config/i386/i386.cc +@@ -5418,17 +5418,15 @@ ix86_get_ssemov (rtx *operands, unsigned size, { case opcode_int: -- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; -+ opcode = "vmovdqu32"; + if (scalar_mode == E_HFmode) +- opcode = (misaligned_p +- ? (TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64") +- : "vmovdqa64"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; + else +- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; ++ opcode = "vmovdqu32"; break; case opcode_float: - opcode = misaligned_p ? "vmovups" : "vmovaps"; @@ -187,9 +192,24 @@ Based on a patch originally by Claude Heiland-Allen break; } } -@@ -4996,16 +4996,16 @@ - switch (scalar_mode) +@@ -5438,29 +5436,21 @@ ix86_get_ssemov (rtx *operands, unsigned size, { + case E_HFmode: + if (evex_reg_p) +- opcode = (misaligned_p +- ? (TARGET_AVX512BW +- ? "vmovdqu16" +- : "vmovdqu64") +- : "vmovdqa64"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; + else +- opcode = (misaligned_p +- ? (TARGET_AVX512BW +- ? "vmovdqu16" +- : "%vmovdqu") +- : "%vmovdqa"); ++ opcode = TARGET_AVX512BW ? "vmovdqu16" : "%vmovdqu"; + break; case E_SFmode: - opcode = misaligned_p ? "%vmovups" : "%vmovaps"; + opcode = "%vmovups"; @@ -208,7 +228,7 @@ Based on a patch originally by Claude Heiland-Allen break; default: gcc_unreachable (); -@@ -5017,48 +5017,32 @@ +@@ -5472,48 +5462,32 @@ ix86_get_ssemov (rtx *operands, unsigned size, { case E_QImode: if (evex_reg_p) From c965943a57adeb2120140843fc9f1981e393e7c2 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:25:18 +0000 Subject: [PATCH 033/116] merge bitcoin#29651: bump time-machine to dc4842797bfdc5f9f3f5f725bf189c2b68bd6b5a --- contrib/guix/libexec/prelude.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index 36a28f2eac..380c187233 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=d5ca4d4fd713a9f7e17e074a1e37dda99bbb09fc \ + --commit=dc4842797bfdc5f9f3f5f725bf189c2b68bd6b5a \ --cores="$JOBS" \ --keep-failed \ --fallback \ From d570e2d21f7fb775995cc19f1bf01ac770036208 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:26:01 +0000 Subject: [PATCH 034/116] merge bitcoin#29695: build GCC with --enable-standard-branch-protection --- contrib/guix/manifest.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index ca03dc0385..604e27ea6f 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -484,6 +484,7 @@ inspecting signatures in Mach-O binaries.") (list "--enable-initfini-array=yes", "--enable-default-ssp=yes", "--enable-default-pie=yes", + "--enable-standard-branch-protection=yes", building-on))) ((#:phases phases) `(modify-phases ,phases From f321d3de0c23a9597fef30be887cbae7f06f9151 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:03:07 +0000 Subject: [PATCH 035/116] merge bitcoin#29673: use GCC 11 in macOS build env --- contrib/guix/libexec/build.sh | 12 ++++++++++-- contrib/guix/manifest.scm | 5 ++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index c357a9da49..d07bde6730 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -63,7 +63,6 @@ store_path() { # Set environment variables to point the NATIVE toolchain to the right # includes/libs NATIVE_GCC="$(store_path gcc-toolchain)" -NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)" unset LIBRARY_PATH unset CPATH @@ -72,12 +71,21 @@ unset CPLUS_INCLUDE_PATH unset OBJC_INCLUDE_PATH unset OBJCPLUS_INCLUDE_PATH -export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib" export C_INCLUDE_PATH="${NATIVE_GCC}/include" export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include" export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" +case "$HOST" in + *darwin*) + export LIBRARY_PATH="${NATIVE_GCC}/lib" + ;; + *) + NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)" + export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib" + ;; +esac + # Set environment variables to point the CROSS toolchain to the right # includes/libs for $HOST case "$HOST" in diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 604e27ea6f..81f186b1d2 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -588,9 +588,8 @@ inspecting signatures in Mach-O binaries.") (list gcc-toolchain-12 "static") (make-bitcoin-cross-toolchain target))) ((string-contains target "darwin") - (list ;; Native GCC 10 toolchain - gcc-toolchain-10 - (list gcc-toolchain-10 "static") + (list ;; Native GCC 11 toolchain + gcc-toolchain-11 binutils clang-toolchain-10 python-signapple From 4d1f7dccd737bec9aa3d92054c2d40e2ffe65999 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 4 Apr 2024 13:32:15 +0100 Subject: [PATCH 036/116] merge bitcoin#29828: remove `gcc-toolchain static` from Windows build --- contrib/guix/libexec/build.sh | 5 ++--- contrib/guix/manifest.scm | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index d07bde6730..3640b4e439 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -77,9 +77,8 @@ export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include" export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include" case "$HOST" in - *darwin*) - export LIBRARY_PATH="${NATIVE_GCC}/lib" - ;; + *darwin*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;; + *mingw*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;; *) NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)" export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib" diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 81f186b1d2..bc388fd344 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -576,7 +576,6 @@ inspecting signatures in Mach-O binaries.") (cond ((string-suffix? "-mingw32" target) (list ;; Native GCC 12 toolchain gcc-toolchain-12 - (list gcc-toolchain-12 "static") zip (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32") nsis-x86_64 From 5b292eec92e50bb6c0195ba98e3392923cfa4a58 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:21:22 +0200 Subject: [PATCH 037/116] merge bitcoin#29846: replace GCC unaligned VMOV patch with binutils patch --- contrib/guix/manifest.scm | 9 +- .../patches/binutils-unaligned-default.patch | 22 ++ contrib/guix/patches/vmov-alignment.patch | 288 ------------------ 3 files changed, 28 insertions(+), 291 deletions(-) create mode 100644 contrib/guix/patches/binutils-unaligned-default.patch delete mode 100644 contrib/guix/patches/vmov-alignment.patch diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index bc388fd344..08445bedd7 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -113,12 +113,15 @@ desirable for building Dash Core release binaries." (define (gcc-mingw-patches gcc) (package-with-extra-patches gcc - (search-our-patches "gcc-remap-guix-store.patch" - "vmov-alignment.patch"))) + (search-our-patches "gcc-remap-guix-store.patch"))) + +(define (binutils-mingw-patches binutils) + (package-with-extra-patches binutils + (search-our-patches "binutils-unaligned-default.patch"))) (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" - (let* ((xbinutils (cross-binutils target)) + (let* ((xbinutils (binutils-mingw-patches (cross-binutils target))) (pthreads-xlibc mingw-w64-x86_64-winpthreads) (pthreads-xgcc (cross-gcc target #:xgcc (gcc-mingw-patches mingw-w64-base-gcc) diff --git a/contrib/guix/patches/binutils-unaligned-default.patch b/contrib/guix/patches/binutils-unaligned-default.patch new file mode 100644 index 0000000000..d1bc71aee1 --- /dev/null +++ b/contrib/guix/patches/binutils-unaligned-default.patch @@ -0,0 +1,22 @@ +commit 6537181f59ed186a341db621812a6bc35e22eaf6 +Author: fanquake +Date: Wed Apr 10 12:15:52 2024 +0200 + + build: turn on -muse-unaligned-vector-move by default + + This allows us to avoid (more invasively) patching GCC, to avoid + unaligned instruction use. + +diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c +index e0632681477..14a9653abdf 100644 +--- a/gas/config/tc-i386.c ++++ b/gas/config/tc-i386.c +@@ -801,7 +801,7 @@ static unsigned int no_cond_jump_promotion = 0; + static unsigned int sse2avx; + + /* Encode aligned vector move as unaligned vector move. */ +-static unsigned int use_unaligned_vector_move; ++static unsigned int use_unaligned_vector_move = 1; + + /* Encode scalar AVX instructions with specific vector length. */ + static enum diff --git a/contrib/guix/patches/vmov-alignment.patch b/contrib/guix/patches/vmov-alignment.patch deleted file mode 100644 index 96e1cb7cd1..0000000000 --- a/contrib/guix/patches/vmov-alignment.patch +++ /dev/null @@ -1,288 +0,0 @@ -Description: Use unaligned VMOV instructions -Author: Stephen Kitt -Bug-Debian: https://bugs.debian.org/939559 -See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 - -Based on a patch originally by Claude Heiland-Allen - ---- a/gcc/config/i386/sse.md -+++ b/gcc/config/i386/sse.md -@@ -1058,17 +1058,11 @@ - { - if (FLOAT_MODE_P (GET_MODE_INNER (mode))) - { -- if (misaligned_operand (operands[1], mode)) -- return "vmovu\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; -- else -- return "vmova\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; -+ return "vmovu\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; - } - else - { -- if (misaligned_operand (operands[1], mode)) -- return "vmovdqu\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; -- else -- return "vmovdqa\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; -+ return "vmovdqu\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"; - } - } - [(set_attr "type" "ssemov") -@@ -1184,17 +1178,11 @@ - { - if (FLOAT_MODE_P (GET_MODE_INNER (mode))) - { -- if (misaligned_operand (operands[0], mode)) -- return "vmovu\t{%1, %0%{%2%}|%0%{%2%}, %1}"; -- else -- return "vmova\t{%1, %0%{%2%}|%0%{%2%}, %1}"; -+ return "vmovu\t{%1, %0%{%2%}|%0%{%2%}, %1}"; - } - else - { -- if (misaligned_operand (operands[0], mode)) -- return "vmovdqu\t{%1, %0%{%2%}|%0%{%2%}, %1}"; -- else -- return "vmovdqa\t{%1, %0%{%2%}|%0%{%2%}, %1}"; -+ return "vmovdqu\t{%1, %0%{%2%}|%0%{%2%}, %1}"; - } - } - [(set_attr "type" "ssemov") -@@ -7806,7 +7794,7 @@ - "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))" - "@ - %vmovlps\t{%1, %0|%q0, %1} -- %vmovaps\t{%1, %0|%0, %1} -+ %vmovups\t{%1, %0|%0, %1} - %vmovlps\t{%1, %d0|%d0, %q1}" - [(set_attr "type" "ssemov") - (set_attr "prefix" "maybe_vex") -@@ -13997,29 +13985,15 @@ - switch (mode) - { - case E_V8DFmode: -- if (misaligned_operand (operands[2], mode)) -- return "vmovupd\t{%2, %x0|%x0, %2}"; -- else -- return "vmovapd\t{%2, %x0|%x0, %2}"; -+ return "vmovupd\t{%2, %x0|%x0, %2}"; - case E_V16SFmode: -- if (misaligned_operand (operands[2], mode)) -- return "vmovups\t{%2, %x0|%x0, %2}"; -- else -- return "vmovaps\t{%2, %x0|%x0, %2}"; -+ return "vmovups\t{%2, %x0|%x0, %2}"; - case E_V8DImode: -- if (misaligned_operand (operands[2], mode)) -- return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}" -+ return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}" - : "vmovdqu\t{%2, %x0|%x0, %2}"; -- else -- return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}" -- : "vmovdqa\t{%2, %x0|%x0, %2}"; - case E_V16SImode: -- if (misaligned_operand (operands[2], mode)) -- return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}" -+ return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}" - : "vmovdqu\t{%2, %x0|%x0, %2}"; -- else -- return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}" -- : "vmovdqa\t{%2, %x0|%x0, %2}"; - default: - gcc_unreachable (); - } -@@ -21225,63 +21199,27 @@ - switch (get_attr_mode (insn)) - { - case MODE_V16SF: -- if (misaligned_operand (operands[1], mode)) -- return "vmovups\t{%1, %t0|%t0, %1}"; -- else -- return "vmovaps\t{%1, %t0|%t0, %1}"; -+ return "vmovups\t{%1, %t0|%t0, %1}"; - case MODE_V8DF: -- if (misaligned_operand (operands[1], mode)) -- return "vmovupd\t{%1, %t0|%t0, %1}"; -- else -- return "vmovapd\t{%1, %t0|%t0, %1}"; -+ return "vmovupd\t{%1, %t0|%t0, %1}"; - case MODE_V8SF: -- if (misaligned_operand (operands[1], mode)) -- return "vmovups\t{%1, %x0|%x0, %1}"; -- else -- return "vmovaps\t{%1, %x0|%x0, %1}"; -+ return "vmovups\t{%1, %x0|%x0, %1}"; - case MODE_V4DF: -- if (misaligned_operand (operands[1], mode)) -- return "vmovupd\t{%1, %x0|%x0, %1}"; -- else -- return "vmovapd\t{%1, %x0|%x0, %1}"; -+ return "vmovupd\t{%1, %x0|%x0, %1}"; - case MODE_XI: -- if (misaligned_operand (operands[1], mode)) -- { -- if (which_alternative == 2) -- return "vmovdqu\t{%1, %t0|%t0, %1}"; -- else if (GET_MODE_SIZE (mode) == 8) -- return "vmovdqu64\t{%1, %t0|%t0, %1}"; -- else -- return "vmovdqu32\t{%1, %t0|%t0, %1}"; -- } -+ if (which_alternative == 2) -+ return "vmovdqu\t{%1, %t0|%t0, %1}"; -+ else if (GET_MODE_SIZE (mode) == 8) -+ return "vmovdqu64\t{%1, %t0|%t0, %1}"; - else -- { -- if (which_alternative == 2) -- return "vmovdqa\t{%1, %t0|%t0, %1}"; -- else if (GET_MODE_SIZE (mode) == 8) -- return "vmovdqa64\t{%1, %t0|%t0, %1}"; -- else -- return "vmovdqa32\t{%1, %t0|%t0, %1}"; -- } -+ return "vmovdqu32\t{%1, %t0|%t0, %1}"; - case MODE_OI: -- if (misaligned_operand (operands[1], mode)) -- { -- if (which_alternative == 2) -- return "vmovdqu\t{%1, %x0|%x0, %1}"; -- else if (GET_MODE_SIZE (mode) == 8) -- return "vmovdqu64\t{%1, %x0|%x0, %1}"; -- else -- return "vmovdqu32\t{%1, %x0|%x0, %1}"; -- } -+ if (which_alternative == 2) -+ return "vmovdqu\t{%1, %x0|%x0, %1}"; -+ else if (GET_MODE_SIZE (mode) == 8) -+ return "vmovdqu64\t{%1, %x0|%x0, %1}"; - else -- { -- if (which_alternative == 2) -- return "vmovdqa\t{%1, %x0|%x0, %1}"; -- else if (GET_MODE_SIZE (mode) == 8) -- return "vmovdqa64\t{%1, %x0|%x0, %1}"; -- else -- return "vmovdqa32\t{%1, %x0|%x0, %1}"; -- } -+ return "vmovdqu32\t{%1, %x0|%x0, %1}"; - default: - gcc_unreachable (); - } ---- a/gcc/config/i386/i386.cc -+++ b/gcc/config/i386/i386.cc -@@ -5418,17 +5418,15 @@ ix86_get_ssemov (rtx *operands, unsigned size, - { - case opcode_int: - if (scalar_mode == E_HFmode) -- opcode = (misaligned_p -- ? (TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64") -- : "vmovdqa64"); -+ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; - else -- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; -+ opcode = "vmovdqu32"; - break; - case opcode_float: -- opcode = misaligned_p ? "vmovups" : "vmovaps"; -+ opcode = "vmovups"; - break; - case opcode_double: -- opcode = misaligned_p ? "vmovupd" : "vmovapd"; -+ opcode = "vmovupd"; - break; - } - } -@@ -5438,29 +5436,21 @@ ix86_get_ssemov (rtx *operands, unsigned size, - { - case E_HFmode: - if (evex_reg_p) -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu16" -- : "vmovdqu64") -- : "vmovdqa64"); -+ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; - else -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu16" -- : "%vmovdqu") -- : "%vmovdqa"); -+ opcode = TARGET_AVX512BW ? "vmovdqu16" : "%vmovdqu"; - break; - case E_SFmode: -- opcode = misaligned_p ? "%vmovups" : "%vmovaps"; -+ opcode = "%vmovups"; - break; - case E_DFmode: -- opcode = misaligned_p ? "%vmovupd" : "%vmovapd"; -+ opcode = "%vmovupd"; - break; - case E_TFmode: - if (evex_reg_p) -- opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64"; -+ opcode = "vmovdqu64"; - else -- opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa"; -+ opcode = "%vmovdqu"; - break; - default: - gcc_unreachable (); -@@ -5472,48 +5462,32 @@ ix86_get_ssemov (rtx *operands, unsigned size, - { - case E_QImode: - if (evex_reg_p) -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu8" -- : "vmovdqu64") -- : "vmovdqa64"); -+ opcode = TARGET_AVX512BW ? "vmovdqu8" : "vmovdqu64"; - else -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu8" -- : "%vmovdqu") -- : "%vmovdqa"); -+ opcode = TARGET_AVX512BW ? "vmovdqu8" : "%vmovdqu"; - break; - case E_HImode: - if (evex_reg_p) -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu16" -- : "vmovdqu64") -- : "vmovdqa64"); -+ opcode = TARGET_AVX512BW ? "vmovdqu16" : "vmovdqu64"; - else -- opcode = (misaligned_p -- ? (TARGET_AVX512BW -- ? "vmovdqu16" -- : "%vmovdqu") -- : "%vmovdqa"); -+ opcode = TARGET_AVX512BW ? "vmovdqu16" : "%vmovdqu"; - break; - case E_SImode: - if (evex_reg_p) -- opcode = misaligned_p ? "vmovdqu32" : "vmovdqa32"; -+ opcode = "vmovdqu32"; - else -- opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa"; -+ opcode = "%vmovdqu"; - break; - case E_DImode: - case E_TImode: - case E_OImode: - if (evex_reg_p) -- opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64"; -+ opcode = "vmovdqu64"; - else -- opcode = misaligned_p ? "%vmovdqu" : "%vmovdqa"; -+ opcode = "%vmovdqu"; - break; - case E_XImode: -- opcode = misaligned_p ? "vmovdqu64" : "vmovdqa64"; -+ opcode = "vmovdqu64"; - break; - default: - gcc_unreachable (); From 06f54318b3248a6ea412bf0509d7fd48a56d7229 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:05:42 +0000 Subject: [PATCH 038/116] merge bitcoin#30231: bump time-machine to f0bb724211872cd6158fce6162e0b8c73efed126 --- contrib/guix/libexec/prelude.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index 380c187233..859095b04d 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -51,7 +51,7 @@ fi time-machine() { # shellcheck disable=SC2086 guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \ - --commit=dc4842797bfdc5f9f3f5f725bf189c2b68bd6b5a \ + --commit=f0bb724211872cd6158fce6162e0b8c73efed126 \ --cores="$JOBS" \ --keep-failed \ --fallback \ From cfc6cba4eaa63a84cba6d6b14b03c716f2fac528 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:42:04 +0100 Subject: [PATCH 039/116] partial bitcoin#30511: GCC 12 consolidation excludes: - 8b41ede55ebbc6978deb3f4fad5e18b76b372506 --- contrib/guix/manifest.scm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 08445bedd7..8e4ccb3936 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -28,6 +28,7 @@ (guix build-system gnu) (guix build-system python) (guix build-system trivial) + (guix download) (guix gexp) (guix git-download) ((guix licenses) #:prefix license:) @@ -94,7 +95,18 @@ chain for " target " development.")) (home-page (package-home-page xgcc)) (license (package-license xgcc))))) -(define base-gcc gcc-12) +(define base-gcc + (package + (inherit gcc-12) ;; 12.3.0 + (version "12.4.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-" + version "/gcc-" version ".tar.xz")) + (sha256 + (base32 + "0xcida8l2wykvvzvpcrcn649gj0ijn64gwxbplacpg6c0hk6akvh")))))) + (define base-linux-kernel-headers linux-libre-headers-6.1) (define* (make-bitcoin-cross-toolchain target @@ -122,7 +134,10 @@ desirable for building Dash Core release binaries." (define (make-mingw-pthreads-cross-toolchain target) "Create a cross-compilation toolchain package for TARGET" (let* ((xbinutils (binutils-mingw-patches (cross-binutils target))) - (pthreads-xlibc mingw-w64-x86_64-winpthreads) + (machine (substring target 0 (string-index target #\-))) + (pthreads-xlibc (make-mingw-w64 machine + #:xgcc (cross-gcc target #:xgcc (gcc-mingw-patches base-gcc)) + #:with-winpthreads? #t)) (pthreads-xgcc (cross-gcc target #:xgcc (gcc-mingw-patches mingw-w64-base-gcc) #:xbinutils xbinutils From 91b7ef86074a24772f1cf13ffb952c8274f90fd0 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:26:38 +0000 Subject: [PATCH 040/116] merge bitcoin#30438: build Linux GCC with --enable-cet --- contrib/guix/manifest.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 8e4ccb3936..ce000ae28e 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -503,6 +503,7 @@ inspecting signatures in Mach-O binaries.") "--enable-default-ssp=yes", "--enable-default-pie=yes", "--enable-standard-branch-protection=yes", + "--enable-cet=yes", building-on))) ((#:phases phases) `(modify-phases ,phases From 8a7941bd0da106a393abd091472a5902e464c1e3 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Thu, 31 Oct 2024 19:20:40 +0700 Subject: [PATCH 041/116] refactor: merge helper GetCoinbaseTx which is used only once into GetNonNullCoinbaseChainlock --- src/evo/cbtx.cpp | 15 +++++---------- src/evo/cbtx.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/evo/cbtx.cpp b/src/evo/cbtx.cpp index 48baccd9d9..a9a5abe762 100644 --- a/src/evo/cbtx.cpp +++ b/src/evo/cbtx.cpp @@ -20,6 +20,7 @@ #include #include + bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state) { if (tx.nType != TRANSACTION_COINBASE) { @@ -448,7 +449,7 @@ std::string CCbTx::ToString() const creditPoolBalance / COIN, creditPoolBalance % COIN); } -std::optional GetCoinbaseTx(const CBlockIndex* pindex) +std::optional> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex) { if (pindex == nullptr) { return std::nullopt; @@ -464,20 +465,14 @@ std::optional GetCoinbaseTx(const CBlockIndex* pindex) return std::nullopt; } - CTransactionRef cbTx = block.vtx[0]; - return GetTxPayload(*cbTx); -} - -std::optional> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex) -{ - auto opt_cbtx = GetCoinbaseTx(pindex); + const CTransactionRef cbTx = block.vtx[0]; + const auto opt_cbtx = GetTxPayload(*cbTx); if (!opt_cbtx.has_value()) { return std::nullopt; } - CCbTx& cbtx = opt_cbtx.value(); - + const CCbTx& cbtx = opt_cbtx.value(); if (cbtx.nVersion < CCbTx::Version::CLSIG_AND_BALANCE) { return std::nullopt; } diff --git a/src/evo/cbtx.h b/src/evo/cbtx.h index dccfb56212..cb8ab1f92c 100644 --- a/src/evo/cbtx.h +++ b/src/evo/cbtx.h @@ -100,7 +100,6 @@ bool CheckCbTxBestChainlock(const CBlock& block, const CBlockIndex* pindexPrev, bool CalcCbTxBestChainlock(const llmq::CChainLocksHandler& chainlock_handler, const CBlockIndex* pindexPrev, uint32_t& bestCLHeightDiff, CBLSSignature& bestCLSignature); -std::optional GetCoinbaseTx(const CBlockIndex* pindex); std::optional> GetNonNullCoinbaseChainlock(const CBlockIndex* pindex); #endif // BITCOIN_EVO_CBTX_H From f2a186f3f369581141fce466d4b7db851c053e15 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Mon, 4 Nov 2024 14:59:32 +0700 Subject: [PATCH 042/116] refactor: remove definition IsQuorumDKGEnabled from header --- src/llmq/dkgsessionmgr.cpp | 10 +++++----- src/llmq/dkgsessionmgr.h | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/llmq/dkgsessionmgr.cpp b/src/llmq/dkgsessionmgr.cpp index 1743f0376c..04ae1d9166 100644 --- a/src/llmq/dkgsessionmgr.cpp +++ b/src/llmq/dkgsessionmgr.cpp @@ -18,6 +18,11 @@ #include #include +static bool IsQuorumDKGEnabled(const CSporkManager& sporkman) +{ + return sporkman.IsSporkActive(SPORK_17_QUORUM_DKG_ENABLED); +} + namespace llmq { static const std::string DB_VVEC = "qdkg_V"; @@ -515,9 +520,4 @@ void CDKGSessionManager::CleanupOldContributions() const } } -bool IsQuorumDKGEnabled(const CSporkManager& sporkman) -{ - return sporkman.IsSporkActive(SPORK_17_QUORUM_DKG_ENABLED); -} - } // namespace llmq diff --git a/src/llmq/dkgsessionmgr.h b/src/llmq/dkgsessionmgr.h index 8c1ddea339..1586e1262d 100644 --- a/src/llmq/dkgsessionmgr.h +++ b/src/llmq/dkgsessionmgr.h @@ -104,8 +104,6 @@ class CDKGSessionManager void MigrateDKG(); void CleanupCache() const; }; - -bool IsQuorumDKGEnabled(const CSporkManager& sporkman); } // namespace llmq #endif // BITCOIN_LLMQ_DKGSESSIONMGR_H From e9387eef69f66bee6419575933022963b2b85fb0 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 1 Nov 2024 13:36:43 +0700 Subject: [PATCH 043/116] refactor: remove unused includes and forward declarations from headers --- src/evo/assetlocktx.h | 4 ++-- src/evo/creditpool.h | 8 ++++---- src/evo/deterministicmns.h | 1 + src/evo/dmnstate.h | 6 +++--- src/evo/mnauth.h | 4 ---- src/evo/mnhftx.h | 3 +-- src/evo/providertx.h | 2 -- src/evo/simplifiedmns.h | 8 ++++++-- src/evo/specialtx.h | 1 - src/evo/specialtxman.h | 3 ++- src/llmq/blockprocessor.h | 7 +++---- src/llmq/chainlocks.h | 9 ++++----- src/llmq/commitment.h | 8 ++++++-- src/llmq/context.h | 1 - src/llmq/dkgsession.h | 1 - src/llmq/dkgsessionhandler.h | 13 ++++++++++--- src/llmq/instantsend.h | 8 ++++---- src/llmq/quorums.h | 14 +++++++------- src/llmq/signing.h | 4 ++-- src/llmq/signing_shares.h | 14 +++++++++----- src/llmq/snapshot.h | 8 ++++---- src/masternode/meta.cpp | 1 + src/masternode/meta.h | 7 +++++-- 23 files changed, 74 insertions(+), 61 deletions(-) diff --git a/src/evo/assetlocktx.h b/src/evo/assetlocktx.h index 1e9a666d50..531183fd0a 100644 --- a/src/evo/assetlocktx.h +++ b/src/evo/assetlocktx.h @@ -6,9 +6,9 @@ #define BITCOIN_EVO_ASSETLOCKTX_H #include -#include +#include #include - +#include #include #include diff --git a/src/evo/creditpool.h b/src/evo/creditpool.h index dfb3004f8e..5da980df65 100644 --- a/src/evo/creditpool.h +++ b/src/evo/creditpool.h @@ -5,10 +5,7 @@ #ifndef BITCOIN_EVO_CREDITPOOL_H #define BITCOIN_EVO_CREDITPOOL_H -#include - -#include - +#include #include #include #include @@ -16,10 +13,13 @@ #include #include +#include + #include #include class BlockManager; +class CBlock; class CBlockIndex; class BlockValidationState; class CEvoDB; diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index c8a3020283..52119350f1 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -29,6 +29,7 @@ class CBlock; class CBlockIndex; class CChainState; +class CCoinsViewCache; class CConnman; class CEvoDB; class TxValidationState; diff --git a/src/evo/dmnstate.h b/src/evo/dmnstate.h index 0a0f62316d..acee5c2b49 100644 --- a/src/evo/dmnstate.h +++ b/src/evo/dmnstate.h @@ -5,12 +5,12 @@ #ifndef BITCOIN_EVO_DMNSTATE_H #define BITCOIN_EVO_DMNSTATE_H -#include #include -#include +#include +#include #include +#include #include