summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc
diff options
context:
space:
mode:
authorRod Evans <Rod.Evans@Sun.COM>2009-05-07 16:01:18 -0700
committerRod Evans <Rod.Evans@Sun.COM>2009-05-07 16:01:18 -0700
commit2a8d6eba033e4713ab12b61178f0513f1f075482 (patch)
tree0fd82f40b89008aa56426a55126371550f5b2309 /usr/src/lib/libc
parentc03aa62609f1d65e84421396e8ee70875fc77b30 (diff)
downloadillumos-gate-2a8d6eba033e4713ab12b61178f0513f1f075482.tar.gz
6806791 filter builds could be optimized
6823371 calloc() uses suboptimal memset() causing 15% regression in SpecCPU2006 gcc code --HG-- rename : usr/src/lib/libkrb5/common/mapfile => usr/src/lib/libkrb5/common/mapfile-vers
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r--usr/src/lib/libc/amd64/mapfile-vers16
-rw-r--r--usr/src/lib/libc/i386/mapfile-vers16
-rw-r--r--usr/src/lib/libc/inc/libc_int.h12
-rw-r--r--usr/src/lib/libc/inc/lint.h31
-rw-r--r--usr/src/lib/libc/port/threads/thr.c19
-rw-r--r--usr/src/lib/libc/port/threads/thread_interface.c12
-rw-r--r--usr/src/lib/libc/sparc/mapfile-vers-aux4
-rw-r--r--usr/src/lib/libc/sparc_hwcap1/sparc/mapfile-vers-aux4
-rw-r--r--usr/src/lib/libc/sparc_hwcap1/sparcv9/mapfile-vers-aux4
-rw-r--r--usr/src/lib/libc/sparcv9/mapfile-vers-aux4
10 files changed, 80 insertions, 42 deletions
diff --git a/usr/src/lib/libc/amd64/mapfile-vers b/usr/src/lib/libc/amd64/mapfile-vers
index 5cd5be235a..7c759736c1 100644
--- a/usr/src/lib/libc/amd64/mapfile-vers
+++ b/usr/src/lib/libc/amd64/mapfile-vers
@@ -107,6 +107,10 @@ SUNW_0.7 {
malloc = NODIRECT;
modf = FUNCTION FILTER libm.so.2;
_modf = FUNCTION FILTER libm.so.2;
+ memcmp;
+ memcpy;
+ memmove;
+ memset;
nextafter = FUNCTION FILTER libm.so.2;
_nextafter = FUNCTION FILTER libm.so.2;
_numeric;
@@ -400,12 +404,8 @@ SUNW_0.7 {
memccpy;
_memccpy;
memchr;
- memcmp;
memcntl;
_memcntl;
- memcpy;
- memmove;
- memset;
mkdir;
_mkdir;
mkfifo;
@@ -750,6 +750,10 @@ SUNWprivate_1.1 {
_dlopen = FUNCTION FILTER /usr/lib/amd64/ld.so.1;
_dlsym = FUNCTION FILTER /usr/lib/amd64/ld.so.1;
_ld_libc = FUNCTION FILTER /usr/lib/amd64/ld.so.1;
+ _memcmp;
+ _memcpy;
+ _memmove;
+ _memset;
protected:
_D_cplx_lr_div;
_D_cplx_lr_div_ix;
@@ -759,10 +763,6 @@ SUNWprivate_1.1 {
_F_cplx_lr_div_rx;
__fltrounds;
__fseterror_u;
- _memcmp;
- _memcpy;
- _memmove;
- _memset;
sysi86;
_sysi86;
_X_cplx_div;
diff --git a/usr/src/lib/libc/i386/mapfile-vers b/usr/src/lib/libc/i386/mapfile-vers
index 019a4ba265..c54c1b3d14 100644
--- a/usr/src/lib/libc/i386/mapfile-vers
+++ b/usr/src/lib/libc/i386/mapfile-vers
@@ -285,6 +285,10 @@ SYSVABI_1.3 {
ldexp = FUNCTION FILTER libm.so.2;
logb = FUNCTION FILTER libm.so.2;
malloc = NODIRECT;
+ memcmp;
+ memcpy;
+ memmove;
+ memset;
modf = FUNCTION FILTER libm.so.2;
_modf = FUNCTION FILTER libm.so.2;
nextafter = FUNCTION FILTER libm.so.2;
@@ -541,12 +545,8 @@ SYSVABI_1.3 {
memccpy;
_memccpy;
memchr;
- memcmp;
memcntl;
_memcntl;
- memcpy;
- memmove;
- memset;
mkdir;
_mkdir;
mkfifo;
@@ -861,6 +861,10 @@ SUNWprivate_1.1 {
_dlopen = FUNCTION FILTER /usr/lib/ld.so.1;
_dlsym = FUNCTION FILTER /usr/lib/ld.so.1;
_ld_libc = FUNCTION FILTER /usr/lib/ld.so.1;
+ _memcmp;
+ _memcpy;
+ _memmove;
+ _memset;
_sse_hw;
_sys_errlist;
_sys_errs;
@@ -885,10 +889,6 @@ SUNWprivate_1.1 {
_fwscanf_c89;
_imaxabs_c89;
_imaxdiv_c89;
- _memcmp;
- _memcpy;
- _memmove;
- _memset;
__moddi3;
_printf_c89;
_scanf_c89;
diff --git a/usr/src/lib/libc/inc/libc_int.h b/usr/src/lib/libc/inc/libc_int.h
index 3cb5be036d..940636b49c 100644
--- a/usr/src/lib/libc/inc/libc_int.h
+++ b/usr/src/lib/libc/inc/libc_int.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBC_INT_H
#define _LIBC_INT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -47,8 +45,9 @@ extern "C" {
#define CI_TLS_MODREM 8 /* __tls_mod_remove() address */
#define CI_TLS_STATMOD 9 /* __tls_static_mods() address */
#define CI_THRINIT 10 /* libc thread initialization */
+#define CI_CRITICAL 11 /* critical level query interface */
-#define CI_MAX 11
+#define CI_MAX 12
#define CI_V_NONE 0 /* ci_version versions */
#define CI_V_ONE 1 /* original version */
@@ -56,8 +55,9 @@ extern "C" {
#define CI_V_THREE 3
#define CI_V_FOUR 4
#define CI_V_FIVE 5
-#define CI_V_CURRENT CI_V_FIVE /* current version of libc interface */
-#define CI_V_NUM 6 /* number of CI_V_* numbers */
+#define CI_V_SIX 6
+#define CI_V_CURRENT CI_V_SIX /* current version of libc interface */
+#define CI_V_NUM 7 /* number of CI_V_* numbers */
/*
* Flags for the bindguard routines.
diff --git a/usr/src/lib/libc/inc/lint.h b/usr/src/lib/libc/inc/lint.h
index d031a250c5..99a1d1ab83 100644
--- a/usr/src/lib/libc/inc/lint.h
+++ b/usr/src/lib/libc/inc/lint.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBC_LINT_H
#define _LIBC_LINT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -53,6 +51,33 @@ extern "C" {
#define syscall _syscall6
#define __systemcall __systemcall6
+/*
+ * Shades of the old and deprecated "synonyms.h" file.
+ * Because of the awkward relationship between these functions:
+ * memcmp()
+ * memcpy()
+ * memmove()
+ * memset()
+ * and the sparc auxiliary filters:
+ * /platform/.../lib/libc_psr.so.1
+ * we must be careful always to call the leading-underscore
+ * symbol names when calling from within libc itself.
+ *
+ * If an interposer interposes on these mem*() symbol names,
+ * and we call one of them from within a critical region in libc,
+ * we will end up in the interposer code while executing within
+ * the critical region. Chaos can ensue.
+ *
+ * We try to avoid this by calling only the leading-underscore names.
+ * We hope that no interposer will interpose on the leading-underscore
+ * versions of these functions, else all hope is lost.
+ */
+
+#pragma redefine_extname memcmp _memcmp
+#pragma redefine_extname memcpy _memcpy
+#pragma redefine_extname memmove _memmove
+#pragma redefine_extname memset _memset
+
#endif
#ifdef __cplusplus
diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c
index fdcf549f26..bfad10c06a 100644
--- a/usr/src/lib/libc/port/threads/thr.c
+++ b/usr/src/lib/libc/port/threads/thr.c
@@ -2191,8 +2191,8 @@ _ti_bind_guard(int flags)
if ((self->ul_bindflags & bindflag) == bindflag)
return (0);
+ self->ul_bindflags |= bindflag;
if ((flags & (THR_FLG_NOLOCK | THR_FLG_REENTER)) == THR_FLG_NOLOCK) {
- ASSERT(self->ul_critical == 0);
sigoff(self); /* see no signals while holding ld_lock */
(void) mutex_lock(&udp->ld_lock);
}
@@ -2200,7 +2200,6 @@ _ti_bind_guard(int flags)
self->ul_save_state = self->ul_cancel_disabled;
self->ul_cancel_disabled = 1;
set_cancel_pending_flag(self, 0);
- self->ul_bindflags |= bindflag;
return (1);
}
@@ -2218,7 +2217,6 @@ _ti_bind_clear(int flags)
set_cancel_pending_flag(self, 0);
exit_critical(self);
if ((flags & (THR_FLG_NOLOCK | THR_FLG_REENTER)) == THR_FLG_NOLOCK) {
- ASSERT(self->ul_critical == 0);
if (MUTEX_OWNED(&udp->ld_lock, self)) {
(void) mutex_unlock(&udp->ld_lock);
sigon(self); /* reenable signals */
@@ -2228,6 +2226,21 @@ _ti_bind_clear(int flags)
}
/*
+ * Tell the dynamic linker (ld.so.1) whether or not it was entered from
+ * a critical region in libc. Return zero if not, else return non-zero.
+ */
+int
+_ti_critical(void)
+{
+ ulwp_t *self = curthread;
+ int level = self->ul_critical;
+
+ if ((self->ul_bindflags & THR_FLG_RTLD) == 0 || level == 0)
+ return (level); /* ld.so.1 hasn't (yet) called enter() */
+ return (level - 1);
+}
+
+/*
* sigoff() and sigon() enable cond_wait() to behave (optionally) like
* it does in the old libthread (see the comments in cond_wait_queue()).
* Also, signals are deferred at thread startup until TLS constructors
diff --git a/usr/src/lib/libc/port/threads/thread_interface.c b/usr/src/lib/libc/port/threads/thread_interface.c
index c4dc1964e7..0cfa07e89c 100644
--- a/usr/src/lib/libc/port/threads/thread_interface.c
+++ b/usr/src/lib/libc/port/threads/thread_interface.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,19 +18,19 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include "thr_uberdata.h"
extern int _ti_bind_guard();
extern int _ti_bind_clear();
extern int _ti_thr_self();
+extern int _ti_critical();
/*
* This is the array of interface functions passed to
@@ -42,5 +41,6 @@ const Lc_interface rtld_funcs[] = {
{CI_BIND_GUARD, (int(*)())_ti_bind_guard},
{CI_BIND_CLEAR, (int(*)())_ti_bind_clear},
{CI_THR_SELF, (int(*)())_ti_thr_self},
+ {CI_CRITICAL, (int(*)())_ti_critical},
{CI_NULL, (int(*)())NULL}
};
diff --git a/usr/src/lib/libc/sparc/mapfile-vers-aux b/usr/src/lib/libc/sparc/mapfile-vers-aux
index 5184d84744..9465efdfa6 100644
--- a/usr/src/lib/libc/sparc/mapfile-vers-aux
+++ b/usr/src/lib/libc/sparc/mapfile-vers-aux
@@ -38,7 +38,7 @@
#
SYSVABI_1.3 {
- protected:
+ global:
memcmp = AUXILIARY /platform/$PLATFORM/lib/libc_psr.so.1;
memcpy = AUXILIARY /platform/$PLATFORM/lib/libc_psr.so.1;
memmove = AUXILIARY /platform/$PLATFORM/lib/libc_psr.so.1;
@@ -46,7 +46,7 @@ SYSVABI_1.3 {
};
SUNWprivate_1.1 {
- protected:
+ global:
_memcmp = AUXILIARY /platform/$PLATFORM/lib/libc_psr.so.1;
_memcpy = AUXILIARY /platform/$PLATFORM/lib/libc_psr.so.1;
_memcpy = NODYNSORT;
diff --git a/usr/src/lib/libc/sparc_hwcap1/sparc/mapfile-vers-aux b/usr/src/lib/libc/sparc_hwcap1/sparc/mapfile-vers-aux
index 1f7d3269c4..b9a85d01db 100644
--- a/usr/src/lib/libc/sparc_hwcap1/sparc/mapfile-vers-aux
+++ b/usr/src/lib/libc/sparc_hwcap1/sparc/mapfile-vers-aux
@@ -38,7 +38,7 @@
#
SYSVABI_1.3 {
- protected:
+ global:
memcmp;
memcpy;
memmove;
@@ -46,7 +46,7 @@ SYSVABI_1.3 {
};
SUNWprivate_1.1 {
- protected:
+ global:
_memcmp;
_memcpy = NODYNSORT;
_memmove;
diff --git a/usr/src/lib/libc/sparc_hwcap1/sparcv9/mapfile-vers-aux b/usr/src/lib/libc/sparc_hwcap1/sparcv9/mapfile-vers-aux
index 821f767d1b..001d2feeb9 100644
--- a/usr/src/lib/libc/sparc_hwcap1/sparcv9/mapfile-vers-aux
+++ b/usr/src/lib/libc/sparc_hwcap1/sparcv9/mapfile-vers-aux
@@ -38,7 +38,7 @@
#
SUNW_0.7 {
- protected:
+ global:
memcmp;
memcpy;
memmove;
@@ -46,7 +46,7 @@ SUNW_0.7 {
};
SUNWprivate_1.1 {
- protected:
+ global:
_memcmp;
_memcpy = NODYNSORT;
_memmove;
diff --git a/usr/src/lib/libc/sparcv9/mapfile-vers-aux b/usr/src/lib/libc/sparcv9/mapfile-vers-aux
index 5fca166609..9c1bd8aca8 100644
--- a/usr/src/lib/libc/sparcv9/mapfile-vers-aux
+++ b/usr/src/lib/libc/sparcv9/mapfile-vers-aux
@@ -38,7 +38,7 @@
#
SUNW_0.7 {
- protected:
+ global:
memcmp = AUXILIARY /platform/$PLATFORM/lib/sparcv9/libc_psr.so.1;
memcpy = AUXILIARY /platform/$PLATFORM/lib/sparcv9/libc_psr.so.1;
memmove = AUXILIARY /platform/$PLATFORM/lib/sparcv9/libc_psr.so.1;
@@ -46,7 +46,7 @@ SUNW_0.7 {
};
SUNWprivate_1.1 {
- protected:
+ global:
_memcmp = AUXILIARY /platform/$PLATFORM/lib/sparcv9/libc_psr.so.1;
_memcpy = AUXILIARY /platform/$PLATFORM/lib/sparcv9/libc_psr.so.1;
_memcpy = NODYNSORT;