diff --git a/srcpkgs/libunwind/patches/mips-musl.patch b/srcpkgs/libunwind/patches/mips-musl.patch index b2bd99e78e8..6dac3d0789b 100644 --- a/srcpkgs/libunwind/patches/mips-musl.patch +++ b/srcpkgs/libunwind/patches/mips-musl.patch @@ -1,11 +1,10 @@ --- src/mips/getcontext.S.orig +++ src/mips/getcontext.S -@@ -24,7 +24,7 @@ +@@ -24,7 +24,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "offsets.h" -#include -+#include .text diff --git a/srcpkgs/libunwind/patches/mips-read_write_s32.patch b/srcpkgs/libunwind/patches/mips-read_write_s32.patch new file mode 100644 index 00000000000..d61d4b2cb52 --- /dev/null +++ b/srcpkgs/libunwind/patches/mips-read_write_s32.patch @@ -0,0 +1,52 @@ +--- include/tdep-mips/libunwind_i.h 2020-11-10 17:14:01.000000000 +0100 ++++ include/tdep-mips/libunwind_i.h 2021-01-11 22:12:16.993539625 +0100 +@@ -148,9 +148,10 @@ + static inline int + read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val) + { +- int offset = addr & 4; + int ret; + unw_word_t memval; ++#if _MIPS_SIM == _ABI64 ++ int offset = addr & 4; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) +@@ -160,6 +161,13 @@ + *val = (int32_t) memval; + else + *val = (int32_t) (memval >> 32); ++#else ++ ret = (*c->as->acc.access_mem) (c->as, addr, &memval, 0, c->as_arg); ++ if (ret < 0) ++ return ret; ++ ++ *val = (int32_t) memval; ++#endif + + return 0; + } +@@ -167,9 +175,10 @@ + static inline int + write_s32 (struct dwarf_cursor *c, unw_word_t addr, const unw_word_t *val) + { +- int offset = addr & 4; +- int ret; + unw_word_t memval; ++#if _MIPS_SIM == _ABI64 ++ int offset = addr & 4; ++ int ret; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) +@@ -181,6 +190,10 @@ + memval = (memval & 0xffffffffLL) | (uint32_t) (*val << 32); + + return (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 1, c->as_arg); ++#else ++ memval = (uint32_t) *val; ++ return (*c->as->acc.access_mem) (c->as, addr, &memval, 1, c->as_arg); ++#endif + } + + /* FIXME: Implement these for the MIPS FPU. */ diff --git a/srcpkgs/libunwind/template b/srcpkgs/libunwind/template index 67bd6303e01..3ef73d90d5b 100644 --- a/srcpkgs/libunwind/template +++ b/srcpkgs/libunwind/template @@ -19,6 +19,7 @@ case "$XBPS_TARGET_MACHINE" in i686-musl) LDFLAGS=" -lssp_nonshared" ;; ppc64*-musl) makedepends+=" libucontext-devel"; LDFLAGS=" -lucontext" ;; ppc*-musl) makedepends+=" libucontext-devel"; LDFLAGS=" -lucontext -lssp_nonshared" ;; + mips*-musl) CLAGS="-D_MIPS_SIM=_ABI32" ;; *) ;; esac