From f492b34a694a4bf40e075a030c01f360eaa5500e Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Fri, 27 May 2022 09:41:38 +0800
Subject: [PATCH] add default machine name to support loongarch

---
 lib/rpmrc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 120777c..bd0dbca 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -1242,6 +1242,13 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
 	}
 #	endif	/* riscv */
 
+#       if defined(__linux__) && defined(__loongarch__)
+            if (sizeof(long) == 4)
+                    strcpy(un.machine, "loongarch32");
+            else if (sizeof(long) == 8)
+                    strcpy(un.machine, "loongarch64");
+#       endif   /* loongarch */
+
 #	if defined(__GNUC__) && defined(__alpha__)
 	{
 	    unsigned long amask, implver;
-- 
2.27.0

