[glibc] Revert "tests: Remove target-specific huge-page size definition for THP-aware load segment alignment
Adhemerval Zanella via Glibc-cvs <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dfacfbbdbb2bb408e2c505f05b0eb2933c41b472 commit dfacfbbdbb2bb408e2c505f05b0eb2933c41b472 Author: Adhemerval Zanella <[email protected]> Date: Mon Aug 24 13:45:53 2026 -0300 Revert "tests: Remove target-specific huge-page size definition for THP-aware load segment alignment" This reverts commit 224cb4a8ddd60d989790ab3da0e145c70be0a421. The change broke the build of some THP tests on arc and or1k [1]. [1] https://sourceware.org/pipermail/libc-testresults/2026q3/014918.html Diff: --- sysdeps/unix/sysv/linux/Makefile | 16 ++++++++++------ sysdeps/unix/sysv/linux/loongarch/Makefile | 3 +++ sysdeps/unix/sysv/linux/sparc/Makefile | 5 +++++ sysdeps/unix/sysv/linux/tst-thp-size.S | 4 +--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 34856a3b2f..14a56d5cc3 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -730,17 +730,21 @@ tests-special += \ # tests-special endif +ifndef THP-PAGE-SIZE # Align PT_LOAD segments in THP tests to THP page size so that kernel will -# map PIE to the address aligned to THP page size. The maximum THP size we -# support to align the load segments (and we skip the tests with even -# larger THP) is 32 MiB. -THP-PAGE-SIZE-LDFLAGS = -Wl,-z,max-page-size=0x2000000 +# map PIE to the address aligned to THP page size. Default THP page size +# to 2MB which can be overridden in Makefile in subdirectories. +THP-PAGE-SIZE = 0x200000 +endif + +THP-PAGE-SIZE-CFLAGS = -DTHP_PAGE_SIZE=$(THP-PAGE-SIZE) +THP-PAGE-SIZE-LDFLAGS = -Wl,-z,max-page-size=$(THP-PAGE-SIZE) -# -Wl,-z,max-page-size=0x2000000 alone doesn't work for PDE when +# -Wl,-z,max-page-size=$(THP-PAGE-SIZE) alone doesn't work for PDE when # text-segment address is lower than the maximum page size: # https://sourceware.org/bugzilla/show_bug.cgi?id=34184 ifneq (,$(load-address-ldflag)) -LOAD-THP-ADDRESS-LDFLAGS = $(load-address-ldflag)=0x2000000 +LOAD-THP-ADDRESS-LDFLAGS = $(load-address-ldflag)=$(THP-PAGE-SIZE) endif LDFLAGS-tst-thp-size-mod.so = -Wl,-z,noseparate-code \ diff --git a/sysdeps/unix/sysv/linux/loongarch/Makefile b/sysdeps/unix/sysv/linux/loongarch/Makefile index 0d5f087862..d5beb62440 100644 --- a/sysdeps/unix/sysv/linux/loongarch/Makefile +++ b/sysdeps/unix/sysv/linux/loongarch/Makefile @@ -12,3 +12,6 @@ abi-ilp32s-condition := __WORDSIZE == 32 && defined __loongarch_soft_float abi-ilp32d-condition := __WORDSIZE == 32 && defined __loongarch_double_float abi-lp64s-condition := __WORDSIZE == 64 && defined __loongarch_soft_float abi-lp64d-condition := __WORDSIZE == 64 && defined __loongarch_double_float + +# Align THP tests to 32MB. +THP-PAGE-SIZE = 0x2000000 diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile index e0056c9413..57e73d0a14 100644 --- a/sysdeps/unix/sysv/linux/sparc/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/Makefile @@ -14,3 +14,8 @@ endif ifeq ($(subdir),signal) sysdep_routines += sigreturn_stub endif + +ifeq ($(subdir),elf) +# The sparc64 uses an 8KB base page and 8MB PMD transparent huge page +THP-PAGE-SIZE = 0x800000 +endif diff --git a/sysdeps/unix/sysv/linux/tst-thp-size.S b/sysdeps/unix/sysv/linux/tst-thp-size.S index 154b167509..29c5f4e750 100644 --- a/sysdeps/unix/sysv/linux/tst-thp-size.S +++ b/sysdeps/unix/sysv/linux/tst-thp-size.S @@ -17,6 +17,4 @@ <https://www.gnu.org/licenses/>. */ .text - /* 64 MiB, twice of MAX_THP_PAGESIZE in dl-map-segment-align.h and - tst-thp-align.c */ - .space 0x4000000 + .space 2 * THP_PAGE_SIZE