summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs
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/cmd/sgs
parentc03aa62609f1d65e84421396e8ee70875fc77b30 (diff)
downloadillumos-joyent-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/cmd/sgs')
-rw-r--r--usr/src/cmd/sgs/Makefile.var6
-rw-r--r--usr/src/cmd/sgs/libdl/Makefile.com55
-rw-r--r--usr/src/cmd/sgs/libdl/Makefile.targ40
-rw-r--r--usr/src/cmd/sgs/libdl/amd64/Makefile21
-rw-r--r--usr/src/cmd/sgs/libdl/i386/Makefile19
-rw-r--r--usr/src/cmd/sgs/libdl/sparc/Makefile33
-rw-r--r--usr/src/cmd/sgs/libdl/sparcv9/Makefile21
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/liblddbg.msg1
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/util.c3
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README3
-rw-r--r--usr/src/cmd/sgs/rtld/common/_rtld.h1
-rw-r--r--usr/src/cmd/sgs/rtld/common/audit.c27
-rw-r--r--usr/src/cmd/sgs/rtld/common/external.c30
13 files changed, 96 insertions, 164 deletions
diff --git a/usr/src/cmd/sgs/Makefile.var b/usr/src/cmd/sgs/Makefile.var
index e3239f09e1..e1f33eff45 100644
--- a/usr/src/cmd/sgs/Makefile.var
+++ b/usr/src/cmd/sgs/Makefile.var
@@ -132,12 +132,6 @@ VAR_LDDSTUB_INTERP= -I'$$ORIGIN/ld.so.1'
VAR_LIBCONV_CPPFLAGS=
#
-# libdl
-#
-VAR_LIBDL_ROOT4LINK_LIBLINKPATH= ../../lib/
-VAR_LIBDL_ETCDYNLIB=
-
-#
# libelf
#
VAR_LIBELF_LDLIBS=
diff --git a/usr/src/cmd/sgs/libdl/Makefile.com b/usr/src/cmd/sgs/libdl/Makefile.com
index 09e27433e1..90fe1ceb0e 100644
--- a/usr/src/cmd/sgs/libdl/Makefile.com
+++ b/usr/src/cmd/sgs/libdl/Makefile.com
@@ -19,57 +19,14 @@
# CDDL HEADER END
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY= libdl.a
-VERS= .1
-
-include $(SRC)/lib/Makefile.lib
-include $(SRC)/cmd/sgs/Makefile.com
-
-SRCDIR = ../common
-
-MAPFILES += mapfile-vers $(MAPFILE.FLT)
-
-# Redefine shared object build rule to use $(LD) directly (this avoids .init
-# and .fini sections being added). Also, since there are no OBJECTS, turn
-# off CTF.
-
-BUILD.SO= $(LD) -o $@ -G $(DYNFLAGS)
-CTFMERGE_LIB= :
-
-DYNFLAGS += $(ZNODUMP) $(VERSREF) $(CONVLIBDIR) -lconv
-LINTFLAGS += -u
-LINTFLAGS64 += -u
-SRCS= ../common/llib-ldl
+LIBRARY = libdl.a
+VERS = .1
-CLEANFILES +=
-CLOBBERFILES += $(DYNLIB) $(LINTLIB) $(LINTOUTS) $(LIBLINKS)
-
-
-ROOTFS_DYNLIB64= $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
-ROOTFS_LINTLIB64= $(LINTLIB:%=$(ROOTFS_LIBDIR64)/%)
-
-#
-# In the libc/libthread unified environment:
-# This library needs to be placed in /lib to allow
-# dlopen() functionality while in single-user mode.
-ROOTFS_DYNLIB= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
-ROOTFS_LINTLIB= $(LINTLIB:%=$(ROOTFS_LIBDIR)/%)
-
-$(ROOTFS_DYNLIB) := FILEMODE= 755
-$(ROOTFS_DYNLIB64) := FILEMODE= 755
-
-#
-# In the libc/libthread un-unified environment:
-# A version of this library needs to be placed in /etc/lib to allow
-# dlopen() functionality while in single-user mode.
-ETCLIBDIR= $(ROOT)/etc/lib
-ETCDYNLIB= $(DYNLIB:%=$(ETCLIBDIR)/%)
+include $(SRC)/lib/Makefile.rootfs
-$(ETCDYNLIB) := FILEMODE= 755
+LIBS += $(LINTLIB)
+MAPFILES += mapfile-vers
diff --git a/usr/src/cmd/sgs/libdl/Makefile.targ b/usr/src/cmd/sgs/libdl/Makefile.targ
deleted file mode 100644
index 95cc2d06bd..0000000000
--- a/usr/src/cmd/sgs/libdl/Makefile.targ
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# 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.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-$(ROOTFS_LIBDIR)/%: %
- $(INS.file)
-
-$(ETCLIBDIR)/%: %
- $(INS.file)
-
-delete:
- $(RM) $(DYNLIB)
-
-include $(SRC)/lib/Makefile.targ
-include $(SRC)/cmd/sgs/Makefile.targ
-
-lint: $(LINTLIB) $(SGSLINTOUT)
diff --git a/usr/src/cmd/sgs/libdl/amd64/Makefile b/usr/src/cmd/sgs/libdl/amd64/Makefile
index e2bc6ec326..90e6d5bf3a 100644
--- a/usr/src/cmd/sgs/libdl/amd64/Makefile
+++ b/usr/src/cmd/sgs/libdl/amd64/Makefile
@@ -19,25 +19,16 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
+include $(SRC)/lib/Makefile.filter.com
include ../Makefile.com
+include $(SRC)/lib/Makefile.lib.64
-CONVLIBDIR= $(CONVLIBDIR64)
-DYNFLAGS += -F /usr/lib/$(MACH64)/ld.so.1 -64
-LINTFLAGS64 += $(VAR_LINTFLAGS64)
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-include ../../Makefile.sub.64
-
-all: $(DYNLIB) $(LINTLIB)
+DYNFLAGS += -F /usr/lib/$(MACH64)/ld.so.1
-install: all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) $(ROOTFS_LINTLIB64)
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
-BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS) $(PICS)
+include $(SRC)/lib/Makefile.filter.targ
diff --git a/usr/src/cmd/sgs/libdl/i386/Makefile b/usr/src/cmd/sgs/libdl/i386/Makefile
index 9c83ff9ca9..3faec045c9 100644
--- a/usr/src/cmd/sgs/libdl/i386/Makefile
+++ b/usr/src/cmd/sgs/libdl/i386/Makefile
@@ -19,26 +19,15 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
+include $(SRC)/lib/Makefile.filter.com
include ../Makefile.com
DYNFLAGS += -F /usr/lib/ld.so.1
-.KEEP_STATE:
-
-include ../Makefile.targ
-
-
-all: $(DYNLIB) $(LINTLIB)
-
-install: all $(ROOTFS_DYNLIB) $(VAR_LIBDL_ETCDYNLIB) \
- $(ROOTFS_LINKS) \
- $(ROOTFS_LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
-$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
-$(VAR_POUND_1) $(INS.file) ../common/$(LINTLIBSRC)
+include $(SRC)/lib/Makefile.filter.targ
diff --git a/usr/src/cmd/sgs/libdl/sparc/Makefile b/usr/src/cmd/sgs/libdl/sparc/Makefile
index 9dedb74d9d..6bc95b1ea1 100644
--- a/usr/src/cmd/sgs/libdl/sparc/Makefile
+++ b/usr/src/cmd/sgs/libdl/sparc/Makefile
@@ -19,37 +19,28 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-4VERS= .0
+include $(SRC)/lib/Makefile.filter.com
include ../Makefile.com
DYNFLAGS += -F /usr/lib/ld.so.1
# A symbolic link from /usr/4lib/libdl.so.1.0 is required for BCP.
-4DYNLIB= libdl.so.1$(4VERS)
-ROOT4LIBDIR= $(ROOT)/usr/4lib
-ROOT4LINKS= $(ROOT4LIBDIR)/$(4DYNLIB)
-$(ROOT4LINKS):= LIBLINKPATH = $(VAR_LIBDL_ROOT4LINK_LIBLINKPATH)
-
-.KEEP_STATE:
+4VERS = .0
-include ../Makefile.targ
+4DYNLIB = libdl.so.1$(4VERS)
+ROOT4LIBDIR = $(ROOT)/usr/4lib
+ROOT4LINKS = $(ROOT4LIBDIR)/$(4DYNLIB)
+$(ROOT4LINKS):= LIBLINKPATH = ../../lib/
-all: $(DYNLIB) $(LINTLIB)
-
-install: all $(ROOTFS_DYNLIB) $(VAR_LIBDL_ETCDYNLIB) \
- $(ROOTFS_LINKS) $(ROOT4LINKS) \
- $(ROOTFS_LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
-
-$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
-$(VAR_POUND_1) $(INS.file) ../common/$(LINTLIBSRC)
+install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) \
+ $(ROOT4LINKS)
$(ROOT4LINKS): $(ROOTFS_DYNLIB)
- $(INS.liblink)
+ $(INS.liblink)
+
+include $(SRC)/lib/Makefile.filter.targ
diff --git a/usr/src/cmd/sgs/libdl/sparcv9/Makefile b/usr/src/cmd/sgs/libdl/sparcv9/Makefile
index e2bc6ec326..90e6d5bf3a 100644
--- a/usr/src/cmd/sgs/libdl/sparcv9/Makefile
+++ b/usr/src/cmd/sgs/libdl/sparcv9/Makefile
@@ -19,25 +19,16 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
+include $(SRC)/lib/Makefile.filter.com
include ../Makefile.com
+include $(SRC)/lib/Makefile.lib.64
-CONVLIBDIR= $(CONVLIBDIR64)
-DYNFLAGS += -F /usr/lib/$(MACH64)/ld.so.1 -64
-LINTFLAGS64 += $(VAR_LINTFLAGS64)
-
-.KEEP_STATE:
-
-include ../Makefile.targ
-include ../../Makefile.sub.64
-
-all: $(DYNLIB) $(LINTLIB)
+DYNFLAGS += -F /usr/lib/$(MACH64)/ld.so.1
-install: all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) $(ROOTFS_LINTLIB64)
+install: all $(ROOTLIBDIR64) .WAIT $(ROOTLIBS64) $(ROOTLINKS64)
-BUILD.SO= $(LD) -o $@ -G -64 $(DYNFLAGS) $(PICS)
+include $(SRC)/lib/Makefile.filter.targ
diff --git a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
index acf7fad9ba..558e1a3c28 100644
--- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
+++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
@@ -1562,6 +1562,7 @@
@ MSG_CI_TLS_MODREM "TLS_MODREM"
@ MSG_CI_TLS_STATMOD "TLS_STATMOD"
@ MSG_CI_THRINIT "THRINIT"
+@ MSG_CI_CRITICAL "CRITICAL"
# TLS information flags
diff --git a/usr/src/cmd/sgs/liblddbg/common/util.c b/usr/src/cmd/sgs/liblddbg/common/util.c
index 04d669ebd1..02de483a82 100644
--- a/usr/src/cmd/sgs/liblddbg/common/util.c
+++ b/usr/src/cmd/sgs/liblddbg/common/util.c
@@ -290,7 +290,8 @@ static const Msg tags[] = {
MSG_CI_TLS_MODADD, /* MSG_ORIG(MSG_CI_TLS_MODADD) */
MSG_CI_TLS_MODREM, /* MSG_ORIG(MSG_CI_TLS_MODREM) */
MSG_CI_TLS_STATMOD, /* MSG_ORIG(MSG_CI_TLS_STATMOD) */
- MSG_CI_THRINIT /* MSG_ORIG(MSG_CI_THRINIT) */
+ MSG_CI_THRINIT, /* MSG_ORIG(MSG_CI_THRINIT) */
+ MSG_CI_CRITICAL /* MSG_ORIG(MSG_CI_CRITICAL) */
};
void
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index d7c897c6c4..b46a2806c5 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1475,3 +1475,6 @@ Bugid Risk Synopsis
6577982 ld.so.1 calls getpid() before it should when any LD_* are set
6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
6831285 linker LD_DEBUG support needs improvements
+6806791 filter builds could be optimized (link-editor components only)
+6823371 calloc() uses suboptimal memset() causing 15% regression in SpecCPU2006
+ gcc code (link-editor components only)
diff --git a/usr/src/cmd/sgs/rtld/common/_rtld.h b/usr/src/cmd/sgs/rtld/common/_rtld.h
index ff9589dd16..aa3355ffa0 100644
--- a/usr/src/cmd/sgs/rtld/common/_rtld.h
+++ b/usr/src/cmd/sgs/rtld/common/_rtld.h
@@ -690,6 +690,7 @@ extern void remove_lml(Lm_list *);
extern void remove_plist(Alist **, int);
extern void remove_so(Lm_list *, Rt_map *);
extern int rt_cond_wait(Rt_cond *, Rt_lock *);
+extern int rt_critical(void);
extern int rt_bind_guard(int);
extern int rt_bind_clear(int);
extern int rt_get_extern(Lm_list *, Rt_map *);
diff --git a/usr/src/cmd/sgs/rtld/common/audit.c b/usr/src/cmd/sgs/rtld/common/audit.c
index 4415ea082f..87a18b89ca 100644
--- a/usr/src/cmd/sgs/rtld/common/audit.c
+++ b/usr/src/cmd/sgs/rtld/common/audit.c
@@ -116,6 +116,9 @@ audit_objfilter(Rt_map *frlmp, const char *ref, Rt_map *felmp, uint_t flags)
{
int appl = 0, respond = 1;
+ if (rt_critical())
+ return (respond);
+
if ((rtld_flags & RT_FL_APPLIC) == 0)
appl = rtld_flags |= RT_FL_APPLIC;
@@ -171,6 +174,9 @@ audit_objsearch(Rt_map *clmp, const char *name, uint_t flags)
char *nname = (char *)name;
int appl = 0;
+ if (rt_critical())
+ return (nname);
+
if ((rtld_flags & RT_FL_APPLIC) == 0)
appl = rtld_flags |= RT_FL_APPLIC;
@@ -247,6 +253,9 @@ audit_activity(Rt_map *clmp, uint_t flags)
{
int appl = 0;
+ if (rt_critical())
+ return;
+
if ((rtld_flags & RT_FL_APPLIC) == 0)
appl = rtld_flags |= RT_FL_APPLIC;
@@ -335,6 +344,9 @@ audit_objopen(Rt_map *clmp, Rt_map *nlmp)
uint_t clients = 0;
Audit_info *aip;
+ if (rt_critical())
+ return (respond);
+
/*
* Determine the total number of audit libraries in use. This provides
* the number of client structures required for this object.
@@ -416,6 +428,9 @@ audit_objclose(Rt_map *clmp, Rt_map *lmp)
{
int appl = 0;
+ if (rt_critical())
+ return;
+
if ((rtld_flags & RT_FL_APPLIC) == 0)
appl = rtld_flags |= RT_FL_APPLIC;
@@ -489,6 +504,9 @@ audit_pltenter(Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx,
Sym _sym = *sym;
int _appl = 0;
+ if (rt_critical())
+ return (_sym.st_value);
+
/*
* We're effectively entering ld.so.1 from user (glue) code.
*/
@@ -561,6 +579,9 @@ audit_pltexit(uintptr_t retval, Rt_map *rlmp, Rt_map *dlmp, Sym *sym,
uintptr_t _retval = retval;
int _appl = 0;
+ if (rt_critical())
+ return (_retval);
+
/*
* We're effectively entering ld.so.1 from user (glue) code.
*/
@@ -667,6 +688,9 @@ audit_symbind(Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx, Addr value,
_sym = *sym;
_sym.st_value = value;
+ if (rt_critical())
+ return (_sym.st_value);
+
#if !defined(_ELF64)
_sym.st_name += (Word)STRTAB(dlmp);
#endif
@@ -723,6 +747,9 @@ audit_preinit(Rt_map *clmp)
{
int appl = 0;
+ if (rt_critical())
+ return;
+
if ((rtld_flags & RT_FL_APPLIC) == 0)
appl = rtld_flags |= RT_FL_APPLIC;
diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c
index 709918c7b3..713a9d5be5 100644
--- a/usr/src/cmd/sgs/rtld/common/external.c
+++ b/usr/src/cmd/sgs/rtld/common/external.c
@@ -151,6 +151,15 @@
* this interface (and no longer relies on the INITFIRST flag - which
* others have started to camp out on).
*
+ * CI_VERSION == 5 (Solaris 11).
+ * Use of "protected" references within libc, so that symbols are
+ * pre-bound, and don't require ld.so.1 binding. This implementation
+ * protects libc's critical regions from being vectored to auditors.
+ *
+ * CI_VERSION == 6 (Solaris 11).
+ * Added the CI_CRITICAL handshake, to allow "mem*" family to be reexposed
+ * as "global", and thus be redirected to auxiliary filters.
+ *
* Release summary:
*
* Solaris 8 CI_ATEXIT via _ld_libc()
@@ -286,6 +295,7 @@ get_lcinterface(Rt_map *lmp, Lc_interface *funcs)
case CI_BIND_GUARD:
case CI_BIND_CLEAR:
case CI_THR_SELF:
+ case CI_CRITICAL:
/*
* If the global vector is unset, or this is the primary
* link-map, set the global vector.
@@ -500,18 +510,34 @@ rt_thr_self()
}
int
-rt_mutex_lock(Rt_lock * mp)
+rt_mutex_lock(Rt_lock *mp)
{
return (_lwp_mutex_lock((lwp_mutex_t *)mp));
}
int
-rt_mutex_unlock(Rt_lock * mp)
+rt_mutex_unlock(Rt_lock *mp)
{
return (_lwp_mutex_unlock((lwp_mutex_t *)mp));
}
/*
+ * Test whether we're in a libc critical region. Certain function references,
+ * like the "mem*" family, might require binding. Although these functions can
+ * safely bind to auxiliary filtees, they should not be captured by auditors.
+ */
+int
+rt_critical()
+{
+ int (*fptr)(void);
+
+ if ((fptr = glcs[CI_CRITICAL].lc_un.lc_func) != NULL)
+ return ((*fptr)());
+
+ return (0);
+}
+
+/*
* Mutex interfaces to resolve references from any objects extracted from
* libc_pic.a. Note, as ld.so.1 is essentially single threaded these can be
* noops.