Source-Changes-HG archive

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

[src/trunk]: src Register new weak symbol in libc for internal usage: atoi



details:   https://anonhg.NetBSD.org/src/rev/a50fd5545055
branches:  trunk
changeset: 358527:a50fd5545055
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jan 05 20:30:51 2018 +0000

description:
Register new weak symbol in libc for internal usage: atoi

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.

Add atoi to namespace.h.

Register a new __weak_alias() entry for atoi() in atoi.c.

atoi() is used internally in getrpcent(), rresvport_af(), ftok(), err(),
__llvm_profile_write_file(), llvm_gcda_start_file(), citrus_iconv_open(),
getprotoent_r(), __rpc_uaddr2taddr_af(), __res_nopt_rdata() and
servent_parseline().

This revision switches the internal usage to the internal symbol.

Sponsored by <The NetBSD Foundation>

diffstat:

 lib/libc/include/namespace.h                                       |   3 ++-
 lib/libc/stdlib/atoi.c                                             |  10 ++++++++--
 sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c |   4 ++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diffs (61 lines):

diff -r 8d3a5a74155e -r a50fd5545055 lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Fri Jan 05 20:01:31 2018 +0000
+++ b/lib/libc/include/namespace.h      Fri Jan 05 20:30:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.192 2018/01/05 20:01:31 kamil Exp $    */
+/*     $NetBSD: namespace.h,v 1.193 2018/01/05 20:30:51 kamil Exp $    */
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -217,6 +217,7 @@
 #define asprintf_l             _asprintf_l
 #define asysctl                        _asysctl
 #define asysctlbyname          _asysctlbyname
+#define atoi                   _atoi
 #define atoll                  _atoll
 #define authnone_create                _authnone_create
 #define authunix_create                _authunix_create
diff -r 8d3a5a74155e -r a50fd5545055 lib/libc/stdlib/atoi.c
--- a/lib/libc/stdlib/atoi.c    Fri Jan 05 20:01:31 2018 +0000
+++ b/lib/libc/stdlib/atoi.c    Fri Jan 05 20:30:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atoi.c,v 1.12 2012/06/25 22:32:45 abs Exp $    */
+/*     $NetBSD: atoi.c,v 1.13 2018/01/05 20:30:51 kamil Exp $  */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,13 +34,19 @@
 #if 0
 static char sccsid[] = "@(#)atoi.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: atoi.c,v 1.12 2012/06/25 22:32:45 abs Exp $");
+__RCSID("$NetBSD: atoi.c,v 1.13 2018/01/05 20:30:51 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
+
 #include <assert.h>
 #include <stdlib.h>
 
+#ifdef __weak_alias
+__weak_alias(atoi,_atoi)
+#endif
+
 int
 atoi(const char *str)
 {
diff -r 8d3a5a74155e -r a50fd5545055 sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c
--- a/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c        Fri Jan 05 20:01:31 2018 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c        Fri Jan 05 20:30:51 2018 +0000
@@ -7,6 +7,10 @@
 |*
 \*===----------------------------------------------------------------------===*/
 
+#ifdef _LIBC
+#include "namespace.h"
+#endif
+
 #include "InstrProfiling.h"
 #include "InstrProfilingInternal.h"
 #include "InstrProfilingUtil.h"



Home | Main Index | Thread Index | Old Index