diff --git a/Add-support-for-loongarch64-architecture-in-ld.hugetlbfs.patch b/Add-support-for-loongarch64-architecture-in-ld.hugetlbfs.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b21bfff2e8a085e7320948eafc8f860efefcbb5 --- /dev/null +++ b/Add-support-for-loongarch64-architecture-in-ld.hugetlbfs.patch @@ -0,0 +1,27 @@ +From 135a062d6eda37ac56eb00e3dd11de7e241d619b Mon Sep 17 00:00:00 2001 +From: wangqiang +Date: Fri, 27 Sep 2024 15:21:19 +0800 +Subject: [PATCH] Add support for loongarch64 architecture in ld.hugetlbfs + +- Added alignment configuration for loongarch64 architecture in the `ld.hugetlbfs` script. +- Set `HPAGE_SIZE` to 32MB and `SLICE_SIZE` to match `HPAGE_SIZE` for loongarch64. +- This ensures correct alignment and hugepage usage for binaries targeting loongarch64 systems. + +Fix: https://github.com/libhugetlbfs/libhugetlbfs/issues/91 +Referenc: https://github.com/llvm/llvm-project/blob/main/lld/ELF/Driver.cpp#L217 +--- + ld.hugetlbfs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ld.hugetlbfs b/ld.hugetlbfs +index 5e4e4974..1028d8e2 100755 +--- a/ld.hugetlbfs ++++ b/ld.hugetlbfs +@@ -117,6 +117,7 @@ elf64ppc|elf64lppc) + fi ;; + elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; + elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; ++elf64loongarch) HPAGE_SIZE=$((32*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; + armelf*_linux_eabi|aarch64elf*|aarch64linux*|sw_64elf*|sw_64linux*) + hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}') + HPAGE_SIZE=$((hpage_kb * 1024)) diff --git a/libhugetlbfs.spec b/libhugetlbfs.spec index 43895587afedd3097fd9c3d2d243fce88edd443e..4fbf5c89170acb6ccf5bdc086d43ae726c6225da 100644 --- a/libhugetlbfs.spec +++ b/libhugetlbfs.spec @@ -2,7 +2,7 @@ Name: libhugetlbfs Version: 2.23 -Release: 5 +Release: 6 Summary: A library which provides easy access to huge pages of memory License: LGPLv2+ URL: https://github.com/libhugetlbfs/libhugetlbfs @@ -12,6 +12,7 @@ Patch0: 0000-build_flags.patch Patch1: Disable-hugepage-backed-malloc-if-__morecore-is-not-.patch Patch2: libhugetlbfs-2.23-sw.patch Patch3: add-loongarch-support.patch +Patch4: Add-support-for-loongarch64-architecture-in-ld.hugetlbfs.patch Patch9001:libhugetlbfs-make-cflags.patch Patch9002:libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch @@ -86,6 +87,9 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf %changelog +* Tue Oct 29 2024 wangqiang - 2.23-6 +- Add support for loongarch64 architecture in ld.hugetlbfs + * Fri Sep 27 2024 wangqiang - 2.23-5 - Re-enable patch libhugetlbfs-fix-max-segment-cannot-adopt-the-x86.patch