]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
LoongArch: Default to a maximum page size of 64KiB
authorWANG Xuerui <git@xen0n.name>
Sat, 19 Oct 2024 14:11:52 +0000 (22:11 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Tue, 10 Dec 2024 01:14:30 +0000 (09:14 +0800)
commitc2dbc2929e87557f8bc030f6f010d67b19f99f12
tree8daf731d20b5859597ed798d04a9d58111316b21
parentacaec6533785f3beb88a3cb8a48aaa5c0b88781a
LoongArch: Default to a maximum page size of 64KiB

As per the spec (Section 7.5.10, LoongArch Reference Manual Vol. 1),
LoongArch machines are not limited in page size choices, and currently
page sizes of 4KiB, 16KiB and 64KiB are supported by mainline Linux.
While 16KiB is the most common, the current BFD code says it is the
maximum; this is not correct, and as an effect, almost all existing
binaries are incompatible with a 64KiB kernel because the sections are
not sufficiently aligned, while being totally fine otherwise.
This is needlessly complicating integration testing [1].

This patch fixes the inconsistency, and also brings BFD behavior in line
with that of LLD [2].

[1] https://github.com/loongson-community/discussions/issues/47
[2] https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/lld/ELF/Arch/LoongArch.cpp#L174-L183

bfd/
* elfnn-loongarch.c (ELF_MAXPAGESIZE): Bump to 64KiB.
(ELF_MINPAGESIZE): Define as 4KiB.
(ELF_COMMONPAGESIZE): Define as 16KiB.

ld/
* testsuite/ld-loongarch-elf/64_pcrel.d: Update assertions after
changing the target max page size to 64KiB.
* testsuite/ld-loongarch-elf/data-got.d: Likewise.
* testsuite/ld-loongarch-elf/desc-relex.d: Likewise.
* testsuite/ld-loongarch-elf/relax-align-ignore-start.d: Likewise.
* testsuite/ld-loongarch-elf/tlsdesc_abs.d: Make the fuzzy match work
as intended by not checking exact instruction words.
* testsuite/ld-loongarch-elf/tlsdesc_extreme.d: Likewise.

Signed-off-by: WANG Xuerui <git@xen0n.name>
bfd/ChangeLog
bfd/elfnn-loongarch.c
ld/ChangeLog
ld/testsuite/ld-loongarch-elf/64_pcrel.d
ld/testsuite/ld-loongarch-elf/data-got.d
ld/testsuite/ld-loongarch-elf/desc-relax.d
ld/testsuite/ld-loongarch-elf/relax-align-ignore-start.d
ld/testsuite/ld-loongarch-elf/tlsdesc_abs.d
ld/testsuite/ld-loongarch-elf/tlsdesc_extreme.d