Module Name:    src
Committed By:   kamil
Date:           Fri Jan  5 20:30:51 UTC 2018

Modified Files:
        src/lib/libc/include: namespace.h
        src/lib/libc/stdlib: atoi.c
        src/sys/external/bsd/compiler_rt/dist/lib/profile: InstrProfilingFile.c

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/stdlib/atoi.c
cvs rdiff -u -r1.1.1.4 -r1.2 \
    src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.192 src/lib/libc/include/namespace.h:1.193
--- src/lib/libc/include/namespace.h:1.192	Fri Jan  5 20:01:31 2018
+++ src/lib/libc/include/namespace.h	Fri Jan  5 20:30:51 2018
@@ -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

Index: src/lib/libc/stdlib/atoi.c
diff -u src/lib/libc/stdlib/atoi.c:1.12 src/lib/libc/stdlib/atoi.c:1.13
--- src/lib/libc/stdlib/atoi.c:1.12	Mon Jun 25 22:32:45 2012
+++ src/lib/libc/stdlib/atoi.c	Fri Jan  5 20:30:51 2018
@@ -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)
 {

Index: src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c
diff -u src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.1.1.4	Sat Feb 27 18:59:32 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c	Fri Jan  5 20:30:51 2018
@@ -7,6 +7,10 @@
 |*
 \*===----------------------------------------------------------------------===*/
 
+#ifdef _LIBC
+#include "namespace.h"
+#endif
+
 #include "InstrProfiling.h"
 #include "InstrProfilingInternal.h"
 #include "InstrProfilingUtil.h"

Reply via email to