[PATCH v3 09/29] loongarch: Add <bits/pagesize.h>

Xi Ruoyao xry111@xry111.site
Sun Sep 29 17:35:30 GMT 2024


On Sun, 2024-09-29 at 18:12 +0200, Florian Weimer wrote:
> According to arch/loongarch/Kconfig in the kernel sources, LoongArch
> supports 4 KiB, 16 KiB, and 64 KiB page sizes.

As reported
at https://github.com/loongson-community/discussions/issues/47, 64KiB
configuration currently does not work at all because ld sets an
insufficient alignment in the program header:

  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000850 0x0000000000000850  R E    0x4000
  LOAD           0x0000000000003df8 0x0000000000007df8 0x0000000000007df8
                 0x0000000000000230 0x0000000000000238  RW     0x4000

So to me we should either raise the alignment to 0x10000, or remove the
64 KiB page support to simplify the code everywhere.

How do you think?

> Note: The entire series runs into a GCC compilation problem on
> LoongArch, which appears to be a GCC bug:
> 
>   Section type conflict on loongarch with .data.rel.ro section attribute
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116887

I'm taking a look.  But still we should try to work around it on the
Glibc side.  Otherwise even if we fix it for GCC we'd still need to
raise the required GCC version to the leading edge, and doing so is bad
for users and distro maintainers.

> ---
>  sysdeps/loongarch/bits/pagesize.h | 2 ++
>  1 file changed, 2 insertions(+)
>  create mode 100644 sysdeps/loongarch/bits/pagesize.h
> 
> diff --git a/sysdeps/loongarch/bits/pagesize.h
> b/sysdeps/loongarch/bits/pagesize.h
> new file mode 100644
> index 0000000000..cd688d3fb0
> --- /dev/null
> +++ b/sysdeps/loongarch/bits/pagesize.h
> @@ -0,0 +1,2 @@
> +#define __GLIBC_PAGE_SHIFT_MIN 12
> +#define __GLIBC_PAGE_SHIFT_MAX 16

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Libc-alpha mailing list