summaryrefslogtreecommitdiffstats
path: root/debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:23:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:23:08 +0000
commit25161eab0977cf62f77af868be3fc698888776ea (patch)
treeea9037f8066dfc7c0a7d7b898822a56fec71c324 /debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch
parentAdding upstream version 110.0.1. (diff)
downloadfirefox-25161eab0977cf62f77af868be3fc698888776ea.tar.xz
firefox-25161eab0977cf62f77af868be3fc698888776ea.zip
Adding debian version 110.0.1-1.debian/110.0.1-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch')
-rw-r--r--debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch b/debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch
new file mode 100644
index 0000000000..ab77ccdf9c
--- /dev/null
+++ b/debian/patches/porting/Use-compiler-macros-to-detect-big-endian.patch
@@ -0,0 +1,68 @@
+From: Mike Hommey <mh@glandium.org>
+Date: Wed, 15 Feb 2023 08:44:19 +0900
+Subject: Use compiler macros to detect big endian
+
+Both clang and GCC define endianness as builtin defines.
+---
+ third_party/wasm2c/src/common.h | 8 ++++++++
+ third_party/wasm2c/src/prebuilt/wasm2c.include.c | 8 ++++++++
+ third_party/wasm2c/src/wasm2c.c.tmpl | 8 ++++++++
+ 3 files changed, 24 insertions(+)
+
+diff --git a/third_party/wasm2c/src/common.h b/third_party/wasm2c/src/common.h
+index de5e44a..c4eb760 100644
+--- a/third_party/wasm2c/src/common.h
++++ b/third_party/wasm2c/src/common.h
+@@ -103,6 +103,14 @@
+ #define PRIaddress PRIu64
+ #define PRIoffset PRIzx
+
++#ifndef WABT_BIG_ENDIAN
++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
++# define WABT_BIG_ENDIAN 1
++# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
++# define WABT_BIG_ENDIAN 0
++# endif
++#endif
++
+ namespace wabt {
+ #if WABT_BIG_ENDIAN
+ inline void MemcpyEndianAware(void *dst, const void *src, size_t dsize, size_t ssize, size_t doff, size_t soff, size_t len) {
+diff --git a/third_party/wasm2c/src/prebuilt/wasm2c.include.c b/third_party/wasm2c/src/prebuilt/wasm2c.include.c
+index de62978..5040afa 100644
+--- a/third_party/wasm2c/src/prebuilt/wasm2c.include.c
++++ b/third_party/wasm2c/src/prebuilt/wasm2c.include.c
+@@ -113,6 +113,14 @@ const char SECTION_NAME(declarations)[] =
+ "#define wasm_asm(X)\n"
+ "#endif\n"
+ "\n"
++"#ifndef WABT_BIG_ENDIAN\n"
++"# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n"
++"# define WABT_BIG_ENDIAN 1\n"
++"# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__\n"
++"# define WABT_BIG_ENDIAN 0\n"
++"# endif\n"
++"#endif\n"
++"\n"
+ "#if WABT_BIG_ENDIAN\n"
+ "static inline void load_data(void *dest, const void *src, size_t n) {\n"
+ " size_t i = 0;\n"
+diff --git a/third_party/wasm2c/src/wasm2c.c.tmpl b/third_party/wasm2c/src/wasm2c.c.tmpl
+index 6539ddc..990bb2f 100644
+--- a/third_party/wasm2c/src/wasm2c.c.tmpl
++++ b/third_party/wasm2c/src/wasm2c.c.tmpl
+@@ -110,6 +110,14 @@ void WASM2C_MALLOC_FAIL_CALLBACK(u32 ptr_size);
+ #define wasm_asm(X)
+ #endif
+
++#ifndef WABT_BIG_ENDIAN
++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
++# define WABT_BIG_ENDIAN 1
++# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
++# define WABT_BIG_ENDIAN 0
++# endif
++#endif
++
+ #if WABT_BIG_ENDIAN
+ static inline void load_data(void *dest, const void *src, size_t n) {
+ size_t i = 0;