klibc-bot for Ben Hutchings
2025-Mar-04 03:12 UTC
[klibc] [klibc:master] mips64: Set executable base address to fix link failure on R6
Commit-ID: 9fa5e02e9ef9feae43b0a0e9eec54c90d3b5f913 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=9fa5e02e9ef9feae43b0a0e9eec54c90d3b5f913 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Tue, 4 Mar 2025 02:58:18 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Tue, 4 Mar 2025 03:05:56 +0100 [klibc] mips64: Set executable base address to fix link failure on R6 It appears that at some point the GNU tools started using a different default base address for MIPS64 R6 executables; at least this is what I see with the Debian-provided cross-toolchain. This resulted in klibc.so being too far away from the executable for regular jumps to work. Add an explicit linker option to set the base address to the value we expect. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/klibc/arch/mips64/MCONFIG | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr/klibc/arch/mips64/MCONFIG b/usr/klibc/arch/mips64/MCONFIG index e078dad7..6ac4afe1 100644 --- a/usr/klibc/arch/mips64/MCONFIG +++ b/usr/klibc/arch/mips64/MCONFIG @@ -11,10 +11,14 @@ KLIBCARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 KLIBCOPTFLAGS += -Os KLIBCBITSIZE = 64 +# Normal binaries historically started at 0x120000000 (4608 MiB), +# but this may vary between toolchain versions and targets. To be +# safe, we set that base address explicitly. +KLIBCLDFLAGS = $(LD_IMAGE_BASE_OPT) 0x120000000 + # Extra linkflags when building the shared version of the library # This address needs to be reachable using normal inter-module # calls, and work on the memory models for this architecture. -# Normal binaries start at 0x120000000 (4608 MiB). # * On R5 and earlier, non-PIC jumps usually use the JAL instruction # which requires a destination within the same 256 MiB aligned # region. Since we can't put ourselves below the normal load