Source-Changes-HG archive

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

[src/trunk]: src/lib/libc Register dl_iterate_phdr in the libc's namespace.h



details:   https://anonhg.NetBSD.org/src/rev/418278bbbfad
branches:  trunk
changeset: 358525:418278bbbfad
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jan 05 19:29:44 2018 +0000

description:
Register dl_iterate_phdr in the libc's namespace.h

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Stop using the public global name of dl_iterate_phdr in tls/tls.c:
__libc_static_tls_setup().

Follow the approach with other dlopen(3)-like functions with the
namespace.h in the dl_iterate_phdr() case. Use internally a weak symbol:
__dl_iterate_phdr instead of dl_iterate_phdr.

Sponsored by <The NetBSD Foundation>

diffstat:

 lib/libc/dlfcn/dlfcn_elf.c   |  5 +++--
 lib/libc/include/namespace.h |  3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 40479a994ee6 -r 418278bbbfad lib/libc/dlfcn/dlfcn_elf.c
--- a/lib/libc/dlfcn/dlfcn_elf.c        Fri Jan 05 19:01:36 2018 +0000
+++ b/lib/libc/dlfcn/dlfcn_elf.c        Fri Jan 05 19:29:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dlfcn_elf.c,v 1.14 2017/07/11 15:21:35 joerg Exp $     */
+/*     $NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $     */
 
 /*
  * Copyright (c) 2000 Takuya SHIOZAKI
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: dlfcn_elf.c,v 1.14 2017/07/11 15:21:35 joerg Exp $");
+__RCSID("$NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -38,6 +38,7 @@
 #include <string.h>
 #include <stdbool.h>
 
+#undef dl_iterate_phdr
 #undef dlopen
 #undef dlclose
 #undef dlsym
diff -r 40479a994ee6 -r 418278bbbfad lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Fri Jan 05 19:01:36 2018 +0000
+++ b/lib/libc/include/namespace.h      Fri Jan 05 19:29:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.190 2018/01/05 18:57:06 kamil Exp $    */
+/*     $NetBSD: namespace.h,v 1.191 2018/01/05 19:29:44 kamil Exp $    */
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -926,6 +926,7 @@
 #define yperr_string           _yperr_string
 #define ypprot_err             _ypprot_err
 #define yp_setbindtries                _yp_setbindtries
+#define dl_iterate_phdr                __dl_iterate_phdr
 #define dlopen                 __dlopen
 #define dlclose                        __dlclose
 #define dlsym                  __dlsym



Home | Main Index | Thread Index | Old Index