Forum user portuquesa raised a topic (see [1]) about being unable to use
Asterisk on his armeb xscale device. We narrowed it down to sqlite3.
Asterisk was unable to insert a simple table into its db.
In short, sqlite3 assumes little endian for every ARM device. This
worked OK for 4 Byte bit (unaligned) access. But once upstream (back in
2015) added a function which accesses 2 Bytes (see [2]) this failed for
some (if not all) ARM big endian devices. ARM CPUs are bi-endian for 4
Byte reads but not for 2 Byte reads.
This patch fixes the problem by setting the endianness adequately for
ARM targets, for both 32 bit and 64 bit varieties. The patch was applied
upstream (see [3]).
[1] https://forum.openwrt.org/t/solved-asterisk13-or-15-sqlite3-database-problem/36856
[2] 329428e208
[3] https://www.sqlite.org/src/info/b7aad929619f7043
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
21 lines
975 B
Diff
21 lines
975 B
Diff
--- a/sqlite3.c
|
|
+++ b/sqlite3.c
|
|
@@ -13920,12 +13920,13 @@ typedef INT16_TYPE LogEst;
|
|
** at run-time.
|
|
*/
|
|
#ifndef SQLITE_BYTEORDER
|
|
-# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
|
|
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
|
|
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
|
|
- defined(__arm__) || defined(_M_ARM64)
|
|
+# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
|
|
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
|
|
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
|
|
+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
|
|
# define SQLITE_BYTEORDER 1234
|
|
-# elif defined(sparc) || defined(__ppc__)
|
|
+# elif defined(sparc) || defined(__ppc__) || \
|
|
+ defined(__ARMEB__) || defined(__AARCH64EB__)
|
|
# define SQLITE_BYTEORDER 4321
|
|
# else
|
|
# define SQLITE_BYTEORDER 0
|