diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index 52481b24fca863..8a0517ec483d50 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -435,6 +435,13 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " ARROW " ]]; then # apache-arrow-17.0.0-force-write-int96-timestamps.patch : # Introducing the parameter that forces writing int96 timestampes for compatibility with Paimon cpp. patch -p1 <"${TP_PATCH_DIR}/apache-arrow-17.0.0-force-write-int96-timestamps.patch" + + # apache-arrow-17.0.0-status-inline-static-fix.patch : + # Move Status::message()/detail() empty sentinels out of header + # inline function-local statics. Clang can place those weak inline + # std::string objects in RELRO, then crash while initializing them. + patch -p1 <"${TP_PATCH_DIR}/apache-arrow-17.0.0-status-inline-static-fix.patch" + touch "${PATCHED_MARK}" fi cd - diff --git a/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch b/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch new file mode 100644 index 00000000000000..2a1ed534077303 --- /dev/null +++ b/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch @@ -0,0 +1,58 @@ +diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc +index a9581cadc9..1b7ee7df62 100644 +--- a/cpp/src/arrow/status.cc ++++ b/cpp/src/arrow/status.cc +@@ -17,6 +17,17 @@ + + namespace arrow { + ++const std::string& Status::NoMessage() { ++ static const std::string* no_message = new std::string(); ++ return *no_message; ++} ++ ++const std::shared_ptr& Status::NoDetail() { ++ static const std::shared_ptr* no_detail = ++ new std::shared_ptr(); ++ return *no_detail; ++} ++ + Status::Status(StatusCode code, const std::string& msg) + : Status::Status(code, msg, nullptr) {} + +diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h +index 983b61629d..a49a982922 100644 +--- a/cpp/src/arrow/status.h ++++ b/cpp/src/arrow/status.h +@@ -330,14 +330,18 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparablemsg; ++ if (ARROW_PREDICT_FALSE(state_ != NULLPTR)) { ++ return state_->msg; ++ } ++ return NoMessage(); + } + + /// \brief Return the status detail attached to this message. + const std::shared_ptr& detail() const { +- static std::shared_ptr no_detail = NULLPTR; +- return state_ ? state_->detail : no_detail; ++ if (ARROW_PREDICT_FALSE(state_ != NULLPTR)) { ++ return state_->detail; ++ } ++ return NoDetail(); + } + + const void* debug_state_addr() const { return state_; } +@@ -396,6 +400,8 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparable& NoDetail(); + void CopyFrom(const Status& s); + inline void MoveFrom(Status& s); + };