Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/lib/libc/misc Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/31510e1f323b
branches:  netbsd-8
changeset: 850740:31510e1f323b
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Jun 21 17:46:02 2017 +0000

description:
Pull up following revision(s) (requested by joerg in ticket #44):
        lib/libc/misc/initfini.c: revision 1.14
PR 51654: Don't initialize _dlauxinfo for static binaries.
Emacs likes save all memory of the main binary and the first run of
_libc_init via .init will get the wrong (old) value of __ps_strings.
By avoiding the initialization of _dlauxinfo for shared applications,
it will be touched only by the _libc_init call from crt0.o itself,
at which point __ps_strings is correct.

diffstat:

 lib/libc/misc/initfini.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r bf0c3751e97b -r 31510e1f323b lib/libc/misc/initfini.c
--- a/lib/libc/misc/initfini.c  Wed Jun 21 17:43:32 2017 +0000
+++ b/lib/libc/misc/initfini.c  Wed Jun 21 17:46:02 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: initfini.c,v 1.13 2016/11/26 21:17:06 dholland Exp $    */
+/*     $NetBSD: initfini.c,v 1.13.6.1 2017/06/21 17:46:02 snj Exp $     */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: initfini.c,v 1.13 2016/11/26 21:17:06 dholland Exp $");
+__RCSID("$NetBSD: initfini.c,v 1.13.6.1 2017/06/21 17:46:02 snj Exp $");
 
 #ifdef _LIBC
 #include "namespace.h"
@@ -58,6 +58,7 @@
 static void *__libc_dlauxinfo;
 
 void *___dlauxinfo(void) __pure;
+__weakref_visible void * real_dlauxinfo(void) __weak_reference(_dlauxinfo);
 
 void *
 ___dlauxinfo(void)
@@ -107,7 +108,8 @@
 
        libc_initialised = 1;
 
-       if (__ps_strings != NULL)
+       /* Only initialize _dlauxinfo for static binaries. */
+       if (__ps_strings != NULL && real_dlauxinfo == ___dlauxinfo)
                __libc_dlauxinfo = __ps_strings->ps_argvstr +
                    __ps_strings->ps_nargvstr + __ps_strings->ps_nenvstr + 2;
 



Home | Main Index | Thread Index | Old Index