Date: Thu, 06 Aug 2026 15:01:29 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e1070148f676 - stable/15 - linker: Recognize SHT_INIT_ARRAY sections as constructor sections Message-ID: <6a74a1c9.471c6.1083c615@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e1070148f676876e224e63502dc51b69358aea33 commit e1070148f676876e224e63502dc51b69358aea33 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-07-15 14:59:22 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-08-06 12:52:28 +0000 linker: Recognize SHT_INIT_ARRAY sections as constructor sections We do this already for ET_REL files, but it was missed here. Note that this function operates only on dynamically loaded files, not on preloaded files. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58245 (cherry picked from commit 83181995593ac61796d7be63dcb241f5d80faa73) --- sys/kern/link_elf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 4c77f444d961..d12495504c81 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -1306,8 +1306,9 @@ link_elf_load_file(linker_class_t cls, const char* filename, if (shdr[i].sh_type == SHT_SYMTAB) { symtabindex = i; symstrindex = shdr[i].sh_link; - } else if (shstrs != NULL && shdr[i].sh_name != 0 && - strcmp(shstrs + shdr[i].sh_name, ".ctors") == 0) { + } else if ((shstrs != NULL && shdr[i].sh_name != 0 && + strcmp(shstrs + shdr[i].sh_name, ".ctors") == 0) || + shdr[i].sh_type == SHT_INIT_ARRAY) { /* Record relocated address and size of .ctors. */ lf->ctors_addr = mapbase + shdr[i].sh_addr - base_vaddr; lf->ctors_size = shdr[i].sh_size;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a74a1c9.471c6.1083c615>
