add loongarch64 support for libbsd

This commit is contained in:
Wenlong Zhang 2024-10-31 20:32:32 +08:00
parent ec64322c45
commit d2a26570c0
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From ada3c63291bd07beb0d43559ce640dc144f51558 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Thu, 31 Oct 2024 20:26:51 +0800
Subject: [PATCH] add loongarch64 support for libbsd
---
src/local-elf.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/local-elf.h b/src/local-elf.h
index f784b12..c568727 100644
--- a/src/local-elf.h
+++ b/src/local-elf.h
@@ -193,11 +193,18 @@
#define ELF_TARG_CLASS ELFCLASS32
#elif __riscv_xlen == 64
#define ELF_TARG_CLASS ELFCLASS64
+
#else
#error Unsupported ELF class
#endif
#define ELF_TARG_DATA ELFDATA2LSB
+#elif defined(__loongarch64)
+
+#define ELF_TARG_MACH EM_LOONGARCH
+#define ELF_TARG_CLASS ELFCLASS64
+#define ELF_TARG_DATA ELFDATA2LSB
+
#elif defined(__sparc__)
#if defined(__arch64__)
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: libbsd
Version: 0.10.0
Release: 1
Release: 2
Summary: Library providing BSD-compatible functions for portability
URL: http://libbsd.freedesktop.org/
License: BSD and ISC and Copyright only and Public Domain
@ -8,6 +8,7 @@ License: BSD and ISC and Copyright only and Public Domain
Source0: http://libbsd.freedesktop.org/releases/libbsd-%{version}.tar.xz
# Use symver attribute for symbol versioning
Patch1: %{name}-symver.patch
Patch2: 0001-add-loongarch64-support-for-libbsd.patch
BuildRequires: gcc
BuildRequires: autoconf automake libtool
@ -39,6 +40,7 @@ configured using "pkg-config --libs libbsd-ctor".
%setup -q
%patch1 -p1 -b .symver
%patch2 -p1
%build
autoreconf -fiv
@ -77,5 +79,8 @@ rm %{buildroot}%{_mandir}/man3/explicit_bzero.3bsd
%{_libdir}/pkgconfig/%{name}-ctor.pc
%changelog
* Thu Oct 31 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 0.10.0-2
- add loongarch64 support for libbsd
* Fri Jul 15 2022 misaka00251 <misaka00251@misakanet.cn> - 0.10.0-1
- Init package (Thanks to fedora team)