From 8fe8fef3274d006bd01900b8aee838c229e81cbd Mon Sep 17 00:00:00 2001
From: mahailiang <mahailiang@uniontech.com>
Date: Thu, 7 Nov 2024 09:46:14 +0800
Subject: [PATCH] add sw64 support

---
 configure.ac           | 2 +-
 src/unexelf.c          | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ad1068a..dce63ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -740,7 +740,7 @@ case "${canonical}" in
   *-apple-darwin* )
     case "${canonical}" in
       *-apple-darwin[0-9].*) unported=yes ;;
-      i[3456]86-* | x86_64-* | arm-* | aarch64-* )  ;;
+      i[3456]86-* | x86_64-* | arm-* | sw_64-* | aarch64-* )  ;;
       * )            unported=yes ;;
     esac
     opsys=darwin
diff --git a/src/unexelf.c b/src/unexelf.c
index 607ac0c..da5cbd6 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -120,7 +120,7 @@ typedef struct {
 /*
  * NetBSD does not have normal-looking user-land ELF support.
  */
-# if defined __alpha__ || defined __sparc_v9__ || defined _LP64
+# if defined __alpha__ || defined __sparc_v9__ || defined _LP64 || defined __sw_64__
 #  define ELFSIZE	64
 # else
 #  define ELFSIZE	32
@@ -150,6 +150,12 @@ typedef struct {
 #  define pHDRR		HDRR *
 # endif /* __alpha__ */
 
+# ifdef __sw_64__
+#  include <sys/exec_ecoff.h>
+#  define HDRR		struct ecoff_symhdr
+#  define pHDRR		HDRR *
+# endif /* __sw_64__ */
+
 #ifdef __mips__			/* was in pkgsrc patches for 20.7 */
 # define SHT_MIPS_DEBUG	DT_MIPS_FLAGS
 # define HDRR		struct Elf_Shdr
-- 
2.39.3

