diff --git a/packages/databases/mariadb/package.mk b/packages/databases/mariadb/package.mk index 973affe58fa..451e84bd929 100644 --- a/packages/databases/mariadb/package.mk +++ b/packages/databases/mariadb/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="mariadb" -PKG_VERSION="10.1.21" +PKG_VERSION="10.1.22" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPLv2" diff --git a/packages/databases/mariadb/patches/mariadb-2c2bd8c1556b081fccd0fc3e010dc3ea2c38fffb.patch b/packages/databases/mariadb/patches/mariadb-2c2bd8c1556b081fccd0fc3e010dc3ea2c38fffb.patch new file mode 100644 index 00000000000..5c5a3dc3061 --- /dev/null +++ b/packages/databases/mariadb/patches/mariadb-2c2bd8c1556b081fccd0fc3e010dc3ea2c38fffb.patch @@ -0,0 +1,239 @@ +From 2c2bd8c1556b081fccd0fc3e010dc3ea2c38fffb Mon Sep 17 00:00:00 2001 +From: Sergei Golubchik +Date: Wed, 15 Mar 2017 11:46:54 +0100 +Subject: [PATCH] MDEV-12261 build failure without P_S + +restore mysql_file_delete_with_symlink() but let it use +new my_handler_delete_with_symlink() mysys helper. +--- + include/my_sys.h | 3 +-- + include/mysql/psi/mysql_file.h | 44 ++++++++++++++++++++++++++++++++++++++++ + mysys/my_symlink2.c | 14 ++++++------- + sql/handler.cc | 2 +- + sql/sql_db.cc | 6 +++--- + sql/table.cc | 2 +- + storage/maria/ma_delete_table.c | 8 ++++---- + storage/myisam/mi_delete_table.c | 8 ++++---- + 8 files changed, 64 insertions(+), 23 deletions(-) + +diff --git a/include/my_sys.h b/include/my_sys.h +index 6d4faeb5c6a..7480514dc08 100644 +--- a/include/my_sys.h ++++ b/include/my_sys.h +@@ -646,8 +646,7 @@ extern File my_create_with_symlink(const char *linkname, const char *filename, + myf MyFlags); + extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); + extern int my_symlink(const char *content, const char *linkname, myf MyFlags); +-extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name, +- const char *ext, myf sync_dir); ++extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir); + + extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); + extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, +diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h +index aca66bd4974..2f388c285bf 100644 +--- a/include/mysql/psi/mysql_file.h ++++ b/include/mysql/psi/mysql_file.h +@@ -442,6 +442,20 @@ + #endif + + /** ++ @def mysql_file_delete_with_symlink(K, P1, P2, P3) ++ Instrumented delete with symbolic link. ++ @c mysql_file_delete_with_symlink is a replacement ++ for @c my_handler_delete_with_symlink. ++*/ ++#ifdef HAVE_PSI_FILE_INTERFACE ++ #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ ++ inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) ++#else ++ #define mysql_file_delete_with_symlink(K, P1, P2, P3) \ ++ inline_mysql_file_delete_with_symlink(P1, P2, P3) ++#endif ++ ++/** + @def mysql_file_rename_with_symlink(K, P1, P2, P3) + Instrumented rename with symbolic link. + @c mysql_file_rename_with_symlink is a replacement +@@ -1294,6 +1308,7 @@ inline_mysql_file_rename( + return result; + } + ++ + static inline File + inline_mysql_file_create_with_symlink( + #ifdef HAVE_PSI_FILE_INTERFACE +@@ -1325,6 +1340,35 @@ inline_mysql_file_create_with_symlink( + + + static inline int ++inline_mysql_file_delete_with_symlink( ++#ifdef HAVE_PSI_FILE_INTERFACE ++ PSI_file_key key, const char *src_file, uint src_line, ++#endif ++ const char *name, const char *ext, myf flags) ++{ ++ int result; ++ char buf[FN_REFLEN]; ++ char *fullname= fn_format(buf, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT); ++#ifdef HAVE_PSI_FILE_INTERFACE ++ struct PSI_file_locker *locker; ++ PSI_file_locker_state state; ++ locker= PSI_FILE_CALL(get_thread_file_name_locker) ++ (&state, key, PSI_FILE_DELETE, fullname, &locker); ++ if (likely(locker != NULL)) ++ { ++ PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); ++ result= my_handler_delete_with_symlink(fullname, flags); ++ PSI_FILE_CALL(end_file_close_wait)(locker, result); ++ return result; ++ } ++#endif ++ ++ result= my_handler_delete_with_symlink(fullname, flags); ++ return result; ++} ++ ++ ++static inline int + inline_mysql_file_rename_with_symlink( + #ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c +index a2f7b6a0741..f1ace5dcd77 100644 +--- a/mysys/my_symlink2.c ++++ b/mysys/my_symlink2.c +@@ -170,22 +170,20 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) + in this case both the symlink and the symlinked file are deleted, + but only if the symlinked file is not in the datadir. + */ +-int my_handler_delete_with_symlink(PSI_file_key key, const char *name, +- const char *ext, myf sync_dir) ++int my_handler_delete_with_symlink(const char *filename, myf sync_dir) + { +- char orig[FN_REFLEN], real[FN_REFLEN]; ++ char real[FN_REFLEN]; + int res= 0; + DBUG_ENTER("my_handler_delete_with_symlink"); + +- fn_format(orig, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT); +- if (my_is_symlink(orig)) ++ if (my_is_symlink(filename)) + { + /* + Delete the symlinked file only if the symlink is not + pointing into datadir. + */ +- if (!(my_realpath(real, orig, MYF(0)) || mysys_test_invalid_symlink(real))) +- res= mysql_file_delete(key, real, MYF(MY_NOSYMLINKS | sync_dir)); ++ if (!(my_realpath(real, filename, MYF(0)) || mysys_test_invalid_symlink(real))) ++ res= my_delete(real, MYF(MY_NOSYMLINKS | sync_dir)); + } +- DBUG_RETURN(mysql_file_delete(key, orig, MYF(sync_dir)) || res); ++ DBUG_RETURN(my_delete(filename, MYF(sync_dir)) || res); + } +diff --git a/sql/handler.cc b/sql/handler.cc +index 17d00ce2486..22b7feef117 100644 +--- a/sql/handler.cc ++++ b/sql/handler.cc +@@ -3840,7 +3840,7 @@ int handler::delete_table(const char *name) + + for (const char **ext=bas_ext(); *ext ; ext++) + { +- if (my_handler_delete_with_symlink(key_file_misc, name, *ext, 0)) ++ if (mysql_file_delete_with_symlink(key_file_misc, name, *ext, 0)) + { + if (my_errno != ENOENT) + { +diff --git a/sql/sql_db.cc b/sql/sql_db.cc +index 701f4e6aa4e..f626b4e6112 100644 +--- a/sql/sql_db.cc ++++ b/sql/sql_db.cc +@@ -846,7 +846,7 @@ mysql_rm_db_internal(THD *thd,char *db, bool if_exists, bool silent) + if there exists a table with the name 'db', so let's just do it + separately. We know this file exists and needs to be deleted anyway. + */ +- if (my_handler_delete_with_symlink(key_file_misc, path, "", MYF(0)) && ++ if (mysql_file_delete_with_symlink(key_file_misc, path, "", MYF(0)) && + my_errno != ENOENT) + { + my_error(EE_DELETE, MYF(0), path, my_errno); +@@ -1152,7 +1152,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp, + We ignore ENOENT error in order to skip files that was deleted + by concurrently running statement like REPAIR TABLE ... + */ +- if (my_handler_delete_with_symlink(key_file_misc, filePath, "", MYF(0)) && ++ if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(0)) && + my_errno != ENOENT) + { + my_error(EE_DELETE, MYF(0), filePath, my_errno); +@@ -1268,7 +1268,7 @@ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) + continue; + } + strxmov(filePath, org_path, "/", file->name, NullS); +- if (my_handler_delete_with_symlink(key_file_misc, filePath, "", MYF(MY_WME))) ++ if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(MY_WME))) + { + goto err; + } +diff --git a/sql/table.cc b/sql/table.cc +index fe09ec8948d..37c0b630efc 100644 +--- a/sql/table.cc ++++ b/sql/table.cc +@@ -571,7 +571,7 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags) + { + DBUG_ASSERT(flags & GTS_TABLE); + DBUG_ASSERT(flags & GTS_USE_DISCOVERY); +- my_handler_delete_with_symlink(key_file_frm, path, "", MYF(0)); ++ mysql_file_delete_with_symlink(key_file_frm, path, "", MYF(0)); + file= -1; + } + else +diff --git a/storage/maria/ma_delete_table.c b/storage/maria/ma_delete_table.c +index 14d8a7f759a..067ab280fdc 100644 +--- a/storage/maria/ma_delete_table.c ++++ b/storage/maria/ma_delete_table.c +@@ -86,13 +86,14 @@ int maria_delete_table_files(const char *name, my_bool temporary, myf sync_dir) + { + DBUG_ENTER("maria_delete_table_files"); + +- if (my_handler_delete_with_symlink(key_file_kfile, name, MARIA_NAME_IEXT, MYF(MY_WME | sync_dir)) || +- my_handler_delete_with_symlink(key_file_dfile, name, MARIA_NAME_DEXT, MYF(MY_WME | sync_dir))) ++ if (mysql_file_delete_with_symlink(key_file_kfile, name, MARIA_NAME_IEXT, MYF(MY_WME | sync_dir)) || ++ mysql_file_delete_with_symlink(key_file_dfile, name, MARIA_NAME_DEXT, MYF(MY_WME | sync_dir))) + DBUG_RETURN(my_errno); + +- if (!temporary) { +- my_handler_delete_with_symlink(key_file_dfile, name, ".TMD", MYF(0)); +- my_handler_delete_with_symlink(key_file_dfile, name, ".OLD", MYF(0)); ++ if (!temporary) ++ { ++ mysql_file_delete_with_symlink(key_file_dfile, name, ".TMD", MYF(0)); ++ mysql_file_delete_with_symlink(key_file_dfile, name, ".OLD", MYF(0)); + } + DBUG_RETURN(0); + } +diff --git a/storage/myisam/mi_delete_table.c b/storage/myisam/mi_delete_table.c +index 3422e6b045d..d766fb2547f 100644 +--- a/storage/myisam/mi_delete_table.c ++++ b/storage/myisam/mi_delete_table.c +@@ -34,14 +34,14 @@ int mi_delete_table(const char *name) + check_table_is_closed(name,"delete"); + #endif + +- if (my_handler_delete_with_symlink(mi_key_file_kfile, name, MI_NAME_IEXT, MYF(MY_WME)) || +- my_handler_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME))) ++ if (mysql_file_delete_with_symlink(mi_key_file_kfile, name, MI_NAME_IEXT, MYF(MY_WME)) || ++ mysql_file_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME))) + DBUG_RETURN(my_errno); + + + // optionally present: +- my_handler_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0)); +- my_handler_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0)); ++ mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0)); ++ mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0)); + + DBUG_RETURN(0); + } + diff --git a/packages/databases/mariadb/patches/mips/mariadb-c11_atomics.patch b/packages/databases/mariadb/patches/mips/mariadb-c11_atomics.patch new file mode 100644 index 00000000000..3df7215f04d --- /dev/null +++ b/packages/databases/mariadb/patches/mips/mariadb-c11_atomics.patch @@ -0,0 +1,121 @@ +Description: Fix mips missing atomics primitives + On mips we don't have native support for 64bit atomic operations. Make use + of libatomic to emulate them. +Author: Vicențiu Ciorbaru + +--- a/configure.cmake ++++ b/configure.cmake +@@ -128,7 +128,7 @@ IF(UNIX) + ENDIF() + FIND_PACKAGE(Threads) + +- SET(CMAKE_REQUIRED_LIBRARIES ++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES + ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO}) + # Need explicit pthread for gcc -fsanitize=address + IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=") +@@ -1028,7 +1028,26 @@ ELSEIF(NOT WITH_ATOMIC_OPS) + long long int *ptr= &var; + return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); + }" +- HAVE_GCC_C11_ATOMICS) ++ HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) ++ IF(HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC) ++ SET(HAVE_GCC_C11_ATOMICS True) ++ ELSE() ++ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) ++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ CHECK_CXX_SOURCE_COMPILES(" ++ int main() ++ { ++ long long int var= 1; ++ long long int *ptr= &var; ++ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST); ++ }" ++ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) ++ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) ++ SET(HAVE_GCC_C11_ATOMICS True) ++ ELSE() ++ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) ++ ENDIF() ++ ENDIF() + ELSE() + MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!") + ENDIF() +--- a/include/atomic/gcc_builtins.h ++++ b/include/atomic/gcc_builtins.h +@@ -16,6 +16,7 @@ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + ++#if defined (HAVE_GCC_ATOMIC_BUILTINS) + #define make_atomic_add_body(S) \ + v= __sync_fetch_and_add(a, v); + #define make_atomic_fas_body(S) \ +@@ -26,6 +27,20 @@ + sav= __sync_val_compare_and_swap(a, cmp_val, set);\ + if (!(ret= (sav == cmp_val))) *cmp= sav + ++#elif defined(HAVE_GCC_C11_ATOMICS) ++ ++#define make_atomic_add_body(S) \ ++ __atomic_add_fetch(a, v, __ATOMIC_SEQ_CST) ++#define make_atomic_fas_body(S) \ ++ v= __atomic_exchange_n(a, v, __ATOMIC_SEQ_CST) ++#define make_atomic_cas_body(S) \ ++ int ## S sav; \ ++ ret= __atomic_compare_exchange_n(a, cmp, set, \ ++ 0, \ ++ __ATOMIC_SEQ_CST,\ ++ __ATOMIC_SEQ_CST); ++#endif ++ + #ifdef MY_ATOMIC_MODE_DUMMY + #define make_atomic_load_body(S) ret= *a + #define make_atomic_store_body(S) *a= v +--- a/include/atomic/nolock.h ++++ b/include/atomic/nolock.h +@@ -17,7 +17,7 @@ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + #if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \ +- || defined(HAVE_GCC_ATOMIC_BUILTINS) \ ++ || defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) \ + || defined(HAVE_SOLARIS_ATOMIC) + + # ifdef MY_ATOMIC_MODE_DUMMY +@@ -41,7 +41,7 @@ + # elif __GNUC__ + # if defined(HAVE_SOLARIS_ATOMIC) + # include "solaris.h" +-# elif defined(HAVE_GCC_ATOMIC_BUILTINS) ++# elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) + # include "gcc_builtins.h" + # elif defined(__i386__) || defined(__x86_64__) + # include "x86-gcc.h" +--- a/mysys/CMakeLists.txt ++++ b/mysys/CMakeLists.txt +@@ -78,6 +78,10 @@ IF(HAVE_BFD_H) + TARGET_LINK_LIBRARIES(mysys bfd) + ENDIF(HAVE_BFD_H) + ++IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) ++ TARGET_LINK_LIBRARIES(mysys atomic) ++ENDIF() ++ + IF (WIN32) + TARGET_LINK_LIBRARIES(mysys IPHLPAPI) + ENDIF(WIN32) +--- a/sql/CMakeLists.txt ++++ b/sql/CMakeLists.txt +@@ -171,6 +171,10 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI + ${SSL_LIBRARIES} + ${LIBSYSTEMD}) + ++IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) ++ TARGET_LINK_LIBRARIES(sql atomic) ++ENDIF() ++ + IF(WIN32) + SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc) + TARGET_LINK_LIBRARIES(sql psapi) diff --git a/packages/databases/mariadb/patches/mips/mariadb-mips-connect-unaligned.patch b/packages/databases/mariadb/patches/mips/mariadb-mips-connect-unaligned.patch new file mode 100644 index 00000000000..a7873de949c --- /dev/null +++ b/packages/databases/mariadb/patches/mips/mariadb-mips-connect-unaligned.patch @@ -0,0 +1,251 @@ +Description: Handle unaligned buffers in connect's TYPBLK class + On MIPS platforms (and probably others) unaligned memory access results in a + bus error. In the connect storage engine, block data for some data formats is + stored packed in memory and the TYPBLK class is used to read values from it. + Since TYPBLK does not have special handling for this packed memory, it can + quite easily result in unaligned memory accesses. + . + The simple way to fix this is to perform all accesses to the main buffer + through memcpy. With GCC and optimizations turned on, this call to memcpy is + completely optimized away on architectures where unaligned accesses are ok + (like x86). +Author: James Cowgill +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/storage/connect/valblk.h ++++ b/storage/connect/valblk.h +@@ -139,6 +139,7 @@ class VALBLK : public BLOCK { + int Prec; // Precision of float values + }; // end of class VALBLK + ++ + /***********************************************************************/ + /* Class TYPBLK: represents a block of typed values. */ + /***********************************************************************/ +@@ -151,40 +152,40 @@ class TYPBLK : public VALBLK { + // Implementation + virtual bool Init(PGLOBAL g, bool check); + virtual int GetVlen(void) {return sizeof(TYPE);} +- virtual char GetTinyValue(int n) {return (char)Typp[n];} +- virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];} +- virtual short GetShortValue(int n) {return (short)Typp[n];} +- virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];} +- virtual int GetIntValue(int n) {return (int)Typp[n];} +- virtual uint GetUIntValue(int n) {return (uint)Typp[n];} +- virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];} +- virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];} +- virtual double GetFloatValue(int n) {return (double)Typp[n];} ++ virtual char GetTinyValue(int n) {return (char)UnalignedRead(n);} ++ virtual uchar GetUTinyValue(int n) {return (uchar)UnalignedRead(n);} ++ virtual short GetShortValue(int n) {return (short)UnalignedRead(n);} ++ virtual ushort GetUShortValue(int n) {return (ushort)UnalignedRead(n);} ++ virtual int GetIntValue(int n) {return (int)UnalignedRead(n);} ++ virtual uint GetUIntValue(int n) {return (uint)UnalignedRead(n);} ++ virtual longlong GetBigintValue(int n) {return (longlong)UnalignedRead(n);} ++ virtual ulonglong GetUBigintValue(int n) {return (ulonglong)UnalignedRead(n);} ++ virtual double GetFloatValue(int n) {return (double)UnalignedRead(n);} + virtual char *GetCharString(char *p, int n); +- virtual void Reset(int n) {Typp[n] = 0;} ++ virtual void Reset(int n) {UnalignedWrite(n, 0);} + + // Methods + using VALBLK::SetValue; + virtual void SetValue(PSZ sp, int n); + virtual void SetValue(char *sp, uint len, int n); + virtual void SetValue(short sval, int n) +- {Typp[n] = (TYPE)sval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);} + virtual void SetValue(ushort sval, int n) +- {Typp[n] = (TYPE)sval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);} + virtual void SetValue(int lval, int n) +- {Typp[n] = (TYPE)lval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} + virtual void SetValue(uint lval, int n) +- {Typp[n] = (TYPE)lval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} + virtual void SetValue(longlong lval, int n) +- {Typp[n] = (TYPE)lval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} + virtual void SetValue(ulonglong lval, int n) +- {Typp[n] = (TYPE)lval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);} + virtual void SetValue(double fval, int n) +- {Typp[n] = (TYPE)fval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)fval); SetNull(n, false);} + virtual void SetValue(char cval, int n) +- {Typp[n] = (TYPE)cval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);} + virtual void SetValue(uchar cval, int n) +- {Typp[n] = (TYPE)cval; SetNull(n, false);} ++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);} + virtual void SetValue(PVAL valp, int n); + virtual void SetValue(PVBLK pv, int n1, int n2); + virtual void SetMin(PVAL valp, int n); +@@ -206,6 +207,17 @@ class TYPBLK : public VALBLK { + // Members + TYPE* const &Typp; + const char *Fmt; ++ ++ // Unaligned access ++ TYPE UnalignedRead(int n) const { ++ TYPE result; ++ memcpy(&result, Typp + n, sizeof(TYPE)); ++ return result; ++ } ++ ++ void UnalignedWrite(int n, TYPE value) { ++ memcpy(Typp + n, &value, sizeof(TYPE)); ++ } + }; // end of class TYPBLK + + /***********************************************************************/ +--- a/storage/connect/valblk.cpp ++++ b/storage/connect/valblk.cpp +@@ -265,14 +265,14 @@ bool TYPBLK::Init(PGLOBAL g, bool + template + char *TYPBLK::GetCharString(char *p, int n) + { +- sprintf(p, Fmt, Typp[n]); ++ sprintf(p, Fmt, UnalignedRead(n)); + return p; + } // end of GetCharString + + template <> + char *TYPBLK::GetCharString(char *p, int n) + { +- sprintf(p, Fmt, Prec, Typp[n]); ++ sprintf(p, Fmt, Prec, UnalignedRead(n)); + return p; + } // end of GetCharString + +@@ -288,7 +288,7 @@ void TYPBLK::SetValue(PVAL valp, i + ChkTyp(valp); + + if (!(b = valp->IsNull())) +- Typp[n] = GetTypedValue(valp); ++ UnalignedWrite(n, GetTypedValue(valp)); + else + Reset(n); + +@@ -350,9 +350,9 @@ void TYPBLK::SetValue(PSZ p, int n + ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus); + + if (minus && val < maxval) +- Typp[n] = (TYPE)(-(signed)val); ++ UnalignedWrite(n, (TYPE)(-(signed)val)); + else +- Typp[n] = (TYPE)val; ++ UnalignedWrite(n, (TYPE)val); + + SetNull(n, false); + } // end of SetValue +@@ -395,7 +395,7 @@ void TYPBLK::SetValue(PSZ p, int + longjmp(g->jumper[g->jump_level], Type); + } // endif Check + +- Typp[n] = atof(p); ++ UnalignedWrite(n, atof(p)); + SetNull(n, false); + } // end of SetValue + +@@ -427,7 +427,7 @@ void TYPBLK::SetValue(PVBLK pv, in + ChkTyp(pv); + + if (!(b = pv->IsNull(n2) && Nullable)) +- Typp[n1] = GetTypedValue(pv, n2); ++ UnalignedWrite(n1, GetTypedValue(pv, n2)); + else + Reset(n1); + +@@ -478,10 +478,10 @@ void TYPBLK::SetMin(PVAL valp, int + { + CheckParms(valp, n) + TYPE tval = GetTypedValue(valp); +- TYPE& tmin = Typp[n]; ++ TYPE tmin = UnalignedRead(n); + + if (tval < tmin) +- tmin = tval; ++ UnalignedWrite(n, tval); + + } // end of SetMin + +@@ -493,10 +493,10 @@ void TYPBLK::SetMax(PVAL valp, int + { + CheckParms(valp, n) + TYPE tval = GetTypedValue(valp); +- TYPE& tmin = Typp[n]; ++ TYPE tmin = UnalignedRead(n); + + if (tval > tmin) +- tmin = tval; ++ UnalignedWrite(n, tval); + + } // end of SetMax + +@@ -522,7 +522,7 @@ void TYPBLK::SetValues(PVBLK pv, i + template + void TYPBLK::Move(int i, int j) + { +- Typp[j] = Typp[i]; ++ UnalignedWrite(j, UnalignedRead(i)); + MoveNull(i, j); + } // end of Move + +@@ -536,7 +536,7 @@ int TYPBLK::CompVal(PVAL vp, int n + ChkIndx(n); + ChkTyp(vp); + #endif // _DEBUG +- TYPE mlv = Typp[n]; ++ TYPE mlv = UnalignedRead(n); + TYPE vlv = GetTypedValue(vp); + + return (vlv > mlv) ? 1 : (vlv < mlv) ? (-1) : 0; +@@ -548,8 +548,8 @@ int TYPBLK::CompVal(PVAL vp, int n + template + int TYPBLK::CompVal(int i1, int i2) + { +- TYPE lv1 = Typp[i1]; +- TYPE lv2 = Typp[i2]; ++ TYPE lv1 = UnalignedRead(i1); ++ TYPE lv2 = UnalignedRead(i2); + + return (lv1 > lv2) ? 1 : (lv1 < lv2) ? (-1) : 0; + } // end of CompVal +@@ -586,7 +586,7 @@ int TYPBLK::Find(PVAL vp) + TYPE n = GetTypedValue(vp); + + for (i = 0; i < Nval; i++) +- if (n == Typp[i]) ++ if (n == UnalignedRead(i)) + break; + + return (i < Nval) ? i : (-1); +@@ -602,7 +602,7 @@ int TYPBLK::GetMaxLength(void) + int i, n, m; + + for (i = n = 0; i < Nval; i++) { +- m = sprintf(buf, Fmt, Typp[i]); ++ m = sprintf(buf, Fmt, UnalignedRead(i)); + n = MY_MAX(n, m); + } // endfor i + +@@ -1332,7 +1332,7 @@ char *DATBLK::GetCharString(char *p, int + char *vp; + + if (Dvalp) { +- Dvalp->SetValue(Typp[n]); ++ Dvalp->SetValue(UnalignedRead(n)); + vp = Dvalp->GetCharString(p); + } else + vp = TYPBLK::GetCharString(p, n); +@@ -1348,7 +1348,7 @@ void DATBLK::SetValue(PSZ p, int n) + if (Dvalp) { + // Decode the string according to format + Dvalp->SetValue_psz(p); +- Typp[n] = Dvalp->GetIntValue(); ++ UnalignedWrite(n, Dvalp->GetIntValue()); + } else + TYPBLK::SetValue(p, n); + diff --git a/packages/databases/mariadb/patches/mips/mariadb-mips-groonga-atomic.patch b/packages/databases/mariadb/patches/mips/mariadb-mips-groonga-atomic.patch new file mode 100644 index 00000000000..acf80522ddb --- /dev/null +++ b/packages/databases/mariadb/patches/mips/mariadb-mips-groonga-atomic.patch @@ -0,0 +1,28 @@ +Description: Ensure groonga is built with libatomic + MIPS (and possibly other) platforms require linking against libatomic to + support 64-bit atomic integers. Groonga was failing to do so and all related + tests were failing with an atomics relocation error on MIPS. +Author: James Cowgill +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/storage/mroonga/vendor/groonga/CMakeLists.txt ++++ b/storage/mroonga/vendor/groonga/CMakeLists.txt +@@ -234,6 +234,8 @@ endmacro() + include(build/ac_macros/check_headers.m4) + include(build/ac_macros/check_functions.m4) + ++ac_check_lib(atomic __atomic_store_8) ++ + ac_check_symbols(fpclassify math.h) + ac_check_lib(m fpclassify) + +--- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt ++++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt +@@ -62,6 +62,7 @@ endif() + set_target_properties(libgroonga PROPERTIES OUTPUT_NAME "groonga") + + set(GRN_ALL_LIBRARIES ++ ${ATOMIC_LIBS} + ${EXECINFO_LIBS} + ${RT_LIBS} + ${PTHREAD_LIBS}