Module Name: src Committed By: martin Date: Tue Oct 3 09:48:19 UTC 2023
Modified Files: src/libexec/ld.elf_so: rtld.c Log Message: PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so local copy of the atomic access support functions for machines that do not implement all required ops in hardware (like 32bit sparc). XXX would be better to figure out a way to share this copy with libc (thereby using half as many RAS sections). But even if we would share it, we have to init it early enough for ld.elf_so internal uses. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/libexec/ld.elf_so/rtld.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/ld.elf_so/rtld.c diff -u src/libexec/ld.elf_so/rtld.c:1.215 src/libexec/ld.elf_so/rtld.c:1.216 --- src/libexec/ld.elf_so/rtld.c:1.215 Sun Jul 30 09:20:14 2023 +++ src/libexec/ld.elf_so/rtld.c Tue Oct 3 09:48:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rtld.c,v 1.215 2023/07/30 09:20:14 riastradh Exp $ */ +/* $NetBSD: rtld.c,v 1.216 2023/10/03 09:48:18 martin Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -40,7 +40,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: rtld.c,v 1.215 2023/07/30 09:20:14 riastradh Exp $"); +__RCSID("$NetBSD: rtld.c,v 1.216 2023/10/03 09:48:18 martin Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -70,6 +70,13 @@ __RCSID("$NetBSD: rtld.c,v 1.215 2023/07 #endif /* + * Hidden function from common/lib/libc/atomic - nop on machines + * with enough atomic ops. Need to explicitly call it early. + * libc has the same symbol and will initialize itself, but not our copy. + */ +void __libc_atomic_init(void); + +/* * Function declarations. */ static void _rtld_init(caddr_t, caddr_t, const char *); @@ -404,6 +411,8 @@ _rtld_init(caddr_t mapbase, caddr_t relo ehdr = (Elf_Ehdr *)mapbase; _rtld_objself.phdr = (Elf_Phdr *)((char *)mapbase + ehdr->e_phoff); _rtld_objself.phsize = ehdr->e_phnum * sizeof(_rtld_objself.phdr[0]); + + __libc_atomic_init(); } /*