Module Name:    src
Committed By:   snj
Date:           Tue Aug  6 15:06:47 UTC 2024

Modified Files:
        src/libexec/ld.elf_so [netbsd-10]: rtld.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #775):
        libexec/ld.elf_so/rtld.c: 1.216
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.212.2.3 -r1.212.2.4 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.212.2.3 src/libexec/ld.elf_so/rtld.c:1.212.2.4
--- src/libexec/ld.elf_so/rtld.c:1.212.2.3	Tue Aug  1 17:03:53 2023
+++ src/libexec/ld.elf_so/rtld.c	Tue Aug  6 15:06:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.212.2.3 2023/08/01 17:03:53 martin Exp $	 */
+/*	$NetBSD: rtld.c,v 1.212.2.4 2024/08/06 15:06:47 snj Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.212.2.3 2023/08/01 17:03:53 martin Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.212.2.4 2024/08/06 15:06:47 snj Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -70,6 +70,13 @@ __RCSID("$NetBSD: rtld.c,v 1.212.2.3 202
 #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();
 }
 
 /*

Reply via email to