git: d4e02f74fe8d - stable/12 - rtld-elf: Fix for mips with LLD 14+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Dec 2024 00:30:03 UTC
The branch stable/12 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=d4e02f74fe8de9acbb5370d66b5d507200f2ff42 commit d4e02f74fe8de9acbb5370d66b5d507200f2ff42 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2024-12-13 00:18:33 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2024-12-13 00:29:50 +0000 rtld-elf: Fix for mips with LLD 14+ As of LLD 14, it no longer falls back to the address of .text if it can't find the entry point, and instead just uses address 0. Since the mips port has always used rtld_start as its entry point symbol but has never set RTLD_ENTRY to match (instead getting the default .rtld_start), with LLD 14+ it ends up using an entry point of 0, i.e. reinterpreting various headers and metadata sections as code, and thus quickly dies, in my case with SIGILL. This has seemingly always been a warning with LLD even when it defaulted to .text, but that went unnoticed this whole time, until now. Fix this by specifying the right symbol name. This is a direct commit to stable/13 as mips no longer exists in main. (cherry picked from commit d7bf409a63501a28357a9a9ec24628e1208d530d) --- libexec/rtld-elf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index dfa6d4e6b85e..5604cb80a6e7 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -37,6 +37,8 @@ RTLD_ARCH= ${MACHINE_CPUARCH} CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} .if ${MACHINE_ARCH} == "powerpc64" LDFLAGS+= -nostdlib -e _rtld_start +.elif ${MACHINE_CPUARCH} == "mips" +LDFLAGS+= -nostdlib -e rtld_start .else LDFLAGS+= -nostdlib -e .rtld_start .endif