6316708 LD_DEBUG should provide a means of identifying/isolating individual
authorrie
Tue, 14 Mar 2006 09:22:52 -0800
changeset 1618 8c9a4f31d225
parent 1617 12ce27916e2c
child 1619 b29a07d0220d
6316708 LD_DEBUG should provide a means of identifying/isolating individual link-map lists 6280209 elfdump cores on memory model 0x3 6197234 elfdump and dump don't handle 64-bit symbols correctly
deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile
deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile.targ
deleted_files/usr/src/cmd/sgs/libelf/spec/amd64/Makefile
deleted_files/usr/src/cmd/sgs/libelf/spec/elf.spec
deleted_files/usr/src/cmd/sgs/libelf/spec/elf32.spec
deleted_files/usr/src/cmd/sgs/libelf/spec/elf64.spec
deleted_files/usr/src/cmd/sgs/libelf/spec/gelf.spec
deleted_files/usr/src/cmd/sgs/libelf/spec/i386/Makefile
deleted_files/usr/src/cmd/sgs/libelf/spec/sparc/Makefile
deleted_files/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile
deleted_files/usr/src/cmd/sgs/libelf/spec/versions
deleted_files/usr/src/cmd/sgs/libelf/spec/weak.spec
deleted_files/usr/src/cmd/sgs/librtld_db/common/lintsup.c
usr/src/Targetdirs
usr/src/cmd/sgs/Makefile
usr/src/cmd/sgs/Makefile.com
usr/src/cmd/sgs/Makefile.sub
usr/src/cmd/sgs/Makefile.sub.64
usr/src/cmd/sgs/Makefile.targ
usr/src/cmd/sgs/Makefile.var
usr/src/cmd/sgs/crle/Makefile.com
usr/src/cmd/sgs/crle/common/print.c
usr/src/cmd/sgs/dump/Makefile.com
usr/src/cmd/sgs/dump/Makefile.targ
usr/src/cmd/sgs/dump/amd64/Makefile
usr/src/cmd/sgs/dump/common/dump.c
usr/src/cmd/sgs/dump/i386/Makefile
usr/src/cmd/sgs/dump/sparc/Makefile
usr/src/cmd/sgs/dump/sparcv9/Makefile
usr/src/cmd/sgs/elfdump/Makefile
usr/src/cmd/sgs/elfdump/Makefile.com
usr/src/cmd/sgs/elfdump/Makefile.targ
usr/src/cmd/sgs/elfdump/amd64/Makefile
usr/src/cmd/sgs/elfdump/common/_elfdump.h
usr/src/cmd/sgs/elfdump/common/elfdump.c
usr/src/cmd/sgs/elfdump/common/elfdump.msg
usr/src/cmd/sgs/elfdump/common/lintsup.c
usr/src/cmd/sgs/elfdump/common/main.c
usr/src/cmd/sgs/elfdump/common/mapfile-vers
usr/src/cmd/sgs/elfdump/i386/Makefile
usr/src/cmd/sgs/elfdump/sparc/Makefile
usr/src/cmd/sgs/elfdump/sparcv9/Makefile
usr/src/cmd/sgs/include/conv.h
usr/src/cmd/sgs/include/debug.h
usr/src/cmd/sgs/include/i386/machdep.h
usr/src/cmd/sgs/include/libld.h
usr/src/cmd/sgs/include/rtld.h
usr/src/cmd/sgs/include/sgs.h
usr/src/cmd/sgs/include/sparc/machdep.h
usr/src/cmd/sgs/ld/Makefile
usr/src/cmd/sgs/ld/Makefile.com
usr/src/cmd/sgs/ld/Makefile.targ
usr/src/cmd/sgs/ld/amd64/Makefile
usr/src/cmd/sgs/ld/common/ld.c
usr/src/cmd/sgs/ld/common/ld.msg
usr/src/cmd/sgs/ld/common/lintsup.c
usr/src/cmd/sgs/ld/common/mapfile-vers
usr/src/cmd/sgs/ld/sparcv9/Makefile
usr/src/cmd/sgs/ldd/Makefile.com
usr/src/cmd/sgs/libconv/Makefile
usr/src/cmd/sgs/libconv/Makefile.com
usr/src/cmd/sgs/libconv/Makefile.targ
usr/src/cmd/sgs/libconv/amd64/Makefile
usr/src/cmd/sgs/libconv/common/_conv.h
usr/src/cmd/sgs/libconv/common/arch.c
usr/src/cmd/sgs/libconv/common/cap.c
usr/src/cmd/sgs/libconv/common/config.c
usr/src/cmd/sgs/libconv/common/config.msg
usr/src/cmd/sgs/libconv/common/data.c
usr/src/cmd/sgs/libconv/common/data.msg
usr/src/cmd/sgs/libconv/common/deftag.c
usr/src/cmd/sgs/libconv/common/deftag.msg
usr/src/cmd/sgs/libconv/common/demangle.c
usr/src/cmd/sgs/libconv/common/demangle.msg
usr/src/cmd/sgs/libconv/common/dl.c
usr/src/cmd/sgs/libconv/common/dwarf_ehe.c
usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg
usr/src/cmd/sgs/libconv/common/dynamic.c
usr/src/cmd/sgs/libconv/common/dynamic.msg
usr/src/cmd/sgs/libconv/common/elf.c
usr/src/cmd/sgs/libconv/common/elf.msg
usr/src/cmd/sgs/libconv/common/globals.c
usr/src/cmd/sgs/libconv/common/globals.msg
usr/src/cmd/sgs/libconv/common/group.c
usr/src/cmd/sgs/libconv/common/group.msg
usr/src/cmd/sgs/libconv/common/lddstub.c
usr/src/cmd/sgs/libconv/common/lddstub.msg
usr/src/cmd/sgs/libconv/common/llib-lconv
usr/src/cmd/sgs/libconv/common/phdr.c
usr/src/cmd/sgs/libconv/common/phdr.msg
usr/src/cmd/sgs/libconv/common/relocate.c
usr/src/cmd/sgs/libconv/common/relocate_amd64.c
usr/src/cmd/sgs/libconv/common/relocate_i386.c
usr/src/cmd/sgs/libconv/common/relocate_sparc.c
usr/src/cmd/sgs/libconv/common/sections.c
usr/src/cmd/sgs/libconv/common/segments.c
usr/src/cmd/sgs/libconv/common/segments.msg
usr/src/cmd/sgs/libconv/common/symbols.c
usr/src/cmd/sgs/libconv/common/symbols.msg
usr/src/cmd/sgs/libconv/common/symbols_sparc.c
usr/src/cmd/sgs/libconv/common/symbols_sparc.msg
usr/src/cmd/sgs/libconv/common/tokens.c
usr/src/cmd/sgs/libconv/common/version.c
usr/src/cmd/sgs/libconv/i386/Makefile
usr/src/cmd/sgs/libconv/sparc/Makefile
usr/src/cmd/sgs/libconv/sparcv9/Makefile
usr/src/cmd/sgs/libcrle/amd64/Makefile
usr/src/cmd/sgs/libcrle/common/dump.c
usr/src/cmd/sgs/libcrle/i386/Makefile
usr/src/cmd/sgs/libcrle/sparc/Makefile
usr/src/cmd/sgs/libcrle/sparcv9/Makefile
usr/src/cmd/sgs/libelf/Makefile
usr/src/cmd/sgs/libelf/Makefile.com
usr/src/cmd/sgs/libelf/Makefile.targ
usr/src/cmd/sgs/libelf/Makefile.targ.64
usr/src/cmd/sgs/libelf/amd64/Makefile
usr/src/cmd/sgs/libelf/common/lintsup.c
usr/src/cmd/sgs/libelf/common/mapfile-32
usr/src/cmd/sgs/libelf/common/mapfile-common
usr/src/cmd/sgs/libelf/common/xlate.m4
usr/src/cmd/sgs/libelf/common/xlate64.m4
usr/src/cmd/sgs/libelf/i386/Makefile
usr/src/cmd/sgs/libelf/sparc/Makefile
usr/src/cmd/sgs/libelf/sparcv9/Makefile
usr/src/cmd/sgs/libelf/spec/Makefile
usr/src/cmd/sgs/libelf/spec/Makefile.targ
usr/src/cmd/sgs/libelf/spec/amd64/Makefile
usr/src/cmd/sgs/libelf/spec/elf.spec
usr/src/cmd/sgs/libelf/spec/elf32.spec
usr/src/cmd/sgs/libelf/spec/elf64.spec
usr/src/cmd/sgs/libelf/spec/gelf.spec
usr/src/cmd/sgs/libelf/spec/i386/Makefile
usr/src/cmd/sgs/libelf/spec/sparc/Makefile
usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile
usr/src/cmd/sgs/libelf/spec/versions
usr/src/cmd/sgs/libelf/spec/weak.spec
usr/src/cmd/sgs/libld/Makefile
usr/src/cmd/sgs/libld/Makefile.com
usr/src/cmd/sgs/libld/Makefile.targ
usr/src/cmd/sgs/libld/amd64/Makefile
usr/src/cmd/sgs/libld/amd64/amd64unwind.c
usr/src/cmd/sgs/libld/amd64/machrel.c
usr/src/cmd/sgs/libld/common/_libld.h
usr/src/cmd/sgs/libld/common/args.c
usr/src/cmd/sgs/libld/common/debug.c
usr/src/cmd/sgs/libld/common/entry.c
usr/src/cmd/sgs/libld/common/exit.c
usr/src/cmd/sgs/libld/common/files.c
usr/src/cmd/sgs/libld/common/globals.c
usr/src/cmd/sgs/libld/common/groups.c
usr/src/cmd/sgs/libld/common/ldentry.c
usr/src/cmd/sgs/libld/common/ldlibs.c
usr/src/cmd/sgs/libld/common/ldmain.c
usr/src/cmd/sgs/libld/common/libld.chk.msg
usr/src/cmd/sgs/libld/common/libld.msg
usr/src/cmd/sgs/libld/common/libld.sparc.msg
usr/src/cmd/sgs/libld/common/libs.c
usr/src/cmd/sgs/libld/common/lintsup.c
usr/src/cmd/sgs/libld/common/llib-lld
usr/src/cmd/sgs/libld/common/machrel.amd.c
usr/src/cmd/sgs/libld/common/machrel.intel.c
usr/src/cmd/sgs/libld/common/machrel.sparc.c
usr/src/cmd/sgs/libld/common/machsym.intel.c
usr/src/cmd/sgs/libld/common/machsym.sparc.c
usr/src/cmd/sgs/libld/common/map.c
usr/src/cmd/sgs/libld/common/mapfile-vers
usr/src/cmd/sgs/libld/common/order.c
usr/src/cmd/sgs/libld/common/outfile.c
usr/src/cmd/sgs/libld/common/place.c
usr/src/cmd/sgs/libld/common/relocate.c
usr/src/cmd/sgs/libld/common/resolve.c
usr/src/cmd/sgs/libld/common/sections.c
usr/src/cmd/sgs/libld/common/sunwmove.c
usr/src/cmd/sgs/libld/common/support.c
usr/src/cmd/sgs/libld/common/syms.c
usr/src/cmd/sgs/libld/common/unwind.amd.c
usr/src/cmd/sgs/libld/common/update.c
usr/src/cmd/sgs/libld/common/util.c
usr/src/cmd/sgs/libld/common/version.c
usr/src/cmd/sgs/libld/i386/Makefile
usr/src/cmd/sgs/libld/i386/machrel.c
usr/src/cmd/sgs/libld/i386/machsym.c
usr/src/cmd/sgs/libld/sparc/Makefile
usr/src/cmd/sgs/libld/sparc/machrel.c
usr/src/cmd/sgs/libld/sparc/machsym.c
usr/src/cmd/sgs/libld/sparcv9/Makefile
usr/src/cmd/sgs/liblddbg/Makefile
usr/src/cmd/sgs/liblddbg/Makefile.com
usr/src/cmd/sgs/liblddbg/Makefile.targ
usr/src/cmd/sgs/liblddbg/amd64/Makefile
usr/src/cmd/sgs/liblddbg/common/_debug.h
usr/src/cmd/sgs/liblddbg/common/_synonyms.h
usr/src/cmd/sgs/liblddbg/common/args.c
usr/src/cmd/sgs/liblddbg/common/audit.c
usr/src/cmd/sgs/liblddbg/common/bindings.c
usr/src/cmd/sgs/liblddbg/common/cap.c
usr/src/cmd/sgs/liblddbg/common/debug.c
usr/src/cmd/sgs/liblddbg/common/dynamic.c
usr/src/cmd/sgs/liblddbg/common/elf.c
usr/src/cmd/sgs/liblddbg/common/entry.c
usr/src/cmd/sgs/liblddbg/common/files.c
usr/src/cmd/sgs/liblddbg/common/got.c
usr/src/cmd/sgs/liblddbg/common/liblddbg.msg
usr/src/cmd/sgs/liblddbg/common/libs.c
usr/src/cmd/sgs/liblddbg/common/lintsup.c
usr/src/cmd/sgs/liblddbg/common/llib-llddbg
usr/src/cmd/sgs/liblddbg/common/map.c
usr/src/cmd/sgs/liblddbg/common/mapfile-vers
usr/src/cmd/sgs/liblddbg/common/move.c
usr/src/cmd/sgs/liblddbg/common/phdr.c
usr/src/cmd/sgs/liblddbg/common/relocate.c
usr/src/cmd/sgs/liblddbg/common/sections.c
usr/src/cmd/sgs/liblddbg/common/segments.c
usr/src/cmd/sgs/liblddbg/common/shdr.c
usr/src/cmd/sgs/liblddbg/common/statistics.c
usr/src/cmd/sgs/liblddbg/common/support.c
usr/src/cmd/sgs/liblddbg/common/syminfo.c
usr/src/cmd/sgs/liblddbg/common/syms.c
usr/src/cmd/sgs/liblddbg/common/tls.c
usr/src/cmd/sgs/liblddbg/common/unused.c
usr/src/cmd/sgs/liblddbg/common/util.c
usr/src/cmd/sgs/liblddbg/common/version.c
usr/src/cmd/sgs/liblddbg/i386/Makefile
usr/src/cmd/sgs/liblddbg/sparc/Makefile
usr/src/cmd/sgs/liblddbg/sparcv9/Makefile
usr/src/cmd/sgs/libldstab/Makefile.com
usr/src/cmd/sgs/librtld/Makefile.com
usr/src/cmd/sgs/librtld/amd64/Makefile
usr/src/cmd/sgs/librtld/amd64/_relocate.c
usr/src/cmd/sgs/librtld/common/_librtld.h
usr/src/cmd/sgs/librtld/common/dldump.c
usr/src/cmd/sgs/librtld/common/dynamic.c
usr/src/cmd/sgs/librtld/common/mapfile-32-vers
usr/src/cmd/sgs/librtld/common/mapfile-64-vers
usr/src/cmd/sgs/librtld/common/mapfile-vers
usr/src/cmd/sgs/librtld/i386/Makefile
usr/src/cmd/sgs/librtld/i386/_relocate.c
usr/src/cmd/sgs/librtld/sparc/Makefile
usr/src/cmd/sgs/librtld/sparc/_relocate.c
usr/src/cmd/sgs/librtld/sparcv9/Makefile
usr/src/cmd/sgs/librtld/sparcv9/_relocate.c
usr/src/cmd/sgs/librtld_db/Makefile.com
usr/src/cmd/sgs/librtld_db/Makefile.targ
usr/src/cmd/sgs/librtld_db/amd64/Makefile
usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c
usr/src/cmd/sgs/librtld_db/common/_rtld_db.h
usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg
usr/src/cmd/sgs/librtld_db/common/librtld_db.msg
usr/src/cmd/sgs/librtld_db/common/librtld_db.sparc.msg
usr/src/cmd/sgs/librtld_db/common/librtld_db.sparcv9.msg
usr/src/cmd/sgs/librtld_db/common/lintsup.c
usr/src/cmd/sgs/librtld_db/i386/Makefile
usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c
usr/src/cmd/sgs/librtld_db/sparc/Makefile
usr/src/cmd/sgs/librtld_db/sparcv9/Makefile
usr/src/cmd/sgs/link_audit/Makefile.com
usr/src/cmd/sgs/link_audit/amd64/Makefile
usr/src/cmd/sgs/link_audit/i386/Makefile
usr/src/cmd/sgs/link_audit/sparc/Makefile
usr/src/cmd/sgs/link_audit/sparcv9/Makefile
usr/src/cmd/sgs/mcs/Makefile.com
usr/src/cmd/sgs/mcs/Makefile.targ
usr/src/cmd/sgs/mcs/common/file.c
usr/src/cmd/sgs/mcs/common/message.c
usr/src/cmd/sgs/moe/Makefile.com
usr/src/cmd/sgs/nm/common/nm.c
usr/src/cmd/sgs/packages/Makefile
usr/src/cmd/sgs/packages/Makefile.lint
usr/src/cmd/sgs/packages/common/SUNWonld-README
usr/src/cmd/sgs/packages/common/prototype_com
usr/src/cmd/sgs/packages/common/prototype_i386
usr/src/cmd/sgs/packages/common/prototype_sparc
usr/src/cmd/sgs/packages/inc.flg
usr/src/cmd/sgs/pvs/Makefile.com
usr/src/cmd/sgs/pvs/amd64/Makefile
usr/src/cmd/sgs/pvs/common/lintsup.c
usr/src/cmd/sgs/pvs/common/mapfile-vers
usr/src/cmd/sgs/pvs/common/pvs.c
usr/src/cmd/sgs/pvs/common/pvs.msg
usr/src/cmd/sgs/pvs/sparcv9/Makefile
usr/src/cmd/sgs/rtld/Makefile.com
usr/src/cmd/sgs/rtld/Makefile.targ
usr/src/cmd/sgs/rtld/amd64/Makefile
usr/src/cmd/sgs/rtld/amd64/_setup.c
usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c
usr/src/cmd/sgs/rtld/common/_rtld.h
usr/src/cmd/sgs/rtld/common/a.out.c
usr/src/cmd/sgs/rtld/common/analyze.c
usr/src/cmd/sgs/rtld/common/audit.c
usr/src/cmd/sgs/rtld/common/cache_a.out.c
usr/src/cmd/sgs/rtld/common/cap.c
usr/src/cmd/sgs/rtld/common/config_elf.c
usr/src/cmd/sgs/rtld/common/debug.c
usr/src/cmd/sgs/rtld/common/dlfcns.c
usr/src/cmd/sgs/rtld/common/elf.c
usr/src/cmd/sgs/rtld/common/globals.c
usr/src/cmd/sgs/rtld/common/malloc.c
usr/src/cmd/sgs/rtld/common/mapfile-32-vers
usr/src/cmd/sgs/rtld/common/mapfile-64-vers
usr/src/cmd/sgs/rtld/common/mapfile-order-devpro
usr/src/cmd/sgs/rtld/common/mapfile-order-gcc
usr/src/cmd/sgs/rtld/common/mapfile-vers
usr/src/cmd/sgs/rtld/common/move.c
usr/src/cmd/sgs/rtld/common/object.c
usr/src/cmd/sgs/rtld/common/paths.c
usr/src/cmd/sgs/rtld/common/remove.c
usr/src/cmd/sgs/rtld/common/rtld.msg
usr/src/cmd/sgs/rtld/common/setup.c
usr/src/cmd/sgs/rtld/common/sunwmove.c
usr/src/cmd/sgs/rtld/common/tls.c
usr/src/cmd/sgs/rtld/common/tsort.c
usr/src/cmd/sgs/rtld/common/util.c
usr/src/cmd/sgs/rtld/i386/Makefile
usr/src/cmd/sgs/rtld/i386/_setup.c
usr/src/cmd/sgs/rtld/i386/i386_elf.c
usr/src/cmd/sgs/rtld/mdbmod/Makefile.com
usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ
usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile
usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c
usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile
usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile
usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile
usr/src/cmd/sgs/rtld/sparc/Makefile
usr/src/cmd/sgs/rtld/sparc/_setup.c
usr/src/cmd/sgs/rtld/sparc/common_sparc.c
usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c
usr/src/cmd/sgs/rtld/sparc/sparc_elf.c
usr/src/cmd/sgs/rtld/sparcv9/Makefile
usr/src/cmd/sgs/rtld/sparcv9/_setup.c
usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c
usr/src/cmd/sgs/tools/bld_lint.sh
usr/src/cmd/sgs/tools/chkmsg.sh
usr/src/cmd/sgs/tools/common/alist.c
usr/src/cmd/sgs/tools/common/leb128.c
usr/src/cmd/sgs/tools/common/string_table.c
usr/src/cmd/sgs/tools/proto.sh
usr/src/pkgdefs/SUNWcsl/prototype_i386
usr/src/pkgdefs/SUNWcsl/prototype_sparc
usr/src/pkgdefs/SUNWcslr/prototype_com
usr/src/pkgdefs/SUNWcslr/prototype_i386
usr/src/pkgdefs/SUNWcslr/prototype_sparc
usr/src/pkgdefs/SUNWtoo/prototype_com
usr/src/pkgdefs/SUNWtoo/prototype_i386
usr/src/pkgdefs/SUNWtoo/prototype_sparc
usr/src/tools/abi/etc/ABI_i386.db
usr/src/tools/abi/etc/ABI_sparc.db
usr/src/tools/scripts/check_rtime.pl
usr/src/uts/common/krtld/reloc.h
usr/src/uts/intel/amd64/krtld/doreloc.c
usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c
usr/src/uts/intel/amd64/krtld/kobj_reloc.c
usr/src/uts/intel/ia32/krtld/doreloc.c
usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c
usr/src/uts/intel/ia32/krtld/kobj_reloc.c
usr/src/uts/intel/sys/machelf.h
usr/src/uts/sparc/krtld/doreloc.c
usr/src/uts/sparc/krtld/kobj_convrelstr.c
usr/src/uts/sparc/krtld/kobj_reloc.c
usr/src/uts/sparc/sys/machelf.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+# 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 (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/Makefile
+
+include	$(SRC)/lib/Makefile.spec.arch
+
+chkmsg:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,40 @@
+#
+# 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.
+#
+# 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
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# cmd/sgs/libelf/Makefile.targ
+
+LIBRARY	=	libelf.a
+VERS	=	.1
+
+OBJECTS	=	elf.o	\
+		elf32.o	\
+		elf64.o	\
+		gelf.o	\
+		weak.o
+
+SPECCPP =
+
+lint:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+# 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 2004 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+.KEEP_STATE:
+
+include	../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS	+=
+
+include	$(SRC)/lib/Makefile.lib
+include	$(SRC)/lib/Makefile.lib.64
+
+# Uncomment the following if the linker complains
+#amd64_C_PICFLAGS  = -K PIC
+
+include	$(SRC)/lib/Makefile.spec
+ABILLIBC=
+
+install: $(ROOTABILIB64)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/elf.spec	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,287 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/elf.spec
+
+
+function	elf_getphnum
+include		<libelf.h>
+declaration	int elf_getphnum(Elf *elf, size_t *phnum)
+version		SUNW_1.6
+end		
+
+function	elf_getshnum
+include		<libelf.h>
+declaration	int elf_getshnum(Elf *elf, size_t *shnum)
+version		SUNW_1.4
+end		
+
+function	elf_getshstrndx
+include		<libelf.h>
+declaration	int elf_getshstrndx(Elf *elf, size_t *shstrndx)
+version		SUNW_1.4
+end		
+
+function	elf_begin
+include		<libelf.h>
+declaration	Elf *elf_begin(int fildes, Elf_Cmd cmd, Elf *ref)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_end
+include		<libelf.h>
+declaration	int elf_end(Elf *elf)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_memory
+include		<libelf.h>
+declaration	Elf *elf_memory(char *image, size_t sz)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_next
+include		<libelf.h>
+declaration	Elf_Cmd elf_next(Elf *elf)
+version		SUNW_0.7
+exception	$return == ELF_C_NULL
+end
+
+function	elf_rand
+include		<libelf.h>
+declaration	size_t elf_rand(Elf *elf, size_t offset)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_cntl
+include		<libelf.h>
+declaration	int elf_cntl(Elf *elf, Elf_Cmd cmd)
+version		SUNW_0.7
+exception	$return == -1
+end
+
+function	elf_errmsg
+include		<libelf.h>
+declaration	const char *elf_errmsg (int err)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_errno
+include		<libelf.h>
+declaration	int elf_errno(void)
+version		SUNW_0.7
+end
+
+function	elf_fill
+include		<libelf.h>
+declaration	void elf_fill(int fill)
+version		SUNW_0.7
+end
+
+function	elf_flagdata
+include		<libelf.h>
+declaration	unsigned elf_flagdata(Elf_Data *data, Elf_Cmd cmd, \
+			unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_flagehdr
+include		<libelf.h>
+declaration	unsigned elf_flagehdr(Elf *elf,	Elf_Cmd cmd, unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_flagelf
+include		<libelf.h>
+declaration	unsigned elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_flagphdr
+include		<libelf.h>
+declaration	unsigned elf_flagphdr(Elf *elf,	Elf_Cmd	cmd, unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_flagscn
+include		<libelf.h>
+declaration	unsigned elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_flagshdr
+include		<libelf.h>
+declaration	unsigned elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags)
+version		SUNW_0.7
+exception	$return == 0
+end
+
+function	elf_getarhdr
+include		<libelf.h>
+declaration	Elf_Arhdr *elf_getarhdr(Elf *elf)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_getarsym
+include		<libelf.h>
+declaration	Elf_Arsym *elf_getarsym(Elf *elf, size_t *ptr)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_getbase
+include		<libelf.h>
+declaration	off_t elf_getbase(Elf *elf)
+version		SUNW_0.7
+exception	$return == -1
+end
+
+function	elf_getdata
+include		<libelf.h>
+declaration	Elf_Data *elf_getdata(Elf_Scn *scn, Elf_Data *data)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_newdata
+include		<libelf.h>
+declaration	Elf_Data *elf_newdata(Elf_Scn *scn)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_rawdata
+include		<libelf.h>
+declaration	Elf_Data *elf_rawdata(Elf_Scn *scn, Elf_Data *data)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_getident
+include		<libelf.h>
+declaration	char *elf_getident(Elf *elf, size_t *ptr)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_getscn
+include		<libelf.h>
+declaration	Elf_Scn *elf_getscn(Elf *elf, size_t index)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_ndxscn
+include		<libelf.h>
+declaration	size_t elf_ndxscn(Elf_Scn *scn)
+version		SUNW_0.7
+exception	$return == SHN_UNDEF
+end
+
+function	elf_newscn
+include		<libelf.h>
+declaration	Elf_Scn *elf_newscn(Elf *elf)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_nextscn
+include		<libelf.h>
+declaration	Elf_Scn *elf_nextscn(Elf *elf, Elf_Scn *scn)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_hash
+include		<libelf.h>
+declaration	unsigned long elf_hash(const char *name)
+version		SUNW_0.7
+end
+
+function	elf_kind
+include		<libelf.h>
+declaration	Elf_Kind elf_kind(Elf *elf)
+version		SUNW_0.7
+exception	$return == ELF_K_NONE
+end
+
+function	elf_rawfile
+include		<libelf.h>
+declaration	char *elf_rawfile(Elf *elf, size_t *ptr)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_strptr
+include		<libelf.h>
+declaration	char *elf_strptr(Elf *elf, size_t section, size_t offset)
+version		SUNW_0.7
+exception	$return == NULL
+end
+
+function	elf_update
+include		<libelf.h>
+declaration	off_t elf_update(Elf *elf, Elf_Cmd cmd)
+version		SUNW_0.7
+exception	$return == -1
+end
+
+function	elf_version
+include		<libelf.h>
+declaration	unsigned elf_version(unsigned ver)
+version		SUNW_0.7
+end
+
+function	nlist
+include		<nlist.h>
+declaration	int nlist(const char *filename, struct nlist *nl)
+version		SUNW_0.7
+exception	$return == -1
+end
+
+function	_elf_getxoff
+version		SUNWprivate_1.1
+end
+
+function	_elf_outsync
+version		SUNWprivate_1.1
+end
+
+function	elf_demangle
+arch		sparc i386
+version		SUNWprivate_1.1
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/elf32.spec	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,93 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/elf32.spec
+
+function	elf32_checksum
+include		<libelf.h>
+declaration	long elf32_checksum(Elf *elf)
+version		SUNW_1.3
+exception	$return == 0
+end		
+
+function	elf32_fsize
+include		<libelf.h>
+declaration	size_t elf32_fsize(Elf_Type type, size_t count, unsigned ver)
+version		SUNW_0.7
+exception	$return == 0
+end		
+
+function	elf32_getphdr
+include		<libelf.h>
+declaration	Elf32_Phdr *elf32_getphdr(Elf *elf)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_newphdr
+include		<libelf.h>
+declaration	Elf32_Phdr *elf32_newphdr(Elf *elf, size_t count)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_getshdr
+include		<libelf.h>
+declaration	Elf32_Shdr *elf32_getshdr(Elf_Scn *scn)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_getehdr
+include		<libelf.h>
+declaration	Elf32_Ehdr *elf32_getehdr(Elf *elf)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_newehdr
+include		<libelf.h>
+declaration	Elf32_Ehdr *elf32_newehdr(Elf *elf)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_xlatetof
+include		<libelf.h>
+declaration	Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,\
+			unsigned encode)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
+function	elf32_xlatetom
+include		<libelf.h>
+declaration	Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src, \
+			unsigned encode)
+version		SUNW_0.7
+exception	$return == NULL
+end		
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/elf64.spec	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,93 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/elf64.spec
+
+function	elf64_checksum
+include		<libelf.h>
+declaration	long elf64_checksum(Elf *elf)
+version		SUNW_1.3
+exception	$return == 0
+end		
+
+function	elf64_fsize
+include		<libelf.h>
+declaration	size_t elf64_fsize(Elf_Type type, size_t count, unsigned ver)
+version		SUNW_1.2
+exception	$return == 0
+end		
+
+function	elf64_getehdr
+include		<libelf.h>
+declaration	Elf64_Ehdr *elf64_getehdr(Elf *elf)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_getphdr
+include		<libelf.h>
+declaration	Elf64_Phdr *elf64_getphdr(Elf *elf)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_getshdr
+include		<libelf.h>
+declaration	Elf64_Shdr *elf64_getshdr(Elf_Scn *scn)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_newehdr
+include		<libelf.h>
+declaration	Elf64_Ehdr *elf64_newehdr(Elf *elf)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_newphdr
+include		<libelf.h>
+declaration	Elf64_Phdr *elf64_newphdr(Elf *elf, size_t count)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_xlatetof
+include		<libelf.h>
+declaration	Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,\
+			unsigned encode)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
+function	elf64_xlatetom
+include		<libelf.h>
+declaration	Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src, \
+			unsigned encode)
+version		SUNW_1.2
+exception	$return == NULL
+end		
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/gelf.spec	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,208 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/gelf.spec
+
+function	gelf_getsymshndx
+include		<gelf.h>
+declaration	GElf_Sym *gelf_getsymshndx(Elf_Data *symdata, \
+			Elf_Data *shndxdata, int ndx, \
+			GElf_Sym *symptr, Elf32_Word *xshndx);
+version		SUNW_1.4
+end		
+
+function	gelf_update_symshndx
+include		<gelf.h>
+declaration	int gelf_update_symshndx(Elf_Data *symdata, \
+			Elf_Data *shndxdata, int ndx, \
+			GElf_Sym *symptr, Elf32_Word xshndx);
+version		SUNW_1.4
+end		
+
+function	gelf_checksum
+include		<gelf.h>
+declaration	long gelf_checksum(Elf *elf)
+version		SUNW_1.3
+end		
+
+function	gelf_getclass
+include		<gelf.h>
+declaration	int gelf_getclass(Elf *elf)
+version		SUNW_1.2
+end		
+
+function	gelf_fsize
+include		<gelf.h>
+declaration	size_t gelf_fsize(Elf *elf, Elf_Type type, size_t count, unsigned ver)
+version		SUNW_1.2
+end		
+
+function	gelf_getehdr
+include		<gelf.h>
+declaration	GElf_Ehdr *gelf_getehdr(Elf *elf, GElf_Ehdr *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_ehdr
+include		<gelf.h>
+declaration	int gelf_update_ehdr(Elf *elf, GElf_Ehdr *src)
+version		SUNW_1.2
+end		
+
+function	gelf_newehdr
+include		<gelf.h>
+declaration	unsigned long gelf_newehdr(Elf *elf, int elfclass)
+version		SUNW_1.2
+end		
+
+function	gelf_getphdr
+include		<gelf.h>
+declaration	GElf_Phdr *gelf_getphdr(Elf *elf, int ndx, GElf_Phdr *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_phdr
+include		<gelf.h>
+declaration	int gelf_update_phdr(Elf *elf, int ndx, GElf_Phdr *src)
+version		SUNW_1.2
+end		
+
+function	gelf_newphdr
+include		<gelf.h>
+declaration	unsigned long gelf_newphdr(Elf *elf, size_t phnum)
+version		SUNW_1.2
+end		
+
+function	gelf_getshdr
+include		<gelf.h>
+declaration	GElf_Shdr *gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_shdr
+include		<gelf.h>
+declaration	int gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *src)
+version		SUNW_1.2
+end		
+
+function	gelf_xlatetof
+include		<gelf.h>
+declaration	Elf_Data *gelf_xlatetof(Elf *elf, Elf_Data *dst, \
+			const Elf_Data *src, unsigned encode)
+version		SUNW_1.2
+end		
+
+function	gelf_xlatetom
+include		<gelf.h>
+declaration	Elf_Data *gelf_xlatetom(Elf *elf, Elf_Data *dst, \
+			const Elf_Data * src, unsigned encode)
+version		SUNW_1.2
+end		
+
+function	gelf_getsym
+include		<gelf.h>
+declaration	GElf_Sym *gelf_getsym(Elf_Data *data, int ndx, GElf_Sym *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_sym
+include		<gelf.h>
+declaration	int gelf_update_sym(Elf_Data *dest, int ndx, GElf_Sym *src)
+version		SUNW_1.2
+end		
+
+function	gelf_getsyminfo
+include		<gelf.h>
+declaration	GElf_Syminfo *gelf_getsyminfo(Elf_Data *data, int ndx, GElf_Syminfo *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_getmove
+include		<gelf.h>
+declaration	GElf_Move *gelf_getmove(Elf_Data * data, int ndx, GElf_Move *src)
+version		SUNW_1.2
+end		
+
+function	gelf_update_move
+include		<gelf.h>
+declaration	int gelf_update_move(Elf_Data *dest, int ndx, GElf_Move *src)
+version		SUNW_1.2
+end		
+
+function	gelf_update_syminfo
+include		<gelf.h>
+declaration	int gelf_update_syminfo(Elf_Data *dest, int ndx, \
+			GElf_Syminfo *src)
+version		SUNW_1.2
+end		
+
+function	gelf_getdyn
+include		<gelf.h>
+declaration	GElf_Dyn *gelf_getdyn(Elf_Data *src, int ndx, GElf_Dyn *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_dyn
+include		<gelf.h>
+declaration	int gelf_update_dyn(Elf_Data *dst, int ndx, GElf_Dyn *src)
+version		SUNW_1.2
+end		
+
+function	gelf_getrela
+include		<gelf.h>
+declaration	GElf_Rela *gelf_getrela(Elf_Data *src, int ndx, GElf_Rela *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_rela
+include		<gelf.h>
+declaration	int gelf_update_rela(Elf_Data *dst, int ndx, GElf_Rela *src)
+version		SUNW_1.2
+end		
+
+function	gelf_getrel
+include		<gelf.h>
+declaration	GElf_Rel *gelf_getrel(Elf_Data *src, int ndx, GElf_Rel *dst)
+version		SUNW_1.2
+end		
+
+function	gelf_update_rel
+include		<gelf.h>
+declaration	int gelf_update_rel(Elf_Data *dst, int ndx, GElf_Rel *src)
+version		SUNW_1.2
+end		
+
+function	gelf_getcap
+include		<gelf.h>
+declaration	GElf_Cap *gelf_getcap(Elf_Data *dst, int ndx, GElf_Cap *src)
+version		SUNW_1.5
+end
+
+function	gelf_update_cap
+include		<gelf.h>
+declaration	int gelf_update_cap(Elf_Data *dst, int ndx, GElf_Cap *src)
+version		SUNW_1.5
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+# 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
+#
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# cmd/sgs/libelf/spec/i386/Makefile
+
+.KEEP_STATE:
+
+include	../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS	+=
+
+include	$(SRC)/lib/Makefile.lib
+
+# Uncomment the following if the linker complains
+#i386_C_PICFLAGS  = -K PIC
+
+include	$(SRC)/lib/Makefile.spec
+ABILLIBC=
+
+install: $(ROOTABILIB)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,45 @@
+#
+# 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.
+#
+# 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
+#
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# cmd/sgs/libelf/spec/sparc/Makefile
+
+.KEEP_STATE:
+
+include	../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS	+=
+
+include	$(SRC)/lib/Makefile.lib
+
+# Uncomment the following if the linker complains
+#sparc_C_PICFLAGS  = -K PIC
+
+include	$(SRC)/lib/Makefile.spec
+ABILLIBC=
+
+install: $(ROOTABILIB)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,46 @@
+#
+# 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.
+#
+# 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
+#
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# cmd/sgs/libelf/spec/sparcv9/Makefile
+
+.KEEP_STATE:
+
+include	../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS	+=
+
+include	$(SRC)/lib/Makefile.lib
+include	$(SRC)/lib/Makefile.lib.64
+
+# Uncomment the following if the linker complains
+sparcv9_C_PICFLAGS  = -K PIC
+
+include	$(SRC)/lib/Makefile.spec
+ABILLIBC=
+
+install: $(ROOTABILIB64)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/versions	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,71 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Note: Even though the SUNW_1.1 version now contains no symbols
+# beyond what was present at Solaris 2.3, the SUNW_1.1 version MUST be 
+# present.  This is because applications built on 2.6 Beta 
+# (when it did contain symbols explicitly) may depend on it.
+#
+sparc {
+	SUNW_1.6:	{SUNW_1.5};
+	SUNW_1.5:	{SUNW_1.4};
+	SUNW_1.4:	{SUNW_1.3};
+	SUNW_1.3:	{SUNW_1.2};
+	SUNW_1.2:	{SUNW_1.1};
+	SUNW_1.1:	{SUNW_0.7};
+	SUNW_0.7;
+	SUNWprivate_1.1;
+}
+sparcv9 {
+	SUNW_1.6:	{SUNW_1.5};
+	SUNW_1.5:	{SUNW_1.4};
+	SUNW_1.4:	{SUNW_1.3};
+	SUNW_1.3:	{SUNW_1.2};
+	SUNW_1.2:	{SUNW_1.1};
+	SUNW_1.1:	{SUNW_0.7};
+	SUNW_0.7;
+	SUNWprivate_1.1;
+}
+i386 {
+	SUNW_1.6:	{SUNW_1.5};
+	SUNW_1.5:	{SUNW_1.4};
+	SUNW_1.4:	{SUNW_1.3};
+	SUNW_1.3:	{SUNW_1.2};
+	SUNW_1.2:	{SUNW_1.1};
+	SUNW_1.1:	{SUNW_0.7};
+	SUNW_0.7;
+	SUNWprivate_1.1;
+}
+amd64 {
+	SUNW_1.6:	{SUNW_1.5};
+	SUNW_1.5:	{SUNW_1.4};
+	SUNW_1.4:	{SUNW_1.3};
+	SUNW_1.3:	{SUNW_1.2};
+	SUNW_1.2:	{SUNW_1.1};
+	SUNW_1.1:	{SUNW_0.7};
+	SUNW_0.7;
+	SUNWprivate_1.1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/libelf/spec/weak.spec	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,228 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# 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.
+#
+# 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
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#
+# cmd/sgs/libelf/spec/weak.spec
+
+function	_elf_begin
+weak		elf_begin
+version		SUNWprivate_1.1
+end		
+
+function	_elf_memory
+weak		elf_memory
+version		SUNWprivate_1.1
+end		
+
+function	_elf_cntl
+weak		elf_cntl
+version		SUNWprivate_1.1
+end		
+
+function	_elf_end
+weak		elf_end
+version		SUNWprivate_1.1
+end		
+
+function	_elf_errno
+weak		elf_errno
+version		SUNWprivate_1.1
+end		
+
+function	_elf_errmsg
+weak		elf_errmsg
+version		SUNWprivate_1.1
+end		
+
+function	_elf_fill
+weak		elf_fill
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagdata
+weak		elf_flagdata
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagehdr
+weak		elf_flagehdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagelf
+weak		elf_flagelf
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagphdr
+weak		elf_flagphdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagscn
+weak		elf_flagscn
+version		SUNWprivate_1.1
+end		
+
+function	_elf_flagshdr
+weak		elf_flagshdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getarhdr
+weak		elf_getarhdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getarsym
+weak		elf_getarsym
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getbase
+weak		elf_getbase
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getdata
+weak		elf_getdata
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_getehdr
+weak		elf32_getehdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getident
+weak		elf_getident
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_getphdr
+weak		elf32_getphdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_getscn
+weak		elf_getscn
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_getshdr
+weak		elf32_getshdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_hash
+weak		elf_hash
+version		SUNWprivate_1.1
+end		
+
+function	_elf_kind
+weak		elf_kind
+version		SUNWprivate_1.1
+end		
+
+function	_elf_ndxscn
+weak		elf_ndxscn
+version		SUNWprivate_1.1
+end		
+
+function	_elf_newdata
+weak		elf_newdata
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_newehdr
+weak		elf32_newehdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_newphdr
+weak		elf32_newphdr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_newscn
+weak		elf_newscn
+version		SUNWprivate_1.1
+end		
+
+function	_elf_next
+weak		elf_next
+version		SUNWprivate_1.1
+end		
+
+function	_elf_nextscn
+weak		elf_nextscn
+version		SUNWprivate_1.1
+end		
+
+function	_elf_rand
+weak		elf_rand
+version		SUNWprivate_1.1
+end		
+
+function	_elf_rawdata
+weak		elf_rawdata
+version		SUNWprivate_1.1
+end		
+
+function	_elf_rawfile
+weak		elf_rawfile
+version		SUNWprivate_1.1
+end		
+
+function	_elf_strptr
+weak		elf_strptr
+version		SUNWprivate_1.1
+end		
+
+function	_elf_update
+weak		elf_update
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_fsize
+weak		elf32_fsize
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_xlatetof
+weak		elf32_xlatetof
+version		SUNWprivate_1.1
+end		
+
+function	_elf32_xlatetom
+weak		elf32_xlatetom
+version		SUNWprivate_1.1
+end		
+
+function	_elf_version
+weak		elf_version
+version		SUNWprivate_1.1
+end		
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deleted_files/usr/src/cmd/sgs/librtld_db/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ *
+ * 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
+ */
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+/*
+ * Copyright (c) 1998 by Sun Microsystems, Inc. 
+ * All rights reserved. 
+ */ 
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Supplimental definitions for lint that help us avoid
+ * options like `-x' that filter out things we want to
+ * know about as well as things we don't.
+ */
+#include <thread.h>
+#include <rtld_db.h>
+#include "libld.h"
+#include "rtld.h"
+#include "msg.h"
+
--- a/usr/src/Targetdirs	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/Targetdirs	Tue Mar 14 09:22:52 2006 -0800
@@ -615,8 +615,6 @@
 $(ROOT)/usr/ccs/lib/llib-ll.ln:= 	REALPATH=../../lib/llib-ll.ln
 $(ROOT)/usr/ccs/lib/liby.so:=		REALPATH=../../lib/liby.so.1
 $(ROOT)/usr/ccs/lib/llib-ly.ln:= 	REALPATH=../../lib/llib-ly.ln
-$(ROOT)/usr/ccs/lib/libld.so.2:=	REALPATH=../../../lib/libld.so.2
-$(ROOT)/usr/ccs/lib/libld.so.3:=	REALPATH=../../../lib/libld.so.3
 $(ROOT)/usr/lib/libp/libc.so.1:=	REALPATH=../../../lib/libc.so.1
 $(ROOT)/usr/lib/lwp/libthread.so.1:=	REALPATH=../libthread.so.1
 $(ROOT)/usr/lib/lwp/libthread_db.so.1:=	REALPATH=../libthread_db.so.1
@@ -672,10 +670,6 @@
 	REALPATH=../../../lib/$(MACH64)/liby.so.1
 $(ROOT)/usr/ccs/lib/$(MACH64)/llib-ly.ln:= \
 	REALPATH=../../../lib/$(MACH64)/llib-ly.ln
-$(ROOT)/usr/ccs/lib/$(MACH64)/libld.so.2:= \
-	REALPATH=../../../../lib/$(MACH64)/libld.so.2
-$(ROOT)/usr/ccs/lib/$(MACH64)/libld.so.3:= \
-	REALPATH=../../../../lib/$(MACH64)/libld.so.3
 $(ROOT)/usr/lib/libp/$(MACH64)/libc.so.1:= \
 	REALPATH=../../../../lib/$(MACH64)/libc.so.1
 $(ROOT)/usr/lib/lwp/$(MACH64)/libthread.so.1:= \
@@ -716,13 +710,11 @@
 	/usr/ccs/lib/llib-ll.ln \
 	/usr/ccs/lib/liby.so \
 	/usr/ccs/lib/llib-ly.ln \
-	/usr/ccs/lib/libld.so.2 \
 	/usr/lib/libp/libc.so.1 \
 	/usr/lib/lwp/libthread.so.1 \
 	/usr/lib/lwp/libthread_db.so.1
 
 SYM.USRCCSLIB64= \
-	/usr/ccs/lib/libld.so.3 \
 	/usr/ccs/lib/$(MACH64)/libcurses.so \
 	/usr/ccs/lib/$(MACH64)/llib-lcurses.ln \
 	/usr/ccs/lib/$(MACH64)/libform.so \
@@ -748,8 +740,6 @@
 	/usr/ccs/lib/$(MACH64)/llib-ll.ln \
 	/usr/ccs/lib/$(MACH64)/liby.so \
 	/usr/ccs/lib/$(MACH64)/llib-ly.ln \
-	/usr/ccs/lib/$(MACH64)/libld.so.2 \
-	/usr/ccs/lib/$(MACH64)/libld.so.3 \
 	/usr/lib/libp/$(MACH64)/libc.so.1 \
 	/usr/lib/lwp/$(MACH64)/libthread.so.1 \
 	/usr/lib/lwp/$(MACH64)/libthread_db.so.1
@@ -818,8 +808,6 @@
 $(ROOT)/usr/lib/libintl.so:=		REALPATH=../../lib/libintl.so.1
 $(ROOT)/usr/lib/libkstat.so.1:=		REALPATH=../../lib/libkstat.so.1
 $(ROOT)/usr/lib/libkstat.so:=		REALPATH=../../lib/libkstat.so.1
-$(ROOT)/usr/lib/libld.so.2:=		REALPATH=../../lib/libld.so.2
-$(ROOT)/usr/lib/libld.so.3:=		REALPATH=../../lib/libld.so.3
 $(ROOT)/usr/lib/liblddbg.so.4:=		REALPATH=../../lib/liblddbg.so.4
 $(ROOT)/usr/lib/libmd5.so.1:=		REALPATH=../../lib/libmd5.so.1
 $(ROOT)/usr/lib/libmd5.so:=		REALPATH=../../lib/libmd5.so.1
@@ -1081,10 +1069,6 @@
 	REALPATH=../../../lib/$(MACH64)/libkstat.so.1
 $(ROOT)/usr/lib/$(MACH64)/libkstat.so:= \
 	REALPATH=../../../lib/$(MACH64)/libkstat.so.1
-$(ROOT)/usr/lib/$(MACH64)/libld.so.2:= \
-	REALPATH=../../../lib/$(MACH64)/libld.so.2
-$(ROOT)/usr/lib/$(MACH64)/libld.so.3:= \
-	REALPATH=../../../lib/$(MACH64)/libld.so.3
 $(ROOT)/usr/lib/$(MACH64)/liblddbg.so.4:= \
 	REALPATH=../../../lib/$(MACH64)/liblddbg.so.4
 $(ROOT)/usr/lib/$(MACH64)/libmd5.so.1:= \
@@ -1376,7 +1360,6 @@
 	/usr/lib/libintl.so.1 \
 	/usr/lib/libkstat.so \
 	/usr/lib/libkstat.so.1 \
-	/usr/lib/libld.so.2 \
 	/usr/lib/liblddbg.so.4 \
 	/usr/lib/libmd5.so \
 	/usr/lib/libmd5.so.1 \
@@ -1602,8 +1585,6 @@
 	/usr/lib/$(MACH64)/libintl.so.1 \
 	/usr/lib/$(MACH64)/libkstat.so \
 	/usr/lib/$(MACH64)/libkstat.so.1 \
-	/usr/lib/$(MACH64)/libld.so.2 \
-	/usr/lib/$(MACH64)/libld.so.3 \
 	/usr/lib/$(MACH64)/liblddbg.so.4 \
 	/usr/lib/$(MACH64)/libmd5.so \
 	/usr/lib/$(MACH64)/libmd5.so.1 \
@@ -1716,8 +1697,7 @@
 	/usr/lib/$(MACH64)/nss_files.so.1 \
 	/usr/lib/$(MACH64)/nss_nis.so.1 \
 	/usr/lib/$(MACH64)/nss_nisplus.so.1 \
-	/usr/lib/$(MACH64)/nss_user.so.1 \
-	/usr/lib/libld.so.3
+	/usr/lib/$(MACH64)/nss_user.so.1
 
 $(SYM.USRLIB:%=$(ROOT)%):= \
     INS.dir= -$(RM) $@; $(SYMLINK) $(REALPATH) $@; \
--- a/usr/src/cmd/sgs/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -28,11 +28,8 @@
 include		$(SRC)/cmd/Makefile.cmd
 
 SUBDIRS-common= libconv		\
-		.WAIT		\
 		libdl		\
-		.WAIT		\
 		libelf		\
-		.WAIT		\
 		liblddbg	\
 		.WAIT		\
 		libld		\
--- a/usr/src/cmd/sgs/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,27 +18,30 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/sgs/Makefile.com
 
 .KEEP_STATE:
+.KEEP_STATE_FILE: .make.state.$(MACH)
+
 
 include		$(SRC)/cmd/sgs/Makefile.var
 
-SRCBASE=	../../../..
+SRCBASE =	../../../..
 
-i386_ARCH=	$(VAR_I386_ARCH)
-sparc_ARCH=	sparc
+i386_ARCH =	$(VAR_I386_ARCH)
+sparc_ARCH =	sparc
 
-ARCH=		$($(MACH)_ARCH)
+ARCH =		$($(MACH)_ARCH)
 
-ROOTCCSBIN64=		$(ROOTCCSBIN)/$(MACH64)
-ROOTCCSBINPROG64=	$(PROG:%=$(ROOTCCSBIN64)/%)
+ROOTCCSBIN64 =	$(ROOTCCSBIN)/$(MACH64)
+ROOTCCSBINPROG64 = \
+		$(PROG:%=$(ROOTCCSBIN64)/%)
 
 # Establish any global flags.
 
@@ -47,17 +49,17 @@
 # checking.  This is automatically enabled for DEBUG builds, not for non-debug
 # builds.  Unset the global C99_DISABLE flag to insure we uncover all compiler
 # warnings/errors.
-DEBUG=
+DEBUG =
 $(NOT_RELEASE_BUILD)DEBUG = -DDEBUG
 
-C99_DISABLE=	$(C99_ENABLE)
+C99_DISABLE =	$(C99_ENABLE)
 
 CFLAGS +=	$(CCVERBOSE) $(DEBUG) $(XFFLAG)
 CFLAGS64 +=	$(CCVERBOSE) $(DEBUG) $(XFFLAG)
 
 # Reassign CPPFLAGS so that local search paths are used before any parent
 # $ROOT paths.
-CPPFLAGS=	-I. -I../common -I../../include -I../../include/$(MACH) \
+CPPFLAGS =	-I. -I../common -I../../include -I../../include/$(MACH) \
 		$(VAR_CPPFLAGS) $(CPPFLAGS.master)
 
 # PICS64 is unique to our environment
@@ -70,62 +72,59 @@
 
 # Establish the local tools, proto and package area.
 
-SGSHOME=	$(SRC)/cmd/sgs
-SGSPROTO=	$(SGSHOME)/proto/$(MACH)
-SGSTOOLS=	$(SGSHOME)/tools
-SGSMSGID=	$(SGSHOME)/messages
-SGSMSGDIR=	$(SGSHOME)/messages/$(MACH)
-SGSONLD=	$(ROOT)/opt/SUNWonld
-SGSRPATH=	/usr/lib
-SGSRPATH64=	$(SGSRPATH)/$(MACH64)
+SGSHOME =	$(SRC)/cmd/sgs
+SGSPROTO =	$(SGSHOME)/proto/$(MACH)
+SGSTOOLS =	$(SGSHOME)/tools
+SGSMSGID =	$(SGSHOME)/messages
+SGSMSGDIR =	$(SGSHOME)/messages/$(MACH)
+SGSONLD =	$(ROOT)/opt/SUNWonld
+SGSRPATH =	/usr/lib
+SGSRPATH64 =	$(SGSRPATH)/$(MACH64)
 
 #
-# Macros to be used to include link against libconv and include
-# vernote.o
+# Macros to be used to include link against libconv and include vernote.o
 #
-VERSREF=	-ulink_ver_string
-CONVLIBDIR=	-L$(SGSHOME)/libconv/$(MACH)
-CONVLIBDIR64=	-L$(SGSHOME)/libconv/$(MACH64)
+VERSREF =	-ulink_ver_string
+
+LDLIBDIR =	-L$(SGSHOME)/libld/$(MACH)
+LDLIBDIR64 =	-L$(SGSHOME)/libld/$(MACH64)
 
-ELFLIBDIR=	-L$(SGSHOME)/libelf/$(MACH)
-ELFLIBDIR64=	-L$(SGSHOME)/libelf/$(MACH64)
+CONVLIBDIR =	-L$(SGSHOME)/libconv/$(MACH)
+CONVLIBDIR64 =	-L$(SGSHOME)/libconv/$(MACH64)
 
-LDDBGLIBDIR=	-L$(SGSHOME)/liblddbg/$(MACH)
-LDDBGLIBDIR64=	-L$(SGSHOME)/liblddbg/$(MACH64)
+ELFLIBDIR =	-L$(SGSHOME)/libelf/$(MACH)
+ELFLIBDIR64 =	-L$(SGSHOME)/libelf/$(MACH64)
 
-
+LDDBGLIBDIR =	-L$(SGSHOME)/liblddbg/$(MACH)
+LDDBGLIBDIR64 =	-L$(SGSHOME)/liblddbg/$(MACH64)
 
 # The cmd/Makefile.com and lib/Makefile.com define TEXT_DOMAIN.  We don't need
 # this definition as the sgs utilities obtain their domain via sgsmsg(1l).
 
-DTEXTDOM=
-
+DTEXTDOM =
 
 # Define any generic sgsmsg(1l) flags.  The default message generation system
 # is to use gettext(3i), add the -C flag to switch to catgets(3c).
 
-SGSMSG=		$(SGSTOOLS)/$(MACH)/sgsmsg
-CHKMSG=		$(SGSTOOLS)/chkmsg.sh
+SGSMSG =	$(SGSTOOLS)/$(MACH)/sgsmsg
+CHKMSG =	$(SGSTOOLS)/chkmsg.sh
 
 SGSMSGVFLAG =
 SGSMSGFLAGS =	$(SGSMSGVFLAG) -i $(SGSMSGID)/sgs.ident
-CHKMSGFLAGS=	$(SGSMSGTARG:%=-m %) $(SGSMSGCHK:%=-m %)
-
+CHKMSGFLAGS =	$(SGSMSGTARG:%=-m %) $(SGSMSGCHK:%=-m %)
 
 # Native targets should use the minimum of ld(1) flags to allow building on
 # previous releases.  We use mapfiles to scope, but don't bother versioning.
 
-native:=	DYNFLAGS = $(MAPOPTS) -R$(SGSPROTO) -L$(SGSPROTO) $(ZNOVERSION)
+native :=	DYNFLAGS = $(MAPOPTS) -R$(SGSPROTO) -L$(SGSPROTO) $(ZNOVERSION)
 
-USE_PROTO=	-Yl,$(SGSPROTO)
-
-.KEEP_STATE_FILE: .make.state.$(MACH)
+USE_PROTO =	-Yl,$(SGSPROTO)
 
 #
 # lint-related stuff
 #
 
-DASHES=		"------------------------------------------------------------"
+DASHES =	"------------------------------------------------------------"
 
 LIBNAME32 =	$(LIBNAME:%=%32)
 LIBNAME64 =	$(LIBNAME:%=%64)
@@ -144,18 +143,21 @@
 
 LINTFLAGS =	-m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
 LINTFLAGS64 =	-m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED \
-		-errchk=longptr64 $(VAR_LINTFLAGS64)
+		    $(VAR_LINTFLAGS64) \
 
 #
-# These libraries have two resulting lint libraries.
-# If a dependency is declared using these variables,
-# the substitution for the 32/64 versions at lint time
-# will happen automatically (see Makefile.targ).
+# These libraries have two resulting lint libraries.  If a dependency is
+# declared using these variables, the substitution for the 32/64 versions at
+# lint time happens automatically (see Makefile.targ).
 #
-LDDBG_LIB=	-llddbg
-LDDBG_LIB32=	-llddbg32
-LDDBG_LIB64=	-llddbg64
+LD_LIB =	-lld
+LD_LIB32 =	-lld32
+LD_LIB64 =	-lld64
 
-LD_LIB=		-lld
-LD_LIB32=	-lld32
-LD_LIB64=	-lld64
+LDDBG_LIB =	-llddbg
+LDDBG_LIB32 =	-llddbg32
+LDDBG_LIB64 =	-llddbg64
+
+CONV_LIB =	-lconv
+CONV_LIB32 =	-lconv32
+CONV_LIB64 =	-lconv64
--- a/usr/src/cmd/sgs/Makefile.sub	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile.sub	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,11 @@
 #
 # CDDL HEADER END
 #
+
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # Standard subdirs makefile for the sgs area.
@@ -42,8 +42,7 @@
 # to build whatever 64-bit directories we actually find as a side-effect
 # of descending into the 32-bit directories.  Ick.
 
-# Note, SPECDIR is defined only in those targets that require spec files.
-SUBDIRS =	$(PRESUBDIRS) $(SPECDIR) $(MACH) $(EXTRASUBDIRS)
+SUBDIRS =	$(MACH) $(EXTRASUBDIRS)
 
 all :=		TARGET= all
 clean :=	TARGET= clean
@@ -55,8 +54,8 @@
 package :=	TARGET= package
 chkmsg :=	TARGET= chkmsg
 
+.KEEP_STATE:
 .KEEP_STATE_FILE: .make.state.$(MACH)
-.KEEP_STATE:
 
 all clean clobber delete install lint catalog package chkmsg: \
 		$(SUBDIRS)
--- a/usr/src/cmd/sgs/Makefile.sub.64	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile.sub.64	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,15 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright (c) 1997, by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 #
 # Include overrides for building 64-bit objects
 #
-include ../../../../Makefile.master.64
+include		$(SRC)/Makefile.master.64
--- a/usr/src/cmd/sgs/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,64 +18,59 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# cmd/sgs/Makefile.targ
 
 
 ################################################################################
 #
 # Linting the Linker Libraries
 #
-#  Several of the linker's libraries are, in whole or in part,
-#  are built in two passes, once as Elf32 and once as Elf64,
-#  i.e. with -D_ELF64 defined.  Lint needs to be able to do
-#  both passes, but combining the two is problematic for the
-#  2nd pass of lint, as it sees many interfaces as being defined
-#  both ways and considers them to be incompatible.  The targets
-#  defined here allow for both passes to live independently.
-#  This means that both the lint.out, and the lint library itself
-#  get generated separately, to different output files.  The
-#  lint.out's get combined into a single lint.out report, and
-#  the lint libraries get generated with a 32/64 suffix.  The
-#  dependents on these lint libraries, then, choose which version
-#  the need to use.  Substitutions can be made automatically if
-#  the macro's defined in ./Makefile.com are used to specify
-#  the dependency, for those libs that need them.
+#  Several of the linker's libraries are, in whole or in part, built in two
+#  passes, once as Elf32 and once as Elf64 (i.e. with -D_ELF64 defined).  Lint
+#  needs to be able to do both passes, but combining the two is problematic for
+#  the 2nd pass of lint, as it sees many interfaces as being defined both ways
+#  and considers them to be incompatible.  The targets defined here allow for
+#  both passes to live independently.  This means that both the lint.out, and
+#  the lint library itself get generated separately, to different output files.
+#  The lint.out's get combined into a single lint.out report, and the lint
+#  libraries get generated with a 32/64 suffix.  The dependents on these lint
+#  libraries, then, choose which version they need to use.  Substitutions can
+#  be made automatically if the macro's defined in ./Makefile.com are used to
+#  specify the dependency, for those libs that need them.
 #
 # Don't
 #
-#  Don't use the /*LINTLIBRARY*/ directive in linker libraries,
-#  this disables some important checks, including the ability
-#  to test format strings from the msg.h files.
+#  Don't use the /*LINTLIBRARY*/ directive in linker libraries, this disables
+#  some important checks, including the ability to test format strings from the
+#  msg.h files.
 #
-#  Don't use the `-x' option to lint when linting linker libraries.
-#  This masks all the dead wood in our own header files.  Instead,
-#  there has been added to the relevant common directories a file
-#  called `lintsup.c' which is used to mask out the headers that
-#  we aren't interested in.  This method is used for libraries, like
-#  libld, which have their own header files, but is irrelevant to
-#  libraries like libldstab which exports no interface of it's own.
+#  Don't use the `-x' option to lint when linting linker libraries.  This masks
+#  all the dead wood in our own header files.  Instead, there has been added to
+#  the relevant common directories a file called `lintsup.c' which is used to
+#  mask out the headers that we aren't interested in.  This method is used for
+#  libraries, like libld, which have their own header files, but is irrelevant
+#  to libraries like libldstab which exports no interface of it's own.
 #
-#  The `lintsup.c' file can also be used, in some cases, to mask
-#  out other issues that lint won't otherwise shut up about.
+#  The `lintsup.c' file can also be used, in some cases, to mask out other
+#  issues that lint won't otherwise shut up about.
 #
 # Other Lint Options
 #
-#  `-m' has been added to the LINTFLAGS.  Warnings about globals
-#  that could be static are irrelevant because we use mapfiles to
-#  scope down unnecessary globals.
+#  `-m' has been added to the LINTFLAGS.  Warnings about globals that could be
+#  static are irrelevant as we use mapfiles to scope down unnecessary globals.
 #
-#  `-u' is used in the LINTFLAGS for libraries, otherwise lint
-#  tends to be very noisy.
+#  `-u' is used in the LINTFLAGS for libraries, otherwise lint tends to be very
+#  noisy.
 #
-#  `-x' is avoided for libraries, but is used for executables
-#  because all we care about is that what we use is defined,
-#  not about declarations in public headers that we don't use.
+#  `-x' is avoided for libraries, but is used for executables because all we
+#  care about is that what we use is defined, not about declarations in public
+#  headers that we don't use.
 #
 # Relevant variables:
 #
@@ -119,13 +113,16 @@
 LINTOUT =	$(LINTOUT1)
 
 #
-# If LD_LIB or LDDBG_LIB is added to LDLIBS, then the
-# right lint library should be picked up automatically.
+# If LD_LIB, LDDBG_LIB, or CONV_LIB is added to LDLIBS, then the right lint
+# library should be picked up automatically.
 #
 $(LINTOUT32) :=	LD_LIB=$(LD_LIB32)
 $(LINTOUT32) :=	LDDBG_LIB=$(LDDBG_LIB32)
+$(LINTOUT32) :=	CONV_LIB=$(CONV_LIB32)
+
 $(LINTOUT64) :=	LD_LIB=$(LD_LIB64)
 $(LINTOUT64) :=	LDDBG_LIB=$(LDDBG_LIB64)
+$(LINTOUT64) :=	CONV_LIB=$(CONV_LIB64)
 
 #
 # Force $(LINTLIB) in order to help the $(SGSLINTOUT)
@@ -185,16 +182,20 @@
 $(ROOTLIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
 	$(INS.file) ../common/$(LINTLIBSRC)
 
-$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
+$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKS): \
+	$(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
 $(VAR_POUND_1)	$(INS.liblink)
 
-$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
+$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKS): \
+	$(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
 $(VAR_POUND_1)	$(INS.liblink64)
 
-$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS)
+$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKSCCC): \
+	$(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS)
 $(VAR_POUND_1)	$(INS.liblinkccc)
 
-$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS)
+$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): \
+	$(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS)
 $(VAR_POUND_1)	$(INS.liblinkccc64)
 
 FRC:
--- a/usr/src/cmd/sgs/Makefile.var	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/Makefile.var	Tue Mar 14 09:22:52 2006 -0800
@@ -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,26 +18,24 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/sgs/Makefile.var
-#
 
-# The link-editor related source files and Makefile files
-# are unified for on10-gate, on{81,28,998}-patch gates.
-# However, some of the compiler pre-processor flags, linker flags
-# are different among the releases. This file is used to
-# specify such flags. 
+# The link-editor related source files and Makefile files are normally unified
+# across all presently maintained release gates.  However, some of the compiler
+# pre-processor flags, linker flags are different among the releases.  This
+# file is used to specify such flags. 
 # 
 # This file is included by the ./Makefile.com.
 # 
-# This file should be the only file which is different
-# among /ws/{on10-gate,on{81,28,998}-patch} workspaces
-# among the files which generate link-editors and related tools.
+# This file should be the only file which is different among the presently
+# maintained release workspaces and the files that generate the link-editors
+# and related tools.
 
 #
 # CPPFEATUREMACROS provides for selectively turning on/off features within the
@@ -114,21 +111,15 @@
 
 VAR_LINTFLAGS64=	-Xarch=$(MACH64:sparcv9=v9)
 VAR_I386_ARCH=		intel
+
 VAR_PLAT_sparc=		sparc
 VAR_PLAT_i386=		intel/ia32
 VAR_PLAT_amd64=		intel/amd64
-VAR_MAPDIR_sparc=	../spec/sparc
-VAR_MAPDIR_sparcv9=	../spec/sparcv9
-VAR_MAPDIR_i386=	../spec/i386
-VAR_MAPDIR_amd64=	../spec/amd64
 
 VAR_POUND_1=
 VAR_POUND_2=		$(POUND_SIGN)
 VAR_POUND_3=		$(POUND_SIGN)
 
-VAR_SPEC_ON=		
-VAR_SPEC_OFF=		$(POUND_SIGN)
-
 #
 # VAR_AVLDIR - directory to find avl.c in.
 #
@@ -144,7 +135,7 @@
 # files avl.c, avl.h and avl_impl.h until these files are back ported into
 # the system.
 #
-VAR_AVLDIR=$(SRCBASE)/common/avl
+VAR_AVLDIR=		$(SRCBASE)/common/avl
 VAR_AVLINCDIR=
 
 #
--- a/usr/src/cmd/sgs/crle/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/crle/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -51,7 +51,7 @@
 		$(CPPFLAGS.master) -D__EXTENSIONS__
 LDFLAGS +=	$(VERSREF) $(USE_PROTO) -M$(MAPFILE) \
 			'-R$$ORIGIN/../lib' $(ZNOLAZYLOAD)
-LDLIBS +=	-lelf $(CONVLIBDIR) -lconv $(DLLIB)
+LDLIBS +=	-lelf $(CONVLIBDIR) $(CONV_LIB) $(DLLIB)
 LINTFLAGS +=	-mx
 
 BLTDEFS=        msg.h
--- a/usr/src/cmd/sgs/crle/common/print.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/crle/common/print.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -265,7 +265,7 @@
 		const char	*fmt;
 
 		if (head->ch_dlflags)
-			fmt = conv_dlflag_str(head->ch_dlflags, 0);
+			fmt = conv_dl_flag(head->ch_dlflags, 0);
 		else
 			fmt = MSG_ORIG(MSG_STR_EMPTY);
 
@@ -287,7 +287,7 @@
 		if (head->ch_dlflags &&
 		    (head->ch_dlflags != RTLD_REL_RELATIVE)) {
 			(void) snprintf(_cmd, PATH_MAX, MSG_ORIG(MSG_CMD_FLAGS),
-			    conv_dlflag_str(head->ch_dlflags, 1));
+			    conv_dl_flag(head->ch_dlflags, 1));
 			cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd);
 			if (list_append(&cmdline, cmd) == 0)
 				return (1);
@@ -362,12 +362,12 @@
 #ifndef	SGS_PRE_UNIFIED_PROCESS
 			if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
 				if (head->ch_cnflags & RTC_HDR_64)
-					str = conv_upm_string(str,
+					str = conv_config_upm(str,
 					    MSG_ORIG(MSG_PTH_OLDDLP_64),
 					    MSG_ORIG(MSG_PTH_UPDLP_64),
 					    MSG_PTH_UPDLP_64_SIZE);
 				else
-					str = conv_upm_string(str,
+					str = conv_config_upm(str,
 					    MSG_ORIG(MSG_PTH_OLDDLP),
 					    MSG_ORIG(MSG_PTH_UPDLP),
 					    MSG_PTH_UPDLP_SIZE);
@@ -429,12 +429,12 @@
 #ifndef	SGS_PRE_UNIFIED_PROCESS
 			if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
 				if (head->ch_cnflags & RTC_HDR_64)
-					str = conv_upm_string(str,
+					str = conv_config_upm(str,
 					    MSG_ORIG(MSG_PTH_OLDTD_64),
 					    MSG_ORIG(MSG_PTH_UPTD_64),
 					    MSG_PTH_UPTD_64_SIZE);
 				else
-					str = conv_upm_string(str,
+					str = conv_config_upm(str,
 					    MSG_ORIG(MSG_PTH_OLDTD),
 					    MSG_ORIG(MSG_PTH_UPTD),
 					    MSG_PTH_UPTD_SIZE);
--- a/usr/src/cmd/sgs/dump/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -49,7 +49,7 @@
 
 DEMLIB=		-L../../sgsdemangler/$(MACH)
 DEMLIB64=	-L../../sgsdemangler/$(MACH64)
-LDLIBS +=	$(DEMLIB) -ldemangle $(CONVLIBDIR) -lconv \
+LDLIBS +=	$(DEMLIB) -ldemangle $(CONVLIBDIR) $(CONV_LIB) \
 		$(ELFLIBDIR) -lelf
 
 LINTSRCS =	$(SRCS)
--- a/usr/src/cmd/sgs/dump/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,17 +19,16 @@
 # CDDL HEADER END
 #
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright 1998,2002 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 %.o:		../common/%.c
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
-
 $(PROG):	$(OBJS)
 		$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
 		$(POST_PROCESS)
@@ -46,7 +44,5 @@
 clean:
 		$(RM) $(OBJS) $(CLEANFILES)
 
-lint:		$(LINTOUT32) $(SGSLINTOUT)
-
 include		$(SRC)/cmd/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
--- a/usr/src/cmd/sgs/dump/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,12 +34,13 @@
 ELFLIBDIR =	$(ELFLIBDIR64)
 DEMLIB =	$(DEMLIB64)
 CONVLIBDIR =	$(CONVLIBDIR64)
-LINTFLAGS64 +=	-Xarch=amd64
 
 ROOTCCSBINPROG=	$(ROOTCCSBINPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
 
+lint:		$(LINTOUT64) $(SGSLINTOUT)
+
 install \
 package:	$(ROOTCCSBINPROG64)
--- a/usr/src/cmd/sgs/dump/common/dump.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/common/dump.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -41,6 +38,7 @@
 #include <sys/elf_M32.h>
 #include <sys/elf_386.h>
 #include <sys/elf_SPARC.h>
+#include <sys/elf_amd64.h>
 #include <sys/machelf.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -301,7 +299,7 @@
 	int adj = 0;
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		adj = 4;
+		adj = 8;
 
 	rel_entsize = p_scns->p_shdr.sh_entsize;
 	if ((rel_entsize == 0) ||
@@ -400,7 +398,7 @@
 	int adj = 0;
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		adj = 4;
+		adj = 8;
 
 	rel_entsize = p_scns->p_shdr.sh_entsize;
 	if ((rel_entsize == 0) ||
@@ -468,12 +466,12 @@
 }
 
 /* demangle C++ names */
-static char *format = "%s\t[%s]";
 static char *
 demangled_name(char *s)
 {
-	char *dn;
-	static char *buf;
+	static char	*buf = NULL;
+	char		*dn;
+	size_t		len;
 
 	dn = sgs_demangle(s);
 
@@ -489,11 +487,11 @@
 	if (buf != NULL)
 		free(buf);
 
-	buf = malloc(strlen(dn) + 1 + 1 + strlen(s) + 1 + 1);
-	if (buf == NULL)
+	len = strlen(dn) + strlen(s) + 4;
+	if ((buf = malloc(len)) == NULL)
 		return (s);
 
-	(void) sprintf(buf, format, dn, s);
+	(void) snprintf(buf, len, "%s\t[%s]", dn, s);
 	return (buf);
 }
 
@@ -516,7 +514,7 @@
 	unsigned int	nosymshndx = 0;
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		adj = 4;
+		adj = 8;
 
 	while (range > 0) {
 		char		*sym_name = (char *)0;
@@ -712,7 +710,7 @@
 	int field;
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		field = 15;
+		field = 21;
 	else
 		field = 13;
 
@@ -798,6 +796,12 @@
 			case SHT_SUNW_COMDAT:
 				(void) printf("COMD");
 				break;
+			case SHT_AMD64_UNWIND:
+				(void) printf("UNWD");
+				break;
+			case SHT_SPARC_GOTDATA:
+				(void) printf("GOTD");
+				break;
 			default:
 				(void) printf("%u", EC_WORD(p->p_shdr.sh_type));
 				break;
@@ -903,7 +907,7 @@
 	size_t shnum;
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		adj = 4;
+		adj = 8;
 
 	if ((!p_flag) && (!r_title)) {
 		(void) printf("\n    **** RELOCATION INFORMATION ****\n");
@@ -1114,7 +1118,7 @@
 	int adj = 0;			/*  field adjustment for elf64 */
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		adj = 4;
+		adj = 8;
 
 	if (p_symtab == NULL) {
 		(void) fprintf(stderr,
@@ -1859,15 +1863,15 @@
 	int field;
 
 	if (gelf_getehdr(elf_file, elf_head_p) == NULL) {
-		(void) fprintf(stderr,
-		"%s: %s: %s\n", prog_name, filename, elf_errmsg(-1));
+		(void) fprintf(stderr, "%s: %s: %s\n", prog_name, filename,
+		    elf_errmsg(-1));
 		return (NULL);
 	}
 
 	class = (int)elf_head_p->e_ident[4];
 
 	if (class == ELFCLASS64)
-		field = 17;
+		field = 21;
 	else
 		field = 13;
 
@@ -1875,14 +1879,13 @@
 		return (elf_head_p);
 
 	if (!p_flag) {
-	(void) printf(
-		"\n                    **** ELF HEADER ****\n");
-	(void) printf("%-*s%-11s%-*sMachine     Version\n",
-	    field, "Class", "Data", field, "Type");
-	(void) printf("%-*s%-11s%-*sFlags       Ehsize\n",
-	    field, "Entry", "Phoff", field, "Shoff");
-	(void) printf("%-*s%-11s%-*sShnum       Shstrndx\n\n",
-	    field, "Phentsize", "Phnum", field, "Shentsz");
+		(void) printf("\n                    **** ELF HEADER ****\n");
+		(void) printf("%-*s%-11s%-*sMachine     Version\n",
+		    field, "Class", "Data", field, "Type");
+		(void) printf("%-*s%-11s%-*sFlags       Ehsize\n",
+		    field, "Entry", "Phoff", field, "Shoff");
+		(void) printf("%-*s%-11s%-*sShnum       Shstrndx\n\n",
+		    field, "Phentsize", "Phnum", field, "Shentsz");
 	}
 
 	if (!v_flag) {
@@ -2040,9 +2043,9 @@
 		int		field;
 
 		if (gelf_getclass(elf_file) == ELFCLASS64)
-			field = 14;
+			field = 21;
 		else
-			field = 12;
+			field = 13;
 		if (!p_flag) {
 			(void) printf("\n	   **** SECTION HEADER[0] "
 			    "{Elf Extensions} ****\n");
@@ -2051,7 +2054,7 @@
 			    field, "Addr", field, "Offset", field,
 			    "Size(shnum)",
 			    /* compatibility:  tab for elf32 */
-			    (field == 12) ? "\t" : "  ");
+			    (field == 13) ? "\t" : "  ");
 			(void) printf("\tLn(strndx) Info\t%-*s Entsize\n",
 			    field, "Adralgn");
 		}
@@ -2079,7 +2082,7 @@
 			field, EC_OFF(shdr0.sh_offset),
 			field, EC_XWORD(shdr0.sh_size),
 			/* compatibility:  tab for elf32 */
-			((field == 12) ? "\t" : "  "),
+			((field == 13) ? "\t" : "  "),
 			field, EC_WORD(shdr0.sh_name));
 
 		(void) printf("\t%u\t%u\t%-#*llx %-#*llx\n",
@@ -2231,16 +2234,16 @@
 	int found_it = 0;  /* for use with -n section_name */
 
 	if (gelf_getclass(elf_file) == ELFCLASS64)
-		field = 14;
+		field = 21;
 	else
-		field = 12;
+		field = 13;
 
 	if (!p_flag) {
 		(void) printf("\n	   **** SECTION HEADER TABLE ****\n");
 		(void) printf("[No]\tType\tFlags\t%-*s %-*s %-*s%sName\n",
 		    field, "Addr", field, "Offset", field, "Size",
 		    /* compatibility:  tab for elf32 */
-		    (field == 12) ? "\t" : "  ");
+		    (field == 13) ? "\t" : "  ");
 		(void) printf("\tLink\tInfo\t%-*s Entsize\n\n",
 		    field, "Adralgn");
 	}
@@ -2528,6 +2531,8 @@
 
 	cmd = ELF_C_READ;
 	while ((arf = elf_begin(fd, cmd, elf_file)) != 0) {
+		size_t	len;
+
 		p_ar = elf_getarhdr(arf);
 		if (p_ar == NULL) {
 			(void) fprintf(stderr,
@@ -2542,8 +2547,11 @@
 			continue;
 		}
 
-		fullname = malloc(strlen(filename) + strlen(p_ar->ar_name) + 3);
-		(void) sprintf(fullname, "%s[%s]", filename, p_ar->ar_name);
+		len = strlen(filename) + strlen(p_ar->ar_name) + 3;
+		if ((fullname = malloc(len)) == NULL)
+			return;
+		(void) snprintf(fullname, len, "%s[%s]", filename,
+		    p_ar->ar_name);
 		(void) printf("\n%s:\n", fullname);
 		file_type = elf_kind(arf);
 		if (file_type == ELF_K_ELF) {
@@ -2593,26 +2601,21 @@
 	errno = 0;
 
 	if (stat(filename, &buf) == -1) {
-		(void) fprintf(stderr, "%s: ", prog_name);
-		perror(filename);
+		int	err = errno;
+		(void) fprintf(stderr, "%s: %s: %s", prog_name, filename,
+		    strerror(err));
 		return;
 	}
 
-	if (elf_version(EV_CURRENT) == EV_NONE) {
-		(void) fprintf(stderr,
-		"%s: Libelf is out of date\n", prog_name);
-		exit(101);
-	}
-
 	if ((fd = open((filename), O_RDONLY)) == -1) {
-		(void) fprintf(stderr, "%s: %s: cannot read\n",
-			prog_name, filename);
+		(void) fprintf(stderr, "%s: %s: cannot read\n", prog_name,
+		    filename);
 		return;
 	}
 	cmd = ELF_C_READ;
 	if ((elf_file = elf_begin(fd, cmd, (Elf *)0)) == NULL) {
-		(void) fprintf(stderr,
-		"%s: %s: %s\n", prog_name, filename, elf_errmsg(-1));
+		(void) fprintf(stderr, "%s: %s: %s\n", prog_name, filename,
+		    elf_errmsg(-1));
 		return;
 	}
 
@@ -2627,24 +2630,18 @@
 	} else {
 		if (file_type == ELF_K_ELF) {
 			(void) printf("\n%s:\n", filename);
-			if (dump_elf_header(elf_file, filename, &elf_head)
-			    == (GElf_Ehdr *)0) {
-					(void) elf_end(elf_file);
-					(void) close(fd);
-					return;
+			if (dump_elf_header(elf_file, filename, &elf_head)) {
+				if (o_flag)
+					dump_exec_header(elf_file,
+					    (unsigned)elf_head.e_phnum,
+					    filename);
+				if (x_flag)
+					dump_section_table(elf_file,
+					    &elf_head, filename);
 			}
-			if (o_flag)
-				dump_exec_header(elf_file,
-					(unsigned)elf_head.e_phnum, filename);
-			if (x_flag)
-				dump_section_table(elf_file,
-					&elf_head, filename);
 		} else {
 			(void) fprintf(stderr, "%s: %s: invalid file type\n",
-				prog_name, filename);
-			(void) elf_end(elf_file);
-			(void) close(fd);
-			return;
+			    prog_name, filename);
 		}
 	}
 	(void) elf_end(elf_file);
@@ -2661,7 +2658,6 @@
 	char *optstr = OPTSTR; /* option string used by getopt() */
 	int optchar;
 
-
 	/*
 	 * Check for a binary that better fits this architecture.
 	 */
@@ -2769,6 +2765,12 @@
 		}
 	}
 
+	if (elf_version(EV_CURRENT) == EV_NONE) {
+		(void) fprintf(stderr, "%s: libelf is out of date\n",
+		    prog_name);
+		exit(101);
+	}
+
 	while (optind < argc) {
 		each_file(argv[optind]);
 		optind++;
--- a/usr/src/cmd/sgs/dump/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,18 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 1998,2002 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
 
 include		../Makefile.com
 
 .KEEP_STATE:
 
+lint:		$(LINTOUT32) $(SGSLINTOUT)
+
 include		../Makefile.targ
--- a/usr/src/cmd/sgs/dump/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,18 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 1998,2002 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
 
 include		../Makefile.com
 
 .KEEP_STATE:
 
+lint:		$(LINTOUT32) $(SGSLINTOUT)
+
 include		../Makefile.targ
--- a/usr/src/cmd/sgs/dump/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/dump/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,12 +34,13 @@
 ELFLIBDIR =	$(ELFLIBDIR64)
 DEMLIB =	$(DEMLIB64)
 CONVLIBDIR =	$(CONVLIBDIR64)
-LINTFLAGS64 +=	-Xarch=v9
 
 ROOTCCSBINPROG=	$(ROOTCCSBINPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
 
+lint:		$(LINTOUT64) $(SGSLINTOUT)
+
 install \
 package:	$(ROOTCCSBINPROG64)
--- a/usr/src/cmd/sgs/elfdump/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/elfdump/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,40 +31,46 @@
 include		$(SRC)/cmd/Makefile.cmd
 include		$(SRC)/cmd/sgs/Makefile.com
 
-COMOBJ=		elfdump.o
-TOOLOBJS=	leb128.o
-BLTOBJ=		msg.o
+COMOBJ =	main.o
+
+COMOBJ32 =	elfdump32.o
+
+COMOBJ64 =	elfdump64.o
 
-OBJS=		$(BLTOBJ) $(COMOBJ) $(TOOLOBJS)
+TOOLOBJ =	leb128.o
+
+BLTOBJ =	msg.o
+
+OBJS=		$(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64) $(TOOLOBJ)
 
 MAPFILE=	../common/mapfile-vers
 
-CPPFLAGS=	-I. -I../../include -I../../include/$(MACH) \
-		-I../../liblddbg/common \
+CPPFLAGS=	-I. -I../common -I../../include -I../../include/$(MACH) \
 		-I$(SRCBASE)/uts/$(ARCH)/sys \
 		$(CPPFLAGS.master)
 LLDFLAGS =	$(VAR_ELFDUMP_LLDFLAGS)
 LLDFLAGS64 =	$(VAR_LD_LLDFLAGS64)
 LDFLAGS +=	$(VERSREF) $(USE_PROTO) -M$(MAPFILE) $(LLDFLAGS) $(ZLAZYLOAD)
 LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) $(LDDBG_LIB) \
-		$(CONVLIBDIR) -lconv
+		    $(CONVLIBDIR) $(CONV_LIB)
 
 LINTFLAGS +=	-x
 LINTFLAGS64 +=	-x
 
-BLTDEFS=	msg.h
-BLTDATA=	msg.c
-BLTMESG=	$(SGSMSGDIR)/elfdump
+BLTDEFS =	msg.h
+BLTDATA =	msg.c
+BLTMESG =	$(SGSMSGDIR)/elfdump
 
-BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
+BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM=	../common/elfdump.msg
-SGSMSGTARG=	$(SGSMSGCOM)
-SGSMSGALL=	$(SGSMSGCOM)
+SGSMSGCOM =	../common/elfdump.msg
+SGSMSGTARG =	$(SGSMSGCOM)
+SGSMSGALL =	$(SGSMSGCOM)
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n elfdump_msg
 
-SRCS=		$(COMOBJ:%.o=../common/%.c) $(TOOLOBJS:%.o=../../tools/common/%.c) \
-		$(BLTDATA)
-LINTSRCS=	$(SRCS) ../common/lintsup.c
+SRCS =		$(COMOBJ:%.o=../common/%.c) \
+		$(COMOBJ32:%32.o=../common/%.c) \
+		$(TOOLOBJ:%.o=../../tools/common/%.c) $(BLTDATA)
+LINTSRCS =	$(SRCS) ../common/lintsup.c
 
 CLEANFILES +=	$(LINTOUTS) $(BLTFILES)
--- a/usr/src/cmd/sgs/elfdump/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,28 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 %.o:		../common/%.c
-		$(COMPILE.c) $<
+		$(COMPILE.c) -o $@ $<
+		$(POST_PROCESS_O)
+
+%32.o:		../common/%.c
+		$(COMPILE.c) -o $@ $<
+		$(POST_PROCESS_O)
+
+%64.o:		../common/%.c
+		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
 %.o:		$(SGSTOOLS)/common/%.c
-		$(COMPILE.c) $<
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 $(PROG):	$(OBJS) $(MAPFILE)
@@ -52,7 +60,9 @@
 install \
 package:	all $(ROOTCCSBINPROG)
 
-lint:		$(LINTOUT32) $(SGSLINTOUT)
+.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
+
+lint:		$(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT)
 
 include		$(SRC)/cmd/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
--- a/usr/src/cmd/sgs/elfdump/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,9 +31,9 @@
 .KEEP_STATE:
 
 LLDFLAGS =	$(LLDFLAGS64)
-ELFLIBDIR=	$(ELFLIBDIR64)
-LDDBGLIBDIR=	$(LDDBGLIBDIR64)
-CONVLIBDIR=	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
 ROOTCCSBINPROG= $(ROOTCCSBINPROG64)
@@ -43,4 +43,3 @@
 
 install \
 package:	$(ROOTCCSBINPROG64)
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/elfdump/common/_elfdump.h	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+#ifndef	__ELFDUMP_H
+#define	__ELFDUMP_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<machelf.h>
+#include	<debug.h>
+
+/*
+ * Local include file for elfdump.
+ */
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#define	FLG_DYNAMIC	0x00000001
+#define	FLG_EHDR	0x00000002
+#define	FLG_INTERP	0x00000004
+#define	FLG_SHDR	0x00000008
+#define	FLG_NOTE	0x00000010
+#define	FLG_PHDR	0x00000020
+#define	FLG_RELOC	0x00000040
+#define	FLG_SYMBOLS	0x00000080
+#define	FLG_VERSIONS	0x00000100
+#define	FLG_HASH	0x00000200
+#define	FLG_GOT		0x00000400
+#define	FLG_SYMINFO	0x00000800
+#define	FLG_MOVE	0x00001000
+#define	FLG_GROUP	0x00002000
+#define	FLG_CAP		0x00004000
+#define	FLG_UNWIND	0x00008000
+#define	FLG_LONGNAME	0x00100000	/* not done by default */
+#define	FLG_CHECKSUM	0x00200000	/* not done by default */
+#define	FLG_DEMANGLE	0x00400000	/* not done by default */
+#define	FLG_EVERYTHING	0x000fffff
+
+#define	MAXNDXSIZE	10
+
+typedef struct cache {
+	Shdr		*c_shdr;
+	Elf_Data	*c_data;
+	char		*c_name;
+} Cache;
+
+typedef struct got_info {
+	Word		g_reltype;	/* it will never happen, but */
+					/* support mixed relocations */
+	void		*g_rel;
+	const char	*g_symname;
+} Got_info;
+
+extern	const Cache	 cache_init;
+
+extern	void		failure(const char *, const char *);
+extern	const char	*demangle(const char *, uint_t);
+
+/*
+ * Define various elfdump() functions into their 32-bit and 64-bit variants.
+ */
+#if	defined(_ELF64)
+#define	cap			cap64
+#define	checksum		checksum64
+#define	dynamic			dynamic64
+#define	got			got64
+#define	group			group64
+#define	hash			hash64
+#define	interp			interp64
+#define	move			move64
+#define	note			note64
+#define	note_entry		note_entry64
+#define	regular			regular64
+#define	reloc			reloc64
+#define	sections		sections64
+#define	string			string64
+#define	symbols			symbols64
+#define	syminfo			syminfo64
+#define	symlookup		symlookup64
+#define	unwind			unwind64
+#define	versions		versions64
+#define	version_def		version_def64
+#define	version_need		version_need64
+#else
+#define	cap			cap32
+#define	checksum		checksum32
+#define	dynamic			dynamic32
+#define	got			got32
+#define	group			group32
+#define	hash			hash32
+#define	interp			interp32
+#define	move			move32
+#define	note			note32
+#define	note_entry		note_entry32
+#define	regular			regular32
+#define	reloc			reloc32
+#define	sections		sections32
+#define	string			string32
+#define	symbols			symbols32
+#define	syminfo			syminfo32
+#define	symlookup		symlookup32
+#define	unwind			unwind32
+#define	versions		versions32
+#define	version_def		version_def32
+#define	version_need		version_need32
+#endif
+
+extern	void	regular32(const char *, Elf *, uint_t, char *, int);
+extern	void	regular64(const char *, Elf *, uint_t, char *, int);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* __ELFDUMP_H */
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -29,151 +28,33 @@
 /*
  * Dump an elf file.
  */
-#include	<sys/param.h>
-#include	<fcntl.h>
-#include	<stdio.h>
-#include	<libelf.h>
-#include	<gelf.h>
-#include	<link.h>
-#include	<stdarg.h>
+#include	<machdep.h>
+#include	<sys/elf_386.h>
+#include	<sys/elf_amd64.h>
+#include	<sys/elf_SPARC.h>
+#include	<dwarf.h>
 #include	<unistd.h>
-#include	<libgen.h>
-#include	<libintl.h>
-#include	<locale.h>
 #include	<errno.h>
 #include	<strings.h>
-#include	<sys/elf_SPARC.h>
-#include	<sys/elf_386.h>
-#include	<sys/elf_amd64.h>
 #include	<debug.h>
-#include	<_debug.h>
 #include	<conv.h>
 #include	<msg.h>
-#include	<dwarf.h>
-
-#define	FLG_DYNAMIC	0x00000001
-#define	FLG_EHDR	0x00000002
-#define	FLG_INTERP	0x00000004
-#define	FLG_SHDR	0x00000008
-#define	FLG_NOTE	0x00000010
-#define	FLG_PHDR	0x00000020
-#define	FLG_RELOC	0x00000040
-#define	FLG_SYMBOLS	0x00000080
-#define	FLG_VERSIONS	0x00000100
-#define	FLG_HASH	0x00000200
-#define	FLG_GOT		0x00000400
-#define	FLG_SYMINFO	0x00000800
-#define	FLG_MOVE	0x00001000
-#define	FLG_GROUP	0x00002000
-#define	FLG_CAP		0x00004000
-#define	FLG_UNWIND	0x00008000
-#define	FLG_LONGNAME	0x00100000	/* not done by default */
-#define	FLG_CHECKSUM	0x00200000	/* not done by default */
-#define	FLG_DEMANGLE	0x00400000	/* not done by default */
-
-#define	FLG_EVERYTHING	0x000fffff
-
-#define	IAM_SPARC(X)	\
-	((X == EM_SPARC) || (X == EM_SPARC32PLUS) || (X == EM_SPARCV9))
-#define	IAM_INTEL(X)	\
-	(X == EM_386)
-
-#define	MAXNDXSIZE	10
-
-typedef struct cache {
-	GElf_Shdr	c_shdr;
-	Elf_Data	*c_data;
-	char		*c_name;
-} Cache;
-
-typedef struct got_info {
-	GElf_Word	g_rshtype;	/* it will never happen, but */
-					/* support mixed relocations */
-	GElf_Rela	g_rela;
-	const char	*g_symname;
-} Got_info;
-
-static const Cache	_cache_init = {{0}, NULL, NULL};
-
-const char *
-_elfdump_msg(Msg mid)
-{
-	return (gettext(MSG_ORIG(mid)));
-}
-
-/*
- * Determine whether a symbol name should be demangled.
- */
-static const char *
-demangle(const char *name, uint32_t flags)
-{
-	if (flags & FLG_DEMANGLE)
-		return (Gelf_sym_dem(name));
-	else
-		return ((char *)name);
-}
-
-
-/*
- * Define our own printing routine.  All Elf routines referenced call upon
- * this routine to carry out the actual printing.
- */
-/*PRINTFLIKE1*/
-void
-dbg_print(const char *format, ...)
-{
-	va_list		ap;
-
-	va_start(ap, format);
-	(void) vprintf(format, ap);
-	(void) printf(MSG_ORIG(MSG_STR_NL));
-	va_end(ap);
-}
-
-/*
- * Just like dbg_print - except that it does not insert
- * a newline at the end.  Can be used for printing tables
- * and such.
- */
-/*PRINTFLIKE1*/
-void
-dbg_printf(const char *format, ...)
-{
-	va_list	    ap;
-	va_start(ap, format);
-	(void) vprintf(format, ap);
-	va_end(ap);
-}
-
-
-
-/*
- * Define our own standard error routine.
- */
-static void
-failure(const char *file, const char *func)
-{
-	(void) fprintf(stderr, MSG_INTL(MSG_ERR_FAILURE),
-	    file, func, elf_errmsg(elf_errno()));
-	(void) fflush(stderr);
-}
-
+#include	<_elfdump.h>
 
 /*
  * Focal point for verifying symbol names.
  */
 static const char *
-string(Cache *refsec, GElf_Word ndx, Cache *strsec, const char *file,
-    ulong_t name)
+string(Cache *refsec, Word ndx, Cache *strsec, const char *file, Word name)
 {
 	static Cache	*osec = 0;
 	static int	nostr;
 
 	const char	*strs = (char *)strsec->c_data->d_buf;
-	ulong_t		strn = strsec->c_data->d_size;
+	Word		strn = strsec->c_data->d_size;
 
 	/*
-	 * Only print a diagnoistic regarding an empty string table once per
+	 * Only print a diagnostic regarding an empty string table once per
 	 * input section being processed.
 	 */
 	if (osec != refsec) {
@@ -192,14 +73,12 @@
 			if (nostr == 0) {
 				(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
 				    file, strsec->c_name);
-				(void) fflush(stderr);
 				nostr++;
 			}
 		} else {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSTOFF),
-			    file, refsec->c_name, ndx, strsec->c_name,
-			    EC_XWORD(name), EC_XWORD(strn - 1));
-			(void) fflush(stderr);
+			    file, refsec->c_name, EC_WORD(ndx), strsec->c_name,
+			    EC_WORD(name), EC_WORD(strn - 1));
 		}
 
 		/*
@@ -212,64 +91,152 @@
 }
 
 /*
- * Lookup a symbol and set Sym accordingly.
- *
- * Returns:
- *	1 - symbol found
- *	0 - symbol not found
+ * Relocations can reference section symbols and standard symbols.  If the
+ * former, establish the section name.
+ */
+static const char *
+relsymname(Cache *cache, Cache *csec, Cache *strsec, Word symndx, Word symnum,
+    Word relndx, Sym *syms, char *secstr, size_t secsz, const char *file,
+    uint_t flags)
+{
+	Sym	*sym;
+
+	if (symndx >= symnum) {
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_RELBADSYMNDX),
+		    file, EC_WORD(symndx), EC_WORD(relndx));
+		return (MSG_INTL(MSG_STR_UNKNOWN));
+	}
+
+	sym = (Sym *)(syms + symndx);
+
+	/*
+	 * If the symbol represents a section offset construct an appropriate
+	 * string.
+	 */
+	if ((ELF_ST_TYPE(sym->st_info) == STT_SECTION) && (sym->st_name == 0)) {
+		if (flags & FLG_LONGNAME)
+			(void) snprintf(secstr, secsz,
+			    MSG_INTL(MSG_STR_L_SECTION),
+			    cache[sym->st_shndx].c_name);
+		else
+			(void) snprintf(secstr, secsz,
+			    MSG_INTL(MSG_STR_SECTION),
+			    cache[sym->st_shndx].c_name);
+		return ((const char *)secstr);
+	}
+
+	return (string(csec, symndx, strsec, file, sym->st_name));
+}
+
+/*
+ * Focal point for establishing a string table section.  Data such as the
+ * dynamic information simply points to a string table.  Data such as
+ * relocations, reference a symbol table, which in turn is associated with a
+ * string table.
  */
 static int
-symlookup(const char *name, Cache *cache, GElf_Word shnum, GElf_Sym *sym,
+stringtbl(Cache *cache, int symtab, Word ndx, Word shnum, const char *file,
+    Word *symnum, Cache **symsec, Cache **strsec)
+{
+	Shdr	*shdr = cache[ndx].c_shdr;
+
+	if (symtab) {
+		/*
+		 * Validate the symbol table section.
+		 */
+		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
+			    file, cache[ndx].c_name, EC_WORD(shdr->sh_link));
+			return (0);
+		}
+
+		/*
+		 * Obtain, and verify the symbol table data.
+		 */
+		if (cache[ndx].c_data->d_buf == 0) {
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
+			    file, cache[ndx].c_name);
+			return (0);
+		}
+
+		/*
+		 * Establish the string table index.
+		 */
+		ndx = shdr->sh_link;
+		shdr = cache[ndx].c_shdr;
+
+		/*
+		 * Return symbol table information.
+		 */
+		if (symnum)
+			*symnum = (shdr->sh_size / shdr->sh_entsize);
+		if (symsec)
+			*symsec = &cache[ndx];
+	}
+
+	/*
+	 * Validate the associated string table section.
+	 */
+	if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
+		    file, cache[ndx].c_name, EC_WORD(shdr->sh_link));
+		return (0);
+	}
+
+	if (strsec)
+		*strsec = &cache[shdr->sh_link];
+
+	return (1);
+}
+
+/*
+ * Lookup a symbol and set Sym accordingly.
+ */
+static int
+symlookup(const char *name, Cache *cache, Word shnum, Sym **sym,
     Cache *symtab, const char *file)
 {
-	GElf_Shdr *	shdr;
-	GElf_Word	symn, cnt;
+	Shdr	*shdr;
+	Word	symn, cnt;
+	Sym	*syms;
 
 	if (symtab == 0)
 		return (0);
 
-	shdr = &symtab->c_shdr;
+	shdr = symtab->c_shdr;
+
 	/*
 	 * Determine the symbol data and number.
 	 */
 	if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
 		    file, symtab->c_name);
-		(void) fflush(stderr);
 		return (0);
 	}
 	/* LINTED */
-	symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize);
+	symn = (Word)(shdr->sh_size / shdr->sh_entsize);
+	syms = (Sym *)symtab->c_data->d_buf;
 
 	/*
 	 * Get the associated string table section.
 	 */
 	if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-		    file, symtab->c_name, EC_XWORD(shdr->sh_link));
-		(void) fflush(stderr);
+		    file, symtab->c_name, EC_WORD(shdr->sh_link));
 		return (0);
 	}
 
 	/*
 	 * Loop through the symbol table to find a match.
 	 */
-	for (cnt = 0; cnt < symn; cnt++) {
-		GElf_Sym	tsym;
-		const char	*sname;
+	for (cnt = 0; cnt < symn; syms++, cnt++) {
+		const char	*symname;
 
-		if (gelf_getsym(symtab->c_data, cnt, &tsym) == NULL) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM),
-			    file, symtab->c_name, elf_errmsg(0));
-			(void) fflush(stderr);
-			return (0);
-		}
+		symname = string(symtab, cnt, &cache[shdr->sh_link], file,
+		    syms->st_name);
 
-		sname = string(symtab, cnt, &cache[shdr->sh_link], file,
-		    tsym.st_name);
-
-		if (strcmp(name, sname) == 0) {
-			*sym = tsym;
+		if (symname && (strcmp(name, symname) == 0)) {
+			*sym = syms;
 			return (1);
 		}
 	}
@@ -277,74 +244,39 @@
 }
 
 /*
- * The full usage message
- */
-static void
-detail_usage()
-{
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL1));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL2));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL3));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL4));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL5));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL6));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL7));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL8));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9_1));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL10));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL11));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL12));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL13));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL14));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL15));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL16));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL17));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL18));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL19));
-	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL20));
-	(void) fflush(stderr);
-}
-
-/*
  * Print section headers.
  */
 static void
-sections(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum,
-    GElf_Ehdr *ehdr, const char *name)
+sections(const char *file, Cache *cache, Word shnum, Ehdr *ehdr,
+    const char *name)
 {
-	GElf_Word	cnt;
-	Cache *		_cache;
+	size_t	seccnt;
 
-	for (cnt = 1; cnt < shnum; cnt++) {
-		GElf_Shdr	*shdr;
-		const char	*sname;
+	for (seccnt = 1; seccnt < shnum; seccnt++) {
+		Cache		*_cache = &cache[seccnt];
+		Shdr		*shdr = _cache->c_shdr;
+		const char	*secname = _cache->c_name;
 
-		_cache = &cache[cnt];
-		sname = _cache->c_name;
-		if (name && strcmp(name, sname))
+		if (name && strcmp(name, secname))
 			continue;
 
 		/*
 		 * Although numerous section header entries can be zero, it's
 		 * usually a sign of trouble if the name or type are zero.
 		 */
-		shdr = &_cache->c_shdr;
 		if (shdr->sh_type == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHTYPE),
-			    file, sname, EC_XWORD(shdr->sh_type));
-			(void) fflush(stderr);
+			    file, secname, EC_WORD(shdr->sh_type));
 		}
 		if (shdr->sh_name == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHNAME),
-			    file, sname, EC_XWORD(shdr->sh_name));
-			(void) fflush(stderr);
+			    file, secname, EC_XWORD(shdr->sh_name));
 
 			/*
 			 * Use the empty string, rather than the fabricated
 			 * name for the section output.
 			 */
-			sname = MSG_ORIG(MSG_STR_EMPTY);
+			secname = MSG_ORIG(MSG_STR_EMPTY);
 		}
 
 		/*
@@ -352,66 +284,100 @@
 		 * shouldn't exist in a relocatable object.
 		 */
 		if (ehdr->e_type == ET_REL) {
-			if (strncmp(sname, MSG_ORIG(MSG_ELF_GOT),
+			if (strncmp(secname, MSG_ORIG(MSG_ELF_GOT),
 			    MSG_ELF_GOT_SIZE) == 0) {
 				(void) fprintf(stderr,
-				    MSG_INTL(MSG_GOT_UNEXPECTED), file, sname);
-				(void) fflush(stderr);
+				    MSG_INTL(MSG_GOT_UNEXPECTED), file,
+				    secname);
 			}
 		}
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		/* LINTED */
-		dbg_print(MSG_INTL(MSG_ELF_SHDR), (uint_t)cnt, sname);
-		Gelf_shdr_entry(ehdr->e_machine, shdr);
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SHDR), EC_WORD(seccnt), secname);
+		Elf_shdr(0, ehdr->e_machine, shdr);
 	}
 }
 
+/*
+ * A couple of instances of unwind data are printed as tables of 8 data items
+ * expressed as 0x?? integers.
+ */
+#define	UNWINDTBLSZ	10 + (8 * 5) + 1
+
+static void
+unwindtbl(uint64_t *ndx, uint_t len, uchar_t *data, uint64_t doff,
+    const char *msg, const char *pre, size_t plen)
+{
+	char	buffer[UNWINDTBLSZ];
+	uint_t	boff = plen, cnt = 0;
+
+	dbg_print(0, msg);
+	(void) strncpy(buffer, pre, UNWINDTBLSZ);
+
+	while (*ndx < (len + 4)) {
+		if (cnt == 8) {
+			dbg_print(0, buffer);
+			boff = plen;
+			cnt = 0;
+		}
+		(void) snprintf(&buffer[boff], UNWINDTBLSZ - boff,
+		    MSG_ORIG(MSG_UNW_TBLENTRY), data[doff + (*ndx)++]);
+		boff += 5;
+		cnt++;
+	}
+	if (cnt)
+		dbg_print(0, buffer);
+}
+
+/*
+ * Obtain a specified Phdr entry.
+ */
+static Phdr *
+getphdr(Word phnum, Word type, const char *file, Elf *elf)
+{
+	Word	cnt;
+	Phdr	*phdr;
+
+	if ((phdr = elf_getphdr(elf)) == NULL) {
+		failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
+		return (0);
+	}
+
+	for (cnt = 0; cnt < phnum; phdr++, cnt++) {
+		if (phdr->p_type == type)
+			return (phdr);
+	}
+	return (0);
+}
+
 static void
-unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr,
-    const char *name, const char *file, Elf *elf)
+unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, const char *name,
+    const char *file, Elf *elf)
 {
-	GElf_Word	cnt;
-	GElf_Phdr	unwind_phdr;
+	Word	cnt;
+	Phdr	*uphdr = 0;
+
 	/*
-	 * For the moment - UNWIND is only relevant for
-	 * a AMD64 object
+	 * For the moment - UNWIND is only relevant for a AMD64 object.
 	 */
 	if (ehdr->e_machine != EM_AMD64)
-	    return;
-
-	unwind_phdr.p_type = PT_NULL;
-
-	for (cnt = 0; cnt < phnum; cnt++) {
-		GElf_Phdr	phdr;
+		return;
 
-		if (gelf_getphdr(elf, cnt, &phdr) == NULL) {
-			failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
-			return;
-		}
-
-		if (phdr.p_type == PT_SUNW_UNWIND) {
-			unwind_phdr = phdr;
-			break;
-		}
-	}
-
+	if (phnum)
+		uphdr = getphdr(phnum, PT_SUNW_UNWIND, file, elf);
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		Cache		*_cache;
-		GElf_Shdr	*shdr;
-		unsigned char	*data;
+		Cache		*_cache = &cache[cnt];
+		Shdr		*shdr = _cache->c_shdr;
+		uchar_t		*data;
 		size_t		datasize;
-		uint64_t	off, ndx;
-
+		uint64_t	off, ndx, frame_ptr, fde_cnt, tabndx;
+		uint_t		vers, frame_ptr_enc, fde_cnt_enc, table_enc;
 
-		_cache = &cache[cnt];
-		shdr = &_cache->c_shdr;
 		/*
-		 * XX64 - this is a strmcp() just to find the gcc
-		 *	  produced sections.  Soon gcc should be
-		 *	  settng the section type - and we'll not need
-		 *	  this strcmp().
+		 * AMD64 - this is a strmcp() just to find the gcc produced
+		 * sections.  Soon gcc should be setting the section type - and
+		 * we'll not need this strcmp().
 		 */
 		if ((shdr->sh_type != SHT_AMD64_UNWIND) &&
 		    (strncmp(_cache->c_name, MSG_ORIG(MSG_SCN_FRM),
@@ -422,70 +388,54 @@
 		if (name && strcmp(name, _cache->c_name))
 			continue;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_UNWIND), _cache->c_name);
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_UNWIND), _cache->c_name);
 
-		data = (unsigned char *)(_cache->c_data->d_buf);
+		data = (uchar_t *)(_cache->c_data->d_buf);
 		datasize = _cache->c_data->d_size;
 		off = 0;
 
 		/*
 		 * Is this a .eh_frame_hdr
 		 */
-		if (((unwind_phdr.p_type == PT_SUNW_UNWIND) &&
-		    (shdr->sh_addr == unwind_phdr.p_vaddr)) ||
+		if ((uphdr && (shdr->sh_addr == uphdr->p_vaddr)) ||
 		    (strncmp(_cache->c_name, MSG_ORIG(MSG_SCN_FRMHDR),
-			MSG_SCN_FRMHDR_SIZE) == 0)) {
-			    uint_t	vers;
-			    uint_t	frame_ptr_enc;
-			    uint64_t	frame_ptr;
-			    uint_t	fde_cnt_enc;
-			    uint64_t	fde_cnt;
-			    uint_t	table_enc;
-			    uint64_t	tabndx;
+		    MSG_SCN_FRMHDR_SIZE) == 0)) {
+
+			dbg_print(0, MSG_ORIG(MSG_UNW_FRMHDR));
+			ndx = 0;
 
-			    dbg_print(MSG_ORIG(MSG_UNW_FRMHDR));
-			    ndx = 0;
+			vers = data[ndx++];
+			frame_ptr_enc = data[ndx++];
+			fde_cnt_enc = data[ndx++];
+			table_enc = data[ndx++];
 
-			    vers = data[ndx++];
-			    frame_ptr_enc = data[ndx++];
-			    fde_cnt_enc = data[ndx++];
-			    table_enc = data[ndx++];
+			dbg_print(0, MSG_ORIG(MSG_UNW_FRMVERS), vers);
 
-			    dbg_print(MSG_ORIG(MSG_UNW_FRMVERS), vers);
-
-			    frame_ptr = dwarf_ehe_extract(data,
-				&ndx, frame_ptr_enc, ehdr->e_ident,
-				shdr->sh_addr + ndx);
+			frame_ptr = dwarf_ehe_extract(data, &ndx, frame_ptr_enc,
+			    ehdr->e_ident, shdr->sh_addr + ndx);
 
-			    dbg_print(MSG_ORIG(MSG_UNW_FRPTRENC),
-				conv_dwarf_ehe_str(frame_ptr_enc),
-				frame_ptr);
+			dbg_print(0, MSG_ORIG(MSG_UNW_FRPTRENC),
+			    conv_dwarf_ehe(frame_ptr_enc), EC_XWORD(frame_ptr));
+
+			fde_cnt = dwarf_ehe_extract(data, &ndx, fde_cnt_enc,
+			    ehdr->e_ident, shdr->sh_addr + ndx);
 
-			    fde_cnt = dwarf_ehe_extract(data,
-				&ndx, fde_cnt_enc, ehdr->e_ident,
-				shdr->sh_addr + ndx);
-			    dbg_print(MSG_ORIG(MSG_UNW_FDCNENC),
-				    conv_dwarf_ehe_str(fde_cnt_enc),
-				    fde_cnt);
-			    dbg_print(MSG_ORIG(MSG_UNW_TABENC),
-				    conv_dwarf_ehe_str(table_enc));
-			    dbg_print(MSG_ORIG(MSG_UNW_BINSRTAB1));
-			    dbg_print(MSG_ORIG(MSG_UNW_BINSRTAB2));
+			dbg_print(0, MSG_ORIG(MSG_UNW_FDCNENC),
+			    conv_dwarf_ehe(fde_cnt_enc), EC_XWORD(fde_cnt));
+			dbg_print(0, MSG_ORIG(MSG_UNW_TABENC),
+			    conv_dwarf_ehe(table_enc));
+			dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTAB1));
+			dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTAB2));
 
-			    for (tabndx = 0; tabndx < fde_cnt; tabndx++) {
-				    uint64_t	init_loc;
-				    uint64_t	fde_loc;
-				    init_loc = dwarf_ehe_extract(data,
-					&ndx, table_enc, ehdr->e_ident,
-					shdr->sh_addr);
-				    fde_loc = dwarf_ehe_extract(data,
-					&ndx, table_enc, ehdr->e_ident,
-					shdr->sh_addr);
-				    dbg_print(MSG_ORIG(MSG_UNW_BINSRTABENT),
-					init_loc, fde_loc);
-			    }
-			    continue;
+			for (tabndx = 0; tabndx < fde_cnt; tabndx++) {
+				dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTABENT),
+				    EC_XWORD(dwarf_ehe_extract(data, &ndx,
+				    table_enc, ehdr->e_ident, shdr->sh_addr)),
+				    EC_XWORD(dwarf_ehe_extract(data, &ndx,
+				    table_enc, ehdr->e_ident, shdr->sh_addr)));
+			}
+			continue;
 		}
 
 		/*
@@ -494,12 +444,10 @@
 		while (off < datasize) {
 			uint_t		cieid, cielength, cieversion,
 					cieretaddr;
-			int		cieRflag, cieLflag,
-					ciePflag, cieZflag;
-			uint_t		length,	id;
+			int		cieRflag, cieLflag, ciePflag, cieZflag;
+			uint_t		cieaugndx, length, id;
 			uint64_t	ciecalign, ciedalign;
 			char		*cieaugstr;
-			uint_t		cieaugndx;
 
 			ndx = 0;
 			/*
@@ -515,47 +463,50 @@
 			ndx += 4;
 
 			/*
-			 * A CIE record has a id of '0', otherwise
-			 * this is a FDE entry and the 'id' is the
-			 * CIE pointer.
+			 * A CIE record has a id of '0', otherwise this is a
+			 * FDE entry and the 'id' is the CIE pointer.
 			 */
 			if (id == 0) {
 				uint64_t    persVal;
+
 				cielength = length;
 				cieid = id;
+				cieLflag = ciePflag = cieRflag = cieZflag = 0;
 
-				cieLflag = 0;
-				ciePflag = 0;
-				cieRflag = 0;
-				cieZflag = 0;
+				dbg_print(0, MSG_ORIG(MSG_UNW_CIE),
+				    EC_XWORD(shdr->sh_addr + off));
+				dbg_print(0, MSG_ORIG(MSG_UNW_CIELNGTH),
+				    cielength, cieid);
 
-				dbg_print(MSG_ORIG(MSG_UNW_CIE),
-				    shdr->sh_addr + off);
-				dbg_print(MSG_ORIG(MSG_UNW_CIELNGTH),
-				    cielength, cieid);
 				cieversion = data[off + ndx];
 				ndx += 1;
 				cieaugstr = (char *)(&data[off + ndx]);
 				ndx += strlen(cieaugstr) + 1;
-				dbg_print(MSG_ORIG(MSG_UNW_CIEVERS),
-					cieversion, cieaugstr);
+
+				dbg_print(0, MSG_ORIG(MSG_UNW_CIEVERS),
+				    cieversion, cieaugstr);
+
 				ciecalign = uleb_extract(&data[off], &ndx);
 				ciedalign = sleb_extract(&data[off], &ndx);
 				cieretaddr = data[off + ndx];
 				ndx += 1;
-				dbg_print(MSG_ORIG(MSG_UNW_CIECALGN),
-				    ciecalign, ciedalign, cieretaddr);
+
+				dbg_print(0, MSG_ORIG(MSG_UNW_CIECALGN),
+				    EC_XWORD(ciecalign), EC_XWORD(ciedalign),
+				    cieretaddr);
 
 				if (cieaugstr[0])
-				    dbg_print(MSG_ORIG(MSG_UNW_CIEAUXVAL));
+				    dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXVAL));
+
 				for (cieaugndx = 0; cieaugstr[cieaugndx];
 				    cieaugndx++) {
 					uint_t	val;
+
 					switch (cieaugstr[cieaugndx]) {
 					case 'z':
 					    val = uleb_extract(&data[off],
 						&ndx);
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_CIEAUXSIZE),
 						val);
 					    cieZflag = 1;
@@ -568,60 +519,52 @@
 						&data[off],
 						&ndx, ciePflag, ehdr->e_ident,
 						shdr->sh_addr + off + ndx);
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_CIEAUXPERS),
 						ciePflag,
-						conv_dwarf_ehe_str(ciePflag),
+						conv_dwarf_ehe(ciePflag),
 						EC_XWORD(persVal));
 					    break;
 					case 'R':
 					    val = data[off + ndx];
 					    ndx += 1;
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_CIEAUXCENC),
-						val, conv_dwarf_ehe_str(val));
+						val, conv_dwarf_ehe(val));
 					    cieRflag = val;
 					    break;
 					case 'L':
 					    val = data[off + ndx];
 					    ndx += 1;
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_CIEAUXLSDA),
-						val, conv_dwarf_ehe_str(val));
+						val, conv_dwarf_ehe(val));
 					    cieLflag = val;
 					    break;
 					default:
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_CIEAUXUNEC),
 						cieaugstr[cieaugndx]);
 					    break;
 					}
 				}
-				if ((cielength + 4) > ndx) {
-					uint_t	    cnt;
-					dbg_printf(MSG_ORIG(MSG_UNW_CIECFI));
-					cnt = 0;
-					while (ndx < (cielength + 4)) {
-						if ((cnt++ % 8) == 0) {
-						    dbg_printf(
-						    MSG_ORIG(MSG_UNW_CIECFI1));
-						}
-						dbg_printf(
-						    MSG_ORIG(MSG_UNW_CIECFI2),
-						    data[off + ndx++]);
-					}
-					dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-				}
+				if ((cielength + 4) > ndx)
+					unwindtbl(&ndx, cielength, data, off,
+					    MSG_ORIG(MSG_UNW_CIECFI),
+					    MSG_ORIG(MSG_UNW_CIEPRE),
+					    MSG_UNW_CIEPRE_SIZE);
 				off += cielength + 4;
+
 			} else {
 				uint_t	    fdelength = length;
 				int	    fdecieptr = id;
 				uint64_t    fdeinitloc, fdeaddrrange;
 
-				dbg_print(MSG_ORIG(MSG_UNW_FDE),
-				    shdr->sh_addr + off);
-				dbg_print(MSG_ORIG(MSG_UNW_FDELNGTH),
+				dbg_print(0, MSG_ORIG(MSG_UNW_FDE),
+				    EC_XWORD(shdr->sh_addr + off));
+				dbg_print(0, MSG_ORIG(MSG_UNW_FDELNGTH),
 				    fdelength, fdecieptr);
+
 				fdeinitloc = dwarf_ehe_extract(&data[off],
 				    &ndx, cieRflag, ehdr->e_ident,
 				    shdr->sh_addr + off + ndx);
@@ -629,41 +572,35 @@
 				    &ndx, (cieRflag & ~DW_EH_PE_pcrel),
 				    ehdr->e_ident,
 				    shdr->sh_addr + off + ndx);
-				dbg_print(MSG_ORIG(MSG_UNW_FDEINITLOC),
-				    fdeinitloc, fdeaddrrange);
+
+				dbg_print(0, MSG_ORIG(MSG_UNW_FDEINITLOC),
+				    EC_XWORD(fdeinitloc),
+				    EC_XWORD(fdeaddrrange));
+
 				if (cieaugstr[0])
-					dbg_print(MSG_ORIG(MSG_UNW_FDEAUXVAL));
+					dbg_print(0,
+					    MSG_ORIG(MSG_UNW_FDEAUXVAL));
 				if (cieZflag) {
 					uint64_t    val;
 					val = uleb_extract(&data[off], &ndx);
-					dbg_print(
-					    MSG_ORIG(MSG_UNW_FDEAUXSIZE), val);
+					dbg_print(0,
+					    MSG_ORIG(MSG_UNW_FDEAUXSIZE),
+					    EC_XWORD(val));
 					if (val & cieLflag) {
 					    fdeinitloc = dwarf_ehe_extract(
 						&data[off], &ndx, cieLflag,
 						ehdr->e_ident,
 						shdr->sh_addr + off + ndx);
-					    dbg_print(
+					    dbg_print(0,
 						MSG_ORIG(MSG_UNW_FDEAUXLSDA),
-						val);
+						EC_XWORD(val));
 					}
 				}
-				if ((fdelength + 4) > ndx) {
-					uint_t	    cnt;
-					dbg_printf(MSG_ORIG(MSG_UNW_FDECFI));
-					cnt = 0;
-					while (ndx < (fdelength + 4)) {
-						if ((cnt++ % 8) == 0) {
-						    dbg_printf(
-						    MSG_ORIG(MSG_UNW_FDECFI1));
-						}
-						dbg_printf(
-						MSG_ORIG(MSG_UNW_FDECFI2),
-						data[off + ndx++]);
-					}
-					dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-				}
-
+				if ((fdelength + 4) > ndx)
+					unwindtbl(&ndx, fdelength, data, off,
+					    MSG_ORIG(MSG_UNW_FDECFI),
+					    MSG_ORIG(MSG_UNW_FDEPRE),
+					    MSG_UNW_FDEPRE_SIZE);
 				off += fdelength + 4;
 			}
 		}
@@ -675,30 +612,32 @@
  * this should be accompanied with a program header.
  */
 static void
-cap(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum,
-    GElf_Ehdr *ehdr, Elf *elf)
+cap(const char *file, Cache *cache, Word shnum, Word phnum, Ehdr *ehdr,
+    Elf *elf)
 {
-	GElf_Word	cnt;
-	GElf_Shdr *	cshdr = 0;
+	Word		cnt;
+	Shdr *		cshdr = 0;
 	Cache *		ccache;
-	Elf64_Off	cphdr_off = 0;
-	Elf64_Xword	cphdr_sz;
+	Off		cphdr_off = 0;
+	Xword		cphdr_sz;
 
 	/*
 	 * Determine if a hardware/software capabilities header exists.
 	 */
-	for (cnt = 0; cnt < phnum; cnt++) {
-		GElf_Phdr	phdr;
+	if (phnum) {
+		Phdr	*phdr;
 
-		if (gelf_getphdr(elf, cnt, &phdr) == NULL) {
+		if ((phdr = elf_getphdr(elf)) == NULL) {
 			failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
 			return;
 		}
 
-		if (phdr.p_type == PT_SUNWCAP) {
-			cphdr_off = phdr.p_offset;
-			cphdr_sz = phdr.p_filesz;
-			break;
+		for (cnt = 0; cnt < phnum; phdr++, cnt++) {
+			if (phdr->p_type == PT_SUNWCAP) {
+				cphdr_off = phdr->p_offset;
+				cphdr_sz = phdr->p_filesz;
+				break;
+			}
 		}
 	}
 
@@ -706,11 +645,8 @@
 	 * Determine if a hardware/software capabilities section exists.
 	 */
 	for (cnt = 1; cnt < shnum; cnt++) {
-		Cache *		_cache;
-		GElf_Shdr	*shdr;
-
-		_cache = &cache[cnt];
-		shdr = &_cache->c_shdr;
+		Cache	*_cache = &cache[cnt];
+		Shdr	*shdr = _cache->c_shdr;
 
 		if (shdr->sh_type != SHT_SUNW_cap)
 			continue;
@@ -731,28 +667,19 @@
 	 * Print the hardware/software capabilities section.
 	 */
 	if (cshdr) {
-		GElf_Word	ndx, capn;
-
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_CAP), ccache->c_name);
+		Word	ndx, capn;
+		Cap	*cap = (Cap *)ccache->c_data->d_buf;
 
-		Gelf_cap_title();
-
-		/* LINTED */
-		capn = (GElf_Word)(cshdr->sh_size / cshdr->sh_entsize);
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_CAP), ccache->c_name);
 
-		/* LINTED */
-		for (ndx = 0; ndx < capn; ndx++) {
-			GElf_Cap	cap;
+		Elf_cap_title(0);
+
+		capn = (Word)(cshdr->sh_size / cshdr->sh_entsize);
 
-			if (gelf_getcap(ccache->c_data, ndx, &cap) == NULL) {
-				(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADCAP),
-				    file, ccache->c_name, elf_errmsg(0));
-				(void) fflush(stderr);
-				return;
-			}
-			if (cap.c_tag != CA_SUNW_NULL)
-				Gelf_cap_print(&cap, ndx, ehdr->e_machine);
+		for (ndx = 0; ndx < capn; cap++, ndx++) {
+			if (cap->c_tag != CA_SUNW_NULL)
+				Elf_cap_entry(0, cap, ndx, ehdr->e_machine);
 		}
 	} else
 		(void) fprintf(stderr, MSG_INTL(MSG_WARN_INVCAP1), file);
@@ -777,30 +704,23 @@
  * Print the interpretor.
  */
 static void
-interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum,
-    GElf_Ehdr *ehdr, Elf *elf)
+interp(const char *file, Cache *cache, Word shnum, Word phnum, Elf *elf)
 {
-	GElf_Word	cnt;
-	GElf_Shdr *	ishdr = 0;
-	Cache *		icache;
-	Elf64_Off	iphdr_off = 0;
-	Elf64_Xword	iphdr_sz;
+	Word	cnt;
+	Shdr	*ishdr = 0;
+	Cache	*icache;
+	Off	iphdr_off = 0;
+	Xword	iphdr_fsz;
 
 	/*
 	 * Determine if an interp header exists.
 	 */
-	for (cnt = 0; cnt < phnum; cnt++) {
-		GElf_Phdr	phdr;
+	if (phnum) {
+		Phdr	*phdr;
 
-		if (gelf_getphdr(elf, cnt, &phdr) == NULL) {
-			failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
-			return;
-		}
-
-		if (phdr.p_type == PT_INTERP) {
-			iphdr_off = phdr.p_offset;
-			iphdr_sz = phdr.p_filesz;
-			break;
+		if ((phdr = getphdr(phnum, PT_INTERP, file, elf)) != 0) {
+			iphdr_off = phdr->p_offset;
+			iphdr_fsz = phdr->p_filesz;
 		}
 	}
 
@@ -811,11 +731,8 @@
 	 * Determine if an interp section exists.
 	 */
 	for (cnt = 1; cnt < shnum; cnt++) {
-		Cache *		_cache;
-		GElf_Shdr	*shdr;
-
-		_cache = &cache[cnt];
-		shdr = &_cache->c_shdr;
+		Cache	*_cache = &cache[cnt];
+		Shdr	*shdr = _cache->c_shdr;
 
 		/*
 		 * Scan sections to find a section which contains the PT_INTERP
@@ -823,7 +740,7 @@
 		 */
 		if ((shdr->sh_type == SHT_NOBITS) ||
 		    (iphdr_off < shdr->sh_offset) ||
-		    (iphdr_off + iphdr_sz) > (shdr->sh_offset + shdr->sh_size))
+		    (iphdr_off + iphdr_fsz) > (shdr->sh_offset + shdr->sh_size))
 			continue;
 
 		icache = _cache;
@@ -836,9 +753,9 @@
 	 * program header, as this is the offset used by the kernel.
 	 */
 	if (ishdr) {
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_INTERP), icache->c_name);
-		dbg_print(MSG_ORIG(MSG_FMT_INDENT),
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_INTERP), icache->c_name);
+		dbg_print(0, MSG_ORIG(MSG_FMT_INDENT),
 		    (char *)icache->c_data->d_buf +
 		    (iphdr_off - ishdr->sh_offset));
 	} else
@@ -849,10 +766,9 @@
 	 * section information, flag them.
 	 */
 	if (ishdr && ((iphdr_off != ishdr->sh_offset) ||
-	    (iphdr_sz != ishdr->sh_size))) {
+	    (iphdr_fsz != ishdr->sh_size))) {
 		(void) fprintf(stderr, MSG_INTL(MSG_WARN_INVINTERP2), file,
 		    icache->c_name);
-		(void) fflush(stderr);
 	}
 }
 
@@ -860,124 +776,81 @@
  * Print the syminfo section.
  */
 static void
-syminfo(Cache *cache, GElf_Word shnum, const char *file)
+syminfo(Cache *cache, Word shnum, const char *file)
 {
-	GElf_Shdr	*shdr;
-	Elf_Data	*dsyms, *ddyn;
-	GElf_Word	symn, cnt, ndx;
-	Cache		*syminfo = 0;
-	char		*sname;
+	Shdr		*infoshdr;
+	Syminfo		*info;
+	Sym		*syms;
+	Dyn		*dyns;
+	Word		infonum, cnt, ndx, symnum;
+	Cache		*infocache = 0, *symsec, *strsec;
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		if (cache[cnt].c_shdr.sh_type == SHT_SUNW_syminfo) {
-			syminfo = &cache[cnt];
+		if (cache[cnt].c_shdr->sh_type == SHT_SUNW_syminfo) {
+			infocache = &cache[cnt];
 			break;
 		}
 	}
-	if (syminfo == 0)
+	if (infocache == 0)
 		return;
 
-	shdr = &syminfo->c_shdr;
-	/*
-	 * Determine the symbol info data and number.
-	 */
-	if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
+	infoshdr = infocache->c_shdr;
+	if ((infoshdr->sh_entsize == 0) || (infoshdr->sh_size == 0)) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-		    file, syminfo->c_name);
-		(void) fflush(stderr);
+		    file, infocache->c_name);
 		return;
 	}
-	/* LINTED */
-	symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize);
+	infonum = (Word)(infoshdr->sh_size / infoshdr->sh_entsize);
+	info = (Syminfo *)infocache->c_data->d_buf;
 
 	/*
 	 * Get the data buffer of the associated dynamic section.
 	 */
-	if ((shdr->sh_info == 0) || (shdr->sh_info >= shnum)) {
+	if ((infoshdr->sh_info == 0) || (infoshdr->sh_info >= shnum)) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO),
-		    file, syminfo->c_name, EC_XWORD(shdr->sh_info));
-		(void) fflush(stderr);
+		    file, infocache->c_name, EC_WORD(infoshdr->sh_info));
 		return;
 	}
-	ddyn = cache[shdr->sh_info].c_data;
-	if (ddyn->d_buf == 0) {
+	dyns = cache[infoshdr->sh_info].c_data->d_buf;
+	if (dyns == 0) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-		    file, cache[shdr->sh_info].c_name);
-		(void) fflush(stderr);
+		    file, cache[infoshdr->sh_info].c_name);
 		return;
 	}
 
 	/*
-	 * Get the data buffer of the associated symbol table.
-	 */
-	if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-		    file, syminfo->c_name, EC_XWORD(shdr->sh_link));
-		(void) fflush(stderr);
-		return;
-	}
-	dsyms = cache[shdr->sh_link].c_data;
-	if (dsyms->d_buf == 0) {
-		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-		    file, cache[shdr->sh_link].c_name);
-		(void) fflush(stderr);
-		return;
-	}
-
-	sname = cache[shdr->sh_link].c_name;
-	shdr = &cache[shdr->sh_link].c_shdr;
-	/*
-	 * Get the associated string table section.
+	 * Get the data buffer for the associated symbol table and string table.
 	 */
-	if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-		    file, sname, EC_XWORD(shdr->sh_link));
-		(void) fflush(stderr);
+	if (stringtbl(cache, 1, cnt, shnum, file,
+	    &symnum, &symsec, &strsec) == 0)
 		return;
-	}
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_ELF_SCN_SYMINFO), syminfo->c_name);
-	Gelf_syminfo_title();
+	syms = symsec->c_data->d_buf;
 
-	for (ndx = 1; ndx < symn; ndx++) {
-		GElf_Syminfo 	gsip;
-		GElf_Sym 	gsym;
-		GElf_Dyn	gdyn;
-		const char	*needed, *sname;
+	/*
+	 * Loop through the syminfo entries.
+	 */
+	dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(0, MSG_INTL(MSG_ELF_SCN_SYMINFO), infocache->c_name);
+	Elf_syminfo_title(0);
 
-		if (gelf_getsyminfo(syminfo->c_data, ndx, &gsip) == 0) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_SIBADCOUNT),
-			    file, syminfo->c_name, ndx);
-			(void) fflush(stderr);
-			return;
-		}
-		if ((gsip.si_flags == 0) && (gsip.si_boundto == 0))
+	for (ndx = 1, info++; ndx < infonum; ndx++, info++) {
+		Sym 		*sym;
+		const char	*needed = 0, *name;
+
+		if ((info->si_flags == 0) && (info->si_boundto == 0))
 			continue;
 
-		if (gelf_getsym(dsyms, ndx, &gsym) == 0) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM),
-			    file, syminfo->c_name, elf_errmsg(0));
-			(void) fflush(stderr);
-			return;
-		}
-
-		sname = string(syminfo, cnt, &cache[shdr->sh_link], file,
-		    gsym.st_name);
-		needed = 0;
+		sym = &syms[ndx];
+		name = string(infocache, ndx, strsec, file, sym->st_name);
 
-		if (gsip.si_boundto < SYMINFO_BT_LOWRESERVE) {
-			if (gelf_getdyn(ddyn, gsip.si_boundto, &gdyn) == 0) {
-				(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADDYN),
-				    file, syminfo->c_name, gsip.si_boundto);
-				(void) fflush(stderr);
-				return;
-			}
-			needed = string(syminfo, gsip.si_boundto,
-			    &cache[shdr->sh_link], file, gdyn.d_un.d_val);
+		if (info->si_boundto < SYMINFO_BT_LOWRESERVE) {
+			Dyn	*dyn = &dyns[info->si_boundto];
+
+			needed = string(infocache, info->si_boundto,
+			    strsec, file, dyn->d_un.d_val);
 		}
-
-		Gelf_syminfo_entry(ndx, &gsip, sname, needed);
+		Elf_syminfo_entry(0, ndx, info, name, needed);
 	}
 }
 
@@ -985,28 +858,27 @@
  * Print version definition section entries.
  */
 static void
-version_def(GElf_Verdef *vdf, GElf_Word shnum, Cache *vcache, Cache *scache,
+version_def(Verdef *vdf, Word shnum, Cache *vcache, Cache *scache,
     const char *file)
 {
-	GElf_Word	cnt;
-	char		index[MAXNDXSIZE];
+	Word	cnt;
+	char	index[MAXNDXSIZE];
 
-	Gelf_ver_def_title();
+	Elf_ver_def_title(0);
 
 	for (cnt = 1; cnt <= shnum; cnt++,
-	    vdf = (GElf_Verdef *)((uintptr_t)vdf + vdf->vd_next)) {
-
-		GElf_Half	vcnt = vdf->vd_cnt - 1;
-		GElf_Half	ndx = vdf->vd_ndx;
-		GElf_Verdaux	*vdap = (GElf_Verdaux *)
-				    ((uintptr_t)vdf + vdf->vd_aux);
+	    vdf = (Verdef *)((uintptr_t)vdf + vdf->vd_next)) {
 		const char	*name, *dep;
+		Half		vcnt = vdf->vd_cnt - 1;
+		Half		ndx = vdf->vd_ndx;
+		Verdaux		*vdap = (Verdaux *)((uintptr_t)vdf +
+				    vdf->vd_aux);
 
 		/*
 		 * Obtain the name and first dependency (if any).
 		 */
 		name = string(vcache, cnt, scache, file, vdap->vda_name);
-		vdap = (GElf_Verdaux *)((uintptr_t)vdap + vdap->vda_next);
+		vdap = (Verdaux *)((uintptr_t)vdap + vdap->vda_next);
 		if (vcnt)
 			dep = string(vcache, cnt, scache, file, vdap->vda_name);
 		else
@@ -1014,21 +886,20 @@
 
 		(void) snprintf(index, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INDEX),
 		    EC_XWORD(ndx));
-		Gelf_ver_line_1(index, name, dep,
-		    conv_verflg_str(vdf->vd_flags));
+		Elf_ver_line_1(0, index, name, dep,
+		    conv_ver_flags(vdf->vd_flags));
 
 		/*
 		 * Print any additional dependencies.
 		 */
 		if (vcnt) {
-			vdap = (GElf_Verdaux *)((uintptr_t)vdap +
-				vdap->vda_next);
+			vdap = (Verdaux *)((uintptr_t)vdap + vdap->vda_next);
 			for (vcnt--; vcnt; vcnt--,
-			    vdap = (GElf_Verdaux *)((uintptr_t)vdap +
+			    vdap = (Verdaux *)((uintptr_t)vdap +
 			    vdap->vda_next)) {
 				dep = string(vcache, cnt, scache, file,
 				    vdap->vda_name);
-				Gelf_ver_line_2(MSG_ORIG(MSG_STR_EMPTY), dep);
+				Elf_ver_line_2(0, MSG_ORIG(MSG_STR_EMPTY), dep);
 			}
 		}
 	}
@@ -1038,20 +909,19 @@
  * Print a version needed section entries.
  */
 static void
-version_need(GElf_Verneed *vnd, GElf_Word shnum, Cache *vcache, Cache *scache,
+version_need(Verneed *vnd, Word shnum, Cache *vcache, Cache *scache,
     const char *file)
 {
-	GElf_Word	cnt;
+	Word	cnt;
 
-	Gelf_ver_need_title();
+	Elf_ver_need_title(0);
 
 	for (cnt = 1; cnt <= shnum; cnt++,
-	    vnd = (GElf_Verneed *)((uintptr_t)vnd + vnd->vn_next)) {
-
-		GElf_Half	vcnt = vnd->vn_cnt;
-		GElf_Vernaux	*vnap = (GElf_Vernaux *)((uintptr_t)vnd +
-			vnd->vn_aux);
+	    vnd = (Verneed *)((uintptr_t)vnd + vnd->vn_next)) {
 		const char	*name, *dep;
+		Half		vcnt = vnd->vn_cnt;
+		Vernaux		*vnap = (Vernaux *)((uintptr_t)vnd +
+					vnd->vn_aux);
 
 		/*
 		 * Obtain the name of the needed file and the version name
@@ -1065,43 +935,43 @@
 		else
 			dep = MSG_INTL(MSG_STR_NULL);
 
-		Gelf_ver_line_1(MSG_ORIG(MSG_STR_EMPTY), name, dep,
-		    conv_verflg_str(vnap->vna_flags));
+		Elf_ver_line_1(0, MSG_ORIG(MSG_STR_EMPTY), name, dep,
+		    conv_ver_flags(vnap->vna_flags));
 
 		/*
 		 * Print any additional version dependencies.
 		 */
 		if (vcnt) {
-			vnap = (GElf_Vernaux *)((uintptr_t)vnap +
-				vnap->vna_next);
+			vnap = (Vernaux *)((uintptr_t)vnap + vnap->vna_next);
 			for (vcnt--; vcnt; vcnt--,
-			    vnap = (GElf_Vernaux *)((uintptr_t)vnap +
+			    vnap = (Vernaux *)((uintptr_t)vnap +
 			    vnap->vna_next)) {
 				dep = string(vcache, cnt, scache, file,
 				    vnap->vna_name);
-				Gelf_ver_line_3(MSG_ORIG(MSG_STR_EMPTY), dep,
-				    conv_verflg_str(vnap->vna_flags));
+				Elf_ver_line_3(0, MSG_ORIG(MSG_STR_EMPTY), dep,
+				    conv_ver_flags(vnap->vna_flags));
 			}
 		}
 	}
 }
 
 /*
- * Search for any verion sections - the Versym output is possibly
- * used by the symbols() printing.  If VERSYM is specified - then
- * display the version information.
+ * Search for any version sections - the Versym output is possibly used by the
+ * symbols() printing.  If VERSYM is specified - then display the version
+ * information.
  */
 static Cache *
-versions(Cache *cache, GElf_Word shnum, const char *file, uint32_t flags)
+versions(Cache *cache, Word shnum, const char *file, uint_t flags)
 {
 	GElf_Word	cnt;
 	Cache		*versymcache = 0;
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		void *		ver;
+		void		*ver;
 		uint_t		num;
-		Cache *		_cache = &cache[cnt];
-		GElf_Shdr *	shdr = &_cache->c_shdr;
+		Cache		*_cache = &cache[cnt];
+		Shdr		*shdr = _cache->c_shdr;
+		const char	*secname = _cache->c_name;
 
 		/*
 		 * If this is the version symbol table simply record its
@@ -1124,14 +994,12 @@
 		 */
 		if ((ver = (void *)_cache->c_data->d_buf) == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, _cache->c_name);
-			(void) fflush(stderr);
+			    file, secname);
 			continue;
 		}
 		if ((num = shdr->sh_info) == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_info));
-			(void) fflush(stderr);
+			    file, secname, EC_WORD(shdr->sh_info));
 			continue;
 		}
 
@@ -1140,21 +1008,18 @@
 		 */
 		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+			    file, secname, EC_WORD(shdr->sh_link));
 			continue;
 		}
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
 		if (shdr->sh_type == SHT_SUNW_verdef) {
-			dbg_print(MSG_INTL(MSG_ELF_SCN_VERDEF),
-			    _cache->c_name);
-			version_def((GElf_Verdef *)ver, num, _cache,
+			dbg_print(0, MSG_INTL(MSG_ELF_SCN_VERDEF), secname);
+			version_def((Verdef *)ver, num, _cache,
 			    &cache[shdr->sh_link], file);
 		} else if (shdr->sh_type == SHT_SUNW_verneed) {
-			dbg_print(MSG_INTL(MSG_ELF_SCN_VERNEED),
-			    _cache->c_name);
-			version_need((GElf_Verneed *)ver, num, _cache,
+			dbg_print(0, MSG_INTL(MSG_ELF_SCN_VERNEED), secname);
+			version_need((Verneed *)ver, num, _cache,
 			    &cache[shdr->sh_link], file);
 		}
 	}
@@ -1162,29 +1027,59 @@
 }
 
 /*
+ * Determine the extended section index used for symbol tables entries.
+ */
+static int
+symbols_getxindex(Cache *cache, Word shnum, Word seccnt, Word **shxndx,
+    uint_t *symnshxndx)
+{
+	uint_t	symn;
+	Word	symcnt;
+
+	for (symcnt = 1; symcnt < shnum; symcnt++) {
+		Cache	*_cache = &cache[symcnt];
+		Shdr	*shdr = _cache->c_shdr;
+
+		if ((shdr->sh_type != SHT_SYMTAB_SHNDX) ||
+		    (shdr->sh_link != seccnt))
+			continue;
+
+		if ((shdr->sh_entsize) &&
+		    /* LINTED */
+		    ((symn = (uint_t)(shdr->sh_size / shdr->sh_entsize)) == 0))
+			continue;
+
+		*shxndx = _cache->c_data->d_buf;
+		*symnshxndx = symn;
+		return (0);
+	}
+	return (1);
+}
+
+/*
  * Search for and process any symbol tables.
  */
-static void
-symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr,
-    const char *name, Cache *versymcache, const char *file)
+void
+symbols(Cache *cache, Word shnum, Ehdr *ehdr, const char *name,
+    Cache *versymcache, const char *file, uint_t flags)
 {
-	GElf_Word	cnt;
-	char		is_core = (ehdr->e_type == ET_CORE);
+	Word	seccnt;
+	char	is_core = (ehdr->e_type == ET_CORE);
 
-	for (cnt = 1; cnt < shnum; cnt++) {
-		GElf_Sym 	sym;
-		GElf_Word	symn, _cnt;
-		GElf_Versym	*versym;
-		Cache		*_cache = &cache[cnt];
-		GElf_Shdr	*shdr = &_cache->c_shdr;
-		Word		*symshndx;
-		uint_t		nosymshndx;
-		uint_t		nosyminshndx;
+	for (seccnt = 1; seccnt < shnum; seccnt++) {
+		Word		symn, symcnt, *shxndx;
+		Versym		*versym;
+		Cache		*_cache = &cache[seccnt];
+		Shdr		*shdr = _cache->c_shdr;
+		const char	*secname = _cache->c_name;
+		Sym 		*sym;
+		int		noshxndx;
+		uint_t		symnshxndx;
 
 		if ((shdr->sh_type != SHT_SYMTAB) &&
 		    (shdr->sh_type != SHT_DYNSYM))
 			continue;
-		if (name && strcmp(name, _cache->c_name))
+		if (name && strcmp(name, secname))
 			continue;
 
 		/*
@@ -1192,20 +1087,19 @@
 		 */
 		if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, _cache->c_name);
-			(void) fflush(stderr);
+			    file, secname);
 			continue;
 		}
 		/* LINTED */
-		symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize);
+		symn = (Word)(shdr->sh_size / shdr->sh_entsize);
+		sym = (Sym *)_cache->c_data->d_buf;
 
 		/*
 		 * Get the associated string table section.
 		 */
 		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+			    file, secname, EC_WORD(shdr->sh_link));
 			continue;
 		}
 
@@ -1213,7 +1107,7 @@
 		 * Determine if there is a associated Versym section
 		 * with this Symbol Table.
 		 */
-		if (versymcache && (versymcache->c_shdr.sh_link == cnt))
+		if (versymcache && (versymcache->c_shdr->sh_link == seccnt))
 			versym = versymcache->c_data->d_buf;
 		else
 			versym = 0;
@@ -1221,110 +1115,74 @@
 		/*
 		 * Loop through the symbol tables entries.
 		 */
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_SYMTAB), _cache->c_name);
-		Gelf_sym_table_title(ehdr, MSG_INTL(MSG_STR_INDEX),
-		    MSG_INTL(MSG_STR_NAME));
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_SYMTAB), secname);
+		Elf_syms_table_title(0, ELF_DBG_ELFDUMP);
 
-		symshndx = 0;
-		nosymshndx = 0;
-		nosyminshndx = 0;
-		for (_cnt = 0; _cnt < symn; _cnt++) {
-			char		index[MAXNDXSIZE];
-			char		*sec;
-			const char	*sname;
+		shxndx = 0;
+		noshxndx = 0;
+		symnshxndx = 0;
+		for (symcnt = 0; symcnt < symn; sym++, symcnt++) {
+			char		index[MAXNDXSIZE], *sec;
+			const char	*symname;
 			int		verndx;
 			uchar_t		type;
-			GElf_Shdr	*tshdr;
+			Shdr		*tshdr;
 			Word		shndx;
 
-			if (gelf_getsym(_cache->c_data, _cnt, &sym) == NULL) {
-				(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM),
-				    file, _cache->c_name, elf_errmsg(0));
-				(void) fflush(stderr);
-				break;
-			}
-
 			/*
 			 * If we are using extended symbol indexes, find the
 			 * corresponding SHN_SYMTAB_SHNDX table.
 			 */
-			if ((sym.st_shndx == SHN_XINDEX) &&
-			    (symshndx == 0) && (nosymshndx == 0)) {
-				Word	__cnt;
-
-				for (__cnt = 1; __cnt < shnum; __cnt++) {
-					Cache		*_cache = &cache[__cnt];
-					GElf_Shdr	*shdr = &_cache->c_shdr;
-
-					if ((shdr->sh_type !=
-					    SHT_SYMTAB_SHNDX) ||
-					    (shdr->sh_link != cnt))
-						continue;
-					if (shdr->sh_entsize)
-						/* LINTED */
-						nosyminshndx = (uint_t)
-						shdr->sh_size/shdr->sh_entsize;
-					if (nosyminshndx == 0)
-						continue;
-					symshndx = _cache->c_data->d_buf;
-					break;
-				}
-				if (symshndx == 0)
-					nosymshndx = 1;
-			}
+			if ((sym->st_shndx == SHN_XINDEX) &&
+			    (shxndx == 0) && (noshxndx == 0))
+				noshxndx = symbols_getxindex(cache, shnum,
+				    seccnt, &shxndx, &symnshxndx);
 
 			/* LINTED */
-			sname = string(_cache, _cnt, &cache[shdr->sh_link],
-			    file, sym.st_name);
+			symname = string(_cache, symcnt, &cache[shdr->sh_link],
+			    file, sym->st_name);
 
 			tshdr = 0;
 			sec = NULL;
 
 			if (is_core)
 				sec = (char *)MSG_INTL(MSG_STR_UNKNOWN);
-			else if ((sym.st_shndx < SHN_LORESERVE) &&
-			    (sym.st_shndx < shnum)) {
-				shndx = sym.st_shndx;
-				tshdr = &(cache[shndx].c_shdr);
+			else if ((sym->st_shndx < SHN_LORESERVE) &&
+			    (sym->st_shndx < shnum)) {
+				shndx = sym->st_shndx;
+				tshdr = cache[shndx].c_shdr;
 				sec = cache[shndx].c_name;
-			} else if (sym.st_shndx == SHN_XINDEX) {
-				if (symshndx) {
-					Word	_symshndx;
+			} else if (sym->st_shndx == SHN_XINDEX) {
+				if (shxndx) {
+					Word	_shxndx;
 
-					if (_cnt > nosyminshndx) {
+					if (symcnt > symnshxndx) {
 					    (void) fprintf(stderr,
 						MSG_INTL(MSG_ERR_BADSYMXINDEX1),
-						file, _cache->c_name,
-						EC_WORD(_cnt));
-					    (void) fflush(stderr);
-					} else if ((_symshndx =
-					    symshndx[_cnt]) > shnum) {
+						file, secname, EC_WORD(symcnt));
+					} else if ((_shxndx =
+					    shxndx[symcnt]) > shnum) {
 					    (void) fprintf(stderr,
 						MSG_INTL(MSG_ERR_BADSYMXINDEX2),
-						file, _cache->c_name,
-						EC_WORD(_cnt),
-						EC_WORD(_symshndx));
-					    (void) fflush(stderr);
+						file, secname, EC_WORD(symcnt),
+						EC_WORD(_shxndx));
 					} else {
-					    shndx = _symshndx;
-					    tshdr = &(cache[shndx].c_shdr);
+					    shndx = _shxndx;
+					    tshdr = cache[shndx].c_shdr;
 					    sec = cache[shndx].c_name;
 					}
 				} else {
 					(void) fprintf(stderr,
-						MSG_INTL(MSG_ERR_BADSYMXINDEX3),
-						file, _cache->c_name,
-						EC_WORD(_cnt));
-					(void) fflush(stderr);
+					    MSG_INTL(MSG_ERR_BADSYMXINDEX3),
+					    file, secname, EC_WORD(symcnt));
 				}
-			} else if ((sym.st_shndx < SHN_LORESERVE) &&
-			    (sym.st_shndx >= shnum)) {
+			} else if ((sym->st_shndx < SHN_LORESERVE) &&
+			    (sym->st_shndx >= shnum)) {
 				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_BADSYM5),
-					file, _cache->c_name,
-					sname, sym.st_shndx);
-				(void) fflush(stderr);
+				    MSG_INTL(MSG_ERR_BADSYM5), file,
+				    secname, demangle(symname, flags),
+				    sym->st_shndx);
 			}
 
 			/*
@@ -1332,29 +1190,27 @@
 			 * version index.
 			 */
 			if (versym)
-				verndx = (int)versym[_cnt];
+				verndx = (int)versym[symcnt];
 			else
 				verndx = 0;
 
 			/*
 			 * Error checking for TLS.
 			 */
-			type = ELF_ST_TYPE(sym.st_info);
+			type = ELF_ST_TYPE(sym->st_info);
 			if (type == STT_TLS) {
 				if (tshdr &&
-				    (sym.st_shndx != SHN_UNDEF) &&
+				    (sym->st_shndx != SHN_UNDEF) &&
 				    ((tshdr->sh_flags & SHF_TLS) == 0)) {
 					(void) fprintf(stderr,
 					    MSG_INTL(MSG_ERR_BADSYM3), file,
-					    _cache->c_name, sname);
-					(void) fflush(stderr);
+					    secname, demangle(symname, flags));
 				}
-			} else if ((type != STT_SECTION) && sym.st_size &&
+			} else if ((type != STT_SECTION) && sym->st_size &&
 			    tshdr && (tshdr->sh_flags & SHF_TLS)) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_ERR_BADSYM4), file,
-				    _cache->c_name, sname);
-				(void) fflush(stderr);
+				    secname, demangle(symname, flags));
 			}
 
 			/*
@@ -1362,21 +1218,19 @@
 			 * references is appropriate.  Note, UNDEF symbols that
 			 * have a size, have been known to exist - ignore them.
 			 */
-			if (sym.st_size && shndx && tshdr &&
-			    (tshdr->sh_size < sym.st_size)) {
+			if (sym->st_size && shndx && tshdr &&
+			    (tshdr->sh_size < sym->st_size)) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_ERR_BADSYM6), file,
-				    _cache->c_name, sname, EC_WORD(shndx),
-				    EC_XWORD(tshdr->sh_size),
-				    EC_XWORD(sym.st_size));
-				(void) fflush(stderr);
+				    secname, demangle(symname, flags),
+				    EC_WORD(shndx), EC_XWORD(tshdr->sh_size),
+				    EC_XWORD(sym->st_size));
 			}
 
 			(void) snprintf(index, MAXNDXSIZE,
-			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(_cnt));
-
-			Gelf_sym_table_entry(index, ehdr, &sym, verndx, sec,
-			    sname);
+			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symcnt));
+			Elf_syms_table_entry(0, ELF_DBG_ELFDUMP, index,
+			    ehdr->e_machine, sym, verndx, sec, symname);
 		}
 	}
 }
@@ -1385,35 +1239,36 @@
  * Search for and process any relocation sections.
  */
 static void
-reloc(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr,
-    const char *name, const char *file, uint32_t flags)
+reloc(Cache *cache, Word shnum, Ehdr *ehdr, const char *name, const char *file,
+    uint_t flags)
 {
-	GElf_Word	cnt;
+	Word	cnt;
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		Word		type;
-		ulong_t		numrels, entsize;
-		int		ndx;
-		Elf_Data	*dsyms;
+		Word		type, symnum;
+		Xword		relndx, relnum, relsize;
+		void		*rels;
+		Sym		*syms;
+		Cache		*symsec, *strsec;
 		Cache		*_cache = &cache[cnt];
-		GElf_Shdr	*shdr = &_cache->c_shdr;
-		char		*sname;
+		Shdr		*shdr = _cache->c_shdr;
+		char		*relname = _cache->c_name;
 
 		if (((type = shdr->sh_type) != SHT_RELA) &&
 		    (type != SHT_REL))
 			continue;
-		if (name && strcmp(name, _cache->c_name))
+		if (name && strcmp(name, relname))
 			continue;
 
 		/*
-		 * Decide entry size
+		 * Decide entry size.
 		 */
-		if (((entsize = shdr->sh_entsize) == 0) ||
-		    (entsize > shdr->sh_size)) {
+		if (((relsize = shdr->sh_entsize) == 0) ||
+		    (relsize > shdr->sh_size)) {
 			if (type == SHT_RELA)
-				entsize = sizeof (GElf_Rela);
+				relsize = sizeof (Rela);
 			else
-				entsize = sizeof (GElf_Rel);
+				relsize = sizeof (Rel);
 		}
 
 		/*
@@ -1421,131 +1276,90 @@
 		 */
 		if (shdr->sh_size == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, _cache->c_name);
-			(void) fflush(stderr);
-			continue;
-		}
-		numrels = shdr->sh_size / entsize;
-
-		/*
-		 * Get the data buffer for the associated symbol table.  Note
-		 * that we've been known to create static binaries containing
-		 * relocations against weak symbols, if these get stripped the
-		 * relocation records can't make symbolic references.
-		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+			    file, relname);
 			continue;
 		}
-		dsyms = cache[shdr->sh_link].c_data;
-		if (dsyms->d_buf == 0) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, cache[shdr->sh_link].c_name);
-			(void) fflush(stderr);
-			continue;
-		}
+		rels = _cache->c_data->d_buf;
+		relnum = shdr->sh_size / relsize;
 
-		sname = cache[shdr->sh_link].c_name;
-		shdr = &cache[shdr->sh_link].c_shdr;
 		/*
-		 * Get the associated string table section.
+		 * Get the data buffer for the associated symbol table and
+		 * string table.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, sname, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+		if (stringtbl(cache, 1, cnt, shnum, file,
+		    &symnum, &symsec, &strsec) == 0)
 			continue;
-		}
+
+		syms = symsec->c_data->d_buf;
 
 		/*
 		 * Loop through the relocation entries.
 		 */
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_RELOC), _cache->c_name);
-		if (type == SHT_RELA) {
-			if (flags & FLG_LONGNAME)
-				dbg_print(MSG_INTL(MSG_ELF_L_RELOC_RELA));
-			else
-				dbg_print(MSG_INTL(MSG_ELF_RELOC_RELA));
-		} else {
-			if (flags & FLG_LONGNAME)
-				dbg_print(MSG_INTL(MSG_ELF_L_RELOC_REL));
-			else
-				dbg_print(MSG_INTL(MSG_ELF_RELOC_REL));
-		}
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_RELOC), _cache->c_name);
+		Elf_reloc_title(0, ELF_DBG_ELFDUMP, type);
 
-		/* LINTED */
-		for (ndx = 0; ndx < numrels; ndx++) {
+		for (relndx = 0; relndx < relnum; relndx++,
+		    rels = (void *)((char *)rels + relsize)) {
 			char		section[BUFSIZ];
-			const char	*_name;
-			GElf_Word	sndx;
-			ulong_t		r_type;
-			GElf_Sym	_sym;
-			GElf_Rela	rela;
+			const char	*symname;
+			Word		symndx, reltype;
+			Rela		*rela;
+			Rel		*rel;
 
 			/*
-			 * Determine the symbol with which this relocation is
-			 * associated.  If the symbol represents a section
-			 * offset construct an appropriate string.
+			 * Unravel the relocation and determine the symbol with
+			 * which this relocation is associated.
 			 */
 			if (type == SHT_RELA) {
-				(void) gelf_getrela(_cache->c_data, ndx,
-				    &rela);
+				rela = (Rela *)rels;
+				symndx = ELF_R_SYM(rela->r_info);
+				reltype = ELF_R_TYPE(rela->r_info);
 			} else {
-				(void) gelf_getrel(_cache->c_data, ndx,
-				    (GElf_Rel*)&rela);
+				rel = (Rel *)rels;
+				symndx = ELF_R_SYM(rel->r_info);
+				reltype = ELF_R_TYPE(rel->r_info);
 			}
-			/* LINTED */
-			sndx = (GElf_Word)GELF_R_SYM(rela.r_info);
-			r_type = GELF_R_TYPE(rela.r_info);
+
+			symname = relsymname(cache, _cache, strsec, symndx,
+			    symnum, relndx, syms, section, BUFSIZ, file,
+			    flags);
+
+			/*
+			 * A zero symbol index is only valid for a few
+			 * relocations.
+			 */
+			if (symndx == 0) {
+				Half	mach = ehdr->e_machine;
+				int	badrel = 0;
 
-			/* LINTED */
-			if (gelf_getsym(dsyms, (int)sndx, &_sym) == NULL) {
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_RELBADSYMNDX),
-				    file, elf_errmsg(0));
-				(void) fflush(stderr);
-				_name = MSG_INTL(MSG_STR_UNKNOWN);
-			} else  {
-				if ((GELF_ST_TYPE(_sym.st_info) ==
-				    STT_SECTION) && (_sym.st_name == 0)) {
-					if (flags & FLG_LONGNAME)
-					    (void) snprintf(section, BUFSIZ,
-						MSG_INTL(MSG_STR_L_SECTION),
-						cache[_sym.st_shndx].c_name);
-					else
-					    (void) snprintf(section, BUFSIZ,
-						MSG_INTL(MSG_STR_SECTION),
-						cache[_sym.st_shndx].c_name);
-					_name = (const char *)section;
-				} else {
-					/* LINTED */
-					_name = string(_cache,
-					    sndx, &cache[shdr->sh_link],
-					    file, _sym.st_name);
+				if ((mach == EM_SPARC) ||
+				    (mach == EM_SPARC32PLUS) ||
+				    (mach == EM_SPARCV9)) {
+					if ((reltype != R_SPARC_NONE) &&
+					    (reltype != R_SPARC_REGISTER) &&
+					    (reltype != R_SPARC_RELATIVE))
+						badrel++;
+				} else if (mach == EM_386) {
+					if ((reltype != R_386_NONE) &&
+					    (reltype != R_386_RELATIVE))
+						badrel++;
+				} else if (mach == EM_AMD64) {
+					if ((reltype != R_AMD64_NONE) &&
+					    (reltype != R_AMD64_RELATIVE))
+						badrel++;
+				}
+
+				if (badrel) {
+					(void) fprintf(stderr,
+					    MSG_INTL(MSG_ERR_BADREL1), file,
+					    conv_reloc_type(mach, reltype));
 				}
 			}
 
-			if ((sndx == 0) && ((IAM_SPARC(ehdr->e_machine) &&
-			    ((r_type != R_SPARC_NONE) &&
-			    (r_type != R_SPARC_REGISTER) &&
-			    (r_type != R_SPARC_RELATIVE))) ||
-			    ((IAM_INTEL(ehdr->e_machine) &&
-			    ((r_type != R_386_NONE) &&
-			    (r_type != R_386_RELATIVE)))))) {
-				(void) fprintf(stderr,
-				    MSG_INTL(MSG_ERR_BADREL1), file,
-				    conv_reloc_type_str(ehdr->e_machine,
-				    /* LINTED */
-				    (uint_t)r_type));
-				(void) fflush(stderr);
-			}
-
-			Gelf_reloc_entry(MSG_ORIG(MSG_STR_EMPTY),
-			    ehdr->e_machine, type, (void *)&rela,
-			    _cache->c_name, _name);
+			Elf_reloc_entry_1(0, ELF_DBG_ELFDUMP,
+			    MSG_ORIG(MSG_STR_EMPTY), ehdr->e_machine, type,
+			    rels, relname, symname, 0);
 		}
 	}
 }
@@ -1554,81 +1368,69 @@
  * Search for and process a .dynamic section.
  */
 static void
-dynamic(Cache *cache, GElf_Word shnum, GElf_Ehdr *ehdr, const char *file)
+dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file)
 {
-	GElf_Word	cnt;
+	Word	cnt;
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		GElf_Dyn	dyn;
-		ulong_t		numdyn;
-		int		ndx;
-		Cache *		_cache = &cache[cnt];
-		GElf_Shdr *	shdr = &_cache->c_shdr;
+		Dyn	*dyn;
+		ulong_t	numdyn;
+		int	ndx;
+		Cache	*_cache = &cache[cnt], *strsec;
+		Shdr	*shdr = _cache->c_shdr;
 
 		if (shdr->sh_type != SHT_DYNAMIC)
 			continue;
 
 		/*
-		 * Get the associated string table section.
+		 * Verify the associated string table section.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+		if (stringtbl(cache, 0, cnt, shnum, file, 0, 0, &strsec) == 0)
 			continue;
-		}
+
 		numdyn = shdr->sh_size / shdr->sh_entsize;
+		dyn = (Dyn *)_cache->c_data->d_buf;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_DYNAMIC), _cache->c_name);
-
-		Gelf_dyn_title();
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_DYNAMIC), _cache->c_name);
 
-		/* LINTED */
-		for (ndx = 0; ndx < numdyn; ++ndx) {
-			const char	*name;
+		Elf_dyn_title(0);
 
-			(void) gelf_getdyn(_cache->c_data, ndx, &dyn);
-			if (dyn.d_tag == DT_NULL)
-				break;
+		for (ndx = 0; ndx < numdyn; dyn++, ndx++) {
+			const char	*name;
 
 			/*
 			 * Print the information numerically, and if possible
 			 * as a string.
 			 */
-			if ((dyn.d_tag == DT_NEEDED) ||
-			    (dyn.d_tag == DT_SONAME) ||
-			    (dyn.d_tag == DT_FILTER) ||
-			    (dyn.d_tag == DT_AUXILIARY) ||
-			    (dyn.d_tag == DT_CONFIG) ||
-			    (dyn.d_tag == DT_RPATH) ||
-			    (dyn.d_tag == DT_RUNPATH) ||
-			    (dyn.d_tag == DT_USED) ||
-			    (dyn.d_tag == DT_DEPAUDIT) ||
-			    (dyn.d_tag == DT_AUDIT) ||
-			    (dyn.d_tag == DT_SUNW_AUXILIARY) ||
-			    (dyn.d_tag == DT_SUNW_FILTER))
-				name = string(_cache, ndx,
-				    &cache[shdr->sh_link], file,
-				    dyn.d_un.d_ptr);
-			else if (dyn.d_tag == DT_FLAGS)
-			    /* LINTED */
-			    name = conv_dynflag_str((Word)dyn.d_un.d_val);
-			else if (dyn.d_tag == DT_FLAGS_1)
-			    /* LINTED */
-			    name = conv_dynflag_1_str((Word)dyn.d_un.d_val);
-			else if (dyn.d_tag == DT_POSFLAG_1)
-			    /* LINTED */
-			    name = conv_dynposflag_1_str((Word)dyn.d_un.d_val);
-			else if (dyn.d_tag == DT_FEATURE_1)
-			    /* LINTED */
-			    name = conv_dynfeature_1_str((Word)dyn.d_un.d_val);
-			else if (dyn.d_tag == DT_DEPRECATED_SPARC_REGISTER)
-			    name = MSG_INTL(MSG_STR_DEPRECATED);
+			if ((dyn->d_tag == DT_NEEDED) ||
+			    (dyn->d_tag == DT_SONAME) ||
+			    (dyn->d_tag == DT_FILTER) ||
+			    (dyn->d_tag == DT_AUXILIARY) ||
+			    (dyn->d_tag == DT_CONFIG) ||
+			    (dyn->d_tag == DT_RPATH) ||
+			    (dyn->d_tag == DT_RUNPATH) ||
+			    (dyn->d_tag == DT_USED) ||
+			    (dyn->d_tag == DT_DEPAUDIT) ||
+			    (dyn->d_tag == DT_AUDIT) ||
+			    (dyn->d_tag == DT_SUNW_AUXILIARY) ||
+			    (dyn->d_tag == DT_SUNW_FILTER))
+				name = string(_cache, ndx, strsec,
+				    file, dyn->d_un.d_ptr);
+			else if (dyn->d_tag == DT_FLAGS)
+				name = conv_dyn_flag(dyn->d_un.d_val);
+			else if (dyn->d_tag == DT_FLAGS_1)
+				name = conv_dyn_flag1(dyn->d_un.d_val);
+			else if (dyn->d_tag == DT_POSFLAG_1)
+				name = conv_dyn_posflag1(dyn->d_un.d_val);
+			else if (dyn->d_tag == DT_FEATURE_1)
+				name = conv_dyn_feature1(dyn->d_un.d_val);
+			else if (dyn->d_tag == DT_DEPRECATED_SPARC_REGISTER)
+				name = MSG_INTL(MSG_STR_DEPRECATED);
 			else
-			    name = MSG_ORIG(MSG_STR_EMPTY);
+				name = MSG_ORIG(MSG_STR_EMPTY);
 
-			Gelf_dyn_print(&dyn, ndx, name, ehdr->e_machine);
+			Elf_dyn_entry(0, dyn, ndx, name, ehdr->e_machine);
 		}
 	}
 }
@@ -1637,19 +1439,18 @@
  * Search for and process a MOVE section.
  */
 static void
-move(Cache *cache, GElf_Word shnum, const char *name, const char *file,
-    uint32_t flags)
+move(Cache *cache, Word shnum, const char *name, const char *file, uint_t flags)
 {
-	GElf_Word	cnt;
+	Word		cnt;
+	const char	*fmt = 0;
 
 	for (cnt = 1; cnt < shnum; cnt++) {
-		ulong_t		num, symn;
-		int		ndx;
-		Elf_Data	*dsyms;
-		const char	*fmt;
-		Cache		*_cache = &cache[cnt];
-		GElf_Shdr	*shdr = &_cache->c_shdr;
-		char		*sname;
+		Word	movenum, symnum, ndx;
+		Sym	*syms;
+		Cache	*_cache = &cache[cnt];
+		Shdr	*shdr = _cache->c_shdr;
+		Cache	*symsec, *strsec;
+		Move	*move;
 
 		if (shdr->sh_type != SHT_SUNW_move)
 			continue;
@@ -1662,142 +1463,84 @@
 		if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
 			    file, _cache->c_name);
-			(void) fflush(stderr);
 			continue;
 		}
-		num = shdr->sh_size / shdr->sh_entsize;
-
-		/*
-		 * Get the data buffer for the associated symbol table.
-		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
-			continue;
-		}
-		dsyms = cache[shdr->sh_link].c_data;
-		if (dsyms->d_buf == 0) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, cache[shdr->sh_link].c_name);
-			(void) fflush(stderr);
-			continue;
-		}
-
-		sname = cache[shdr->sh_link].c_name;
-		shdr = &cache[shdr->sh_link].c_shdr;
+		move = (Move *)_cache->c_data->d_buf;
+		movenum = shdr->sh_size / shdr->sh_entsize;
 
 		/*
-		 * Get the associated string table section.
+		 * Get the data buffer for the associated symbol table and
+		 * string table.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, sname, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
-			continue;
-		}
-		if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, sname);
-			(void) fflush(stderr);
-			continue;
-		}
-		symn = shdr->sh_size / shdr->sh_entsize;
+		if (stringtbl(cache, 1, cnt, shnum, file,
+		    &symnum, &symsec, &strsec) == 0)
+			return;
+
+		syms = (Sym *)symsec->c_data->d_buf;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_MV_TITLE), _cache->c_name);
-
-		fmt = MSG_INTL(MSG_MV_ENTRY);
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_MOVE), _cache->c_name);
+		dbg_print(0, MSG_INTL(MSG_MOVE_TITLE));
 
-		/* LINTED */
-		for (ndx = 0; ndx < num; ndx++) {
-			GElf_Move 	move;
-			const char	*name;
-			GElf_Sym	sym;
-			char		sct[BUFSIZ];
-			Word		shndx;
+		if (fmt == 0)
+			fmt = MSG_INTL(MSG_MOVE_ENTRY);
 
-			if (gelf_getmove(_cache->c_data, ndx, &move) == NULL) {
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_BADMOVE),
-					file, _cache->c_name, elf_errmsg(0));
-				(void) fflush(stderr);
-				break;
-			}
+		for (ndx = 0; ndx < movenum; move++, ndx++) {
+			const char	*symname;
+			char		index[MAXNDXSIZE], section[BUFSIZ];
+			Word		symndx, shndx;
+			Sym		*sym;
 
 			/*
 			 * Check for null entries
 			 */
-			if ((move.m_info == 0) && (move.m_value == 0) &&
-			    (move.m_poffset == 0) && (move.m_repeat == 0) &&
-			    (move.m_stride == 0)) {
-				dbg_print(fmt, EC_XWORD(move.m_poffset),
-				    EC_XWORD(0), 0, 0, 0, EC_LWORD(0),
-				    MSG_ORIG(MSG_STR_EMPTY));
+			if ((move->m_info == 0) && (move->m_value == 0) &&
+			    (move->m_poffset == 0) && (move->m_repeat == 0) &&
+			    (move->m_stride == 0)) {
+				dbg_print(0, fmt, MSG_ORIG(MSG_STR_EMPTY),
+				    EC_XWORD(move->m_poffset), 0, 0, 0,
+				    EC_LWORD(0), MSG_ORIG(MSG_STR_EMPTY));
 				continue;
 			}
-			if ((GELF_M_SYM(move.m_info) == 0) ||
-			    (GELF_M_SYM(move.m_info) >= symn)) {
+			if (((symndx = ELF_M_SYM(move->m_info)) == 0) ||
+			    (symndx >= symnum)) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_ERR_BADMINFO), file,
-				    _cache->c_name, EC_XWORD(move.m_info));
-				(void) fflush(stderr);
-				dbg_print(fmt, EC_XWORD(move.m_poffset),
-				    EC_XWORD(GELF_M_SYM(move.m_info)),
-				    /* LINTED */
-				    GELF_M_SIZE(move.m_info), move.m_repeat,
-				    move.m_stride, EC_LWORD(move.m_value),
+				    _cache->c_name, EC_XWORD(move->m_info));
+
+				(void) snprintf(index, MAXNDXSIZE,
+				    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symndx));
+				dbg_print(0, fmt, index,
+				    EC_XWORD(move->m_poffset),
+				    ELF_M_SIZE(move->m_info), move->m_repeat,
+				    move->m_stride, move->m_value,
 				    MSG_INTL(MSG_STR_UNKNOWN));
 				continue;
 			}
 
-			if (gelf_getsym(dsyms,
-			    /* LINTED */
-			    (int)GELF_M_SYM(move.m_info), &sym) == NULL) {
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_MVBADSYMNDX),
-				    file, elf_errmsg(0));
-				(void) fflush(stderr);
-				name = MSG_INTL(MSG_STR_UNKNOWN);
-			} else {
-				if ((GELF_ST_TYPE(sym.st_info) ==
-				    STT_SECTION) && (sym.st_name == 0)) {
-				    if (flags & FLG_LONGNAME)
-					(void) snprintf(sct, BUFSIZ,
-					    MSG_INTL(MSG_STR_L_SECTION),
-					    cache[sym.st_shndx].c_name);
-				    else
-					(void) snprintf(sct, BUFSIZ,
-					    MSG_INTL(MSG_STR_SECTION),
-					    cache[sym.st_shndx].c_name);
-					name = (const char *)sct;
-				} else {
-					name = demangle(string(_cache,
-					    /* LINTED */
-					    (GElf_Word)GELF_M_SYM(move.m_info),
-					    &cache[shdr->sh_link], file,
-					    sym.st_name), flags);
-				}
-			}
+			symname = relsymname(cache, _cache, strsec,
+			    symndx, symnum, ndx, syms, section, BUFSIZ, file,
+			    flags);
+			sym = (Sym *)(syms + symndx);
 
 			/*
 			 * Additional sanity check.
 			 */
-			shndx = sym.st_shndx;
+			shndx = sym->st_shndx;
 			if (!((shndx == SHN_COMMON) ||
 			    (((shndx >= 1) && (shndx <= shnum)) &&
-			    (cache[shndx].c_shdr).sh_type == SHT_NOBITS))) {
+			    (cache[shndx].c_shdr)->sh_type == SHT_NOBITS))) {
 				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_BADSYM2), file,
-					_cache->c_name, name);
-				(void) fflush(stderr);
+				    MSG_INTL(MSG_ERR_BADSYM2), file,
+				    _cache->c_name, demangle(symname, flags));
 			}
 
-			dbg_print(fmt, EC_XWORD(move.m_poffset),
-			    EC_XWORD(GELF_M_SYM(move.m_info)),
-			    /* LINTED */
-			    GELF_M_SIZE(move.m_info), move.m_repeat,
-			    move.m_stride, EC_LWORD(move.m_value), name);
+			(void) snprintf(index, MAXNDXSIZE,
+			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symndx));
+			dbg_print(0, fmt, index, EC_XWORD(move->m_poffset),
+			    ELF_M_SIZE(move->m_info), move->m_repeat,
+			    move->m_stride, move->m_value,
+			    demangle(symname, flags));
 		}
 	}
 }
@@ -1808,27 +1551,26 @@
  * and is decremented as each element is processed.
  */
 void
-note_entry(Cache *cache, Word *data, Word size, const char *file)
+note_entry(Cache *cache, Word *data, size_t size, const char *file)
 {
-	Word	bsize = size;
+	size_t	bsize = size;
+
 	/*
 	 * Print out a single `note' information block.
 	 */
 	while (size > 0) {
-		Word	namesz, descsz, type, pad, noteoff;
-
+		size_t	namesz, descsz, type, pad, noteoff;
 
 		noteoff = bsize - size;
 		/*
 		 * Make sure we can at least reference the 3 initial entries
 		 * (4-byte words) of the note information block.
 		 */
-		if (size >= (Word)(sizeof (Word) * 3))
-			size -= (Word)(sizeof (Word) * 3);
+		if (size >= (sizeof (Word) * 3))
+			size -= (sizeof (Word) * 3);
 		else {
-			(void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASIZE),
-				file, cache->c_name, EC_WORD(noteoff));
-			(void) fflush(stderr);
+			(void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASZ),
+			    file, cache->c_name, EC_WORD(noteoff));
 			return;
 		}
 
@@ -1840,13 +1582,13 @@
 				size -= namesz;
 			else {
 				(void) fprintf(stderr,
-					MSG_INTL(MSG_NOTE_BADNMSIZE),
-					file, cache->c_name, EC_WORD(noteoff),
-					EC_WORD(namesz));
-				(void) fflush(stderr);
+				    MSG_INTL(MSG_NOTE_BADNMSZ), file,
+				    cache->c_name, EC_WORD(noteoff),
+				    EC_WORD(namesz));
 				return;
 			}
 		}
+
 		/*
 		 * Make sure any specified descriptor can be referenced.
 		 */
@@ -1855,28 +1597,27 @@
 			 * If namesz isn't a 4-byte multiple, account for any
 			 * padding that must exist before the descriptor.
 			 */
-			if ((pad = (namesz & (Word)(sizeof (Word) - 1))) != 0) {
-				pad = (Word)sizeof (Word) - pad;
+			if ((pad = (namesz & (sizeof (Word) - 1))) != 0) {
+				pad = sizeof (Word) - pad;
 				size -= pad;
 			}
 			if (size >= descsz)
 				size -= descsz;
 			else {
 				(void) fprintf(stderr,
-					MSG_INTL(MSG_NOTE_BADDESIZE),
-					file, cache->c_name, EC_WORD(noteoff),
-					EC_WORD(namesz));
-				(void) fflush(stderr);
+				    MSG_INTL(MSG_NOTE_BADDESZ), file,
+				    cache->c_name, EC_WORD(noteoff),
+				    EC_WORD(namesz));
 				return;
 			}
 		}
 
 		type = *data++;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_ORIG(MSG_NOTE_TYPE), EC_WORD(type));
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_ORIG(MSG_NOTE_TYPE), EC_WORD(type));
 
-		dbg_print(MSG_ORIG(MSG_NOTE_NAMESZ), EC_WORD(namesz));
+		dbg_print(0, MSG_ORIG(MSG_NOTE_NAMESZ), EC_WORD(namesz));
 		if (namesz) {
 			char	*name = (char *)data;
 
@@ -1890,7 +1631,7 @@
 			    ~(sizeof (Word) - 1));
 			/* LINTED */
 			data = (Word *)name;
-			dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+			dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
 		}
 
 		/*
@@ -1898,16 +1639,16 @@
 		 * account for any padding that must exist before the next
 		 * information block.
 		 */
-		if ((pad = (descsz & (Word)(sizeof (Word) - 1))) != 0) {
-			pad = (Word)sizeof (Word) - pad;
+		if ((pad = (descsz & (sizeof (Word) - 1))) != 0) {
+			pad = sizeof (Word) - pad;
 			if (size > pad)
 				size -= pad;
 		}
 
-		dbg_print(MSG_ORIG(MSG_NOTE_DESCSZ), EC_WORD(descsz));
+		dbg_print(0, MSG_ORIG(MSG_NOTE_DESCSZ), EC_WORD(descsz));
 		if (descsz) {
 			int		ndx, byte, word;
-			char		string[58], * str = string;
+			char		string[58], *str = string;
 			uchar_t		*desc = (uchar_t *)data;
 
 			/*
@@ -1927,7 +1668,7 @@
 				}
 				if (word == 4) {
 					*str = '\0';
-					dbg_print(MSG_ORIG(MSG_NOTE_DESC),
+					dbg_print(0, MSG_ORIG(MSG_NOTE_DESC),
 					    ndx, string);
 					word = 0;
 					ndx += 16;
@@ -1936,7 +1677,8 @@
 			}
 			if (byte || word) {
 				*str = '\0';
-				dbg_print(MSG_ORIG(MSG_NOTE_DESC), ndx, string);
+				dbg_print(0, MSG_ORIG(MSG_NOTE_DESC),
+				    ndx, string);
 			}
 
 			desc += pad;
@@ -1950,16 +1692,16 @@
  * Search for and process a .note section.
  */
 static void
-note(Cache *cache, GElf_Word shnum, const char *name, const char *file)
+note(Cache *cache, Word shnum, const char *name, const char *file)
 {
-	GElf_Word	cnt;
+	Word	cnt;
 
 	/*
 	 * Otherwise look for any .note sections.
 	 */
 	for (cnt = 1; cnt < shnum; cnt++) {
-		Cache *		_cache = &cache[cnt];
-		GElf_Shdr *	shdr = &_cache->c_shdr;
+		Cache	*_cache = &cache[cnt];
+		Shdr	*shdr = _cache->c_shdr;
 
 		if (shdr->sh_type != SHT_NOTE)
 			continue;
@@ -1973,49 +1715,93 @@
 		if (shdr->sh_offset & (sizeof (Word) - 1)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADALIGN),
 			    file, _cache->c_name);
-			(void) fflush(stderr);
 			continue;
 		}
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_NOTE), _cache->c_name);
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_NOTE), _cache->c_name);
 		note_entry(_cache, (Word *)_cache->c_data->d_buf,
 		/* LINTED */
 		    (Word)_cache->c_data->d_size, file);
 	}
 }
 
+/*
+ * Determine an individual hash entry.  This may be the initial hash entry,
+ * or an associated chain entry.
+ */
+static void
+hash_entry(Cache *refsec, Cache *strsec, const char *hsecname, Word hashndx,
+    Word symndx, Word symn, Sym *syms, const char *file, ulong_t bkts,
+    uint_t flags, int chain)
+{
+	Sym		*sym;
+	const char	*symname, *str;
+	char		_bucket[MAXNDXSIZE], _symndx[MAXNDXSIZE];
+	ulong_t		nbkt, nhash;
+
+	if (symndx > symn) {
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_HSBADSYMNDX), file,
+		    EC_WORD(symndx), EC_WORD(hashndx));
+		symname = MSG_INTL(MSG_STR_UNKNOWN);
+	} else {
+		sym = (Sym *)(syms + symndx);
+		symname = string(refsec, symndx, strsec, file, sym->st_name);
+	}
+
+	if (chain == 0) {
+		(void) snprintf(_bucket, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER),
+		    hashndx);
+		str = (const char *)_bucket;
+	} else
+		str = MSG_ORIG(MSG_STR_EMPTY);
+
+	(void) snprintf(_symndx, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INDEX2),
+	    EC_WORD(symndx));
+	dbg_print(0, MSG_ORIG(MSG_FMT_HASH_INFO), str, _symndx,
+	    demangle(symname, flags));
+
+	/*
+	 * Determine if this string is in the correct bucket.
+	 */
+	nhash = elf_hash(symname);
+	nbkt = nhash % bkts;
+
+	if (nbkt != hashndx) {
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADHASH), file,
+		    hsecname, symname, EC_WORD(hashndx), nbkt);
+	}
+}
 
 #define	MAXCOUNT	500
 
 static void
-hash(Cache *cache, GElf_Word shnum, const char *name, const char *file,
-    uint32_t flags)
+hash(Cache *cache, Word shnum, const char *name, const char *file, uint_t flags)
 {
 	static int	count[MAXCOUNT];
-	GElf_Word	cnt;
+	Word		cnt;
 	ulong_t		ndx, bkts;
 	char		number[MAXNDXSIZE];
 
 	for (cnt = 1; cnt < shnum; cnt++) {
 		uint_t		*hash, *chain;
-		Elf_Data	*dsyms;
 		Cache		*_cache = &cache[cnt];
-		GElf_Shdr	*shdr = &_cache->c_shdr;
-		char		*sname;
+		Shdr		*sshdr, *hshdr = _cache->c_shdr;
+		char		*ssecname, *hsecname = _cache->c_name;
+		Sym		*syms;
+		Word		symn;
 
-		if (shdr->sh_type != SHT_HASH)
+		if (hshdr->sh_type != SHT_HASH)
 			continue;
-		if (name && strcmp(name, _cache->c_name))
+		if (name && strcmp(name, hsecname))
 			continue;
 
 		/*
 		 * Determine the hash table data and size.
 		 */
-		if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
+		if ((hshdr->sh_entsize == 0) || (hshdr->sh_size == 0)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, _cache->c_name);
-			(void) fflush(stderr);
+			    file, hsecname);
 			continue;
 		}
 		hash = (uint_t *)_cache->c_data->d_buf;
@@ -2026,85 +1812,52 @@
 		/*
 		 * Get the data buffer for the associated symbol table.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
+		if ((hshdr->sh_link == 0) || (hshdr->sh_link >= shnum)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+			    file, hsecname, EC_WORD(hshdr->sh_link));
 			continue;
 		}
-		dsyms = cache[shdr->sh_link].c_data;
-		if (dsyms->d_buf == 0) {
+
+		_cache = &cache[hshdr->sh_link];
+		ssecname = _cache->c_name;
+
+		if ((syms = (Sym *)_cache->c_data->d_buf) == 0) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, cache[shdr->sh_link].c_name);
-			(void) fflush(stderr);
+			    file, ssecname);
 			continue;
 		}
 
-		sname = cache[shdr->sh_link].c_name;
-		shdr = &cache[shdr->sh_link].c_shdr;
+		sshdr = _cache->c_shdr;
+		/* LINTED */
+		symn = (Word)(sshdr->sh_size / sshdr->sh_entsize);
+
 		/*
 		 * Get the associated string table section.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
+		if ((sshdr->sh_link == 0) || (sshdr->sh_link >= shnum)) {
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, sname, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+			    file, ssecname, EC_WORD(sshdr->sh_link));
 			continue;
 		}
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_ELF_SCN_HASH), _cache->c_name);
-		dbg_print(MSG_INTL(MSG_ELF_HASH_INFO));
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_HASH), hsecname);
+		dbg_print(0, MSG_INTL(MSG_ELF_HASH_INFO));
 
 		/*
 		 * Loop through the hash buckets, printing the appropriate
 		 * symbols.
 		 */
 		for (ndx = 0; ndx < bkts; ndx++, hash++) {
-			GElf_Sym	_sym;
-			const char	*_str;
-			GElf_Word	_ndx, _cnt;
-			char		_number[MAXNDXSIZE];
-			ulong_t		nbkt, nhash;
+			Word	_ndx, _cnt;
 
 			if (*hash == 0) {
 				count[0]++;
 				continue;
 			}
 
-			/* LINTED */
-			if (gelf_getsym(dsyms, (int)*hash, &_sym) == NULL) {
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_HSBADSYMNDX),
-				    file, elf_errmsg(0));
-				(void) fflush(stderr);
-				_str = MSG_INTL(MSG_STR_UNKNOWN);
-			} else {
-				_str = string(_cache, (GElf_Word)*hash,
-				    &cache[shdr->sh_link], file,
-				    _sym.st_name);
-			}
-
-			(void) snprintf(number, MAXNDXSIZE,
-			    /* LINTED */
-			    MSG_ORIG(MSG_FMT_INTEGER), (int)ndx);
-			(void) snprintf(_number, MAXNDXSIZE,
-			    MSG_ORIG(MSG_FMT_INDEX2), EC_XWORD(*hash));
-			dbg_print(MSG_ORIG(MSG_FMT_HASH_INFO), number, _number,
-			    demangle(_str, flags));
-
-			/*
-			 * Determine if this string is in the correct bucket.
-			 */
-			nhash = elf_hash(_str);
-			nbkt = nhash % bkts;
-			if (nbkt != ndx) {
-				(void) fprintf(stderr,
-				    MSG_INTL(MSG_ERR_BADHASH), file,
-				    /* LINTED */
-				    _cache->c_name, _str, (int)ndx, (int)nbkt);
-				(void) fflush(stderr);
-			}
+			hash_entry(_cache, &cache[sshdr->sh_link], hsecname,
+			    ndx, *hash, symn, syms, file, bkts, flags, 0);
 
 			/*
 			 * Determine if any other symbols are chained to this
@@ -2113,50 +1866,18 @@
 			_ndx = chain[*hash];
 			_cnt = 1;
 			while (_ndx) {
-				/* LINTED */
-				if (gelf_getsym(dsyms, (int)_ndx,
-				    &_sym) == NULL) {
-					(void) fprintf(stderr,
-						MSG_INTL(MSG_ERR_HSBADSYMNDX),
-					    file, elf_errmsg(0));
-					(void) fflush(stderr);
-					_str = MSG_INTL(MSG_STR_UNKNOWN);
-				} else
-					_str = string(_cache, _ndx,
-						&cache[shdr->sh_link], file,
-						_sym.st_name);
-
-				(void) snprintf(_number, MAXNDXSIZE,
-				    MSG_ORIG(MSG_FMT_INDEX2), EC_XWORD(_ndx));
-				dbg_print(MSG_ORIG(MSG_FMT_HASH_INFO),
-				    MSG_ORIG(MSG_STR_EMPTY), _number,
-				    demangle(_str, flags));
+				hash_entry(_cache, &cache[sshdr->sh_link],
+				    hsecname, ndx, _ndx, symn, syms, file,
+				    bkts, flags, 1);
 				_ndx = chain[_ndx];
 				_cnt++;
-
-				/*
-				 * Determine if this string is in the correct
-				 * bucket.
-				 */
-				nhash = elf_hash(_str);
-				nbkt = nhash % bkts;
-				if (nbkt != ndx) {
-					(void) fprintf(stderr,
-					    MSG_INTL(MSG_ERR_BADHASH), file,
-					    _cache->c_name, _str,
-					    /* LINTED */
-					    (int)ndx, (int)nbkt);
-					(void) fflush(stderr);
-				}
 			}
 
 			if (_cnt >= MAXCOUNT) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_HASH_OVERFLW), file,
-				    _cache->c_name,
-				    /* LINTED */
-				    (int)ndx, _cnt);
-				(void) fflush(stderr);
+				    _cache->c_name, EC_WORD(ndx),
+				    EC_WORD(_cnt));
 			} else
 				count[_cnt]++;
 		}
@@ -2167,147 +1888,124 @@
 	 * Print out the count information.
 	 */
 	bkts = cnt = 0;
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+
 	for (ndx = 0; ndx < MAXCOUNT; ndx++) {
-		GElf_Word	_cnt;
+		Word	_cnt;
 
 		if ((_cnt = count[ndx]) == 0)
 			continue;
 
-		(void) snprintf(number, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER),
-		    /* LINTED */
-		    (int)_cnt);
-		/* LINTED */
-		dbg_print(MSG_INTL(MSG_ELF_HASH_BKTS1), number, (int)ndx);
+		(void) snprintf(number, MAXNDXSIZE,
+		    MSG_ORIG(MSG_FMT_INTEGER), _cnt);
+		dbg_print(0, MSG_INTL(MSG_ELF_HASH_BKTS1), number,
+		    EC_WORD(ndx));
 		bkts += _cnt;
-		/* LINTED */
-		cnt += (GElf_Word)(ndx * _cnt);
+		cnt += (Word)(ndx * _cnt);
 	}
 	if (cnt) {
 		(void) snprintf(number, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER),
-		    /* LINTED */
-		    (int)bkts);
-		/* LINTED */
-		dbg_print(MSG_INTL(MSG_ELF_HASH_BKTS2), number, (int)cnt);
+		    bkts);
+		dbg_print(0, MSG_INTL(MSG_ELF_HASH_BKTS2), number,
+		    EC_WORD(cnt));
 	}
 }
 
-
 static void
-group(Cache *cache, GElf_Word shnum, const char *name, const char *file,
-    uint32_t flags)
+group(Cache *cache, Word shnum, const char *name, const char *file,
+    uint_t flags)
 {
-	GElf_Word	cnt;
+	Word	scnt;
 
-	for (cnt = 1; cnt < shnum; cnt++) {
-		Cache		*_cache = &cache[cnt];
-		GElf_Shdr	*shdr = &_cache->c_shdr;
-		Elf_Data	*dsyms;
-		GElf_Shdr	*symshdr;
-		GElf_Sym	sym;
-		const char	*symname;
-		char		flgstrbuf[MSG_GRP_COMDAT_SIZE + 10];
-		Word		*grpdata;
-		size_t		_cnt;
-		size_t		grpcnt;
-
+	for (scnt = 1; scnt < shnum; scnt++) {
+		Cache	*_cache = &cache[scnt];
+		Shdr	*shdr = _cache->c_shdr;
+		Word	*grpdata, gcnt, grpcnt, symnum, unknown;
+		Cache	*symsec, *strsec;
+		Sym	*syms, *sym;
+		char	flgstrbuf[MSG_GRP_COMDAT_SIZE + 10];
 
 		if (shdr->sh_type != SHT_GROUP)
 			continue;
 		if (name && strcmp(name, _cache->c_name))
 			continue;
-		dbg_print(MSG_INTL(MSG_GRP_LINE1), _cache->c_name);
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-				file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+		if ((_cache->c_data == 0) ||
+		    ((grpdata = (Word *)_cache->c_data->d_buf) == 0))
 			continue;
+		grpcnt = shdr->sh_size / sizeof (Word);
+
+		/*
+		 * Get the data buffer for the associated symbol table and
+		 * string table.
+		 */
+		if (stringtbl(cache, 1, scnt, shnum, file,
+		    &symnum, &symsec, &strsec) == 0)
+			return;
+
+		syms = symsec->c_data->d_buf;
+
+		dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+		dbg_print(0, MSG_INTL(MSG_ELF_SCN_GRP), _cache->c_name);
+		dbg_print(0, MSG_INTL(MSG_GRP_TITLE));
+
+		/*
+		 * The first element of the group defines the group.  The
+		 * associated symbol is defined by the sh_link field.
+		 */
+		if ((shdr->sh_info == SHN_UNDEF) || (shdr->sh_info > symnum)) {
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO),
+			    file, _cache->c_name, EC_WORD(shdr->sh_info));
+			return;
 		}
 
-		if (shdr->sh_entsize != sizeof (Word)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_GRP_BADENTSZ),
-				file, _cache->c_name,
-				EC_XWORD(shdr->sh_entsize));
-			(void) fflush(stderr);
+		(void) strcpy(flgstrbuf, MSG_ORIG(MSG_STR_OSQBRKT));
+		if (grpdata[0] & GRP_COMDAT) {
+			(void) strcat(flgstrbuf, MSG_ORIG(MSG_GRP_COMDAT));
 		}
-		symshdr = &(cache[shdr->sh_link].c_shdr);
-		if ((symshdr->sh_type != SHT_SYMTAB) &&
-		    (symshdr->sh_type != SHT_DYNSYM)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_GRP_NOTSYMTAB),
-				file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
-			continue;
-		}
-		dsyms = cache[shdr->sh_link].c_data;
-		if ((shdr->sh_info == SHN_UNDEF) || ((ulong_t)shdr->sh_info >
-		    (symshdr->sh_size / symshdr->sh_entsize))) {
-			(void) fprintf(stderr, MSG_INTL(MSG_GRP_BADSYMNDX),
-				file, _cache->c_name, EC_XWORD(shdr->sh_info));
-			(void) fflush(stderr);
-			continue;
+		if ((unknown = (grpdata[0] & ~GRP_COMDAT)) != 0) {
+			size_t	len = strlen(flgstrbuf);
+
+			(void) snprintf(&flgstrbuf[len],
+			    (MSG_GRP_COMDAT_SIZE + 10 - len),
+			    MSG_ORIG(MSG_GRP_UNKNOWN), unknown);
 		}
-		flgstrbuf[0] = '[';
-		flgstrbuf[1] = '\0';
-		if ((shdr->sh_size != 0) &&
-		    (_cache->c_data) &&
-		    ((grpdata = (Word *)_cache->c_data->d_buf) != 0)) {
-			if (grpdata[0] & GRP_COMDAT) {
-				(void) strcat(flgstrbuf,
-					MSG_ORIG(MSG_GRP_COMDAT));
-			}
-			if ((grpdata[0] & ~GRP_COMDAT) != 0) {
-				(void) snprintf(flgstrbuf + strlen(flgstrbuf),
-				    (MSG_GRP_COMDAT_SIZE + 10),
-				    MSG_ORIG(MSG_GRP_FMT1),
-				    (uint_t)(grpdata[0] & ~GRP_COMDAT));
-			}
-		}
-		(void) strcat(flgstrbuf, MSG_ORIG(MSG_GRP_CLOSBRKT));
+		(void) strcat(flgstrbuf, MSG_ORIG(MSG_STR_CSQBRKT));
+		sym = (Sym *)(syms + shdr->sh_info);
 
-		if (gelf_getsym(dsyms, shdr->sh_info, &sym) == NULL) {
-			(void) fprintf(stderr,
-				MSG_INTL(MSG_ERR_GRBADSYMNDX),
-				file, elf_errmsg(0));
-			(void) fflush(stderr);
-		}
-		symname = demangle(string(_cache, shdr->sh_link,
-			&cache[symshdr->sh_link], file, sym.st_name),
-			flags);
-		dbg_print(MSG_INTL(MSG_GRP_LINE2));
-		dbg_print(MSG_INTL(MSG_GRP_LINE3),
-			flgstrbuf, symname);
-		for (_cnt = 1, grpcnt = (shdr->sh_size / sizeof (Word));
-		    _cnt < grpcnt; _cnt++) {
+		dbg_print(0, MSG_INTL(MSG_GRP_SIGNATURE), flgstrbuf,
+		    demangle(string(_cache, 0, strsec, file, sym->st_name),
+		    flags));
+
+		for (gcnt = 1; gcnt < grpcnt; gcnt++) {
 			char		index[MAXNDXSIZE];
-			const char	*sname;
+			const char	*name;
 
 			(void) snprintf(index, MAXNDXSIZE,
-			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(_cnt));
-			if (grpdata[_cnt] >= shnum) {
-				sname = MSG_INTL(MSG_GRP_INVALSCN);
-			} else {
-				sname = cache[grpdata[_cnt]].c_name;
-			}
-			(void) printf(MSG_ORIG(MSG_GRP_FMT2), index, sname,
-				(uint_t)grpdata[_cnt]);
+			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(gcnt));
+
+			if (grpdata[gcnt] >= shnum)
+				name = MSG_INTL(MSG_GRP_INVALSCN);
+			else
+				name = cache[grpdata[gcnt]].c_name;
+
+			(void) printf(MSG_ORIG(MSG_GRP_ENTRY), index, name,
+				EC_XWORD(grpdata[gcnt]));
 		}
 	}
 }
 
-
 static void
-got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr,
-    const char *file)
+got(Cache *cache, Word shnum, Ehdr *ehdr, const char *file, uint_t flags)
 {
 	Cache		*gotcache = 0, *symtab = 0, *_cache;
-	GElf_Addr	gotbgn, gotend;
-	GElf_Shdr	*gotshdr;
-	GElf_Word	cnt, gotents, gotndx;
+	Addr		gotbgn, gotend;
+	Shdr		*gotshdr;
+	Word		cnt, gotents, gotndx;
 	size_t		gentsize;
 	Got_info	*gottable;
 	char		*gotdata;
-	GElf_Sym	gsym;
-	GElf_Xword	gsymaddr;
+	Sym		*gotsym;
+	Xword		gotsymaddr;
 
 	/*
 	 * First, find the got.
@@ -2320,7 +2018,7 @@
 			break;
 		}
 	}
-	if (!gotcache)
+	if (gotcache == 0)
 		return;
 
 	/*
@@ -2329,40 +2027,33 @@
 	if (ehdr->e_type == ET_REL) {
 		(void) fprintf(stderr, MSG_INTL(MSG_GOT_UNEXPECTED), file,
 		    _cache->c_name);
-		(void) fflush(stderr);
 	}
 
-	gotshdr = &gotcache->c_shdr;
-	gotbgn = gotshdr->sh_addr;
-
+	gotshdr = gotcache->c_shdr;
 	if (gotshdr->sh_size == 0) {
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
 		    file, gotcache->c_name);
-		(void) fflush(stderr);
 		return;
 	}
+
+	gotbgn = gotshdr->sh_addr;
 	gotend = gotbgn + gotshdr->sh_size;
 
 	/*
-	 * Some architectures don't properly set the sh_entsize
-	 * for the GOT table.  If it's not set we will default
-	 * to a size of a pointer.
+	 * Some architectures don't properly set the sh_entsize for the GOT
+	 * table.  If it's not set, default to a size of a pointer.
 	 */
-	if ((gentsize = gotshdr->sh_entsize) == 0) {
-		if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
-			gentsize = sizeof (GElf_Xword);
-		else
-			gentsize = sizeof (GElf_Word);
-	}
+	if ((gentsize = gotshdr->sh_entsize) == 0)
+		gentsize = sizeof (Xword);
+
 	/* LINTED */
-	gotents = (GElf_Word)(gotshdr->sh_size / gentsize);
+	gotents = (Word)(gotshdr->sh_size / gentsize);
 	gotdata = gotcache->c_data->d_buf;
 
 	if ((gottable = calloc(gotents, sizeof (Got_info))) == 0) {
 		int err = errno;
-		(void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC),
-			file, strerror(err));
-		(void) fflush(stderr);
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC), file,
+		    strerror(err));
 		return;
 	}
 
@@ -2374,97 +2065,86 @@
 	 * overriding a dynsym) so that we can lookup _GLOBAL_OFFSET_TABLE_.
 	 */
 	for (cnt = 1; cnt < shnum; cnt++) {
-		GElf_Shdr	*shdr;
-		GElf_Word	rtype;
-		Elf_Data	*dsyms, *reldata;
-		GElf_Rela	rela;
-		ulong_t		rcount;
-		int		ndx;
-		char		*sname;
+		Word		type, symnum;
+		Xword		relndx, relnum, relsize;
+		void		*rels;
+		Sym		*syms;
+		Cache		*symsec, *strsec;
+		Cache		*_cache = &cache[cnt];
+		Shdr		*shdr;
 
-		_cache = &cache[cnt];
-		shdr = &_cache->c_shdr;
+		shdr = _cache->c_shdr;
+		type = shdr->sh_type;
 
-		if ((symtab == 0) && (shdr->sh_type == SHT_DYNSYM)) {
+		if ((symtab == 0) && (type == SHT_DYNSYM)) {
 			symtab = _cache;
 			continue;
 		}
-		if (shdr->sh_type == SHT_SYMTAB) {
+		if (type == SHT_SYMTAB) {
 			symtab = _cache;
 			continue;
 		}
-
-		rtype = shdr->sh_type;
-		if ((rtype != SHT_RELA) && (rtype != SHT_REL))
+		if ((type != SHT_RELA) && (type != SHT_REL))
 			continue;
 
 		/*
-		 * Determine the relocation data and number.
+		 * Decide entry size.
 		 */
-		if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, _cache->c_name);
-			(void) fflush(stderr);
-			continue;
-		}
-		rcount = shdr->sh_size / shdr->sh_entsize;
-
-		reldata = _cache->c_data;
-
-		/*
-		 * Get the data buffer for the associated symbol table.
-		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-				file, _cache->c_name, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
-			continue;
-		}
-		dsyms = cache[shdr->sh_link].c_data;
-		if (dsyms->d_buf == 0) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
-			    file, cache[shdr->sh_link].c_name);
-			(void) fflush(stderr);
-			continue;
+		if (((relsize = shdr->sh_entsize) == 0) ||
+		    (relsize > shdr->sh_size)) {
+			if (type == SHT_RELA)
+				relsize = sizeof (Rela);
+			else
+				relsize = sizeof (Rel);
 		}
 
-		sname = cache[shdr->sh_link].c_name;
-		shdr = &cache[shdr->sh_link].c_shdr;
 		/*
-		 * Get the associated string table section.
+		 * Determine the number of relocations available.
 		 */
-		if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) {
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK),
-			    file, sname, EC_XWORD(shdr->sh_link));
-			(void) fflush(stderr);
+		if (shdr->sh_size == 0) {
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
+			    file, _cache->c_name);
 			continue;
 		}
+		rels = _cache->c_data->d_buf;
+		relnum = shdr->sh_size / relsize;
 
-		/* LINTED */
-		for (ndx = 0; ndx < rcount; ++ndx) {
-			GElf_Sym 	_sym;
-			GElf_Word	sndx;
-			GElf_Addr	offset;
+		/*
+		 * Get the data buffer for the associated symbol table and
+		 * string table.
+		 */
+		if (stringtbl(cache, 1, cnt, shnum, file,
+		    &symnum, &symsec, &strsec) == 0)
+			continue;
+
+		syms = symsec->c_data->d_buf;
+
+		/*
+		 * Loop through the relocation entries.
+		 */
+		for (relndx = 0; relndx < relnum; relndx++,
+		    rels = (void *)((char *)rels + relsize)) {
+			char		section[BUFSIZ];
+			Addr		offset;
 			Got_info	*gip;
-			void		*relret;
+			Word		symndx, reltype;
+			Rela		*rela;
+			Rel		*rel;
 
-			if (rtype == SHT_RELA) {
-				relret = (void *)gelf_getrela(reldata, ndx,
-				    &rela);
+			/*
+			 * Unravel the relocation.
+			 */
+			if (type == SHT_RELA) {
+				rela = (Rela *)rels;
+				symndx = ELF_R_SYM(rela->r_info);
+				reltype = ELF_R_TYPE(rela->r_info);
+				offset = rela->r_offset;
 			} else {
-				relret = (void *)gelf_getrel(reldata, ndx,
-				    (GElf_Rel *)&rela);
+				rel = (Rel *)rels;
+				symndx = ELF_R_SYM(rel->r_info);
+				reltype = ELF_R_TYPE(rel->r_info);
+				offset = rel->r_offset;
 			}
-			if (relret == NULL) {
-				(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADREL),
-				    file, _cache->c_name, elf_errmsg(0));
-				(void) fflush(stderr);
-				break;
-			}
-
-			offset = rela.r_offset;
-			/* LINTED */
-			sndx = (GElf_Word)GELF_R_SYM(rela.r_info);
 
 			/*
 			 * Only pay attention to relocations against the GOT.
@@ -2473,148 +2153,129 @@
 				continue;
 
 			/* LINTED */
-			gotndx = (GElf_Word)((offset - gotbgn) /
+			gotndx = (Word)((offset - gotbgn) /
 			    gotshdr->sh_entsize);
 			gip = &gottable[gotndx];
-			if (gip->g_rshtype != 0) {
+
+			if (gip->g_reltype != 0) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_GOT_MULTIPLE), file,
-				    /* LINTED */
-				    EC_WORD(gotndx), EC_XWORD(offset));
-				(void) fflush(stderr);
+				    EC_WORD(gotndx), EC_ADDR(offset));
 				continue;
 			}
 
-			/* LINTED */
-			if (gelf_getsym(dsyms, sndx, &_sym) == NULL) {
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_RELBADSYMNDX),
-				    file, elf_errmsg(0));
-				(void) fflush(stderr);
-				gip->g_symname = MSG_INTL(MSG_STR_UNKNOWN);
-			} else {
-				gip->g_symname = string(_cache, sndx,
-				    &cache[shdr->sh_link], file, _sym.st_name);
-			}
-			gip->g_rshtype = rtype;
-			gip->g_rela = rela;
+			if (symndx)
+				gip->g_symname = relsymname(cache, _cache,
+				    strsec, symndx, symnum, relndx, syms,
+				    section, BUFSIZ, file, flags);
+			gip->g_reltype = reltype;
+			gip->g_rel = rels;
 		}
 	}
 
-	if (symlookup(MSG_ORIG(MSG_GOT_SYM), cache, shnum, &gsym, symtab, file))
-		gsymaddr = gsym.st_value;
+	if (symlookup(MSG_ORIG(MSG_GOT_SYM), cache, shnum, &gotsym, symtab,
+	    file))
+		gotsymaddr = gotsym->st_value;
 	else
-		gsymaddr = gotbgn;
+		gotsymaddr = gotbgn;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_ELF_SCN_GOT), gotcache->c_name, gotents);
-	Gelf_got_title(ehdr->e_ident[EI_CLASS]);
+	dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(0, MSG_INTL(MSG_ELF_SCN_GOT), gotcache->c_name);
+	Elf_got_title(0);
 
 	for (gotndx = 0; gotndx < gotents; gotndx++) {
 		Got_info	*gip;
 		Sword		gindex;
-		GElf_Addr	gaddr;
-		GElf_Xword	gotentry;
+		Addr		gaddr;
+		Xword		gotentry;
 
 		gip = &gottable[gotndx];
 
 		gaddr = gotbgn + (gotndx * gentsize);
-		/* LINTED */
-		gindex = (Sword)((gaddr - gsymaddr) / gentsize);
+		gindex = (Sword)(gaddr - gotsymaddr) / (Sword)gentsize;
 
-		if (gentsize == sizeof (GElf_Word))
+		if (gentsize == sizeof (Word))
 			/* LINTED */
-			gotentry = (GElf_Xword)(*((GElf_Word *)(gotdata) +
-			    gotndx));
+			gotentry = (Xword)(*((Word *)(gotdata) + gotndx));
 		else
 			/* LINTED */
-			gotentry = *((GElf_Xword *)(gotdata) + gotndx);
+			gotentry = *((Xword *)(gotdata) + gotndx);
 
-		Gelf_got_entry(ehdr, gindex, gaddr, gotentry, gip->g_rshtype,
-		    &gip->g_rela, gip->g_symname);
+		Elf_got_entry(0, gindex, gaddr, gotentry, ehdr->e_machine,
+		    gip->g_reltype, gip->g_rel, gip->g_symname);
 	}
-
 	free(gottable);
 }
 
 void
 checksum(Elf *elf)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_STR_CHECKSUM), gelf_checksum(elf));
+	dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(0, MSG_INTL(MSG_STR_CHECKSUM), elf_checksum(elf));
 }
 
-static void
-regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd)
+void
+regular(const char *file, Elf *elf, uint_t flags, char *Nname, int wfd)
 {
 	Elf_Scn		*scn;
-	GElf_Ehdr	ehdr;
+	Ehdr		*ehdr;
 	Elf_Data	*data;
-	uint_t		cnt;
-	GElf_Word	shnum, phnum;
-	size_t		shstrndx, _shnum, _phnum;
-	GElf_Shdr	nameshdr;
-	GElf_Shdr	shdr0;
-	GElf_Shdr	*_shdr0;
+	size_t		cnt, shstrndx, shnum, phnum;
+	Shdr		*nameshdr, *shdr;
 	char		*names = 0;
 	Cache		*cache, *_cache;
-	Cache		*versymcache;
+	Cache		*versymcache = 0;
 
-	if (gelf_getehdr(elf, &ehdr) == NULL) {
+	if ((ehdr = elf_getehdr(elf)) == NULL) {
 		failure(file, MSG_ORIG(MSG_ELF_GETEHDR));
 		return;
 	}
 
-	if (elf_getshnum(elf, &_shnum) == 0) {
+	if (elf_getshnum(elf, &shnum) == 0) {
 		failure(file, MSG_ORIG(MSG_ELF_GETSHNUM));
 		return;
 	}
-	/* LINTED */
-	shnum = (GElf_Word)_shnum;
 
 	if (elf_getshstrndx(elf, &shstrndx) == 0) {
 		failure(file, MSG_ORIG(MSG_ELF_GETSHSTRNDX));
 		return;
 	}
 
-	if (elf_getphnum(elf, &_phnum) == 0) {
+	if (elf_getphnum(elf, &phnum) == 0) {
 		failure(file, MSG_ORIG(MSG_ELF_GETPHNUM));
 		return;
 	}
-	/* LINTED */
-	phnum = (GElf_Word)_phnum;
 
 	if ((scn = elf_getscn(elf, 0)) != NULL) {
-		if ((_shdr0 = gelf_getshdr(scn, &shdr0)) == NULL) {
+		if ((shdr = elf_getshdr(scn)) == NULL) {
 			failure(file, MSG_ORIG(MSG_ELF_GETSHDR));
 			(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN), 0);
-			(void) fflush(stderr);
 			return;
 		}
 	} else
-		_shdr0 = 0;
+		shdr = 0;
 
 	/*
 	 * Print the elf header.
 	 */
 	if (flags & FLG_EHDR)
-		Gelf_elf_header(&ehdr, _shdr0);
+		Elf_ehdr(0, ehdr, shdr);
 
 	/*
 	 * Print the program headers.
 	 */
-	if ((flags & FLG_PHDR) && phnum != 0) {
-		GElf_Phdr phdr;
+	if ((flags & FLG_PHDR) && (phnum != 0)) {
+		Phdr *phdr;
 
-		for (cnt = 0; cnt < phnum; cnt++) {
-			if (gelf_getphdr(elf, cnt, &phdr) == NULL) {
-				failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
-				return;
-			}
+		if ((phdr = elf_getphdr(elf)) == NULL) {
+			failure(file, MSG_ORIG(MSG_ELF_GETPHDR));
+			return;
+		}
 
-			dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-			dbg_print(MSG_INTL(MSG_ELF_PHDR), cnt);
-			Gelf_phdr_entry(ehdr.e_machine, &phdr);
+		for (cnt = 0; cnt < phnum; phdr++, cnt++) {
+			dbg_print(0, MSG_ORIG(MSG_STR_EMPTY));
+			dbg_print(0, MSG_INTL(MSG_ELF_PHDR), EC_WORD(cnt));
+			Elf_phdr(0, ehdr->e_machine, phdr);
 		}
 	}
 
@@ -2625,11 +2286,12 @@
 	 * was requested.
 	 */
 	if ((shnum <= 1) || (flags && (flags & ~(FLG_EHDR | FLG_PHDR)) == 0)) {
-		if ((ehdr.e_type == ET_CORE) && (flags & FLG_NOTE))
+		if ((ehdr->e_type == ET_CORE) && (flags & FLG_NOTE))
 			note(0, shnum, 0, file);
 		return;
 	}
 
+
 	/*
 	 * Obtain the .shstrtab data buffer to provide the required section
 	 * name strings.
@@ -2638,22 +2300,20 @@
 		failure(file, MSG_ORIG(MSG_ELF_GETSCN));
 		(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SHDR),
 		    EC_XWORD(shstrndx));
-		(void) fflush(stderr);
+
 	} else if ((data = elf_getdata(scn, NULL)) == NULL) {
 		failure(file, MSG_ORIG(MSG_ELF_GETDATA));
 		(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_DATA),
 		    EC_XWORD(shstrndx));
-		(void) fflush(stderr);
-	} else if (gelf_getshdr(scn, &nameshdr) == NULL) {
+
+	} else if ((nameshdr = elf_getshdr(scn)) == NULL) {
 		failure(file, MSG_ORIG(MSG_ELF_GETSHDR));
 		(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN),
 		    /* LINTED */
 		    (int)elf_ndxscn(scn));
-		(void) fflush(stderr);
-	} else if ((names = data->d_buf) == 0) {
+
+	} else if ((names = data->d_buf) == 0)
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_SHSTRNULL), file);
-		(void) fflush(stderr);
-	}
 
 	/*
 	 * Fill in the cache descriptor with information for each section.
@@ -2662,28 +2322,26 @@
 		int err = errno;
 		(void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC),
 		    file, strerror(err));
-		(void) fflush(stderr);
 		return;
 	}
 
-	*cache = _cache_init;
+	*cache = cache_init;
 	_cache = cache;
 	_cache++;
 
 	for (cnt = 1, scn = NULL; scn = elf_nextscn(elf, scn);
 	    cnt++, _cache++) {
-		if (gelf_getshdr(scn, &_cache->c_shdr) == NULL) {
+		if ((_cache->c_shdr = elf_getshdr(scn)) == NULL) {
 			failure(file, MSG_ORIG(MSG_ELF_GETSHDR));
 			(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN),
 			    /* LINTED */
 			    (int)elf_ndxscn(scn));
-			(void) fflush(stderr);
 		}
 
-		if (names && _cache->c_shdr.sh_name &&
+		if (names && _cache->c_shdr->sh_name &&
 		    /* LINTED */
-		    (nameshdr.sh_size > _cache->c_shdr.sh_name))
-			_cache->c_name = names + _cache->c_shdr.sh_name;
+		    (nameshdr->sh_size > _cache->c_shdr->sh_name))
+			_cache->c_name = names + _cache->c_shdr->sh_name;
 		else {
 			/*
 			 * If there exists no shstrtab data, or a section header
@@ -2702,12 +2360,11 @@
 			 */
 			if (names &&
 			    /* LINTED */
-			    (nameshdr.sh_size <= _cache->c_shdr.sh_name)) {
+			    (nameshdr->sh_size <= _cache->c_shdr->sh_name)) {
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_ERR_BADSHNAME), file,
 				    _cache->c_name,
-				    EC_XWORD(_cache->c_shdr.sh_name));
-				(void) fflush(stderr);
+				    EC_XWORD(_cache->c_shdr->sh_name));
 			}
 
 			if ((_cache->c_name =
@@ -2715,7 +2372,6 @@
 				int err = errno;
 				(void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC),
 				    file, strerror(err));
-				(void) fflush(stderr);
 				return;
 			}
 			(void) strcpy(_cache->c_name, scnndxnm);
@@ -2726,7 +2382,6 @@
 			(void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCNDATA),
 			    /* LINTED */
 			    (int)elf_ndxscn(scn));
-			(void) fflush(stderr);
 		}
 
 		/*
@@ -2739,21 +2394,21 @@
 	}
 
 	if (flags & FLG_SHDR)
-		sections(file, cache, shnum, phnum, &ehdr, Nname);
+		sections(file, cache, shnum, ehdr, Nname);
 
 	if (flags & FLG_INTERP)
-		interp(file, cache, shnum, phnum, &ehdr, elf);
+		interp(file, cache, shnum, phnum, elf);
 
 	versymcache = versions(cache, shnum, file, flags);
 
 	if (flags & FLG_SYMBOLS)
-		symbols(cache, shnum, phnum, &ehdr, Nname, versymcache, file);
+		symbols(cache, shnum, ehdr, Nname, versymcache, file, flags);
 
 	if (flags & FLG_HASH)
 		hash(cache, shnum, Nname, file, flags);
 
 	if (flags & FLG_GOT)
-		got(cache, shnum, phnum, &ehdr, file);
+		got(cache, shnum, ehdr, file, flags);
 
 	if (flags & FLG_GROUP)
 		group(cache, shnum, Nname, file, flags);
@@ -2762,10 +2417,10 @@
 		syminfo(cache, shnum, file);
 
 	if (flags & FLG_RELOC)
-		reloc(cache, shnum, phnum, &ehdr, Nname, file, flags);
+		reloc(cache, shnum, ehdr, Nname, file, flags);
 
 	if (flags & FLG_DYNAMIC)
-		dynamic(cache, shnum, &ehdr, file);
+		dynamic(cache, shnum, ehdr, file);
 
 	if (flags & FLG_NOTE)
 		note(cache, shnum, Nname, file);
@@ -2777,358 +2432,10 @@
 		checksum(elf);
 
 	if (flags & FLG_CAP)
-		cap(file, cache, shnum, phnum, &ehdr, elf);
+		cap(file, cache, shnum, phnum, ehdr, elf);
 
 	if (flags & FLG_UNWIND)
-		unwind(cache, shnum, phnum, &ehdr, Nname, file, elf);
+		unwind(cache, shnum, phnum, ehdr, Nname, file, elf);
 
 	free(cache);
 }
-
-static void
-archive(const char *file, int fd, Elf *elf, uint32_t flags, char *Nname,
-    int wfd)
-{
-	Elf_Cmd		cmd = ELF_C_READ;
-	Elf_Arhdr	*arhdr;
-	Elf		*_elf = 0;
-	size_t		ptr;
-	Elf_Arsym	*arsym = 0;
-
-	/*
-	 * Determine if the archive sysmbol table itself is required.
-	 */
-	if ((flags & FLG_SYMBOLS) && ((Nname == NULL) ||
-	    (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))) {
-		/*
-		 * Get the archive symbol table.
-		 */
-		if (((arsym = elf_getarsym(elf, &ptr)) == 0) && elf_errno()) {
-			/*
-			 * The arsym could be 0 even though there was no error.
-			 * Print the error message only when there was
-			 * real error from elf_getarsym().
-			 */
-			failure(file, MSG_ORIG(MSG_ELF_GETARSYM));
-			return;
-		}
-	}
-
-	/*
-	 * Print the archive symbol table only when the archive symbol
-	 * table exists and it was requested to print.
-	 */
-	if (arsym) {
-		size_t		cnt;
-		char		index[MAXNDXSIZE];
-		size_t		offset = 0, _offset = 0;
-
-		/*
-		 * Print out all the symbol entries.
-		 */
-		dbg_print(MSG_INTL(MSG_ARCHIVE_SYMTAB));
-		dbg_print(MSG_INTL(MSG_ARCHIVE_FIELDS));
-
-		for (cnt = 0; cnt < ptr; cnt++, arsym++) {
-			/*
-			 * For each object obtain an elf descriptor so that we
-			 * can establish the members name.  Note, we have had
-			 * archives where the archive header has not been
-			 * obtainable so be lenient with errors.
-			 */
-			if ((offset == 0) || ((arsym->as_off != 0) &&
-			    (arsym->as_off != _offset))) {
-
-				if (_elf)
-					(void) elf_end(_elf);
-
-				if (elf_rand(elf, arsym->as_off) !=
-				    arsym->as_off) {
-					failure(file, MSG_ORIG(MSG_ELF_RAND));
-					arhdr = 0;
-				} else if ((_elf = elf_begin(fd,
-				    ELF_C_READ, elf)) == 0) {
-					failure(file, MSG_ORIG(MSG_ELF_BEGIN));
-					arhdr = 0;
-				} else if ((arhdr = elf_getarhdr(_elf)) == 0) {
-					failure(file,
-					    MSG_ORIG(MSG_ELF_GETARHDR));
-					arhdr = 0;
-				}
-
-				_offset = arsym->as_off;
-				if (offset == 0)
-					offset = _offset;
-			}
-
-			(void) snprintf(index, MAXNDXSIZE,
-			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(cnt));
-			if (arsym->as_off)
-				dbg_print(MSG_ORIG(MSG_FMT_ARSYM1), index,
-				    /* LINTED */
-				    (int)arsym->as_off, arhdr ? arhdr->ar_name :
-				    MSG_INTL(MSG_STR_UNKNOWN), (arsym->as_name ?
-				    demangle(arsym->as_name, flags) :
-				    MSG_INTL(MSG_STR_NULL)));
-			else
-				dbg_print(MSG_ORIG(MSG_FMT_ARSYM2), index,
-				    /* LINTED */
-				    (int)arsym->as_off);
-		}
-
-		if (_elf)
-			(void) elf_end(_elf);
-
-		/*
-		 * If we only need the archive symbol table return.
-		 */
-		if ((flags & FLG_SYMBOLS) && Nname &&
-		    (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))
-			return;
-
-		/*
-		 * Reset elf descriptor in preparation for processing each
-		 * member.
-		 */
-		if (offset)
-			(void) elf_rand(elf, offset);
-	}
-
-	/*
-	 * Process each object within the archive.
-	 */
-	while ((_elf = elf_begin(fd, cmd, elf)) != NULL) {
-		char	name[MAXPATHLEN];
-
-		if ((arhdr = elf_getarhdr(_elf)) == NULL) {
-			failure(file, MSG_ORIG(MSG_ELF_GETARHDR));
-			return;
-		}
-		if (*arhdr->ar_name != '/') {
-			(void) snprintf(name, MAXPATHLEN,
-			    MSG_ORIG(MSG_FMT_ARNAME), file, arhdr->ar_name);
-			dbg_print(MSG_ORIG(MSG_FMT_NLSTR), name);
-
-			switch (elf_kind(_elf)) {
-			case ELF_K_AR:
-				archive(name, fd, _elf, flags, Nname, wfd);
-				break;
-			case ELF_K_ELF:
-				regular(name, _elf, flags, Nname, wfd);
-				break;
-			default:
-				(void) fprintf(stderr,
-					MSG_INTL(MSG_ERR_BADFILE), name);
-				(void) fflush(stderr);
-				break;
-			}
-		}
-
-		cmd = elf_next(_elf);
-		(void) elf_end(_elf);
-	}
-}
-
-int
-main(int argc, char **argv, char **envp)
-{
-	Elf		*elf;
-	int		var, fd, wfd = 0;
-	char		*Nname = NULL, *wname = 0;
-	uint32_t	flags = 0, dbg_flags = 0;
-
-	/*
-	 * If we're on a 64-bit kernel, try to exec a full 64-bit version of
-	 * the binary.  If successful, conv_check_native() won't return.
-	 */
-	conv_check_native(argv, envp);
-
-	/*
-	 * Establish locale.
-	 */
-	(void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY));
-	(void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS));
-
-	(void) setvbuf(stdout, NULL, _IOLBF, 0);
-	(void) setvbuf(stderr, NULL, _IOLBF, 0);
-
-	opterr = 0;
-	while ((var = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != EOF) {
-		switch (var) {
-		case 'C':
-			flags |= FLG_DEMANGLE;
-			break;
-		case 'c':
-			flags |= FLG_SHDR;
-			break;
-		case 'd':
-			flags |= FLG_DYNAMIC;
-			break;
-		case 'e':
-			flags |= FLG_EHDR;
-			break;
-		case 'G':
-			flags |= FLG_GOT;
-			break;
-		case 'g':
-			flags |= FLG_GROUP;
-			break;
-		case 'H':
-			flags |= FLG_CAP;
-			break;
-		case 'h':
-			flags |= FLG_HASH;
-			break;
-		case 'i':
-			flags |= FLG_INTERP;
-			break;
-		case 'k':
-			flags |= FLG_CHECKSUM;
-			break;
-		case 'l':
-			flags |= FLG_LONGNAME;
-			break;
-		case 'm':
-			flags |= FLG_MOVE;
-			break;
-		case 'N':
-			Nname = optarg;
-			break;
-		case 'n':
-			flags |= FLG_NOTE;
-			break;
-		case 'p':
-			flags |= FLG_PHDR;
-			break;
-		case 'r':
-			flags |= FLG_RELOC;
-			break;
-		case 's':
-			flags |= FLG_SYMBOLS;
-			break;
-		case 'u':
-			flags |= FLG_UNWIND;
-			break;
-		case 'v':
-			flags |= FLG_VERSIONS;
-			break;
-		case 'w':
-			wname = optarg;
-			break;
-		case 'y':
-			flags |= FLG_SYMINFO;
-			break;
-		case '?':
-			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
-			    basename(argv[0]));
-			detail_usage();
-			return (1);
-		default:
-			break;
-		}
-	}
-
-	/*
-	 * Validate any arguments.
-	 */
-	if (flags == 0) {
-		if (!wname && !Nname) {
-			flags = FLG_EVERYTHING;
-		} else if (!wname || !Nname) {
-			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
-			    basename(argv[0]));
-			return (1);
-		}
-	}
-
-	if ((var = argc - optind) == 0) {
-		(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
-		    basename(argv[0]));
-		return (1);
-	}
-
-	/*
-	 * If the -C option is used by itself, report an error since the option
-	 * has no use without other symbol name generating options.
-	 *
-	 * If the -l option is used by itself, report an error.
-	 */
-	if ((flags == FLG_DEMANGLE) || (flags == FLG_LONGNAME) ||
-	    (flags == (FLG_DEMANGLE | FLG_LONGNAME))) {
-		if (flags & FLG_DEMANGLE)
-			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DEMANGLE));
-		if (flags & FLG_LONGNAME)
-			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_LONGNAME));
-		return (1);
-	}
-
-	/*
-	 * If the -l/-C option is specified, set up the liblddbg.so.
-	 */
-	if (flags & FLG_LONGNAME)
-		dbg_flags = DBG_LONG;
-	if (flags & FLG_DEMANGLE)
-		dbg_flags |= DBG_DEMANGLE;
-	if (dbg_flags)
-		Dbg_set(dbg_flags);
-
-	/*
-	 * If the -w option has indicated an output file open it.  It's
-	 * arguable whether this option has much use when multiple files are
-	 * being processed.
-	 */
-	if (wname) {
-		if ((wfd = open(wname, (O_RDWR | O_CREAT | O_TRUNC),
-		    0666)) < 0) {
-			int err = errno;
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN),
-			    wname, strerror(err));
-			(void) fflush(stderr);
-			wfd = 0;
-		}
-	}
-
-	/*
-	 * Open the input file and initialize the elf interface.
-	 */
-	for (; optind < argc; optind++) {
-		const char	*file = argv[optind];
-
-		if ((fd = open(argv[optind], O_RDONLY)) == -1) {
-			int err = errno;
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN),
-			    file, strerror(err));
-			(void) fflush(stderr);
-			continue;
-		}
-		(void) elf_version(EV_CURRENT);
-		if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
-			failure(file, MSG_ORIG(MSG_ELF_BEGIN));
-			(void) close(fd);
-			continue;
-		}
-
-		if (var > 1)
-			dbg_print(MSG_ORIG(MSG_FMT_NLSTRNL), file);
-
-		switch (elf_kind(elf)) {
-		case ELF_K_AR:
-			archive(file, fd, elf, flags, Nname, wfd);
-			break;
-		case ELF_K_ELF:
-			regular(file, elf, flags, Nname, wfd);
-			break;
-		default:
-			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file);
-			(void) fflush(stderr);
-			break;
-		}
-
-		(void) close(fd);
-		(void) elf_end(elf);
-	}
-
-	if (wfd)
-		(void) close(wfd);
-	return (0);
-}
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -25,6 +24,7 @@
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 @ _START_
 
@@ -65,11 +65,6 @@
 @ MSG_USAGE_DETAIL20	"\t[-y]\t\tdump the contents of the .SUNW_syminfo \
 			 section\n"
 
-@ MSG_USAGE_DEMANGLE	"usage: -C option is only meaningful \
-			 with other options that display symbol names\n"
-@ MSG_USAGE_LONGNAME	"usage: -l option is only meaningful \
-			 with other options that display section names\n"
-
 # Errors
 
 @ MSG_ERR_BADFILE	"%s: invalid file type\n"
@@ -77,13 +72,10 @@
 @ MSG_ERR_SHSTRNULL	"%s: zero size section header string table (shstrtab)\n"
 @ MSG_ERR_FAILURE	"%s: %s failed: %s\n"
 @ MSG_ERR_BADSHNAME	"%s: %s: invalid sh_name: %lld\n"
-@ MSG_ERR_BADSHLINK	"%s: %s: invalid sh_link: %lld\n"
-@ MSG_ERR_BADSHINFO	"%s: %s: invalid sh_info: %lld\n"
-@ MSG_ERR_BADSHTYPE	"%s: %s: invalid sh_type: %lld\n"
+@ MSG_ERR_BADSHLINK	"%s: %s: invalid sh_link: %d\n"
+@ MSG_ERR_BADSHINFO	"%s: %s: invalid sh_info: %d\n"
+@ MSG_ERR_BADSHTYPE	"%s: %s: invalid sh_type: %d\n"
 @ MSG_ERR_BADALIGN	"%s: %s: bad sh_offset alignment\n"
-@ MSG_ERR_SIBADCOUNT	"%s: %s: bad syminfo entry: %d\n"
-@ MSG_ERR_BADCAP	"%s: %s: bad capabilities entry: %s\n"
-@ MSG_ERR_BADSYM	"%s: %s: bad symbol entry: %s\n"
 @ MSG_ERR_BADSYM2	"%s: %s: bad symbol entry: %s: must be SHN_COMMON or \
 			 defined in SHT_NOBITS section\n"
 @ MSG_ERR_BADSYM3	"%s: %s: bad symbol entry: %s: must be defined in \
@@ -93,12 +85,10 @@
 @ MSG_ERR_BADSYM5	"%s: %s: bad symbol entry: %s: invalid shndx: %d\n"
 @ MSG_ERR_BADSYM6	"%s: %s: bad symbol entry: %s: section[%d] size: %lld: \
 			 is smaller than symbol size: %lld\n"
-@ MSG_ERR_BADMOVE	"%s: %s: bad move table entry: %s\n"
-@ MSG_ERR_BADREL	"%s: %s: bad relocation table entry: %s\n"
-@ MSG_ERR_RELBADSYMNDX	"%s: bad symbol reference from relocation entry: %s\n"
-@ MSG_ERR_MVBADSYMNDX	"%s: bad symbol reference from move entry: %s\n"
-@ MSG_ERR_HSBADSYMNDX	"%s: bad symbol reference from hash entry: %s\n"
-@ MSG_ERR_GRBADSYMNDX	"%s: bad symbol reference from group entry: %s\n"
+
+@ MSG_ERR_RELBADSYMNDX	"%s: bad symbol reference %d: from relocation \
+			 entry: %d\n"
+@ MSG_ERR_HSBADSYMNDX	"%s: bad symbol reference %d: from hash entry: %d\n"
 @ MSG_ERR_BADSYMXINDEX1	"%s: %s: index[%d]: invalid SHN_XINDEX reference: \
 			 SHT_SYMTAB_SHNDX section truncated: no entry for this \
 			 symbol\n"
@@ -106,12 +96,12 @@
 			 bad SHT_SYMTAB_SHNDX entry: invalid shndx: 0x%x\n"
 @ MSG_ERR_BADSYMXINDEX3	"%s: %s: index[%d]: invalid SHN_XINDEX reference: \
 			 SHT_SYMTAB_SHNDX section not found\n"
-@ MSG_ERR_BADSTOFF	"%s: %s: index[%d]: bad %s offset: 0x%llx: max 0x%llx\n"
-@ MSG_ERR_BADDYN	"%s: %s: bad index into .dynamic: %d\n"
-@ MSG_ERR_BADSZ		"%s: %s: zero size or entry size information\n"
+
+@ MSG_ERR_BADSTOFF	"%s: %s: index[%d]: bad %s offset: 0x%x: max 0x%x\n"
+@ MSG_ERR_BADSZ		"%s: %s: zero size or zero entry size information\n"
 @ MSG_ERR_BADMINFO	"%s: %s: invalid m_info: 0x%llx\n"
 @ MSG_ERR_BADHASH	"%s: %s: bad hash entry: symbol %s: exists in bucket \
-			 %d, should be bucket %d\n"
+			 %d, should be bucket %ld\n"
 
 @ MSG_WARN_INVINTERP1	"%s: PT_INTERP header has no associated section\n"
 @ MSG_WARN_INVINTERP2	"%s: interp section: %s: and PT_INTERP program \
@@ -138,17 +128,13 @@
 @ MSG_ELF_SCN_NOTE	"Note Section:  %s"
 @ MSG_ELF_SCN_HASH	"Hash Section:  %s"
 @ MSG_ELF_SCN_SYMINFO	"Syminfo Section:  %s"
-@ MSG_ELF_SCN_GOT	"Global Offset Table Section:  %s  (%u entries)"
+@ MSG_ELF_SCN_GOT	"Global Offset Table Section:  %s"
+@ MSG_ELF_SCN_GRP	"Group Section:  %s"
+@ MSG_ELF_SCN_MOVE	"Move Section:  %s"
 
-@ MSG_ELF_RELOC_RELA	"\ttype\t\t              offset     addend  section        \
-			 with respect to"
-@ MSG_ELF_RELOC_REL	"\ttype\t\t              offset             section        \
-			 with respect to"
-@ MSG_ELF_L_RELOC_RELA	"\ttype\t\t              offset     addend  section/symbol"
-@ MSG_ELF_L_RELOC_REL	"\ttype\t\t              offset             section/symbol"
 @ MSG_ELF_HASH_BKTS1	"%10.10s  buckets contain %8d symbols"
 @ MSG_ELF_HASH_BKTS2	"%10.10s  buckets         %8d symbols (globals)"
-@ MSG_ELF_HASH_INFO	"    bucket    symndx    name"
+@ MSG_ELF_HASH_INFO	"    bucket  symndx      name"
 @ MSG_HASH_OVERFLW	"%s: warning: section %s: too many symbols to count, \
 			 bucket=%d count=%d"
 @ MSG_ELF_ERR_SHDR	"\tunable to obtain section header: shstrtab[%lld]\n"
@@ -163,11 +149,8 @@
 @ MSG_GOT_UNEXPECTED	"%s: warning: section %s: section unexpected within \
 			 relocatable object\n"
 
-
 # Miscellaneous clutter
 
-@ MSG_STR_INDEX		"index"
-@ MSG_STR_NAME		"name"
 @ MSG_STR_NULL		"(null)"
 @ MSG_STR_DEPRECATED	"(deprecated value)"
 @ MSG_STR_UNKNOWN	"<unknown>"
@@ -181,47 +164,41 @@
 @ MSG_ERR_OPEN		"%s: open: %s\n"
 
 #
-# For Elf{32,64}_Move section
+# SHT_MOVE messages
 #
-@ MSG_MV_TITLE		"Move Section: %s\n\
-			 \toffset\tndx\tsize\trepeat\tstride\tvalue\twith \
-			 respect to"
-@ MSG_MV_ENTRY		"\t0x%llx\t0x%llx\t%d\t%d\t%d\t0x%llx\t%s"
-
+@ MSG_MOVE_TITLE	"    symndx offset   size repeat stride   \
+			 value               with respect to"
+@ MSG_MOVE_ENTRY	"%10.10s %6lld %6d %6d %6d %#18.18llx  %s"
 
 #
 # SHT_GROUP messages
 #
-@ MSG_GRP_NOTSYMTAB	"%s: %s: sh_link[%lld] does not point to .symtab\n"
-@ MSG_GRP_BADSYMNDX	"%s: %s: sh_info[%lld] has invalid symbol index\n"
-@ MSG_GRP_BADENTSZ	"%s: %s: has invalid sh_entsize: %lld\n"
-@ MSG_GRP_LINE1		"\nGroup Section: %s"
-@ MSG_GRP_LINE2		"\t[ndx]  Flags/Section		Signature Symbol"
-@ MSG_GRP_LINE3		"\t  [0]   %-24s %s"
+@ MSG_GRP_TITLE		"     index    flags / section         signature symbol"
+@ MSG_GRP_SIGNATURE	"       [0]   %-24s %s"
 @ MSG_GRP_INVALSCN	"<invalid section>"
 
 #
 # SHT_NOTE messages
 #
-@ MSG_NOTE_BADDATASIZE	"%s: %s: note header exceeds section size. \
+@ MSG_NOTE_BADDATASZ	"%s: %s: note header exceeds section size. \
 			 offset: 0x%x\n"
-@ MSG_NOTE_BADNMSIZE	"%s: %s: note name value exceeds section size. \
+@ MSG_NOTE_BADNMSZ	"%s: %s: note name value exceeds section size. \
 			 offset: 0x%x namesize: 0x%x\n"
-@ MSG_NOTE_BADDESIZE	"%s: %s: note data size exceeds section size. \
+@ MSG_NOTE_BADDESZ	"%s: %s: note data size exceeds section size. \
 			 offset: 0x%x datasize: 0x%x\n"
 
-
 @ _END_
 
 # The following strings represent reserved words, files, pathnames and symbols.
 # Reference to this strings is via the MSG_ORIG() macro, and thus no message
 # translation is required.
 
+@ MSG_STR_OSQBRKT	"["
+@ MSG_STR_CSQBRKT	"]"
 
-@ MSG_GRP_COMDAT	" COMDAT"
-@ MSG_GRP_FMT1		" 0x%x"
-@ MSG_GRP_FMT2		"%13.13s   %s[%d]\n"
-@ MSG_GRP_CLOSBRKT	" ]"
+@ MSG_GRP_COMDAT	" COMDAT "
+@ MSG_GRP_ENTRY		"%10.10s   %s [%lld]\n"
+@ MSG_GRP_UNKNOWN	" 0x%x "
 
 @ MSG_ELF_GOT		".got"
 
@@ -244,11 +221,10 @@
 @ MSG_STR_OPTIONS	"CcdeGgHhiklmN:nprsuvw:y"
 
 @ MSG_STR_EMPTY		""
-@ MSG_STR_NL		"\n"
 
 @ MSG_FMT_INDENT	"	%s"
 @ MSG_FMT_INDEX		" [%lld]"
-@ MSG_FMT_INDEX2	"[%lld]"
+@ MSG_FMT_INDEX2	"[%d]"
 @ MSG_FMT_INTEGER	" %d"
 @ MSG_FMT_HASH_INFO	"%10.10s  %-10s  %s"
 @ MSG_FMT_ARSYM1	"%10.10s  0x%8.8x  (%s):%s"
@@ -260,40 +236,42 @@
 @ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
 
 # Unwind info
+
 @ MSG_SCN_FRM		".eh_frame"
 @ MSG_SCN_FRMHDR	".eh_frame_hdr"
+
 @ MSG_UNW_FRMHDR	"Frame Header:"
 @ MSG_UNW_FRMVERS	"  Version: %d"
-@ MSG_UNW_FRPTRENC	"  FramePtrEnc: %-16s FramePtr: 0x%llx"
-@ MSG_UNW_FDCNENC	"  FdeCntEnc:   %-16s  FdeCnt: %lld"
-@ MSG_UNW_TABENC	"  TableEnc:    %-16s"
+@ MSG_UNW_FRPTRENC	"  FramePtrEnc: %-20s  FramePtr: 0x%llx"
+@ MSG_UNW_FDCNENC	"  FdeCntEnc:   %-20s  FdeCnt: %lld"
+@ MSG_UNW_TABENC	"  TableEnc:    %-20s"
 @ MSG_UNW_BINSRTAB1	"  Binary Search Table:"
-@ MSG_UNW_BINSRTAB2	"     InitialLoc         FdeLoc"
-@ MSG_UNW_BINSRTABENT	"    0x%012llx     0x%012llx"
+@ MSG_UNW_BINSRTAB2	"      InitialLoc          FdeLoc"
+@ MSG_UNW_BINSRTABENT	"    0x%016llx  0x%016llx"
 @ MSG_UNW_CIE		"CIE: [0x%08llx]"
 @ MSG_UNW_CIELNGTH	" length: 0x%02x cieid: %d"
 @ MSG_UNW_CIEVERS	" version: %d  augstring: `%s'"
 @ MSG_UNW_CIECALGN	" codealign: 0x%llx  dataalign: %lld  \
 			  retaddr: %d"
-@ MSG_UNW_CIEAUXVAL	" Auxillary vals:"
+@ MSG_UNW_CIEAUXVAL	" Auxiliary vals:"
 @ MSG_UNW_CIEAUXSIZE	"   size: %d"
 @ MSG_UNW_CIEAUXPERS	"   pers: 0x%02x %s 0x%08llx"
 @ MSG_UNW_CIEAUXCENC	"   cenc: 0x%02x %s"
 @ MSG_UNW_CIEAUXLSDA	"   lsda: 0x%02x %s"
 @ MSG_UNW_CIEAUXUNEC	"   Unexpected aug val: %c"
 @ MSG_UNW_CIECFI	" CallFrameInstructions:"
-@ MSG_UNW_CIECFI1	"\n    "
-@ MSG_UNW_CIECFI2	"0x%02x "
+@ MSG_UNW_CIEPRE	"   "
 
 @ MSG_UNW_FDE		" FDE: [0x%08llx]"
 @ MSG_UNW_FDELNGTH	"    length: 0x%02x  cieptr: 0x%02x"
 @ MSG_UNW_FDEINITLOC	"    initloc: 0x%08llx  addrrange: 0x%04llx"
-@ MSG_UNW_FDEAUXVAL	"   Auxillary vals:"
+@ MSG_UNW_FDEAUXVAL	"   Auxiliary vals:"
 @ MSG_UNW_FDEAUXSIZE	"      size: 0x%llx"
 @ MSG_UNW_FDEAUXLSDA	"    lsda: 0x%llx"
 @ MSG_UNW_FDECFI	"    CallFrameInstructions:"
-@ MSG_UNW_FDECFI1	"\n      "
-@ MSG_UNW_FDECFI2	"0x%02x "
+@ MSG_UNW_FDEPRE	"      "
+
+@ MSG_UNW_TBLENTRY	"0x%02x "
 
 # Note messages
 
--- a/usr/src/cmd/sgs/elfdump/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,25 +18,41 @@
  *
  * CDDL HEADER END
  */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
 
 /*
- * Copyright (c) 1998 by Sun Microsystems, Inc. 
- * All rights reserved. 
- */ 
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+/* LINTLIBRARY */
+/* PROTOLIB1 */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
- * Supplimental Pseudo-code to get lint to consider
- * these symbols used.
+ * Supplemental Pseudo-code to get lint to consider these symbols used.
  */
-
-#include "msg.h"
+#include	<sys/types.h>
+#include	<libelf.h>
+#include	<conv.h>
+#include	<msg.h>
+#include	<_elfdump.h>
 
 void
 foo()
 {
 	(void) _elfdump_msg((Msg)&__elfdump_msg[0]);
 }
+
+#if	defined(_ELF64)
+void
+regular32(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd)
+{
+	regular64(file, elf, flags, Nname, wfd);
+}
+#else
+void
+regular64(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd)
+{
+	regular32(file, elf, flags, Nname, wfd);
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/elfdump/common/main.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,441 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Dump an elf file.
+ */
+#include	<sys/param.h>
+#include	<fcntl.h>
+#include	<stdio.h>
+#include	<libelf.h>
+#include	<link.h>
+#include	<stdarg.h>
+#include	<unistd.h>
+#include	<libgen.h>
+#include	<libintl.h>
+#include	<locale.h>
+#include	<errno.h>
+#include	<strings.h>
+#include	<debug.h>
+#include	<conv.h>
+#include	<msg.h>
+#include	<_elfdump.h>
+
+const Cache	cache_init = {NULL, NULL, NULL};
+
+const char *
+_elfdump_msg(Msg mid)
+{
+	return (gettext(MSG_ORIG(mid)));
+}
+
+/*
+ * Determine whether a symbol name should be demangled.
+ */
+const char *
+demangle(const char *name, uint_t flags)
+{
+	if (flags & FLG_DEMANGLE)
+		return (Elf_demangle_name(name));
+	else
+		return ((char *)name);
+}
+
+/*
+ * Define our own standard error routine.
+ */
+void
+failure(const char *file, const char *func)
+{
+	(void) fprintf(stderr, MSG_INTL(MSG_ERR_FAILURE),
+	    file, func, elf_errmsg(elf_errno()));
+}
+
+/*
+ * The full usage message
+ */
+static void
+detail_usage()
+{
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL1));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL2));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL3));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL4));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL5));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL6));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL7));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL8));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9_1));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL10));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL11));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL12));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL13));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL14));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL15));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL16));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL17));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL18));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL19));
+	(void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL20));
+}
+
+static void
+decide(const char *file, Elf *elf, uint_t flags, char *Nname, int wfd)
+{
+	if (gelf_getclass(elf) == ELFCLASS64)
+		regular64(file, elf, flags, Nname, wfd);
+	else
+		regular32(file, elf, flags, Nname, wfd);
+}
+
+static void
+archive(const char *file, int fd, Elf *elf, uint_t flags, char *Nname,
+    int wfd)
+{
+	Elf_Cmd		cmd = ELF_C_READ;
+	Elf_Arhdr	*arhdr;
+	Elf		*_elf = 0;
+	size_t		ptr;
+	Elf_Arsym	*arsym = 0;
+
+	/*
+	 * Determine if the archive sysmbol table itself is required.
+	 */
+	if ((flags & FLG_SYMBOLS) && ((Nname == NULL) ||
+	    (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))) {
+		/*
+		 * Get the archive symbol table.
+		 */
+		if (((arsym = elf_getarsym(elf, &ptr)) == 0) && elf_errno()) {
+			/*
+			 * The arsym could be 0 even though there was no error.
+			 * Print the error message only when there was
+			 * real error from elf_getarsym().
+			 */
+			failure(file, MSG_ORIG(MSG_ELF_GETARSYM));
+			return;
+		}
+	}
+
+	/*
+	 * Print the archive symbol table only when the archive symbol
+	 * table exists and it was requested to print.
+	 */
+	if (arsym) {
+		size_t		cnt;
+		char		index[MAXNDXSIZE];
+		size_t		offset = 0, _offset = 0;
+
+		/*
+		 * Print out all the symbol entries.
+		 */
+		dbg_print(0, MSG_INTL(MSG_ARCHIVE_SYMTAB));
+		dbg_print(0, MSG_INTL(MSG_ARCHIVE_FIELDS));
+
+		for (cnt = 0; cnt < ptr; cnt++, arsym++) {
+			/*
+			 * For each object obtain an elf descriptor so that we
+			 * can establish the members name.  Note, we have had
+			 * archives where the archive header has not been
+			 * obtainable so be lenient with errors.
+			 */
+			if ((offset == 0) || ((arsym->as_off != 0) &&
+			    (arsym->as_off != _offset))) {
+
+				if (_elf)
+					(void) elf_end(_elf);
+
+				if (elf_rand(elf, arsym->as_off) !=
+				    arsym->as_off) {
+					failure(file, MSG_ORIG(MSG_ELF_RAND));
+					arhdr = 0;
+				} else if ((_elf = elf_begin(fd,
+				    ELF_C_READ, elf)) == 0) {
+					failure(file, MSG_ORIG(MSG_ELF_BEGIN));
+					arhdr = 0;
+				} else if ((arhdr = elf_getarhdr(_elf)) == 0) {
+					failure(file,
+					    MSG_ORIG(MSG_ELF_GETARHDR));
+					arhdr = 0;
+				}
+
+				_offset = arsym->as_off;
+				if (offset == 0)
+					offset = _offset;
+			}
+
+			(void) snprintf(index, MAXNDXSIZE,
+			    MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(cnt));
+			if (arsym->as_off)
+				dbg_print(0, MSG_ORIG(MSG_FMT_ARSYM1), index,
+				    /* LINTED */
+				    (int)arsym->as_off, arhdr ? arhdr->ar_name :
+				    MSG_INTL(MSG_STR_UNKNOWN), (arsym->as_name ?
+				    demangle(arsym->as_name, flags) :
+				    MSG_INTL(MSG_STR_NULL)));
+			else
+				dbg_print(0, MSG_ORIG(MSG_FMT_ARSYM2), index,
+				    /* LINTED */
+				    (int)arsym->as_off);
+		}
+
+		if (_elf)
+			(void) elf_end(_elf);
+
+		/*
+		 * If we only need the archive symbol table return.
+		 */
+		if ((flags & FLG_SYMBOLS) && Nname &&
+		    (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))
+			return;
+
+		/*
+		 * Reset elf descriptor in preparation for processing each
+		 * member.
+		 */
+		if (offset)
+			(void) elf_rand(elf, offset);
+	}
+
+	/*
+	 * Process each object within the archive.
+	 */
+	while ((_elf = elf_begin(fd, cmd, elf)) != NULL) {
+		char	name[MAXPATHLEN];
+
+		if ((arhdr = elf_getarhdr(_elf)) == NULL) {
+			failure(file, MSG_ORIG(MSG_ELF_GETARHDR));
+			return;
+		}
+		if (*arhdr->ar_name != '/') {
+			(void) snprintf(name, MAXPATHLEN,
+			    MSG_ORIG(MSG_FMT_ARNAME), file, arhdr->ar_name);
+			dbg_print(0, MSG_ORIG(MSG_FMT_NLSTR), name);
+
+			switch (elf_kind(_elf)) {
+			case ELF_K_AR:
+				archive(name, fd, _elf, flags, Nname, wfd);
+				break;
+			case ELF_K_ELF:
+				decide(name, _elf, flags, Nname, wfd);
+				break;
+			default:
+				(void) fprintf(stderr,
+				    MSG_INTL(MSG_ERR_BADFILE), name);
+				break;
+			}
+		}
+
+		cmd = elf_next(_elf);
+		(void) elf_end(_elf);
+	}
+}
+
+int
+main(int argc, char **argv, char **envp)
+{
+	Elf		*elf;
+	int		var, fd, wfd = 0;
+	char		*Nname = NULL, *wname = 0;
+	uint_t		flags = 0;
+
+	/*
+	 * If we're on a 64-bit kernel, try to exec a full 64-bit version of
+	 * the binary.  If successful, conv_check_native() won't return.
+	 */
+	conv_check_native(argv, envp);
+
+	/*
+	 * Establish locale.
+	 */
+	(void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY));
+	(void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS));
+
+	(void) setvbuf(stdout, NULL, _IOLBF, 0);
+	(void) setvbuf(stderr, NULL, _IOLBF, 0);
+
+	opterr = 0;
+	while ((var = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != EOF) {
+		switch (var) {
+		case 'C':
+			flags |= FLG_DEMANGLE;
+			break;
+		case 'c':
+			flags |= FLG_SHDR;
+			break;
+		case 'd':
+			flags |= FLG_DYNAMIC;
+			break;
+		case 'e':
+			flags |= FLG_EHDR;
+			break;
+		case 'G':
+			flags |= FLG_GOT;
+			break;
+		case 'g':
+			flags |= FLG_GROUP;
+			break;
+		case 'H':
+			flags |= FLG_CAP;
+			break;
+		case 'h':
+			flags |= FLG_HASH;
+			break;
+		case 'i':
+			flags |= FLG_INTERP;
+			break;
+		case 'k':
+			flags |= FLG_CHECKSUM;
+			break;
+		case 'l':
+			flags |= FLG_LONGNAME;
+			break;
+		case 'm':
+			flags |= FLG_MOVE;
+			break;
+		case 'N':
+			Nname = optarg;
+			break;
+		case 'n':
+			flags |= FLG_NOTE;
+			break;
+		case 'p':
+			flags |= FLG_PHDR;
+			break;
+		case 'r':
+			flags |= FLG_RELOC;
+			break;
+		case 's':
+			flags |= FLG_SYMBOLS;
+			break;
+		case 'u':
+			flags |= FLG_UNWIND;
+			break;
+		case 'v':
+			flags |= FLG_VERSIONS;
+			break;
+		case 'w':
+			wname = optarg;
+			break;
+		case 'y':
+			flags |= FLG_SYMINFO;
+			break;
+		case '?':
+			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
+			    basename(argv[0]));
+			detail_usage();
+			return (1);
+		default:
+			break;
+		}
+	}
+
+	/*
+	 * Validate any arguments.
+	 */
+	if ((flags & ~(FLG_DEMANGLE | FLG_LONGNAME)) == 0) {
+		if (!wname && !Nname) {
+			flags |= FLG_EVERYTHING;
+		} else if (!wname || !Nname) {
+			(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
+			    basename(argv[0]));
+			return (1);
+		}
+	}
+
+	if ((var = argc - optind) == 0) {
+		(void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
+		    basename(argv[0]));
+		return (1);
+	}
+
+	/*
+	 * If the -l/-C option is specified, set up the liblddbg.so.
+	 */
+	if (flags & FLG_LONGNAME)
+		dbg_desc->d_extra |= DBG_E_LONG;
+	if (flags & FLG_DEMANGLE)
+		dbg_desc->d_extra |= DBG_E_DEMANGLE;
+
+	/*
+	 * If the -w option has indicated an output file open it.  It's
+	 * arguable whether this option has much use when multiple files are
+	 * being processed.
+	 */
+	if (wname) {
+		if ((wfd = open(wname, (O_RDWR | O_CREAT | O_TRUNC),
+		    0666)) < 0) {
+			int err = errno;
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN),
+			    wname, strerror(err));
+			wfd = 0;
+		}
+	}
+
+	/*
+	 * Open the input file and initialize the elf interface.
+	 */
+	for (; optind < argc; optind++) {
+		const char	*file = argv[optind];
+
+		if ((fd = open(argv[optind], O_RDONLY)) == -1) {
+			int err = errno;
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN),
+			    file, strerror(err));
+			continue;
+		}
+		(void) elf_version(EV_CURRENT);
+		if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
+			failure(file, MSG_ORIG(MSG_ELF_BEGIN));
+			(void) close(fd);
+			continue;
+		}
+
+		if (var > 1)
+			dbg_print(0, MSG_ORIG(MSG_FMT_NLSTRNL), file);
+
+		switch (elf_kind(elf)) {
+		case ELF_K_AR:
+			archive(file, fd, elf, flags, Nname, wfd);
+			break;
+		case ELF_K_ELF:
+			decide(file, elf, flags, Nname, wfd);
+			break;
+		default:
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file);
+			break;
+		}
+
+		(void) close(fd);
+		(void) elf_end(elf);
+	}
+
+	if (wfd)
+		(void) close(wfd);
+	return (0);
+}
--- a/usr/src/cmd/sgs/elfdump/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -25,12 +19,18 @@
 # CDDL HEADER END
 #
 
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+
 # Specify what global symbols we export (none).  Note that we're not
 # interested in declaring a version, simply scoping the file is sufficient.
 
 {
 	global:
-		dbg_print;
 		main;			# debuggers seem to like this.
 	local:
 		*;
--- a/usr/src/cmd/sgs/elfdump/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright (c) 1994 by Sun Microsystems, Inc.
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include		../Makefile.com
--- a/usr/src/cmd/sgs/elfdump/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright (c) 1994 by Sun Microsystems, Inc.
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include		../Makefile.com
--- a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,9 +31,9 @@
 .KEEP_STATE:
 
 LLDFLAGS =	$(LLDFLAGS64)
-ELFLIBDIR=	$(ELFLIBDIR64)
-LDDBGLIBDIR=	$(LDDBGLIBDIR64)
-CONVLIBDIR=	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
 ROOTCCSBINPROG= $(ROOTCCSBINPROG64)
@@ -43,4 +43,3 @@
 
 install \
 package:	$(ROOTCCSBINPROG64)
-
--- a/usr/src/cmd/sgs/include/conv.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/conv.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #ifndef	_CONV_H
@@ -65,62 +64,170 @@
 #define	CONF_FEATMSK	0xffff00
 
 /*
- * Functions
+ * Various values that can't be matched to a symbolic definition are converted
+ * to a numeric string.  Each function that may require this fallback maintains
+ * its own static string buffer, as many conversion routines may be called for
+ * one final diagnostic.  See conv_invalid_val().
+ *
+ * The string size reflects the largest possible decimal number plus a trailing
+ * null.  Typically however, values are hex with a leading "0x".
+ */
+#if	defined(_ELF64)
+#define	CONV_INV_STRSIZE	22
+#else
+#define	CONV_INV_STRSIZE	12
+#endif
+
+/*
+ * Flags for conv_invalid_val().
+ */
+#define	CONV_INV_DECIMAL	0x1	/* print as decimal (default is hex) */
+#define	CONV_INV_SPACE		0x2	/* append a space */
+
+/*
+ * The expansion of bit-field data items is driven from a value descriptor and
+ * the conv_expn_field() routine.
+ */
+typedef struct {
+	Xword		v_val;		/* expansion value */
+	const char	*v_msg;		/* associated message string */
+} Val_desc;
+
+/*
+ * Define all generic interfaces.
  */
 extern	void		conv_check_native(char **, char **);
-extern	const char	*conv_binding_str(uint_t);
-extern	const char	*conv_bindent_str(uint_t);
-extern	const char	*conv_d_type_str(Elf_Type);
-extern	const char	*conv_deftag_str(Symref);
-extern	const char	*conv_dlflag_str(int, int);
-extern	const char	*conv_dlmode_str(int, int);
-extern	const char	*conv_dyntag_str(uint64_t, ushort_t);
-extern	const char	*conv_dynflag_str(uint_t);
-extern	const char	*conv_dynflag_1_str(uint_t);
-extern	const char	*conv_dynposflag_1_str(uint_t);
-extern	const char	*conv_dynfeature_1_str(uint_t);
-extern	const char	*conv_captag_str(uint64_t);
-extern	const char	*conv_capval_str(uint64_t, uint64_t, ushort_t);
-extern	const char	*conv_config_str(int);
+extern	const char	*conv_config_feat(int);
 extern	const char	*conv_config_obj(ushort_t);
-extern	const char	*conv_dwarf_ehe_str(uint_t);
-extern	const char	*conv_eclass_str(uchar_t);
-extern	const char	*conv_edata_str(uchar_t);
-extern	const char	*conv_emach_str(ushort_t);
-extern	const char	*conv_ever_str(uint_t);
-extern	const char	*conv_etype_str(ushort_t);
-extern	const char	*conv_eflags_str(ushort_t, uint_t);
-extern	const char	*conv_hwcap_1_str(uint64_t, ushort_t);
-extern	const char	*conv_hwcap_1_386_str(uint64_t);
-extern	const char	*conv_hwcap_1_SPARC_str(uint64_t);
-extern	const char	*conv_sfcap_1_str(uint64_t, ushort_t);
-extern	const char	*conv_grphdrflags_str(uint_t);
-extern	const char	*conv_info_bind_str(uchar_t);
-extern	const char	*conv_info_type_str(ushort_t, uchar_t);
-extern	const char	*conv_invalid_str(char *, size_t, uint64_t, int);
+extern	const char	*conv_config_upm(const char *, const char *,
+			    const char *, size_t);
+extern	const char	*conv_def_tag(Symref);
+extern	const char	*conv_demangle_name(const char *);
+extern	const char	*conv_dl_flag(int, int);
+extern	const char	*conv_dl_mode(int, int);
+extern	const char	*conv_dwarf_ehe(uint_t);
+extern	const char	*conv_elfdata_type(Elf_Type);
+extern	const char	*conv_grphdl_flags(uint_t);
 extern	Isa_desc	*conv_isalist(void);
 extern	const char	*conv_lddstub(int);
-extern	const char	*conv_phdrflg_str(uint_t);
-extern	const char	*conv_phdrtyp_str(ushort_t, uint_t);
-extern	const char	*conv_reloc_type_str(ushort_t, uint_t);
-extern	const char	*conv_reloc_SPARC_type_str(uint_t);
-extern	const char	*conv_reloc_386_type_str(uint_t);
-extern	const char	*conv_reloc_amd64_type_str(uint_t);
-extern	const char	*conv_reject_str(Rej_desc *);
-extern	const char	*conv_sym_dem(const char *);
-extern	const char	*conv_sym_value_str(ushort_t, uint_t, uint64_t);
-extern	const char	*conv_sym_SPARC_value_str(uint64_t);
-extern	const char	*conv_sym_stother(uchar_t);
-extern	const char	*conv_secflg_str(ushort_t, uint_t);
-extern	const char	*conv_secinfo_str(uint_t, uint_t);
-extern	const char	*conv_sectyp_str(ushort_t, uint_t);
-extern	const char	*conv_segaflg_str(uint_t);
-extern	const char	*conv_shndx_str(ushort_t);
+extern	const char	*conv_seg_flags(Half);
 extern	int		conv_sys_eclass();
-extern	const char	*conv_upm_string(const char *, const char *,
-			    const char *, size_t);
 extern	Uts_desc	*conv_uts(void);
-extern	const char	*conv_verflg_str(ushort_t);
+extern	const char	*conv_ver_flags(Half);
+
+/*
+ * Define all class specific routines.
+ */
+#if	defined(_ELF64)
+#define	conv_bnd_obj		conv64_bnd_obj
+#define	conv_bnd_type		conv64_bnd_type
+#define	conv_cap_tag		conv64_cap_tag
+#define	conv_cap_val		conv64_cap_val
+#define	conv_cap_val_hw1	conv64_cap_val_hw1
+#define	conv_cap_val_sf1	conv64_cap_val_sf1
+#define	conv_dyn_feature1	conv64_dyn_feature1
+#define	conv_dyn_flag1		conv64_dyn_flag1
+#define	conv_dyn_flag		conv64_dyn_flag
+#define	conv_dyn_posflag1	conv64_dyn_posflag1
+#define	conv_dyn_tag		conv64_dyn_tag
+#define	conv_ehdr_class		conv64_ehdr_class
+#define	conv_ehdr_data		conv64_ehdr_data
+#define	conv_ehdr_flags		conv64_ehdr_flags
+#define	conv_ehdr_mach		conv64_ehdr_mach
+#define	conv_ehdr_type		conv64_ehdr_type
+#define	conv_ehdr_vers		conv64_ehdr_vers
+#define	conv_expn_field		conv64_expn_field
+#define	conv_invalid_val	conv64_invalid_val
+#define	conv_phdr_flags		conv64_phdr_flags
+#define	conv_phdr_type		conv64_phdr_type
+#define	conv_reject_desc	conv64_reject_desc
+#define	conv_reloc_type		conv64_reloc_type
+#define	conv_reloc_386_type	conv64_reloc_386_type
+#define	conv_reloc_amd64_type	conv64_reloc_amd64_type
+#define	conv_reloc_SPARC_type	conv64_reloc_SPARC_type
+#define	conv_sec_flags		conv64_sec_flags
+#define	conv_sec_info		conv64_sec_info
+#define	conv_sec_type		conv64_sec_type
+#define	conv_sym_info_bind	conv64_sym_info_bind
+#define	conv_sym_info_type	conv64_sym_info_type
+#define	conv_sym_shndx		conv64_sym_shndx
+#define	conv_sym_other		conv64_sym_other
+#define	conv_sym_value		conv64_sym_value
+#define	conv_sym_SPARC_value	conv64_sym_SPARC_value
+#else
+#define	conv_bnd_obj		conv32_bnd_obj
+#define	conv_bnd_type		conv32_bnd_type
+#define	conv_cap_tag		conv32_cap_tag
+#define	conv_cap_val		conv32_cap_val
+#define	conv_cap_val_hw1	conv32_cap_val_hw1
+#define	conv_cap_val_sf1	conv32_cap_val_sf1
+#define	conv_dyn_feature1	conv32_dyn_feature1
+#define	conv_dyn_flag1		conv32_dyn_flag1
+#define	conv_dyn_flag		conv32_dyn_flag
+#define	conv_dyn_posflag1	conv32_dyn_posflag1
+#define	conv_dyn_tag		conv32_dyn_tag
+#define	conv_ehdr_class		conv32_ehdr_class
+#define	conv_ehdr_data		conv32_ehdr_data
+#define	conv_ehdr_flags		conv32_ehdr_flags
+#define	conv_ehdr_mach		conv32_ehdr_mach
+#define	conv_ehdr_type		conv32_ehdr_type
+#define	conv_ehdr_vers		conv32_ehdr_vers
+#define	conv_expn_field		conv32_expn_field
+#define	conv_invalid_val	conv32_invalid_val
+#define	conv_phdr_flags		conv32_phdr_flags
+#define	conv_phdr_type		conv32_phdr_type
+#define	conv_reject_desc	conv32_reject_desc
+#define	conv_reloc_type		conv32_reloc_type
+#define	conv_reloc_386_type	conv32_reloc_386_type
+#define	conv_reloc_amd64_type	conv32_reloc_amd64_type
+#define	conv_reloc_SPARC_type	conv32_reloc_SPARC_type
+#define	conv_sec_flags		conv32_sec_flags
+#define	conv_sec_info		conv32_sec_info
+#define	conv_sec_type		conv32_sec_type
+#define	conv_sym_info_bind	conv32_sym_info_bind
+#define	conv_sym_info_type	conv32_sym_info_type
+#define	conv_sym_shndx		conv32_sym_shndx
+#define	conv_sym_other		conv32_sym_other
+#define	conv_sym_value		conv32_sym_value
+#define	conv_sym_SPARC_value	conv32_sym_SPARC_value
+#endif
+
+extern	const char	*conv_bnd_obj(uint_t);
+extern	const char	*conv_bnd_type(uint_t);
+extern	const char	*conv_cap_tag(Xword);
+extern	const char	*conv_cap_val(Xword, Xword, Half);
+extern	const char	*conv_cap_val_hw1(Xword, Half);
+extern	const char	*conv_cap_val_sf1(Xword, Half);
+extern	const char	*conv_dyn_flag1(Xword);
+extern	const char	*conv_dyn_flag(Xword);
+extern	const char	*conv_dyn_posflag1(Xword);
+extern	const char	*conv_dyn_tag(Xword, Half);
+extern	const char	*conv_dyn_feature1(Xword);
+extern	const char	*conv_ehdr_class(uchar_t);
+extern	const char	*conv_ehdr_data(uchar_t);
+extern	const char	*conv_ehdr_flags(Half, Word);
+extern	const char	*conv_ehdr_mach(Half);
+extern	const char	*conv_ehdr_type(Half);
+extern	const char	*conv_ehdr_vers(Word);
+extern	int		conv_expn_field(char *, size_t, const Val_desc *,
+			    Xword, Xword, const char *, int);
+extern	const char	*conv_invalid_val(char *, size_t, Xword, int);
+extern	const char	*conv_phdr_flags(Word);
+extern	const char	*conv_phdr_type(Half, Word);
+extern	const char	*conv_reject_desc(Rej_desc *);
+extern	const char	*conv_reloc_type(Half, Word);
+extern	const char	*conv_reloc_386_type(Word);
+extern	const char	*conv_reloc_amd64_type(Word);
+extern	const char	*conv_reloc_SPARC_type(Word);
+extern	const char	*conv_sec_flags(Xword);
+extern	const char	*conv_sec_info(Word, Xword);
+extern	const char	*conv_sec_type(Half, Word);
+extern	const char	*conv_sym_info_bind(uchar_t);
+extern	const char	*conv_sym_info_type(Half, uchar_t);
+extern	const char	*conv_sym_shndx(Half);
+extern	const char	*conv_sym_other(uchar_t);
+extern	const char	*conv_sym_value(Half, uchar_t, Addr);
+extern	const char	*conv_sym_SPARC_value(Addr);
 
 #ifdef	__cplusplus
 }
--- a/usr/src/cmd/sgs/include/debug.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/debug.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -31,11 +30,11 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
- * Global include file for linker debugging.
+ * Global include file for lddbg debugging.
  *
- * ld(1) and ld.so carry out all diagnostic debugging calls via dlopen'ing
- * the library liblddbg.so.  Thus debugging is always enabled.  The utility
- * elfdump() is explicitly dependent upon this library.  There are two
+ * ld(1) and ld.so.1(1) carry out all diagnostic debugging calls via lazy
+ * loading the library liblddbg.so.  Thus debugging is always enabled.  The
+ * utility elfdump(1) is explicitly dependent upon this library.  There are two
  * categories of routines defined in this library:
  *
  *  o	Debugging routines that have specific linker knowledge, and test the
@@ -44,14 +43,11 @@
  *
  *  o	Lower level routines that provide generic ELF structure interpretation
  *	start with the `Elf_' prefix.  These latter routines are the only
- *	routines used by the elfdump() utility.
+ *	routines used by the elfdump(1) utility.
  */
-
-#include <libelf.h>
 #include <sgs.h>
 #include <libld.h>
 #include <rtld.h>
-#include <machdep.h>
 #include <gelf.h>
 
 #ifdef	__cplusplus
@@ -59,7 +55,7 @@
 #endif
 
 /*
- * Define any interface flags.  These flags direct the debugging routine to
+ * Define Dbg_*() interface flags.  These flags direct the debugging routine to
  * generate different diagnostics, thus the strings themselves are maintained
  * in this library.
  */
@@ -127,414 +123,811 @@
 #define	DBG_REL_FINISH		2
 #define	DBG_REL_NONE		3
 
-/*
- * Define our setup entry point.
- */
-extern	uint_t		Dbg_setup(const char *);
-extern	void		Dbg_set(uint_t);
+#define	DBG_NL_STD		0	/* newline controllers - standard and */
+#define	DBG_NL_FRC		2	/*    forced. */
 
 /*
- * Define a user macro to invoke debugging.  The `dbg_mask' variable acts as a
- * suitable flag, and can be set to collect the return value from Dbg_setup().
+ * Define a debug descriptor, and a user macro that inspects the descriptor as
+ * a means of triggering a class of diagnostic output.
  */
-extern	uint_t		dbg_mask;
+typedef struct {
+	uint_t		d_class;	/* debugging classes */
+	uint_t		d_extra;	/* extra information for classes */
+	Alist		*d_list;	/* associated strings */
+} Dbg_desc;
 
-#define	DBG_CALL(func)	if (dbg_mask) func
+extern	Dbg_desc	*dbg_desc;
+
+#define	DBG_ENABLED	(dbg_desc->d_class)
+#define	DBG_CALL(func)	if (DBG_ENABLED) func
 
 /*
  * Most debugging tokens are interpreted within liblddbg, and thus any flags
- * within dbg_mask are only meaningful to this library.  The following flags
- * may be set by the Dbg_setup() by can be interpreted by the caller.
+ * within d_class are only meaningful to this library.  The following flags
+ * extend the d_class diagnostic, and are maintained in d_extra.  These flags
+ * may be interpreted by the debugging library itself or from the callers
+ * dbg_print() routine.
  */
-#define	DBG_G_SNAME	0x10000000	/* prepend simple name */
-#define	DBG_G_FNAME	0x20000000	/* prepend full name */
-#define	DBG_G_CLASS	0x40000000	/* prepend ELF class */
+#define	DBG_E_DETAIL	0x0001		/* add detail to a class */
+#define	DBG_E_LONG	0x0002		/* use long names (ie. no truncation) */
+
+#define	DBG_E_STDNL	0x0010		/* standard newline indicator */
+
+#define	DBG_E_SNAME	0x0100		/* prepend simple name (ld only) */
+#define	DBG_E_FNAME	0x0200		/* prepend full name (ld only) */
+#define	DBG_E_CLASS	0x0400		/* prepend ELF class (ld only) */
+#define	DBG_E_LMID	0x0800		/* prepend link-map id (ld.so.1 only) */
+#define	DBG_E_DEMANGLE	0x1000		/* demangle symbol names */
+
+#define	DBG_NOTDETAIL()	!(dbg_desc->d_extra & DBG_E_DETAIL)
+#define	DBG_NOTLONG()	!(dbg_desc->d_extra & DBG_E_LONG)
+
+#define	DBG_ISSNAME()	(dbg_desc->d_extra & DBG_E_SNAME)
+#define	DBG_ISFNAME()	(dbg_desc->d_extra & DBG_E_FNAME)
+#define	DBG_ISCLASS()	(dbg_desc->d_extra & DBG_E_CLASS)
+#define	DBG_ISLMID()	(dbg_desc->d_extra & DBG_E_LMID)
+#define	DBG_ISDEMANGLE() \
+			(dbg_desc->d_extra & DBG_E_DEMANGLE)
 
 /*
- * Print routine, this must be supplied by the application.
+ * Print routine, this must be supplied by the application.  The initial
+ * argument may provide a link-map list to associate with the format statement
+ * that follows.
  */
-/*PRINTFLIKE1*/
-extern	void		dbg_print(const char *, ...);
+/* PRINTFLIKE2 */
+extern	void		dbg_print(Lm_list *, const char *, ...);
 
+extern	uintptr_t	Dbg_setup(const char *, Dbg_desc *);
 
 /*
- * External interface routines.  These are linker specific.
+ * Establish ELF32 and ELF64 class Dbg_*() interfaces.
  */
-#ifdef _ELF64
-#define	Dbg_cap_hw_1		Dbg_cap_hw_164
-#define	Dbg_cap_mapfile		Dbg_cap_mapfile64
-#define	Dbg_cap_sec_entry	Dbg_cap_sec_entry64
-#define	Dbg_file_analyze	Dbg_file_analyze64
-#define	Dbg_file_aout		Dbg_file_aout64
-#define	Dbg_file_archive	Dbg_file_archive64
-#define	Dbg_file_bind_entry	Dbg_file_bind_entry64
-#define	Dbg_file_bindings	Dbg_file_bindings64
-#define	Dbg_file_config_dis	Dbg_file_config_dis64
-#define	Dbg_file_config_obj	Dbg_file_config_obj64
-#define	Dbg_file_delete		Dbg_file_delete64
-#define	Dbg_file_dlclose	Dbg_file_dlclose64
-#define	Dbg_file_dldump		Dbg_file_dldump64
-#define	Dbg_file_dlopen		Dbg_file_dlopen64
-#define	Dbg_file_elf		Dbg_file_elf64
-#define	Dbg_file_filtee		Dbg_file_filtee64
-#define	Dbg_file_filter		Dbg_file_filter64
-#define	Dbg_file_fixname	Dbg_file_fixname64
-#define	Dbg_file_generic	Dbg_file_generic64
-#define	Dbg_file_hdl_action	Dbg_file_hdl_action64
-#define	Dbg_file_hdl_collect	Dbg_file_hdl_collect64
-#define	Dbg_file_hdl_title	Dbg_file_hdl_title64
-#define	Dbg_file_ldso		Dbg_file_ldso64
-#define	Dbg_file_lazyload	Dbg_file_lazyload64
-#define	Dbg_file_needed		Dbg_file_needed64
-#define	Dbg_file_nl		Dbg_file_nl64
-#define	Dbg_file_output		Dbg_file_output64
-#define	Dbg_file_preload	Dbg_file_preload64
-#define	Dbg_file_prot		Dbg_file_prot64
-#define	Dbg_file_reuse		Dbg_file_reuse64
-#define	Dbg_file_skip		Dbg_file_skip64
-#define	Dbg_got_display		Dbg_got_display64
-#define	Dbg_map_atsign		Dbg_map_atsign64
-#define	Dbg_map_cap		Dbg_map_cap64
-#define	Dbg_map_dash		Dbg_map_dash64
-#define	Dbg_map_ent		Dbg_map_ent64
-#define	Dbg_map_equal		Dbg_map_equal64
-#define	Dbg_map_parse		Dbg_map_parse64
-#define	Dbg_map_pipe		Dbg_map_pipe64
-#define	Dbg_map_seg		Dbg_map_seg64
-#define	Dbg_map_size_new	Dbg_map_size_new64
-#define	Dbg_map_size_old	Dbg_map_size_old64
-#define	Dbg_map_sort_fini	Dbg_map_sort_fini64
-#define	Dbg_map_sort_orig	Dbg_map_sort_orig64
-#define	Dbg_map_symbol		Dbg_map_symbol64
-#define	Dbg_map_version		Dbg_map_version64
-#define	Dbg_move_mventry	Dbg_move_mventry64
-#define	Dbg_move_mventry2	Dbg_move_mventry264
-#define	Dbg_move_outsctadj	Dbg_move_outsctadj64
-#define	Dbg_reloc_discard	Dbg_reloc_discard64
-#define	Dbg_reloc_error		Dbg_reloc_error64
-#define	Dbg_reloc_generate	Dbg_reloc_generate64
-#define	Dbg_reloc_in		Dbg_reloc_in64
-#define	Dbg_reloc_out		Dbg_reloc_out64
-#define	Dbg_reloc_proc		Dbg_reloc_proc64
-#define	Dbg_reloc_ars_entry	Dbg_reloc_ars_entry64
-#define	Dbg_reloc_ors_entry	Dbg_reloc_ors_entry64
-#define	Dbg_reloc_doact		Dbg_reloc_doact64
-#define	Dbg_reloc_dooutrel	Dbg_reloc_dooutrel64
-#define	Dbg_reloc_reg_apply	Dbg_reloc_reg_apply64
-#define	Dbg_reloc_transition	Dbg_reloc_transition64
-#define	Dbg_sec_added		Dbg_sec_added64
-#define	Dbg_sec_created		Dbg_sec_created64
-#define	Dbg_sec_discarded	Dbg_sec_discarded64
-#define	Dbg_sec_group		Dbg_sec_group64
-#define	Dbg_sec_in		Dbg_sec_in64
-#define	Dbg_sec_order_list	Dbg_sec_order_list64
-#define	Dbg_sec_order_error	Dbg_sec_order_error64
-#define	Dbg_sec_strtab		Dbg_sec_strtab64
-#define	Dbg_seg_entry		Dbg_seg_entry64
-#define	Dbg_seg_list		Dbg_seg_list64
-#define	Dbg_seg_os		Dbg_seg_os64
-#define	Dbg_seg_title		Dbg_seg_title64
-#define	Dbg_statistics_ar	Dbg_statistics_ar64
-#define	Dbg_statistics_ld	Dbg_statistics_ld64
-#define	Dbg_syminfo_entry	Dbg_syminfo_entry64
-#define	Dbg_syminfo_entry_title	Dbg_syminfo_entry_title64
-#define	Dbg_syminfo_title	Dbg_syminfo_title64
-#define	Dbg_syms_ar_checking	Dbg_syms_ar_checking64
-#define	Dbg_syms_ar_entry	Dbg_syms_ar_entry64
-#define	Dbg_syms_ar_resolve	Dbg_syms_ar_resolve64
-#define	Dbg_syms_created	Dbg_syms_created64
-#define	Dbg_syms_discarded	Dbg_syms_discarded64
-#define	Dbg_syms_entered	Dbg_syms_entered64
-#define	Dbg_syms_entry		Dbg_syms_entry64
-#define	Dbg_syms_global		Dbg_syms_global64
-#define	Dbg_syms_ignore		Dbg_syms_ignore64
-#define	Dbg_syms_new		Dbg_syms_new64
-#define	Dbg_syms_nl		Dbg_syms_nl64
-#define	Dbg_syms_old		Dbg_syms_old64
-#define	Dbg_syms_process	Dbg_syms_process64
-#define	Dbg_syms_reduce		Dbg_syms_reduce64
-#define	Dbg_syms_reloc		Dbg_syms_reloc64
-#define	Dbg_syms_resolved	Dbg_syms_resolved64
-#define	Dbg_syms_resolving1	Dbg_syms_resolving164
-#define	Dbg_syms_resolving2	Dbg_syms_resolving264
-#define	Dbg_syms_sec_entry	Dbg_syms_sec_entry64
-#define	Dbg_syms_sec_title	Dbg_syms_sec_title64
-#define	Dbg_syms_spec_title	Dbg_syms_spec_title64
-#define	Dbg_syms_up_title	Dbg_syms_up_title64
-#define	Dbg_syms_updated	Dbg_syms_updated64
-#define	Dbg_syms_dlsym		Dbg_syms_dlsym64
-#define	Dbg_syms_lookup_aout	Dbg_syms_lookup_aout64
-#define	Dbg_syms_lookup		Dbg_syms_lookup64
-#define	Dbg_tls_modactivity	Dbg_tls_modactivity64
-#define	Dbg_tls_static_block	Dbg_tls_static_block64
-#define	Dbg_unused_sec		Dbg_unused_sec64
-#define	Dbg_audit_interface	Dbg_audit_interface64
-#define	Dbg_audit_lib		Dbg_audit_lib64
-#define	Dbg_audit_object	Dbg_audit_object64
-#define	Dbg_audit_symval	Dbg_audit_symval64
-#define	Dbg_audit_version	Dbg_audit_version64
-#define	Dbg_ver_avail_entry	Dbg_ver_avail_entry64
-#define	Dbg_ver_desc_entry	Dbg_ver_desc_entry64
-#endif	/* _ELF64 */
+#if	defined(_ELF64)
+
+#define	Dbg_demangle_name	Dbg64_demangle_name
+
+#define	Dbg_bind_global		Dbg64_bind_global
+#define	Dbg_bind_plt_summary	Dbg64_bind_plt_summary
+#define	Dbg_bind_pltpad_from	Dbg64_bind_pltpad_from
+#define	Dbg_bind_pltpad_to	Dbg64_bind_pltpad_to
+#define	Dbg_bind_weak		Dbg64_bind_weak
+
+#define	Dbg_cap_val_hw1		Dbg64_cap_val_hw1
+#define	Dbg_cap_hw_candidate	Dbg64_cap_hw_candidate
+#define	Dbg_cap_hw_filter	Dbg64_cap_hw_filter
+#define	Dbg_cap_mapfile		Dbg64_cap_mapfile
+#define	Dbg_cap_sec_entry	Dbg64_cap_sec_entry
+#define	Dbg_cap_sec_title	Dbg64_cap_sec_title
+
+#define	Dbg_ent_entry		Dbg64_ent_entry
+#define	Dbg_ent_print		Dbg64_ent_print
+
+#define	Dbg_file_analyze	Dbg64_file_analyze
+#define	Dbg_file_aout		Dbg64_file_aout
+#define	Dbg_file_ar		Dbg64_file_ar
+#define	Dbg_file_ar_rescan	Dbg64_file_ar_rescan
+#define	Dbg_file_bind_entry	Dbg64_file_bind_entry
+#define	Dbg_file_bindings	Dbg64_file_bindings
+#define	Dbg_file_cntl		Dbg64_file_cntl
+#define	Dbg_file_config_dis	Dbg64_file_config_dis
+#define	Dbg_file_config_obj	Dbg64_file_config_obj
+#define	Dbg_file_del_rescan	Dbg64_file_del_rescan
+#define	Dbg_file_delete		Dbg64_file_delete
+#define	Dbg_file_dlclose	Dbg64_file_dlclose
+#define	Dbg_file_dldump		Dbg64_file_dldump
+#define	Dbg_file_dlopen		Dbg64_file_dlopen
+#define	Dbg_file_elf		Dbg64_file_elf
+#define	Dbg_file_filtee		Dbg64_file_filtee
+#define	Dbg_file_filter		Dbg64_file_filter
+#define	Dbg_file_fixname	Dbg64_file_fixname
+#define	Dbg_file_generic	Dbg64_file_generic
+#define	Dbg_file_hdl_action	Dbg64_file_hdl_action
+#define	Dbg_file_hdl_collect	Dbg64_file_hdl_collect
+#define	Dbg_file_hdl_title	Dbg64_file_hdl_title
+#define	Dbg_file_lazyload	Dbg64_file_lazyload
+#define	Dbg_file_ldso		Dbg64_file_ldso
+#define	Dbg_file_mode_promote	Dbg64_file_mode_promote
+#define	Dbg_file_needed		Dbg64_file_needed
+#define	Dbg_file_output		Dbg64_file_output
+#define	Dbg_file_preload	Dbg64_file_preload
+#define	Dbg_file_prot		Dbg64_file_prot
+#define	Dbg_file_rejected	Dbg64_file_rejected
+#define	Dbg_file_reuse		Dbg64_file_reuse
+#define	Dbg_file_skip		Dbg64_file_skip
+
+#define	Dbg_got_display		Dbg64_got_display
+
+#define	Dbg_libs_audit		Dbg64_libs_audit
+#define	Dbg_libs_find		Dbg64_libs_find
+#define	Dbg_libs_found		Dbg64_libs_found
+#define	Dbg_libs_ignore		Dbg64_libs_ignore
+#define	Dbg_libs_init		Dbg64_libs_init
+#define	Dbg_libs_l		Dbg64_libs_l
+#define	Dbg_libs_path		Dbg64_libs_path
+#define	Dbg_libs_req		Dbg64_libs_req
+#define	Dbg_libs_update		Dbg64_libs_update
+#define	Dbg_libs_yp		Dbg64_libs_yp
+#define	Dbg_libs_ylu		Dbg64_libs_ylu
+
+#define	Dbg_map_dash		Dbg64_map_dash
+#define	Dbg_map_ent		Dbg64_map_ent
+#define	Dbg_map_parse		Dbg64_map_parse
+#define	Dbg_map_pipe		Dbg64_map_pipe
+#define	Dbg_map_seg		Dbg64_map_seg
+#define	Dbg_map_set_atsign	Dbg64_map_set_atsign
+#define	Dbg_map_set_equal	Dbg64_map_set_equal
+#define	Dbg_map_size_new	Dbg64_map_size_new
+#define	Dbg_map_size_old	Dbg64_map_size_old
+#define	Dbg_map_sort_fini	Dbg64_map_sort_fini
+#define	Dbg_map_sort_orig	Dbg64_map_sort_orig
+#define	Dbg_map_symbol		Dbg64_map_symbol
+#define	Dbg_map_version		Dbg64_map_version
+
+#define	Dbg_move_adjexpandreloc	Dbg64_move_adjexpandreloc
+#define	Dbg_move_adjmovereloc	Dbg64_move_adjmovereloc
+#define	Dbg_move_data		Dbg64_move_data
+#define	Dbg_move_entry1		Dbg64_move_entry1
+#define	Dbg_move_entry2		Dbg64_move_entry2
+#define	Dbg_move_expand		Dbg64_move_expand
+#define	Dbg_move_input		Dbg64_move_input
+#define	Dbg_move_outmove	Dbg64_move_outmove
+#define	Dbg_move_outsctadj	Dbg64_move_outsctadj
+#define	Dbg_move_parexpn	Dbg64_move_parexpn
+
+#define	Dbg_reloc_apply_reg	Dbg64_reloc_apply_reg
+#define	Dbg_reloc_apply_val	Dbg64_reloc_apply_val
+#define	Dbg_reloc_ars_entry	Dbg64_reloc_ars_entry
+#define	Dbg_reloc_copy		Dbg64_reloc_copy
+#define	Dbg_reloc_discard	Dbg64_reloc_discard
+#define	Dbg_reloc_doact		Dbg64_reloc_doact
+#define	Dbg_reloc_doact_title	Dbg64_reloc_doact_title
+#define	Dbg_reloc_dooutrel	Dbg64_reloc_dooutrel
+#define	Dbg_reloc_entry		Dbg64_reloc_entry
+#define	Dbg_reloc_error		Dbg64_reloc_error
+#define	Dbg_reloc_generate	Dbg64_reloc_generate
+#define	Dbg_reloc_in		Dbg64_reloc_in
+#define	Dbg_reloc_ors_entry	Dbg64_reloc_ors_entry
+#define	Dbg_reloc_out		Dbg64_reloc_out
+#define	Dbg_reloc_proc		Dbg64_reloc_proc
+#define	Dbg_reloc_run		Dbg64_reloc_run
+#define	Dbg_reloc_transition	Dbg64_reloc_transition
+
+#define	Dbg_sec_added		Dbg64_sec_added
+#define	Dbg_sec_created		Dbg64_sec_created
+#define	Dbg_sec_discarded	Dbg64_sec_discarded
+#define	Dbg_sec_group		Dbg64_sec_group
+#define	Dbg_sec_in		Dbg64_sec_in
+#define	Dbg_sec_order_error	Dbg64_sec_order_error
+#define	Dbg_sec_order_list	Dbg64_sec_order_list
+#define	Dbg_sec_strtab		Dbg64_sec_strtab
+
+#define	Dbg_seg_desc_entry	Dbg64_seg_desc_entry
+#define	Dbg_seg_entry		Dbg64_seg_entry
+#define	Dbg_seg_list		Dbg64_seg_list
+#define	Dbg_seg_os		Dbg64_seg_os
+#define	Dbg_seg_title		Dbg64_seg_title
+
+#define	Dbg_statistics_ar	Dbg64_statistics_ar
+#define	Dbg_statistics_ld	Dbg64_statistics_ld
+
+#define	Dbg_support_action	Dbg64_support_action
+#define	Dbg_support_load	Dbg64_support_load
+#define	Dbg_support_req		Dbg64_support_req
+
+#define	Dbg_syminfo_entry	Dbg64_syminfo_entry
+#define	Dbg_syminfo_title	Dbg64_syminfo_title
+
+#define	Dbg_syms_ar_checking	Dbg64_syms_ar_checking
+#define	Dbg_syms_ar_entry	Dbg64_syms_ar_entry
+#define	Dbg_syms_ar_resolve	Dbg64_syms_ar_resolve
+#define	Dbg_syms_ar_title	Dbg64_syms_ar_title
+#define	Dbg_syms_created	Dbg64_syms_created
+#define	Dbg_syms_discarded	Dbg64_syms_discarded
+#define	Dbg_syms_dlsym		Dbg64_syms_dlsym
+#define	Dbg_syms_entered	Dbg64_syms_entered
+#define	Dbg_syms_entry		Dbg64_syms_entry
+#define	Dbg_syms_global		Dbg64_syms_global
+#define	Dbg_syms_ignore		Dbg64_syms_ignore
+#define	Dbg_syms_lazy_rescan	Dbg64_syms_lazy_rescan
+#define	Dbg_syms_lookup		Dbg64_syms_lookup
+#define	Dbg_syms_new		Dbg64_syms_new
+#define	Dbg_syms_old		Dbg64_syms_old
+#define	Dbg_syms_process	Dbg64_syms_process
+#define	Dbg_syms_reduce		Dbg64_syms_reduce
+#define	Dbg_syms_reloc		Dbg64_syms_reloc
+#define	Dbg_syms_resolved	Dbg64_syms_resolved
+#define	Dbg_syms_resolving	Dbg64_syms_resolving
+#define	Dbg_syms_sec_entry	Dbg64_syms_sec_entry
+#define	Dbg_syms_sec_title	Dbg64_syms_sec_title
+#define	Dbg_syms_spec_title	Dbg64_syms_spec_title
+#define	Dbg_syms_updated	Dbg64_syms_updated
+#define	Dbg_syms_up_title	Dbg64_syms_up_title
+
+#define	Dbg_util_broadcast	Dbg64_util_broadcast
+#define	Dbg_util_call_array	Dbg64_util_call_array
+#define	Dbg_util_call_fini	Dbg64_util_call_fini
+#define	Dbg_util_call_init	Dbg64_util_call_init
+#define	Dbg_util_call_main	Dbg64_util_call_main
+#define	Dbg_util_collect	Dbg64_util_collect
+#define	Dbg_util_dbnotify	Dbg64_util_dbnotify
+#define	Dbg_util_edge_in	Dbg64_util_edge_in
+#define	Dbg_util_edge_out	Dbg64_util_edge_out
+#define	Dbg_util_intoolate	Dbg64_util_intoolate
+#define	Dbg_util_nl		Dbg64_util_nl
+#define	Dbg_util_no_init	Dbg64_util_no_init
+#define	Dbg_util_scc_entry	Dbg64_util_scc_entry
+#define	Dbg_util_scc_title	Dbg64_util_scc_title
+#define	Dbg_util_str		Dbg64_util_str
+#define	Dbg_util_wait		Dbg64_util_wait
+
+#define	Dbg_unused_file		Dbg64_unused_file
+#define	Dbg_unused_rtldinfo	Dbg64_unused_rtldinfo
+#define	Dbg_unused_sec		Dbg64_unused_sec
+#define	Dbg_unused_unref	Dbg64_unused_unref
 
-extern	void		Dbg_args_files(int, char *);
-extern	void		Dbg_args_flags(int, int);
-extern	void		Dbg_bind_global(const char *, caddr_t, caddr_t, Xword,
-			    Pltbindtype, const char *, caddr_t, caddr_t,
-			    const char *, uint_t);
-extern	void		Dbg_bind_plt_summary(Half, Word, Word, Word,
-			    Word, Word, Word);
-extern	void		Dbg_bind_profile(uint_t, uint_t);
-extern	void		Dbg_bind_weak(const char *, caddr_t, caddr_t,
-			    const char *);
-extern	void		Dbg_cap_hw_candidate(const char *);
-extern	void		Dbg_cap_hw_filter(const char *, const char *);
-extern	void		Dbg_cap_hw_1(Xword, Half);
-extern	void		Dbg_cap_mapfile(Xword, Xword, Half);
-extern	void		Dbg_cap_sec_entry(uint_t, Xword, Xword, Half);
-extern	void		Dbg_cap_sec_title(const char *);
-extern	void		Dbg_ent_print(Half, List * len, Boolean);
-extern	void		Dbg_file_analyze(Rt_map *);
-extern	void		Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t);
-extern	void		Dbg_file_archive(const char *, int);
-extern	void		Dbg_file_ar_rescan(void);
-extern	void		Dbg_file_bind_entry(Bnd_desc *);
-extern	void		Dbg_file_bindings(Rt_map *, int, Word);
-extern	void		Dbg_file_cntl(Lm_list *, Aliste, Aliste);
-extern	void		Dbg_file_config_dis(const char *, int);
-extern	void		Dbg_file_config_obj(const char *, const char *,
-			    const char *);
-extern	void		Dbg_file_delete(const char *);
-extern	void		Dbg_file_dlclose(const char *, int);
-extern	void		Dbg_file_dldump(const char *, const char *, int);
-extern	void		Dbg_file_dlopen(const char *, const char *, int);
-extern	void		Dbg_file_del_rescan(void);
-extern	void		Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t,
-			    ulong_t, Lmid_t, Aliste);
-extern	void		Dbg_file_filtee(const char *, const char *, int);
-extern	void		Dbg_file_filter(const char *, const char *, int);
-extern	void		Dbg_file_fixname(const char *, const char *);
-extern	void		Dbg_file_generic(Ifl_desc *);
-extern	void		Dbg_file_hdl_action(Grp_hdl *, Rt_map *, int);
-extern	void		Dbg_file_hdl_collect(Grp_hdl *, const char *);
-extern	void		Dbg_file_hdl_title(int);
-extern	void		Dbg_file_lazyload(const char *, const char *,
-			    const char *);
-extern	void		Dbg_file_ldso(const char *, ulong_t, ulong_t, char **,
-			    auxv_t *);
-extern	void		Dbg_file_mode_promote(const char *, int);
-extern	void		Dbg_file_needed(const char *, const char *);
-extern	void		Dbg_file_nl(void);
-extern	void		Dbg_file_output(Ofl_desc *);
-extern	void		Dbg_file_preload(const char *);
-extern	void		Dbg_file_prot(const char *, int);
-extern	void		Dbg_file_reuse(const char *, const char *);
-extern	void		Dbg_file_rejected(Rej_desc *);
-extern	void		Dbg_file_skip(const char *, const char *);
-extern	void		Dbg_got_display(Gottable *, Ofl_desc *);
-extern	void		Dbg_libs_audit(const char *, const char *);
-extern	void		Dbg_libs_ignore(const char *);
-extern	void		Dbg_libs_init(List *, List *);
-extern	void		Dbg_libs_l(const char *, const char *);
-extern	void		Dbg_libs_path(const char *, Half, const char *);
-extern	void		Dbg_libs_req(const char *, const char *, const char *);
-extern	void		Dbg_libs_update(List *, List *);
-extern	void		Dbg_libs_yp(const char *);
-extern	void		Dbg_libs_ylu(const char *, const char *, int);
-extern	void		Dbg_libs_find(const char *);
-extern	void		Dbg_libs_found(const char *, int);
-extern	void		Dbg_map_atsign(Boolean);
-extern	void		Dbg_map_dash(const char *, Sdf_desc *);
-extern	void		Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *);
-extern	void		Dbg_map_equal(Boolean);
-extern	void		Dbg_map_parse(const char *);
-extern	void		Dbg_map_pipe(Sg_desc *, const char *, const Word);
-extern	void		Dbg_map_seg(Half, int, Sg_desc *);
-extern	void		Dbg_map_size_new(const char *);
-extern	void		Dbg_map_size_old(Ehdr *, Sym_desc *);
-extern	void		Dbg_map_sort_fini(Sg_desc *);
-extern	void		Dbg_map_sort_orig(Sg_desc *);
-extern	void		Dbg_map_symbol(Ehdr *, Sym_desc *);
-extern	void		Dbg_map_version(const char *, const char *, int);
-extern 	void		Dbg_move_adjexpandreloc(ulong_t, const char *);
-extern 	void		Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *);
-extern	void		Dbg_move_data(const char *);
-extern 	void		Dbg_move_expanding(Move *, Addr);
-extern 	void		Dbg_move_input1(const char *);
-extern 	void		Dbg_move_mventry(int, Move *, Sym_desc *);
-extern 	void		Dbg_move_mventry2(Move *, Word, char *);
-extern 	void		Dbg_move_outmove(const uchar_t *);
-extern 	void		Dbg_move_outsctadj(Sym_desc *);
-extern 	void		Dbg_move_parexpn(const char *, const char *);
-#if	defined(_ELF64)
-extern	void		Dbg_pltpad_bindto64(const char *, const char *, Addr);
-extern	void		Dbg_pltpad_boundto64(const char *, Addr, const char *,
-			    const char *);
+#define	Dbg_ver_avail_entry	Dbg64_ver_avail_entry
+#define	Dbg_ver_avail_title	Dbg64_ver_avail_title
+#define	Dbg_ver_def_title	Dbg64_ver_def_title
+#define	Dbg_ver_desc_entry	Dbg64_ver_desc_entry
+#define	Dbg_ver_need_entry	Dbg64_ver_need_entry
+#define	Dbg_ver_need_title	Dbg64_ver_need_title
+#define	Dbg_ver_nointerface	Dbg64_ver_nointerface
+#define	Dbg_ver_symbol		Dbg64_ver_symbol
+
+#else
+
+#define	Dbg_demangle_name	Dbg32_demangle_name
+
+#define	Dbg_bind_global		Dbg32_bind_global
+#define	Dbg_bind_plt_summary	Dbg32_bind_plt_summary
+#define	Dbg_bind_weak		Dbg32_bind_weak
+
+#define	Dbg_cap_val_hw1		Dbg32_cap_val_hw1
+#define	Dbg_cap_hw_candidate	Dbg32_cap_hw_candidate
+#define	Dbg_cap_hw_filter	Dbg32_cap_hw_filter
+#define	Dbg_cap_mapfile		Dbg32_cap_mapfile
+#define	Dbg_cap_sec_entry	Dbg32_cap_sec_entry
+#define	Dbg_cap_sec_title	Dbg32_cap_sec_title
+
+#define	Dbg_ent_entry		Dbg32_ent_entry
+#define	Dbg_ent_print		Dbg32_ent_print
+
+#define	Dbg_file_analyze	Dbg32_file_analyze
+#define	Dbg_file_aout		Dbg32_file_aout
+#define	Dbg_file_ar		Dbg32_file_ar
+#define	Dbg_file_ar_rescan	Dbg32_file_ar_rescan
+#define	Dbg_file_bind_entry	Dbg32_file_bind_entry
+#define	Dbg_file_bindings	Dbg32_file_bindings
+#define	Dbg_file_cntl		Dbg32_file_cntl
+#define	Dbg_file_config_dis	Dbg32_file_config_dis
+#define	Dbg_file_config_obj	Dbg32_file_config_obj
+#define	Dbg_file_del_rescan	Dbg32_file_del_rescan
+#define	Dbg_file_delete		Dbg32_file_delete
+#define	Dbg_file_dlclose	Dbg32_file_dlclose
+#define	Dbg_file_dldump		Dbg32_file_dldump
+#define	Dbg_file_dlopen		Dbg32_file_dlopen
+#define	Dbg_file_elf		Dbg32_file_elf
+#define	Dbg_file_filtee		Dbg32_file_filtee
+#define	Dbg_file_filter		Dbg32_file_filter
+#define	Dbg_file_fixname	Dbg32_file_fixname
+#define	Dbg_file_generic	Dbg32_file_generic
+#define	Dbg_file_hdl_action	Dbg32_file_hdl_action
+#define	Dbg_file_hdl_collect	Dbg32_file_hdl_collect
+#define	Dbg_file_hdl_title	Dbg32_file_hdl_title
+#define	Dbg_file_lazyload	Dbg32_file_lazyload
+#define	Dbg_file_ldso		Dbg32_file_ldso
+#define	Dbg_file_mode_promote	Dbg32_file_mode_promote
+#define	Dbg_file_needed		Dbg32_file_needed
+#define	Dbg_file_output		Dbg32_file_output
+#define	Dbg_file_preload	Dbg32_file_preload
+#define	Dbg_file_prot		Dbg32_file_prot
+#define	Dbg_file_rejected	Dbg32_file_rejected
+#define	Dbg_file_reuse		Dbg32_file_reuse
+#define	Dbg_file_skip		Dbg32_file_skip
+
+#define	Dbg_got_display		Dbg32_got_display
+
+#define	Dbg_libs_audit		Dbg32_libs_audit
+#define	Dbg_libs_find		Dbg32_libs_find
+#define	Dbg_libs_found		Dbg32_libs_found
+#define	Dbg_libs_ignore		Dbg32_libs_ignore
+#define	Dbg_libs_init		Dbg32_libs_init
+#define	Dbg_libs_l		Dbg32_libs_l
+#define	Dbg_libs_path		Dbg32_libs_path
+#define	Dbg_libs_req		Dbg32_libs_req
+#define	Dbg_libs_update		Dbg32_libs_update
+#define	Dbg_libs_yp		Dbg32_libs_yp
+#define	Dbg_libs_ylu		Dbg32_libs_ylu
+
+#define	Dbg_map_dash		Dbg32_map_dash
+#define	Dbg_map_ent		Dbg32_map_ent
+#define	Dbg_map_parse		Dbg32_map_parse
+#define	Dbg_map_pipe		Dbg32_map_pipe
+#define	Dbg_map_seg		Dbg32_map_seg
+#define	Dbg_map_set_atsign	Dbg32_map_set_atsign
+#define	Dbg_map_set_equal	Dbg32_map_set_equal
+#define	Dbg_map_size_new	Dbg32_map_size_new
+#define	Dbg_map_size_old	Dbg32_map_size_old
+#define	Dbg_map_sort_fini	Dbg32_map_sort_fini
+#define	Dbg_map_sort_orig	Dbg32_map_sort_orig
+#define	Dbg_map_symbol		Dbg32_map_symbol
+#define	Dbg_map_version		Dbg32_map_version
+
+#define	Dbg_move_adjexpandreloc	Dbg32_move_adjexpandreloc
+#define	Dbg_move_adjmovereloc	Dbg32_move_adjmovereloc
+#define	Dbg_move_data		Dbg32_move_data
+#define	Dbg_move_entry1		Dbg32_move_entry1
+#define	Dbg_move_entry2		Dbg32_move_entry2
+#define	Dbg_move_expand		Dbg32_move_expand
+#define	Dbg_move_input		Dbg32_move_input
+#define	Dbg_move_outmove	Dbg32_move_outmove
+#define	Dbg_move_outsctadj	Dbg32_move_outsctadj
+#define	Dbg_move_parexpn	Dbg32_move_parexpn
+
+#define	Dbg_reloc_apply_reg	Dbg32_reloc_apply_reg
+#define	Dbg_reloc_apply_val	Dbg32_reloc_apply_val
+#define	Dbg_reloc_ars_entry	Dbg32_reloc_ars_entry
+#define	Dbg_reloc_copy		Dbg32_reloc_copy
+#define	Dbg_reloc_discard	Dbg32_reloc_discard
+#define	Dbg_reloc_doact		Dbg32_reloc_doact
+#define	Dbg_reloc_doact_title	Dbg32_reloc_doact_title
+#define	Dbg_reloc_dooutrel	Dbg32_reloc_dooutrel
+#define	Dbg_reloc_entry		Dbg32_reloc_entry
+#define	Dbg_reloc_error		Dbg32_reloc_error
+#define	Dbg_reloc_generate	Dbg32_reloc_generate
+#define	Dbg_reloc_in		Dbg32_reloc_in
+#define	Dbg_reloc_ors_entry	Dbg32_reloc_ors_entry
+#define	Dbg_reloc_out		Dbg32_reloc_out
+#define	Dbg_reloc_proc		Dbg32_reloc_proc
+#define	Dbg_reloc_run		Dbg32_reloc_run
+#define	Dbg_reloc_transition	Dbg32_reloc_transition
+
+#define	Dbg_sec_added		Dbg32_sec_added
+#define	Dbg_sec_created		Dbg32_sec_created
+#define	Dbg_sec_discarded	Dbg32_sec_discarded
+#define	Dbg_sec_group		Dbg32_sec_group
+#define	Dbg_sec_in		Dbg32_sec_in
+#define	Dbg_sec_order_error	Dbg32_sec_order_error
+#define	Dbg_sec_order_list	Dbg32_sec_order_list
+#define	Dbg_sec_strtab		Dbg32_sec_strtab
+
+#define	Dbg_seg_desc_entry	Dbg32_seg_desc_entry
+#define	Dbg_seg_entry		Dbg32_seg_entry
+#define	Dbg_seg_list		Dbg32_seg_list
+#define	Dbg_seg_os		Dbg32_seg_os
+#define	Dbg_seg_title		Dbg32_seg_title
+
+#define	Dbg_statistics_ar	Dbg32_statistics_ar
+#define	Dbg_statistics_ld	Dbg32_statistics_ld
+
+#define	Dbg_support_action	Dbg32_support_action
+#define	Dbg_support_load	Dbg32_support_load
+#define	Dbg_support_req		Dbg32_support_req
+
+#define	Dbg_syminfo_entry	Dbg32_syminfo_entry
+#define	Dbg_syminfo_title	Dbg32_syminfo_title
+
+#define	Dbg_syms_ar_checking	Dbg32_syms_ar_checking
+#define	Dbg_syms_ar_entry	Dbg32_syms_ar_entry
+#define	Dbg_syms_ar_resolve	Dbg32_syms_ar_resolve
+#define	Dbg_syms_ar_title	Dbg32_syms_ar_title
+#define	Dbg_syms_created	Dbg32_syms_created
+#define	Dbg_syms_discarded	Dbg32_syms_discarded
+#define	Dbg_syms_dlsym		Dbg32_syms_dlsym
+#define	Dbg_syms_entered	Dbg32_syms_entered
+#define	Dbg_syms_entry		Dbg32_syms_entry
+#define	Dbg_syms_global		Dbg32_syms_global
+#define	Dbg_syms_ignore		Dbg32_syms_ignore
+#define	Dbg_syms_lazy_rescan	Dbg32_syms_lazy_rescan
+#define	Dbg_syms_lookup		Dbg32_syms_lookup
+#define	Dbg_syms_lookup_aout	Dbg32_syms_lookup_aout
+#define	Dbg_syms_new		Dbg32_syms_new
+#define	Dbg_syms_old		Dbg32_syms_old
+#define	Dbg_syms_process	Dbg32_syms_process
+#define	Dbg_syms_reduce		Dbg32_syms_reduce
+#define	Dbg_syms_reloc		Dbg32_syms_reloc
+#define	Dbg_syms_resolved	Dbg32_syms_resolved
+#define	Dbg_syms_resolving	Dbg32_syms_resolving
+#define	Dbg_syms_sec_entry	Dbg32_syms_sec_entry
+#define	Dbg_syms_sec_title	Dbg32_syms_sec_title
+#define	Dbg_syms_spec_title	Dbg32_syms_spec_title
+#define	Dbg_syms_updated	Dbg32_syms_updated
+#define	Dbg_syms_up_title	Dbg32_syms_up_title
+
+#define	Dbg_util_broadcast	Dbg32_util_broadcast
+#define	Dbg_util_call_array	Dbg32_util_call_array
+#define	Dbg_util_call_fini	Dbg32_util_call_fini
+#define	Dbg_util_call_init	Dbg32_util_call_init
+#define	Dbg_util_call_main	Dbg32_util_call_main
+#define	Dbg_util_collect	Dbg32_util_collect
+#define	Dbg_util_dbnotify	Dbg32_util_dbnotify
+#define	Dbg_util_edge_in	Dbg32_util_edge_in
+#define	Dbg_util_edge_out	Dbg32_util_edge_out
+#define	Dbg_util_intoolate	Dbg32_util_intoolate
+#define	Dbg_util_nl		Dbg32_util_nl
+#define	Dbg_util_no_init	Dbg32_util_no_init
+#define	Dbg_util_scc_entry	Dbg32_util_scc_entry
+#define	Dbg_util_scc_title	Dbg32_util_scc_title
+#define	Dbg_util_str		Dbg32_util_str
+#define	Dbg_util_wait		Dbg32_util_wait
+
+#define	Dbg_unused_file		Dbg32_unused_file
+#define	Dbg_unused_rtldinfo	Dbg32_unused_rtldinfo
+#define	Dbg_unused_sec		Dbg32_unused_sec
+#define	Dbg_unused_unref	Dbg32_unused_unref
+
+#define	Dbg_ver_avail_entry	Dbg32_ver_avail_entry
+#define	Dbg_ver_avail_title	Dbg32_ver_avail_title
+#define	Dbg_ver_def_title	Dbg32_ver_def_title
+#define	Dbg_ver_desc_entry	Dbg32_ver_desc_entry
+#define	Dbg_ver_need_entry	Dbg32_ver_need_entry
+#define	Dbg_ver_need_title	Dbg32_ver_need_title
+#define	Dbg_ver_nointerface	Dbg32_ver_nointerface
+#define	Dbg_ver_symbol		Dbg32_ver_symbol
+
 #endif
-extern	void		Dbg_reloc_apply(unsigned long long, unsigned long long);
-extern	void		Dbg_reloc_discard(Half, Rel_desc *);
-extern	void		Dbg_reloc_error(Half, Word, void *, const char *,
-			    const char *);
-extern	void		Dbg_reloc_generate(Os_desc *, Word);
-extern	void		Dbg_reloc_reg_apply(unsigned long long,
-			    unsigned long long);
-extern	void		Dbg_reloc_in(Half, Word, void *, const char *,
-			    const char *);
-extern	void		Dbg_reloc_out(Half, Word, void *, const char *,
-			    const char *);
-extern	void		Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *);
-extern	void		Dbg_reloc_ars_entry(Half, Rel_desc *);
-extern	void		Dbg_reloc_ors_entry(Half, Rel_desc *);
-extern	void		Dbg_reloc_doactiverel(void);
-extern	void		Dbg_reloc_doact(Half, Word, Xword, Xword, const char *,
-			    Os_desc *);
-extern	void		Dbg_reloc_dooutrel(GElf_Word);
-extern	void		Dbg_reloc_copy(const char *, const char *,
-			    const char *, int);
-extern	void		Dbg_reloc_run(const char *, uint_t, int, int);
-extern	void		Dbg_reloc_transition(Half, Word, Word, Xword,
-			    const char *);
-extern	void		Dbg_sec_added(Os_desc *, Sg_desc *);
-extern	void		Dbg_sec_created(Os_desc *, Sg_desc *);
-extern	void		Dbg_sec_discarded(Is_desc *, Is_desc *);
-extern	void		Dbg_sec_group(Is_desc *, Group_desc *);
-extern	void		Dbg_sec_in(Is_desc *);
-extern	void		Dbg_sec_order_list(Ofl_desc *, int);
-extern	void		Dbg_sec_order_error(Ifl_desc *, Word, int);
-extern	void		Dbg_sec_strtab(Os_desc *, Str_tbl *);
-extern	void		Dbg_seg_entry(Half, int, Sg_desc *);
-extern	void		Dbg_seg_list(Half, List *);
-extern	void		Dbg_seg_os(Ofl_desc *, Os_desc *, int);
-extern	void		Dbg_seg_title(void);
-extern	void		Dbg_support_action(const char *, const char *,
-			    Support_ndx, const char *);
-extern	void		Dbg_support_load(const char *, const char *);
-extern	void		Dbg_support_req(const char *, int);
-extern	void		Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *);
-extern	void		Dbg_syms_ar_entry(Xword, Elf_Arsym *);
-extern	void		Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *,
-			    int);
-extern	void		Dbg_syms_ar_title(const char *, int);
-extern	void		Dbg_syms_created(const char *);
-extern	void		Dbg_syms_discarded(Sym_desc *, Is_desc *);
-extern	void		Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *);
-extern	void		Dbg_syms_entry(Xword, Sym_desc *);
-extern	void		Dbg_syms_global(Xword, const char *);
-extern	void		Dbg_syms_ignore(Ehdr *, Sym_desc *);
-extern	void		Dbg_syms_lazy_rescan(const char *);
-extern	void		Dbg_syms_new(Ehdr *, Sym *, Sym_desc *);
-extern	void		Dbg_syms_nl(void);
-extern	void		Dbg_syms_old(Ehdr *, Sym_desc *);
-extern	void		Dbg_syms_process(Ifl_desc *);
-extern	void		Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int,
-			    const char *);
-extern	void		Dbg_syms_reloc(Ehdr *, Sym_desc *);
-extern	void		Dbg_syms_resolved(Ehdr *, Sym_desc *);
-extern	void		Dbg_syms_resolving1(Xword, const char *, int, int);
-extern	void		Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *,
-			    Ifl_desc *);
-extern	void		Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *);
-extern	void		Dbg_syms_sec_title(void);
-extern	void		Dbg_syms_spec_title(void);
-extern	void		Dbg_syms_up_title(Ehdr *);
-extern	void		Dbg_syms_updated(Ehdr *, Sym_desc *, const char *);
-extern	void		Dbg_syms_dlsym(const char *, const char *, const char *,
-			    int);
-extern	void		Dbg_syms_lookup_aout(const char *);
-extern	void		Dbg_syms_lookup(const char *, const char *,
-			    const char *);
-extern	void		Dbg_tls_modactivity(void *, uint_t);
-extern	void		Dbg_tls_static_block(void *, ulong_t);
-extern	void		Dbg_audit_interface(const char *, const char *);
-extern	void		Dbg_audit_lib(const char *);
-extern	void		Dbg_audit_object(const char *, const char *);
-extern	void		Dbg_audit_symval(const char *, const char *,
-			    const char *, Addr, Addr);
-extern	void		Dbg_audit_version(const char *, ulong_t);
-extern	void		Dbg_statistics_ar(Ofl_desc *);
-extern	void		Dbg_statistics_ld(Ofl_desc *);
-extern	void		Dbg_syminfo_entry(int, Syminfo *, Sym *,
-			    const char *, Dyn *);
-extern	void		Dbg_syminfo_title(void);
-extern	void		Dbg_unused_file(const char *, int, int);
-extern	void		Dbg_unused_rtldinfo(const char *, const char *);
-extern	void		Dbg_unused_sec(Is_desc *);
-extern	void		Dbg_unused_unref(const char *, const char *);
-extern	void		Dbg_util_broadcast(const char *);
-extern	void		Dbg_util_call_array(const char *, void *,
-			    uint_t, uint_t);
-extern	void		Dbg_util_call_fini(const char *);
-extern	void		Dbg_util_call_init(const char *, int);
-extern	void		Dbg_util_call_main(const char *);
-extern	void		Dbg_util_collect(const char *, int, int);
-extern	void		Dbg_util_dbnotify(rd_event_e, r_state_e);
-extern	void		Dbg_util_edge_in(Rt_map *, uint_t, Rt_map *, int, int);
-extern	void		Dbg_util_edge_out(const char *, int, const char *);
-extern	void		Dbg_util_intoolate(const char *);
-extern	void		Dbg_util_nl(void);
-extern	void		Dbg_util_no_init(const char *);
-extern	void		Dbg_util_scc_entry(uint_t, const char *);
-extern	void		Dbg_util_scc_title(int);
-extern	void		Dbg_util_str(const char *);
-extern	void		Dbg_util_wait(int, const char *, const char *);
-extern	void		Dbg_ver_avail_entry(Ver_index *, const char *);
-extern	void		Dbg_ver_avail_title(const char *);
-extern	void		Dbg_ver_desc_entry(Ver_desc *);
-extern	void		Dbg_ver_def_title(const char *);
-extern	void		Dbg_ver_need_title(const char *);
-extern	void		Dbg_ver_need_entry(Half, const char *, const char *);
-extern	void		Dbg_ver_nointerface(const char *);
-extern	void		Dbg_ver_symbol(const char *);
 
 /*
- * External interface routines. These are not linker specific and provide
- * generic routines for interpreting elf structures.
+ * External Dbg_*() interface routines.
  */
-#ifdef _ELF64
-#define	Elf_phdr_entry		Gelf_phdr_entry
-#define	Elf_shdr_entry		Gelf_shdr_entry
-#define	Elf_sym_table_entry	Gelf_sym_table_entry
-#else	/* elf32 */
-extern	void		Elf_phdr_entry(Half, Elf32_Phdr *);
-extern	void		Elf_shdr_entry(Half, Elf32_Shdr *);
-extern	void		Elf_sym_table_entry(const char *, Elf32_Ehdr *,
-			    Elf32_Sym *, Elf32_Word, const char *,
-			    const char *);
-#endif /* _ELF64 */
+extern	void	Dbg_args_files(Lm_list *, int, char *);
+extern	void	Dbg_args_flags(Lm_list *, int, int);
+extern	void	Dbg_audit_interface(Lm_list *, const char *, const char *);
+extern	void	Dbg_audit_lib(Lm_list *, const char *);
+extern	void	Dbg_audit_object(Lm_list *, const char *, const char *);
+extern	void	Dbg_audit_symval(Lm_list *, const char *, const char *,
+		    const char *, Addr, Addr);
+extern	void	Dbg_audit_version(Lm_list *, const char *, ulong_t);
+
+extern	void	Dbg_bind_global(Rt_map *, Addr, Off, Xword, Pltbindtype,
+		    Rt_map *, Addr, Off, const char *, uint_t);
+extern	void	Dbg_bind_plt_summary(Lm_list *, Half, Word, Word, Word, Word,
+		    Word, Word);
+#if	defined(_ELF64)
+extern	void	Dbg_bind_pltpad_from(Rt_map *, Addr, const char *);
+extern	void	Dbg_bind_pltpad_to(Rt_map *, Addr, const char *, const char *);
+#endif
+extern	void	Dbg_bind_weak(Rt_map *, Addr, Addr, const char *);
+
+extern	void	Dbg_cap_hw_candidate(Lm_list *, const char *);
+extern	void	Dbg_cap_hw_filter(Lm_list *, const char *, Rt_map *);
+extern	void	Dbg_cap_mapfile(Lm_list *, Xword, Xword, Half);
+extern	void	Dbg_cap_sec_entry(Lm_list *, uint_t, Xword, Xword, Half);
+extern	void	Dbg_cap_sec_title(Ofl_desc *);
+extern	void	Dbg_cap_val_hw1(Lm_list *, Xword, Half);
+
+extern	const char *
+		Dbg_demangle_name(const char *);
+
+extern	void	Dbg_ent_entry(Lm_list *, Half, Ent_desc *);
+extern	void	Dbg_ent_print(Lm_list *, Half, List *, Boolean);
+
+extern	void	Dbg_file_analyze(Rt_map *);
+extern	void	Dbg_file_aout(Lm_list *, const char *, ulong_t, ulong_t,
+		    ulong_t, const char *, Aliste);
+extern	void	Dbg_file_ar(Lm_list *, const char *, int);
+extern	void	Dbg_file_ar_rescan(Lm_list *);
+extern	void	Dbg_file_bind_entry(Lm_list *, Bnd_desc *);
+extern	void	Dbg_file_bindings(Rt_map *, int);
+extern	void	Dbg_file_cntl(Lm_list *, Aliste, Aliste);
+extern	void	Dbg_file_config_dis(Lm_list *, const char *, int);
+extern	void	Dbg_file_config_obj(Lm_list *, const char *, const char *,
+		    const char *);
+extern	void	Dbg_file_del_rescan(Lm_list *);
+extern	void	Dbg_file_delete(Rt_map *);
+extern	void	Dbg_file_dlclose(Lm_list *, const char *, int);
+extern	void	Dbg_file_dldump(Rt_map *, const char *, int);
+extern	void	Dbg_file_dlopen(Rt_map *, const char *, int);
+extern	void	Dbg_file_elf(Lm_list *, const char *, ulong_t, ulong_t,
+		    ulong_t, ulong_t, const char *, Aliste);
+extern	void	Dbg_file_filtee(Lm_list *, const char *, const char *, int);
+extern	void	Dbg_file_filter(Lm_list *, const char *, const char *, int);
+extern	void	Dbg_file_fixname(Lm_list *, const char *, const char *);
+extern	void	Dbg_file_generic(Lm_list *, Ifl_desc *);
+extern	void	Dbg_file_hdl_action(Grp_hdl *, Rt_map *, int);
+extern	void	Dbg_file_hdl_collect(Grp_hdl *, const char *);
+extern	void	Dbg_file_hdl_title(int);
+extern	void	Dbg_file_lazyload(Rt_map *, const char *, const char *);
+extern	void	Dbg_file_ldso(Rt_map *, char **, auxv_t *, const char *,
+		    Aliste);
+extern	void	Dbg_file_mode_promote(Rt_map *, int);
+extern	void	Dbg_file_needed(Rt_map *, const char *);
+extern	void	Dbg_file_output(Ofl_desc *);
+extern	void	Dbg_file_preload(Lm_list *, const char *);
+extern	void	Dbg_file_prot(Rt_map *, int);
+extern	void	Dbg_file_rejected(Lm_list *, Rej_desc *);
+extern	void	Dbg_file_reuse(Lm_list *, const char *, const char *);
+extern	void	Dbg_file_skip(Lm_list *, const char *, const char *);
+
+extern	void	Dbg_got_display(Ofl_desc *, Gottable *);
+
+extern	void	Dbg_libs_audit(Lm_list *, const char *, const char *);
+extern	void	Dbg_libs_find(Lm_list *, const char *);
+extern	void	Dbg_libs_found(Lm_list *, const char *, int);
+extern	void	Dbg_libs_ignore(Lm_list *, const char *);
+extern	void	Dbg_libs_init(Lm_list *, List *, List *);
+extern	void	Dbg_libs_l(Lm_list *, const char *, const char *);
+extern	void	Dbg_libs_path(Lm_list *, const char *, Half, const char *);
+extern	void	Dbg_libs_req(Lm_list *, const char *, const char *,
+		    const char *);
+extern	void	Dbg_libs_update(Lm_list *, List *, List *);
+extern	void	Dbg_libs_yp(Lm_list *, const char *);
+extern	void	Dbg_libs_ylu(Lm_list *, const char *, const char *, int);
+
+extern	void	Dbg_map_dash(Lm_list *, const char *, Sdf_desc *);
+extern	void	Dbg_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *);
+extern	void	Dbg_map_parse(Lm_list *, const char *);
+extern	void	Dbg_map_pipe(Lm_list *, Sg_desc *, const char *, const Word);
+extern	void	Dbg_map_seg(Ofl_desc *, int, Sg_desc *);
+extern	void	Dbg_map_set_atsign(Boolean);
+extern	void	Dbg_map_set_equal(Boolean);
+extern	void	Dbg_map_size_new(Lm_list *, const char *);
+extern	void	Dbg_map_size_old(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_map_sort_fini(Lm_list *, Sg_desc *);
+extern	void	Dbg_map_sort_orig(Lm_list *, Sg_desc *);
+extern	void	Dbg_map_symbol(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_map_version(Lm_list *, const char *, const char *, int);
+
+extern 	void	Dbg_move_adjexpandreloc(Lm_list *, Xword, const char *);
+extern 	void	Dbg_move_adjmovereloc(Lm_list *, Xword, Xword, const char *);
+extern	void	Dbg_move_data(Rt_map *);
+extern 	void	Dbg_move_entry1(Lm_list *, int, Move *, Sym_desc *);
+extern 	void	Dbg_move_entry2(Lm_list *, Move *, Word, const char *);
+extern 	void	Dbg_move_expand(Lm_list *, Move *, Addr);
+extern 	void	Dbg_move_input(Lm_list *, const char *);
+extern 	void	Dbg_move_outmove(Lm_list *, const char *);
+extern 	void	Dbg_move_outsctadj(Lm_list *, Sym_desc *);
+extern 	void	Dbg_move_parexpn(Lm_list *, const char *, const char *);
+
+extern	void	Dbg_reloc_apply_reg(Lm_list *, int, Half, Xword, Xword);
+extern	void	Dbg_reloc_apply_val(Lm_list *, int, Xword, Xword);
+extern	void	Dbg_reloc_ars_entry(Lm_list *, int, Word, Half, Rel_desc *);
+extern	void	Dbg_reloc_copy(Rt_map *, Rt_map *, const char *, int);
+extern	void	Dbg_reloc_discard(Lm_list *, Half, Rel_desc *);
+extern	void	Dbg_reloc_doact(Lm_list *, int, Half, Word, Word, Xword, Xword,
+		    const char *, Os_desc *);
+extern	void	Dbg_reloc_doact_title(Lm_list *);
+extern	void	Dbg_reloc_dooutrel(Lm_list *, Word);
+extern	void	Dbg_reloc_entry(Lm_list *, const char *, Half, Word, void *,
+		    const char *, const char *, const char *);
+extern	void	Dbg_reloc_error(Lm_list *, int, Half, Word, void *,
+		    const char *);
+extern	void	Dbg_reloc_generate(Lm_list *, Os_desc *, Word);
+extern	void	Dbg_reloc_in(Lm_list *, int, Half, Word, void *, const char *,
+		    const char *);
+extern	void	Dbg_reloc_ors_entry(Lm_list *, int, Word, Half, Rel_desc *);
+extern	void	Dbg_reloc_out(Ofl_desc *, int, Word, void *, const char *,
+		    const char *);
+extern	void	Dbg_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *);
+extern	void	Dbg_reloc_run(Rt_map *, uint_t, int, int);
+extern	void	Dbg_reloc_transition(Lm_list *, Half, Word, Word, Xword,
+		    const char *);
+
+extern	void	Dbg_sec_added(Lm_list *, Os_desc *, Sg_desc *);
+extern	void	Dbg_sec_created(Lm_list *, Os_desc *, Sg_desc *);
+extern	void	Dbg_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
+extern	void	Dbg_sec_group(Lm_list *, Is_desc *, Group_desc *);
+extern	void	Dbg_sec_in(Lm_list *, Is_desc *);
+extern	void	Dbg_sec_order_error(Lm_list *, Ifl_desc *, Word, int);
+extern	void	Dbg_sec_order_list(Ofl_desc *, int);
+extern	void	Dbg_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
+
+extern	void	Dbg_seg_desc_entry(Lm_list *, Half, int, Sg_desc *);
+extern	void	Dbg_seg_entry(Ofl_desc *, int, Sg_desc *);
+extern	void	Dbg_seg_list(Lm_list *, Half, List *);
+extern	void	Dbg_seg_os(Ofl_desc *, Os_desc *, int);
+extern	void	Dbg_seg_title(Lm_list *);
+
+extern	void	Dbg_statistics_ar(Ofl_desc *);
+extern	void	Dbg_statistics_ld(Ofl_desc *);
+
+extern	void	Dbg_support_action(Lm_list *, const char *, const char *,
+		    Support_ndx, const char *);
+extern	void	Dbg_support_load(Lm_list *, const char *, const char *);
+extern	void	Dbg_support_req(Lm_list *, const char *, int);
+
+extern	void	Dbg_syminfo_entry(Lm_list *, Word, Syminfo *, Sym *,
+		    const char *, Dyn *);
+extern	void	Dbg_syminfo_title(Lm_list *);
+
+extern	void	Dbg_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *,
+		    const char *);
+extern	void	Dbg_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *);
+extern	void	Dbg_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *,
+		    const char *, int);
+extern	void	Dbg_syms_ar_title(Lm_list *, const char *, int);
+extern	void	Dbg_syms_created(Lm_list *, const char *);
+extern	void	Dbg_syms_discarded(Lm_list *, Sym_desc *, Is_desc *);
+extern	void	Dbg_syms_dlsym(Rt_map *, const char *, const char *, int);
+extern	void	Dbg_syms_entered(Ofl_desc *, Sym *, Sym_desc *);
+extern	void	Dbg_syms_entry(Lm_list *, Word, Sym_desc *);
+extern	void	Dbg_syms_global(Lm_list *, Word, const char *);
+extern	void	Dbg_syms_ignore(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_syms_lazy_rescan(Lm_list *, const char *);
+extern	void	Dbg_syms_lookup(Rt_map *, const char *, const char *);
+#if	!(defined(_ELF64))
+extern	void	Dbg_syms_lookup_aout(Lm_list *, const char *);
+#endif
+extern	void	Dbg_syms_new(Ofl_desc *, Sym *, Sym_desc *);
+extern	void	Dbg_syms_old(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_syms_process(Lm_list *, Ifl_desc *);
+extern	void	Dbg_syms_reduce(Ofl_desc *, int, Sym_desc *, int,
+		    const char *);
+extern	void	Dbg_syms_reloc(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_syms_resolved(Ofl_desc *, Sym_desc *);
+extern	void	Dbg_syms_resolving(Ofl_desc *, Word, const char *, int, int,
+		    Sym *, Sym *, Sym_desc *, Ifl_desc *);
+extern	void	Dbg_syms_sec_entry(Lm_list *, Word, Sg_desc *, Os_desc *);
+extern	void	Dbg_syms_sec_title(Lm_list *);
+extern	void	Dbg_syms_spec_title(Lm_list *);
+extern	void	Dbg_syms_updated(Ofl_desc *, Sym_desc *, const char *);
+extern	void	Dbg_syms_up_title(Lm_list *);
+
+extern	void	Dbg_tls_modactivity(Lm_list *, void *, uint_t);
+extern	void	Dbg_tls_static_block(Lm_list *, void *, ulong_t);
+
+extern	void	Dbg_util_broadcast(Rt_map *);
+extern	void	Dbg_util_call_array(Rt_map *, void *, int, Word);
+extern	void	Dbg_util_call_fini(Rt_map *);
+extern	void	Dbg_util_call_init(Rt_map *, int);
+extern	void	Dbg_util_call_main(Rt_map *);
+extern	void	Dbg_util_collect(Rt_map *, int, int);
+extern	void	Dbg_util_dbnotify(Lm_list *, rd_event_e, r_state_e);
+extern	void	Dbg_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *,
+		    int, int);
+extern	void	Dbg_util_edge_out(Rt_map *, Rt_map *);
+extern	void	Dbg_util_intoolate(Rt_map *);
+extern	void	Dbg_util_nl(Lm_list *, int);
+extern	void	Dbg_util_no_init(Rt_map *);
+extern	void	Dbg_util_str(Lm_list *, const char *);
+extern	void	Dbg_util_scc_entry(Rt_map *, uint_t);
+extern	void	Dbg_util_scc_title(Lm_list *, int);
+extern	void	Dbg_util_wait(Rt_map *, Rt_map *, int);
+
+extern	void	Dbg_unused_file(Lm_list *, const char *, int, uint_t);
+extern	void	Dbg_unused_rtldinfo(Rt_map *);
+extern	void	Dbg_unused_sec(Lm_list *, Is_desc *);
+extern	void	Dbg_unused_unref(Rt_map *, const char *);
+
+extern	void	Dbg_ver_avail_entry(Lm_list *, Ver_index *, const char *);
+extern	void	Dbg_ver_avail_title(Lm_list *, const char *);
+extern	void	Dbg_ver_def_title(Lm_list *, const char *);
+extern	void	Dbg_ver_desc_entry(Lm_list *, Ver_desc *);
+extern	void	Dbg_ver_need_entry(Lm_list *, Half, const char *,
+		    const char *);
+extern	void	Dbg_ver_need_title(Lm_list *, const char *);
+extern	void	Dbg_ver_nointerface(Lm_list *, const char *);
+extern	void	Dbg_ver_symbol(Lm_list *, const char *);
 
 /*
- * These are used by both the Elf32 and Elf64 sides.
+ * Define Elf_*() interface flags.
+ */
+#define	ELF_DBG_ELFDUMP		1
+#define	ELF_DBG_RTLD		2
+#define	ELF_DBG_LD		3
+
+/*
+ * Define generic Elf_*() interfaces.
+ */
+extern	void Elf_syminfo_entry(Lm_list *, Word, Syminfo *, const char *,
+	    const char *);
+extern	void Elf_syminfo_title(Lm_list *);
+
+/*
+ * Establish ELF32 and ELF64 class Elf_*() interfaces.
  */
-extern	const char	*Gelf_sym_dem(const char *);
+#if	defined(_ELF64)
+
+#define	Elf_cap_entry		Elf64_cap_entry
+#define	Elf_cap_title		Elf64_cap_title
+
+#define	Elf_demangle_name	Elf64_demangle_name
+#define	Elf_dyn_entry		Elf64_dyn_entry
+#define	Elf_dyn_title		Elf64_dyn_title
+
+#define	Elf_ehdr		Elf64_ehdr
+
+#define	Elf_got_entry		Elf64_got_entry
+#define	Elf_got_title		Elf64_got_title
+
+#define	Elf_reloc_apply_reg	Elf64_reloc_apply_reg
+#define	Elf_reloc_apply_val	Elf64_reloc_apply_val
+#define	Elf_reloc_entry_1	Elf64_reloc_entry_1
+#define	Elf_reloc_entry_2	Elf64_reloc_entry_2
+#define	Elf_reloc_title		Elf64_reloc_title
+
+#define	Elf_phdr		Elf64_phdr
+
+#define	Elf_shdr		Elf64_shdr
+
+#define	Elf_syms_table_entry	Elf64_syms_table_entry
+#define	Elf_syms_table_title	Elf64_syms_table_title
+
+#define	Elf_ver_def_title	Elf64_ver_def_title
+#define	Elf_ver_line_1		Elf64_ver_line_1
+#define	Elf_ver_line_2		Elf64_ver_line_2
+#define	Elf_ver_line_3		Elf64_ver_line_3
+#define	Elf_ver_line_4		Elf64_ver_line_4
+#define	Elf_ver_line_5		Elf64_ver_line_5
+#define	Elf_ver_need_title	Elf64_ver_need_title
+
+#else
+
+#define	Elf_cap_entry		Elf32_cap_entry
+#define	Elf_cap_title		Elf32_cap_title
+
+#define	Elf_demangle_name	Elf32_demangle_name
+#define	Elf_dyn_entry		Elf32_dyn_entry
+#define	Elf_dyn_title		Elf32_dyn_title
+
+#define	Elf_ehdr		Elf32_ehdr
 
-extern	void		Gelf_cap_print(GElf_Cap *, int, Half);
-extern	void		Gelf_cap_title(void);
-extern	void		Gelf_phdr_entry(Half, GElf_Phdr *);
-extern	void		Gelf_shdr_entry(Half, GElf_Shdr *);
-extern	void		Gelf_sym_table_entry(const char *, GElf_Ehdr *,
-			    GElf_Sym *, GElf_Word, const char *, const char *);
-extern	void		Gelf_elf_data_title(void);
-extern	void		Gelf_syminfo_entry(int, GElf_Syminfo *, const char *,
-			    const char *);
-extern	void		Gelf_sym_table_title(GElf_Ehdr *, const char *,
-			    const char *);
-extern	void		Gelf_ver_def_title(void);
-extern	void		Gelf_ver_need_title(void);
-extern	void		Gelf_ver_line_1(const char *, const char *,
-			    const char *, const char *);
-extern	void		Gelf_ver_line_2(const char *, const char *);
-extern	void		Gelf_ver_line_3(const char *, const char *,
-			    const char *);
+#define	Elf_got_entry		Elf32_got_entry
+#define	Elf_got_title		Elf32_got_title
+
+#define	Elf_reloc_apply_reg	Elf32_reloc_apply_reg
+#define	Elf_reloc_apply_val	Elf32_reloc_apply_val
+#define	Elf_reloc_entry_1	Elf32_reloc_entry_1
+#define	Elf_reloc_entry_2	Elf32_reloc_entry_2
+#define	Elf_reloc_title		Elf32_reloc_title
+
+#define	Elf_phdr		Elf32_phdr
+
+#define	Elf_shdr		Elf32_shdr
+
+#define	Elf_syms_table_entry	Elf32_syms_table_entry
+#define	Elf_syms_table_title	Elf32_syms_table_title
+
+#define	Elf_ver_def_title	Elf32_ver_def_title
+#define	Elf_ver_line_1		Elf32_ver_line_1
+#define	Elf_ver_line_2		Elf32_ver_line_2
+#define	Elf_ver_line_3		Elf32_ver_line_3
+#define	Elf_ver_line_4		Elf32_ver_line_4
+#define	Elf_ver_line_5		Elf32_ver_line_5
+#define	Elf_ver_need_title	Elf32_ver_need_title
+
+#endif
+
+extern	void	Elf_cap_entry(Lm_list *, Cap *, int, Half);
+extern	void	Elf_cap_title(Lm_list *);
 
-extern	void		Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half);
-extern	void		Gelf_dyn_title(void);
-extern	void		Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *);
-extern	void		Gelf_got_title(uchar_t);
-extern	void		Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr,
-			    GElf_Xword, GElf_Word, void *, const char *);
-extern	void		Gelf_reloc_entry(const char *, GElf_Half, GElf_Word,
-			    GElf_Rela *, const char *, const char *);
-extern	void		Gelf_syminfo_title(void);
+extern	const char \
+		*Elf_demangle_name(const char *);
+extern	void	Elf_dyn_entry(Lm_list *, Dyn *, int, const char *, Half);
+extern	void	Elf_dyn_title(Lm_list *);
+
+extern	void	Elf_ehdr(Lm_list *, Ehdr *, Shdr *);
+
+extern	void	Elf_got_entry(Lm_list *, Sword, Addr, Xword, Half, Word, void *,
+		    const char *);
+extern	void	Elf_got_title(Lm_list *);
+
+extern	void	Elf_phdr(Lm_list *, Half, Phdr *);
+
+extern	void	Elf_reloc_apply_val(Lm_list *, int, Xword, Xword);
+extern	void	Elf_reloc_apply_reg(Lm_list *, int, Half, Xword, Xword);
+extern	void	Elf_reloc_entry_1(Lm_list *, int, const char *, Half, Word,
+		    void *, const char *, const char *, const char *);
+extern	void	Elf_reloc_entry_2(Lm_list *, int, const char *, Word,
+		    const char *, Off, Sxword, const char *, const char *,
+		    const char *);
+extern	void	Elf_reloc_title(Lm_list *, int, Word);
+
+extern	void	Elf_shdr(Lm_list *, Half, Shdr *);
+
+extern	void	Elf_syms_table_entry(Lm_list *, int, const char *, Half, Sym *,
+		    Word, const char *, const char *);
+extern	void	Elf_syms_table_title(Lm_list *, int);
+
+extern	void	Elf_ver_def_title(Lm_list *);
+extern	void	Elf_ver_line_1(Lm_list *, const char *, const char *,
+		    const char *, const char *);
+extern	void	Elf_ver_line_2(Lm_list *, const char *, const char *);
+extern	void	Elf_ver_line_3(Lm_list *, const char *, const char *,
+		    const char *);
+extern	void	Elf_ver_line_4(Lm_list *, const char *);
+extern	void	Elf_ver_line_5(Lm_list *, const char *, const char *);
+extern	void	Elf_ver_need_title(Lm_list *);
 
 #ifdef	__cplusplus
 }
--- a/usr/src/cmd/sgs/include/i386/machdep.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/i386/machdep.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  *
  * Global include file for all sgs ia32 based machine dependent macros,
  * constants and declarations.
@@ -150,9 +149,6 @@
 #define	M_GOT_ENTSIZE	4		/* got entry size in bytes */
 #endif
 
-
-
-
 /*
  * Make machine class dependent functions transparent to the common code
  */
@@ -210,7 +206,7 @@
 #define	M_REL_SHT_TYPE	SHT_RELA	/* section header type */
 #define	M_REL_ELF_TYPE	ELF_T_RELA	/* data buffer type */
 
-#define	M_REL_CONTYPSTR	conv_reloc_amd64_type_str
+#define	M_REL_CONTYPSTR	conv_reloc_amd64_type
 #else /* _ELF32 */
 #define	M_REL_DT_TYPE	DT_REL		/* .dynamic entry */
 #define	M_REL_DT_SIZE	DT_RELSZ	/* .dynamic entry */
@@ -219,7 +215,7 @@
 #define	M_REL_SHT_TYPE	SHT_REL		/* section header type */
 #define	M_REL_ELF_TYPE	ELF_T_REL	/* data buffer type */
 
-#define	M_REL_CONTYPSTR	conv_reloc_386_type_str
+#define	M_REL_CONTYPSTR	conv_reloc_386_type
 #endif /* ELF32 */
 
 /*
--- a/usr/src/cmd/sgs/include/libld.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/libld.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,8 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -113,7 +111,8 @@
 	const char	*ofl_name;	/* full file name */
 	Elf		*ofl_elf;	/* elf_memory() elf descriptor */
 	Elf		*ofl_welf;	/* ELF_C_WRITE elf descriptor */
-	Ehdr		*ofl_ehdr;	/* elf header describing this file */
+	Ehdr		*ofl_dehdr;	/* default elf header, and new elf */
+	Ehdr		*ofl_nehdr;	/*	header describing this file */
 	Phdr		*ofl_phdr;	/* program header descriptor */
 	Phdr		*ofl_tlsphdr;	/* TLS phdr */
 	int		ofl_fd;		/* file descriptor */
@@ -161,9 +160,6 @@
 	Word		ofl_regsymcnt;	/* no. of output register symbols */
 	Word		ofl_lregsymcnt;	/* no. of local register symbols */
 	Sym_desc	*ofl_dtracesym;	/* ld -zdtrace= */
-	Half		ofl_e_machine;	/* elf header e_machine field setting */
-	Word		ofl_e_flags;	/* elf header e_flags field setting */
-	Word		ofl_libver;	/* max version that libelf can handle */
 	Word		ofl_flags;	/* various state bits, args etc. */
 	Word		ofl_flags1;	/*	more flags */
 	Xword		ofl_segorigin;	/* segment origin (start) */
@@ -247,6 +243,7 @@
 	Alist		*ofl_dtsfltrs;	/*	associated .dynamic/.dynstrs */
 	Xword		ofl_hwcap_1;	/* hardware capabilities */
 	Xword		ofl_sfcap_1;	/* software capabilities */
+	Lm_list		*ofl_lml;	/* runtime link-map list */
 };
 
 #define	FLG_OF_DYNAMIC	0x00000001	/* generate dynamic output module */
@@ -319,8 +316,6 @@
 					/*	section */
 #define	FLG_OF1_TLSOREL	0x00100000	/* output relocation against .tlsbss */
 					/*	section */
-#define	FLG_OF1_DEMANGL	0x00200000	/* demangle C++ sym name diagnostics */
-
 #define	FLG_OF1_NOHDR	0x00800000	/* no elf header/phdr alignment */
 					/*	needed */
 #define	FLG_OF1_VADDR	0x01000000	/* vaddr was explicitly set */
@@ -976,54 +971,55 @@
  */
 #define	FLG_ARD_EXTRACT	0x00010000	/* archive member has been extracted */
 
+/*
+ * Function Declarations.
+ */
+#if	defined(_ELF64)
 
-/*
- * Function Declarations
- */
-extern char		*add_string(char *, char *);
-extern uintptr_t	create_outfile(Ofl_desc *);
+#define	ld_create_outfile	ld64_create_outfile
+#define	ld_ent_setup		ld64_ent_setup
+#define	ld_ofl_cleanup		ld64_ofl_cleanup
+#define	ld_make_sections	ld64_make_sections
+#define	ld_main			ld64_main
+#define	ld_process_open		ld64_process_open
+#define	ld_reloc_init		ld64_reloc_init
+#define	ld_reloc_process	ld64_reloc_process
+#define	ld_sym_add_u		ld64_sym_add_u
+#define	ld_sym_validate		ld64_sym_validate
+#define	ld_update_outfile	ld64_update_outfile
+
+#else
+
+#define	ld_create_outfile	ld32_create_outfile
+#define	ld_ent_setup		ld32_ent_setup
+#define	ld_ofl_cleanup		ld32_ofl_cleanup
+#define	ld_make_sections	ld32_make_sections
+#define	ld_main			ld32_main
+#define	ld_process_open		ld32_process_open
+#define	ld_reloc_init		ld32_reloc_init
+#define	ld_reloc_process	ld32_reloc_process
+#define	ld_sym_add_u		ld32_sym_add_u
+#define	ld_sym_validate		ld32_sym_validate
+#define	ld_update_outfile	ld32_update_outfile
+
+#endif
+
+extern int		ld32_main(int, char **);
+extern int		ld64_main(int, char **);
+
+extern uintptr_t	ld_create_outfile(Ofl_desc *);
+extern uintptr_t	ld_ent_setup(Ofl_desc *, Xword);
+extern void		ld_ofl_cleanup(Ofl_desc *);
+extern uintptr_t	ld_make_sections(Ofl_desc *);
+extern Ifl_desc		*ld_process_open(const char *, size_t, int, Ofl_desc *,
+			    Half, Rej_desc *);
+extern uintptr_t	ld_reloc_init(Ofl_desc *);
+extern uintptr_t	ld_reloc_process(Ofl_desc *);
+extern Sym_desc		*ld_sym_add_u(const char *, Ofl_desc *);
+extern uintptr_t	ld_sym_validate(Ofl_desc *);
+extern uintptr_t	ld_update_outfile(Ofl_desc *);
+
 extern Elf64_Off	_elf_getxoff(Elf_Data *);
-extern uintptr_t	ent_setup(Ofl_desc *, Xword);
-extern void		eprintf(Error, const char *, ...);
-extern uintptr_t	finish_libs(Ofl_desc *);
-extern int		ld_main(int, char **);
-extern uintptr_t	ld_support_loadso(const char *);
-extern void		lds_start(const char *, const Half, const char *);
-extern void		lds_atexit(int);
-extern void		lds_file(const char *, const Elf_Kind,
-			    int flags, Elf *);
-extern uintptr_t	lds_input_section(const char *, Shdr **, Word,
-			    const char *, Elf_Scn *, Elf *, Ofl_desc *);
-extern void		lds_input_done(void);
-extern void		lds_section(const char *, Shdr *, Word, Elf_Data *,
-			    Elf *);
-extern Listnode		*list_appendc(List *, const void *);
-extern Listnode		*list_insertc(List *, const void *, Listnode *);
-extern Listnode		*list_prependc(List *, const void *);
-extern Listnode		*list_where(List *, Word);
-extern uintptr_t	make_sections(Ofl_desc *);
-extern void		ofl_cleanup(Ofl_desc *);
-extern uintptr_t	open_outfile(Ofl_desc *);
-extern Ifl_desc		*process_open(const char *, size_t, int, Ofl_desc *,
-			    Half, Rej_desc *);
-extern uintptr_t	reloc_init(Ofl_desc *);
-extern uintptr_t	reloc_process(Ofl_desc *);
-extern Sdf_desc		*sdf_find(const char *, List *);
-extern Sdf_desc		*sdf_add(const char *, List *);
-extern void		sec_validate(Ofl_desc *);
-extern uintptr_t	sunwmove_preprocess(Ofl_desc *);
-extern Sym_desc		*sym_add_u(const char *, Ofl_desc *);
-extern Sym_desc		*sym_enter(const char *, Sym *, Word, Ifl_desc *,
-			    Ofl_desc *, Word, Word, Word, Half,
-			    avl_index_t *);
-extern Sym_desc		*sym_find(const char *, Word, avl_index_t *,
-			    Ofl_desc *);
-extern uintptr_t	sym_validate(Ofl_desc *);
-extern uintptr_t	update_outfile(Ofl_desc *);
-extern Ver_desc		*vers_base(Ofl_desc *);
-extern uintptr_t	vers_check_defs(Ofl_desc *);
-extern Ver_desc		*vers_desc(const char *, Word, List *);
-extern Ver_desc		*vers_find(const char *, Word, List *);
 
 #ifdef	__cplusplus
 }
--- a/usr/src/cmd/sgs/include/rtld.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/rtld.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -65,7 +65,7 @@
 
 /*
  * A binding descriptor.  Establishes the binding relationship between two
- * objects, the caller (originator and the dependency (destination).
+ * objects, the caller (originator) and the dependency (destination).
  */
 typedef struct {
 	Rt_map		*b_caller;	/* caller (originator) of a binding */
@@ -236,7 +236,7 @@
 #define	LMC_FLG_REANALYZE	0x04	/* repeat analysis (established when */
 					/*	interposers are added */
 
-typedef	struct {
+struct lm_list {
 	/*
 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
 	 */
@@ -257,13 +257,15 @@
 	Alist		*lm_lists;	/* active and pending link-map lists */
 	char		***lm_environ;	/* pointer to environment array */
 	Word		lm_tflags;	/* transferable flags */
-	int		lm_obj;		/* total number of objs on link-map */
-	int		lm_init;	/* new obj since last init processing */
-	int		lm_lazy;	/* obj with pending lazy dependencies */
-} Lm_list;
+	uint_t		lm_obj;		/* total number of objs on link-map */
+	uint_t		lm_init;	/* new obj since last init processing */
+	uint_t		lm_lazy;	/* obj with pending lazy dependencies */
+	uint_t		lm_lmid;	/* unique link-map list identifier, */
+	char		*lm_lmidstr;	/* and associated diagnostic string */
+};
 
 #ifdef	_SYSCALL32
-typedef struct {
+struct lm_list32 {
 	/*
 	 * BEGIN: Exposed to rtld_db - don't move, don't delete
 	 */
@@ -282,10 +284,12 @@
 	Elf32_Addr	lm_lists;
 	Elf32_Addr	lm_environ;
 	Elf32_Word	lm_tflags;
-	int		lm_obj;
-	int		lm_init;
-	int		lm_lazy;
-} Lm_list32;
+	uint_t		lm_obj;
+	uint_t		lm_init;
+	uint_t		lm_lazy;
+	uint_t		lm_lmid;
+	Elf32_Addr	lm_lmidstr;
+};
 #endif /* _SYSCALL32 */
 
 /*
@@ -363,8 +367,9 @@
  * handle structure returned that describes a group of one or more objects.
  */
 typedef struct {
-	Alist *		gh_depends;	/* handle dependency list */
-	Rt_map *	gh_owner;	/* handle owner and the link-map */
+	Alist		*gh_depends;	/* handle dependency list */
+	Rt_map		*gh_ownlmp;	/* handle owners link-map */
+	Lm_list		*gh_ownlml;	/* handle owners link-map list */
 	uint_t		gh_refcnt;	/* handle reference count */
 	uint_t		gh_flags;	/* handle flags */
 } Grp_hdl;
@@ -800,11 +805,8 @@
 extern Lm_list		lml_rtld;	/* rtld's link map list */
 extern Lm_list		*lml_list[];
 
-extern int		do_reloc(uchar_t, uchar_t *, Xword *, const char *,
-			    const char *);
 extern Pltbindtype	elf_plt_write(uintptr_t, uintptr_t, void *, uintptr_t,
 			    Xword);
-extern void		eprintf(Error, const char *, ...);
 extern Rt_map		*is_so_loaded(Lm_list *, const char *, int);
 extern Sym		*lookup_sym(Slookup *, Rt_map **, uint_t *);
 extern int		rt_dldump(Rt_map *, const char *, int, Addr);
--- a/usr/src/cmd/sgs/include/sgs.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/sgs.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
  *
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Global include file for all sgs.
@@ -246,12 +246,21 @@
 typedef struct rel_desc		Rel_desc;
 
 /*
+ * Data structures defined in rtld.h.
+ */
+typedef struct lm_list		Lm_list;
+#ifdef _SYSCALL32
+typedef struct lm_list32	Lm_list32;
+#endif	/* _SYSCALL32 */
+
+/*
  * For the various utilities that include sgs.h
  */
+extern int	assfail(const char *, const char *, int);
+extern void	eprintf(Lm_list *, Error, const char *, ...);
 extern char	*sgs_demangle(char *);
 extern uint_t	sgs_str_hash(const char *);
 extern uint_t	findprime(uint_t);
-extern int	assfail(const char *, const char *, int);
 
 #endif /* _ASM */
 
--- a/usr/src/cmd/sgs/include/sparc/machdep.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/include/sparc/machdep.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Global include file for all sgs SPARC machine dependent macros, constants
@@ -178,9 +177,6 @@
 #define	M_WORD_ALIGN	4
 #endif
 
-
-
-
 /*
  * Make machine class dependent functions transparent to the common code
  */
@@ -227,7 +223,6 @@
 #define	elf_getshdr		elf32_getshdr
 #endif	/* Elf32 */
 
-
 /*
  * Make common relocation information transparent to the common code
  */
@@ -238,7 +233,7 @@
 #define	M_REL_SHT_TYPE	SHT_RELA	/* section header type */
 #define	M_REL_ELF_TYPE	ELF_T_RELA	/* data buffer type */
 
-#define	M_REL_CONTYPSTR	conv_reloc_SPARC_type_str
+#define	M_REL_CONTYPSTR	conv_reloc_SPARC_type
 
 /*
  * Make common relocation types transparent to the common code
--- a/usr/src/cmd/sgs/ld/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,11 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/ld/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,49 +18,40 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-PROG=		ld
+PROG =		ld
 
 include 	$(SRC)/cmd/Makefile.cmd
 include 	$(SRC)/cmd/sgs/Makefile.com
 
-COMOBJS=	ld.o
-BLTOBJ=		msg.o
+COMOBJS =	ld.o
+BLTOBJ =	msg.o
 
-OBJS =		$(BLTOBJ) $(MACHOBJS) $(COMOBJS)
+OBJS =		$(BLTOBJ) $(COMOBJS)
 .PARALLEL:	$(OBJS)
 
-MAPFILE=	../common/mapfile-vers
-
-# Building SUNWonld results in a call to the `package' target.  Requirements
-# needed to run this application on older releases are established:
-#   dlopen/dlclose requires libdl.so.1 prior to 5.10
-# 
-DLLIB =		$(VAR_DL_LIB)
-package	:=	DLLIB = $(VAR_PKG_DL_LIB)
+MAPFILE =	../common/mapfile-vers
 
-LLDFLAGS =	$(VAR_LD_LLDFLAGS)
-LLDFLAGS64 =	$(VAR_LD_LLDFLAGS64)
-LDFLAGS +=	$(VERSREF) $(LAZYLOAD) $(BDIRECT) \
-			$(USE_PROTO) -M$(MAPFILE)
-LLDLIBS=	-lelf $(DLLIB) $(CONVLIBDIR) -lconv
-LLDLIBS64=	-lelf $(DLLIB) $(CONVLIBDIR64) -lconv
+LDFLAGS +=	$(VERSREF) $(LAZYLOAD) $(BDIRECT) $(USE_PROTO) -M$(MAPFILE) \
+		    $(VAR_LD_LLDFLAGS)
+LDLIBS +=	$(LDLIBDIR) $(LD_LIB) $(ELFLIBDIR) -lelf \
+		    $(LDDBGLIBDIR) $(LDDBG_LIB) $(CONVLIBDIR) $(CONV_LIB)
 
-LDFLAGS +=	$(LLDFLAGS)
-LDLIBS +=	$(LLDLIBS)
 LINTFLAGS +=	-x
-LINTFLAGS64 +=	-x
+LINTFLAGS64 +=	-x $(VAR_LINTFLAGS64)
+
 CLEANFILES +=	$(LINTOUTS)
 
 native :=	LDFLAGS = -R$(SGSPROTO) $(ZNOVERSION)
-native :=	LLDLIBS = -L$(SGSPROTO) -lelf -ldl $(CONVLIBDIR) \
-			-lconv $(VAR_LD_NATIVE_LLDLIBS)
+native :=	LDLIBS = -L$(SGSPROTO) $(LD_LIB) -lelf $(CONVLIBDIR) \
+		    $(CONV_LIB) $(VAR_LD_NATIVE_LLDLIBS)
 
 BLTDEFS=	msg.h
 BLTDATA=	msg.c
--- a/usr/src/cmd/sgs/ld/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,11 +18,13 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 2001 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 all:		$(PROG)
 
--- a/usr/src/cmd/sgs/ld/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,13 +28,18 @@
 
 include		../Makefile.com
 
+LDLIBDIR =	$(LDLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+
+VAR_LD_LLDFLAGS = \
+		$(VAR_LD_LLDFLAGS64)
+
 .KEEP_STATE:
 
-LLDLIBS =	$(LLDLIBS64)
-LLDFLAGS =	$(LLDFLAGS64)
-LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
-
-ROOTCCSBINPROG=	$(ROOTCCSBINPROG64)
+ROOTCCSBINPROG = \
+		$(ROOTCCSBINPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/ld/common/ld.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/common/ld.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -36,12 +36,10 @@
 #include	<libintl.h>
 #include	<locale.h>
 #include	<fcntl.h>
-#include	<dlfcn.h>
 #include	"conv.h"
 #include	"libld.h"
 #include	"msg.h"
 
-
 /*
  * The following prevent us from having to include ctype.h which defines these
  * functions as macros which reference the __ctype[] array.  Go through .plt's
@@ -50,6 +48,52 @@
  */
 extern int	isspace(int);
 
+/*
+ * Print a message to stdout
+ */
+/* VARARGS3 */
+void
+eprintf(Lm_list *lml, Error error, const char *format, ...)
+{
+	va_list			args;
+	static const char	*strings[ERR_NUM] = { MSG_ORIG(MSG_STR_EMPTY) };
+
+#if	defined(lint)
+	/*
+	 * The lml argument is only meaningful for diagnostics sent to ld.so.1.
+	 * Supress the lint error by making a dummy assignment.
+	 */
+	lml = 0;
+#endif
+	if (error > ERR_NONE) {
+		if (error == ERR_WARNING) {
+			if (strings[ERR_WARNING] == 0)
+			    strings[ERR_WARNING] = MSG_INTL(MSG_ERR_WARNING);
+		} else if (error == ERR_FATAL) {
+			if (strings[ERR_FATAL] == 0)
+			    strings[ERR_FATAL] = MSG_INTL(MSG_ERR_FATAL);
+		} else if (error == ERR_ELF) {
+			if (strings[ERR_ELF] == 0)
+			    strings[ERR_ELF] = MSG_INTL(MSG_ERR_ELF);
+		}
+		(void) fputs(MSG_ORIG(MSG_STR_LDDIAG), stderr);
+	}
+	(void) fputs(strings[error], stderr);
+
+	va_start(args, format);
+	(void) vfprintf(stderr, format, args);
+	if (error == ERR_ELF) {
+		int	elferr;
+
+		if ((elferr = elf_errno()) != 0)
+			(void) fprintf(stderr, MSG_ORIG(MSG_STR_ELFDIAG),
+			    elf_errmsg(elferr));
+	}
+	(void) fprintf(stderr, MSG_ORIG(MSG_STR_NL));
+	(void) fflush(stderr);
+	va_end(args);
+}
+
 
 /*
  * Determine whether we need the Elf32 or Elf64 libld.
@@ -111,7 +155,7 @@
 		if ((fd = open(argv[optind], O_RDONLY)) == -1) {
 			int err = errno;
 
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
 			    argv[optind], strerror(err));
 			return (0);
 		}
@@ -146,8 +190,8 @@
 static int
 prepend_ldoptions(char *ld_options, int *argcp, char ***argvp)
 {
-	int	nargc;			/* New argc */
-	char	**nargv;			/* New argv */
+	int	nargc;			/* new argc */
+	char	**nargv;		/* new argv */
 	char	*arg, *string;
 	int	count;
 
@@ -182,8 +226,11 @@
 	 * Allocate a new argv array big enough to hold the new options from
 	 * the environment string and the old argv options.
 	 */
-	if ((nargv = calloc(nargc + *argcp, sizeof (char *))) == 0)
+	if ((nargv = calloc(nargc + *argcp, sizeof (char *))) == 0) {
+		int	err = errno;
+		eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_ALLOC), strerror(err));
 		return (0);
+	}
 
 	/*
 	 * Initialize first element of new argv array to be the first element
@@ -224,17 +271,15 @@
 }
 
 /*
- * The ld_altexec() function checks to see if there is
- * a LD_ALTEXEC=<path to alternate ld> in the environment.
- * If there is - it will null that variable out - and then
- * exec() the binary pointed to with the same arguements
- * as the originating process.
- * This permits using alternate link-editors (debugging/developer
- * copies) even in complex build environments.
+ * Check to see if there is a LD_ALTEXEC=<path to alternate ld> in the
+ * environment.  If so, first null the environment variable out, and then
+ * exec() the binary pointed to by the environment variable, passing the same
+ * arguments as the originating process.  This mechanism permits using
+ * alternate link-editors (debugging/developer copies) even in complex build
+ * environments.
  *
- * If LD_ALTEXEC= isn't set, or the exec() fails this
- * function silently returns and the execution of this
- * link-editor continues on.
+ * If LD_ALTEXEC= isn't set, or the exec() fails, silently return and allow the
+ * current link-editor to execute.
  */
 void
 ld_altexec(char **argv, char **envp)
@@ -273,9 +318,8 @@
 	(void) execve(execstr, argv, envp);
 
 	/*
-	 * If the exec failes - we just silently fall
-	 * through and continue execution of the
-	 * current link-editor.
+	 * If the exec() fails, silently fall through and continue execution of
+	 * the current link-editor.
 	 */
 }
 
@@ -283,16 +327,12 @@
 main(int argc, char **argv, char **envp)
 {
 	char		*ld_options, **oargv = argv;
-	const char	*libld = MSG_ORIG(MSG_LD_LIB32);
-	void		*libld_h;
-	int		(*libld_main)(int, char **);
-	unsigned char	class;
+	uchar_t 	class;
 
 	/*
-	 * XX64 -- Strip "-Wl," from the head of each argument.
-	 * This is to accommodate awkwardness in pasing ld arguments
-	 * to gcc while maintaining the structure of the build
-	 * environment's Makefiles.
+	 * XX64 -- Strip "-Wl," from the head of each argument.  This is to
+	 * accommodate awkwardness in passing ld arguments to gcc while
+	 * maintaining the structure of the OSNet build environment's Makefiles.
 	 */
 	{
 		int i;
@@ -330,52 +370,32 @@
 	}
 
 	/*
-	 * Locate the first input file and from it determine the class of
+	 * Locate the first input file and from this file determine the class of
 	 * objects we're going to process.  If the class is ELFCLASS64 we'll
-	 * specifically load libld.so.3, otherwise we'll fall back to
-	 * libld.so.2.  Note that if the option -64 is encountered a 64-bit
-	 * link is explicitly being requested.
+	 * call the ELF64 class of interfaces, else the ELF32 class.  Note that
+	 * if the option -64 is encountered a 64-bit link is explicitly being
+	 * requested.
 	 */
 	if ((class = determine_class(argc, argv)) == 0)
 		return (1);
 
 	/*
-	 * dlopen() right libld implementation.  Note: the RTLD_GLOBAL flag is
-	 * added to make ld behave as if libld was one of its dependencies.
-	 * Support libraries, like libldstab.so.1, may expect this, to get at
-	 * libld_malloc, which they argueably shouldn't be using anyway.
+	 * If we're on a 64-bit kernel, try to exec a full 64-bit version of ld.
 	 */
-	if (class == ELFCLASS64) {
-		/*
-		 * If we're on a 64-bit kernel, try to exec a full 64-bit
-		 * version of ld.
-		 */
+	if (class == ELFCLASS64)
 		conv_check_native(oargv, envp);
-		libld = MSG_ORIG(MSG_LD_LIB64);
-	}
-	if ((libld_h = dlopen(libld, (RTLD_LAZY | RTLD_GLOBAL))) == NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_DLOPEN), libld, dlerror());
-		return (1);
-	}
 
 	/*
-	 * Find ld_main(), which is ld's generic entry point.
-	 */
-	if ((libld_main = (int (*)(int, char **))dlsym(libld_h,
-	    MSG_ORIG(MSG_LD_MAIN))) == NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_DLSYM), libld, dlerror());
-		return (1);
-	}
-
-	/*
-	 * Reset the arg counter and getopt(3c) error message flag and call the
-	 * generic entry point.
+	 * Reset the getopt(3c) error message flag, and call the generic entry
+	 * point using the appropriate class.
 	 */
 	optind = opterr = 1;
-	return (libld_main(argc, argv));
+	if (class == ELFCLASS64)
+		return (ld64_main(argc, argv));
+	else
+		return (ld32_main(argc, argv));
 }
 
-
 /*
  * Exported interfaces required by our dependencies.  libld and friends bind to
  * the different implementations of these provided by either ld or ld.so.1.
@@ -385,42 +405,3 @@
 {
 	return (gettext(MSG_ORIG(mid)));
 }
-
-/*
- * Print a message to stdout
- */
-/* VARARGS2 */
-void
-eprintf(Error error, const char *format, ...)
-{
-	va_list			args;
-	static const char	*strings[ERR_NUM] = { MSG_ORIG(MSG_STR_EMPTY) };
-
-	if (error > ERR_NONE) {
-		if (error == ERR_WARNING) {
-			if (strings[ERR_WARNING] == 0)
-			    strings[ERR_WARNING] = MSG_INTL(MSG_ERR_WARNING);
-		} else if (error == ERR_FATAL) {
-			if (strings[ERR_FATAL] == 0)
-			    strings[ERR_FATAL] = MSG_INTL(MSG_ERR_FATAL);
-		} else if (error == ERR_ELF) {
-			if (strings[ERR_ELF] == 0)
-			    strings[ERR_ELF] = MSG_INTL(MSG_ERR_ELF);
-		}
-		(void) fputs(MSG_ORIG(MSG_STR_LDDIAG), stderr);
-	}
-	(void) fputs(strings[error], stderr);
-
-	va_start(args, format);
-	(void) vfprintf(stderr, format, args);
-	if (error == ERR_ELF) {
-		int	elferr;
-
-		if ((elferr = elf_errno()) != 0)
-			(void) fprintf(stderr, MSG_ORIG(MSG_STR_ELFDIAG),
-			    elf_errmsg(elferr));
-	}
-	(void) fprintf(stderr, MSG_ORIG(MSG_STR_NL));
-	(void) fflush(stderr);
-	va_end(args);
-}
--- a/usr/src/cmd/sgs/ld/common/ld.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/common/ld.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,7 +18,12 @@
 #
 # CDDL HEADER END
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ _START_
 
@@ -33,8 +34,8 @@
 # System error messages
 
 @ MSG_SYS_OPEN		"file %s: open failed: %s"
-@ MSG_SYS_DLOPEN	"file %s: dlopen failed: %s"
-@ MSG_SYS_DLSYM		"file %s: dlsym failed: %s"
+
+@ MSG_SYS_ALLOC		"alloc failed: %s"
 
 # Generic error diagnostic labels
 
@@ -49,10 +50,6 @@
 # Reference to this strings is via the MSG_ORIG() macro, and thus no message
 # translation is required.
 
-@ MSG_LD_MAIN		"ld_main"
-@ MSG_LD_LIB32		"libld.so.2"
-@ MSG_LD_LIB64		"libld.so.3"
-
 @ MSG_STR_EMPTY		""
 @ MSG_STR_NL		"\n"
 @ MSG_STR_LDDIAG	"ld: "
--- a/usr/src/cmd/sgs/ld/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -23,7 +22,7 @@
 /* PROTOLIB1 */
 
 /*
- * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,11 +33,11 @@
  */
 
 #include <stdlib.h>
-#include "debug.h"
+#include <debug.h>
 #include "msg.h"
 
 void
 exit(int status)
 {
-	dbg_print(_ld_msg((Msg)&__ld_msg[0]), status);
+	dbg_print(0, _ld_msg((Msg)&__ld_msg[0]), status);
 }
--- a/usr/src/cmd/sgs/ld/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -25,12 +19,18 @@
 # CDDL HEADER END
 #
 
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 # Specify what global symbols we export.  Note that we're not really
 # interested in declaring a version, simply scoping the file is sufficient.
 
 {
 	global:
-		main;			# Provides basic adb symbol offsets
+		main;
 		eprintf;
 	local:
 		*;
--- a/usr/src/cmd/sgs/ld/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ld/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,13 +28,18 @@
 
 include		../Makefile.com
 
+LDLIBDIR =	$(LDLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+
+VAR_LD_LLDFLAGS = \
+		$(VAR_LD_LLDFLAGS64)
+
 .KEEP_STATE:
 
-LLDLIBS =	$(LLDLIBS64)
-LLDFLAGS =	$(LLDFLAGS64)
-LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
-
-ROOTCCSBINPROG=	$(ROOTCCSBINPROG64)
+ROOTCCSBINPROG = \
+		$(ROOTCCSBINPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/ldd/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/ldd/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -50,7 +50,7 @@
 		$(CPPFLAGS.master)
 LDFLAGS +=	$(VERSREF) $(USE_PROTO) -M$(MAPFILE) \
 		'-R$$ORIGIN/../lib'
-LDLIBS +=	$(CONVLIBDIR) -lconv -lelf $(DLLIB)
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lelf $(DLLIB)
 LINTFLAGS +=	-x
 
 BLTDEFS=        msg.h
--- a/usr/src/cmd/sgs/libconv/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/libconv/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,35 +18,50 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
+
+LIBRARY =	libconv.a
 
-LIBRARY=	libconv.a
+COMOBJS32 =	cap32.o			dynamic32.o \
+		elf32.o			globals32.o \
+		phdr32.o		\
+		relocate_i38632.o	relocate_amd6432.o \
+		relocate_sparc32.o	sections32.o \
+		symbols32.o		symbols_sparc32.o
 
-COMOBJS_MSG=	arch.o			config.o \
+COMOBJS64 =	cap64.o			dynamic64.o \
+		elf64.o			globals64.o \
+		phdr64.o		\
+		relocate_i38664.o	relocate_amd6464.o \
+		relocate_sparc64.o	sections64.o \
+		symbols64.o		symbols_sparc64.o
+
+COMOBJS=	arch.o			config.o \
 		data.o			deftag.o \
-		dl.o			dynamic.o \
-		elf.o			globals.o \
-		dwarf_ehe.o \
-		cap.o			group.o \
-		relocate_amd64.o \
-		lddstub.o		phdr.o \
-		relocate_i386.o		relocate_sparc.o \
-		sections.o		segments.o \
-		symbols.o		symbols_sparc.o \
+		demangle.o		dl.o \
+		dwarf_ehe.o		group.o	\
+		lddstub.o		segments.o \
 		version.o
 
-COMOBJS_NOMSG=	relocate.o		tokens.o
+COMOBJS_NOMSG =	tokens.o
+
+COMOBJS_NOMSG32 = \
+		relocate32.o
+COMOBJS_NOMSG64 = \
+		relocate64.o
 
 ELFCAP_OBJS=	elfcap.o
 
 ASOBJS=		vernote.o
 
-OBJECTS=	$(COMOBJS_MSG) $(COMOBJS_NOMSG) $(ELFCAP_OBJS) $(ASOBJS)
+OBJECTS =	$(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(COMOBJS_NOMSG) \
+		$(COMOBJS_NOMSG32) $(COMOBJS_NOMSG64) $(ELFCAP_OBJS) $(ASOBJS)
 
 ELFCAP=		$(SRC)/common/elfcap
 
@@ -56,8 +70,8 @@
 # Since static archives should never contain CTF data (regardless of
 # whether the object code is position-independent), we disable CTF.
 #
-NOCTFOBJS=	$(OBJECTS)
-CTFMERGE_LIB=	:
+NOCTFOBJS =	$(OBJECTS)
+CTFMERGE_LIB =	:
 
 include 	$(SRC)/lib/Makefile.lib
 include 	$(SRC)/cmd/sgs/Makefile.com
@@ -73,21 +87,25 @@
 
 AS_CPPFLAGS=	-P -D_ASM $(CPPFLAGS)
 
-BLTDATA=	$(COMOBJS_MSG:%.o=%_msg.h)
+BLTDATA=	$(COMOBJS:%.o=%_msg.h) \
+		    $(COMOBJS32:%.o=%_msg.h) $(COMOBJS64:%.o=%_msg.h)
 
 SRCS=		../common/llib-lconv
-LINTSRCS=	$(COMOBJS_MSG:%.o=../common/%.c) \
-		$(COMOBJS_NOMSG:%.o=../common/%.c) \
-		$(ELFCOM_OBJS:%.o=$(ELFCAP)/%.c) \
-		../common/lintsup.c
+LINTSRCS=	$(COMOBJS:%.o=../common/%.c) \
+		    $(COMOBJS_NOMSG:%.o=../common/%.c) \
+		    $(ELFCOM_OBJS:%.o=$(ELFCAP)/%.c) ../common/lintsup.c
+LINTSRCS32 =	$(COMOBJS32:%32.o=../common/%.c)
+LINTSRCS64 =	$(COMOBJS64:%64.o=../common/%.c)
 
 VERNOTE_DEBUG= -D
 $(INTERNAL_RELEASE_BUILD)VERNOTE_DEBUG=
 
-SGSMSGTARG=	$(COMOBJS_MSG:%.o=../common/%.msg)
+SGSMSGTARG=	$(COMOBJS:%.o=../common/%.msg) \
+		    $(COMOBJS32:%32.o=../common/%.msg) \
+		    $(COMOBJS64:%64.o=../common/%.msg)
 
 LINTFLAGS +=	-u
 LINTFLAGS64 +=	-u
 
 CLEANFILES +=	$(BLTDATA) $(LINTOUTS) bld_vernote vernote.s
-CLOBBERFILES +=	$(LINTLIB)
+CLOBBERFILES +=	$(LINTLIBS)
--- a/usr/src/cmd/sgs/libconv/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
 
 pics/%.o:	../common/%.c
 		$(COMPILE.c) -o $@ $<
@@ -34,6 +34,14 @@
 		$(COMPILE.s) -o $@ $<
 		$(POST_PROCESS_O)
 
+pics/%32.o:	../common/%.c
+		$(COMPILE.c) -o $@ $<
+		$(POST_PROCESS_O)
+
+pics/%64.o:	../common/%.c
+		$(COMPILE.c) -D_ELF64 -o $@ $<
+		$(POST_PROCESS_O)
+
 pics/elfcap.o:	$(ELFCAP)/elfcap.c
 		$(COMPILE.c) -DCAP_UPPERCASE -o $@ $(ELFCAP)/elfcap.c
 		$(POST_PROCESS_O)
@@ -64,10 +72,10 @@
 chkmsg:		$(LINTSRCS)
 		sh $(CHKMSG) $(CHKMSGFLAGS) $(LINTSRCS)
 
-lint:		$(LINTLIB) $(LINTOUT32) $(SGSLINTOUT)
+.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
 
-$(LINTLIB): $$(SRCS)
-		$(LINT.c) -o $(LIBNAME) $(SRCS) > $(LINTOUT) 2>&1
+lint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
+		    .WAIT $(SGSLINTOUT)
 
 catalog:
 
--- a/usr/src/cmd/sgs/libconv/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,8 +31,6 @@
 .PARALLEL:	$(PICS)
 .KEEP_STATE:
 
-CPPFLAGS +=	-D_ELF64
-
 install all:	$(LIBRARY) .WAIT
 
 include 	../Makefile.targ
--- a/usr/src/cmd/sgs/libconv/common/_conv.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/_conv.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 1998,2003 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #ifndef	__CONV_DOT_H
@@ -39,16 +39,24 @@
 #endif
 
 /*
- * Various values that can't be matched to a symbolic definition will be
- * converted to a numeric string.  Each function that may require this
- * fallback maintains its own static string buffer, as many conversion
- * routines may be called for one final diagnostic.
- *
- * Most strings are printed as a 10.10s, but the string size is big
- * enough for any 32 bit value.
+ * Some format strings differ depending on whether they are used for 32-bit
+ * or 64-bit values.
  */
-#define	STRSIZE		12
-#define	STRSIZE64	24
+#if	defined(_ELF64)
+#define	MSG_GBL_FMT_DEC		MSG_GBL_FMT_DEC_64
+#define	MSG_GBL_FMT_DECS	MSG_GBL_FMT_DECS_64
+#define	MSG_GBL_FMT_HEX		MSG_GBL_FMT_HEX_64
+#define	MSG_GBL_FMT_HEXS	MSG_GBL_FMT_HEXS_64
+
+#define	MSG_SYM_FMT_VAL		MSG_SYM_FMT_VAL_64
+#else
+#define	MSG_GBL_FMT_DEC		MSG_GBL_FMT_DEC_32
+#define	MSG_GBL_FMT_DECS	MSG_GBL_FMT_DECS_32
+#define	MSG_GBL_FMT_HEX		MSG_GBL_FMT_HEX_32
+#define	MSG_GBL_FMT_HEXS	MSG_GBL_FMT_HEXS_32
+
+#define	MSG_SYM_FMT_VAL		MSG_SYM_FMT_VAL_32
+#endif
 
 #ifdef	__cplusplus
 }
--- a/usr/src/cmd/sgs/libconv/common/arch.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/arch.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -29,8 +29,6 @@
 #include	<unistd.h>
 #include	<string.h>
 #include	<sys/systeminfo.h>
-#include	<sys/param.h>
-#include	<sys/auxv.h>
 #include	"_conv.h"
 #include	"arch_msg.h"
 
@@ -39,7 +37,7 @@
  * Return the corresponding EI_CLASS constant.
  */
 int
-conv_sys_eclass()
+conv_sys_eclass(void)
 {
 	char buf[BUFSIZ];
 
@@ -62,7 +60,7 @@
 void
 conv_check_native(char **argv, char **envp)
 {
-	/* ia32 & 64-bit sparc version does nothing */
+	/* 64-bit version does nothing */
 }
 
 #else
--- a/usr/src/cmd/sgs/libconv/common/cap.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/cap.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -30,14 +30,13 @@
  */
 #include	<strings.h>
 #include	<stdio.h>
-#include	<limits.h>
 #include	<sys/machelf.h>
 #include	<elfcap.h>
 #include	"_conv.h"
 #include	"cap_msg.h"
 
-void
-conv_cap_1_str(uint64_t val, char *str, size_t len, ushort_t mach,
+static int
+conv_cap_1(Xword val, char *str, size_t len, Half mach,
     int (*fptr)(uint64_t, char *, size_t, int, ushort_t))
 {
 	size_t	_len;
@@ -47,68 +46,79 @@
 	len -= _len;
 	str += _len;
 
-	if ((*fptr)(val, str, len, CAP_FMT_DBLSPACE, mach) == 0) {
-		_len = strlen(str);
+	if ((*fptr)(val, str, len, CAP_FMT_DBLSPACE, mach) != 0)
+		return (0);
 
-		if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) {
-			str += _len;
-			(void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT));
-		}
+	_len = strlen(str);
+	if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) {
+		str += _len;
+		(void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT));
 	}
+	return (1);
 }
 
-#define	HW1SZ	100
+/*
+ * Establish a buffer size based on the maximum number of hardware capabilities
+ * that exist.  See common/elfcap.
+ */
+#define	HW1SZ	200
 
 const char *
-conv_hwcap_1_str(uint64_t val, ushort_t mach)
+conv_cap_val_hw1(Xword val, Half mach)
 {
-	static char	string[HW1SZ] = { '\0' };
+	static char	string[HW1SZ];
 
 	if (val == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
 
-	conv_cap_1_str(val, string, HW1SZ, mach, hwcap_1_val2str);
+	if (conv_cap_1(val, string, HW1SZ, mach, hwcap_1_val2str) == 0)
+		return (conv_invalid_val(string, HW1SZ, val, 0));
 	return ((const char *)string);
 }
 
-#define	SF1SZ	40
+/*
+ * Establish a buffer size based on the maximum number of software capabilities
+ * that exist.  See common/elfcap.
+ */
+#define	SF1SZ	50
 
 const char *
-conv_sfcap_1_str(uint64_t val, ushort_t mach)
+conv_cap_val_sf1(Xword val, Half mach)
 {
-	static char	string[SF1SZ] = { '\0' };
+	static char	string[SF1SZ];
 
 	if (val == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
 
-	conv_cap_1_str(val, string, SF1SZ, mach, sfcap_1_val2str);
+	if (conv_cap_1(val, string, SF1SZ, mach, sfcap_1_val2str) == 0)
+		return (conv_invalid_val(string, SF1SZ, val, 0));
 	return ((const char *)string);
 }
 
-static const Msg cap_tags[] = {
-	MSG_CA_SUNW_NULL,	MSG_CA_SUNW_HW_1,	MSG_CA_SUNW_SF_1
-};
-
 const char *
-conv_captag_str(uint64_t tag)
+conv_cap_tag(Xword tag)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	tags[] = {
+		MSG_CA_SUNW_NULL,	MSG_CA_SUNW_HW_1,
+		MSG_CA_SUNW_SF_1
+	};
 
 	if (tag <= CA_SUNW_SF_1)
-		return (MSG_ORIG(cap_tags[tag]));
+		return (MSG_ORIG(tags[tag]));
 	else
-		return (conv_invalid_str(string, STRSIZE, tag, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, tag, 0));
 }
 
 const char *
-conv_capval_str(uint64_t tag, uint64_t val, ushort_t mach)
+conv_cap_val(Xword tag, Xword val, Half mach)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (tag == CA_SUNW_HW_1)
-		return (conv_hwcap_1_str(val, mach));
+		return (conv_cap_val_hw1(val, mach));
 	else if (tag == CA_SUNW_SF_1)
-		return (conv_sfcap_1_str(val, mach));
+		return (conv_cap_val_sf1(val, mach));
 	else
-		return (conv_invalid_str(string, STRSIZE, val, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, val, 0));
 }
--- a/usr/src/cmd/sgs/libconv/common/config.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/config.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -32,64 +32,62 @@
 #include	"_conv.h"
 #include	"config_msg.h"
 
-#define	MODESZ	MSG_GBL_OSQBRKT_SIZE + \
+#define	FEATSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_CONF_EDLIBPATH_SIZE + \
+		MSG_CONF_ESLIBPATH_SIZE + \
 		MSG_CONF_ADLIBPATH_SIZE + \
-		MSG_CONF_ESLIBPATH_SIZE + \
 		MSG_CONF_ASLIBPATH_SIZE + \
 		MSG_CONF_DIRCFG_SIZE + \
 		MSG_CONF_OBJALT_SIZE + \
+		MSG_CONF_MEMRESV_SIZE + \
 		MSG_CONF_ENVS_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		MSG_CONF_FLTR_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 /*
  * String conversion routine for configuration file information.
  */
 const char *
-conv_config_str(int feature)
+conv_config_feat(int features)
 {
-	static	char	string[MODESZ] = { '\0' };
-
-	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
+	static	char	string[FEATSZ];
+	static Val_desc	vda[] = {
+		{ CONF_EDLIBPATH,	MSG_ORIG(MSG_CONF_EDLIBPATH) },
+		{ CONF_ESLIBPATH,	MSG_ORIG(MSG_CONF_ESLIBPATH) },
+		{ CONF_ADLIBPATH,	MSG_ORIG(MSG_CONF_ADLIBPATH) },
+		{ CONF_ASLIBPATH,	MSG_ORIG(MSG_CONF_ASLIBPATH) },
+		{ CONF_DIRCFG,		MSG_ORIG(MSG_CONF_DIRCFG) },
+		{ CONF_OBJALT,		MSG_ORIG(MSG_CONF_OBJALT) },
+		{ CONF_MEMRESV,		MSG_ORIG(MSG_CONF_MEMRESV) },
+		{ CONF_ENVS,		MSG_ORIG(MSG_CONF_ENVS) },
+		{ CONF_FLTR,		MSG_ORIG(MSG_CONF_FLTR) },
+		{ 0,			0 }
+	};
 
-	if (feature & CONF_EDLIBPATH)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_EDLIBPATH));
-	if (feature & CONF_ESLIBPATH)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_ESLIBPATH));
-	if (feature & CONF_ADLIBPATH)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_ADLIBPATH));
-	if (feature & CONF_ASLIBPATH)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_ASLIBPATH));
-	if (feature & CONF_DIRCFG)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_DIRCFG));
-	if (feature & CONF_OBJALT)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_OBJALT));
-	if (feature & CONF_MEMRESV)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_MEMRESV));
-	if (feature & CONF_ENVS)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_ENVS));
-	if (feature & CONF_FLTR)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_FLTR));
-
-	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ);
+	if (conv_expn_field(string, FEATSZ, vda, features,
+	    features, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ);
 
 	return ((const char *)string);
 }
 
 #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_CONF_DIRENT_SIZE + \
+		MSG_CONF_ALLENTS_SIZE + \
 		MSG_CONF_NOEXIST_SIZE + \
-		MSG_CONF_ALLENTS_SIZE + \
 		MSG_CONF_EXEC_SIZE + \
 		MSG_CONF_ALTER_SIZE + \
+		MSG_CONF_OPTIONAL_SIZE + \
 		MSG_CONF_DUMP_SIZE + \
 		MSG_CONF_REALPATH_SIZE + \
+		MSG_CONF_NOALTER_SIZE + \
 		MSG_CONF_GROUP_SIZE + \
 		MSG_CONF_APP_SIZE + \
 		MSG_CONF_CMDLINE_SIZE + \
 		MSG_CONF_FILTER_SIZE + \
 		MSG_CONF_FILTEE_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 /*
  * String conversion routine for object flags.
@@ -97,45 +95,46 @@
 const char *
 conv_config_obj(ushort_t flags)
 {
-	static char	string[FLAGSZ] = { '\0' };
-
-	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
+	static char	string[FLAGSZ];
+	static Val_desc vda[] = {
+		{ RTC_OBJ_DIRENT,	MSG_ORIG(MSG_CONF_DIRENT) },
+		{ RTC_OBJ_ALLENTS,	MSG_ORIG(MSG_CONF_ALLENTS) },
+		{ RTC_OBJ_NOEXIST,	MSG_ORIG(MSG_CONF_NOEXIST) },
+		{ RTC_OBJ_EXEC,		MSG_ORIG(MSG_CONF_EXEC) },
+		{ RTC_OBJ_ALTER,	MSG_ORIG(MSG_CONF_ALTER) },
+		{ RTC_OBJ_DUMP,		MSG_ORIG(MSG_CONF_DUMP) },
+		{ RTC_OBJ_NOALTER,	MSG_ORIG(MSG_CONF_NOALTER) },
+		{ RTC_OBJ_REALPTH,	MSG_ORIG(MSG_CONF_REALPATH) },
+		{ RTC_OBJ_GROUP,	MSG_ORIG(MSG_CONF_GROUP) },
+		{ RTC_OBJ_APP,		MSG_ORIG(MSG_CONF_APP) },
+		{ RTC_OBJ_CMDLINE,	MSG_ORIG(MSG_CONF_CMDLINE) },
+		{ RTC_OBJ_FILTER,	MSG_ORIG(MSG_CONF_FILTER) },
+		{ RTC_OBJ_FILTEE,	MSG_ORIG(MSG_CONF_FILTEE) },
+		{ 0,			0 }
+	};
+	ushort_t	_flags = flags;
 
-	if (flags & RTC_OBJ_DIRENT)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_DIRENT));
-	if (flags & RTC_OBJ_ALLENTS)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_ALLENTS));
-	if (flags & RTC_OBJ_NOEXIST)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_NOEXIST));
-	if (flags & RTC_OBJ_EXEC)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_EXEC));
-	if (flags & RTC_OBJ_ALTER) {
-		if (flags & RTC_OBJ_OPTINAL)
-			(void) strcat(string, MSG_ORIG(MSG_CONF_OPTIONAL));
-		else
-			(void) strcat(string, MSG_ORIG(MSG_CONF_ALTER));
+	if ((flags == 0) || (flags == RTC_OBJ_OPTINAL))
+		return (MSG_ORIG(MSG_GBL_NULL));
+
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
+
+	/*
+	 * Print an alternative-optional object simply as optional.
+	 */
+	if ((flags & (RTC_OBJ_ALTER | RTC_OBJ_OPTINAL)) ==
+	    (RTC_OBJ_ALTER | RTC_OBJ_OPTINAL)) {
+		if (strlcat(string, MSG_ORIG(MSG_CONF_OPTIONAL),
+		    FLAGSZ) >= FLAGSZ)
+			return (conv_invalid_val(string, FLAGSZ, flags, 0));
+		flags = _flags &= ~(RTC_OBJ_ALTER | RTC_OBJ_OPTINAL);
 	}
-	if (flags & RTC_OBJ_DUMP)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_DUMP));
-	if (flags & RTC_OBJ_REALPTH)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_REALPATH));
-	if (flags & RTC_OBJ_GROUP)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_GROUP));
-	if (flags & RTC_OBJ_APP)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_APP));
-	if (flags & RTC_OBJ_CMDLINE)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_CMDLINE));
-	if (flags & RTC_OBJ_FILTER)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_FILTER));
-	if (flags & RTC_OBJ_FILTEE)
-		(void) strcat(string, MSG_ORIG(MSG_CONF_FILTEE));
+	flags = _flags &= ~RTC_OBJ_OPTINAL;
 
-	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	if (conv_expn_field(string, FLAGSZ, vda, flags, _flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 
-	if (strlen(string) == (MSG_GBL_OSQBRKT_SIZE + MSG_GBL_CSQBRKT_SIZE))
-		return (MSG_ORIG(MSG_GBL_NULL));
-	else
-		return ((const char *)string);
+	return ((const char *)string);
 }
 
 /*
@@ -149,7 +148,7 @@
  *	/local/lib:/opt/sfw/lib:/lib:/usr/lib
  */
 const char *
-conv_upm_string(const char *str, const char *old, const char *new,
+conv_config_upm(const char *str, const char *old, const char *new,
     size_t newlen)
 {
 	const char	*curstr, *ptr;
--- a/usr/src/cmd/sgs/libconv/common/config.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/config.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,6 +18,11 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 # Message file for cmd/sgs/libconv/common/config.c
@@ -44,6 +45,7 @@
 @ MSG_CONF_ALTER	" ALTERNATE "
 @ MSG_CONF_DUMP		" DUMPED "
 @ MSG_CONF_REALPATH	" REALPATH "
+@ MSG_CONF_NOALTER	" NO-ALTERNATE "
 @ MSG_CONF_GROUP	" GROUP "
 @ MSG_CONF_APP		" SPECIFIC-APP "
 @ MSG_CONF_CMDLINE	" COMMAND-LINE "
--- a/usr/src/cmd/sgs/libconv/common/data.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/data.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,36 +18,40 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
  * String conversion routine for Elf data buffer types.
  */
-#include	<stdio.h>
 #include	"_conv.h"
 #include	"data_msg.h"
 
-static const Msg types[] = {
-	MSG_DATA_BYTE,		MSG_DATA_ADDR,		MSG_DATA_DYN,
-	MSG_DATA_EHDR,		MSG_DATA_HALF,		MSG_DATA_OFF,
-	MSG_DATA_PHDR,		MSG_DATA_RELA,		MSG_DATA_REL,
-	MSG_DATA_SHDR,		MSG_DATA_SWORD,		MSG_DATA_SYM,
-	MSG_DATA_WORD,		MSG_DATA_VDEF,		MSG_DATA_VNEED,
-	MSG_DATA_SXWORD,	MSG_DATA_XWORD,		MSG_DATA_SYMINFO,
-	MSG_DATA_NOTE,		MSG_DATA_MOVE,		MSG_DATA_MOVEP
-};
-
 const char *
-conv_d_type_str(Elf_Type type)
+conv_elfdata_type(Elf_Type type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	types[] = {
+		MSG_DATA_BYTE,		MSG_DATA_ADDR,
+		MSG_DATA_DYN,		MSG_DATA_EHDR,
+		MSG_DATA_HALF,		MSG_DATA_OFF,
+		MSG_DATA_PHDR,		MSG_DATA_RELA,
+		MSG_DATA_REL,		MSG_DATA_SHDR,
+		MSG_DATA_SWORD,		MSG_DATA_SYM,
+		MSG_DATA_WORD,		MSG_DATA_VDEF,
+		MSG_DATA_VNEED,		MSG_DATA_SXWORD,
+		MSG_DATA_XWORD,		MSG_DATA_SYMINFO,
+		MSG_DATA_NOTE,		MSG_DATA_MOVE,
+		MSG_DATA_MOVEP,		MSG_DATA_CAP
+	};
 
 	if (type >= ELF_T_NUM)
-		return (conv_invalid_str(string, STRSIZE, type, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 	else
 		return (MSG_ORIG(types[type]));
 }
--- a/usr/src/cmd/sgs/libconv/common/data.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/data.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,12 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Message file for cmd/sgs/libconv/common/data.c
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_DATA_BYTE		"BYTE"
 @ MSG_DATA_ADDR		"ADDR"
@@ -47,3 +46,4 @@
 @ MSG_DATA_NOTE		"NOTE"
 @ MSG_DATA_MOVE		"MOVE"
 @ MSG_DATA_MOVEP	"MOVEP"
+@ MSG_DATA_CAP		"CAP"
--- a/usr/src/cmd/sgs/libconv/common/deftag.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/deftag.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,21 +28,19 @@
 /*
  * String conversion routine for symbol references.
  */
-#include	<stdio.h>
 #include	"_conv.h"
 #include	"deftag_msg.h"
 
-static const Msg refs[] = {
-	MSG_REF_DYN_SEEN,	MSG_REF_DYN_NEED,	MSG_REF_REL_NEED
-};
-
 const char *
-conv_deftag_str(Symref ref)
+conv_def_tag(Symref ref)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	refs[] = {
+		MSG_REF_DYN_SEEN,	MSG_REF_DYN_NEED,	MSG_REF_REL_NEED
+	};
 
 	if (ref >= REF_NUM)
-		return (conv_invalid_str(string, STRSIZE, ref, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, ref, 0));
 	else
 		return (MSG_ORIG(refs[ref]));
 }
--- a/usr/src/cmd/sgs/libconv/common/deftag.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/deftag.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,12 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Message file for cmd/sgs/libconv/common/deftag.c
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_REF_DYN_SEEN	"REF_DYN_SEEN"
 @ MSG_REF_DYN_NEED	"REF_DYN_NEED"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libconv/common/demangle.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<stdio.h>
+#include	<demangle.h>
+#include	"_conv.h"
+#include	"demangle_msg.h"
+
+/*
+ * Demangle C++ symbols.
+ *
+ * This routine acts as a generic routine for use by liblddbg (and hence tools
+ * like elfdump(1) and pvs(1)), ld(1) and ld.so.1(1).
+ *
+ * The C++ ABI-2 places no limits on symbol names, thus when demangling a name
+ * it's possible the buffer won't be big enough (DEMANGLE_ESPACE) so here we
+ * try to allocate bigger buffers.  However, we place a limit on this buffer
+ * size for fear of a C++ error sending us into an infinit loop.
+ *
+ * NOTE. we create and use a common buffer for use by cplus_demangle(), thus
+ * each call to this routine will override the contents of any existing call.
+ * Normally this is sufficient for typical error diagnostics referencing one
+ * symbol.  For those diagnostics using more than one symbol name, all but the
+ * last name must be copied to a temporary buffer (regardless of whether
+ * demangling occurred, as the process of attempting to demangle may damage the
+ * buffer).  One model is:
+ *
+ *	if ((_name1 = demangle(name1)) != name1) {
+ *		char *	__name1 = alloca(strlen(_name1) + 1);
+ *		(void) strcpy(__name1, _name1);
+ *		name1 = (const char *)__name1;
+ *	}
+ *	name2 = demangle(name2);
+ *	eprintf(format, name1, name2);
+ */
+#define	SYM_MAX	1000
+
+const char *
+conv_demangle_name(const char *name)
+{
+	static char	_str[SYM_MAX], *str = _str;
+	static size_t	size = SYM_MAX;
+	static int	again = 1;
+	static int	(*fptr)() = 0;
+	int		error;
+
+	if (str == 0)
+		return (name);
+
+	/*
+	 * If we haven't located the demangler yet try now (we do this rather
+	 * than maintain a static dependency on libdemangle as it's part of an
+	 * optional package).  Null the str element out to reject any other
+	 * callers until this operation is complete - under ld.so.1 we can get
+	 * into serious recursion without this.
+	 */
+	if (fptr == 0) {
+		void	*hdl;
+
+		str = 0;
+		if (!(hdl = dlopen(MSG_ORIG(MSG_DEM_LIB), RTLD_LAZY)) ||
+		    !(fptr = (int (*)())dlsym(hdl, MSG_ORIG(MSG_DEM_SYM))))
+			return (name);
+		str = _str;
+	}
+
+	if ((error = (*fptr)(name, str, size)) == 0)
+		return ((const char *)str);
+
+	while ((error == DEMANGLE_ESPACE) && again) {
+		char	*_str;
+		size_t	_size = size;
+
+		/*
+		 * If we haven't allocated our maximum try incrementing the
+		 * present buffer size. Use malloc() rather than realloc() so
+		 * that we at least have the old buffer on failure.
+		 */
+		if (((_size += SYM_MAX) > (SYM_MAX * 4)) ||
+		    ((_str = malloc(_size)) == 0)) {
+			again = 0;
+			break;
+		}
+		if (size != SYM_MAX) {
+			free(str);
+		}
+		str = _str;
+		size = _size;
+
+		if ((error = (*fptr)(name, str, size)) == 0)
+			return ((const char *)str);
+	}
+	return (name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libconv/common/demangle.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,30 @@
+#
+# 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"
+#
+
+@ MSG_DEM_SYM		"cplus_demangle"
+@ MSG_DEM_LIB		"libdemangle.so.1"
--- a/usr/src/cmd/sgs/libconv/common/dl.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/dl.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -31,78 +31,72 @@
 
 #define	MODESZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_RTLD_LAZY_SIZE + \
+		MSG_RTLD_GLOBAL_SIZE + \
 		MSG_RTLD_NOLOAD_SIZE + \
-		MSG_RTLD_GLOBAL_SIZE + \
 		MSG_RTLD_PARENT_SIZE + \
 		MSG_RTLD_GROUP_SIZE + \
 		MSG_RTLD_WORLD_SIZE + \
 		MSG_RTLD_NODELETE_SIZE + \
 		MSG_RTLD_FIRST_SIZE + \
 		MSG_RTLD_CONFGEN_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
+
 
 /*
  * String conversion routine for dlopen() attributes.
  */
 const char *
-conv_dlmode_str(int mode, int fabricate)
+conv_dl_mode(int mode, int fabricate)
 {
-	static	char	string[MODESZ] = { '\0' };
+	static	char	string[MODESZ];
+	static Val_desc vda[] = {
+		{ RTLD_NOLOAD,		MSG_ORIG(MSG_RTLD_NOLOAD) },
+		{ RTLD_PARENT,		MSG_ORIG(MSG_RTLD_PARENT) },
+		{ RTLD_GROUP,		MSG_ORIG(MSG_RTLD_GROUP) },
+		{ RTLD_WORLD,		MSG_ORIG(MSG_RTLD_WORLD) },
+		{ RTLD_NODELETE,	MSG_ORIG(MSG_RTLD_NODELETE) },
+		{ RTLD_FIRST,		MSG_ORIG(MSG_RTLD_FIRST) },
+		{ RTLD_CONFGEN,		MSG_ORIG(MSG_RTLD_CONFGEN) },
+		{ 0,			0 }
+	};
+	int		_mode = mode;
 
 	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
 
-	if (mode & RTLD_NOW)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_NOW));
-	else if (fabricate)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_LAZY));
-
-	if (mode & RTLD_NOLOAD)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_NOLOAD));
-
-	if (mode & RTLD_GLOBAL)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_GLOBAL));
-	else if (fabricate)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_LOCAL));
+	if (mode & RTLD_NOW) {
+	    if (strlcat(string, MSG_ORIG(MSG_RTLD_NOW), MODESZ) >= MODESZ)
+		return (conv_invalid_val(string, MODESZ, mode, 0));
+	} else if (fabricate) {
+	    if (strlcat(string, MSG_ORIG(MSG_RTLD_LAZY), MODESZ) >= MODESZ)
+		return (conv_invalid_val(string, MODESZ, mode, 0));
+	}
+	if (mode & RTLD_GLOBAL) {
+	    if (strlcat(string, MSG_ORIG(MSG_RTLD_GLOBAL), MODESZ) >= MODESZ)
+		return (conv_invalid_val(string, MODESZ, mode, 0));
+	} else if (fabricate) {
+	    if (strlcat(string, MSG_ORIG(MSG_RTLD_LOCAL), MODESZ) >= MODESZ)
+		return (conv_invalid_val(string, MODESZ, mode, 0));
+	}
+	_mode &= ~(RTLD_LAZY | RTLD_NOW | RTLD_GLOBAL);
 
-	if (mode & RTLD_PARENT)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_PARENT));
-	if (mode & RTLD_GROUP)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_GROUP));
-	if (mode & RTLD_WORLD)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_WORLD));
-	if (mode & RTLD_NODELETE)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_NODELETE));
-	if (mode & RTLD_FIRST)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_FIRST));
-	if (mode & RTLD_CONFGEN)
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_CONFGEN));
-
-	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	if (conv_expn_field(string, MODESZ, vda, mode, _mode, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), MODESZ);
 
 	return ((const char *)string);
 }
 
 #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
-		MSG_RTLD_REL_RELATIVE_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_REL_EXEC_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_REL_DEPENDS_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_REL_PRELOAD_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_REL_SELF_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_REL_WEAK_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_MEMORY_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_STRIP_SIZE + \
-		MSG_GBL_SEP_SIZE + \
-		MSG_RTLD_NOHEAP_SIZE + \
-		MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_RELATIVE_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_EXEC_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_DEPENDS_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_PRELOAD_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_SELF_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_REL_WEAK_SIZE +	MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_MEMORY_SIZE +		MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_STRIP_SIZE +		MSG_GBL_SEP_SIZE + \
+		MSG_RTLD_NOHEAP_SIZE +		MSG_GBL_SEP_SIZE + \
 		MSG_RTLD_CONFSET_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 /*
  * String conversion routine for dldump() flags.
@@ -110,79 +104,46 @@
  * we build a "|" separated string.
  */
 const char *
-conv_dlflag_str(int flags, int separator)
+conv_dl_flag(int flags, int separator)
 {
-	static	char	string[FLAGSZ] = { '\0' };
-	int		element = 0;
+	static	char	string[FLAGSZ];
+	static Val_desc vda[] = {
+		{ RTLD_REL_RELATIVE,	MSG_ORIG(MSG_RTLD_REL_RELATIVE) },
+		{ RTLD_REL_EXEC,	MSG_ORIG(MSG_RTLD_REL_EXEC) },
+		{ RTLD_REL_DEPENDS,	MSG_ORIG(MSG_RTLD_REL_DEPENDS) },
+		{ RTLD_REL_PRELOAD,	MSG_ORIG(MSG_RTLD_REL_PRELOAD) },
+		{ RTLD_REL_SELF,	MSG_ORIG(MSG_RTLD_REL_SELF) },
+		{ RTLD_REL_WEAK,	MSG_ORIG(MSG_RTLD_REL_WEAK) },
+		{ RTLD_MEMORY,		MSG_ORIG(MSG_RTLD_MEMORY) },
+		{ RTLD_STRIP,		MSG_ORIG(MSG_RTLD_STRIP) },
+		{ RTLD_NOHEAP,		MSG_ORIG(MSG_RTLD_NOHEAP) },
+		{ RTLD_CONFSET,		MSG_ORIG(MSG_RTLD_CONFSET) },
+		{ 0,			0 }
+	};
+	int		_flags = flags, element = 0;
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
 
 	if (separator)
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_QUOTE));
+		(void) strlcpy(string, MSG_ORIG(MSG_GBL_QUOTE), FLAGSZ);
 	else
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
+		(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
 
 	if ((flags & RTLD_REL_ALL) == RTLD_REL_ALL) {
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_ALL));
-		element++;
-	} else {
-		if (flags & RTLD_REL_RELATIVE) {
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_RELATIVE));
-			element++;
-		}
-		if (flags & RTLD_REL_EXEC) {
-			if (separator && element++)
-				(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_EXEC));
-		}
-		if (flags & RTLD_REL_DEPENDS) {
-			if (separator && element++)
-				(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_DEPENDS));
-		}
-		if (flags & RTLD_REL_PRELOAD) {
-			if (separator && element++)
-				(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_PRELOAD));
-		}
-		if (flags & RTLD_REL_SELF) {
-			if (separator && element++)
-				(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_SELF));
-		}
-		if (flags & RTLD_REL_WEAK) {
-			if (separator && element++)
-				(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-			(void) strcat(string, MSG_ORIG(MSG_RTLD_REL_WEAK));
-		}
+	    if (strlcat(string, MSG_ORIG(MSG_RTLD_REL_ALL), FLAGSZ) >= FLAGSZ)
+		return (conv_invalid_val(string, FLAGSZ, flags, 0));
+	    element++;
+	    flags = _flags &= ~RTLD_REL_ALL;
 	}
 
-	if (flags & RTLD_MEMORY) {
-		if (separator && element++)
-			(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_MEMORY));
-	}
-	if (flags & RTLD_STRIP) {
-		if (separator && element++)
-			(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_STRIP));
+	if (conv_expn_field(string, FLAGSZ, vda, flags, _flags,
+	    (separator ? MSG_ORIG(MSG_GBL_SEP) : 0), element)) {
+		if (separator)
+		    (void) strlcat(string, MSG_ORIG(MSG_GBL_QUOTE), FLAGSZ);
+		else
+		    (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 	}
-	if (flags & RTLD_NOHEAP) {
-		if (separator && element++)
-			(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_NOHEAP));
-	}
-	if (flags & RTLD_CONFSET) {
-		if (separator && element++)
-			(void) strcat(string, MSG_ORIG(MSG_GBL_SEP));
-		(void) strcat(string, MSG_ORIG(MSG_RTLD_CONFSET));
-	}
-
-	if (separator)
-		(void) strcat(string, MSG_ORIG(MSG_GBL_QUOTE));
-	else
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
 
 	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,89 +18,96 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<strings.h>
-#include	<stdio.h>
-#include	<limits.h>
 #include	<dwarf.h>
 #include	<dwarf_ehe_msg.h>
+#include	"_conv.h"
 
-#define	STRBUFSIZE	128
+#define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
+		MSG_DWEHE_SLEB128_SIZE + \
+		MSG_DWEHE_INDIRECT_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
+
 const char *
-conv_dwarf_ehe_str(uint_t flags)
+conv_dwarf_ehe(uint_t flags)
 {
-	static char	string[STRBUFSIZE];
-
-	(void) strncpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), STRBUFSIZE);
+	static char	string[FLAGSZ];
+	size_t		ret = 0;
 
-	if (flags == DW_EH_PE_omit) {
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_OMIT), STRBUFSIZE);
-		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE);
-		return (string);
-	}
-	if (flags == DW_EH_PE_absptr) {
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), STRBUFSIZE);
-		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE);
+	(void) strncpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
+
+	if (flags == DW_EH_PE_omit)
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_OMIT), FLAGSZ);
+	else if (flags == DW_EH_PE_absptr)
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), FLAGSZ);
+
+	if (ret >= FLAGSZ)
+		return (conv_invalid_val(string, FLAGSZ, flags, 0));
+
+	if ((flags == DW_EH_PE_omit) || (flags == DW_EH_PE_absptr)) {
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 		return (string);
 	}
 
 	switch (flags & 0x0f) {
-	case DW_EH_PE_absptr:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), STRBUFSIZE);
-		break;
 	case DW_EH_PE_uleb128:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_ULEB128), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ULEB128), FLAGSZ);
 		break;
 	case DW_EH_PE_udata2:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA2), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA2), FLAGSZ);
 		break;
 	case DW_EH_PE_udata4:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA4), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA4), FLAGSZ);
 		break;
 	case DW_EH_PE_udata8:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA8), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA8), FLAGSZ);
 		break;
 	case DW_EH_PE_sleb128:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_SLEB128), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SLEB128), FLAGSZ);
 		break;
 	case DW_EH_PE_sdata2:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA2), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA2), FLAGSZ);
 		break;
 	case DW_EH_PE_sdata4:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA4), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA4), FLAGSZ);
 		break;
 	case DW_EH_PE_sdata8:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA8), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA8), FLAGSZ);
 		break;
 	}
+	if (ret >= FLAGSZ)
+		return (conv_invalid_val(string, FLAGSZ, flags, 0));
 
 	switch (flags & 0xf0) {
 	case DW_EH_PE_pcrel:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_PCREL), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_PCREL), FLAGSZ);
 		break;
 	case DW_EH_PE_textrel:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_TEXTREL), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_TEXTREL), FLAGSZ);
 		break;
 	case DW_EH_PE_datarel:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_DATAREL), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_DATAREL), FLAGSZ);
 		break;
 	case DW_EH_PE_funcrel:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_FUNCREL), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_FUNCREL), FLAGSZ);
 		break;
 	case DW_EH_PE_aligned:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_ALIGNED), STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ALIGNED), FLAGSZ);
 		break;
 	case DW_EH_PE_indirect:
-		(void) strlcat(string, MSG_ORIG(MSG_DWEHE_INDIRECT),
-			STRBUFSIZE);
+		ret = strlcat(string, MSG_ORIG(MSG_DWEHE_INDIRECT), FLAGSZ);
 		break;
 	}
+	if (ret >= FLAGSZ)
+		return (conv_invalid_val(string, FLAGSZ, flags, 0));
 
-	(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE);
+	(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 	return (string);
 }
--- a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,28 +18,31 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Message file for cmd/sgs/libconv/common/dwarf_ehe.c
+# ident	"%Z%%M%	%I%	%E% SMI"
 
+@ MSG_DWEHE_OMIT	" omit "
+@ MSG_DWEHE_ABSPTR	" absptr "
 
-@ MSG_DWEHE_OMIT	"omit "
-@ MSG_DWEHE_ABSPTR	"absptr "
-@ MSG_DWEHE_ULEB128	"uleb128 "
-@ MSG_DWEHE_UDATA2	"udata2 "
-@ MSG_DWEHE_UDATA4	"udata4 "
-@ MSG_DWEHE_UDATA8	"udata8 "
-@ MSG_DWEHE_SLEB128	"sleb128 "
-@ MSG_DWEHE_SDATA2	"sdata2 "
-@ MSG_DWEHE_SDATA4	"sdata4 "
-@ MSG_DWEHE_SDATA8	"sdata8 "
+@ MSG_DWEHE_ULEB128	" uleb128 "
+@ MSG_DWEHE_UDATA2	" udata2 "
+@ MSG_DWEHE_UDATA4	" udata4 "
+@ MSG_DWEHE_UDATA8	" udata8 "
+@ MSG_DWEHE_SLEB128	" sleb128 "
+@ MSG_DWEHE_SDATA2	" sdata2 "
+@ MSG_DWEHE_SDATA4	" sdata4 "
+@ MSG_DWEHE_SDATA8	" sdata8 "
 
-@ MSG_DWEHE_PCREL	"pcrel "
-@ MSG_DWEHE_TEXTREL	"textrel "
-@ MSG_DWEHE_DATAREL	"datarel "
-@ MSG_DWEHE_FUNCREL	"funcrel "
-@ MSG_DWEHE_ALIGNED	"aligned "
-@ MSG_DWEHE_INDIRECT	"indirect "
+@ MSG_DWEHE_PCREL	" pcrel "
+@ MSG_DWEHE_TEXTREL	" textrel "
+@ MSG_DWEHE_DATAREL	" datarel "
+@ MSG_DWEHE_FUNCREL	" funcrel "
+@ MSG_DWEHE_ALIGNED	" aligned "
+@ MSG_DWEHE_INDIRECT	" indirect "
 
-@ MSG_GBL_OSQBRKT	"[ "
+@ MSG_GBL_OSQBRKT	"["
 @ MSG_GBL_CSQBRKT	"]"
--- a/usr/src/cmd/sgs/libconv/common/dynamic.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/dynamic.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -38,60 +38,62 @@
 #define	POSSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_DFP_LAZYLOAD_SIZE + \
 		MSG_DFP_GROUPPERM_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_dynposflag_1_str(uint_t flags)
+conv_dyn_posflag1(Xword flags)
 {
-	static char	string[POSSZ] = { '\0' };
+	static char	string[POSSZ];
+	static Val_desc vda[] = {
+		{ DF_P1_LAZYLOAD,	MSG_ORIG(MSG_DFP_LAZYLOAD) },
+		{ DF_P1_GROUPPERM,	MSG_ORIG(MSG_DFP_GROUPPERM) },
+		{ 0,			0 }
+	};
+
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
 
-	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-
-	if (flags & DF_P1_LAZYLOAD)
-		(void) strcat(string, MSG_ORIG(MSG_DFP_LAZYLOAD));
-	if (flags & DF_P1_GROUPPERM)
-		(void) strcat(string, MSG_ORIG(MSG_DFP_GROUPPERM));
-
-	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), POSSZ);
+	if (conv_expn_field(string, POSSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), POSSZ);
 
 	return ((const char *)string);
 }
 
-#define	FLAGSZ	MSG_DF_ORIGIN_SIZE + \
+#define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
+		MSG_DF_ORIGIN_SIZE + \
 		MSG_DF_SYMBOLIC_SIZE + \
 		MSG_DF_TEXTREL_SIZE + \
 		MSG_DF_BIND_NOW_SIZE + \
-		MSG_DF_STATIC_TLS_SIZE
+		MSG_DF_STATIC_TLS_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_dynflag_str(uint_t flags)
+conv_dyn_flag(Xword flags)
 {
-	static char	string[FLAGSZ] = { '\0' };
+	static char	string[FLAGSZ];
+	static Val_desc vda[] = {
+		{ DF_ORIGIN,		MSG_ORIG(MSG_DF_ORIGIN) },
+		{ DF_SYMBOLIC,		MSG_ORIG(MSG_DF_SYMBOLIC) },
+		{ DF_TEXTREL,		MSG_ORIG(MSG_DF_TEXTREL) },
+		{ DF_BIND_NOW,		MSG_ORIG(MSG_DF_BIND_NOW) },
+		{ DF_STATIC_TLS,	MSG_ORIG(MSG_DF_STATIC_TLS) },
+		{ 0,			0 }
+	};
+
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & DF_ORIGIN)
-			(void) strcat(string, MSG_ORIG(MSG_DF_ORIGIN));
-		if (flags & DF_SYMBOLIC)
-			(void) strcat(string, MSG_ORIG(MSG_DF_SYMBOLIC));
-		if (flags & DF_TEXTREL)
-			(void) strcat(string, MSG_ORIG(MSG_DF_TEXTREL));
-		if (flags & DF_BIND_NOW)
-			(void) strcat(string, MSG_ORIG(MSG_DF_BIND_NOW));
-		if (flags & DF_STATIC_TLS)
-			(void) strcat(string, MSG_ORIG(MSG_DF_STATIC_TLS));
 
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
+	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 
-		return ((const char *)string);
-	}
+	return ((const char *)string);
 }
 
 #define	FLAG1SZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_DF1_NOW_SIZE + \
+		MSG_DF1_GLOBAL_SIZE + \
 		MSG_DF1_GROUP_SIZE + \
 		MSG_DF1_NODELETE_SIZE + \
 		MSG_DF1_LOADFLTR_SIZE + \
@@ -111,116 +113,101 @@
 		MSG_DF1_IGNMULDEF_SIZE + \
 		MSG_DF1_NOKSYMS_SIZE + \
 		MSG_DF1_NORELOC_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_dynflag_1_str(uint_t flags)
+conv_dyn_flag1(Xword flags)
 {
-	static char	string[FLAG1SZ] = { '\0' };
+	static char	string[FLAG1SZ];
+	static Val_desc vda[] = {
+		{ DF_1_NOW,		MSG_ORIG(MSG_DF_ORIGIN) },
+		{ DF_1_GLOBAL,		MSG_ORIG(MSG_DF1_GLOBAL) },
+		{ DF_1_GROUP,		MSG_ORIG(MSG_DF1_GROUP) },
+		{ DF_1_NODELETE,	MSG_ORIG(MSG_DF1_NODELETE) },
+		{ DF_1_LOADFLTR,	MSG_ORIG(MSG_DF1_LOADFLTR) },
+		{ DF_1_INITFIRST,	MSG_ORIG(MSG_DF1_INITFIRST) },
+		{ DF_1_NOOPEN,		MSG_ORIG(MSG_DF1_NOOPEN) },
+		{ DF_1_ORIGIN,		MSG_ORIG(MSG_DF1_ORIGIN) },
+		{ DF_1_DIRECT,		MSG_ORIG(MSG_DF1_DIRECT) },
+		{ DF_1_TRANS,		MSG_ORIG(MSG_DF1_TRANS) },
+		{ DF_1_INTERPOSE,	MSG_ORIG(MSG_DF1_INTERPOSE) },
+		{ DF_1_NODEFLIB,	MSG_ORIG(MSG_DF1_NODEFLIB) },
+		{ DF_1_NODUMP,		MSG_ORIG(MSG_DF1_NODUMP) },
+		{ DF_1_CONFALT,		MSG_ORIG(MSG_DF1_CONFALT) },
+		{ DF_1_ENDFILTEE,	MSG_ORIG(MSG_DF1_ENDFILTEE) },
+		{ DF_1_DISPRELPND,	MSG_ORIG(MSG_DF1_DISPRELPND) },
+		{ DF_1_DISPRELDNE,	MSG_ORIG(MSG_DF1_DISPRELDNE) },
+		{ DF_1_NODIRECT,	MSG_ORIG(MSG_DF1_NODIRECT) },
+		{ DF_1_IGNMULDEF,	MSG_ORIG(MSG_DF1_IGNMULDEF) },
+		{ DF_1_NOKSYMS,		MSG_ORIG(MSG_DF1_NOKSYMS) },
+		{ DF_1_NORELOC,		MSG_ORIG(MSG_DF1_NORELOC) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
 
-		if (flags & DF_1_NOW)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NOW));
-		if (flags & DF_1_GROUP)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_GROUP));
-		if (flags & DF_1_NODELETE)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NODELETE));
-		if (flags & DF_1_LOADFLTR)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_LOADFLTR));
-		if (flags & DF_1_INITFIRST)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_INITFIRST));
-		if (flags & DF_1_NOOPEN)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NOOPEN));
-		if (flags & DF_1_ORIGIN)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_ORIGIN));
-		if (flags & DF_1_DIRECT)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_DIRECT));
-		if (flags & DF_1_TRANS)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_TRANS));
-		if (flags & DF_1_INTERPOSE)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_INTERPOSE));
-		if (flags & DF_1_NODEFLIB)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NODEFLIB));
-		if (flags & DF_1_NODUMP)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NODUMP));
-		if (flags & DF_1_CONFALT)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_CONFALT));
-		if (flags & DF_1_ENDFILTEE)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_ENDFILTEE));
-		if (flags & DF_1_DISPRELPND)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_DISPRELPND));
-		if (flags & DF_1_DISPRELDNE)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_DISPRELDNE));
-		if (flags & DF_1_NODIRECT)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NODIRECT));
-		if (flags & DF_1_IGNMULDEF)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_IGNMULDEF));
-		if (flags & DF_1_NOKSYMS)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NOKSYMS));
-		if (flags & DF_1_NORELOC)
-			(void) strcat(string, MSG_ORIG(MSG_DF1_NORELOC));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAG1SZ);
+	if (conv_expn_field(string, FLAG1SZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAG1SZ);
 
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
-
-		return ((const char *)string);
-	}
+	return ((const char *)string);
 }
 
 #define	FEATSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_DTF_PARINIT_SIZE + \
 		MSG_DTF_CONFEXP_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_dynfeature_1_str(uint_t flags)
+conv_dyn_feature1(Xword flags)
 {
-	static char	string[FEATSZ] = { '\0' };
+	static char	string[FEATSZ];
+	static Val_desc vda[] = {
+		{ DTF_1_PARINIT,	MSG_ORIG(MSG_DTF_PARINIT) },
+		{ DTF_1_CONFEXP,	MSG_ORIG(MSG_DTF_CONFEXP) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
 
-		if (flags & DTF_1_PARINIT)
-			(void) strcat(string, MSG_ORIG(MSG_DTF_PARINIT));
-		if (flags & DTF_1_CONFEXP)
-			(void) strcat(string, MSG_ORIG(MSG_DTF_CONFEXP));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ);
+	if (conv_expn_field(string, FEATSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ);
 
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
-
-		return ((const char *)string);
-	}
+	return ((const char *)string);
 }
 
-const Msg _dyntag_tags[DT_MAXPOSTAGS] = {
-	MSG_DYN_NULL,		MSG_DYN_NEEDED,		MSG_DYN_PLTRELSZ,
-	MSG_DYN_PLTGOT,		MSG_DYN_HASH,		MSG_DYN_STRTAB,
-	MSG_DYN_SYMTAB,		MSG_DYN_RELA,		MSG_DYN_RELASZ,
-	MSG_DYN_RELAENT,	MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
-	MSG_DYN_INIT,		MSG_DYN_FINI,		MSG_DYN_SONAME,
-	MSG_DYN_RPATH,		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
-	MSG_DYN_RELSZ,		MSG_DYN_RELENT,		MSG_DYN_PLTREL,
-	MSG_DYN_DEBUG,		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
-	MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,	MSG_DYN_FINI_ARRAY,
-	MSG_DYN_INIT_ARRAYSZ,	MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
-	MSG_DYN_FLAGS,		MSG_DYN_NULL,		MSG_DYN_PREINIT_ARRAY,
-	MSG_DYN_PREINIT_ARRAYSZ
-};
-
 const char *
-conv_dyntag_str(uint64_t tag, ushort_t mach)
+conv_dyn_tag(Xword tag, Half mach)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	tags[DT_MAXPOSTAGS] = {
+		MSG_DYN_NULL,		MSG_DYN_NEEDED,
+		MSG_DYN_PLTRELSZ,	MSG_DYN_PLTGOT,
+		MSG_DYN_HASH,		MSG_DYN_STRTAB,
+		MSG_DYN_SYMTAB,		MSG_DYN_RELA,
+		MSG_DYN_RELASZ,		MSG_DYN_RELAENT,
+		MSG_DYN_STRSZ,		MSG_DYN_SYMENT,
+		MSG_DYN_INIT,		MSG_DYN_FINI,
+		MSG_DYN_SONAME,		MSG_DYN_RPATH,
+		MSG_DYN_SYMBOLIC,	MSG_DYN_REL,
+		MSG_DYN_RELSZ,		MSG_DYN_RELENT,
+		MSG_DYN_PLTREL,		MSG_DYN_DEBUG,
+		MSG_DYN_TEXTREL,	MSG_DYN_JMPREL,
+		MSG_DYN_BIND_NOW,	MSG_DYN_INIT_ARRAY,
+		MSG_DYN_FINI_ARRAY,	MSG_DYN_INIT_ARRAYSZ,
+		MSG_DYN_FINI_ARRAYSZ,	MSG_DYN_RUNPATH,
+		MSG_DYN_FLAGS,		MSG_DYN_NULL,
+		MSG_DYN_PREINIT_ARRAY,	MSG_DYN_PREINIT_ARRAYSZ
+	};
 
 	if (tag < DT_MAXPOSTAGS) {
 		/*
 		 * Generic dynamic tags.
 		 */
-		return (MSG_ORIG(_dyntag_tags[tag]));
+		return (MSG_ORIG(tags[tag]));
 	} else {
 		/*
 		 * SUNW: DT_LOOS -> DT_HIOS range.
@@ -306,65 +293,65 @@
 		else if (tag == DT_DEPRECATED_SPARC_REGISTER)
 			return (MSG_ORIG(MSG_DYN_REGISTER));
 		else
-			return (conv_invalid_str(string, STRSIZE, tag, 0));
+			return (conv_invalid_val(string, CONV_INV_STRSIZE,
+			    tag, 0));
 	}
 }
 
-#define	BINDESZ	MSG_GBL_OSQBRKT_SIZE + \
+#define	BINDTSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_BND_NEEDED_SIZE + \
 		MSG_BND_REFER_SIZE + \
 		MSG_BND_FILTER_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_bindent_str(uint_t flags)
+conv_bnd_type(uint_t flags)
 {
-	static char	string[BINDESZ] = { '\0' };
+	static char	string[BINDTSZ];
+	static Val_desc vda[] = {
+		{ BND_NEEDED,		MSG_ORIG(MSG_BND_NEEDED) },
+		{ BND_REFER,		MSG_ORIG(MSG_BND_REFER) },
+		{ BND_FILTER,		MSG_ORIG(MSG_BND_FILTER) },
+		{ 0,			0 }
+	};
 
-	/*
-	 * Evaluate the binding descriptors flags.
-	 */
-	if (flags) {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & BND_NEEDED)
-			(void) strcat(string, MSG_ORIG(MSG_BND_NEEDED));
-		if (flags & BND_REFER)
-			(void) strcat(string, MSG_ORIG(MSG_BND_REFER));
-		if (flags & BND_FILTER)
-			(void) strcat(string, MSG_ORIG(MSG_BND_FILTER));
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	if (flags == 0)
+		return (MSG_ORIG(MSG_STR_EMPTY));
 
-		return ((const char *)string);
-	} else
-		return (MSG_ORIG(MSG_STR_EMPTY));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDTSZ);
+	if (conv_expn_field(string, BINDTSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDTSZ);
+
+	return ((const char *)string);
 }
 
-#define	BINDSSZ	MSG_GBL_OSQBRKT_SIZE + \
+#define	BINDOSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_BND_ADDED_SIZE + \
 		MSG_BND_REEVAL_SIZE + \
 		MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_binding_str(uint_t flags)
+conv_bnd_obj(uint_t flags)
 {
-	static char	string[BINDSSZ] = { '\0' };
+	static char	string[BINDOSZ];
+	static Val_desc vda[] = {
+		{ LML_FLG_OBJADDED,	MSG_ORIG(MSG_BND_ADDED) },
+		{ LML_FLG_OBJREEVAL,	MSG_ORIG(MSG_BND_REEVAL) },
+		{ LML_FLG_OBJDELETED,	MSG_ORIG(MSG_BND_DELETED) },
+		{ LML_FLG_ATEXIT,	MSG_ORIG(MSG_BND_ATEXIT) },
+		{ 0,			0 }
+	};
+
+	if (flags == 0)
+		return (MSG_ORIG(MSG_STR_EMPTY));
 
 	/*
-	 * Evaluate the binding descriptors flags.
+	 * Note, we're not worried about unknown flags for this family, only
+	 * the selected flags are of interest.
 	 */
-	if (flags) {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & LML_FLG_OBJADDED)
-			(void) strcat(string, MSG_ORIG(MSG_BND_ADDED));
-		if (flags & LML_FLG_OBJREEVAL)
-			(void) strcat(string, MSG_ORIG(MSG_BND_REEVAL));
-		if (flags & LML_FLG_OBJDELETED)
-			(void) strcat(string, MSG_ORIG(MSG_BND_DELETED));
-		if (flags & LML_FLG_ATEXIT)
-			(void) strcat(string, MSG_ORIG(MSG_BND_ATEXIT));
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDOSZ);
+	if (conv_expn_field(string, BINDOSZ, vda, flags, 0, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDOSZ);
 
-		return ((const char *)string);
-	} else
-		return (MSG_ORIG(MSG_STR_EMPTY));
+	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/dynamic.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/dynamic.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,12 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Message file for cmd/sgs/libconv/common/dynamic.c
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_DYN_NULL		"NULL"
 @ MSG_DYN_NEEDED	"NEEDED"
@@ -100,6 +99,7 @@
 @ MSG_DF_STATIC_TLS	" STATIC_TLS "
 
 @ MSG_DF1_NOW		" NOW "
+@ MSG_DF1_GLOBAL	" GLOBAL "
 @ MSG_DF1_GROUP		" GROUP "
 @ MSG_DF1_NODELETE	" NODELETE "
 @ MSG_DF1_LOADFLTR	" LOADFILTER "
--- a/usr/src/cmd/sgs/libconv/common/elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,252 +34,168 @@
 #include	"elf_msg.h"
 #include	<sys/elf_SPARC.h>
 
-static const Msg classes[] = {
-	MSG_ELFCLASSNONE,	MSG_ELFCLASS32,		MSG_ELFCLASS64
-};
-
 const char *
-conv_eclass_str(uchar_t class)
+conv_ehdr_class(uchar_t class)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	classes[] = {
+		MSG_ELFCLASSNONE,	MSG_ELFCLASS32,		MSG_ELFCLASS64
+	};
 
 	if (class >= ELFCLASSNUM)
-		return (conv_invalid_str(string, STRSIZE, class, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, class, 0));
 	else
 		return (MSG_ORIG(classes[class]));
-
 }
 
-static const Msg datas[] = {
-	MSG_ELFDATANONE,	MSG_ELFDATA2LSB, 	MSG_ELFDATA2MSB
-};
-
 const char *
-conv_edata_str(uchar_t data)
+conv_ehdr_data(uchar_t data)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	datas[] = {
+		MSG_ELFDATANONE,	MSG_ELFDATA2LSB, 	MSG_ELFDATA2MSB
+	};
 
 	if (data >= ELFDATANUM)
-		return (conv_invalid_str(string, STRSIZE, data, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, data, 0));
 	else
 		return (MSG_ORIG(datas[data]));
-
 }
 
 static const Msg machines[EM_NUM] = {
-	MSG_EM_NONE,
-	MSG_EM_M32,
-	MSG_EM_SPARC,
-	MSG_EM_386,
-	MSG_EM_68K,
-	MSG_EM_88K,
-	MSG_EM_486,
-	MSG_EM_860,
-	MSG_EM_MIPS,
-	MSG_EM_UNKNOWN9,
-	MSG_EM_MIPS_RS3_LE,
-	MSG_EM_RS6000,
-	MSG_EM_UNKNOWN12,
-	MSG_EM_UNKNOWN13,
-	MSG_EM_UNKNOWN14,
-	MSG_EM_PA_RISC,
-	MSG_EM_nCUBE,
-	MSG_EM_VPP500,
-	MSG_EM_SPARC32PLUS,
-	MSG_EM_UNKNOWN19,
-	MSG_EM_PPC,
-	MSG_EM_PPC64,
-	MSG_EM_UNKNOWN22,
-	MSG_EM_UNKNOWN23,
-	MSG_EM_UNKNOWN24,
-	MSG_EM_UNKNOWN25,
-	MSG_EM_UNKNOWN26,
-	MSG_EM_UNKNOWN27,
-	MSG_EM_UNKNOWN28,
-	MSG_EM_UNKNOWN29,
-	MSG_EM_UNKNOWN30,
-	MSG_EM_UNKNOWN31,
-	MSG_EM_UNKNOWN32,
-	MSG_EM_UNKNOWN33,
-	MSG_EM_UNKNOWN34,
-	MSG_EM_UNKNOWN35,
-	MSG_EM_Y800,
-	MSG_EM_FR20,
-	MSG_EM_RH32,
-	MSG_EM_RCE,
-	MSG_EM_ARM,
-	MSG_EM_ALPHA,
-	MSG_EM_SH,
-	MSG_EM_SPARCV9,
-	MSG_EM_TRICORE,
-	MSG_EM_ARC,
-	MSG_EM_H8_300,
-	MSG_EM_H8_300H,
-	MSG_EM_H8S,
-	MSG_EM_H8_500,
-	MSG_EM_IA_64,
-	MSG_EM_MIPS_X,
-	MSG_EM_COLDFIRE,
-	MSG_EM_68HC12,
-	MSG_EM_MMA,
-	MSG_EM_PCP,
-	MSG_EM_NCPU,
-	MSG_EM_NDR1,
-	MSG_EM_STARCORE,
-	MSG_EM_ME16,
-	MSG_EM_ST100,
-	MSG_EM_TINYJ,
-	MSG_EM_AMD64,
-	MSG_EM_UNKNOWN63,
-	MSG_EM_UNKNOWN64,
-	MSG_EM_UNKNOWN65,
-	MSG_EM_FX66,
-	MSG_EM_ST9PLUS,
-	MSG_EM_ST7,
-	MSG_EM_68HC16,
-	MSG_EM_68HC11,
-	MSG_EM_68HC08,
-	MSG_EM_68HC05,
-	MSG_EM_SVX,
-	MSG_EM_ST19,
-	MSG_EM_VAX,
-	MSG_EM_CRIS,
-	MSG_EM_JAVELIN,
-	MSG_EM_FIREPATH,
-	MSG_EM_ZSP,
-	MSG_EM_MMIX,
-	MSG_EM_HUANY,
-	MSG_EM_PRISM,
-	MSG_EM_AVR,
-	MSG_EM_FR30,
-	MSG_EM_D10V,
-	MSG_EM_D30V,
-	MSG_EM_V850,
-	MSG_EM_M32R,
-	MSG_EM_MN10300,
-	MSG_EM_MN10200,
-	MSG_EM_PJ,
-	MSG_EM_OPENRISC,
-	MSG_EM_ARC_A5,
-	MSG_EM_XTENSA
+	MSG_EM_NONE,		MSG_EM_M32,		MSG_EM_SPARC,
+	MSG_EM_386,		MSG_EM_68K,		MSG_EM_88K,
+	MSG_EM_486,		MSG_EM_860,		MSG_EM_MIPS,
+	MSG_EM_UNKNOWN9,	MSG_EM_MIPS_RS3_LE,	MSG_EM_RS6000,
+	MSG_EM_UNKNOWN12,	MSG_EM_UNKNOWN13,	MSG_EM_UNKNOWN14,
+	MSG_EM_PA_RISC,		MSG_EM_nCUBE,		MSG_EM_VPP500,
+	MSG_EM_SPARC32PLUS,	MSG_EM_UNKNOWN19,	MSG_EM_PPC,
+	MSG_EM_PPC64,		MSG_EM_UNKNOWN22,	MSG_EM_UNKNOWN23,
+	MSG_EM_UNKNOWN24,	MSG_EM_UNKNOWN25,	MSG_EM_UNKNOWN26,
+	MSG_EM_UNKNOWN27,	MSG_EM_UNKNOWN28,	MSG_EM_UNKNOWN29,
+	MSG_EM_UNKNOWN30,	MSG_EM_UNKNOWN31,	MSG_EM_UNKNOWN32,
+	MSG_EM_UNKNOWN33,	MSG_EM_UNKNOWN34,	MSG_EM_UNKNOWN35,
+	MSG_EM_Y800,		MSG_EM_FR20,		MSG_EM_RH32,
+	MSG_EM_RCE,		MSG_EM_ARM,		MSG_EM_ALPHA,
+	MSG_EM_SH,		MSG_EM_SPARCV9,		MSG_EM_TRICORE,
+	MSG_EM_ARC,		MSG_EM_H8_300,		MSG_EM_H8_300H,
+	MSG_EM_H8S,		MSG_EM_H8_500,		MSG_EM_IA_64,
+	MSG_EM_MIPS_X,		MSG_EM_COLDFIRE,	MSG_EM_68HC12,
+	MSG_EM_MMA,		MSG_EM_PCP,		MSG_EM_NCPU,
+	MSG_EM_NDR1,		MSG_EM_STARCORE,	MSG_EM_ME16,
+	MSG_EM_ST100,		MSG_EM_TINYJ,		MSG_EM_AMD64,
+	MSG_EM_UNKNOWN63,	MSG_EM_UNKNOWN64,	MSG_EM_UNKNOWN65,
+	MSG_EM_FX66,		MSG_EM_ST9PLUS,		MSG_EM_ST7,
+	MSG_EM_68HC16,		MSG_EM_68HC11,		MSG_EM_68HC08,
+	MSG_EM_68HC05,		MSG_EM_SVX,		MSG_EM_ST19,
+	MSG_EM_VAX,		MSG_EM_CRIS,		MSG_EM_JAVELIN,
+	MSG_EM_FIREPATH,	MSG_EM_ZSP,		MSG_EM_MMIX,
+	MSG_EM_HUANY,		MSG_EM_PRISM,		MSG_EM_AVR,
+	MSG_EM_FR30,		MSG_EM_D10V,		MSG_EM_D30V,
+	MSG_EM_V850,		MSG_EM_M32R,		MSG_EM_MN10300,
+	MSG_EM_MN10200,		MSG_EM_PJ,		MSG_EM_OPENRISC,
+	MSG_EM_ARC_A5,		MSG_EM_XTENSA
 };
-
-const char *
-conv_emach_str(ushort_t machine)
-{
-	static char	string[STRSIZE] = { '\0' };
-
-	/*
-	 * In order to assure that all values included in sys/elf.h::EM_* are
-	 * included in libconv/elfdump for decoding - we have the below
-	 * #define trap.  Each time the machines[] table is updated, make
-	 * sure the following entry is updated.
-	 */
 #if	(EM_NUM != (EM_XTENSA + 1))
 #error	"EM_NUM has grown"
 #endif
+
+const char *
+conv_ehdr_mach(Half machine)
+{
+	static char	string[CONV_INV_STRSIZE];
+
 	if (machine >= (EM_NUM))
-		return (conv_invalid_str(string, STRSIZE, machine, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, machine, 0));
 	else
 		return (MSG_ORIG(machines[machine]));
-
 }
 
-static const Msg etypes[] = {
-	MSG_ET_NONE,		MSG_ET_REL,		MSG_ET_EXEC,
-	MSG_ET_DYN,		MSG_ET_CORE
-};
-
 const char *
-conv_etype_str(ushort_t etype)
+conv_ehdr_type(Half etype)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	etypes[] = {
+		MSG_ET_NONE,		MSG_ET_REL,		MSG_ET_EXEC,
+		MSG_ET_DYN,		MSG_ET_CORE
+	};
 
 	if (etype == ET_SUNWPSEUDO)
 		return (MSG_ORIG(MSG_ET_SUNWPSEUDO));
 	else if (etype >= ET_NUM)
-		return (conv_invalid_str(string, STRSIZE, etype, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, etype, 0));
 	else
 		return (MSG_ORIG(etypes[etype]));
 }
 
-static const Msg versions[] = {
-	MSG_EV_NONE,		MSG_EV_CURRENT
-};
-
 const char *
-conv_ever_str(uint_t version)
+conv_ehdr_vers(Word version)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	versions[] = {
+		MSG_EV_NONE,		MSG_EV_CURRENT
+	};
 
 	if (version >= EV_NUM)
-		return (conv_invalid_str(string, STRSIZE, version, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, version, 0));
 	else
 		return (MSG_ORIG(versions[version]));
 }
 
-
-static const Msg mm_flags[] = {
-	MSG_EF_SPARCV9_TSO,	MSG_EF_SPARCV9_PSO,	MSG_EF_SPARCV9_RMO
-};
-
 #define	EFLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_EF_SPARCV9_TSO_SIZE + \
 		MSG_EF_SPARC_SUN_US1_SIZE + \
 		MSG_EF_SPARC_HAL_R1_SIZE + \
 		MSG_EF_SPARC_SUN_US3_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 /*
- * Valid vendor extension bits for SPARCV9. This must be updated along with
- * elf_SPARC.h.
+ * Make a string representation of the e_flags field.
  */
 const char *
-conv_eflags_str(ushort_t mach, uint_t flags)
+conv_ehdr_flags(Half mach, Word flags)
 {
-	static char	string[EFLAGSZ] = { '\0' };
+	static char	string[EFLAGSZ];
+	static Val_desc vda[] = {
+		{ EF_SPARC_32PLUS,	MSG_ORIG(MSG_EF_SPARC_32PLUS) },
+		{ EF_SPARC_SUN_US1,	MSG_ORIG(MSG_EF_SPARC_SUN_US1) },
+		{ EF_SPARC_HAL_R1,	MSG_ORIG(MSG_EF_SPARC_HAL_R1) },
+		{ EF_SPARC_SUN_US3,	MSG_ORIG(MSG_EF_SPARC_SUN_US3) },
+		{ 0,			0 }
+	};
+	static const Msg mm_flags[] = {
+		MSG_EF_SPARCV9_TSO,	MSG_EF_SPARCV9_PSO,
+		MSG_EF_SPARCV9_RMO
+	};
+	Word		_flags = flags;
 
 	/*
-	 * Make a string representation of the e_flags field.  If any bogus
-	 * bits are set, then just return a string containing the numeric value.
+	 * Non-SPARC architectures presently provide no known flags.
 	 */
 	if ((mach == EM_SPARCV9) || (((mach == EM_SPARC) ||
 	    (mach == EM_SPARC32PLUS)) && flags)) {
-		uint_t _flags = flags;
-
+		/*
+		 * Valid vendor extension bits for SPARCV9.  These must be
+		 * updated along with elf_SPARC.h.
+		 */
 		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
 
-		if (mach == EM_SPARCV9) {
-			(void) strcat(string, MSG_ORIG(mm_flags[flags &
-			    EF_SPARCV9_MM]));
-			_flags &= ~EF_SPARCV9_MM;
+		if ((mach == EM_SPARCV9) && (flags <= EF_SPARCV9_RMO)) {
+		    if (strlcat(string,
+			MSG_ORIG(mm_flags[flags & EF_SPARCV9_MM]),
+			EFLAGSZ) >= EFLAGSZ)
+			    return (conv_invalid_val(string, EFLAGSZ,
+				flags, 0));
+		    _flags &= ~EF_SPARCV9_MM;
 		}
 
-		if (flags & EF_SPARC_32PLUS) {
-			(void) strcat(string, MSG_ORIG(MSG_EF_SPARC_32PLUS));
-			_flags &= ~EF_SPARC_32PLUS;
-		}
-		if (flags & EF_SPARC_SUN_US1) {
-			(void) strcat(string, MSG_ORIG(MSG_EF_SPARC_SUN_US1));
-			_flags &= ~EF_SPARC_SUN_US1;
-		}
-		if (flags & EF_SPARC_HAL_R1) {
-			(void) strcat(string, MSG_ORIG(MSG_EF_SPARC_HAL_R1));
-			_flags &= ~EF_SPARC_HAL_R1;
-		}
-		if (flags & EF_SPARC_SUN_US3) {
-			(void) strcat(string, MSG_ORIG(MSG_EF_SPARC_SUN_US3));
-			_flags &= ~EF_SPARC_SUN_US3;
-		}
-		if (_flags)
-			(void) sprintf(&string[strlen(string)],
-			    MSG_ORIG(MSG_EF_GEN_1_FLAGS), _flags);
+		if (conv_expn_field(string, EFLAGSZ, vda, flags, _flags, 0, 0))
+			(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT),
+			    EFLAGSZ);
 
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
-	} else
-		(void) sprintf(string, MSG_ORIG(MSG_EF_GEN_2_FLAGS), flags);
-
-	return (string);
+		return (string);
+	}
+	return (conv_invalid_val(string, EFLAGSZ, flags, CONV_INV_DECIMAL));
 }
 
 /*
@@ -287,31 +203,31 @@
  * terms of a string.
  */
 const char *
-conv_reject_str(Rej_desc * rej)
+conv_reject_desc(Rej_desc * rej)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	ushort_t	type = rej->rej_type;
 	uint_t		info = rej->rej_info;
 
 	if (type == SGS_REJ_MACH)
 		/* LINTED */
-		return (conv_emach_str((ushort_t)info));
+		return (conv_ehdr_mach((Half)info));
 	else if (type == SGS_REJ_CLASS)
 		/* LINTED */
-		return (conv_eclass_str((uchar_t)info));
+		return (conv_ehdr_class((uchar_t)info));
 	else if (type == SGS_REJ_DATA)
 		/* LINTED */
-		return (conv_edata_str((uchar_t)info));
+		return (conv_ehdr_data((uchar_t)info));
 	else if (type == SGS_REJ_TYPE)
 		/* LINTED */
-		return (conv_etype_str((ushort_t)info));
+		return (conv_ehdr_type((Half)info));
 	else if ((type == SGS_REJ_BADFLAG) || (type == SGS_REJ_MISFLAG) ||
 	    (type == SGS_REJ_HAL) || (type == SGS_REJ_US3))
 		/*
 		 * Only called from ld.so.1, thus M_MACH is hardcoded.
 		 */
-		return (conv_eflags_str(M_MACH, info));
+		return (conv_ehdr_flags(M_MACH, (Word)info));
 	else if (type == SGS_REJ_UNKFILE)
 		return ((const char *)0);
 	else if ((type == SGS_REJ_STR) || (type == SGS_REJ_HWCAP_1)) {
@@ -320,5 +236,6 @@
 		else
 			return (MSG_ORIG(MSG_STR_EMPTY));
 	} else
-		return (conv_invalid_str(string, STRSIZE, info, 1));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, info,
+		    CONV_INV_DECIMAL));
 }
--- a/usr/src/cmd/sgs/libconv/common/elf.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/elf.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Message file for cmd/sgs/libconv/common/elf.c
 
 @ MSG_ELFCLASSNONE	"ELFCLASSNONE"
 @ MSG_ELFCLASS32	"ELFCLASS32"
@@ -149,8 +149,7 @@
 @ MSG_EF_SPARCV9_PSO	" EF_SPARCV9_PSO "
 @ MSG_EF_SPARCV9_RMO	" EF_SPARCV9_RMO "
 
-@ MSG_EF_GEN_1_FLAGS	" %#x "
-@ MSG_EF_GEN_2_FLAGS	"%#x"
+@ MSG_GBL_ZERO		"0"
 
 @ MSG_GBL_OSQBRKT	"["
 @ MSG_GBL_CSQBRKT	"]"
--- a/usr/src/cmd/sgs/libconv/common/globals.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/globals.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,27 +18,95 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdio.h>
+#include	<strings.h>
 #include	<sys/machelf.h>
+#include	"_conv.h"
 #include	"globals_msg.h"
 
 const char *
-conv_invalid_str(char *string, size_t size, uint64_t value, int decimal)
+conv_invalid_val(char *string, size_t size, Xword value, int flags)
 {
-	Msg	format;
+	const char	*fmt;
 
-	if (decimal)
-		format = MSG_GBL_FMT_DEC;
-	else
-		format = MSG_GBL_FMT_HEX;
-
-	/* LINTED */
-	(void) snprintf(string, size, MSG_ORIG(format), value);
+	if (flags & CONV_INV_DECIMAL) {
+		if (flags & CONV_INV_SPACE)
+			fmt = MSG_ORIG(MSG_GBL_FMT_DECS);
+		else
+			fmt = MSG_ORIG(MSG_GBL_FMT_DEC);
+	} else {
+		if (flags & CONV_INV_SPACE)
+			fmt = MSG_ORIG(MSG_GBL_FMT_HEXS);
+		else
+			fmt = MSG_ORIG(MSG_GBL_FMT_HEX);
+	}
+	(void) snprintf(string, size, fmt, value);
 	return ((const char *)string);
 }
+
+/*
+ * Provide a focal point for expanding values (typically bit-fields) into
+ * their corresponding strings.
+ */
+int
+conv_expn_field(char *string, size_t size, const Val_desc *vdp,
+    Xword oflags, Xword rflags, const char *separator, int element)
+{
+	const Val_desc	*vde;
+
+	/*
+	 * Traverse the callers Val_desc array and determine if the value
+	 * corresponds to any array item.
+	 */
+	for (vde = vdp; vde->v_msg; vde++) {
+		if (oflags & vde->v_val) {
+			/*
+			 * If a separator is required, and elements have already
+			 * been added to the users output buffer, add the
+			 * separator to the buffer first.
+			 */
+			if (separator && element++) {
+				if (strlcat(string, separator, size) >= size) {
+					(void) conv_invalid_val(string, size,
+					    oflags, 0);
+					return (0);
+				}
+			}
+
+			/*
+			 * Add the items strings to the users output buffer.
+			 */
+			if (strlcat(string, vde->v_msg, size) >= size) {
+				(void) conv_invalid_val(string, size,
+				    oflags, 0);
+				return (0);
+			}
+
+			/*
+			 * Indicate this item has been collected.
+			 */
+			rflags &= ~(vde->v_val);
+		}
+	}
+
+	/*
+	 * If any flags remain, then they are unidentified.  Add the number
+	 * representation of these flags to the users output buffer.
+	 */
+	if (rflags) {
+		size_t  off = strlen(string);
+		size_t  rem = size - off;
+
+		(void) conv_invalid_val(&string[off], rem, rflags,
+		    CONV_INV_SPACE);
+	}
+
+	return (1);
+}
--- a/usr/src/cmd/sgs/libconv/common/globals.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/globals.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,20 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Message file for cmd/sgs/libconv/common/globals.c
 
-@ MSG_GBL_FMT_HEX	"0x%llx"
-@ MSG_GBL_FMT_DEC	"%lld"
+@ MSG_GBL_FMT_DEC_32	"%ld"
+@ MSG_GBL_FMT_DEC_64	"%lld"
+@ MSG_GBL_FMT_DECS_32	" %ld "
+@ MSG_GBL_FMT_DECS_64	" %lld "
+
+@ MSG_GBL_FMT_HEX_32	"0x%lx"
+@ MSG_GBL_FMT_HEX_64	"0x%llx"
+@ MSG_GBL_FMT_HEXS_32	" 0x%lx "
+@ MSG_GBL_FMT_HEXS_64	" 0x%llx "
--- a/usr/src/cmd/sgs/libconv/common/group.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/group.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -31,43 +31,39 @@
 #include	"group_msg.h"
 
 #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
-		MSG_GPH_INITIAL_SIZE + \
 		MSG_GPH_ZERO_SIZE + \
 		MSG_GPH_LDSO_SIZE + \
 		MSG_GPH_FIRST_SIZE + \
 		MSG_GPH_PARENT_SIZE + \
 		MSG_GPH_FILTEE_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		MSG_GPH_INITIAL_SIZE + \
+		MSG_GPH_STICKY_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 /*
  * String conversion routine for Grp_hdl flags.
  */
 const char *
-conv_grphdrflags_str(uint_t flags)
+conv_grphdl_flags(uint_t flags)
 {
-	static	char	string[FLAGSZ] = { '\0' };
-
-	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
+	static char	string[FLAGSZ];
+	static Val_desc vda[] = {
+		{ GPH_ZERO,		MSG_ORIG(MSG_GPH_ZERO) },
+		{ GPH_LDSO,		MSG_ORIG(MSG_GPH_LDSO) },
+		{ GPH_FIRST,		MSG_ORIG(MSG_GPH_FIRST) },
+		{ GPH_PARENT,		MSG_ORIG(MSG_GPH_PARENT) },
+		{ GPH_FILTEE,		MSG_ORIG(MSG_GPH_FILTEE) },
+		{ GPH_INITIAL,		MSG_ORIG(MSG_GPH_INITIAL) },
+		{ GPH_STICKY,		MSG_ORIG(MSG_GPH_STICKY) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_NULL));
 
-	if (flags & GPH_INITIAL)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_INITIAL));
-	if (flags & GPH_ZERO)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_ZERO));
-	if (flags & GPH_LDSO)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_LDSO));
-	if (flags & GPH_FIRST)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_FIRST));
-	if (flags & GPH_PARENT)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_PARENT));
-	if (flags & GPH_FILTEE)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_FILTEE));
-	if (flags & GPH_STICKY)
-		(void) strcat(string, MSG_ORIG(MSG_GPH_STICKY));
-
-	(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
+	(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
+	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 
 	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/group.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/group.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,12 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Message file for cmd/sgs/libconv/common/group.c
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_GPH_ZERO		" GPH_ZERO "
 @ MSG_GPH_LDSO		" GPH_LDSO "
--- a/usr/src/cmd/sgs/libconv/common/lddstub.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/lddstub.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,40 +33,6 @@
 #include	"_conv.h"
 #include	"lddstub_msg.h"
 
-static char	orgstub[PATH_MAX];
-static char	orgstub64[PATH_MAX];
-static int	orgflag;
-static int	orgflag64;
-
-#ifdef NEED_OWN_STRLCAT
-/*
- * Appends src to the dstsize buffer at dst. The append will never
- * overflow the destination buffer and the buffer will always be null
- * terminated. Never reference beyond &bst[dstsize-1] when computing
- * the length of the pre-existing string.
- */
-size_t
-strlcat(char *dst, const char *src, size_t dstsize)
-{
-	char *df = dst;
-	size_t left = dstsize;
-	size_t l1;
-	size_t l2 = strlen(src);
-	size_t copied;
-
-	while (left-- != 0 && *df != '\0')
-		df++;
-	l1 = df - dst;
-	if (dstsize == l1)
-		return (l1 + l2);
-
-	copied = l1 + l2 >= dstsize ? dstsize - l1 - 1 : l2;
-	memcpy(dst + l1, src, copied);
-	dst[l1+copied] = '\0';
-	return (l1 + l2);
-}
-#endif
-
 static int
 originlddstub(char *buffer, const char *orgfile)
 {
@@ -79,12 +45,15 @@
 	if ((len = resolvepath(buffer, buffer, (PATH_MAX - 1))) == -1)
 		return (-1);
 	buffer[len] = '\0';
-	if (access(orgstub, X_OK) == -1)
+	if (access(buffer, X_OK) == -1)
 		return (-1);
 
-	return (0);
+	return (1);
 }
 
+static char	orgstub[PATH_MAX], orgstub64[PATH_MAX];
+static int	orgflag, orgflag64;
+
 /*
  * Determine what lddstub to run.
  */
--- a/usr/src/cmd/sgs/libconv/common/lddstub.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/lddstub.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -21,10 +17,12 @@
 # information: Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
+
 #
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Message file for cmd/sgs/libconv/common/lddstub.c
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_ORG_LDDSTUB	"/../lib/lddstub"
 @ MSG_ORG_LDDSTUB_64	"/../lib/64/lddstub"
--- a/usr/src/cmd/sgs/libconv/common/llib-lconv	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/llib-lconv	Tue Mar 14 09:22:52 2006 -0800
@@ -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,75 +18,115 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 /* LINTLIBRARY */
 /* PROTOLIB1 */
 
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved. 
- * Use is subject to license terms.
- */ 
-
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdlib.h>
 #include	<libelf.h>
 #include	<sys/machelf.h>
-#include	"sgs.h"
+#include	<sgs.h>
+#include	<libld.h>
+#include	<conv.h>
 
+/*
+ * Define all generic interfaces.
+ */
 void		conv_check_native(char **, char **);
-const char	*conv_binding_str(uint_t);
-const char	*conv_bindent_str(uint_t);
-const char	*conv_captag_str(uint64_t);
-const char	*conv_capval_str(uint64_t, uint64_t, ushort_t);
+const char      *conv_config_feat(int);
 const char	*conv_config_obj(ushort_t);
-const char	*conv_config_str(int);
-const char	*conv_d_type_str(Elf_Type);
-const char	*conv_deftag_str(int);
-const char	*conv_dlflag_str(int, int);
-const char	*conv_dlmode_str(int, int);
-const char	*conv_dyntag_str(uint64_t, ushort_t);
-const char	*conv_dynflag_str(uint_t);
-const char	*conv_dynflag_1_str(uint_t);
-const char	*conv_dynposflag_1_str(uint_t);
-const char	*conv_dynfeature_1_str(uint_t);
-const char	*conv_dwarf_ehe_str(uint_t);
-const char	*conv_eclass_str(uchar_t);
-const char	*conv_edata_str(uchar_t);
-const char	*conv_emach_str(ushort_t);
-const char	*conv_ever_str(uint_t);
-const char	*conv_etype_str(ushort_t);
-const char	*conv_eflags_str(ushort_t, uint_t);
-const char	*conv_hwcap_1_str(uint64_t, ushort_t);
-const char	*conv_hwcap_1_386_str(uint64_t);
-const char	*conv_hwcap_1_SPARC_str(uint64_t);
-const char	*conv_sfcap_1_str(uint64_t, ushort_t);
-const char	*conv_grphdrflags_str(uint_t);
-const char	*conv_info_bind_str(uchar_t);
-const char	*conv_info_type_str(ushort_t, uchar_t);
+const char	*conv_config_upm(const char *, const char *, const char *,
+		    size_t);
+const char	*conv_def_tag(Symref);
+const char	*conv_demangle_name(const char *);
+const char	*conv_dl_flag(int, int);
+const char	*conv_dl_mode(int, int);
+const char	*conv_dwarf_ehe(uint_t);
+const char	*conv_elfdata_type(Elf_Type);
+int		conv_expn_field(char *, size_t, const Val_desc *, Xword, Xword,
+		    const char *, int);
+const char	*conv_grphdl_flags(uint_t);
 Isa_desc	*conv_isalist(void);
 const char	*conv_lddstub(int);
-const char	*conv_phdrflg_str(uint_t);
-const char	*conv_phdrtyp_str(ushort_t, uint_t);
-const char	*conv_reject_str(Rej_desc *);
-const char	*conv_reloc_type_str(ushort_t, uint_t);
-const char	*conv_reloc_amd64_type_str(uint_t);
-const char	*conv_reloc_SPARC_type_str(uint_t);
-const char	*conv_reloc_386_type_str(uint_t);
-const char	*conv_sym_dem(const char *);
-const char	*conv_sym_stother(uchar_t);
-const char	*conv_sym_value_str(ushort_t, uint_t, uint64_t);
-const char	*conv_sym_SPARC_value_str(uint64_t);
-const char	*conv_secflg_str(ushort_t, uint_t);
-const char	*conv_secinfo_str(uint_t, uint_t);
-const char	*conv_sectyp_str(ushort_t, uint_t);
-const char	*conv_segaflg_str(uint_t);
-const char	*conv_shndx_str(ushort_t);
+const char	*conv_seg_flags(Half);
 int		conv_sys_eclass(void);
 Uts_desc	*conv_uts(void);
-const char	*conv_upm_string(const char *, const char *, const char *,
-		    size_t);
-const char	*conv_verflg_str(ushort_t);
+const char	*conv_ver_flags(Half);
+
+/*
+ * Define all class specific routines.
+ */
+const char	*conv32_bnd_obj(uint_t);
+const char	*conv64_bnd_obj(uint_t);
+const char	*conv32_bnd_type(uint_t);
+const char	*conv64_bnd_type(uint_t);
+const char	*conv32_cap_tag(Elf32_Word);
+const char	*conv64_cap_tag(Elf64_Xword);
+const char	*conv32_cap_val(Elf32_Word, Elf32_Word, Half);
+const char	*conv64_cap_val(Elf64_Xword, Elf64_Xword, Half);
+const char	*conv32_cap_val_hw1(Elf32_Word, Half);
+const char	*conv64_cap_val_hw1(Elf64_Xword, Half);
+const char	*conv32_cap_val_sf1(Elf32_Word, Half);
+const char	*conv64_cap_val_sf1(Elf64_Xword, Half);
+const char	*conv32_dyn_flag1(Elf32_Word);
+const char	*conv64_dyn_flag1(Elf64_Xword);
+const char	*conv32_dyn_flag(Elf32_Word);
+const char	*conv64_dyn_flag(Elf64_Xword);
+const char	*conv32_dyn_posflag1(Elf32_Word);
+const char	*conv64_dyn_posflag1(Elf64_Xword);
+const char	*conv32_dyn_tag(Elf32_Word, Elf32_Half);
+const char	*conv64_dyn_tag(Elf64_Xword, Elf64_Half);
+const char	*conv32_dyn_feature1(Elf32_Word);
+const char	*conv64_dyn_feature1(Elf64_Xword);
+const char	*conv32_ehdr_class(uchar_t);
+const char	*conv64_ehdr_class(uchar_t);
+const char	*conv32_ehdr_data(uchar_t);
+const char	*conv64_ehdr_data(uchar_t);
+const char	*conv32_ehdr_flags(Elf32_Half, Elf32_Word);
+const char	*conv64_ehdr_flags(Elf64_Half, Elf64_Word);
+const char	*conv32_ehdr_mach(Elf32_Half);
+const char	*conv64_ehdr_mach(Elf64_Half);
+const char	*conv32_ehdr_type(Elf32_Half);
+const char	*conv64_ehdr_type(Elf64_Half);
+const char	*conv32_ehdr_vers(Elf32_Word);
+const char	*conv64_ehdr_vers(Elf64_Word);
+const char	*conv32_invalid_val(char *, size_t, Elf32_Word, int);
+const char	*conv64_invalid_val(char *, size_t, Elf64_Xword, int);
+const char	*conv32_phdr_flags(Word);
+const char	*conv64_phdr_flags(Word);
+const char	*conv32_phdr_type(Elf32_Half, Word);
+const char	*conv64_phdr_type(Elf64_Half, Word);
+const char	*conv32_reject_desc(Rej_desc *);
+const char	*conv64_reject_desc(Rej_desc *);
+const char	*conv32_reloc_type(Half, Word);
+const char	*conv64_reloc_type(Half, Word);
+const char	*conv32_reloc_386_type(Word);
+const char	*conv64_reloc_386_type(Word);
+const char	*conv32_reloc_amd64_type(Word);
+const char	*conv64_reloc_amd64_type(Word);
+const char	*conv32_reloc_SPARC_type(Word);
+const char	*conv64_reloc_SPARC_type(Word);
+const char	*conv32_sec_flags(Elf32_Word);
+const char	*conv64_sec_flags(Elf64_Xword);
+const char	*conv32_sec_info(Elf32_Word, Elf32_Word);
+const char	*conv64_sec_info(Elf64_Word, Elf64_Xword);
+const char	*conv32_sec_type(Elf32_Half, Elf32_Word);
+const char	*conv64_sec_type(Elf64_Half, Elf64_Word);
+const char	*conv32_sym_info_bind(uchar_t);
+const char	*conv64_sym_info_bind(uchar_t);
+const char	*conv32_sym_info_type(Elf32_Half, uchar_t);
+const char	*conv64_sym_info_type(Elf64_Half, uchar_t);
+const char	*conv32_sym_shndx(Elf32_Half);
+const char	*conv64_sym_shndx(Elf64_Half);
+const char	*conv32_sym_other(uchar_t);
+const char	*conv64_sym_other(uchar_t);
+const char	*conv32_sym_value(Elf32_Half, uchar_t, Elf32_Addr);
+const char	*conv64_sym_value(Elf64_Half, uchar_t, Elf64_Addr);
+const char	*conv32_sym_SPARC_value(Elf32_Addr);
+const char	*conv64_sym_SPARC_value(Elf64_Addr);
--- a/usr/src/cmd/sgs/libconv/common/phdr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/phdr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -30,62 +30,59 @@
  * String conversion routines for program header attributes.
  */
 #include	<string.h>
-#include	<sys/elf_amd64.h>
 #include	<_conv.h>
 #include	<phdr_msg.h>
 
-static const Msg phdrs[] = {
-	MSG_PT_NULL,		MSG_PT_LOAD,		MSG_PT_DYNAMIC,
-	MSG_PT_INTERP,		MSG_PT_NOTE,		MSG_PT_SHLIB,
-	MSG_PT_PHDR,		MSG_PT_TLS
-};
-
 static const Msg uphdrs[] = {
 	MSG_PT_SUNWBSS,		MSG_PT_SUNWSTACK,	MSG_PT_SUNWDTRACE,
 	MSG_PT_SUNWCAP
 };
 
 const char *
-/* ARGSUSED 1 */
-conv_phdrtyp_str(ushort_t mach, uint_t phdr)
+conv_phdr_type(Half mach, Word type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	phdrs[] = {
+		MSG_PT_NULL,		MSG_PT_LOAD,		MSG_PT_DYNAMIC,
+		MSG_PT_INTERP,		MSG_PT_NOTE,		MSG_PT_SHLIB,
+		MSG_PT_PHDR,		MSG_PT_TLS
+	};
 
-	if (phdr < PT_NUM)
-		return (MSG_ORIG(phdrs[phdr]));
-	else if ((phdr >= PT_SUNWBSS) && (phdr <= PT_HISUNW))
-		return (MSG_ORIG(uphdrs[phdr - PT_SUNWBSS]));
-	else if ((phdr == PT_SUNW_UNWIND) && (mach == EM_AMD64))
+	if (type < PT_NUM)
+		return (MSG_ORIG(phdrs[type]));
+	else if ((type >= PT_SUNWBSS) && (type <= PT_HISUNW))
+		return (MSG_ORIG(uphdrs[type - PT_SUNWBSS]));
+	else if ((type == PT_SUNW_UNWIND) && (mach == EM_AMD64))
 		return (MSG_ORIG(MSG_PT_SUNW_UNWIND));
 	else
-		return (conv_invalid_str(string, STRSIZE, phdr, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 }
 
 #define	PHDRSZ	MSG_GBL_OSQBRKT_SIZE + \
 		MSG_PF_X_SIZE + \
 		MSG_PF_W_SIZE + \
 		MSG_PF_R_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		MSG_PF_SUNW_FAILURE_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_phdrflg_str(uint_t flags)
+conv_phdr_flags(Word flags)
 {
-	static	char	string[PHDRSZ] = { '\0' };
+	static char	string[PHDRSZ];
+	static Val_desc vda[] = {
+		{ PF_X,			MSG_ORIG(MSG_PF_X) },
+		{ PF_W,			MSG_ORIG(MSG_PF_W) },
+		{ PF_R,			MSG_ORIG(MSG_PF_R) },
+		{ PF_SUNW_FAILURE,	MSG_ORIG(MSG_PF_SUNW_FAILURE) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & PF_X)
-			(void) strcat(string, MSG_ORIG(MSG_PF_X));
-		if (flags & PF_W)
-			(void) strcat(string, MSG_ORIG(MSG_PF_W));
-		if (flags & PF_R)
-			(void) strcat(string, MSG_ORIG(MSG_PF_R));
-		if (flags & PF_SUNW_FAILURE)
-			(void) strcat(string, MSG_ORIG(MSG_PF_SUNW_FAILURE));
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
 
-		return ((const char *)string);
-	}
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), PHDRSZ);
+	if (conv_expn_field(string, PHDRSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), PHDRSZ);
+
+	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/phdr.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/phdr.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Message file for cmd/sgs/libconv/common/phdr.c
 
 @ MSG_PT_NULL		"[ PT_NULL ]"
 @ MSG_PT_LOAD		"[ PT_LOAD ]"
--- a/usr/src/cmd/sgs/libconv/common/relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -35,19 +35,19 @@
  * Generic front-end that determines machine specific relocations.
  */
 const char *
-conv_reloc_type_str(ushort_t mach, uint_t rel)
+conv_reloc_type(Half mach, Word type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (mach == EM_386)
-		return (conv_reloc_386_type_str(rel));
+		return (conv_reloc_386_type(type));
 
 	if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
 	    (mach == EM_SPARCV9))
-		return (conv_reloc_SPARC_type_str(rel));
+		return (conv_reloc_SPARC_type(type));
 
 	if (mach == EM_AMD64)
-		return (conv_reloc_amd64_type_str(rel));
+		return (conv_reloc_amd64_type(type));
 
-	return (conv_invalid_str(string, STRSIZE, rel, 0));
+	return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 }
--- a/usr/src/cmd/sgs/libconv/common/relocate_amd64.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/relocate_amd64.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -61,11 +60,11 @@
 #endif
 
 const char *
-conv_reloc_amd64_type_str(uint_t type)
+conv_reloc_amd64_type(Word type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (type >= R_AMD64_NUM)
-		return (conv_invalid_str(string, STRSIZE, type, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 	return (MSG_ORIG(rels[type]));
 }
--- a/usr/src/cmd/sgs/libconv/common/relocate_i386.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/relocate_i386.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -64,11 +63,11 @@
 #endif
 
 const char *
-conv_reloc_386_type_str(uint_t type)
+conv_reloc_386_type(Word type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (type >= R_386_NUM)
-		return (conv_invalid_str(string, STRSIZE, type, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 	return (MSG_ORIG(rels[type]));
 }
--- a/usr/src/cmd/sgs/libconv/common/relocate_sparc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/relocate_sparc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -88,11 +87,11 @@
 #endif
 
 const char *
-conv_reloc_SPARC_type_str(uint_t type)
+conv_reloc_SPARC_type(Word type)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (type >= R_SPARC_NUM)
-		return (conv_invalid_str(string, STRSIZE, type, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 	return (MSG_ORIG(rels[type]));
 }
--- a/usr/src/cmd/sgs/libconv/common/sections.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/sections.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -60,27 +59,25 @@
 #endif
 
 const char *
-/* ARGSUSED 1 */
-conv_sectyp_str(ushort_t mach, uint_t sec)
+conv_sec_type(Half mach, Word sec)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if (sec < SHT_NUM)
 		return (MSG_ORIG(secs[sec]));
 	else if ((sec >= SHT_LOSUNW) && (sec <= SHT_HISUNW))
 		return (MSG_ORIG(usecs[sec - SHT_LOSUNW]));
 	else if ((sec >= SHT_LOPROC) && (sec <= SHT_HIPROC)) {
-		if ((sec == (uint_t)SHT_SPARC_GOTDATA) &&
-		    ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
-		    (mach == EM_SPARCV9)))
+		if ((sec == SHT_SPARC_GOTDATA) && ((mach == EM_SPARC) ||
+		    (mach == EM_SPARC32PLUS) || (mach == EM_SPARCV9)))
 			return (MSG_ORIG(MSG_SHT_SPARC_GOTDATA));
-		else if ((sec == (uint_t)SHT_AMD64_UNWIND) &&
-		    (mach == EM_AMD64))
+		else if ((sec == SHT_AMD64_UNWIND) && (mach == EM_AMD64))
 			return (MSG_ORIG(MSG_SHT_AMD64_UNWIND));
 		else
-			return (conv_invalid_str(string, STRSIZE, sec, 0));
+			return (conv_invalid_val(string, CONV_INV_STRSIZE,
+			    sec, 0));
 	} else
-		return (conv_invalid_str(string, STRSIZE, sec, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, sec, 0));
 }
 
 #define	FLAGSZ	MSG_GBL_OSQBRKT_SIZE + \
@@ -97,101 +94,43 @@
 		MSG_SHF_EXCLUDE_SIZE + \
 		MSG_SHF_ORDERED_SIZE + \
 		MSG_SHF_AMD64_LARGE_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-/* ARGSUSED 1 */
-conv_secflg_str(ushort_t mach, uint_t flags)
+conv_sec_flags(Xword flags)
 {
-	static	char	string[FLAGSZ] = { '\0' };
+	static	char	string[FLAGSZ];
+	static Val_desc vda[] = {
+		{ SHF_WRITE,		MSG_ORIG(MSG_SHF_WRITE) },
+		{ SHF_ALLOC,		MSG_ORIG(MSG_SHF_ALLOC) },
+		{ SHF_EXECINSTR,	MSG_ORIG(MSG_SHF_EXECINSTR) },
+		{ SHF_MERGE,		MSG_ORIG(MSG_SHF_MERGE) },
+		{ SHF_STRINGS,		MSG_ORIG(MSG_SHF_STRINGS) },
+		{ SHF_INFO_LINK,	MSG_ORIG(MSG_SHF_INFO_LINK) },
+		{ SHF_LINK_ORDER,	MSG_ORIG(MSG_SHF_LINK_ORDER) },
+		{ SHF_OS_NONCONFORMING,	MSG_ORIG(MSG_SHF_OS_NONCONFORMING) },
+		{ SHF_GROUP,		MSG_ORIG(MSG_SHF_GROUP) },
+		{ SHF_TLS,		MSG_ORIG(MSG_SHF_TLS) },
+		{ SHF_EXCLUDE,		MSG_ORIG(MSG_SHF_EXCLUDE) },
+		{ SHF_ORDERED,		MSG_ORIG(MSG_SHF_ORDERED) },
+		{ SHF_AMD64_LARGE,	MSG_ORIG(MSG_SHF_AMD64_LARGE) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		uint_t	flags_handled = 0;
 
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & SHF_WRITE) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_WRITE));
-			flags_handled |= SHF_WRITE;
-		}
-		if (flags & SHF_ALLOC) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_ALLOC));
-			flags_handled |= SHF_ALLOC;
-		}
-		if (flags & SHF_EXECINSTR) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_EXECINSTR));
-			flags_handled |= SHF_EXECINSTR;
-		}
-		if (flags & SHF_MERGE) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_MERGE));
-			flags_handled |= SHF_MERGE;
-		}
-		if (flags & SHF_STRINGS) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_STRINGS));
-			flags_handled |= SHF_STRINGS;
-		}
-		if (flags & SHF_INFO_LINK) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_INFO_LINK));
-			flags_handled |= SHF_INFO_LINK;
-		}
-		if (flags & SHF_LINK_ORDER) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_LINK_ORDER));
-			flags_handled |= SHF_LINK_ORDER;
-		}
-		if (flags & SHF_OS_NONCONFORMING) {
-			(void) strcat(string,
-				MSG_ORIG(MSG_SHF_OS_NONCONFORMING));
-			flags_handled |= SHF_OS_NONCONFORMING;
-		}
-		if (flags & SHF_GROUP) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_GROUP));
-			flags_handled |= SHF_GROUP;
-		}
-		if (flags & SHF_TLS) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_TLS));
-			flags_handled |= SHF_TLS;
-		}
-		if (flags & SHF_EXCLUDE) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_EXCLUDE));
-			flags_handled |= SHF_EXCLUDE;
-		}
-		if (flags & SHF_ORDERED) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_ORDERED));
-			flags_handled |= SHF_ORDERED;
-		}
-		if (flags & SHF_AMD64_LARGE) {
-			(void) strcat(string, MSG_ORIG(MSG_SHF_AMD64_LARGE));
-			flags_handled |= SHF_AMD64_LARGE;
-		}
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ);
+	if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ);
 
-		/*
-		 * Are there any flags that haven't been handled.
-		 */
-		if ((flags & flags_handled) != flags) {
-			char	*str;
-			size_t	len;
-
-			len = strlen(string);
-			str = string + len;
-			(void) conv_invalid_str(str, FLAGSZ - len,
-			    (flags & (~flags_handled)), 0);
-		}
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
-
-		return ((const char *)string);
-	}
+	return ((const char *)string);
 }
 
-/*
- * Need to be able to hold a 32bit signed integer.
- */
-#define	INFOSZ	128
-
 const char *
-conv_secinfo_str(uint_t info, uint_t flags)
+conv_sec_info(Word info, Xword flags)
 {
-	static	char	string[INFOSZ] = { '\0' };
+	static	char	string[CONV_INV_STRSIZE];
 
 	if (flags & SHF_ORDERED) {
 		if (info == SHN_BEFORE)
@@ -199,6 +138,6 @@
 		else if (info == SHN_AFTER)
 			return (MSG_ORIG(MSG_SHN_AFTER));
 	}
-	(void) conv_invalid_str(string, INFOSZ, info, 1);
+	(void) conv_invalid_val(string, CONV_INV_STRSIZE, info, 1);
 	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/segments.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/segments.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -29,7 +29,8 @@
  * String conversion routine for segment flags.
  */
 #include	<string.h>
-#include	"libld.h"
+#include	<libld.h>
+#include	"_conv.h"
 #include	"segments_msg.h"
 
 #define	SEGSZ	MSG_GBL_OSQBRKT_SIZE + \
@@ -41,41 +42,40 @@
 		MSG_FLG_SG_FLAGS_SIZE + \
 		MSG_FLG_SG_TYPE_SIZE + \
 		MSG_FLG_SG_ORDER_SIZE + \
+		MSG_FLG_SG_NOHDR_SIZE + \
 		MSG_FLG_SG_EMPTY_SIZE + \
-		MSG_FLG_SG_NOHDR_SIZE + \
-		MSG_GBL_CSQBRKT_SIZE
+		MSG_FLG_SG_KEY_SIZE + \
+		MSG_FLG_SG_DISABLED_SIZE + \
+		MSG_FLG_SG_PHREQ_SIZE + \
+		CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE
 
 const char *
-conv_segaflg_str(uint_t flags)
+conv_seg_flags(Half flags)
 {
-	static	char	string[SEGSZ] = { '\0' };
+	static char	string[SEGSZ];
+	static Val_desc vda[] = {
+		{ FLG_SG_VADDR,		MSG_ORIG(MSG_FLG_SG_VADDR) },
+		{ FLG_SG_PADDR,		MSG_ORIG(MSG_FLG_SG_PADDR) },
+		{ FLG_SG_LENGTH,	MSG_ORIG(MSG_FLG_SG_LENGTH) },
+		{ FLG_SG_ALIGN,		MSG_ORIG(MSG_FLG_SG_ALIGN) },
+		{ FLG_SG_ROUND,		MSG_ORIG(MSG_FLG_SG_ROUND) },
+		{ FLG_SG_FLAGS,		MSG_ORIG(MSG_FLG_SG_FLAGS) },
+		{ FLG_SG_TYPE,		MSG_ORIG(MSG_FLG_SG_TYPE) },
+		{ FLG_SG_ORDER,		MSG_ORIG(MSG_FLG_SG_ORDER) },
+		{ FLG_SG_NOHDR,		MSG_ORIG(MSG_FLG_SG_NOHDR) },
+		{ FLG_SG_EMPTY,		MSG_ORIG(MSG_FLG_SG_EMPTY) },
+		{ FLG_SG_KEY,		MSG_ORIG(MSG_FLG_SG_KEY) },
+		{ FLG_SG_DISABLED,	MSG_ORIG(MSG_FLG_SG_DISABLED) },
+		{ FLG_SG_PHREQ,		MSG_ORIG(MSG_FLG_SG_PHREQ) },
+		{ 0,			0 }
+	};
 
 	if (flags == 0)
 		return (MSG_ORIG(MSG_GBL_ZERO));
-	else {
-		(void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT));
-		if (flags & FLG_SG_VADDR)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_VADDR));
-		if (flags & FLG_SG_PADDR)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_PADDR));
-		if (flags & FLG_SG_LENGTH)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_LENGTH));
-		if (flags & FLG_SG_ALIGN)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_ALIGN));
-		if (flags & FLG_SG_ROUND)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_ROUND));
-		if (flags & FLG_SG_FLAGS)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_FLAGS));
-		if (flags & FLG_SG_TYPE)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_TYPE));
-		if (flags & FLG_SG_ORDER)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_ORDER));
-		if (flags & FLG_SG_EMPTY)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_EMPTY));
-		if (flags & FLG_SG_NOHDR)
-			(void) strcat(string, MSG_ORIG(MSG_FLG_SG_NOHDR));
-		(void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT));
 
-		return ((const char *)string);
-	}
+	(void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), SEGSZ);
+	if (conv_expn_field(string, SEGSZ, vda, flags, flags, 0, 0))
+		(void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), SEGSZ);
+
+	return ((const char *)string);
 }
--- a/usr/src/cmd/sgs/libconv/common/segments.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/segments.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,12 @@
 #
 # CDDL HEADER END
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Message file for cmd/sgs/libconv/common/segments.c
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 @ MSG_FLG_SG_VADDR	" FLG_SG_VADDR "
 @ MSG_FLG_SG_PADDR	" FLG_SG_PADDR "
@@ -34,8 +33,11 @@
 @ MSG_FLG_SG_FLAGS	" FLG_SG_FLAGS "
 @ MSG_FLG_SG_TYPE	" FLG_SG_TYPE "
 @ MSG_FLG_SG_ORDER	" FLG_SG_ORDER "
+@ MSG_FLG_SG_NOHDR	" FLG_SG_NOHDR "
 @ MSG_FLG_SG_EMPTY	" FLG_SG_EMPTY "
-@ MSG_FLG_SG_NOHDR	" FLG_SG_NOHDR "
+@ MSG_FLG_SG_KEY	" FLG_SG_KEY "
+@ MSG_FLG_SG_DISABLED	" FLG_SG_DISABLED "
+@ MSG_FLG_SG_PHREQ	" FLG_SG_PHREQ "
 
 @ MSG_GBL_ZERO		"0"
 @ MSG_GBL_OSQBRKT	"["
--- a/usr/src/cmd/sgs/libconv/common/symbols.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/symbols.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -29,49 +29,46 @@
  * String conversion routines for symbol attributes.
  */
 #include	<stdio.h>
-#include	<demangle.h>
-#include	"_conv.h"
-#include	"symbols_msg.h"
+#include	<sys/machelf.h>
 #include	<sys/elf_SPARC.h>
 #include	<sys/elf_amd64.h>
-
-static const char vis_types[4] = {
-	'D',	/* STV_DEFAULT */
-	'I',	/* STV_INTERNAL */
-	'H',	/* STV_HIDDEN */
-	'P'	/* STV_PROTECTED */
-	};
+#include	"_conv.h"
+#include	"symbols_msg.h"
 
 const char *
-conv_sym_stother(uchar_t stother)
+conv_sym_other(uchar_t other)
 {
-	uint_t	vis = ELF_ST_VISIBILITY(stother);
-	static char	string[STRSIZE];
-	uint_t	ndx = 0;
+	static char		string[CONV_INV_STRSIZE];
+	static const char	visibility[4] = {
+		'D',	/* STV_DEFAULT */
+		'I',	/* STV_INTERNAL */
+		'H',	/* STV_HIDDEN */
+		'P'	/* STV_PROTECTED */
+	};
+	uint_t		vis = ELF_ST_VISIBILITY(other);
+	uint_t		ndx = 0;
 
-	string[ndx++] = vis_types[vis];
+	string[ndx++] = visibility[vis];
+
 	/*
 	 * If unkown bits are present in stother - throw out a '?'
 	 */
-	if (stother & ~MSK_SYM_VISIBILITY)
+	if (other & ~MSK_SYM_VISIBILITY)
 		string[ndx++] = '?';
-
 	string[ndx++] = '\0';
 
 	return (string);
 }
 
-static const Msg types[] = {
-	MSG_STT_NOTYPE,		MSG_STT_OBJECT,		MSG_STT_FUNC,
-	MSG_STT_SECTION,	MSG_STT_FILE,		MSG_STT_COMMON,
-	MSG_STT_TLS
-};
-
 const char *
-conv_info_type_str(ushort_t mach, uchar_t type)
+conv_sym_info_type(Half mach, uchar_t type)
 {
-	static char	string[STRSIZE] = { '\0' };
-
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	types[] = {
+		MSG_STT_NOTYPE,		MSG_STT_OBJECT,		MSG_STT_FUNC,
+		MSG_STT_SECTION,	MSG_STT_FILE,		MSG_STT_COMMON,
+		MSG_STT_TLS
+	};
 
 	if (type < STT_NUM)
 		return (MSG_ORIG(types[type]));
@@ -79,154 +76,60 @@
 	    (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
 		return (MSG_ORIG(MSG_STT_REGISTER));
 	else
-		return (conv_invalid_str(string, STRSIZE, type, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0));
 }
 
-static const Msg binds[] = {
-	MSG_STB_LOCAL,		MSG_STB_GLOBAL,		MSG_STB_WEAK
-};
-
 const char *
-conv_info_bind_str(uchar_t bind)
+conv_sym_info_bind(uchar_t bind)
 {
-	static char	string[STRSIZE] = { '\0' };
+	static char		string[CONV_INV_STRSIZE];
+	static const Msg	binds[] = {
+		MSG_STB_LOCAL,		MSG_STB_GLOBAL,		MSG_STB_WEAK
+	};
 
 	if (bind >= STB_NUM)
-		return (conv_invalid_str(string, STRSIZE, bind, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, bind, 0));
 	else
 		return (MSG_ORIG(binds[bind]));
 }
 
 const char *
-conv_shndx_str(ushort_t shndx)
+conv_sym_shndx(Half shndx)
 {
-	static	char	string[STRSIZE] = { '\0' };
+	static	char	string[CONV_INV_STRSIZE];
 
-	if (shndx == SHN_UNDEF)
+	switch (shndx) {
+	case SHN_UNDEF:
 		return (MSG_ORIG(MSG_SHN_UNDEF));
-	else if (shndx == SHN_SUNW_IGNORE)
+	case SHN_SUNW_IGNORE:
 		return (MSG_ORIG(MSG_SHN_SUNW_IGNORE));
-	else if (shndx == SHN_ABS)
+	case SHN_ABS:
 		return (MSG_ORIG(MSG_SHN_ABS));
-	else if (shndx == SHN_COMMON)
+	case SHN_COMMON:
 		return (MSG_ORIG(MSG_SHN_COMMON));
-	else if (shndx == SHN_X86_64_LCOMMON)
-		return (MSG_ORIG(MSG_SHN_X86_64_LCOMMON));
-	else if (shndx == SHN_AFTER)
+	case SHN_AMD64_LCOMMON:
+		return (MSG_ORIG(MSG_SHN_AMD64_LCOMMON));
+	case SHN_AFTER:
 		return (MSG_ORIG(MSG_SHN_AFTER));
-	else if (shndx == SHN_BEFORE)
+	case SHN_BEFORE:
 		return (MSG_ORIG(MSG_SHN_BEFORE));
-	else if (shndx == SHN_XINDEX)
+	case SHN_XINDEX:
 		return (MSG_ORIG(MSG_SHN_XINDEX));
-	else
-		return (conv_invalid_str(string, STRSIZE, shndx, 1));
+	default:
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, shndx,
+		    CONV_INV_DECIMAL));
+	}
 }
 
 const char *
-conv_sym_value_str(ushort_t mach, uint_t type, uint64_t value)
+conv_sym_value(Half mach, uchar_t type, Addr value)
 {
-	static char	string[STRSIZE64] = { '\0' };
-	const char	*fmt;
+	static char	string[CONV_INV_STRSIZE];
 
 	if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
 	    (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
-		return (conv_sym_SPARC_value_str(value));
+		return (conv_sym_SPARC_value(value));
 
-	/*
-	 * Should obtain the elf class rather than relying on e_machine here...
-	 */
-	if (mach == EM_SPARCV9)
-		fmt = MSG_ORIG(MSG_FMT_VAL_64);
-	else
-		fmt = MSG_ORIG(MSG_FMT_VAL);
-
-	(void) sprintf(string, fmt, EC_XWORD(value));
+	(void) sprintf(string, MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value));
 	return (string);
 }
-
-/*
- * Demangle C++ symbols.
- *
- * This routine acts as a generic routine for use by liblddbg (and hence tools
- * like elfdump(1) and pvs(1)), ld(1) and ld.so.1(1).
- *
- * The C++ ABI-2 places no limits on symbol names, thus when demangling a name
- * it's possible the buffer won't be big enough (DEMANGLE_ESPACE) so here we
- * try to allocate bigger buffers.  However, we place a limit on this buffer
- * size for fear of a C++ error sending us into an infinit loop.
- *
- * NOTE. we create and use a common buffer for use by cplus_demangle(), thus
- * each call to this routine will override the contents of any existing call.
- * Normally this is sufficient for typical error diagnostics referencing one
- * symbol.  For those diagnostics using more than one symbol name, all but the
- * last name must be copied to a temporary buffer (regardless of whether
- * demangling occurred, as the process of attempting to demangle may damage the
- * buffer).  One model is:
- *
- *	if ((_name1 = demangle(name1)) != name1) {
- *		char *	__name1 = alloca(strlen(_name1) + 1);
- *		(void) strcpy(__name1, _name1);
- *		name1 = (const char *)__name1;
- *	}
- *	name2 = demangle(name2);
- *	eprintf(format, name1, name2);
- */
-#define	SYM_MAX	1000
-
-const char *
-conv_sym_dem(const char *name)
-{
-	static char	_str[SYM_MAX], *str = _str;
-	static size_t	size = SYM_MAX;
-	static int	again = 1;
-	static int	(*fptr)() = 0;
-	int		error;
-
-	if (str == 0)
-		return (name);
-
-	/*
-	 * If we haven't located the demangler yet try now (we do this rather
-	 * than maintain a static dependency on libdemangle as it's part of an
-	 * optional package).  Null the str element out to reject any other
-	 * callers until this operation is complete - under ld.so.1 we can get
-	 * into serious recursion without this.
-	 */
-	if (fptr == 0) {
-		void	*hdl;
-
-		str = 0;
-		if (!(hdl = dlopen(MSG_ORIG(MSG_DEM_LIB), RTLD_LAZY)) ||
-		    !(fptr = (int (*)())dlsym(hdl, MSG_ORIG(MSG_DEM_SYM))))
-			return (name);
-		str = _str;
-	}
-
-	if ((error = (*fptr)(name, str, size)) == 0)
-		return ((const char *)str);
-
-	while ((error == DEMANGLE_ESPACE) && again) {
-		char	*_str;
-		size_t	_size = size;
-
-		/*
-		 * If we haven't allocated our maximum try incrementing the
-		 * present buffer size. Use malloc() rather than realloc() so
-		 * that we at least have the old buffer on failure.
-		 */
-		if (((_size += SYM_MAX) > (SYM_MAX * 4)) ||
-		    ((_str = malloc(_size)) == 0)) {
-			again = 0;
-			break;
-		}
-		if (size != SYM_MAX) {
-			free(str);
-		}
-		str = _str;
-		size = _size;
-
-		if ((error = (*fptr)(name, str, size)) == 0)
-			return ((const char *)str);
-	}
-	return (name);
-}
--- a/usr/src/cmd/sgs/libconv/common/symbols.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/symbols.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -21,10 +17,13 @@
 # information: Portions Copyright [yyyy] [name of copyright owner]
 #
 # CDDL HEADER END
+
 #
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Message file for cmd/sgs/libconv/common/symbols.c
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 @ MSG_STT_NOTYPE	"NOTY"
 @ MSG_STT_OBJECT	"OBJT"
@@ -43,13 +42,10 @@
 @ MSG_SHN_SUNW_IGNORE	"IGNORE"
 @ MSG_SHN_ABS		"ABS"
 @ MSG_SHN_COMMON	"COMMON"
-@ MSG_SHN_X86_64_LCOMMON	"LCOMMON"
+@ MSG_SHN_AMD64_LCOMMON	"LCOMMON"
 @ MSG_SHN_AFTER		"AFTER"
 @ MSG_SHN_BEFORE	"BEFORE"
 @ MSG_SHN_XINDEX	"XINDEX"
 
-@ MSG_FMT_VAL		"0x%8.8llx"
-@ MSG_FMT_VAL_64	"0x%12.12llx"
-
-@ MSG_DEM_SYM		"cplus_demangle"
-@ MSG_DEM_LIB		"libdemangle.so.1"
+@ MSG_SYM_FMT_VAL_32	"0x%8.8llx"
+@ MSG_SYM_FMT_VAL_64	"0x%16.16llx"
--- a/usr/src/cmd/sgs/libconv/common/symbols_sparc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/symbols_sparc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <stdio.h>
@@ -41,12 +42,12 @@
 };
 
 const char *
-conv_sym_SPARC_value_str(uint64_t val)
+conv_sym_SPARC_value(Addr val)
 {
-	static char	string[STRSIZE64] = { '\0' };
+	static char	string[CONV_INV_STRSIZE];
 
 	if ((val < STO_SPARC_REGISTER_G1) || (val > STO_SPARC_REGISTER_G7))
-		return (conv_invalid_str(string, STRSIZE64, val, 0));
+		return (conv_invalid_val(string, CONV_INV_STRSIZE, val, 0));
 	else
 		return (MSG_ORIG(registers[val]));
 }
--- a/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Message file for cmd/sgs/libconv/common/symbols_sparc.c
 
 @ MSG_STO_REGISTERG1	"REG_G1"
 @ MSG_STO_REGISTERG2	"REG_G2"
--- a/usr/src/cmd/sgs/libconv/common/tokens.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/tokens.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1999,2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
--- a/usr/src/cmd/sgs/libconv/common/version.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/common/version.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,11 +33,8 @@
 #include	"version_msg.h"
 
 const char *
-conv_verflg_str(ushort_t flags)
+conv_ver_flags(Half flags)
 {
-	/*
-	 * Presently we only know about a weak flag.
-	 */
 	if (flags & VER_FLG_WEAK)
 		return (MSG_ORIG(MSG_VER_FLG_WEAK));
 	else if (flags & VER_FLG_BASE)
--- a/usr/src/cmd/sgs/libconv/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright (c) 1998 by Sun Microsystems, Inc.
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include 	../Makefile.com
--- a/usr/src/cmd/sgs/libconv/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright (c) 1998 by Sun Microsystems, Inc.
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include 	../Makefile.com
--- a/usr/src/cmd/sgs/libconv/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libconv/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,21 +18,19 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
-# cmd/sgs/libconv/sparcv9/Makefile
 
 include 	../Makefile.com
 
 .PARALLEL:	$(PICS)
 .KEEP_STATE:
 
-CPPFLAGS +=	-D_ELF64
-
 install all:	$(LIBRARY) .WAIT
 
 include 	../Makefile.targ
--- a/usr/src/cmd/sgs/libcrle/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libcrle/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -38,7 +38,8 @@
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install package:	all $(ROOTDYNLIB64)
+install \
+package:	all $(ROOTDYNLIB64)
 
 lint:		$(LINTOUT64) $(SGSLINTOUT)
 
--- a/usr/src/cmd/sgs/libcrle/common/dump.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libcrle/common/dump.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -78,7 +78,7 @@
 		    MSG_ORIG(MSG_FIL_LIBCRLE), dlerror());
 		return (1);
 	}
-	lmp = ghp->gh_owner;
+	lmp = ghp->gh_ownlmp;
 	FLAGS1(lmp) |= FL1_RT_CONFSET;
 
 	/*
@@ -177,7 +177,7 @@
 			if ((ghp = dlmopen(LM_ID_BASE, 0,
 			    (RTLD_NOLOAD | RTLD_CONFGEN))) == 0)
 				return (1);
-			FLAGS1(ghp->gh_owner) |= FL1_RT_CONFSET;
+			FLAGS1(ghp->gh_ownlmp) |= FL1_RT_CONFSET;
 
 		} else {
 			/*
--- a/usr/src/cmd/sgs/libcrle/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libcrle/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,20 +18,23 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
-include		$(SRC)/cmd/sgs/libcrle/Makefile.com
+include		../Makefile.com
 
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install package:	all $(ROOTDYNLIB)
+install \
+package:	all $(ROOTDYNLIB)
 
 lint:		$(LINTOUT32) $(SGSLINTOUT)
 
-include		$(SRC)/cmd/sgs/libcrle/Makefile.targ
+include		../Makefile.targ
--- a/usr/src/cmd/sgs/libcrle/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libcrle/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,11 +18,13 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 include		../Makefile.com
 
@@ -31,7 +32,8 @@
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install package:	all $(ROOTDYNLIB)
+install \
+package:	all $(ROOTDYNLIB)
 
 lint:		$(LINTOUT32) $(SGSLINTOUT)
 
--- a/usr/src/cmd/sgs/libcrle/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libcrle/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -38,7 +38,8 @@
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install package:	all $(ROOTDYNLIB64)
+install \
+package:	all $(ROOTDYNLIB64)
 
 lint:		$(LINTOUT64) $(SGSLINTOUT)
 
--- a/usr/src/cmd/sgs/libelf/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
-
-SPECDIR=	spec
+#
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/libelf/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -64,14 +64,13 @@
 
 WARLOCKFILES=	$(OBJECTS:%.o=wlocks/%.ll)
 
-MAPFILE=	$(MAPDIR)/mapfile
-MAPFILES=	$(MAPFILE)
+MAPFILES=	../common/mapfile-common
 MAPOPTS=	$(MAPFILES:%=-M%)
 
-CLOBBERFILES +=	$(MAPFILE)
+CLOBBERFILES +=
 
 DYNFLAGS +=	$(VERSREF) $(MAPOPTS)
-LDLIBS +=	$(CONVLIBDIR) -lconv $(VAR_LIBELF_LDLIBS) -lc
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(VAR_LIBELF_LDLIBS) -lc
 
 LINTFLAGS +=	-u -erroff=E_BAD_PTR_CAST_ALIGN
 LINTFLAGS64 +=	-u -erroff=E_CAST_INT_TO_SMALL_INT
--- a/usr/src/cmd/sgs/libelf/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# sgs/libelf/Makefile.targ
 
 $(VAR_POUND_2)LIBS +=	$(LIBRARY)
 
@@ -67,12 +66,7 @@
 delete:
 		$(RM) $(DYNLIB)
 
-$(DYNLIB):	$(MAPFILES)
-
-$(VAR_SPEC_ON)$(MAPFILE):
-$(VAR_SPEC_ON)		@ cd $(MAPDIR); $(MAKE) mapfile
-$(VAR_SPEC_OFF)$(MAPFILE):
-$(VAR_SPEC_OFF)		@ sccs get mapfile
+$(DYNLIB):	$$(MAPFILES)
 
 $(LIBLINKS):
 		$(RM) $(LIBLINKS)
--- a/usr/src/cmd/sgs/libelf/Makefile.targ.64	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/Makefile.targ.64	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1997-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# cmd/sgs/libelf/Makefile.targ.64
 
 objs/%.o \
 pics/%.o:	%.c
@@ -64,11 +63,6 @@
 
 $(DYNLIB):	$(MAPFILES)
 
-$(VAR_SPEC_ON)$(MAPFILE):
-$(VAR_SPEC_ON)		@ cd $(MAPDIR); $(MAKE) mapfile
-$(VAR_SPEC_OFF)$(MAPFILE):
-$(VAR_SPEC_OFF)		@ sccs get mapfile
-
 $(LIBLINKS):
 		$(RM) $(LIBLINKS)
 		$(SYMLINK) $(DYNLIB) $(LIBLINKS)
--- a/usr/src/cmd/sgs/libelf/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,14 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-MAPDIR=		$(VAR_MAPDIR_amd64)
-
 include		../Makefile.com
 
 CONVLIBDIR=	$(CONVLIBDIR64)
--- a/usr/src/cmd/sgs/libelf/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,33 +18,17 @@
  *
  * CDDL HEADER END
  */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
 
 /*
- * Copyright (c) 1998 by Sun Microsystems, Inc. 
- * All rights reserved. 
- */ 
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* LINTLIBRARY */
+/* PROTOLIB1 */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-/*
- * Supplimental definitions for lint that help us avoid
- * options like `-x' that filter out things we want to
- * know about as well as things we don't.
- */
-
-/*
- * The public interfaces are allowed to be "declared
- * but not used".
- */
 #include <malloc.h>
 #include <link.h>
-
-
-/*
- * These are from libc.so.1, but are not in it's lint
- * library.
- */
-int	__threaded;
-char *	_dgettext(const char *, const char *);
+#include <sgs.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libelf/common/mapfile-32	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,32 @@
+#
+# 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"
+#
+
+SUNWprivate_1.1 {
+    global:
+	elf_demangle;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libelf/common/mapfile-common	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,187 @@
+#
+# 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"
+#
+
+SUNW_1.6 {
+    global:
+	elf_getphnum;
+} SUNW_1.5;
+
+SUNW_1.5 {
+    global:
+	gelf_getcap;
+	gelf_update_cap;
+} SUNW_1.4;
+
+SUNW_1.4 {
+    global:
+	elf_getshnum;
+	elf_getshstrndx;
+	gelf_getsymshndx;
+	gelf_update_symshndx;
+} SUNW_1.3;
+
+SUNW_1.3 {
+    global:
+	elf32_checksum;
+	elf64_checksum;
+	gelf_checksum;
+} SUNW_1.2;
+
+SUNW_1.2 {
+    global:
+	elf64_fsize;
+	elf64_getehdr;
+	elf64_getphdr;
+	elf64_getshdr;
+	elf64_newehdr;
+	elf64_newphdr;
+	elf64_xlatetof;
+	elf64_xlatetom;
+	gelf_getclass;
+	gelf_fsize;
+	gelf_getehdr;
+	gelf_update_ehdr;
+	gelf_newehdr;
+	gelf_getphdr;
+	gelf_update_phdr;
+	gelf_newphdr;
+	gelf_getshdr;
+	gelf_update_shdr;
+	gelf_xlatetof;
+	gelf_xlatetom;
+	gelf_getsym;
+	gelf_update_sym;
+	gelf_getsyminfo;
+	gelf_getmove;
+	gelf_update_move;
+	gelf_update_syminfo;
+	gelf_getdyn;
+	gelf_update_dyn;
+	gelf_getrela;
+	gelf_update_rela;
+	gelf_getrel;
+	gelf_update_rel;
+} SUNW_1.1;
+
+SUNW_1.1 {
+    global:
+	SUNW_1.1;
+} SUNW_0.7;
+
+SUNW_0.7 {
+    global:
+	elf_begin;
+	elf_end;
+	elf_memory;
+	elf_next;
+	elf_rand;
+	elf_cntl;
+	elf_errmsg;
+	elf_errno;
+	elf_fill;
+	elf_flagdata;
+	elf_flagehdr;
+	elf_flagelf;
+	elf_flagphdr;
+	elf_flagscn;
+	elf_flagshdr;
+	elf_getarhdr;
+	elf_getarsym;
+	elf_getbase;
+	elf_getdata;
+	elf_newdata;
+	elf_rawdata;
+	elf_getident;
+	elf_getscn;
+	elf_ndxscn;
+	elf_newscn;
+	elf_nextscn;
+	elf_hash;
+	elf_kind;
+	elf_rawfile;
+	elf_strptr;
+	elf_update;
+	elf_version;
+	nlist;
+	elf32_fsize;
+	elf32_getphdr;
+	elf32_newphdr;
+	elf32_getshdr;
+	elf32_getehdr;
+	elf32_newehdr;
+	elf32_xlatetof;
+	elf32_xlatetom;
+    local:
+	*;
+};
+
+SUNWprivate_1.1 {
+    global:
+	_elf_getxoff;
+	_elf_outsync;
+	_elf_begin;
+	_elf_memory;
+	_elf_cntl;
+	_elf_end;
+	_elf_errno;
+	_elf_errmsg;
+	_elf_fill;
+	_elf_flagdata;
+	_elf_flagehdr;
+	_elf_flagelf;
+	_elf_flagphdr;
+	_elf_flagscn;
+	_elf_flagshdr;
+	_elf_getarhdr;
+	_elf_getarsym;
+	_elf_getbase;
+	_elf_getdata;
+	_elf32_getehdr;
+	_elf_getident;
+	_elf32_getphdr;
+	_elf_getscn;
+	_elf32_getshdr;
+	_elf_hash;
+	_elf_kind;
+	_elf_ndxscn;
+	_elf_newdata;
+	_elf32_newehdr;
+	_elf32_newphdr;
+	_elf_newscn;
+	_elf_next;
+	_elf_nextscn;
+	_elf_rand;
+	_elf_rawdata;
+	_elf_rawfile;
+	_elf_strptr;
+	_elf_update;
+	_elf32_fsize;
+	_elf32_xlatetof;
+	_elf32_xlatetom;
+	_elf_version;
+};
--- a/usr/src/cmd/sgs/libelf/common/xlate.m4	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/common/xlate.m4	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1600,15 +1600,18 @@
 		dst->n_descsz = tomw(src, N1_descsz_$2);
 		dst->n_type = tomw(src, N1_type_$2);
 		nhdr = dst;
+		/* LINTED */
 		dst = (Elf32_Nhdr *)((char *)dst + sizeof (Elf32_Nhdr));
 		namestr = src + N1_sizeof;
 		field_sz = S_ROUND(nhdr->n_namesz, sizeof (Elf32_Word));
 		(void)memcpy((void *)dst, namestr, field_sz);
 		desc = namestr + field_sz;
+		/* LINTED */
 		dst = (Elf32_Nhdr *)((char *)dst + field_sz);
 		field_sz = nhdr->n_descsz;
 		(void)memcpy(dst, desc, field_sz);
 		field_sz = S_ROUND(field_sz, sizeof (Elf32_Word));
+		/* LINTED */
 		dst = (Elf32_Nhdr *)((char *)dst + field_sz);
 		src = (unsigned char *)desc + field_sz;
 	}
--- a/usr/src/cmd/sgs/libelf/common/xlate64.m4	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/common/xlate64.m4	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1644,15 +1644,18 @@
 		dst->n_descsz = tomw(src, N1_descsz_$2);
 		dst->n_type = tomw(src, N1_type_$2);
 		nhdr = dst;
+		/* LINTED */
 		dst = (Elf64_Nhdr *)((char *)dst + sizeof (Elf64_Nhdr));
 		namestr = src + N1_sizeof;
 		field_sz = S_ROUND(nhdr->n_namesz, sizeof (Elf64_Word));
 		(void)memcpy((void *)dst, namestr, field_sz);
 		desc = namestr + field_sz;
+		/* LINTED */
 		dst = (Elf64_Nhdr *)((char *)dst + field_sz);
 		field_sz = nhdr->n_descsz;
 		(void)memcpy(dst, desc, field_sz);
 		field_sz = S_ROUND(field_sz, sizeof (Elf64_Word));
+		/* LINTED */
 		dst = (Elf64_Nhdr *)((char *)dst + field_sz);
 		src = (unsigned char *)desc + field_sz;
 	}
--- a/usr/src/cmd/sgs/libelf/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,16 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 
-MAPDIR=		$(VAR_MAPDIR_i386)
-
 include		../Makefile.com
 
-# Optimization reduced to level O1 due to compiler bug# 4137136
-
-COPTFLAG=	-xO1
+MAPFILES +=	../common/mapfile-32
 
 SGSMSGTARG +=	$(SGSMSG32)
 
--- a/usr/src/cmd/sgs/libelf/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,16 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 
-MAPDIR=		$(VAR_MAPDIR_sparc)
+include		../Makefile.com
 
-include		../Makefile.com
+MAPFILES +=	../common/mapfile-32
 
 SGSMSGTARG +=	$(SGSMSG32)
 
--- a/usr/src/cmd/sgs/libelf/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libelf/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
-
-MAPDIR=		$(VAR_MAPDIR_sparcv9)
+#
 
 include		../Makefile.com
 
--- a/usr/src/cmd/sgs/libelf/spec/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# 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.
-#
-# 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 (c) 1997-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/Makefile
-
-include	$(SRC)/lib/Makefile.spec.arch
-
-chkmsg:
--- a/usr/src/cmd/sgs/libelf/spec/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#
-# 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.
-#
-# 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
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# cmd/sgs/libelf/Makefile.targ
-
-LIBRARY	=	libelf.a
-VERS	=	.1
-
-OBJECTS	=	elf.o	\
-		elf32.o	\
-		elf64.o	\
-		gelf.o	\
-		weak.o
-
-SPECCPP =
-
-lint:
--- a/usr/src/cmd/sgs/libelf/spec/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# 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.
-#
-# 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 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-
-.KEEP_STATE:
-
-include	../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS	+=
-
-include	$(SRC)/lib/Makefile.lib
-include	$(SRC)/lib/Makefile.lib.64
-
-# Uncomment the following if the linker complains
-#amd64_C_PICFLAGS  = -K PIC
-
-include	$(SRC)/lib/Makefile.spec
-ABILLIBC=
-
-install: $(ROOTABILIB64)
--- a/usr/src/cmd/sgs/libelf/spec/elf.spec	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/elf.spec
-
-
-function	elf_getphnum
-include		<libelf.h>
-declaration	int elf_getphnum(Elf *elf, size_t *phnum)
-version		SUNW_1.6
-end		
-
-function	elf_getshnum
-include		<libelf.h>
-declaration	int elf_getshnum(Elf *elf, size_t *shnum)
-version		SUNW_1.4
-end		
-
-function	elf_getshstrndx
-include		<libelf.h>
-declaration	int elf_getshstrndx(Elf *elf, size_t *shstrndx)
-version		SUNW_1.4
-end		
-
-function	elf_begin
-include		<libelf.h>
-declaration	Elf *elf_begin(int fildes, Elf_Cmd cmd, Elf *ref)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_end
-include		<libelf.h>
-declaration	int elf_end(Elf *elf)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_memory
-include		<libelf.h>
-declaration	Elf *elf_memory(char *image, size_t sz)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_next
-include		<libelf.h>
-declaration	Elf_Cmd elf_next(Elf *elf)
-version		SUNW_0.7
-exception	$return == ELF_C_NULL
-end
-
-function	elf_rand
-include		<libelf.h>
-declaration	size_t elf_rand(Elf *elf, size_t offset)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_cntl
-include		<libelf.h>
-declaration	int elf_cntl(Elf *elf, Elf_Cmd cmd)
-version		SUNW_0.7
-exception	$return == -1
-end
-
-function	elf_errmsg
-include		<libelf.h>
-declaration	const char *elf_errmsg (int err)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_errno
-include		<libelf.h>
-declaration	int elf_errno(void)
-version		SUNW_0.7
-end
-
-function	elf_fill
-include		<libelf.h>
-declaration	void elf_fill(int fill)
-version		SUNW_0.7
-end
-
-function	elf_flagdata
-include		<libelf.h>
-declaration	unsigned elf_flagdata(Elf_Data *data, Elf_Cmd cmd, \
-			unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_flagehdr
-include		<libelf.h>
-declaration	unsigned elf_flagehdr(Elf *elf,	Elf_Cmd cmd, unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_flagelf
-include		<libelf.h>
-declaration	unsigned elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_flagphdr
-include		<libelf.h>
-declaration	unsigned elf_flagphdr(Elf *elf,	Elf_Cmd	cmd, unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_flagscn
-include		<libelf.h>
-declaration	unsigned elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_flagshdr
-include		<libelf.h>
-declaration	unsigned elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags)
-version		SUNW_0.7
-exception	$return == 0
-end
-
-function	elf_getarhdr
-include		<libelf.h>
-declaration	Elf_Arhdr *elf_getarhdr(Elf *elf)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_getarsym
-include		<libelf.h>
-declaration	Elf_Arsym *elf_getarsym(Elf *elf, size_t *ptr)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_getbase
-include		<libelf.h>
-declaration	off_t elf_getbase(Elf *elf)
-version		SUNW_0.7
-exception	$return == -1
-end
-
-function	elf_getdata
-include		<libelf.h>
-declaration	Elf_Data *elf_getdata(Elf_Scn *scn, Elf_Data *data)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_newdata
-include		<libelf.h>
-declaration	Elf_Data *elf_newdata(Elf_Scn *scn)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_rawdata
-include		<libelf.h>
-declaration	Elf_Data *elf_rawdata(Elf_Scn *scn, Elf_Data *data)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_getident
-include		<libelf.h>
-declaration	char *elf_getident(Elf *elf, size_t *ptr)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_getscn
-include		<libelf.h>
-declaration	Elf_Scn *elf_getscn(Elf *elf, size_t index)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_ndxscn
-include		<libelf.h>
-declaration	size_t elf_ndxscn(Elf_Scn *scn)
-version		SUNW_0.7
-exception	$return == SHN_UNDEF
-end
-
-function	elf_newscn
-include		<libelf.h>
-declaration	Elf_Scn *elf_newscn(Elf *elf)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_nextscn
-include		<libelf.h>
-declaration	Elf_Scn *elf_nextscn(Elf *elf, Elf_Scn *scn)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_hash
-include		<libelf.h>
-declaration	unsigned long elf_hash(const char *name)
-version		SUNW_0.7
-end
-
-function	elf_kind
-include		<libelf.h>
-declaration	Elf_Kind elf_kind(Elf *elf)
-version		SUNW_0.7
-exception	$return == ELF_K_NONE
-end
-
-function	elf_rawfile
-include		<libelf.h>
-declaration	char *elf_rawfile(Elf *elf, size_t *ptr)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_strptr
-include		<libelf.h>
-declaration	char *elf_strptr(Elf *elf, size_t section, size_t offset)
-version		SUNW_0.7
-exception	$return == NULL
-end
-
-function	elf_update
-include		<libelf.h>
-declaration	off_t elf_update(Elf *elf, Elf_Cmd cmd)
-version		SUNW_0.7
-exception	$return == -1
-end
-
-function	elf_version
-include		<libelf.h>
-declaration	unsigned elf_version(unsigned ver)
-version		SUNW_0.7
-end
-
-function	nlist
-include		<nlist.h>
-declaration	int nlist(const char *filename, struct nlist *nl)
-version		SUNW_0.7
-exception	$return == -1
-end
-
-function	_elf_getxoff
-version		SUNWprivate_1.1
-end
-
-function	_elf_outsync
-version		SUNWprivate_1.1
-end
-
-function	elf_demangle
-arch		sparc i386
-version		SUNWprivate_1.1
-end
--- a/usr/src/cmd/sgs/libelf/spec/elf32.spec	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/elf32.spec
-
-function	elf32_checksum
-include		<libelf.h>
-declaration	long elf32_checksum(Elf *elf)
-version		SUNW_1.3
-exception	$return == 0
-end		
-
-function	elf32_fsize
-include		<libelf.h>
-declaration	size_t elf32_fsize(Elf_Type type, size_t count, unsigned ver)
-version		SUNW_0.7
-exception	$return == 0
-end		
-
-function	elf32_getphdr
-include		<libelf.h>
-declaration	Elf32_Phdr *elf32_getphdr(Elf *elf)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_newphdr
-include		<libelf.h>
-declaration	Elf32_Phdr *elf32_newphdr(Elf *elf, size_t count)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_getshdr
-include		<libelf.h>
-declaration	Elf32_Shdr *elf32_getshdr(Elf_Scn *scn)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_getehdr
-include		<libelf.h>
-declaration	Elf32_Ehdr *elf32_getehdr(Elf *elf)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_newehdr
-include		<libelf.h>
-declaration	Elf32_Ehdr *elf32_newehdr(Elf *elf)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_xlatetof
-include		<libelf.h>
-declaration	Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,\
-			unsigned encode)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
-function	elf32_xlatetom
-include		<libelf.h>
-declaration	Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src, \
-			unsigned encode)
-version		SUNW_0.7
-exception	$return == NULL
-end		
-
--- a/usr/src/cmd/sgs/libelf/spec/elf64.spec	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/elf64.spec
-
-function	elf64_checksum
-include		<libelf.h>
-declaration	long elf64_checksum(Elf *elf)
-version		SUNW_1.3
-exception	$return == 0
-end		
-
-function	elf64_fsize
-include		<libelf.h>
-declaration	size_t elf64_fsize(Elf_Type type, size_t count, unsigned ver)
-version		SUNW_1.2
-exception	$return == 0
-end		
-
-function	elf64_getehdr
-include		<libelf.h>
-declaration	Elf64_Ehdr *elf64_getehdr(Elf *elf)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_getphdr
-include		<libelf.h>
-declaration	Elf64_Phdr *elf64_getphdr(Elf *elf)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_getshdr
-include		<libelf.h>
-declaration	Elf64_Shdr *elf64_getshdr(Elf_Scn *scn)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_newehdr
-include		<libelf.h>
-declaration	Elf64_Ehdr *elf64_newehdr(Elf *elf)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_newphdr
-include		<libelf.h>
-declaration	Elf64_Phdr *elf64_newphdr(Elf *elf, size_t count)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_xlatetof
-include		<libelf.h>
-declaration	Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,\
-			unsigned encode)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
-function	elf64_xlatetom
-include		<libelf.h>
-declaration	Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src, \
-			unsigned encode)
-version		SUNW_1.2
-exception	$return == NULL
-end		
-
--- a/usr/src/cmd/sgs/libelf/spec/gelf.spec	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/gelf.spec
-
-function	gelf_getsymshndx
-include		<gelf.h>
-declaration	GElf_Sym *gelf_getsymshndx(Elf_Data *symdata, \
-			Elf_Data *shndxdata, int ndx, \
-			GElf_Sym *symptr, Elf32_Word *xshndx);
-version		SUNW_1.4
-end		
-
-function	gelf_update_symshndx
-include		<gelf.h>
-declaration	int gelf_update_symshndx(Elf_Data *symdata, \
-			Elf_Data *shndxdata, int ndx, \
-			GElf_Sym *symptr, Elf32_Word xshndx);
-version		SUNW_1.4
-end		
-
-function	gelf_checksum
-include		<gelf.h>
-declaration	long gelf_checksum(Elf *elf)
-version		SUNW_1.3
-end		
-
-function	gelf_getclass
-include		<gelf.h>
-declaration	int gelf_getclass(Elf *elf)
-version		SUNW_1.2
-end		
-
-function	gelf_fsize
-include		<gelf.h>
-declaration	size_t gelf_fsize(Elf *elf, Elf_Type type, size_t count, unsigned ver)
-version		SUNW_1.2
-end		
-
-function	gelf_getehdr
-include		<gelf.h>
-declaration	GElf_Ehdr *gelf_getehdr(Elf *elf, GElf_Ehdr *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_ehdr
-include		<gelf.h>
-declaration	int gelf_update_ehdr(Elf *elf, GElf_Ehdr *src)
-version		SUNW_1.2
-end		
-
-function	gelf_newehdr
-include		<gelf.h>
-declaration	unsigned long gelf_newehdr(Elf *elf, int elfclass)
-version		SUNW_1.2
-end		
-
-function	gelf_getphdr
-include		<gelf.h>
-declaration	GElf_Phdr *gelf_getphdr(Elf *elf, int ndx, GElf_Phdr *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_phdr
-include		<gelf.h>
-declaration	int gelf_update_phdr(Elf *elf, int ndx, GElf_Phdr *src)
-version		SUNW_1.2
-end		
-
-function	gelf_newphdr
-include		<gelf.h>
-declaration	unsigned long gelf_newphdr(Elf *elf, size_t phnum)
-version		SUNW_1.2
-end		
-
-function	gelf_getshdr
-include		<gelf.h>
-declaration	GElf_Shdr *gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_shdr
-include		<gelf.h>
-declaration	int gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *src)
-version		SUNW_1.2
-end		
-
-function	gelf_xlatetof
-include		<gelf.h>
-declaration	Elf_Data *gelf_xlatetof(Elf *elf, Elf_Data *dst, \
-			const Elf_Data *src, unsigned encode)
-version		SUNW_1.2
-end		
-
-function	gelf_xlatetom
-include		<gelf.h>
-declaration	Elf_Data *gelf_xlatetom(Elf *elf, Elf_Data *dst, \
-			const Elf_Data * src, unsigned encode)
-version		SUNW_1.2
-end		
-
-function	gelf_getsym
-include		<gelf.h>
-declaration	GElf_Sym *gelf_getsym(Elf_Data *data, int ndx, GElf_Sym *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_sym
-include		<gelf.h>
-declaration	int gelf_update_sym(Elf_Data *dest, int ndx, GElf_Sym *src)
-version		SUNW_1.2
-end		
-
-function	gelf_getsyminfo
-include		<gelf.h>
-declaration	GElf_Syminfo *gelf_getsyminfo(Elf_Data *data, int ndx, GElf_Syminfo *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_getmove
-include		<gelf.h>
-declaration	GElf_Move *gelf_getmove(Elf_Data * data, int ndx, GElf_Move *src)
-version		SUNW_1.2
-end		
-
-function	gelf_update_move
-include		<gelf.h>
-declaration	int gelf_update_move(Elf_Data *dest, int ndx, GElf_Move *src)
-version		SUNW_1.2
-end		
-
-function	gelf_update_syminfo
-include		<gelf.h>
-declaration	int gelf_update_syminfo(Elf_Data *dest, int ndx, \
-			GElf_Syminfo *src)
-version		SUNW_1.2
-end		
-
-function	gelf_getdyn
-include		<gelf.h>
-declaration	GElf_Dyn *gelf_getdyn(Elf_Data *src, int ndx, GElf_Dyn *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_dyn
-include		<gelf.h>
-declaration	int gelf_update_dyn(Elf_Data *dst, int ndx, GElf_Dyn *src)
-version		SUNW_1.2
-end		
-
-function	gelf_getrela
-include		<gelf.h>
-declaration	GElf_Rela *gelf_getrela(Elf_Data *src, int ndx, GElf_Rela *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_rela
-include		<gelf.h>
-declaration	int gelf_update_rela(Elf_Data *dst, int ndx, GElf_Rela *src)
-version		SUNW_1.2
-end		
-
-function	gelf_getrel
-include		<gelf.h>
-declaration	GElf_Rel *gelf_getrel(Elf_Data *src, int ndx, GElf_Rel *dst)
-version		SUNW_1.2
-end		
-
-function	gelf_update_rel
-include		<gelf.h>
-declaration	int gelf_update_rel(Elf_Data *dst, int ndx, GElf_Rel *src)
-version		SUNW_1.2
-end		
-
-function	gelf_getcap
-include		<gelf.h>
-declaration	GElf_Cap *gelf_getcap(Elf_Data *dst, int ndx, GElf_Cap *src)
-version		SUNW_1.5
-end
-
-function	gelf_update_cap
-include		<gelf.h>
-declaration	int gelf_update_cap(Elf_Data *dst, int ndx, GElf_Cap *src)
-version		SUNW_1.5
-end
--- a/usr/src/cmd/sgs/libelf/spec/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# 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.
-#
-# 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
-#
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# cmd/sgs/libelf/spec/i386/Makefile
-
-.KEEP_STATE:
-
-include	../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS	+=
-
-include	$(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#i386_C_PICFLAGS  = -K PIC
-
-include	$(SRC)/lib/Makefile.spec
-ABILLIBC=
-
-install: $(ROOTABILIB)
--- a/usr/src/cmd/sgs/libelf/spec/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# 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.
-#
-# 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
-#
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# cmd/sgs/libelf/spec/sparc/Makefile
-
-.KEEP_STATE:
-
-include	../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS	+=
-
-include	$(SRC)/lib/Makefile.lib
-
-# Uncomment the following if the linker complains
-#sparc_C_PICFLAGS  = -K PIC
-
-include	$(SRC)/lib/Makefile.spec
-ABILLIBC=
-
-install: $(ROOTABILIB)
--- a/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# 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.
-#
-# 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
-#
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# cmd/sgs/libelf/spec/sparcv9/Makefile
-
-.KEEP_STATE:
-
-include	../Makefile.targ
-
-# Add arch specific objects here
-OBJECTS	+=
-
-include	$(SRC)/lib/Makefile.lib
-include	$(SRC)/lib/Makefile.lib.64
-
-# Uncomment the following if the linker complains
-sparcv9_C_PICFLAGS  = -K PIC
-
-include	$(SRC)/lib/Makefile.spec
-ABILLIBC=
-
-install: $(ROOTABILIB64)
--- a/usr/src/cmd/sgs/libelf/spec/versions	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Note: Even though the SUNW_1.1 version now contains no symbols
-# beyond what was present at Solaris 2.3, the SUNW_1.1 version MUST be 
-# present.  This is because applications built on 2.6 Beta 
-# (when it did contain symbols explicitly) may depend on it.
-#
-sparc {
-	SUNW_1.6:	{SUNW_1.5};
-	SUNW_1.5:	{SUNW_1.4};
-	SUNW_1.4:	{SUNW_1.3};
-	SUNW_1.3:	{SUNW_1.2};
-	SUNW_1.2:	{SUNW_1.1};
-	SUNW_1.1:	{SUNW_0.7};
-	SUNW_0.7;
-	SUNWprivate_1.1;
-}
-sparcv9 {
-	SUNW_1.6:	{SUNW_1.5};
-	SUNW_1.5:	{SUNW_1.4};
-	SUNW_1.4:	{SUNW_1.3};
-	SUNW_1.3:	{SUNW_1.2};
-	SUNW_1.2:	{SUNW_1.1};
-	SUNW_1.1:	{SUNW_0.7};
-	SUNW_0.7;
-	SUNWprivate_1.1;
-}
-i386 {
-	SUNW_1.6:	{SUNW_1.5};
-	SUNW_1.5:	{SUNW_1.4};
-	SUNW_1.4:	{SUNW_1.3};
-	SUNW_1.3:	{SUNW_1.2};
-	SUNW_1.2:	{SUNW_1.1};
-	SUNW_1.1:	{SUNW_0.7};
-	SUNW_0.7;
-	SUNWprivate_1.1;
-}
-amd64 {
-	SUNW_1.6:	{SUNW_1.5};
-	SUNW_1.5:	{SUNW_1.4};
-	SUNW_1.4:	{SUNW_1.3};
-	SUNW_1.3:	{SUNW_1.2};
-	SUNW_1.2:	{SUNW_1.1};
-	SUNW_1.1:	{SUNW_0.7};
-	SUNW_0.7;
-	SUNWprivate_1.1;
-}
--- a/usr/src/cmd/sgs/libelf/spec/weak.spec	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# cmd/sgs/libelf/spec/weak.spec
-
-function	_elf_begin
-weak		elf_begin
-version		SUNWprivate_1.1
-end		
-
-function	_elf_memory
-weak		elf_memory
-version		SUNWprivate_1.1
-end		
-
-function	_elf_cntl
-weak		elf_cntl
-version		SUNWprivate_1.1
-end		
-
-function	_elf_end
-weak		elf_end
-version		SUNWprivate_1.1
-end		
-
-function	_elf_errno
-weak		elf_errno
-version		SUNWprivate_1.1
-end		
-
-function	_elf_errmsg
-weak		elf_errmsg
-version		SUNWprivate_1.1
-end		
-
-function	_elf_fill
-weak		elf_fill
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagdata
-weak		elf_flagdata
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagehdr
-weak		elf_flagehdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagelf
-weak		elf_flagelf
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagphdr
-weak		elf_flagphdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagscn
-weak		elf_flagscn
-version		SUNWprivate_1.1
-end		
-
-function	_elf_flagshdr
-weak		elf_flagshdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getarhdr
-weak		elf_getarhdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getarsym
-weak		elf_getarsym
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getbase
-weak		elf_getbase
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getdata
-weak		elf_getdata
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_getehdr
-weak		elf32_getehdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getident
-weak		elf_getident
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_getphdr
-weak		elf32_getphdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_getscn
-weak		elf_getscn
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_getshdr
-weak		elf32_getshdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_hash
-weak		elf_hash
-version		SUNWprivate_1.1
-end		
-
-function	_elf_kind
-weak		elf_kind
-version		SUNWprivate_1.1
-end		
-
-function	_elf_ndxscn
-weak		elf_ndxscn
-version		SUNWprivate_1.1
-end		
-
-function	_elf_newdata
-weak		elf_newdata
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_newehdr
-weak		elf32_newehdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_newphdr
-weak		elf32_newphdr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_newscn
-weak		elf_newscn
-version		SUNWprivate_1.1
-end		
-
-function	_elf_next
-weak		elf_next
-version		SUNWprivate_1.1
-end		
-
-function	_elf_nextscn
-weak		elf_nextscn
-version		SUNWprivate_1.1
-end		
-
-function	_elf_rand
-weak		elf_rand
-version		SUNWprivate_1.1
-end		
-
-function	_elf_rawdata
-weak		elf_rawdata
-version		SUNWprivate_1.1
-end		
-
-function	_elf_rawfile
-weak		elf_rawfile
-version		SUNWprivate_1.1
-end		
-
-function	_elf_strptr
-weak		elf_strptr
-version		SUNWprivate_1.1
-end		
-
-function	_elf_update
-weak		elf_update
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_fsize
-weak		elf32_fsize
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_xlatetof
-weak		elf32_xlatetof
-version		SUNWprivate_1.1
-end		
-
-function	_elf32_xlatetom
-weak		elf32_xlatetom
-version		SUNWprivate_1.1
-end		
-
-function	_elf_version
-weak		elf_version
-version		SUNWprivate_1.1
-end		
-
--- a/usr/src/cmd/sgs/libld/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,11 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/libld/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,39 +18,51 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-LIBRARY=	libld.a
-VERS=		.2
+LIBRARY =	libld.a
+VERS =		.4
+
+COMOBJS =	debug.o		globals.o	util.o
 
-G_MACHOBJS=	doreloc.o
-L_MACHOBJS= 	machrel.o	machsym.o
+COMOBJS32 =	args32.o	entry32.o	exit32.o	groups32.o \
+		ldentry32.o	ldlibs32.o	ldmain32.o	libs32.o \
+		files32.o	map32.o		order32.o	outfile32.o \
+		place32.o	relocate32.o	resolve32.o	sections32.o \
+		sunwmove32.o	support32.o	syms32.o	update32.o \
+		version32.o
 
-TOOLOBJS=	alist.o		assfail.o	findprime.o	string_table.o \
+COMOBJS64 =	args64.o	entry64.o	exit64.o	groups64.o \
+		ldentry64.o	ldlibs64.o	ldmain64.o	libs64.o \
+		files64.o	map64.o		order64.o	outfile64.o \
+		place64.o	relocate64.o	resolve64.o	sections64.o \
+		sunwmove64.o	support64.o	syms64.o	update64.o \
+		version64.o
+
+TOOLOBJS =	alist.o		assfail.o	findprime.o	string_table.o \
 		strhash.o
-AVLOBJ=		avl.o
-COMOBJS=	entry.o		files.o		globals.o	libs.o \
-		order.o		outfile.o	place.o		relocate.o \
-		resolve.o	sections.o	support.o	sunwmove.o \
-		syms.o		update.o	util.o		version.o \
-		args.o		debug.o		ldentry.o	groups.o \
-		ldlibs.o	ldmain.o	exit.o		map.o
-COMOBJS64=	$(COMOBJS:%.o=%64.o)
-BLTOBJ=		msg.o
-ELFCAPOBJ=	elfcap.o
+AVLOBJ =	avl.o
+
+G_MACHOBJS32 =	doreloc32.o
+G_MACHOBJS64 =	doreloc64.o
 
-OBJECTS=	$(BLTOBJ)  $(G_MACHOBJS)  $(L_MACHOBJS)  $(COMOBJS) \
-		$(TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ)
+BLTOBJ =	msg.o
+ELFCAPOBJ =	elfcap.o
+
+OBJECTS =	$(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \
+		$(L_MACHOBJS32) $(L_MACHOBJS64) \
+		$(COMOBJS) $(COMOBJS32) $(COMOBJS64) \
+		$(TOOLOBJS) $(E_TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ)
 
 include 	$(SRC)/lib/Makefile.lib
 include 	$(SRC)/cmd/sgs/Makefile.com
 
-PLAT=		$(VAR_PLAT_$(BASEPLAT))
 MAPFILES=	../common/mapfile-vers
 MAPOPTS=	$(MAPFILES:%=-M%)
 
@@ -65,49 +76,54 @@
 package	:=	DLLIB = $(VAR_PKG_DL_LIB)
 
 CPPFLAGS +=	-DUSE_LIBLD_MALLOC -I$(SRCBASE)/uts/common/krtld \
-		-I$(ELFCAP) -D_REENTRANT $(VAR_LIBLD_CPPFLAGS)
-LLDLIBS=	$(LDDBGLIBDIR) $(LDDBG_LIB) $(ELFLIBDIR) -lelf $(DLLIB)
-LDLIBS +=	$(CONVLIBDIR) -lconv $(LLDLIBS) -lc
-LINTFLAGS +=	-u $(LDDBGLIBDIR) $(CONVLIBDIR) \
-		-erroff=E_NAME_DECL_NOT_USED_DEF2
-LINTFLAGS64 +=	-u $(LDDBGLIBDIR64) $(CONVLIBDIR64) \
-		-erroff=E_NAME_DECL_NOT_USED_DEF2 \
-		-erroff=E_CAST_INT_TO_SMALL_INT
-ORIGIN =	'-R$$ORIGIN'
-HSONAME =	-h$(SONAME)
+		    -I$(ELFCAP) $(VAR_LIBLD_CPPFLAGS)
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(LDDBGLIBDIR) $(LDDBG_LIB) \
+		    $(ELFLIBDIR) -lelf $(DLLIB) -lc
+
+LINTFLAGS +=	-u -D_REENTRANT
+LINTFLAGS64 +=	-u -D_REENTRANT
+
 DYNFLAGS +=	$(BDIRECT) $(VERSREF) \
-		$(ZLAZYLOAD) $(MAPOPTS) $(USE_PROTO) $(ORIGIN)
+		$(ZLAZYLOAD) $(MAPOPTS) $(USE_PROTO) '-R$$ORIGIN'
 
 $(VAR_POUND_3)DEFS=
 $(VAR_POUND_3)native:=	MAPOPTS	=
 native:=	DYNFLAGS	+= $(CONVLIBDIR)
 
-BLTDEFS=	msg.h
-BLTDATA=	msg.c
-BLTMESG=	$(SGSMSGDIR)/libld
+BLTDEFS =	msg.h
+BLTDATA =	msg.c
+BLTMESG =	$(SGSMSGDIR)/libld
 
-BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
+BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM=	../common/libld.msg
-SGSMSGSPARC=	../common/libld.sparc.msg
-SGSMSGINTEL=	../common/libld.intel.msg
-SGSMSGTARG=	$(SGSMSGCOM)
-SGSMSGALL=	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
+SGSMSGCOM =	../common/libld.msg
+SGSMSGSPARC =	../common/libld.sparc.msg
+SGSMSGINTEL =	../common/libld.intel.msg
+SGSMSGTARG =	$(SGSMSGCOM)
+SGSMSGALL =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
+
+SGSMSGFLAGS1 =	$(SGSMSGFLAGS) -m $(BLTMESG)
+SGSMSGFLAGS2 =	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg
 
-SGSMSGFLAGS1=	$(SGSMSGFLAGS) -m $(BLTMESG)
-SGSMSGFLAGS2=	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg
+CHKSRCS =	$(SRCBASE)/uts/common/krtld/reloc.h \
+		$(COMOBJS32:%32.o=../common/%.c) \
+		$(L_MACHOBJS32:%32.o=../common/%.c) \
+		$(L_MACHOBJS64:%64.o=../common/%.c)
 
-SRCS=		../common/llib-lld
-LIBSRCS=	$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
-		$(COMOBJS:%.o=../common/%.c) $(BLTDATA) \
+SRCS =		../common/llib-lld
+LIBSRCS =	$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
+		$(E_TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
+		$(COMOBJS:%.o=../common/%.c) \
 		$(AVLOBJS:%.o=$(VAR_AVLDIR)/%.c) \
-		$(G_MACHOBJS:%.o=$(SRCBASE)/uts/$(PLAT)/krtld/%.c)
+		$(BLTDATA)
 
-LINTSRCS32 = $(L_MACHSRCS32)
-LINTSRCS64 = $(L_MACHSRCS64)
-LINTSRCS = $(LIBSRCS)
+LINTSRCS =	$(LIBSRCS) ../common/lintsup.c
+LINTSRCS32 =	$(COMOBJS32:%32.o=../common/%.c) \
+		$(L_MACHOBJS32:%32.o=../common/%.c)
+LINTSRCS64 =	$(COMOBJS64:%64.o=../common/%.c) \
+		$(L_MACHOBJS64:%64.o=../common/%.c)
 
 CLEANFILES +=	$(LINTOUTS) $(BLTFILES)
 CLOBBERFILES +=	$(DYNLIB) $(LINTLIBS) $(LIBLINKS)
 
-ROOTFS_DYNLIB=	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
+ROOTFS_DYNLIB =	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
--- a/usr/src/cmd/sgs/libld/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,37 +18,52 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-
-pics64/%.o:	../common/%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
-		$(POST_PROCESS_O)
-
-pics64/%.o:	./%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
-		$(POST_PROCESS_O)
 
 pics/%.o:	../common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics64/%.o pics/%.o: \
-		$(SGSTOOLS)/common/%.c
+pics/%32.o:	../common/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
+		$(POST_PROCESS_O)
+
+pics/%64.o:	../common/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
+		$(POST_PROCESS_O)
+
+pics/%32.o:	%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
+		$(POST_PROCESS_O)
+
+pics/%64.o:	%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
+		$(POST_PROCESS_O)
+
+pics/%.o:	$(SGSTOOLS)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics64/%.o pics/%.o: \
-		$(VAR_AVLDIR)/%.c
+pics/%.o:	$(VAR_AVLDIR)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics64/elfcap.o pics/elfcap.o: \
-		$(ELFCAP)/elfcap.c
-		$(COMPILE.c) -DCAP_LOWERCASE -o $@ $(ELFCAP)/elfcap.c
+#pics/%32.o:	$(SRCBASE)/uts/$(PLAT)/krtld/%.c
+#		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
+#		$(POST_PROCESS_O)
+#
+#pics/%64.o:	$(SRCBASE)/uts/$(PLAT)/krtld/%.c
+#		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
+#		$(POST_PROCESS_O)
+
+pics/elfcap.o:	$(ELFCAP)/elfcap.c
+		$(COMPILE.c) -o  $@ -DCAP_LOWERCASE $(ELFCAP)/elfcap.c
 		$(POST_PROCESS_O)
 
 $(DYNLIB):	$(MAPFILES)
@@ -60,6 +74,11 @@
 delete:
 		$(RM) $(DYNLIB)
 
+.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
+
+lint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
+		    .WAIT $(SGSLINTOUT)
+
 # Special target for native builds (ie. when we need to build a version of ld
 # to build a version of ld :-).
 
@@ -79,7 +98,7 @@
 
 catalog:	$(BLTMESG)
 
-chkmsg:		$(LIBSRCS)
+chkmsg:		$(LIBSRCS) $(CHKSRCS)
 		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
 
 $(BLTDEFS) + \
@@ -88,5 +107,3 @@
 
 $(BLTMESG):	$(SGSMSGALL)
 		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
-
-lint:		$(LINTLIB32) $(LINTOUT32) $(SGSLINTOUT)
--- a/usr/src/cmd/sgs/libld/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,123 +18,82 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-BASEPLAT=	amd64
-
-include		$(SRC)/cmd/sgs/libld/Makefile.com
-
-#
-# Share machsym.c with the 32-bit i386 directory since
-# they both need the Elf32 and the Elf64 code.
-#
-L_MACHSRCS32=	../i386/machrel.c ../i386/machsym.c
-L_MACHSRCS64 =	machrel.c ../i386/machsym.c \
-		amd64unwind.c ../../tools/common/leb128.c
-
-CHKSRCS +=	machrel.c ../i386/machrel.c amd64unwind.c \
-		../../tools/common/leb128.c
-
-LIB64=		libld.so.3
-$(LIB64) :=	SONAME = $(LIB64)
-
-DBGLIB =	-L ../../liblddbg/$(MACH64)
-CONVLIB =	-L ../../libconv/$(MACH64)
-ELFLIB =	-L ../../libelf/$(MACH64)
-DYNFLAGS +=	$(DBGLIB) $(CONVLIB) $(ELFLIB)
-
-SGSMSGTARG +=	$(SGSMSGINTEL)
+E_TOOLOBJS =	leb128.o
+L_MACHOBJS32 =	machrel.intel32.o	machsym.intel32.o
+L_MACHOBJS64 =	machrel.amd64.o		machsym.intel64.o	unwind.amd64.o
 
-.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
+include		../Makefile.com
 
-PICS64=		$(OBJECTS:%=pics64/%) pics64/amd64unwind.o pics64/leb128.o
-$(PICS64) :=	amd64_CFLAGS += $(C_PICFLAGS)
-CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64)
-$(PICS64)  :=	CFLAGS += $(CTF_FLAGS)
-$(PICS64)  :=	CFLAGS64 += $(CTF_FLAGS)
-$(PICS64)  :=	CTFCONVERT_POST = $(CTFCONVERT_O)
-$(LIB64)   :=	CTFMERGE_POST = $(CTFMERGE_LIB64)
-$(PICS64) :=    CPPFLAGS += -I../../../../uts/intel/amd64/krtld
-$(PICS64) :=	CPPFLAGS += -DELF_TARGET_AMD64
-$(PICS) :=      CPPFLAGS += -I../../../../uts/intel/ia32/krtld
-$(PICS) :=	CPPFLAGS += -DELF_TARGET_386
-
-.PARALLEL:	$(PICS64)
-
-ROOTFS_LIBDIR=		$(VAR_LIBLD_64_ROOTFS_LIBDIR)
-ROOTFS_DYNLIB64=	$(ROOTFS_LIBDIR)/$(LIB64)
-$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
-
-$(LINTOUT32) :=	CPPFLAGS += -I../../../../uts/intel/ia32/krtld \
-		-DELF_TARGET_386
-$(LINTOUT64) :=	CPPFLAGS += -I../../../../uts/intel/amd64/krtld \
-		-DELF_TARGET_AMD64
 .KEEP_STATE:
 
-all:		$(DYNLIB) $(LIBLINKS) $(LIB64)
-
-
-LINK.LIB64 = $(CC) $(amd64_CFLAGS) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS)
-$(LIB64) $(SGSPROTO)/$(LIB64): pics64 .WAIT $$(PICS64) $(MAPFILES)
-	$(LINK.LIB64)
-	$(POST_PROCESS_SO)
-
-lint:		$(LINTLIB64) $(LINTOUT64)
-
-native:		$(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64)
-
-native-proto:
-		-@mkdir -p proto/$(MACH) proto/$(MACH64)
+ROOTFS_LIBDIR64 = \
+		$(VAR_LIBLD_64_ROOTFS_LIBDIR)
 
-pics64:
-		-@mkdir -p $@
-
-
-install package:	all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64)
-
-
-clean: clean64
+ROOTFS_DYNLIB64 = \
+		$(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
 
-clean64:
-	-$(RM) $(PICS64)
-
-clobber: clobber64
-clobber64:
-	-$(RM) $(LIB64)
-
-delete:
-		$(RM) $(DYNLIB) $(LIB64)
+SGSMSGCHK =	../common/libld.chk.msg
+SGSMSGTARG +=	$(SGSMSGINTEL)
 
 #
-# Grab 32bit i386 files for libld.so.2
+# For cross-compilation, it is necessary to trigger the correct include files
+# (see sys/elf.h).
 #
-pics/machrel.o:	../i386/machrel.c
-		$(COMPILE.c) -o $@ -D_ELF32 ../i386/machrel.c
-		$(POST_PROCESS_O)
+ELFTARGET64 =	-DELF_TARGET_AMD64
+ELFTARGET32 =	-DELF_TARGET_386
+
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+
+$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+
+all:		$(DYNLIB) $(LIBLINKS)
+
+install \
+package:	all $(ROOTFS_DYNLIB64)
+
+include		../Makefile.targ
+include		../../Makefile.sub.64
+
+# Associate ELF32 and ELF64 objects to the appropriate headers.
 
-pics/machsym.o:	../i386/machsym.c
-		$(COMPILE.c) -o $@ -D_ELF32 ../i386/machsym.c
-		$(POST_PROCESS_O)
+pics/%32.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld
+pics/%64.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld
+
+# Associate the various lint targets with the appropriate headers/files.
 
-pics64/machsym.o:	../i386/machsym.c
-		$(COMPILE.c) -o $@ -D_ELF64 ../i386/machsym.c
+$(LINTOUT32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \
+		    $(ELFTARGET32)
+$(LINTOUT64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+$(LINTLIB32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \
+		    $(ELFTARGET32)
+$(LINTLIB64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+
+LINTSRCS32 +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c)
+LINTSRCS64 +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c)
+
+# Compensate chkmsg with the doreloc family.
+
+CHKSRCS +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c)
+CHKSRCS +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c)
+
+pics/%32.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
 		$(POST_PROCESS_O)
 
-
-include		$(SRC)/cmd/sgs/libld/Makefile.targ
-include		../../Makefile.sub.64
-
-$(LIBLINKS) :=	DYNLIB=$(LIB64)
-
-pics64/%.o:	$(SRCBASE)/uts/intel/amd64/krtld/%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
+pics/%64.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
 		$(POST_PROCESS_O)
-
-pics/%.o:	$(SRCBASE)/uts/intel/ia32/krtld/%.c
-		$(COMPILE.c) -o $@ $<
-		$(POST_PROCESS_O)
--- a/usr/src/cmd/sgs/libld/amd64/amd64unwind.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,739 +0,0 @@
-/*
- * 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.
- *
- * 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 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<string.h>
-#include	<stdio.h>
-#include	<sys/types.h>
-#include	<sgs.h>
-#include	<debug.h>
-#include	<_libld.h>
-#include	<sys/elf_amd64.h>
-#include	<dwarf.h>
-#include	<stdlib.h>
-
-/*
- * A EH_FRAME_HDR consists of the following:
- *
- *	Encoding	Field
- *	--------------------------------
- *	unsigned byte	version
- *	unsigned byte	eh_frame_ptr_enc
- *	unsigned byte	fde_count_enc
- *	unsigned byte	table_enc
- *	encoded		eh_frame_ptr
- *	encoded		fde_count
- *	[ binary search table ]
- *
- * The binary search table entries each consists of:
- *
- *	encoded		initial_func_loc
- *	encoded		FDE_address
- *
- * The entries in the binary search table are sorted
- * in a increasing order by the initial location.
- *
- *
- * version
- *
- *   Version of the .eh_frame_hdr format. This value shall be 1.
- *
- * eh_frame_ptr_enc
- *
- *    The encoding format of the eh_frame_ptr field.  For shared
- *    libraries the encoding must be
- *    DW_EH_PE_sdata4|DW_EH_PE_pcrel or
- *    DW_EH_PE_sdata4|DW_EH_PE_datarel.
- *
- *
- * fde_count_enc
- *
- *    The encoding format of the fde_count field. A value of
- *    DW_EH_PE_omit indicates the binary search table is not
- *    present.
- *
- * table_enc
- *
- *    The encoding format of the entries in the binary search
- *    table. A value of DW_EH_PE_omit indicates the binary search
- *    table is not present. For shared libraries the encoding
- *    must be DW_EH_PE_sdata4|DW_EH_PE_pcrel or
- *    DW_EH_PE_sdata4|DW_EH_PE_datarel.
- *
- *
- * eh_frame_ptr
- *
- *    The encoded value of the pointer to the start of the
- *    .eh_frame section.
- *
- * fde_count
- *
- *    The encoded value of the count of entries in the binary
- *    search table.
- *
- * binary search table
- *
- *    A binary search table containing fde_count entries. Each
- *    entry of the table consist of two encoded values, the
- *    initial location of the function to which an FDE applies,
- *    and the address of the FDE. The entries are sorted in an
- *    increasing order by the initial location value.
- *
- */
-
-
-/*
- * EH_FRAME sections
- * =================
- *
- * The call frame information needed for unwinding the stack is output in
- * an ELF section(s) of type SHT_AMD64_UNWIND. In the simplest case there
- * will be one such section per object file and it will be named
- * ".eh_frame".  An .eh_frame section consists of one or more
- * subsections. Each subsection contains a CIE (Common Information Entry)
- * followed by varying number of FDEs (Frame Descriptor Entry). A FDE
- * corresponds to an explicit or compiler generated function in a
- * compilation unit, all FDEs can access the CIE that begins their
- * subsection for data.
- *
- * If an object file contains C++ template instantiations there shall be
- * a separate CIE immediately preceding each FDE corresponding to an
- * instantiation.
- *
- * Using the preferred encoding specified below, the .eh_frame section can
- * be entirely resolved at link time and thus can become part of the
- * text segment.
- *
- * .eh_frame Section Layout
- * ------------------------
- *
- * EH_PE encoding below refers to the pointer encoding as specified in the
- * enhanced LSB Chapter 7 for Eh_Frame_Hdr.
- *
- * Common Information Entry (CIE)
- * ------------------------------
- * CIE has the following format:
- *
- *                           Length
- *                              in
- *     Field                   Byte      Description
- *     -----                  ------     -----------
- *  1. Length                   4        Length of CIE (not including
- *					 this 4-byte field).
- *
- *  2. CIE id                   4        Value Zero (0) for .eh_frame
- *					 (used to distinguish CIEs and
- *					 FDEs when scanning the section)
- *
- *  3. Version                  1        Value One (1)
- *
- *  4. CIE Augmentation       string     Null-terminated string with legal
- *					 values being "" or 'z' optionally
- *					 followed by single occurrances of
- *					 'P', 'L', or 'R' in any order.
- *     String                            The presence of character(s) in the
- *                                       string dictates the content of
- *                                       field 8, the Augmentation Section.
- *					 Each character has one or two
- *					 associated operands in the AS.
- *					 Operand order depends on
- *					 position in the string ('z' must
- *					 be first).
- *
- *  5. Code Align Factor      uleb128    To be multiplied with the
- *					 "Advance Location" instructions in
- *                                       the Call Frame Instructions
- *
- *  6. Data Align Factor      sleb128    To be multiplied with all offset
- *                                       in the Call Frame Instructions
- *
- *  7. Ret Address Reg          1        A "virtual' register representation
- *                                       of the return address. In Dwarf V2,
- *                                       this is a byte, otherwise it is
- *                                       uleb128. It is a byte in gcc 3.3.x
- *
- *  8. Optional CIE           varying    Present if Augmentation String in
- *     Augmentation Section              field 4 is not 0.
- *
- *     z:
- * 	size		   uleb128       Length of the remainder of the
- *				         Augmentation Section
- *
- *     P:
- * 	personality_enc    1	         Encoding specifier - preferred
- *					 value is a pc-relative, signed
- *				         4-byte
- *
- *
- *        personality routine (encoded)  Encoded pointer to personality
- *					 routine (actually to the PLT
- *				         entry for the personality
- *				         routine)
- *     R:
- * 	code_enc           1	      Non-default encoding for the
- *				      code-pointers (FDE members
- *				      "initial_location" and "address_range"
- *				      and the operand for DW_CFA_set_loc)
- *				      - preferred value is pc-relative,
- *				      signed 4-byte.
- *     L:
- * 	lsda_enc	   1	      FDE augmentation bodies may contain
- *				      LSDA pointers. If so they are
- *				      encoded as specified here -
- *				      preferred value is pc-relative,
- *				      signed 4-byte possibly indirect
- *				      thru a GOT entry.
- *
- *
- *  9. Optional Call Frame varying
- *     Instructions
- *
- * The size of the optional call frame instruction area must be computed
- * based on the overall size and the offset reached while scanning the
- * preceding fields of the CIE.
- *
- *
- * Frame Descriptor Entry (FDE)
- * ----------------------------
- * FDE has the following format:
- *
- *                            Length
- *                              in
- *     Field                   Byte      Description
- *     -----                  ------     -----------
- *  1. Length                   4        Length of remainder of this FDE
- *
- *  2. CIE Pointer              4        Distance from this field to the
- *				         nearest preceding CIE
- *				         (uthe value is subtracted from the
- *					 current address). This value
- *				         can never be zero and thus can
- *				         be used to distinguish CIE's and
- *				         FDE's when scanning the
- *				         .eh_frame section
- *
- *  3. Initial Location       varying    Reference to the function code
- *                                       corresponding to this FDE.
- *                                       If 'R' is missing from the CIE
- *                                       Augmentation String, the field is an
- *                                       8-byte absolute pointer. Otherwise,
- *                                       the corresponding EH_PE encoding in the
- *                                       CIE Augmentation Section is used to
- *                                       interpret the reference.
- *
- *  4. Address Range          varying    Size of the function code corresponding
- *                                       to this FDE.
- *                                       If 'R' is missing from the CIE
- *                                       Augmentation String, the field is an
- *                                       8-byte unsigned number. Otherwise,
- *                                       the size is determined by the
- *				         corresponding EH_PE encoding in the
- *                                       CIE Augmentation Section (the
- *				         value is always absolute).
- *
- *  5. Optional FDE           varying    present if CIE augmentation
- *     Augmentation Section	         string is non-empty.
- *
- *
- *     'z':
- * 	length		   uleb128       length of the remainder of the
- *				         FDE augmentation section
- *
- *
- *     'L' (and length > 0):
- *         LSDA               varying    LSDA pointer, encoded in the
- *				         format specified by the
- *				         corresponding operand in the CIE's
- *				         augmentation body.
- *
- *  6. Optional Call          varying
- *     Frame Instructions
- *
- * The size of the optional call frame instruction area must be computed
- * based on the overall size and the offset reached while scanning the
- * preceding fields of the FDE.
- *
- * The overall size of a .eh_frame section is given in the ELF section
- * header.  The only way to determine the number of entries is to scan
- * the section till the end and count.
- *
- */
-
-
-
-
-/*
- * The job of this function is to determine how much space
- * will be required for the final table.  We'll build
- * it later.
- */
-uintptr_t
-make_amd64_unwindhdr(Ofl_desc *ofl)
-{
-	Shdr	    *shdr;
-	Elf_Data    *elfdata;
-	Is_desc	    *isec;
-	Xword	    size;
-	Xword	    fde_cnt;
-	Listnode    *lnp;
-	Os_desc	    *osp;
-
-	/*
-	 * we only build a unwind header if we have
-	 * sum unwind information in the file.
-	 */
-	if (ofl->ofl_unwind.head == NULL)
-		return (1);
-
-	/*
-	 * Allocate and initialize the Elf_Data structure.
-	 */
-	if ((elfdata = libld_calloc(sizeof (Elf_Data), 1)) == 0)
-		return (S_ERROR);
-	elfdata->d_type = ELF_T_BYTE;
-	elfdata->d_align = M_WORD_ALIGN;
-	elfdata->d_version = ofl->ofl_libver;
-
-
-	/*
-	 * Allocate and initialize the Shdr structure.
-	 */
-	if ((shdr = libld_calloc(sizeof (Shdr), 1)) == 0)
-		return (S_ERROR);
-	shdr->sh_type = SHT_AMD64_UNWIND;
-	shdr->sh_flags = SHF_ALLOC;
-	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = 0;
-
-	/*
-	 * Allocate and initialize the Is_desc structure.
-	 */
-	if ((isec = libld_calloc(1, sizeof (Is_desc))) == 0)
-		return (S_ERROR);
-	isec->is_name = MSG_ORIG(MSG_SCN_UNWINDHDR);
-	isec->is_shdr = shdr;
-	isec->is_indata = elfdata;
-
-
-	if ((ofl->ofl_unwindhdr = place_section(ofl, isec,
-	    M_ID_UNWINDHDR, 0)) == (Os_desc *)S_ERROR)
-		return (S_ERROR);
-
-	/*
-	 * Following we quickly scan through all of
-	 * the input Frame info - counting for each
-	 * FDE will have to index.  Each fde_entry
-	 * will get a corresponding entry in the
-	 * binary search table.
-	 */
-	fde_cnt = 0;
-	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, osp)) {
-		Is_desc	    *isp;
-		Listnode    *_lnp;
-		for (LIST_TRAVERSE(&osp->os_isdescs, _lnp, isp)) {
-			unsigned char	*data;
-			size_t		datasize;
-			uint64_t	off;
-			uint_t		length, id;
-
-			data = (unsigned char *)isp->is_indata->d_buf;
-			datasize = isp->is_indata->d_size;
-			off = 0;
-			while (off < datasize) {
-				uint_t	    ndx;
-
-				ndx = 0;
-				/*
-				 * extract length in lsb format
-				 */
-				length = LSB32EXTRACT(data + off + ndx);
-				ndx += 4;
-
-				/*
-				 * extract CIE id in lsb format
-				 */
-				id = LSB32EXTRACT(data + off + ndx);
-				ndx += 4;
-
-				/*
-				 * A CIE record has a id of '0', otherwise
-				 * this is a FDE entry and the 'id' is the
-				 *  CIE pointer.
-				 */
-				if (id == 0) {
-					uint_t	cieversion;
-					/*
-					 * The only CIE version supported
-					 * is '1' - quick sanity check
-					 * here.
-					 */
-					cieversion = data[off + ndx];
-					ndx += 1;
-					if (cieversion != 1) {
-					    eprintf(ERR_FATAL,
-						MSG_INTL(MSG_UNW_BADCIEVERS),
-						isp->is_file->ifl_name,
-						isp->is_name,
-						off);
-					    return (S_ERROR);
-					}
-				} else
-					fde_cnt++;
-				off += length + 4;
-			}
-		}
-	}
-
-
-	/*
-	 * section size:
-	 *	byte	    version		+1
-	 *	byte	    eh_frame_ptr_enc	+1
-	 *	byte	    fde_count_enc	+1
-	 *	byte	    table_enc		+1
-	 *	4 bytes	    eh_frame_ptr	+4
-	 *	4 bytes	    fde_count		+4
-	 *	[4 bytes] [4bytes] * fde_count	...
-	 */
-	size = 12 + (8 * fde_cnt);
-
-	if ((elfdata->d_buf = libld_calloc(size, 1)) == 0)
-		return (S_ERROR);
-	elfdata->d_size = size;
-	shdr->sh_size = (Xword)size;
-
-	return (1);
-}
-
-
-/*
- * the comparator function needs to calculate
- * the actual 'initloc' of a bintab entry - to
- * do this we initialize the following global to point
- * to it.
- */
-static Addr framehdr_addr;
-
-static int
-bintabcompare(const void *p1, const void *p2)
-{
-	uint_t	    *bintab1, *bintab2;
-	uint_t	    ent1, ent2;
-
-	bintab1 = (uint_t *)p1;
-	bintab2 = (uint_t *)p2;
-
-	assert(bintab1 != 0);
-	assert(bintab2 != 0);
-
-	ent1 = *bintab1 + framehdr_addr;
-	ent2 = *bintab2 + framehdr_addr;
-
-	if (ent1 > ent2)
-		return (1);
-	if (ent1 < ent2)
-		return (-1);
-	return (0);
-}
-
-uintptr_t
-populate_amd64_unwindhdr(Ofl_desc *ofl)
-{
-	unsigned char	    *hdrdata;
-	uint_t		    *binarytable;
-	uint_t		    hdroff;
-	Listnode	    *lnp;
-	Addr		    hdraddr;
-	Os_desc		    *hdrosp;
-	Os_desc		    *osp;
-	Os_desc		    *first_unwind;
-	uint_t		    fde_count;
-	uint_t		    *uint_ptr;
-
-	/*
-	 * Are we building the unwind hdr?
-	 */
-	if ((hdrosp = ofl->ofl_unwindhdr) == 0)
-		return (1);
-
-	hdrdata = hdrosp->os_outdata->d_buf;
-	hdraddr = hdrosp->os_shdr->sh_addr;
-	hdroff = 0;
-
-	/*
-	 * version == 1
-	 */
-	hdrdata[hdroff++] = 1;
-	/*
-	 * The encodings are:
-	 *
-	 *  eh_frameptr_enc	sdata4 | pcrel
-	 *  fde_count_enc	udata4
-	 *  table_enc		sdata4 | datarel
-	 */
-	hdrdata[hdroff++] = DW_EH_PE_sdata4 | DW_EH_PE_pcrel;
-	hdrdata[hdroff++] = DW_EH_PE_udata4;
-	hdrdata[hdroff++] = DW_EH_PE_sdata4 | DW_EH_PE_datarel;
-
-	/*
-	 *	Header Offsets
-	 *	-----------------------------------
-	 *	byte	    version		+1
-	 *	byte	    eh_frame_ptr_enc	+1
-	 *	byte	    fde_count_enc	+1
-	 *	byte	    table_enc		+1
-	 *	4 bytes	    eh_frame_ptr	+4
-	 *	4 bytes	    fde_count		+4
-	 */
-	/* LINTED */
-	binarytable =  (uint_t *)(hdrdata + 12);
-	first_unwind = 0;
-	fde_count = 0;
-
-	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, osp)) {
-		unsigned char	*fdata;
-		uint64_t	fdatasize;
-		uint_t		foff;
-		uint64_t	fndx;
-		uint_t		cieRflag;
-		uint_t		ciePflag;
-		Shdr		*shdr;
-
-		/*
-		 * remember first UNWIND section to
-		 * point to in the frame_ptr entry.
-		 */
-		if (first_unwind == 0)
-			first_unwind = osp;
-
-		fdata = osp->os_outdata->d_buf;
-		shdr = osp->os_shdr;
-		fdatasize = shdr->sh_size;
-		foff = 0;
-		ciePflag = 0;
-		cieRflag = 0;
-		while (foff < fdatasize) {
-			uint_t	    length;
-			uint_t	    id;
-
-			fndx = 0;
-			/*
-			 * extract length in lsb format
-			 */
-			length = LSB32EXTRACT(fdata + foff + fndx);
-			fndx += 4;
-
-			/*
-			 * extract id in lsb format
-			 */
-			id = LSB32EXTRACT(fdata + foff + fndx);
-			fndx += 4;
-
-			/*
-			 * A CIE record has a id of '0'; otherwise
-			 * this is a FDE entry and the 'id' is the
-			 * CIE pointer.
-			 */
-			if (id == 0) {
-				char	*cieaugstr;
-				uint_t	cieaugndx;
-
-				ciePflag = 0;
-				cieRflag = 0;
-				/*
-				 * We need to drill through the CIE
-				 * to find the Rflag.  It's the Rflag
-				 * which describes how the FDE code-pointers
-				 * are encoded.
-				 */
-
-				/*
-				 * burn through version
-				 */
-				fndx++;
-				/*
-				 * augstr
-				 */
-				cieaugstr = (char *)(&fdata[foff + fndx]);
-				fndx += strlen(cieaugstr) + 1;
-
-				/*
-				 * calign & dalign
-				 */
-				(void) uleb_extract(&fdata[foff], &fndx);
-				(void) sleb_extract(&fdata[foff], &fndx);
-				/*
-				 * retreg
-				 */
-				fndx++;
-
-				/*
-				 * we walk through the augmentation
-				 * section now looking for the Rflag
-				 */
-				for (cieaugndx = 0; cieaugstr[cieaugndx];
-				    cieaugndx++) {
-					switch (cieaugstr[cieaugndx]) {
-					case 'z':
-					    /* size */
-					    (void) uleb_extract(&fdata[foff],
-						&fndx);
-					    break;
-					case 'P':
-					    /* personality */
-					    ciePflag = fdata[foff + fndx];
-					    fndx++;
-						/*
-						 * Just need to extract the
-						 * value to move on to the next
-						 * field.
-						 */
-					    (void) dwarf_ehe_extract(
-						&fdata[foff + fndx],
-						&fndx, ciePflag,
-						ofl->ofl_ehdr->e_ident,
-						shdr->sh_addr + foff + fndx);
-					    break;
-					case 'R':
-					    /* code encoding */
-					    cieRflag = fdata[foff + fndx];
-					    fndx++;
-					    break;
-					case 'L':
-					    /* lsda encoding */
-					    fndx++;
-					    break;
-					}
-				}
-			} else {
-				uint_t	    bintabndx;
-				uint64_t    initloc;
-				uint64_t    fdeaddr;
-
-				bintabndx = fde_count * 2;
-				fde_count++;
-
-				/*
-				 * FDEaddr is adjusted
-				 * to account for the length & id which
-				 * have already been consumed.
-				 */
-				fdeaddr = shdr->sh_addr + foff;
-
-				initloc = dwarf_ehe_extract(&fdata[foff],
-				    &fndx, cieRflag, ofl->ofl_ehdr->e_ident,
-				    shdr->sh_addr + foff + fndx);
-				binarytable[bintabndx] = (uint_t)(initloc -
-					hdraddr);
-				binarytable[bintabndx + 1] = (uint_t)(fdeaddr -
-					hdraddr);
-			}
-
-			/*
-			 * the length does not include the length
-			 * itself - so account for that too.
-			 */
-			foff += length + 4;
-		}
-	}
-
-	/*
-	 * Do a quick sort on the binary table
-	 */
-	framehdr_addr = hdraddr;
-	qsort((void *)binarytable, (size_t)fde_count,
-		(size_t)(sizeof (uint_t) * 2), bintabcompare);
-	/*
-	 * Fill in:
-	 *	first_frame_ptr
-	 *	fde_count
-	 */
-	hdroff = 4;
-	/* LINTED */
-	uint_ptr = (uint_t *)(&hdrdata[hdroff]);
-	*uint_ptr = first_unwind->os_shdr->sh_addr -
-		hdrosp->os_shdr->sh_addr + hdroff;
-
-	hdroff += 4;
-	/* LINTED */
-	uint_ptr = (uint_t *)&hdrdata[hdroff];
-	*uint_ptr = fde_count;
-
-	return (1);
-}
-
-uintptr_t
-append_amd64_unwind(Os_desc *osp, Ofl_desc * ofl)
-{
-	Listnode    *lnp;
-	Os_desc	    *_osp;
-	/*
-	 * Check to see if this output section is already
-	 * on the list.
-	 */
-	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, _osp))
-		if (osp == _osp)
-		    return (1);
-
-	/*
-	 * Append output section to unwind list
-	 */
-	if (list_appendc(&ofl->ofl_unwind, osp) == 0)
-	    return (S_ERROR);
-	return (1);
-}
-
-uintptr_t
-process_amd64_unwind(const char *name, Ifl_desc *ifl, Shdr *shdr,
-	Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl)
-{
-	Os_desc	    *osp;
-	Is_desc	    *isp;
-
-	ident = M_ID_UNWIND;
-	if (process_section(name, ifl, shdr, scn, ndx, ident, ofl) ==
-	    S_ERROR)
-		return (S_ERROR);
-	/*
-	 * When producing a relocatable object - just collect
-	 * the sections.
-	 */
-	if (ofl->ofl_flags & FLG_OF_RELOBJ)
-		return (1);
-	/*
-	 * If we are producing a executable or shared library, we need
-	 * to keep track of all the output UNWIND sections - so that
-	 * we can create the appropriate frame_hdr information.
-	 *
-	 * If the section hasn't been placed in the output file,
-	 * then there's nothing for us to do.
-	 */
-	if (((isp = ifl->ifl_isdesc[ndx]) == 0) ||
-	    ((osp = isp->is_osdesc) == 0))
-		return (1);
-
-	return (append_amd64_unwind(osp, ofl));
-}
--- a/usr/src/cmd/sgs/libld/amd64/machrel.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1632 +0,0 @@
-/*
- * 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.
- *
- * 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.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<string.h>
-#include	<stdio.h>
-#include	<strings.h>
-#include	<sys/elf_amd64.h>
-#include	<debug.h>
-#include	<reloc.h>
-#include	<msg.h>
-#include	<_libld.h>
-
-Word
-init_rel(Rel_desc *reld, void *reloc)
-{
-	Rela *	rel = (Rela *)reloc;
-
-	/* LINTED */
-	reld->rel_rtype = (Word)ELF_R_TYPE(rel->r_info);
-	reld->rel_roffset = rel->r_offset;
-	reld->rel_raddend = rel->r_addend;
-	reld->rel_typedata = 0;
-
-	reld->rel_flags |= FLG_REL_RELA;
-
-	return ((Word)ELF_R_SYM(rel->r_info));
-}
-
-void
-mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
-{
-	ofl->ofl_e_flags |= ehdr->e_flags;
-}
-
-void
-mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		/*
-		 * Create this entry if we are going to create a PLT table.
-		 */
-		if (ofl->ofl_pltcnt)
-			(*cnt)++;		/* DT_PLTGOT */
-	}
-}
-
-void
-mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		if (ofl->ofl_pltcnt) {
-			(*dyn)->d_tag = DT_PLTGOT;
-			(*dyn)->d_un.d_ptr = fillin_gotplt2(ofl);
-			(*dyn)++;
-		}
-	}
-}
-
-Xword
-calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
-{
-	Xword	value;
-
-	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
-	    M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) * M_PLT_ENTSIZE);
-	return (value);
-}
-
-/*
- *  Build a single plt entry - code is:
- *	JMP	*name1@GOTPCREL(%rip)
- *	PUSHL	$index
- *	JMP	.PLT0
- */
-static uchar_t pltn_entry[M_PLT_ENTSIZE] = {
-/* 0x00 jmpq *name1@GOTPCREL(%rip) */	0xff, 0x25, 0x00, 0x00, 0x00, 0x00,
-/* 0x06 pushq $index */			0x68, 0x00, 0x00, 0x00, 0x00,
-/* 0x0b jmpq  .plt0(%rip) */		0xe9, 0x00, 0x00, 0x00, 0x00
-/* 0x10 */
-};
-
-static uintptr_t
-plt_entry(Ofl_desc * ofl, Sym_desc * sdp)
-{
-	uchar_t		*plt0, *pltent, *gotent;
-	Sword		plt_off;
-	Word		got_off;
-	Xword		val1;
-	Word		flags = ofl->ofl_flags;
-	Word		dtflags1 = ofl->ofl_dtflags_1;
-
-	got_off = sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
-	plt_off = M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) *
-	    M_PLT_ENTSIZE);
-	plt0 = (uchar_t *)(ofl->ofl_osplt->os_outdata->d_buf);
-	pltent = plt0 + plt_off;
-	gotent = (uchar_t *)(ofl->ofl_osgot->os_outdata->d_buf) + got_off;
-
-	bcopy(pltn_entry, pltent, sizeof (pltn_entry));
-	/*
-	 * Fill in the got entry with the address of the next instruction.
-	 */
-	/* LINTED */
-	*(Word *)gotent = ofl->ofl_osplt->os_shdr->sh_addr + plt_off +
-	    M_PLT_INSSIZE;
-
-	/*
-	 * patchup:
-	 *	jmpq	*name1@gotpcrel(%rip)
-	 *
-	 * NOTE: 0x06 represents next instruction.
-	 */
-	val1 = (ofl->ofl_osgot->os_shdr->sh_addr + got_off) -
-		(ofl->ofl_osplt->os_shdr->sh_addr + plt_off) - 0x06;
-
-	/*
-	 * If '-z noreloc' is specified - skip the do_reloc
-	 * stage.
-	 */
-	if ((flags & FLG_OF_RELOBJ) ||
-	    !(dtflags1 & DF_1_NORELOC)) {
-		if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02],
-		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
-		    MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL),
-				sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name));
-			return (S_ERROR);
-		}
-	}
-
-	/*
-	 * patchup:
-	 *	pushq	$pltndx
-	 */
-	val1 = (Xword)(sdp->sd_aux->sa_PLTndx - 1);
-	/*
-	 * If '-z noreloc' is specified - skip the do_reloc
-	 * stage.
-	 */
-	if ((flags & FLG_OF_RELOBJ) ||
-	    !(dtflags1 & DF_1_NORELOC)) {
-		if (do_reloc(R_AMD64_32, &pltent[0x07],
-		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
-		    MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL),
-				sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name));
-			return (S_ERROR);
-		}
-	}
-
-	/*
-	 * patchup:
-	 *	jmpq	.plt0(%rip)
-	 * NOTE: 0x10 represents next instruction.  The rather complex series
-	 * of casts is necessary to sign extend an offset into a 64-bit value
-	 * while satisfying various compiler error checks.  Handle with care.
-	 */
-	val1 = (Xword)((intptr_t)((uintptr_t)plt0 -
-	    (uintptr_t)(&pltent[0x10])));
-
-	/*
-	 * If '-z noreloc' is specified - skip the do_reloc
-	 * stage.
-	 */
-	if ((flags & FLG_OF_RELOBJ) ||
-	    !(dtflags1 & DF_1_NORELOC)) {
-		if (do_reloc(R_AMD64_PC32, &pltent[0x0c],
-		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
-		    MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL),
-				sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name));
-			return (S_ERROR);
-		}
-	}
-	return (1);
-}
-
-uintptr_t
-perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
-{
-	Os_desc *	relosp, * osp = 0;
-	Word		ndx;
-	Xword		roffset, value;
-	Sxword		raddend;
-	Rela		rea;
-	char		*relbits;
-	Sym_desc *	sdp, * psym = (Sym_desc *)0;
-	int		sectmoved = 0;
-
-	raddend = orsp->rel_raddend;
-	sdp = orsp->rel_sym;
-
-	/*
-	 * If the section this relocation is against has been discarded
-	 * (-zignore), then also discard (skip) the relocation itself.
-	 */
-	if (orsp->rel_isdesc && ((orsp->rel_flags &
-	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
-	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
-		DBG_CALL(Dbg_reloc_discard(M_MACH, orsp));
-		return (1);
-	}
-
-	/*
-	 * If this is a relocation against a move table, or expanded move
-	 * table, adjust the relocation entries.
-	 */
-	if (orsp->rel_move)
-		adj_movereloc(ofl, orsp);
-
-	/*
-	 * If this is a relocation against a section then we need to adjust the
-	 * raddend field to compensate for the new position of the input section
-	 * within the new output section.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
-		if (ofl->ofl_parsym.head &&
-		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-		    /* LINTED */
-		    (psym = am_I_partial(orsp, orsp->rel_raddend))) {
-			DBG_CALL(Dbg_move_outsctadj(psym));
-			sectmoved = 1;
-			if (ofl->ofl_flags & FLG_OF_RELOBJ)
-				raddend = psym->sd_sym->st_value;
-			else
-				raddend = psym->sd_sym->st_value -
-				    psym->sd_isc->is_osdesc->os_shdr->sh_addr;
-			/* LINTED */
-			raddend += (Off)_elf_getxoff(psym->sd_isc->is_indata);
-			if (psym->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
-				raddend +=
-				psym->sd_isc->is_osdesc->os_shdr->sh_addr;
-		} else {
-			/* LINTED */
-			raddend += (Off)_elf_getxoff(sdp->sd_isc->is_indata);
-			if (sdp->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
-				raddend +=
-				sdp->sd_isc->is_osdesc->os_shdr->sh_addr;
-		}
-	}
-
-	value = sdp->sd_sym->st_value;
-
-	if (orsp->rel_flags & FLG_REL_GOT) {
-		/*
-		 * Note: for GOT relative relocations on amd64
-		 *	 we discard the addend.  It was relevant
-		 *	 to the reference - not to the data item
-		 *	 being referenced (ie: that -4 thing).
-		 */
-		raddend = 0;
-		osp = ofl->ofl_osgot;
-		roffset = calc_got_offset(orsp, ofl);
-	} else if (orsp->rel_flags & FLG_REL_PLT) {
-		/*
-		 * Note that relocations for PLT's actually
-		 * cause a relocation againt the GOT.
-		 */
-		osp = ofl->ofl_osplt;
-		roffset = (ofl->ofl_osgot->os_shdr->sh_addr) +
-		    sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
-		raddend = 0;
-		if (plt_entry(ofl, sdp) == S_ERROR)
-			return (S_ERROR);
-
-	} else if (orsp->rel_flags & FLG_REL_BSS) {
-		/*
-		 * This must be a R_AMD64_COPY.  For these set the roffset to
-		 * point to the new symbols location.
-		 */
-		osp = ofl->ofl_isbss->is_osdesc;
-		roffset = value;
-
-		/*
-		 * The raddend doesn't mean anything in a R_SPARC_COPY
-		 * relocation.  Null it out because it can confuse people.
-		 */
-		raddend = 0;
-	} else {
-		osp = orsp->rel_osdesc;
-
-		/*
-		 * Calculate virtual offset of reference point; equals offset
-		 * into section + vaddr of section for loadable sections, or
-		 * offset plus section displacement for nonloadable sections.
-		 */
-		roffset = orsp->rel_roffset +
-		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
-		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
-			roffset += orsp->rel_isdesc->is_osdesc->
-			    os_shdr->sh_addr;
-	}
-
-	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
-		relosp = ofl->ofl_osrel;
-
-	/*
-	 * Assign the symbols index for the output relocation.  If the
-	 * relocation refers to a SECTION symbol then it's index is based upon
-	 * the output sections symbols index.  Otherwise the index can be
-	 * derived from the symbols index itself.
-	 */
-	if (orsp->rel_rtype == R_AMD64_RELATIVE)
-		ndx = STN_UNDEF;
-	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
-		if (sectmoved == 0) {
-			/*
-			 * Check for a null input section. This can
-			 * occur if this relocation references a symbol
-			 * generated by sym_add_sym().
-			 */
-			if ((sdp->sd_isc != 0) &&
-			    (sdp->sd_isc->is_osdesc != 0))
-				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
-			else
-				ndx = sdp->sd_shndx;
-		} else
-			ndx = ofl->ofl_sunwdata1ndx;
-	} else
-		ndx = sdp->sd_symndx;
-
-	/*
-	 * Add the symbols 'value' to the addend field.
-	 */
-	if (orsp->rel_flags & FLG_REL_ADVAL)
-		raddend += value;
-
-	/*
-	 * addend field for R_AMD64_DTPMOD64 means nothing.  The addend
-	 * is propogated in the corresponding R_AMD64_DTPOFF64
-	 * relocation.
-	 */
-	if (orsp->rel_rtype == R_AMD64_DTPMOD64)
-		raddend = 0;
-
-	relbits = (char *)relosp->os_outdata->d_buf;
-
-	rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype);
-	rea.r_offset = roffset;
-	rea.r_addend = raddend;
-	DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea, orsp->rel_sname,
-	    relosp->os_name));
-
-	/*
-	 * Assert we haven't walked off the end of our relocation table.
-	 */
-	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
-
-	(void) memcpy((relbits + relosp->os_szoutrels),
-	    (char *)&rea, sizeof (Rela));
-	relosp->os_szoutrels += (Xword)sizeof (Rela);
-
-	/*
-	 * Determine if this relocation is against a non-writable, allocatable
-	 * section.  If so we may need to provide a text relocation diagnostic.
-	 * Note that relocations against the .plt (R_AMD64_JUMP_SLOT) actually
-	 * result in modifications to the .got.
-	 */
-	if (orsp->rel_rtype == R_AMD64_JUMP_SLOT)
-		osp = ofl->ofl_osgot;
-
-	reloc_remain_entry(orsp, osp, ofl);
-	return (1);
-}
-
-/*
- * amd64 Instructions for TLS processing
- */
-static uchar_t tlsinstr_gd_ie[] = {
-	/*
-	 *	0x00 movq %fs:0, %rax
-	 */
-	0x64, 0x48, 0x8b, 0x04, 0x25,
-	0x00, 0x00, 0x00, 0x00,
-	/*
-	 *	0x09 addq x@gottpoff(%rip), %rax
-	 */
-	0x48, 0x03, 0x05, 0x00, 0x00,
-	0x00, 0x00
-};
-
-static uchar_t tlsinstr_gd_le[] = {
-	/*
-	 *	0x00 movq %fs:0, %rax
-	 */
-	0x64, 0x48, 0x8b, 0x04, 0x25,
-	0x00, 0x00, 0x00, 0x00,
-	/*
-	 *	0x09 leaq x@gottpoff(%rip), %rax
-	 */
-	0x48, 0x8d, 0x80, 0x00, 0x00,
-	0x00, 0x00
-};
-
-static uchar_t tlsinstr_ld_le[] = {
-	/*
-	 * .byte 0x66
-	 */
-	0x66,
-	/*
-	 * .byte 0x66
-	 */
-	0x66,
-	/*
-	 * .byte 0x66
-	 */
-	0x66,
-	/*
-	 * movq %fs:0, %rax
-	 */
-	0x64, 0x48, 0x8b, 0x04, 0x25,
-	0x00, 0x00, 0x00, 0x00
-};
-
-
-Fixupret
-tls_fixups(Rel_desc *arsp)
-{
-	Sym_desc	*sdp = arsp->rel_sym;
-	Word		rtype = arsp->rel_rtype;
-	uchar_t		*offset;
-
-	offset = (uchar_t *)((uintptr_t)arsp->rel_roffset +
-	    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
-	    (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
-
-	if (sdp->sd_ref == REF_DYN_NEED) {
-		/*
-		 * IE reference model
-		 */
-		switch (rtype) {
-		case R_AMD64_TLSGD:
-			/*
-			 *  GD -> IE
-			 *
-			 * Transition:
-			 *	0x00 .byte 0x66
-			 *	0x01 leaq x@tlsgd(%rip), %rdi
-			 *	0x08 .word 0x6666
-			 *	0x0a rex64
-			 *	0x0b call __tls_get_addr@plt
-			 *	0x10
-			 * To:
-			 *	0x00 movq %fs:0, %rax
-			 *	0x09 addq x@gottpoff(%rip), %rax
-			 *	0x10
-			 */
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_AMD64_GOTTPOFF,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			arsp->rel_rtype = R_AMD64_GOTTPOFF;
-			arsp->rel_roffset += 8;
-			arsp->rel_raddend = (Sxword)-4;
-			/*
-			 * Addjust 'offset' to beginning of instruction
-			 * sequence.
-			 */
-			offset -= 4;
-			(void) memcpy(offset, tlsinstr_gd_ie,
-				sizeof (tlsinstr_gd_ie));
-			return (FIX_RELOC);
-		case R_AMD64_PLT32:
-			/*
-			 * Fixup done via the TLS_GD relocation
-			 */
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_AMD64_NONE,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			return (FIX_DONE);
-		}
-	}
-
-	/*
-	 * LE reference model
-	 */
-	switch (rtype) {
-	case R_AMD64_TLSGD:
-		/*
-		 * GD -> LE
-		 *
-		 * Transition:
-		 *	0x00 .byte 0x66
-		 *	0x01 leaq x@tlsgd(%rip), %rdi
-		 *	0x08 .word 0x6666
-		 *	0x0a rex64
-		 *	0x0b call __tls_get_addr@plt
-		 *	0x10
-		 * To:
-		 *	0x00 movq %fs:0, %rax
-		 *	0x09 leaq x@tpoff(%rax), %rax
-		 *	0x10
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_AMD64_TPOFF32,
-			arsp->rel_roffset,
-			sdp->sd_name));
-
-		arsp->rel_rtype = R_AMD64_TPOFF32;
-		arsp->rel_roffset += 8;
-		arsp->rel_raddend = 0;
-		/*
-		 * Addjust 'offset' to beginning of instruction
-		 * sequence.
-		 */
-		offset -= 4;
-		(void) memcpy(offset, tlsinstr_gd_le,
-			sizeof (tlsinstr_gd_le));
-		return (FIX_RELOC);
-	case R_AMD64_GOTTPOFF:
-		/*
-		 * IE -> LE
-		 *
-		 * Transition:
-		 *	0x00 movq %fs:0, %rax
-		 *	0x09 addq x@gottopoff(%rip), %rax
-		 *	0x10
-		 * To:
-		 *	0x00 movq %fs:0, %rax
-		 *	0x09 leaq x@tpoff(%rax), %rax
-		 *	0x10
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_AMD64_TPOFF32,
-			arsp->rel_roffset,
-			sdp->sd_name));
-
-		arsp->rel_rtype = R_AMD64_TPOFF32;
-		arsp->rel_raddend = 0;
-		/*
-		 * Addjust 'offset' to beginning of instruction
-		 * sequence.
-		 */
-		offset -= 12;
-		/*
-		 * Same code sequence used in the GD -> LE
-		 * transition.
-		 */
-		(void) memcpy(offset, tlsinstr_gd_le,
-			sizeof (tlsinstr_gd_le));
-		return (FIX_RELOC);
-	case R_AMD64_TLSLD:
-		/*
-		 * LD -> LE
-		 *
-		 * Transition
-		 *	0x00 leaq x1@tlsgd(%rip), %rdi
-		 *	0x07 call __tls_get_addr@plt
-		 *	0x0c
-		 * To:
-		 *	0x00 .byte 0x66
-		 *	0x01 .byte 0x66
-		 *	0x02 .byte 0x66
-		 *	0x03 movq %fs:0, %rax
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_AMD64_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		offset -= 3;
-		(void) memcpy(offset, tlsinstr_ld_le,
-			sizeof (tlsinstr_ld_le));
-		return (FIX_DONE);
-	case R_AMD64_DTPOFF32:
-		/*
-		 * LD->LE
-		 *
-		 * Transition:
-		 *	0x00 leaq x1@dtpoff(%rax), %rcx
-		 * To:
-		 *	0x00 leaq x1@tpoff(%rax), %rcx
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_AMD64_TPOFF32,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_AMD64_TPOFF32;
-		arsp->rel_raddend = 0;
-		return (FIX_RELOC);
-	}
-
-	return (FIX_RELOC);
-}
-
-uintptr_t
-do_activerelocs(Ofl_desc *ofl)
-{
-	Rel_desc	*arsp;
-	Rel_cache	*rcp;
-	Listnode	*lnp;
-	uintptr_t	return_code = 1;
-	Word		flags = ofl->ofl_flags;
-	Word		dtflags1 = ofl->ofl_dtflags_1;
-
-	DBG_CALL(Dbg_reloc_doactiverel());
-	/*
-	 * Process active relocations.
-	 */
-	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
-		/* LINTED */
-		for (arsp = (Rel_desc *)(rcp + 1);
-		    arsp < rcp->rc_free; arsp++) {
-			uchar_t		*addr;
-			Xword 		value;
-			Sym_desc	*sdp;
-			const char	*ifl_name;
-			Xword		refaddr;
-			int		moved = 0;
-			Gotref		gref;
-
-			/*
-			 * If the section this relocation is against has been
-			 * discarded (-zignore), then discard (skip) the
-			 * relocation itself.
-			 */
-			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
-			    ((arsp->rel_flags &
-			    (FLG_REL_GOT | FLG_REL_BSS |
-			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
-				DBG_CALL(Dbg_reloc_discard(M_MACH, arsp));
-				continue;
-			}
-
-			/*
-			 * We deteremine what the 'got reference'
-			 * model (if required) is at this point.  This
-			 * needs to be done before tls_fixup() since
-			 * it may 'transition' our instructions.
-			 *
-			 * The got table entries have already been assigned,
-			 * and we bind to those initial entries.
-			 */
-			if (arsp->rel_flags & FLG_REL_DTLS)
-				gref = GOT_REF_TLSGD;
-			else if (arsp->rel_flags & FLG_REL_MTLS)
-				gref = GOT_REF_TLSLD;
-			else if (arsp->rel_flags & FLG_REL_STLS)
-				gref = GOT_REF_TLSIE;
-			else
-				gref = GOT_REF_GENERIC;
-
-			/*
-			 * Perform any required TLS fixups.
-			 */
-			if (arsp->rel_flags & FLG_REL_TLSFIX) {
-				Fixupret	ret;
-
-				if ((ret = tls_fixups(arsp)) == FIX_ERROR)
-					return (S_ERROR);
-				if (ret == FIX_DONE)
-					continue;
-			}
-
-			/*
-			 * If this is a relocation against a move table, or
-			 * expanded move table, adjust the relocation entries.
-			 */
-			if (arsp->rel_move)
-				adj_movereloc(ofl, arsp);
-
-			sdp = arsp->rel_sym;
-			refaddr = arsp->rel_roffset +
-			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
-
-			if ((arsp->rel_flags & FLG_REL_CLVAL) ||
-			    (arsp->rel_flags & FLG_REL_GOTCL))
-				value = 0;
-			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
-			    STT_SECTION) {
-				Sym_desc	*sym;
-
-				/*
-				 * The value for a symbol pointing to a SECTION
-				 * is based off of that sections position.
-				 *
-				 * The second argument of the am_I_partial() is
-				 * the value stored at the target address
-				 * relocation is going to be applied.
-				 */
-				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-				    /* LINTED */
-				    (sym = am_I_partial(arsp, *(Xword *)
-				    ((uchar_t *)
-				    arsp->rel_isdesc->is_indata->d_buf +
-				    arsp->rel_roffset)))) {
-					/*
-					 * If the symbol is moved,
-					 * adjust the value
-					 */
-					value = sym->sd_sym->st_value;
-					moved = 1;
-				} else {
-					value = _elf_getxoff(
-					    sdp->sd_isc->is_indata);
-					if (sdp->sd_isc->is_shdr->sh_flags &
-					    SHF_ALLOC)
-					    value += sdp->sd_isc->is_osdesc->
-					    os_shdr->sh_addr;
-				}
-				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
-					value -= ofl->ofl_tlsphdr->p_vaddr;
-			} else {
-				/*
-				 * else the value is the symbols value
-				 */
-				value = sdp->sd_sym->st_value;
-			}
-
-			/*
-			 * Relocation against the GLOBAL_OFFSET_TABLE.
-			 */
-			if (arsp->rel_flags & FLG_REL_GOT)
-				arsp->rel_osdesc = ofl->ofl_osgot;
-
-			/*
-			 * If loadable and not producing a relocatable object
-			 * add the sections virtual address to the reference
-			 * address.
-			 */
-			if ((arsp->rel_flags & FLG_REL_LOAD) &&
-			    ((flags & FLG_OF_RELOBJ) == 0))
-				refaddr += arsp->rel_isdesc->is_osdesc->
-				    os_shdr->sh_addr;
-
-			/*
-			 * If this entry has a PLT assigned to it, it's
-			 * value is actually the address of the PLT (and
-			 * not the address of the function).
-			 */
-			if (IS_PLT(arsp->rel_rtype)) {
-				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
-					value = calc_plt_addr(sdp, ofl);
-			}
-
-			/*
-			 * Add relocations addend to value.  Add extra
-			 * relocation addend if needed.
-			 *
-			 * Note: for GOT relative relocations on amd64
-			 *	 we discard the addend.  It was relevant
-			 *	 to the reference - not to the data item
-			 *	 being referenced (ie: that -4 thing).
-			 */
-			if ((arsp->rel_flags & FLG_REL_GOT) == 0)
-				value += arsp->rel_raddend;
-
-			/*
-			 * Determine whether the value needs further adjustment.
-			 * Filter through the attributes of the relocation to
-			 * determine what adjustment is required.  Note, many
-			 * of the following cases are only applicable when a
-			 * .got is present.  As a .got is not generated when a
-			 * relocatable object is being built, any adjustments
-			 * that require a .got need to be skipped.
-			 */
-			if ((arsp->rel_flags & FLG_REL_GOT) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword		R1addr;
-				uintptr_t	R2addr;
-				Word		gotndx;
-				Gotndx		*gnp;
-
-				/*
-				 * Perform relocation against GOT table.  Since
-				 * this doesn't fit exactly into a relocation
-				 * we place the appropriate byte in the GOT
-				 * directly
-				 *
-				 * Calculate offset into GOT at which to apply
-				 * the relocation.
-				 */
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, arsp);
-				assert(gnp);
-
-				if (arsp->rel_rtype == R_AMD64_DTPOFF64)
-					gotndx = gnp->gn_gotndx + 1;
-				else
-					gotndx = gnp->gn_gotndx;
-
-				R1addr = (Xword)(gotndx * M_GOT_ENTSIZE);
-
-				/*
-				 * Add the GOTs data's offset.
-				 */
-				R2addr = R1addr + (uintptr_t)
-				    arsp->rel_osdesc->os_outdata->d_buf;
-
-				DBG_CALL(Dbg_reloc_doact(M_MACH,
-				    arsp->rel_rtype, R1addr, value,
-				    arsp->rel_sname, arsp->rel_osdesc));
-
-				/*
-				 * And do it.
-				 */
-				*(Xword *)R2addr = value;
-				continue;
-
-			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				value -= ofl->ofl_osgot->os_shdr->sh_addr;
-
-			} else if (IS_GOTPCREL(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx *gnp;
-
-				/*
-				 * Calculation:
-				 *	G + GOT + A - P
-				 */
-				gnp = find_gotndx(&(sdp->sd_GOTndxs),
-				    gref, ofl, arsp);
-				assert(gnp);
-				value = (Xword)(ofl->ofl_osgot->os_shdr->
-				    sh_addr) + ((Xword)gnp->gn_gotndx *
-				    M_GOT_ENTSIZE) + arsp->rel_raddend -
-				    refaddr;
-
-			} else if (IS_GOT_PC(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				value = (Xword)(ofl->ofl_osgot->os_shdr->
-				    sh_addr) - refaddr + arsp->rel_raddend;
-
-			} else if ((IS_PC_RELATIVE(arsp->rel_rtype)) &&
-			    (((flags & FLG_OF_RELOBJ) == 0) ||
-			    (arsp->rel_osdesc == sdp->sd_isc->is_osdesc))) {
-				value -= refaddr;
-
-			} else if (IS_TLS_INS(arsp->rel_rtype) &&
-			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx	*gnp;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, arsp);
-				assert(gnp);
-				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
-
-			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx *gnp;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs),
-				    gref, ofl, arsp);
-				assert(gnp);
-				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
-
-			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword	tlsstatsize;
-
-				/*
-				 * This is the LE TLS reference model.  Static
-				 * offset is hard-coded.
-				 */
-				tlsstatsize =
-				    S_ROUND(ofl->ofl_tlsphdr->p_memsz,
-				    M_TLSSTATALIGN);
-				value = tlsstatsize - value;
-
-				/*
-				 * Since this code is fixed up, it assumes a
-				 * negative offset that can be added to the
-				 * thread pointer.
-				 */
-				if (arsp->rel_rtype == R_AMD64_TPOFF32)
-					value = -value;
-			}
-
-			if (arsp->rel_isdesc->is_file)
-				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
-			else
-				ifl_name = MSG_INTL(MSG_STR_NULL);
-
-			/*
-			 * Make sure we have data to relocate.  Compiler and
-			 * assembler developers have been known to generate
-			 * relocations against invalid sections (normally .bss),
-			 * so for their benefit give them sufficient information
-			 * to help analyze the problem.  End users should never
-			 * see this.
-			 */
-			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC),
-				    conv_reloc_amd64_type_str(arsp->rel_rtype),
-				    ifl_name, demangle(arsp->rel_sname),
-				    arsp->rel_isdesc->is_name);
-				return (S_ERROR);
-			}
-
-			/*
-			 * Get the address of the data item we need to modify.
-			 */
-			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
-			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
-			    is_indata));
-
-			DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype,
-			    (uintptr_t)addr, value, arsp->rel_sname,
-			    arsp->rel_osdesc));
-			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
-
-			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) >
-			    ofl->ofl_size) || (arsp->rel_roffset >
-			    arsp->rel_osdesc->os_shdr->sh_size)) {
-				int	class;
-
-				if (((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size)
-					class = ERR_FATAL;
-				else
-					class = ERR_WARNING;
-
-				eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET),
-				    conv_reloc_amd64_type_str(arsp->rel_rtype),
-				    ifl_name, arsp->rel_isdesc->is_name,
-				    demangle(arsp->rel_sname),
-				    EC_ADDR((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr));
-
-				if (class == ERR_FATAL) {
-					return_code = S_ERROR;
-					continue;
-				}
-			}
-
-			/*
-			 * The relocation is additive.  Ignore the previous
-			 * symbol value if this local partial symbol is
-			 * expanded.
-			 */
-			if (moved)
-				value -= *addr;
-
-			/*
-			 * If '-z noreloc' is specified - skip the do_reloc
-			 * stage.
-			 */
-			if ((flags & FLG_OF_RELOBJ) ||
-			    !(dtflags1 & DF_1_NORELOC)) {
-				if (do_reloc((uchar_t)arsp->rel_rtype,
-				    addr, &value, arsp->rel_sname,
-				    ifl_name) == 0)
-					return_code = S_ERROR;
-			}
-		}
-	}
-	return (return_code);
-}
-
-uintptr_t
-add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
-{
-	Rel_desc	*orsp;
-	Rel_cache	*rcp;
-	Sym_desc	*sdp = rsp->rel_sym;
-
-	/*
-	 * Static executables *do not* want any relocations against them.
-	 * Since our engine still creates relocations against a WEAK UNDEFINED
-	 * symbol in a static executable, it's best to disable them here
-	 * instead of through out the relocation code.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
-		return (1);
-
-	/*
-	 * If no relocation cache structures are available allocate
-	 * a new one and link it into the cache list.
-	 */
-	if ((ofl->ofl_outrels.tail == 0) ||
-	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
-	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
-		static size_t	nextsize = 0;
-		size_t		size;
-
-		/*
-		 * Output relocation numbers can vary considerably between
-		 * building executables or shared objects (pic vs. non-pic),
-		 * etc.  But, they typically aren't very large, so for these
-		 * objects use a standard bucket size.  For building relocatable
-		 * objects, typically there will be an output relocation for
-		 * every input relocation.
-		 */
-		if (nextsize == 0) {
-			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
-				if ((size = ofl->ofl_relocincnt) == 0)
-					size = REL_LOIDESCNO;
-				if (size > REL_HOIDESCNO)
-					nextsize = REL_HOIDESCNO;
-				else
-					nextsize = REL_LOIDESCNO;
-			} else
-				nextsize = size = REL_HOIDESCNO;
-		} else
-			size = nextsize;
-
-		size = size * sizeof (Rel_desc);
-
-		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
-		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
-			return (S_ERROR);
-
-		/* LINTED */
-		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
-		/* LINTED */
-		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
-	}
-
-	/*
-	 * If we are adding a output relocation against a section
-	 * symbol (non-RELATIVE) then mark that section.  These sections
-	 * will be added to the .dynsym symbol table.
-	 */
-	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
-	    ((flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
-
-		/*
-		 * If this is a COMMON symbol - no output section
-		 * exists yet - (it's created as part of sym_validate()).
-		 * So - we mark here that when it's created it should
-		 * be tagged with the FLG_OS_OUTREL flag.
-		 */
-		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
-		    (sdp->sd_shndx == SHN_COMMON)) {
-			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
-				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
-			else
-				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
-		} else {
-			Os_desc	*osp = sdp->sd_isc->is_osdesc;
-
-			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
-				ofl->ofl_dynshdrcnt++;
-				osp->os_flags |= FLG_OS_OUTREL;
-			}
-		}
-	}
-
-	*orsp = *rsp;
-	orsp->rel_flags |= flags;
-
-	rcp->rc_free++;
-	ofl->ofl_outrelscnt++;
-
-	if (flags & FLG_REL_GOT)
-		ofl->ofl_relocgotsz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_PLT)
-		ofl->ofl_relocpltsz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_BSS)
-		ofl->ofl_relocbsssz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_NOINFO)
-		ofl->ofl_relocrelsz += (Xword)sizeof (Rela);
-	else
-		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rela);
-
-	if (orsp->rel_rtype == M_R_RELATIVE)
-		ofl->ofl_relocrelcnt++;
-
-	/*
-	 * We don't perform sorting on PLT relocations because
-	 * they have already been assigned a PLT index and if we
-	 * were to sort them we would have to re-assign the plt indexes.
-	 */
-	if (!(flags & FLG_REL_PLT))
-		ofl->ofl_reloccnt++;
-
-	/*
-	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
-	 */
-	if (IS_GOT_REQUIRED(orsp->rel_rtype))
-		ofl->ofl_flags |= FLG_OF_BLDGOT;
-
-	/*
-	 * Identify and possibly warn of a displacement relocation.
-	 */
-	if (orsp->rel_flags & FLG_REL_DISP) {
-		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
-
-		if (ofl->ofl_flags & FLG_OF_VERBOSE)
-			disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
-	}
-	DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp));
-	return (1);
-}
-
-/*
- * Stub routine since register symbols are not supported on amd64.
- */
-/* ARGSUSED */
-uintptr_t
-reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
-{
-	eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOREG));
-	return (S_ERROR);
-}
-
-/*
- * process relocation for a LOCAL symbol
- */
-uintptr_t
-reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		flags = ofl->ofl_flags;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		shndx = rsp->rel_sym->sd_shndx;
-	Word		ortype = rsp->rel_rtype;
-
-	/*
-	 * if ((shared object) and (not pc relative relocation) and
-	 *    (not against ABS symbol))
-	 * then
-	 *	build R_AMD64_RELATIVE
-	 * fi
-	 */
-	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
-	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
-	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
-	    !(rsp->rel_isdesc != NULL &&
-	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
-	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
-	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
-
-		/*
-		 * R_AMD64_RELATIVE updates a 64bit address, if this
-		 * relocation isn't a 64bit binding then we can not
-		 * simplify it to a RELATIVE relocation.
-		 */
-		if (reloc_table[ortype].re_fsize != sizeof (Addr)) {
-			return (add_outrel(NULL, rsp, ofl));
-		}
-
-		rsp->rel_rtype = R_AMD64_RELATIVE;
-		if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = ortype;
-		return (1);
-	}
-
-	/*
-	 * If the relocation is against a 'non-allocatable' section
-	 * and we can not resolve it now - then give a warning
-	 * message.
-	 *
-	 * We can not resolve the symbol if either:
-	 *	a) it's undefined
-	 *	b) it's defined in a shared library and a
-	 *	   COPY relocation hasn't moved it to the executable
-	 *
-	 * Note: because we process all of the relocations against the
-	 *	text segment before any others - we know whether
-	 *	or not a copy relocation will be generated before
-	 *	we get here (see reloc_init()->reloc_segments()).
-	 */
-	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
-	    ((shndx == SHN_UNDEF) ||
-	    ((sdp->sd_ref == REF_DYN_NEED) &&
-	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
-		/*
-		 * If the relocation is against a SHT_SUNW_ANNOTATE
-		 * section - then silently ignore that the relocation
-		 * can not be resolved.
-		 */
-		if (rsp->rel_osdesc &&
-		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
-			return (0);
-		(void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM),
-		    conv_reloc_amd64_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
-		return (1);
-	}
-
-	/*
-	 * Perform relocation.
-	 */
-	return (add_actrel(NULL, rsp, ofl));
-}
-
-
-uintptr_t
-/* ARGSUSED */
-reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	/*
-	 * Stub routine for common code compatibility, we shouldn't
-	 * actually get here on amd64.
-	 */
-	return (S_ERROR);
-}
-
-uintptr_t
-reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		rtype = rsp->rel_rtype;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		flags = ofl->ofl_flags;
-	Word		rflags;
-	Gotndx		*gnp;
-
-	/*
-	 * all TLS relocations are illegal in a static executable.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * Any TLS relocation must be against a STT_TLS symbol, all others
-	 * are illegal.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    conv_info_type_str(ofl->ofl_e_machine,
-		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
-		return (S_ERROR);
-	}
-
-	/*
-	 * We're a executable - use either the IE or LE
-	 * access model.
-	 */
-	if (flags & FLG_OF_EXEC) {
-		/*
-		 * If we are using either IE or LE reference
-		 * model set the DF_STATIC_TLS flag.
-		 */
-		ofl->ofl_dtflags |= DF_STATIC_TLS;
-
-		if (!local) {
-			Gotref	gref;
-			/*
-			 * IE access model
-			 */
-			/*
-			 * It's not possible for LD or LE reference
-			 * models to reference a symbol external to
-			 * the current object.
-			 */
-			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-				    conv_reloc_amd64_type_str(rsp->rel_rtype),
-				    rsp->rel_isdesc->is_file->ifl_name,
-				    demangle(rsp->rel_sname),
-				    sdp->sd_file->ifl_name);
-				return (S_ERROR);
-			}
-
-			gref = GOT_REF_TLSIE;
-
-			/*
-			 * Assign a GOT entry for static TLS references
-			 */
-			if ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-			    gref, ofl, rsp)) == 0) {
-				if (assign_gotndx(&(sdp->sd_GOTndxs),
-				    gnp, gref, ofl, rsp, sdp) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = R_AMD64_TPOFF64;
-				if (add_outrel((FLG_REL_GOT | FLG_REL_STLS),
-				    rsp, ofl) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = rtype;
-			}
-			if (IS_TLS_IE(rtype))
-				return (add_actrel(FLG_REL_STLS, rsp, ofl));
-
-			/*
-			 * If (GD or LD) reference models - fixups
-			 * are required.
-			 */
-			return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
-			    rsp, ofl));
-		}
-		/*
-		 * LE access model
-		 */
-		if (IS_TLS_LE(rtype))
-			return (add_actrel(FLG_REL_STLS, rsp, ofl));
-		return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl));
-	}
-
-	/*
-	 * Building a shared object
-	 */
-
-	/*
-	 * Building a shared object - only GD & LD access models
-	 * will work here.
-	 */
-	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
-		    conv_reloc_amd64_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * LD access mode can only bind to local symbols.
-	 */
-	if (!local && IS_TLS_LD(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-		    conv_reloc_amd64_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    sdp->sd_file->ifl_name);
-		return (S_ERROR);
-	}
-
-
-	if (IS_TLS_LD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSLD, ofl, rsp)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rflags = FLG_REL_GOT | FLG_REL_MTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-		rsp->rel_rtype = R_AMD64_DTPMOD64;
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = rtype;
-	} else if (IS_TLS_GD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSGD, ofl, rsp)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rflags = FLG_REL_GOT | FLG_REL_DTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-		rsp->rel_rtype = R_AMD64_DTPMOD64;
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		if (local == TRUE) {
-			rsp->rel_rtype = R_AMD64_DTPOFF64;
-			if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		} else {
-			rsp->rel_rtype = R_AMD64_DTPOFF64;
-			if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		}
-		rsp->rel_rtype = rtype;
-	}
-
-	if (IS_TLS_LD(rtype))
-		return (add_actrel(FLG_REL_MTLS, rsp, ofl));
-
-	return (add_actrel(FLG_REL_DTLS, rsp, ofl));
-}
-
-/* ARGSUSED3 */
-Gotndx *
-find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
-{
-	Listnode *	lnp;
-	Gotndx *	gnp;
-
-	assert(rdesc != 0);
-
-	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
-		return (ofl->ofl_tlsldgotndx);
-
-	for (LIST_TRAVERSE(lst, lnp, gnp)) {
-		if ((rdesc->rel_raddend == gnp->gn_addend) &&
-		    (gnp->gn_gotref == gref)) {
-			return (gnp);
-		}
-	}
-	return ((Gotndx *)0);
-}
-
-Xword
-calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
-{
-	Os_desc		*osp = ofl->ofl_osgot;
-	Sym_desc	*sdp = rdesc->rel_sym;
-	Xword		gotndx;
-	Gotref		gref;
-	Gotndx		*gnp;
-
-	if (rdesc->rel_flags & FLG_REL_DTLS)
-		gref = GOT_REF_TLSGD;
-	else if (rdesc->rel_flags & FLG_REL_MTLS)
-		gref = GOT_REF_TLSLD;
-	else if (rdesc->rel_flags & FLG_REL_STLS)
-		gref = GOT_REF_TLSIE;
-	else
-		gref = GOT_REF_GENERIC;
-
-	gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc);
-	assert(gnp);
-
-	gotndx = (Xword)gnp->gn_gotndx;
-
-	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
-	    (rdesc->rel_rtype == R_AMD64_DTPOFF64))
-		gotndx++;
-
-	return ((Xword)(osp->os_shdr->sh_addr + (gotndx * M_GOT_ENTSIZE)));
-}
-
-
-/* ARGSUSED5 */
-uintptr_t
-assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
-    Rel_desc * rsp, Sym_desc * sdp)
-{
-	Xword		raddend;
-	Gotndx		*gnp, *_gnp;
-	Listnode	*lnp, *plnp;
-	uint_t		gotents;
-
-	raddend = rsp->rel_raddend;
-	if (pgnp && (pgnp->gn_addend == raddend) &&
-	    (pgnp->gn_gotref == gref))
-		return (1);
-
-	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
-		gotents = 2;
-	else
-		gotents = 1;
-
-	plnp = 0;
-	for (LIST_TRAVERSE(lst, lnp, _gnp)) {
-		if (_gnp->gn_addend > raddend)
-			break;
-		plnp = lnp;
-	}
-
-	/*
-	 * Allocate a new entry.
-	 */
-	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
-		return (S_ERROR);
-	gnp->gn_addend = raddend;
-	gnp->gn_gotndx = ofl->ofl_gotcnt;
-	gnp->gn_gotref = gref;
-
-	ofl->ofl_gotcnt += gotents;
-
-	if (gref == GOT_REF_TLSLD) {
-		ofl->ofl_tlsldgotndx = gnp;
-		return (1);
-	}
-
-	if (plnp == 0) {
-		/*
-		 * Insert at head of list
-		 */
-		if (list_prependc(lst, (void *)gnp) == 0)
-			return (S_ERROR);
-	} else if (_gnp->gn_addend > raddend) {
-		/*
-		 * Insert in middle of lest
-		 */
-		if (list_insertc(lst, (void *)gnp, plnp) == 0)
-			return (S_ERROR);
-	} else {
-		/*
-		 * Append to tail of list
-		 */
-		if (list_appendc(lst, (void *)gnp) == 0)
-			return (S_ERROR);
-	}
-	return (1);
-}
-
-
-void
-assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
-{
-	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
-	sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++;
-	ofl->ofl_flags |= FLG_OF_BLDGOT;
-}
-
-static uchar_t plt0_template[M_PLT_ENTSIZE] = {
-/* 0x00 PUSHQ GOT+8(%rip) */	0xff, 0x35, 0x00, 0x00, 0x00, 0x00,
-/* 0x06 JMP   *GOT+16(%rip) */	0xff, 0x25, 0x00, 0x00, 0x00, 0x00,
-/* 0x0c NOP */			0x90,
-/* 0x0d NOP */			0x90,
-/* 0x0e NOP */			0x90,
-/* 0x0f NOP */			0x90
-};
-
-/*
- * Initializes .got[0] with the _DYNAMIC symbol value.
- */
-uintptr_t
-fillin_gotplt1(Ofl_desc * ofl)
-{
-	Word	flags = ofl->ofl_flags;
-	Word	dtflags1 = ofl->ofl_dtflags_1;
-
-	if (ofl->ofl_osgot) {
-		Sym_desc *	sdp;
-
-		if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
-			uchar_t	*genptr =
-			    ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf +
-			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
-			/* LINTED */
-			*(Xword *)genptr = sdp->sd_sym->st_value;
-		}
-	}
-
-	/*
-	 * Fill in the reserved slot in the procedure linkage table the first
-	 * entry is:
-	 *	0x00 PUSHQ	GOT+8(%rip)	    # GOT[1]
-	 *	0x06 JMP	*GOT+16(%rip)	    # GOT[2]
-	 *	0x0c NOP
-	 *	0x0d NOP
-	 *	0x0e NOP
-	 *	0x0f NOP
-	 */
-	if ((flags & FLG_OF_DYNAMIC) && ofl->ofl_osplt) {
-		uchar_t		*pltent;
-		Xword		val1;
-
-		pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
-		bcopy(plt0_template, pltent, sizeof (plt0_template));
-
-		/*
-		 * filin:
-		 *	PUSHQ GOT + 8(%rip)
-		 *
-		 * Note: 0x06 below represents the offset to the
-		 *	 next instruction - which is what %rip will
-		 *	 be pointing at.
-		 */
-		val1 = (ofl->ofl_osgot->os_shdr->sh_addr) +
-			(M_GOT_XLINKMAP * M_GOT_ENTSIZE) -
-			ofl->ofl_osplt->os_shdr->sh_addr - 0x06;
-
-		/*
-		 * If '-z noreloc' is specified - skip the do_reloc
-		 * stage.
-		 */
-		if ((flags & FLG_OF_RELOBJ) ||
-		    !(dtflags1 & DF_1_NORELOC)) {
-			if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02],
-			    &val1, MSG_ORIG(MSG_SYM_PLTENT),
-			    MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLT0FAIL));
-				return (S_ERROR);
-			}
-		}
-
-		/*
-		 * filin:
-		 *  JMP	*GOT+16(%rip)
-		 */
-		val1 = (ofl->ofl_osgot->os_shdr->sh_addr) +
-			(M_GOT_XRTLD * M_GOT_ENTSIZE) -
-			ofl->ofl_osplt->os_shdr->sh_addr - 0x0c;
-		/*
-		 * If '-z noreloc' is specified - skip the do_reloc
-		 * stage.
-		 */
-		if ((flags & FLG_OF_RELOBJ) ||
-		    !(dtflags1 & DF_1_NORELOC)) {
-			if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x08],
-			    &val1, MSG_ORIG(MSG_SYM_PLTENT),
-			    MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLT0FAIL));
-				return (S_ERROR);
-			}
-		}
-	}
-	return (1);
-}
-
-/*
- * Return got[0].
- */
-Addr
-fillin_gotplt2(Ofl_desc * ofl)
-{
-	if (ofl->ofl_osgot)
-		return (ofl->ofl_osgot->os_shdr->sh_addr);
-	else
-		return (0);
-}
--- a/usr/src/cmd/sgs/libld/common/_libld.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/_libld.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -38,6 +37,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <libld.h>
+#include <debug.h>
 #include <conv.h>
 #include <msg.h>
 
@@ -176,16 +176,13 @@
 #define	REL_HOIDESCNO	500		/* high water mark output buckets */
 #define	REL_LOIDESCNO	10		/* low water mark output buckets */
 
-extern Ofl_desc		Ofl;
 extern char		*Plibpath;
 extern char		*Llibdir;
 extern char		*Ulibdir;
-extern Ehdr		def_ehdr;
 extern Ld_heap		*ld_heap;
 extern List		lib_support;
+extern int		demangle_flag;
 extern const Msg	reject[];
-extern uint_t		dbg_mask;
-
 extern int		Verbose;
 
 /*
@@ -196,106 +193,352 @@
 /*
  * Local functions.
  */
-extern uintptr_t	add_actrel(Word, Rel_desc *, Ofl_desc *);
-extern uintptr_t	add_libdir(Ofl_desc *, const char *);
-extern uintptr_t	add_outrel(Word, Rel_desc *, Ofl_desc *);
-extern uintptr_t	add_regsym(Sym_desc *, Ofl_desc *);
-extern void 		adj_movereloc(Ofl_desc *, Rel_desc *);
-extern void		*alist_append(Alist **, const void *, size_t, int);
-extern Sym_desc * 	am_I_partial(Rel_desc *, Xword);
-extern Ar_desc *	ar_setup(const char *, Elf *, Ofl_desc *);
-extern void		ar_member(Ar_desc *, Elf_Arsym *, Ar_aux *, Ar_mem *);
+extern char		*add_string(char *, char *);
+extern const char	*demangle(const char *);
+
+extern void		lds_atexit(Ofl_desc *, int);
+
+extern void		libld_free(void *);
+extern void		*libld_malloc(size_t);
+extern void		*libld_realloc(void *, size_t);
+
+extern Listnode		*list_appendc(List *, const void *);
+extern Listnode		*list_insertc(List *, const void *, Listnode *);
+extern Listnode		*list_prependc(List *, const void *);
+extern Listnode		*list_where(List *, Word num);
+
+extern Sdf_desc		*sdf_add(const char *, List *);
+extern Sdf_desc		*sdf_find(const char *, List *);
+
+#if	defined(_ELF64)
+
+#define	ld_add_actrel		ld64_add_actrel
+#define	ld_add_libdir		ld64_add_libdir
+#define	ld_add_outrel		ld64_add_outrel
+#define	ld_adj_movereloc	ld64_adj_movereloc
+#define	ld_am_I_partial		ld64_am_I_partial
+#define	ld_ar_member		ld64_ar_member
+#define	ld_ar_setup		ld64_ar_setup
 #if	defined(sparc)
-extern uintptr_t	allocate_got(Ofl_desc *);
-extern uintptr_t	assign_got(Sym_desc *);
+#define	ld_allocate_got		ld64_allocate_got
+#endif
+#define	ld_assign_got		ld64_assign_got
+#define	ld_assign_gotndx	ld64_assign_gotndx
+#define	ld_assign_plt_ndx	ld64_assign_plt_ndx
+#define	ld_calc_got_offset	ld64_calc_got_offset
+#define	ld_calc_plt_addr	ld64_calc_plt_addr
+#define	ld_disp_errmsg		ld64_disp_errmsg
+#define	ld_do_activerelocs	ld64_do_activerelocs
+#define	ld_ent_check		ld64_ent_check
+#define	ld_exit			ld64_exit
+#define	ld_fillin_gotplt	ld64_fillin_gotplt
+#define	ld_find_gotndx		ld64_find_gotndx
+#define	ld_find_library		ld64_find_library
+#define	ld_finish_libs		ld64_finish_libs
+#define	ld_get_group		ld64_get_group
+#define	ld_lib_setup		ld64_lib_setup
+#define	ld_init			ld64_init
+#define	ld_init_rel		ld64_init_rel
+#define	ld_is_regsym		ld64_is_regsym
+#define	ld_lcm			ld64_lcm
+#define	ld_mach_update_odynamic	ld64_mach_update_odynamic
+#define	ld_mach_eflags		ld64_mach_eflags
+#define	ld_mach_make_dynamic	ld64_mach_make_dynamic
+#define	ld_mach_sym_typecheck	ld64_mach_sym_typecheck
+#define	ld_make_bss		ld64_make_bss
+#define	ld_make_got		ld64_make_got
+#define	ld_map_out		ld64_map_out
+#define	ld_map_parse		ld64_map_parse
+#define	ld_make_sunwbss		ld64_make_sunwbss
+#define	ld_make_sunwdata	ld64_make_sunwdata
+#define	ld_make_sunwmove	ld64_make_sunmove
+#define	ld_open_outfile		ld64_open_outfile
+#define	ld_perform_outreloc	ld64_perform_outreloc
+#define	ld_place_section	ld64_place_section
+#define	ld_process_archive	ld64_process_archive
+#define	ld_process_files	ld64_process_files
+#define	ld_process_flags	ld64_process_flags
+#define	ld_process_ifl		ld64_process_ifl
+#define	ld_process_open		ld64_process_open
+#define	ld_process_ordered	ld64_process_ordered
+#define	ld_process_sym_reloc	ld64_process_sym_reloc
+#define	ld_reloc_local		ld64_reloc_local
+#define	ld_reloc_GOT_relative	ld64_reloc_GOT_relative
+#define	ld_reloc_GOTOP		ld64_reloc_GOTOP
+#define	ld_reloc_plt		ld64_reloc_plt
+#define	ld_reloc_register	ld64_reloc_register
+#define	ld_reloc_remain_entry	ld64_reloc_remain_entry
+#define	ld_reloc_TLS		ld64_reloc_TLS
+#define	ld_reg_check		ld64_reg_check
+#define	ld_reg_enter		ld64_reg_enter
+#define	ld_reg_find		ld64_reg_find
+#define	ld_sec_validate		ld64_sec_validate
+#define	ld_sort_ordered		ld64_sort_ordered
+#define	ld_sort_seg_list	ld64_sort_seg_list
+#define	ld_sunwmove_preprocess	ld64_sunwmove_preprocess
+#define	ld_sup_atexit		ld64_sup_atexit
+#define	ld_sup_file		ld64_sup_file
+#define	ld_sup_loadso		ld64_sup_loadso
+#define	ld_sup_input_done	ld64_sup_input_done
+#define	ld_sup_input_section	ld64_sup_input_section
+#define	ld_sup_section		ld64_sup_section
+#define	ld_sup_start		ld64_sup_start
+#define	ld_sym_add_u		ld64_sym_add_u
+#define	ld_sym_adjust_vis	ld64_sym_adjust_vis
+#define	ld_sym_avl_comp		ld64_sym_avl_comp
+#define	ld_sym_copy		ld64_sym_copy
+#define	ld_sym_enter		ld64_sym_enter
+#define	ld_sym_find		ld64_sym_find
+#define	ld_sym_nodirect		ld64_sym_nodirect
+#define	ld_sym_process		ld64_sym_process
+#define	ld_sym_resolve		ld64_sym_resolve
+#define	ld_sym_spec		ld64_sym_spec
+#define	ld_vers_base		ld64_vers_base
+#define	ld_vers_check_defs	ld64_vers_check_defs
+#define	ld_vers_check_need	ld64_vers_check_need
+#define	ld_vers_def_process	ld64_vers_def_process
+#define	ld_vers_desc		ld64_vers_desc
+#define	ld_vers_find		ld64_vers_find
+#define	ld_vers_need_process	ld64_vers_need_process
+#define	ld_vers_promote		ld64_vers_promote
+#define	ld_vers_sym_process	ld64_vers_sym_process
+#define	ld_vers_verify		ld64_vers_verify
+
+#else
+
+#define	ld_add_actrel		ld32_add_actrel
+#define	ld_add_libdir		ld32_add_libdir
+#define	ld_add_outrel		ld32_add_outrel
+#define	ld_adj_movereloc	ld32_adj_movereloc
+#define	ld_am_I_partial		ld32_am_I_partial
+#define	ld_ar_member		ld32_ar_member
+#define	ld_ar_setup		ld32_ar_setup
+#if	defined(sparc)
+#define	ld_allocate_got		ld32_allocate_got
 #endif
-extern uintptr_t	assign_gotndx(List *, Gotndx *, Gotref, Ofl_desc *,
+#define	ld_assign_got		ld32_assign_got
+#define	ld_assign_gotndx	ld32_assign_gotndx
+#define	ld_assign_plt_ndx	ld32_assign_plt_ndx
+#define	ld_calc_got_offset	ld32_calc_got_offset
+#define	ld_calc_plt_addr	ld32_calc_plt_addr
+#define	ld_disp_errmsg		ld32_disp_errmsg
+#define	ld_do_activerelocs	ld32_do_activerelocs
+#define	ld_ent_check		ld32_ent_check
+#define	ld_exit			ld32_exit
+#define	ld_fillin_gotplt	ld32_fillin_gotplt
+#define	ld_find_gotndx		ld32_find_gotndx
+#define	ld_find_library		ld32_find_library
+#define	ld_finish_libs		ld32_finish_libs
+#define	ld_get_group		ld32_get_group
+#define	ld_lib_setup		ld32_lib_setup
+#define	ld_init			ld32_init
+#define	ld_init_rel		ld32_init_rel
+#define	ld_is_regsym		ld32_is_regsym
+#define	ld_lcm			ld32_lcm
+#define	ld_mach_update_odynamic	ld32_mach_update_odynamic
+#define	ld_mach_eflags		ld32_mach_eflags
+#define	ld_mach_make_dynamic	ld32_mach_make_dynamic
+#define	ld_mach_sym_typecheck	ld32_mach_sym_typecheck
+#define	ld_make_bss		ld32_make_bss
+#define	ld_make_got		ld32_make_got
+#define	ld_map_out		ld32_map_out
+#define	ld_map_parse		ld32_map_parse
+#define	ld_make_sunwbss		ld32_make_sunwbss
+#define	ld_make_sunwdata	ld32_make_sunwdata
+#define	ld_make_sunwmove	ld32_make_sunmove
+#define	ld_open_outfile		ld32_open_outfile
+#define	ld_perform_outreloc	ld32_perform_outreloc
+#define	ld_place_section	ld32_place_section
+#define	ld_process_archive	ld32_process_archive
+#define	ld_process_files	ld32_process_files
+#define	ld_process_flags	ld32_process_flags
+#define	ld_process_ifl		ld32_process_ifl
+#define	ld_process_open		ld32_process_open
+#define	ld_process_ordered	ld32_process_ordered
+#define	ld_process_sym_reloc	ld32_process_sym_reloc
+#define	ld_reloc_local		ld32_reloc_local
+#define	ld_reloc_GOT_relative	ld32_reloc_GOT_relative
+#define	ld_reloc_GOTOP		ld32_reloc_GOTOP
+#define	ld_reloc_plt		ld32_reloc_plt
+#define	ld_reloc_register	ld32_reloc_register
+#define	ld_reloc_remain_entry	ld32_reloc_remain_entry
+#define	ld_reloc_TLS		ld32_reloc_TLS
+#define	ld_reg_check		ld32_reg_check
+#define	ld_reg_enter		ld32_reg_enter
+#define	ld_reg_find		ld32_reg_find
+#define	ld_sec_validate		ld32_sec_validate
+#define	ld_sort_ordered		ld32_sort_ordered
+#define	ld_sort_seg_list	ld32_sort_seg_list
+#define	ld_sunwmove_preprocess	ld32_sunwmove_preprocess
+#define	ld_sup_atexit		ld32_sup_atexit
+#define	ld_sup_file		ld32_sup_file
+#define	ld_sup_loadso		ld32_sup_loadso
+#define	ld_sup_input_done	ld32_sup_input_done
+#define	ld_sup_input_section	ld32_sup_input_section
+#define	ld_sup_section		ld32_sup_section
+#define	ld_sup_start		ld32_sup_start
+#define	ld_sym_add_u		ld32_sym_add_u
+#define	ld_sym_adjust_vis	ld32_sym_adjust_vis
+#define	ld_sym_avl_comp		ld32_sym_avl_comp
+#define	ld_sym_copy		ld32_sym_copy
+#define	ld_sym_enter		ld32_sym_enter
+#define	ld_sym_find		ld32_sym_find
+#define	ld_sym_nodirect		ld32_sym_nodirect
+#define	ld_sym_process		ld32_sym_process
+#define	ld_sym_resolve		ld32_sym_resolve
+#define	ld_sym_spec		ld32_sym_spec
+#define	ld_vers_base		ld32_vers_base
+#define	ld_vers_check_defs	ld32_vers_check_defs
+#define	ld_vers_check_need	ld32_vers_check_need
+#define	ld_vers_def_process	ld32_vers_def_process
+#define	ld_vers_desc		ld32_vers_desc
+#define	ld_vers_find		ld32_vers_find
+#define	ld_vers_need_process	ld32_vers_need_process
+#define	ld_vers_promote		ld32_vers_promote
+#define	ld_vers_sym_process	ld32_vers_sym_process
+#define	ld_vers_verify		ld32_vers_verify
+
+#endif
+
+extern uintptr_t	dbg_setup(const char *, Dbg_desc *, const char **, int);
+
+extern uintptr_t	ld_add_actrel(Word, Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_add_libdir(Ofl_desc *, const char *);
+extern uintptr_t	ld_add_outrel(Word, Rel_desc *, Ofl_desc *);
+extern void 		ld_adj_movereloc(Ofl_desc *, Rel_desc *);
+extern Sym_desc * 	ld_am_I_partial(Rel_desc *, Xword);
+extern void		ld_ar_member(Ar_desc *, Elf_Arsym *, Ar_aux *,
+			    Ar_mem *);
+extern Ar_desc		*ld_ar_setup(const char *, Elf *, Ofl_desc *);
+#if	defined(sparc)
+extern uintptr_t	ld_allocate_got(Ofl_desc *);
+#endif
+extern uintptr_t	ld_assign_got(Ofl_desc *, Sym_desc *);
+extern uintptr_t	ld_assign_gotndx(List *, Gotndx *, Gotref, Ofl_desc *,
 			    Rel_desc *, Sym_desc *);
-extern void		assign_plt_ndx(Sym_desc *, Ofl_desc *);
-extern Xword		calc_got_offset(Rel_desc *, Ofl_desc *);
-extern Xword		calc_plt_addr(Sym_desc *, Ofl_desc *);
-extern int		dbg_setup(const char *);
-extern const char	*demangle(const char *);
-extern void		disp_errmsg(const char *, Rel_desc *, Ofl_desc *);
-extern uintptr_t	do_activerelocs(Ofl_desc *);
-extern void		ent_check(Ofl_desc *);
-extern uintptr_t	fillin_gotplt1(Ofl_desc *);
-extern Addr		fillin_gotplt2(Ofl_desc *);
-extern Gotndx *		find_gotndx(List *, Gotref, Ofl_desc *, Rel_desc *);
-extern uintptr_t	find_library(const char *, Ofl_desc *);
-extern Group_desc *	get_group(Ofl_desc *, Is_desc *);
+extern void		ld_assign_plt_ndx(Sym_desc *, Ofl_desc *);
+
+extern Xword		ld_calc_got_offset(Rel_desc *, Ofl_desc *);
+extern Xword		ld_calc_plt_addr(Sym_desc *, Ofl_desc *);
+
+extern void		ld_disp_errmsg(const char *, Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_do_activerelocs(Ofl_desc *);
+
+extern void		ld_ent_check(Ofl_desc *);
+extern int		ld_exit(Ofl_desc *);
+
+extern uintptr_t	ld_fillin_gotplt(Ofl_desc *);
+extern Gotndx *		ld_find_gotndx(List *, Gotref, Ofl_desc *, Rel_desc *);
+extern uintptr_t	ld_find_library(const char *, Ofl_desc *);
+extern uintptr_t	ld_finish_libs(Ofl_desc *);
+
+extern Group_desc *	ld_get_group(Ofl_desc *, Is_desc *);
+
+extern uintptr_t	ld_lib_setup(Ofl_desc *);
+
+extern void		ld_init(Ofl_desc *);
+extern Word		ld_init_rel(Rel_desc *, void *);
+extern const char	*ld_is_regsym(Ofl_desc *, Ifl_desc *, Sym *,
+			    const char *, int, Word, const char *, Word *);
+
+extern Xword		ld_lcm(Xword, Xword);
+
+extern void		ld_mach_update_odynamic(Ofl_desc *, Dyn **);
+extern void		ld_mach_eflags(Ehdr *, Ofl_desc *);
+extern void		ld_mach_make_dynamic(Ofl_desc *, size_t *);
+extern int		ld_mach_sym_typecheck(Sym_desc *, Sym *, Ifl_desc *,
+			    Ofl_desc *);
+extern uintptr_t	ld_make_bss(Ofl_desc *, Xword, Xword, Bss_Type);
+extern uintptr_t	ld_make_got(Ofl_desc *);
+extern void		ld_map_out(Ofl_desc *);
+extern uintptr_t	ld_map_parse(const char *, Ofl_desc *);
+extern uintptr_t	ld_make_sunwbss(Ofl_desc *, size_t, Xword);
+extern uintptr_t	ld_make_sunwdata(Ofl_desc *, size_t, Xword);
+extern uintptr_t	ld_make_sunwmove(Ofl_desc *, int);
+
+extern uintptr_t	ld_open_outfile(Ofl_desc *);
+
+extern uintptr_t	ld_perform_outreloc(Rel_desc *, Ofl_desc *);
+extern Os_desc *	ld_place_section(Ofl_desc *, Is_desc *, int, Word);
+extern uintptr_t	ld_process_archive(const char *, int, Ar_desc *,
+			    Ofl_desc *);
+extern uintptr_t	ld_process_files(Ofl_desc *, int, char **);
+extern uintptr_t	ld_process_flags(Ofl_desc *, int, char **);
+extern Ifl_desc		*ld_process_ifl(const char *, const char *, int, Elf *,
+			    Half, Ofl_desc *, Rej_desc *);
+extern Ifl_desc		*ld_process_open(const char *, size_t, int, Ofl_desc *,
+			    Half, Rej_desc *);
+extern uintptr_t	ld_process_ordered(Ifl_desc *, Ofl_desc *, Word, Word);
+extern uintptr_t	ld_process_sym_reloc(Ofl_desc *, Rel_desc *, Rel *,
+			    Is_desc *, const char *);
+
+extern uintptr_t	ld_reloc_local(Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_reloc_GOT_relative(Boolean, Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_reloc_GOTOP(Boolean, Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_reloc_plt(Rel_desc *, Ofl_desc *);
+extern uintptr_t	ld_reloc_register(Rel_desc *, Is_desc *, Ofl_desc *);
+extern void		ld_reloc_remain_entry(Rel_desc *, Os_desc *,
+			    Ofl_desc *);
+extern uintptr_t	ld_reloc_TLS(Boolean, Rel_desc *, Ofl_desc *);
+
+extern int		ld_reg_check(Sym_desc *, Sym *, const char *,
+			    Ifl_desc *, Ofl_desc *);
+extern int		ld_reg_enter(Sym_desc *, Ofl_desc *);
+extern Sym_desc *	ld_reg_find(Sym *, Ofl_desc *);
+
+extern void		ld_sec_validate(Ofl_desc *);
+extern uintptr_t	ld_sort_ordered(Ofl_desc *);
+extern uintptr_t	ld_sort_seg_list(Ofl_desc *);
+extern uintptr_t	ld_sunwmove_preprocess(Ofl_desc *);
+extern void		ld_sup_atexit(Ofl_desc *, int);
+extern void		ld_sup_file(Ofl_desc *, const char *, const Elf_Kind,
+			    int flags, Elf *);
+extern uintptr_t	ld_sup_loadso(Ofl_desc *, const char *);
+extern void		ld_sup_input_done(Ofl_desc *);
+extern void		ld_sup_section(Ofl_desc *, const char *, Shdr *, Word,
+			    Elf_Data *, Elf *);
+extern uintptr_t	ld_sup_input_section(Ofl_desc*, const char *, Shdr **,
+			    Word, const char *, Elf_Scn *, Elf *);
+extern void		ld_sup_start(Ofl_desc *, const Half, const char *);
+extern Sym_desc		*ld_sym_add_u(const char *, Ofl_desc *);
+extern void		ld_sym_adjust_vis(Sym_desc *, Ofl_desc *);
+extern int		ld_sym_avl_comp(const void *, const void *);
+extern uintptr_t	ld_sym_copy(Sym_desc *);
+extern Sym_desc		*ld_sym_enter(const char *, Sym *, Word, Ifl_desc *,
+			    Ofl_desc *, Word, Word, Word, Half, avl_index_t *);
+extern Sym_desc		*ld_sym_find(const char *, Word, avl_index_t *,
+			    Ofl_desc *);
+extern uintptr_t	ld_sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *);
+extern uintptr_t	ld_sym_process(Is_desc *, Ifl_desc *, Ofl_desc *);
+extern uintptr_t	ld_sym_resolve(Sym_desc *, Sym *, Ifl_desc *,
+			    Ofl_desc *, int, Word, Word);
+extern uintptr_t	ld_sym_spec(Ofl_desc *);
+
+extern Ver_desc		*ld_vers_base(Ofl_desc *);
+extern uintptr_t	ld_vers_check_defs(Ofl_desc *);
+extern uintptr_t	ld_vers_check_need(Ofl_desc *);
+extern uintptr_t	ld_vers_def_process(Is_desc *, Ifl_desc *, Ofl_desc *);
+extern Ver_desc		*ld_vers_desc(const char *, Word, List *);
+extern Ver_desc		*ld_vers_find(const char *, Word, List *);
+extern uintptr_t	ld_vers_need_process(Is_desc *, Ifl_desc *, Ofl_desc *);
+extern void		ld_vers_promote(Sym_desc *, Word, Ifl_desc *,
+			    Ofl_desc *);
+extern int		ld_vers_sym_process(Lm_list *, Is_desc *, Ifl_desc *);
+extern int		ld_vers_verify(Ofl_desc *);
+
+extern uintptr_t	add_regsym(Sym_desc *, Ofl_desc *);
+extern void		*alist_append(Alist **, const void *, size_t, int);
 extern Word		hashbkts(Word);
 extern Xword		lcm(Xword, Xword);
-extern int		ldexit(void);
-extern void		ldmap_out(Ofl_desc *);
-extern uintptr_t	lib_setup(Ofl_desc *);
 extern Listnode *	list_where(List *, Word);
-extern void		init();
-extern Word		init_rel(Rel_desc *, void *);
-extern const char	*is_regsym(Ifl_desc *, Sym *, const char *, int, Word,
-			    const char *, Word *);
-extern void		mach_eflags(Ehdr *, Ofl_desc *);
-extern void		mach_make_dynamic(Ofl_desc *, size_t *);
-extern void		mach_update_odynamic(Ofl_desc *, Dyn **);
-extern int		mach_sym_typecheck(Sym_desc *, Sym *, Ifl_desc *,
-			    Ofl_desc *);
-extern uintptr_t	make_bss(Ofl_desc *, Xword, Xword, Bss_Type);
-extern uintptr_t	make_got(Ofl_desc *);
-extern uintptr_t	make_reloc(Ofl_desc *, Os_desc *);
-extern uintptr_t	make_sunwbss(Ofl_desc *, size_t, Xword);
-extern uintptr_t	make_sunwdata(Ofl_desc *, size_t, Xword);
-extern uintptr_t	make_sunwmove(Ofl_desc *, int);
-extern uintptr_t	map_parse(const char *, Ofl_desc *);
-extern uintptr_t	perform_outreloc(Rel_desc *, Ofl_desc *);
-extern Os_desc *	place_section(Ofl_desc *, Is_desc *, int, Word);
-extern uintptr_t	process_archive(const char *, int, Ar_desc *,
-			    Ofl_desc *);
-extern uintptr_t	process_flags(Ofl_desc *, int, char **);
-extern uintptr_t	process_files(Ofl_desc *, int, char **);
-extern Ifl_desc *	process_ifl(const char *, const char *, int, Elf *,
-			    Half, Ofl_desc *, Rej_desc *);
-extern uintptr_t	process_ordered(Ifl_desc *, Ofl_desc *, Word, Word);
-extern uintptr_t	process_section(const char *, Ifl_desc *, Shdr *,
-			    Elf_Scn *, Word, int, Ofl_desc *);
-extern uintptr_t	process_sym_reloc(Ofl_desc *, Rel_desc *, Rel *,
-			    Is_desc *, const char *);
-extern int		reg_check(Sym_desc *, Sym *, const char *, Ifl_desc *,
-			    Ofl_desc *);
-extern int		reg_enter(Sym_desc *, Ofl_desc *);
-extern Sym_desc *	reg_find(Sym *, Ofl_desc *);
-extern uintptr_t	reloc_local(Rel_desc *, Ofl_desc *);
-extern uintptr_t	reloc_plt(Rel_desc *, Ofl_desc *);
-extern uintptr_t	reloc_register(Rel_desc *, Is_desc *, Ofl_desc *);
-extern void		reloc_remain_entry(Rel_desc *, Os_desc *, Ofl_desc *);
-extern uintptr_t	reloc_GOT_relative(Boolean, Rel_desc *, Ofl_desc *);
-extern uintptr_t	reloc_GOTOP(Boolean, Rel_desc *, Ofl_desc *);
-extern uintptr_t	reloc_TLS(Boolean, Rel_desc *, Ofl_desc *);
-extern uintptr_t	sort_ordered(Ofl_desc *);
-extern uintptr_t	sort_seg_list(Ofl_desc *);
-extern void		sym_adjust_vis(Sym_desc *, Ofl_desc *);
-extern int		sym_avl_comp(const void *, const void *);
-extern uintptr_t	sym_copy(Sym_desc *);
-extern uintptr_t	sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *);
-extern uintptr_t	sym_process(Is_desc *, Ifl_desc *, Ofl_desc *);
-extern uintptr_t	sym_resolve(Sym_desc *, Sym *, Ifl_desc *, Ofl_desc *,
-				int, Word, Word);
-extern uintptr_t	sym_spec(Ofl_desc *);
-extern uintptr_t	vers_def_process(Is_desc *, Ifl_desc *, Ofl_desc *);
-extern uintptr_t	vers_need_process(Is_desc *, Ifl_desc *, Ofl_desc *);
-extern int		vers_sym_process(Is_desc *, Ifl_desc *);
-extern uintptr_t	vers_check_need(Ofl_desc *);
-extern void		vers_promote(Sym_desc *, Word, Ifl_desc *, Ofl_desc *);
-extern int		vers_verify(Ofl_desc *);
 
 /*
  * AMD64 - 64-bit specific functions
  */
-#if defined(__x86) && defined(_ELF64)
+#if	(defined(__i386) || defined(__amd64)) && defined(_ELF64)
+extern uintptr_t	append_amd64_unwind(Os_desc *, Ofl_desc *);
 extern uintptr_t	make_amd64_unwindhdr(Ofl_desc *);
-extern uintptr_t	process_amd64_unwind(const char *, Ifl_desc *, Shdr *,
-			    Elf_Scn *, Word, int, Ofl_desc *);
 extern uintptr_t	populate_amd64_unwindhdr(Ofl_desc *);
-extern uintptr_t	append_amd64_unwind(Os_desc *, Ofl_desc *);
 #endif
 
 #ifdef	__cplusplus
--- a/usr/src/cmd/sgs/libld/common/args.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/args.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -54,7 +53,7 @@
 #include	<errno.h>
 #include	<elf.h>
 #include	<unistd.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -192,7 +191,7 @@
 check_flags(Ofl_desc * ofl, int argc)
 {
 	if (Plibpath && (Llibdir || Ulibdir)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_YP),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_YP),
 		    Llibdir ? 'L' : 'U');
 		ofl->ofl_flags |= FLG_OF_FATAL;
 	}
@@ -201,8 +200,8 @@
 		if (dflag == SET_UNKNOWN)
 			dflag = SET_FALSE;
 		if (ofl->ofl_flags1 & FLG_OF1_RELCNT) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_R),
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_R),
 			    MSG_ORIG(MSG_ARG_ZCOMBRELOC));
 			ofl->ofl_flags1 &= ~FLG_OF1_RELCNT;
 		}
@@ -228,7 +227,7 @@
 		ofl->ofl_flags1 |= FLG_OF1_AUTOELM;
 
 	if (Blflag && Beflag) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
 		    MSG_ORIG(MSG_ARG_BELIMINATE), MSG_ORIG(MSG_ARG_BLOCAL));
 		ofl->ofl_flags |= FLG_OF_FATAL;
 	}
@@ -242,8 +241,9 @@
 		    (FLG_OF_DYNAMIC | FLG_OF_DYNLIBS | FLG_OF_PROCRED);
 
 		if (aflag) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DY), MSG_ORIG(MSG_ARG_A));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DY),
+			    MSG_ORIG(MSG_ARG_A));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 
@@ -252,7 +252,8 @@
 
 		if (Bgflag == TRUE) {
 			if (zdflag == SET_FALSE) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_BGROUP),
 				    MSG_ORIG(MSG_ARG_ZNODEF));
 				ofl->ofl_flags |= FLG_OF_FATAL;
@@ -267,7 +268,8 @@
 		 * job running this object.
 		 */
 		if ((ofl->ofl_dtflags_1 & DF_1_NODEFLIB) && !ofl->ofl_rpath)
-			eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_NODEFLIB));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_ARG_NODEFLIB));
 
 		/*
 		 * By default, text relocation warnings are given when building
@@ -331,27 +333,30 @@
 				ofl->ofl_flags |= FLG_OF_NOUNDEF;
 
 			if (Bsflag) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_DYNINCOMP),
 				    MSG_ORIG(MSG_ARG_BSYMBOLIC));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
 			if (ofl->ofl_soname) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_DYNINCOMP),
 				    MSG_ORIG(MSG_ARG_H));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
 			if (Btflag) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP),
-					MSG_ORIG(MSG_ARG_BTRANS));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_DYNINCOMP),
+				    MSG_ORIG(MSG_ARG_BTRANS));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
 			if (ofl->ofl_filtees) {
 				if (ofl->ofl_flags & FLG_OF_AUX) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_DYNINCOMP),
 					    MSG_ORIG(MSG_ARG_F));
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_DYNINCOMP),
 					    MSG_ORIG(MSG_ARG_CF));
 				}
@@ -397,53 +402,63 @@
 		ofl->ofl_flags |= FLG_OF_STATIC;
 
 		if (bflag) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_B));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_B));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ofl->ofl_soname) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_H));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_H));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ofl->ofl_depaudit) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_P));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_P));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ofl->ofl_audit) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CP));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_CP));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ofl->ofl_config) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_C));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_C));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ofl->ofl_filtees) {
 			if (ofl->ofl_flags & FLG_OF_AUX) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_F));
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CF));
 			}
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (ztflag) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_ZTEXTALL));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_ZTEXTALL));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (Gflag) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CG));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN),
+			    MSG_ORIG(MSG_ARG_CG));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		if (aflag && rflag) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
-			    MSG_ORIG(MSG_ARG_A), MSG_ORIG(MSG_ARG_R));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_A),
+			    MSG_ORIG(MSG_ARG_R));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 
@@ -453,14 +468,16 @@
 			 * if no output relocations will refer to them
 			 */
 			if (sflag) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_STRIP));
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_STRIP));
 			}
 
 			if (ztflag == 0)
 				ofl->ofl_flags1 |= FLG_OF1_TEXTOFF;
 
 			if (ofl->ofl_interp) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_R), MSG_ORIG(MSG_ARG_CI));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -486,7 +503,7 @@
 	 * it is only at this point we're sure what the output image will be
 	 * (static or dynamic).
 	 */
-	if (ent_setup(ofl, M_SEGM_ALIGN) == S_ERROR)
+	if (ld_ent_setup(ofl, M_SEGM_ALIGN) == S_ERROR)
 		return (S_ERROR);
 
 	/*
@@ -498,11 +515,11 @@
 		const char	*name;
 
 		for (LIST_TRAVERSE(&ofl->ofl_maps, lnp, name))
-			if (map_parse(name, ofl) == S_ERROR)
+			if (ld_map_parse(name, ofl) == S_ERROR)
 				return (S_ERROR);
 
 		if (ofl->ofl_flags & FLG_OF_SEGSORT)
-			if (sort_seg_list(ofl) == S_ERROR)
+			if (ld_sort_seg_list(ofl) == S_ERROR)
 				return (S_ERROR);
 	}
 
@@ -513,7 +530,8 @@
 	 */
 	if (zlflag) {
 		if ((ofl->ofl_filtees == 0) && (ofl->ofl_dtsfltrs == 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOFLTR),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_NOFLTR),
 			    MSG_ORIG(MSG_ARG_ZLOADFLTR));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
@@ -530,7 +548,8 @@
 		if (Vflag && (argc == 2))
 			ofl->ofl_flags1 |= FLG_OF1_DONE;
 		else {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOFILES));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_ARG_NOFILES));
 			return (S_ERROR);
 		}
 	}
@@ -556,7 +575,7 @@
 	 *	ld32= 	or
 	 *	ld64=
 	 */
-#if defined(_LP64)
+#if	defined(_LP64)
 	if (optarg[2] == '3')
 		return (0);
 #else
@@ -657,7 +676,7 @@
 	int	c;
 
 	while ((c = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != -1) {
-		DBG_CALL(Dbg_args_flags((optind - 1), c));
+		DBG_CALL(Dbg_args_flags(ofl->ofl_lml, (optind - 1), c));
 
 		switch (c) {
 		case '6':			/* Processed by ld to */
@@ -667,7 +686,8 @@
 			 * -6* option is mistakenly passed to us.
 			 */
 			if (optarg[0] != '4') {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_6), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -683,33 +703,35 @@
 
 		case 'c':
 			if (ofl->ofl_config)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_MTONCE),
 				    MSG_ORIG(MSG_ARG_C));
 			else
 				ofl->ofl_config = optarg;
 			break;
 
 		case 'C':
-			ofl->ofl_flags1 |= FLG_OF1_DEMANGL;
+			demangle_flag = 1;
 			break;
 
 		case 'd':
 			if ((optarg[0] == 'n') && (optarg[1] == '\0')) {
 				if (dflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_D));
 				else
 					dflag = SET_FALSE;
 			} else if ((optarg[0] == 'y') && (optarg[1] == '\0')) {
 				if (dflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_D));
 				else
 					dflag = SET_TRUE;
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_D), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -717,7 +739,8 @@
 
 		case 'e':
 			if (ofl->ofl_entry)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_MTONCE),
 				    MSG_ORIG(MSG_ARG_E));
 			else
 				ofl->ofl_entry = (void *)optarg;
@@ -726,7 +749,8 @@
 		case 'f':
 			if (ofl->ofl_filtees &&
 			    (!(ofl->ofl_flags & FLG_OF_AUX))) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_F), MSG_ORIG(MSG_ARG_CF));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			} else {
@@ -741,7 +765,8 @@
 		case 'F':
 			if (ofl->ofl_filtees &&
 			    (ofl->ofl_flags & FLG_OF_AUX)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_INCOMP),
 				    MSG_ORIG(MSG_ARG_CF), MSG_ORIG(MSG_ARG_F));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			} else {
@@ -754,7 +779,8 @@
 
 		case 'h':
 			if (ofl->ofl_soname)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_MTONCE),
 				    MSG_ORIG(MSG_ARG_H));
 			else
 				ofl->ofl_soname = (const char *)optarg;
@@ -766,7 +792,8 @@
 
 		case 'I':
 			if (ofl->ofl_interp)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_MTONCE),
 				    MSG_ORIG(MSG_ARG_CI));
 			else
 				ofl->ofl_interp = (const char *)optarg;
@@ -788,7 +815,8 @@
 
 		case 'o':
 			if (ofl->ofl_name)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_MTONCE),
 				    MSG_ORIG(MSG_ARG_O));
 			else
 				ofl->ofl_name = (const char *)optarg;
@@ -876,7 +904,7 @@
 			} else if (
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_DEFS)) == 0) {
 				if (zdflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_ZDEFNODEF));
 				else
@@ -884,7 +912,7 @@
 			} else if (strcmp(optarg,
 			    MSG_ORIG(MSG_ARG_NODEFS)) == 0) {
 				if (zdflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_ZDEFNODEF));
 				else
@@ -893,7 +921,7 @@
 			    MSG_ORIG(MSG_ARG_TEXT)) == 0) {
 				if (ztflag &&
 				    (ztflag != MSG_ORIG(MSG_ARG_ZTEXT))) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_ZTEXT),
 					    ztflag);
@@ -904,7 +932,7 @@
 			    MSG_ORIG(MSG_ARG_TEXTOFF)) == 0) {
 				if (ztflag &&
 				    (ztflag != MSG_ORIG(MSG_ARG_ZTEXTOFF))) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_ZTEXTOFF),
 					    ztflag);
@@ -915,7 +943,7 @@
 			    MSG_ORIG(MSG_ARG_TEXTWARN)) == 0) {
 				if (ztflag &&
 				    (ztflag != MSG_ORIG(MSG_ARG_ZTEXTWARN))) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_ZTEXTWARN),
 					    ztflag);
@@ -1016,7 +1044,8 @@
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_NOLAZYLOAD)) &&
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_RECORD)) &&
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_WEAKEXT))) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_Z), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 
@@ -1034,16 +1063,17 @@
 			 * process_files (this allows debugging to be turned
 			 * on and off around individual groups of files).
 			 */
-			if (ofl->ofl_objscnt == 0)
-				if ((dbg_mask = dbg_setup(optarg)) ==
-				    (uint_t)S_ERROR)
+			if (ofl->ofl_objscnt == 0) {
+				if (dbg_setup(optarg, dbg_desc,
+				    &ofl->ofl_name, 1) == S_ERROR)
 					return (S_ERROR);
+			}
 			break;
 
 		case 'B':
 			if (strcmp(optarg, MSG_ORIG(MSG_ARG_DIRECT)) == 0) {
 				if (Bdflag == SET_FALSE) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_BNODIRECT),
 					    MSG_ORIG(MSG_ARG_BDIRECT));
@@ -1053,7 +1083,7 @@
 			} else if (strcmp(optarg,
 			    MSG_ORIG(MSG_ARG_NODIRECT)) == 0) {
 				if (Bdflag == SET_TRUE) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_BDIRECT),
 					    MSG_ORIG(MSG_ARG_BNODIRECT));
@@ -1077,7 +1107,8 @@
 				Beflag = TRUE;
 			else if (strcmp(optarg, MSG_ORIG(MSG_STR_LD_DYNAMIC)) &&
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_STATIC))) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_CB), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -1101,20 +1132,21 @@
 		case 'Q':
 			if ((optarg[0] == 'n') && (optarg[1] == '\0')) {
 				if (Qflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_CQ));
 				else
 					Qflag = SET_FALSE;
 			} else if ((optarg[0] == 'y') && (optarg[1] == '\0')) {
 				if (Qflag != SET_UNKNOWN)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_CQ));
 				else
 					Qflag = SET_TRUE;
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_CQ), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -1135,7 +1167,7 @@
 		case 'Y':
 			if (strncmp(optarg, MSG_ORIG(MSG_ARG_LCOM), 2) == 0) {
 				if (Llibdir)
-				    eprintf(ERR_WARNING,
+				    eprintf(ofl->ofl_lml, ERR_WARNING,
 					MSG_INTL(MSG_ARG_MTONCE),
 					MSG_ORIG(MSG_ARG_CYL));
 				else
@@ -1143,7 +1175,7 @@
 			} else if (strncmp(optarg,
 			    MSG_ORIG(MSG_ARG_UCOM), 2) == 0) {
 				if (Ulibdir)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_CYU));
 				else
@@ -1151,13 +1183,14 @@
 			} else if (strncmp(optarg,
 			    MSG_ORIG(MSG_ARG_PCOM), 2) == 0) {
 				if (Plibpath)
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_ARG_MTONCE),
 					    MSG_ORIG(MSG_ARG_CYP));
 				else
 					Plibpath = optarg + 2;
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_ILLEGAL),
 				    MSG_ORIG(MSG_ARG_CY), optarg);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
@@ -1186,10 +1219,10 @@
 		Ifl_desc	*ifl;
 		Sym_desc	*sdp;
 
-		DBG_CALL(Dbg_args_flags((optind - 1), c));
+		DBG_CALL(Dbg_args_flags(ofl->ofl_lml, (optind - 1), c));
 		switch (c) {
 			case 'l':
-				if (find_library(optarg, ofl) == S_ERROR)
+				if (ld_find_library(optarg, ofl) == S_ERROR)
 					return (S_ERROR);
 				break;
 			case 'B':
@@ -1199,7 +1232,7 @@
 						ofl->ofl_flags |=
 							FLG_OF_DYNLIBS;
 					else {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_ARG_INCOMP),
 						    MSG_ORIG(MSG_ARG_DN),
 						    MSG_ORIG(MSG_ARG_BDYNAMIC));
@@ -1210,7 +1243,7 @@
 					ofl->ofl_flags &= ~FLG_OF_DYNLIBS;
 				break;
 			case 'L':
-				if (add_libdir(ofl, optarg) == S_ERROR)
+				if (ld_add_libdir(ofl, optarg) == S_ERROR)
 					return (S_ERROR);
 				break;
 			case 'N':
@@ -1218,7 +1251,7 @@
 				 * Record DT_NEEDED string
 				 */
 				if (!(ofl->ofl_flags & FLG_OF_DYNAMIC)) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_ARG_INCOMP),
 					    MSG_ORIG(MSG_ARG_DN),
 					    MSG_ORIG(MSG_ARG_CN));
@@ -1236,10 +1269,11 @@
 
 				break;
 			case 'D':
-				dbg_mask = dbg_setup(optarg);
+				(void) dbg_setup(optarg, dbg_desc,
+				    &ofl->ofl_name, 2);
 				break;
 			case 'u':
-				if (sym_add_u(optarg, ofl) ==
+				if (ld_sym_add_u(optarg, ofl) ==
 				    (Sym_desc *)S_ERROR)
 					return (S_ERROR);
 				break;
@@ -1291,7 +1325,7 @@
 				} else if (strncmp(optarg,
 				    MSG_ORIG(MSG_ARG_INITARRAY),
 				    MSG_ARG_INITARRAY_SIZE) == 0) {
-					if (((sdp = sym_add_u(optarg +
+					if (((sdp = ld_sym_add_u(optarg +
 					    MSG_ARG_INITARRAY_SIZE, ofl)) ==
 					    (Sym_desc *)S_ERROR) ||
 					    (list_appendc(&ofl->ofl_initarray,
@@ -1300,7 +1334,7 @@
 				} else if (strncmp(optarg,
 				    MSG_ORIG(MSG_ARG_FINIARRAY),
 				    MSG_ARG_FINIARRAY_SIZE) == 0) {
-					if (((sdp = sym_add_u(optarg +
+					if (((sdp = ld_sym_add_u(optarg +
 					    MSG_ARG_FINIARRAY_SIZE, ofl)) ==
 					    (Sym_desc *)S_ERROR) ||
 					    (list_appendc(&ofl->ofl_finiarray,
@@ -1309,7 +1343,7 @@
 				} else if (strncmp(optarg,
 				    MSG_ORIG(MSG_ARG_PREINITARRAY),
 				    MSG_ARG_PREINITARRAY_SIZE) == 0) {
-					if (((sdp = sym_add_u(optarg +
+					if (((sdp = ld_sym_add_u(optarg +
 					    MSG_ARG_PREINITARRAY_SIZE, ofl)) ==
 					    (Sym_desc *)S_ERROR) ||
 					    (list_appendc(&ofl->ofl_preiarray,
@@ -1318,7 +1352,7 @@
 				} else if (strncmp(optarg,
 				    MSG_ORIG(MSG_ARG_RTLDINFO),
 				    MSG_ARG_RTLDINFO_SIZE) == 0) {
-					if (((sdp = sym_add_u(optarg +
+					if (((sdp = ld_sym_add_u(optarg +
 					    MSG_ARG_RTLDINFO_SIZE, ofl)) ==
 					    (Sym_desc *)S_ERROR) ||
 					    (list_appendc(&ofl->ofl_rtldinfo,
@@ -1327,7 +1361,7 @@
 				} else if (strncmp(optarg,
 				    MSG_ORIG(MSG_ARG_DTRACE),
 				    MSG_ARG_DTRACE_SIZE) == 0) {
-					if ((sdp = sym_add_u(optarg +
+					if ((sdp = ld_sym_add_u(optarg +
 					    MSG_ARG_DTRACE_SIZE, ofl)) ==
 					    (Sym_desc *)S_ERROR)
 						return (S_ERROR);
@@ -1369,7 +1403,7 @@
 }
 
 uintptr_t
-process_flags(Ofl_desc *ofl, int argc, char **argv)
+ld_process_flags(Ofl_desc *ofl, int argc, char **argv)
 {
 	int	error = 0;	/* Collect all argument errors before exit */
 
@@ -1425,15 +1459,16 @@
 		if ((fd = open(argv[optind], O_RDONLY)) == -1) {
 			int err = errno;
 
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), argv[optind],
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYS_OPEN), argv[optind],
 			    strerror(err));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
 		}
 
-		DBG_CALL(Dbg_args_files(optind, argv[optind]));
+		DBG_CALL(Dbg_args_files(ofl->ofl_lml, optind, argv[optind]));
 
-		ifl = process_open(argv[optind], 0, fd, ofl,
+		ifl = ld_process_open(argv[optind], 0, fd, ofl,
 		    (FLG_IF_CMDLINE | FLG_IF_NEEDED), &rej);
 		(void) close(fd);
 		if (ifl == (Ifl_desc *)S_ERROR)
@@ -1443,9 +1478,10 @@
 		 * Check for mismatched input.
 		 */
 		if (rej.rej_type) {
-			eprintf(ERR_FATAL, MSG_INTL(reject[rej.rej_type]),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(reject[rej.rej_type]),
 			    rej.rej_name ? rej.rej_name :
-			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej));
+			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (1);
 		}
@@ -1454,7 +1490,7 @@
 }
 
 uintptr_t
-process_files(Ofl_desc *ofl, int argc, char **argv)
+ld_process_files(Ofl_desc *ofl, int argc, char **argv)
 {
 	optind = 1;		/* reinitialize optind */
 
@@ -1472,7 +1508,7 @@
 	 * any additional `needed' shared object dependencies.
 	 */
 	if (ofl->ofl_soneed.head)
-		if (finish_libs(ofl) == S_ERROR)
+		if (ld_finish_libs(ofl) == S_ERROR)
 			return (S_ERROR);
 
 	/*
@@ -1492,7 +1528,7 @@
 
 		ofl->ofl_flags1 &= ~FLG_OF1_EXTRACT;
 
-		DBG_CALL(Dbg_file_ar_rescan());
+		DBG_CALL(Dbg_file_ar_rescan(ofl->ofl_lml));
 
 		for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) {
 			const char	*name = adp->ad_name;
@@ -1512,7 +1548,8 @@
 			if ((fd = open(name, O_RDONLY)) == -1) {
 				int err = errno;
 
-				eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_SYS_OPEN), name,
 				    strerror(err));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				return (S_ERROR);
@@ -1524,7 +1561,7 @@
 			ofl->ofl_flags1 &= ~MSK_OF1_ARCHIVE;
 			ofl->ofl_flags1 |= (adp->ad_flags & MSK_OF1_ARCHIVE);
 
-			error = process_archive(adp->ad_name, fd, adp, ofl);
+			error = ld_process_archive(adp->ad_name, fd, adp, ofl);
 			(void) close(fd);
 
 			if (error == S_ERROR)
@@ -1549,7 +1586,7 @@
 	 * version dependencies are satisfied, and version symbols created.
 	 */
 	if (ofl->ofl_verdesc.head)
-		if (vers_check_defs(ofl) == S_ERROR)
+		if (ld_vers_check_defs(ofl) == S_ERROR)
 			return (S_ERROR);
 
 	/*
@@ -1557,7 +1594,7 @@
 	 * are ok.
 	 */
 	if (ofl->ofl_flags & FLG_OF_SEGORDER)
-		ent_check(ofl);
+		ld_ent_check(ofl);
 
 	return (1);
 }
--- a/usr/src/cmd/sgs/libld/common/debug.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/debug.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,31 +18,136 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1999 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdio.h>
+#include	<stdarg.h>
+#include	<strings.h>
 #include	<dlfcn.h>
-#include	"debug.h"
-#include	"_libld.h"
+#include	<debug.h>
+#include	"msg.h"
 
 /*
- * It's possible that dbg_setup may be called more than once.
+ * dbg_setup() can be called a number of times.  The typical use through
+ * LD_OPTIONS, results in dbg_setup() being called as the first argument to
+ * ld(1).  It's also possible to pass debugging tokens through the compiler,
+ * for example -Wl,-Dlibs -Wl-Ddetail, in which case multiple dbg_setup()
+ * calls are made.
+ *
+ * A distinction is also made between diagnostics being requested before any
+ * other ld(1) options are read, or whether the debugging options occur
+ * between other options on the command line.  In the latter case, the
+ * debugging options can be used to isolate diagnostics around one or more
+ * input files.  The "phase" argument allows us to select which phase of
+ * dbg_setup() processing we should isolate ourselves to.
+ *
+ * dbg_print() can require the output filename for use in the diagnostics
+ * created.  Save the address of the output filename pointer for this use.
  */
-static int	dbg_init = 0;
+static const char	**Name = 0;
+static int		Phase = 0;
 
-int
-dbg_setup(const char * options)
+uintptr_t
+dbg_setup(const char *options, Dbg_desc *dbp, const char **name, int phase)
 {
-	if (dbg_init)
+	if (Phase == 0)
+		Phase = phase;
+	else if (Phase != phase)
 		return (0);
 
+	Name = name;
+
 	/*
 	 * Call the debugging setup routine to initialize the mask and
 	 * debug function array.
 	 */
-	return (Dbg_setup(options));
+	return (Dbg_setup(options, dbp));
 }
+
+/* PRINTFLIKE2 */
+void
+dbg_print(Lm_list *lml, const char *format, ...)
+{
+	static char	*prestr = 0;
+	va_list		args;
+
+#if	defined(lint)
+	/*
+	 * The lml argument is only meaningful for diagnostics sent to ld.so.1.
+	 * Supress the lint error by making a dummy assignment.
+	 */
+	lml = 0;
+#endif
+	/*
+	 * Knock off any newline indicator to signify that a diagnostic has
+	 * been processed.
+	 */
+	dbg_desc->d_extra &= ~DBG_E_STDNL;
+
+	if (DBG_ISSNAME()) {
+		/*
+		 * If the debugging options have requested each diagnostic line
+		 * be prepended by a name create a prefix string.
+		 */
+		if ((prestr == 0) && *Name) {
+			const char	*name, *cls;
+			size_t		len;
+
+			/*
+			 * Select the fullname or basename of the output file
+			 * being created.
+			 */
+			if (DBG_ISFNAME())
+				name = *Name;
+			else {
+				if ((name =
+				    strrchr(*Name, '/')) == 0)
+					name = *Name;
+				else
+					name++;
+			}
+			len = strlen(name) +
+			    strlen(MSG_INTL(MSG_DBG_NAME_FMT)) + 1;
+
+			/*
+			 * Add the output file class if required.
+			 */
+			if (DBG_ISCLASS()) {
+#if	defined(_ELF64)
+				len += MSG_DBG_CLS64_FMT_SIZE;
+				cls = MSG_ORIG(MSG_DBG_CLS64_FMT);
+#else
+				len += MSG_DBG_CLS32_FMT_SIZE;
+				cls = MSG_ORIG(MSG_DBG_CLS32_FMT);
+#endif
+			}
+
+			/*
+			 * Allocate a string to build the prefix.
+			 */
+			if ((prestr = malloc(len)) == 0)
+				prestr = (char *)MSG_INTL(MSG_DBG_DFLT_FMT);
+			else {
+				(void) snprintf(prestr, len,
+				    MSG_INTL(MSG_DBG_NAME_FMT), name);
+				if (DBG_ISCLASS())
+					(void) strcat(prestr, cls);
+			}
+		}
+		if (prestr)
+			(void) fputs(prestr, stderr);
+		else
+			(void) fputs(MSG_INTL(MSG_DBG_AOUT_FMT), stderr);
+	} else
+		(void) fputs(MSG_INTL(MSG_DBG_DFLT_FMT), stderr);
+
+	va_start(args, format);
+	(void) vfprintf(stderr, format, args);
+	(void) fprintf(stderr, MSG_ORIG(MSG_STR_NL));
+	va_end(args);
+}
--- a/usr/src/cmd/sgs/libld/common/entry.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/entry.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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 (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdio.h>
 #include	<memory.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -41,7 +40,7 @@
  * segments it can potentially create.   Additional segments may be added
  * using a map file.
  */
-#ifdef _ELF64
+#if	defined(_ELF64)
 /* Phdr packing changes under Elf64 */
 static Sg_desc sg_desc[LD_NUM] = {
 	{{PT_PHDR, PF_R + PF_X, 0, 0, 0, 0, 0, 0},
@@ -183,7 +182,7 @@
  * the output file descriptor.
  */
 uintptr_t
-ent_setup(Ofl_desc * ofl, Xword segalign)
+ld_ent_setup(Ofl_desc * ofl, Xword segalign)
 {
 	Ent_desc *	enp;
 	Sg_desc *	sgp;
@@ -193,15 +192,17 @@
 	 * Initialize the elf library.
 	 */
 	if (elf_version(EV_CURRENT) == EV_NONE) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ELF_LIBELF), EV_CURRENT);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ELF_LIBELF),
+		    EV_CURRENT);
 		return (S_ERROR);
 	}
 
 	/*
 	 * Initialize internal Global Symbol Table AVL tree
 	 */
-	avl_create(&ofl->ofl_symavl, &sym_avl_comp, sizeof (Sym_avlnode),
-		SGSOFFSETOF(Sym_avlnode, sav_node));
+	avl_create(&ofl->ofl_symavl, &ld_sym_avl_comp, sizeof (Sym_avlnode),
+	    SGSOFFSETOF(Sym_avlnode, sav_node));
+
 	/*
 	 * The datasegment permissions can differ depending on whether
 	 * this object is built statically or dynamically.
--- a/usr/src/cmd/sgs/libld/common/exit.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/exit.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 1999-2003 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -35,7 +34,6 @@
 #include	<unistd.h>
 #include	<signal.h>
 #include	<locale.h>
-#include	<errno.h>
 #include	<string.h>
 #include	"msg.h"
 #include	"_libld.h"
@@ -44,19 +42,18 @@
  * Exit after cleaning up.
  */
 int
-ldexit()
+ld_exit(Ofl_desc *ofl)
 {
 	/*
 	 * If we have created an output file remove it.
 	 */
-	if ((Ofl.ofl_fd > 0) && ((Ofl.ofl_flags1 & FLG_OF1_NONREG) == 0))
-		(void) unlink(Ofl.ofl_name);
+	if ((ofl->ofl_fd > 0) && ((ofl->ofl_flags1 & FLG_OF1_NONREG) == 0))
+		(void) unlink(ofl->ofl_name);
 
 	/*
 	 * Inform any support library that the link-edit has failed.
 	 */
-	lds_atexit(1);
-
+	ld_sup_atexit(ofl, 1);
 	return (1);
 }
 
@@ -69,12 +66,15 @@
 	void (*	defhdl)();
 } Signals;
 
-Signals signals[] = {	{ SIGHUP,	SIG_DFL },
-			{ SIGINT,	SIG_IGN },
-			{ SIGQUIT,	SIG_DFL },
-			{ SIGBUS,	SIG_DFL },
-			{ SIGTERM,	SIG_IGN },
-			{ 0,		0 } };
+static Signals signals[] = {
+	{ SIGHUP,	SIG_DFL },
+	{ SIGINT,	SIG_IGN },
+	{ SIGQUIT,	SIG_DFL },
+	{ SIGBUS,	SIG_DFL },
+	{ SIGTERM,	SIG_IGN },
+	{ 0,		0 } };
+
+static Ofl_desc	*Ofl = 0;
 
 /*
  * Define our signal handler.
@@ -108,9 +108,9 @@
 	 * error (one instance was a stale NFS handle from an unstable server).
 	 * Thus we catch all bus errors and hope we can decode a better error.
 	 */
-	if ((sig == SIGBUS) && sip && Ofl.ofl_name) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INTERRUPT), Ofl.ofl_name,
-		    strerror(sip->si_errno));
+	if ((sig == SIGBUS) && sip && Ofl->ofl_name) {
+		eprintf(Ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INTERRUPT),
+		    Ofl->ofl_name, strerror(sip->si_errno));
 	}
 	/*
 	 * This assert(0) causes DEBUG enabled linkers to produce a core file.
@@ -118,19 +118,20 @@
 	if ((sig != SIGHUP) && (sig != SIGINT))
 		assert(0);
 
-	exit(ldexit());
+	exit(ld_exit(Ofl));
 }
 
-
 /*
  * Establish a signal handler for all signals we're interested in.
  */
 void
-init()
+ld_init(Ofl_desc *ofl)
 {
 	struct sigaction	nact, oact;
 	Signals *		sigs;
 
+	Ofl = ofl;
+
 	/*
 	 * For each signal we're interested in set up a signal handler that
 	 * insures we clean up any output file we're in the middle of creating.
--- a/usr/src/cmd/sgs/libld/common/files.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/files.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -44,7 +43,6 @@
 #include	<msg.h>
 #include	<_libld.h>
 
-
 /*
  * Decide if we can link against this input file.
  */
@@ -67,7 +65,7 @@
 		rej->rej_info = (uint_t)ehdr->e_ident[EI_DATA];
 		return (0);
 	}
-	if (ehdr->e_version > ofl->ofl_libver) {
+	if (ehdr->e_version > ofl->ofl_dehdr->e_version) {
 		rej->rej_type = SGS_REJ_VERSION;
 		rej->rej_info = (uint_t)ehdr->e_version;
 		return (0);
@@ -75,12 +73,11 @@
 	return (1);
 }
 
-
 /*
  * Check sanity of file header and allocate an infile descriptor
  * for the file being processed.
  */
-Ifl_desc *
+static Ifl_desc *
 ifl_setup(const char *name, Ehdr *ehdr, Elf *elf, Half flags, Ofl_desc *ofl,
     Rej_desc *rej)
 {
@@ -90,7 +87,7 @@
 
 	if (ifl_verify(ehdr, ofl, &_rej) == 0) {
 		_rej.rej_name = name;
-		DBG_CALL(Dbg_file_rejected(&_rej));
+		DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej));
 		if (rej->rej_type == 0) {
 			*rej = _rej;
 			rej->rej_name = strdup(_rej.rej_name);
@@ -117,12 +114,14 @@
 		Shdr	*shdr0;
 
 		if ((scn = elf_getscn(elf, 0)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSCN), name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return ((Ifl_desc *)S_ERROR);
 		}
 		if ((shdr0 = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSHDR), name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return ((Ifl_desc *)S_ERROR);
 		}
@@ -159,7 +158,7 @@
  * Process a generic section.  The appropriate section information is added
  * to the files input descriptor list.
  */
-uintptr_t
+static uintptr_t
 process_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -180,7 +179,8 @@
 	/* LINTED */
 	isp->is_key = (Half)ident;
 	if ((isp->is_indata = elf_getdata(scn, NULL)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETDATA),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
@@ -195,19 +195,21 @@
 	 * to the output section list (some sections like .strtab and
 	 * .shstrtab are not added to the output section list).
 	 *
-	 * If the section has the SHF_ORDERED flag on, do the place_section()
+	 * If the section has the SHF_ORDERED flag on, do the ld_place_section()
 	 * after all input sections from this file are read in.
 	 */
 	ifl->ifl_isdesc[ndx] = isp;
 	if (ident && (shdr->sh_flags & ALL_SHF_ORDER) == 0)
-		return ((uintptr_t)place_section(ofl, isp, ident, 0));
+		return ((uintptr_t)ld_place_section(ofl, isp, ident, 0));
 
 	if (ident && (shdr->sh_flags & ALL_SHF_ORDER)) {
 		isp->is_flags |= FLG_IS_ORDERED;
 		isp->is_ident = ident;
+
 		if ((ndx != 0) && (ndx == shdr->sh_link) &&
 		    (shdr->sh_flags & SHF_ORDERED))
-			return ((uintptr_t)place_section(ofl, isp, ident, 0));
+			return ((uintptr_t)ld_place_section(ofl, isp,
+			    ident, 0));
 	}
 
 	return (1);
@@ -248,7 +250,8 @@
 	 * capabilities, ignore any new input capabilities.
 	 */
 	if (ofl->ofl_flags1 & FLG_OF1_OVSFCAP) {
-		Dbg_cap_sec_entry(DBG_CAP_IGNORE, CA_SUNW_SF_1, val, M_MACH);
+		Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_IGNORE, CA_SUNW_SF_1,
+		    val, M_MACH);
 		return;
 	}
 
@@ -264,18 +267,20 @@
 	 * an F1_SUNW_FPUSED by itself is viewed as bad practice.
 	 */
 	if ((badval = (val & ~SF1_SUNW_MASK)) != 0) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1),
 		    ifl->ifl_name, name, EC_XWORD(badval));
 		val &= SF1_SUNW_MASK;
 	}
 	if (val == SF1_SUNW_FPUSED) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1),
 		    ifl->ifl_name, name, EC_XWORD(val));
 		return;
 	}
 
-	Dbg_cap_sec_entry(DBG_CAP_OLD, CA_SUNW_SF_1, ofl->ofl_sfcap_1, M_MACH);
-	Dbg_cap_sec_entry(DBG_CAP_NEW, CA_SUNW_SF_1, val, M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_OLD, CA_SUNW_SF_1,
+	    ofl->ofl_sfcap_1, M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_NEW, CA_SUNW_SF_1,
+	    val, M_MACH);
 
 	/*
 	 * Determine the resolution of the present frame pointer and the
@@ -299,8 +304,8 @@
 		ofl->ofl_sfcap_1 = val;
 	}
 
-	Dbg_cap_sec_entry(DBG_CAP_RESOLVED, CA_SUNW_SF_1, ofl->ofl_sfcap_1,
-	    M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_RESOLVED, CA_SUNW_SF_1,
+	    ofl->ofl_sfcap_1, M_MACH);
 }
 
 /*
@@ -317,7 +322,8 @@
 	 * capabilities, ignore any new input capabilities.
 	 */
 	if (ofl->ofl_flags1 & FLG_OF1_OVHWCAP) {
-		Dbg_cap_sec_entry(DBG_CAP_IGNORE, CA_SUNW_HW_1, val, M_MACH);
+		Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_IGNORE, CA_SUNW_HW_1,
+		    val, M_MACH);
 		return;
 	}
 
@@ -328,13 +334,14 @@
 	if (val == 0)
 		return;
 
-	Dbg_cap_sec_entry(DBG_CAP_OLD, CA_SUNW_HW_1, ofl->ofl_hwcap_1, M_MACH);
-	Dbg_cap_sec_entry(DBG_CAP_NEW, CA_SUNW_HW_1, val, M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_OLD, CA_SUNW_HW_1,
+	    ofl->ofl_hwcap_1, M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_NEW, CA_SUNW_HW_1, val, M_MACH);
 
 	ofl->ofl_hwcap_1 |= val;
 
-	Dbg_cap_sec_entry(DBG_CAP_RESOLVED, CA_SUNW_HW_1, ofl->ofl_hwcap_1,
-	    M_MACH);
+	Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_RESOLVED, CA_SUNW_HW_1,
+	    ofl->ofl_hwcap_1, M_MACH);
 }
 
 /*
@@ -344,9 +351,9 @@
 static void
 process_cap(const char *name, Ifl_desc *ifl, Is_desc *cisp, Ofl_desc *ofl)
 {
-	Cap *	cdata;
+	Cap	*cdata;
 
-	Dbg_cap_sec_title(ofl->ofl_name);
+	Dbg_cap_sec_title(ofl);
 
 	for (cdata = (Cap *)cisp->is_indata->d_buf;
 	    cdata->c_tag != CA_SUNW_NULL; cdata++) {
@@ -358,7 +365,8 @@
 				sf1_cap(ofl, cdata->c_un.c_val, ifl, name);
 				break;
 			default:
-				eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_UNKCAP),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_FIL_UNKCAP),
 				    ifl->ifl_name, name, cdata->c_tag);
 		}
 	}
@@ -370,7 +378,7 @@
  * list as we will be creating our own replacement sections later (ie.
  * symtab and relocation).
  */
-uintptr_t
+static uintptr_t
 /* ARGSUSED5 */
 process_input(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
 	Word ndx, int ident, Ofl_desc *ofl)
@@ -384,7 +392,7 @@
  * relocations from shared objects to determine if any copy relocation symbol
  * has a displacement relocation against it.
  */
-uintptr_t
+static uintptr_t
 /* ARGSUSED5 */
 process_reloc(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
 	Word ndx, int ident, Ofl_desc *ofl)
@@ -410,7 +418,7 @@
  * Process a string table section.  A valid section contains an initial and
  * final null byte.
  */
-uintptr_t
+static uintptr_t
 process_strtab(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
 	Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -451,8 +459,8 @@
 	if (size) {
 		data = isp->is_indata->d_buf;
 		if (data[0] != '\0' || data[size - 1] != '\0')
-			eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_MALSTR),
-			    ifl->ifl_name, name);
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_FIL_MALSTR), ifl->ifl_name, name);
 	} else
 		isp->is_indata->d_buf = (void *)MSG_ORIG(MSG_STR_EMPTY);
 
@@ -463,20 +471,21 @@
 /*
  * Invalid sections produce a warning and are skipped.
  */
-uintptr_t
+static uintptr_t
 /* ARGSUSED3 */
 invalid_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
-	eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name, name,
-		conv_sectyp_str(ofl->ofl_e_machine, (unsigned)shdr->sh_type));
+	eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC),
+	    ifl->ifl_name, name, conv_sec_type(ifl->ifl_ehdr->e_machine,
+	    shdr->sh_type));
 	return (1);
 }
 
 /*
  * Process a progbits section.
  */
-uintptr_t
+static uintptr_t
 process_progbits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -548,7 +557,7 @@
 /*
  * Handles the SHT_SUNW_{DEBUG,DEBUGSTR) sections.
  */
-uintptr_t
+static uintptr_t
 process_debug(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -561,11 +570,10 @@
 	return (process_progbits(name, ifl, shdr, scn, ndx, ident, ofl));
 }
 
-
 /*
  * Process a nobits section.
  */
-uintptr_t
+static uintptr_t
 process_nobits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -585,7 +593,7 @@
 /*
  * Process a SHT_*_ARRAY section.
  */
-uintptr_t
+static uintptr_t
 process_array(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -618,7 +626,7 @@
 /*
  * Process a SHT_SYMTAB_SHNDX section.
  */
-uintptr_t
+static uintptr_t
 process_sym_shndx(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -633,8 +641,9 @@
 
 		if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
 		    (isp->is_shdr->sh_type != SHT_DYNSYM))) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK),
-				ifl->ifl_name, name, EC_XWORD(shdr->sh_link));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_INVSHLINK), ifl->ifl_name, name,
+			    EC_XWORD(shdr->sh_link));
 			return (S_ERROR);
 		}
 		isp->is_symshndx = ifl->ifl_isdesc[ndx];
@@ -645,7 +654,7 @@
 /*
  * Final processing for SHT_SYMTAB_SHNDX section.
  */
-uintptr_t
+static uintptr_t
 /* ARGSUSED2 */
 sym_shndx_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
 {
@@ -654,9 +663,9 @@
 
 		if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
 		    (isp->is_shdr->sh_type != SHT_DYNSYM))) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK),
-				isc->is_file->ifl_name, isc->is_name,
-				EC_XWORD(isc->is_shdr->sh_link));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_INVSHLINK), isc->is_file->ifl_name,
+			    isc->is_name, EC_XWORD(isc->is_shdr->sh_link));
 			return (S_ERROR);
 		}
 		isp->is_symshndx = isc;
@@ -672,7 +681,7 @@
  *	 set when libld is called from ld.so.1).
  */
 /*ARGSUSED*/
-uintptr_t
+static uintptr_t
 process_rel_dynamic(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
     Word ndx, int ident, Ofl_desc *ofl)
 {
@@ -691,7 +700,8 @@
 	 * Find the string section associated with the .dynamic section.
 	 */
 	if ((strscn = elf_getscn(ifl->ifl_elf, shdr->sh_link)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSCN),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
@@ -975,7 +985,7 @@
  * recorded on the `ofl_soneed' list and will be analyzed after all explicit
  * file processing has been completed (refer finish_libs()).
  */
-uintptr_t
+static uintptr_t
 process_dynamic(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	Dyn		*data, *dyn;
@@ -1120,9 +1130,9 @@
 				else
 					hint = MSG_ORIG(MSG_STR_EMPTY);
 
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REC_OBJCNFLT),
-				    sifl->ifl_name, ifl->ifl_name,
-				    sifl->ifl_soname, hint);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REC_OBJCNFLT), sifl->ifl_name,
+				    ifl->ifl_name, sifl->ifl_soname, hint);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				return (0);
 			}
@@ -1135,8 +1145,9 @@
 		 */
 		if (ofl->ofl_soname &&
 		    (strcmp(ofl->ofl_soname, ifl->ifl_soname) == 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REC_OPTCNFLT),
-			    ifl->ifl_name, ifl->ifl_soname);
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REC_OPTCNFLT), ifl->ifl_name,
+			    ifl->ifl_soname);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
@@ -1144,13 +1155,12 @@
 	return (1);
 }
 
-
 /*
  * Process a relocation entry. At this point all input sections from this
  * input file have been assigned an input section descriptor which is saved
  * in the `ifl_isdesc' array.
  */
-uintptr_t
+static uintptr_t
 rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	Word 	rndx;
@@ -1162,9 +1172,9 @@
 	 * Make sure this is a valid relocation we can handle.
 	 */
 	if (shdr->sh_type != M_REL_SHT_TYPE) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name,
-		    isc->is_name, conv_sectyp_str(ofl->ofl_e_machine,
-		    (unsigned)shdr->sh_type));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVALSEC),
+		    ifl->ifl_name, isc->is_name,
+		    conv_sec_type(ifl->ifl_ehdr->e_machine, shdr->sh_type));
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
@@ -1181,7 +1191,7 @@
 		/*
 		 * Broken input file.
 		 */
-		eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO),
 			ifl->ifl_name, isc->is_name, EC_XWORD(rndx));
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
@@ -1208,8 +1218,9 @@
 					return (S_ERROR);
 				return (1);
 			}
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVRELOC1),
-				ifl->ifl_name, isc->is_name, risc->is_name);
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_INVRELOC1), ifl->ifl_name,
+			    isc->is_name, risc->is_name);
 			return (0);
 		}
 		if (list_appendc(&osp->os_relisdescs, isc) == 0)
@@ -1241,7 +1252,7 @@
 		/*
 		 * A conflict, issue an warning message, and ignore the section.
 		 */
-		eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_EXCLUDE),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_EXCLUDE),
 		    ifl->ifl_name, name);
 		return (0);
 	}
@@ -1252,6 +1263,53 @@
 	return (process_section(name, ifl, shdr, scn, ndx, 0, ofl));
 }
 
+#if	(defined(__i386) || defined(__amd64)) && defined(_ELF64)
+
+static uintptr_t
+process_amd64_unwind(const char *name, Ifl_desc *ifl, Shdr *shdr,
+    Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl)
+{
+	Os_desc		*osp, *eosp;
+	Is_desc		*isp;
+	Listnode	*lnp;
+
+	if (process_section(name, ifl, shdr, scn, ndx, ident, ofl) == S_ERROR)
+		return (S_ERROR);
+
+	/*
+	 * When producing a relocatable object - just collect the sections.
+	 */
+	if (ofl->ofl_flags & FLG_OF_RELOBJ)
+		return (1);
+
+	/*
+	 * If producing a executable or shared library, keep track of all the
+	 * output UNWIND sections to allow the creation of the appropriate
+	 * frame_hdr information.
+	 *
+	 * If the section hasn't been placed in the output file, then there's
+	 * nothing for us to do.
+	 */
+	if (((isp = ifl->ifl_isdesc[ndx]) == 0) ||
+	    ((osp = isp->is_osdesc) == 0))
+		return (1);
+
+	/*
+	 * Check to see if this output section is already on the list, and if
+	 * not, add it.
+	 */
+	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, eosp))
+		if (osp == eosp)
+		    return (1);
+
+	if (list_appendc(&ofl->ofl_unwind, osp) == 0)
+		return (S_ERROR);
+
+	return (1);
+}
+
+#endif
+
 /*
  * Section processing state table.  `Initial' describes the required initial
  * procedure to be called (if any), `Final' describes the final processing
@@ -1287,7 +1345,7 @@
 
 /* SHT_NULL	*/	NULL,			NULL,
 /* SHT_PROGBITS	*/	NULL,			NULL,
-/* SHT_SYMTAB	*/	sym_process,		sym_process,
+/* SHT_SYMTAB	*/	ld_sym_process,		ld_sym_process,
 /* SHT_STRTAB	*/	NULL,			NULL,
 /* SHT_RELA	*/	rel_process,		NULL,
 /* SHT_HASH	*/	NULL,			NULL,
@@ -1296,7 +1354,7 @@
 /* SHT_NOBITS	*/	NULL,			NULL,
 /* SHT_REL	*/	rel_process,		NULL,
 /* SHT_SHLIB	*/	NULL,			NULL,
-/* SHT_DYNSYM	*/	NULL,			sym_process,
+/* SHT_DYNSYM	*/	NULL,			ld_sym_process,
 /* SHT_UNKNOWN12 */	NULL,			NULL,
 /* SHT_UNKNOWN13 */	NULL,			NULL,
 /* SHT_INIT_ARRAY */	NULL,			NULL,
@@ -1313,7 +1371,7 @@
  * table to determine whether it should be processed (saved), ignored, or
  * is invalid for the type of input file being processed.
  */
-uintptr_t
+static uintptr_t
 process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl)
 {
 	Elf_Scn		*scn;
@@ -1332,33 +1390,36 @@
 	 * First process the .shstrtab section so that later sections can
 	 * reference their name.
 	 */
-	lds_file(ifl->ifl_name, elf_kind(elf), ifl->ifl_flags, elf);
+	ld_sup_file(ofl, ifl->ifl_name, elf_kind(elf), ifl->ifl_flags, elf);
 
 	sndx = ifl->ifl_shstrndx;
 	if ((scn = elf_getscn(elf, (size_t)sndx)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSCN),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
 	if ((shdr = elf_getshdr(scn)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
 	if ((name = elf_strptr(elf, (size_t)sndx, (size_t)shdr->sh_name)) ==
 	    NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_STRPTR),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
 
-	if (lds_input_section(name, &shdr, sndx, ifl->ifl_name,
-	    scn, elf, ofl) == S_ERROR)
+	if (ld_sup_input_section(ofl, name, &shdr, sndx, ifl->ifl_name,
+	    scn, elf) == S_ERROR)
 		return (S_ERROR);
 
 	/*
 	 * Reset the name since the shdr->sh_name could have been changed as
-	 * part of lds_input_section().  If there is no name, fabricate one
+	 * part of ld_sup_input_section().  If there is no name, fabricate one
 	 * using the section index.
 	 */
 	if (shdr->sh_name == 0) {
@@ -1370,7 +1431,8 @@
 
 	} else if ((name = elf_strptr(elf, (size_t)sndx,
 	    (size_t)shdr->sh_name)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), ifl->ifl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_STRPTR),
+		    ifl->ifl_name);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
@@ -1394,7 +1456,7 @@
 		ident = M_ID_UNKNOWN;
 	}
 
-	DBG_CALL(Dbg_file_generic(ifl));
+	DBG_CALL(Dbg_file_generic(ofl->ofl_lml, ifl));
 	ndx = 0;
 	vdfisp = vndisp = vsyisp = sifisp = capisp = 0;
 	scn = NULL;
@@ -1407,21 +1469,21 @@
 			continue;
 
 		if ((shdr = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
-			    ifl->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSHDR), ifl->ifl_name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
 		name = str + (size_t)(shdr->sh_name);
 
-		if (lds_input_section(name, &shdr, ndx, ifl->ifl_name, scn,
-		    elf, ofl) == S_ERROR)
+		if (ld_sup_input_section(ofl, name, &shdr, ndx, ifl->ifl_name,
+		    scn, elf) == S_ERROR)
 			return (S_ERROR);
 
 		/*
 		 * Reset the name since the shdr->sh_name could have been
-		 * changed as part of lds_input_section().  If there is no name,
-		 * fabricate one using the section index.
+		 * changed as part of ld_sup_input_section().  If there is no
+		 * name, fabricate one using the section index.
 		 */
 		if (shdr->sh_name == 0) {
 			(void) snprintf(_name, MAXNDXSIZE,
@@ -1464,10 +1526,11 @@
 			 * message but do the basic section processing anyway.
 			 */
 			if (row < (Word)SHT_LOSUNW)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC),
-				    ifl->ifl_name, name,
-				    conv_sectyp_str(ofl->ofl_e_machine,
-				    (unsigned)shdr->sh_type));
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name,
+				    name,
+				    conv_sec_type(ifl->ifl_ehdr->e_machine,
+				    shdr->sh_type));
 
 			/*
 			 * Handle sections greater than SHT_LOSUNW.
@@ -1539,7 +1602,7 @@
 					 * column == ET_REL
 					 */
 					if (process_amd64_unwind(name, ifl,
-					    shdr, scn, ndx, M_ID_NULL,
+					    shdr, scn, ndx, M_ID_UNWIND,
 					    ofl) == S_ERROR)
 						return (S_ERROR);
 				}
@@ -1590,7 +1653,7 @@
 			 * If this is an ordered section, process it.
 			 */
 			cnt++;
-			if ((osp = (Os_desc *)process_ordered(ifl, ofl, ndx,
+			if ((osp = (Os_desc *)ld_process_ordered(ifl, ofl, ndx,
 			    ifl->ifl_shnum)) == (Os_desc *)S_ERROR)
 				return (S_ERROR);
 
@@ -1650,7 +1713,7 @@
 	 * .dynamic's NEEDED entries.
 	 */
 	if (vndisp && (ofl->ofl_flags & (FLG_OF_NOUNDEF | FLG_OF_SYMBOLIC)))
-		if (vers_need_process(vndisp, ifl, ofl) == S_ERROR)
+		if (ld_vers_need_process(vndisp, ifl, ofl) == S_ERROR)
 			return (S_ERROR);
 
 	/*
@@ -1658,11 +1721,11 @@
 	 * version sections.
 	 */
 	if (vsyisp)
-		(void) vers_sym_process(vsyisp, ifl);
+		(void) ld_vers_sym_process(ofl->ofl_lml, vsyisp, ifl);
 
 	if (ifl->ifl_versym &&
 	    (vdfisp || (sdf && (sdf->sdf_flags & FLG_SDF_SELECT))))
-		if (vers_def_process(vdfisp, ifl, ofl) == S_ERROR)
+		if (ld_vers_def_process(vdfisp, ifl, ofl) == S_ERROR)
 			return (S_ERROR);
 
 	/*
@@ -1677,8 +1740,8 @@
 		row = isp->is_shdr->sh_type;
 
 		if ((isp->is_flags & FLG_IS_DISCARD) == 0)
-			lds_section(isp->is_name, isp->is_shdr, ndx,
-				isp->is_indata, elf);
+			ld_sup_section(ofl, isp->is_name, isp->is_shdr, ndx,
+			    isp->is_indata, elf);
 
 		/*
 		 * If this is a ST_SUNW_move section from a
@@ -1708,7 +1771,7 @@
 	 */
 	if (sifisp && ((ifl->ifl_flags & (FLG_IF_NEEDED | FLG_IF_NODIRECT)) ==
 	    (FLG_IF_NEEDED | FLG_IF_NODIRECT)))
-		(void) sym_nodirect(sifisp, ifl, ofl);
+		(void) ld_sym_nodirect(sifisp, ifl, ofl);
 
 	return (1);
 }
@@ -1735,7 +1798,7 @@
  *	recorded as dependencies of the output file being generated.
  */
 Ifl_desc *
-process_ifl(const char *name, const char *soname, int fd, Elf *elf,
+ld_process_ifl(const char *name, const char *soname, int fd, Elf *elf,
     Half flags, Ofl_desc * ofl, Rej_desc * rej)
 {
 	Ifl_desc	*ifl;
@@ -1775,9 +1838,10 @@
 				 * original archive descriptor and discard the
 				 * new elf descriptor.
 				 */
-				DBG_CALL(Dbg_file_reuse(name, adp->ad_name));
+				DBG_CALL(Dbg_file_reuse(ofl->ofl_lml, name,
+				    adp->ad_name));
 				(void) elf_end(elf);
-				return ((Ifl_desc *)process_archive(name, fd,
+				return ((Ifl_desc *)ld_process_archive(name, fd,
 				    adp, ofl));
 			}
 		}
@@ -1786,15 +1850,15 @@
 		 * As we haven't processed this file before establish a new
 		 * archive descriptor.
 		 */
-		adp = ar_setup(name, elf, ofl);
+		adp = ld_ar_setup(name, elf, ofl);
 		if ((adp == 0) || (adp == (Ar_desc *)S_ERROR))
 			return ((Ifl_desc *)adp);
 		adp->ad_stdev = status.st_dev;
 		adp->ad_stino = status.st_ino;
 
-		lds_file(name, ELF_K_AR, flags, elf);
+		ld_sup_file(ofl, name, ELF_K_AR, flags, elf);
 
-		return ((Ifl_desc *)process_archive(name, fd, adp, ofl));
+		return ((Ifl_desc *)ld_process_archive(name, fd, adp, ofl));
 
 	case ELF_K_ELF:
 		/*
@@ -1820,7 +1884,7 @@
 				_rej.rej_str = elf_errmsg(-1);
 			}
 			_rej.rej_name = name;
-			DBG_CALL(Dbg_file_rejected(&_rej));
+			DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej));
 			if (rej->rej_type == 0) {
 				*rej = _rej;
 				rej->rej_name = strdup(_rej.rej_name);
@@ -1858,7 +1922,8 @@
 				/*
 				 * Disregard (skip) this image.
 				 */
-				DBG_CALL(Dbg_file_skip(name, ifl->ifl_name));
+				DBG_CALL(Dbg_file_skip(ofl->ofl_lml,
+				    ifl->ifl_name, name));
 				(void) elf_end(elf);
 
 				/*
@@ -1884,8 +1949,8 @@
 					else
 					    errmsg = MSG_INTL(MSG_FIL_MULINC_2);
 
-					eprintf(ERR_WARNING, errmsg, name,
-					    ifl->ifl_name);
+					eprintf(ofl->ofl_lml, ERR_WARNING,
+					    errmsg, name, ifl->ifl_name);
 				}
 				return (ifl);
 			}
@@ -1911,14 +1976,14 @@
 
 		switch (ehdr->e_type) {
 		case ET_REL:
-			mach_eflags(ehdr, ofl);
+			ld_mach_eflags(ehdr, ofl);
 			error = process_elf(ifl, elf, ofl);
 			break;
 		case ET_DYN:
 			if ((ofl->ofl_flags & FLG_OF_STATIC) ||
 			    !(ofl->ofl_flags & FLG_OF_DYNLIBS)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_SOINSTAT),
-				    name);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_FIL_SOINSTAT), name);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				return (0);
 			}
@@ -1961,7 +2026,7 @@
 			(void) elf_errno();
 			_rej.rej_type = SGS_REJ_UNKFILE;
 			_rej.rej_name = name;
-			DBG_CALL(Dbg_file_rejected(&_rej));
+			DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej));
 			if (rej->rej_type == 0) {
 				*rej = _rej;
 				rej->rej_name = strdup(_rej.rej_name);
@@ -1973,7 +2038,7 @@
 		(void) elf_errno();
 		_rej.rej_type = SGS_REJ_UNKFILE;
 		_rej.rej_name = name;
-		DBG_CALL(Dbg_file_rejected(&_rej));
+		DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej));
 		if (rej->rej_type == 0) {
 			*rej = _rej;
 			rej->rej_name = strdup(_rej.rej_name);
@@ -1993,18 +2058,19 @@
  * archive (see libs.c: process_archive()).
  */
 Ifl_desc *
-process_open(const char *path, size_t dlen, int fd, Ofl_desc *ofl, Half flags,
-    Rej_desc * rej)
+ld_process_open(const char *path, size_t dlen, int fd, Ofl_desc *ofl,
+    Half flags, Rej_desc * rej)
 {
 	Elf *	elf;
 
 	if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), path);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), path);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
 
-	return (process_ifl(&path[0], &path[dlen], fd, elf, flags, ofl, rej));
+	return (ld_process_ifl(&path[0], &path[dlen], fd, elf, flags,
+	    ofl, rej));
 }
 
 /*
@@ -2012,7 +2078,7 @@
  * Combine the directory and filename, check the resultant path size, and try
  * opening the pathname.
  */
-Ifl_desc *
+static Ifl_desc *
 process_req_lib(Sdf_desc *sdf, const char *dir, const char *file,
     Ofl_desc * ofl, Rej_desc * rej)
 {
@@ -2032,7 +2098,8 @@
 	dlen++;
 	plen = dlen + strlen(file) + 1;
 	if (plen > PATH_MAX) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_PTHTOLONG), _dir, file);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_PTHTOLONG),
+		    _dir, file);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return (0);
 	}
@@ -2043,7 +2110,8 @@
 	(void) strcpy(path, _dir);
 	(void) strcat(path, MSG_ORIG(MSG_STR_SLASH));
 	(void) strcat(path, file);
-	DBG_CALL(Dbg_libs_req(sdf->sdf_name, sdf->sdf_rfile, path));
+	DBG_CALL(Dbg_libs_req(ofl->ofl_lml, sdf->sdf_name,
+	    sdf->sdf_rfile, path));
 
 	if ((fd = open(path, O_RDONLY)) == -1)
 		return (0);
@@ -2054,7 +2122,7 @@
 		if ((_path = libld_malloc(strlen(path) + 1)) == 0)
 			return ((Ifl_desc *)S_ERROR);
 		(void) strcpy(_path, path);
-		ifl = process_open(_path, dlen, fd, ofl, NULL, rej);
+		ifl = ld_process_open(_path, dlen, fd, ofl, NULL, rej);
 		(void) close(fd);
 		return (ifl);
 	}
@@ -2073,7 +2141,7 @@
  *  o	use the default directories, i.e. LIBPATH or -YP.
  */
 uintptr_t
-finish_libs(Ofl_desc *ofl)
+ld_finish_libs(Ofl_desc *ofl)
 {
 	Listnode	*lnp1;
 	Sdf_desc	*sdf;
@@ -2119,15 +2187,16 @@
 			if (*path == '/')
 				break;
 		if (*path) {
-			DBG_CALL(Dbg_libs_req(sdf->sdf_name, sdf->sdf_rfile,
-			    file));
+			DBG_CALL(Dbg_libs_req(ofl->ofl_lml, sdf->sdf_name,
+			    sdf->sdf_rfile, file));
 			if ((fd = open(file, O_RDONLY)) == -1) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NOTFOUND),
-				    file, sdf->sdf_rfile);
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_FIL_NOTFOUND), file,
+				    sdf->sdf_rfile);
 			} else {
 				Rej_desc	_rej = { 0 };
 
-				ifl = process_open(file, sizeof (file) + 1,
+				ifl = ld_process_open(file, sizeof (file) + 1,
 				    fd, ofl, NULL, &_rej);
 				(void) close(fd);
 
@@ -2135,11 +2204,11 @@
 					return (S_ERROR);
 				}
 				if (_rej.rej_type) {
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(reject[_rej.rej_type]),
 					    _rej.rej_name ? rej.rej_name :
 					    MSG_INTL(MSG_STR_UNKNOWN),
-					    conv_reject_str(&_rej));
+					    conv_reject_desc(&_rej));
 				} else
 					sdf->sdf_file = ifl;
 			}
@@ -2181,8 +2250,8 @@
 			if (rpath == 0)
 				return (S_ERROR);
 			(void) strcpy(rpath, sdf->sdf_rpath);
-			DBG_CALL(Dbg_libs_path(rpath, LA_SER_RUNPATH,
-			    sdf->sdf_rfile));
+			DBG_CALL(Dbg_libs_path(ofl->ofl_lml, rpath,
+			    LA_SER_RUNPATH, sdf->sdf_rfile));
 			if ((path = strtok_r(rpath,
 			    MSG_ORIG(MSG_STR_COLON), &next)) != NULL) {
 				do {
@@ -2245,12 +2314,13 @@
 		 * generic "not found" diagnostic.
 		 */
 		if (rej.rej_type) {
-			eprintf(ERR_WARNING, MSG_INTL(reject[rej.rej_type]),
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(reject[rej.rej_type]),
 			    rej.rej_name ? rej.rej_name :
-			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej));
+			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej));
 		} else {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NOTFOUND), file,
-			    sdf->sdf_rfile);
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_FIL_NOTFOUND), file, sdf->sdf_rfile);
 		}
 	}
 
@@ -2258,5 +2328,5 @@
 	 * Finally, now that all objects have been input, make sure any version
 	 * requirements have been met.
 	 */
-	return (vers_verify(ofl));
+	return (ld_vers_verify(ofl));
 }
--- a/usr/src/cmd/sgs/libld/common/globals.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/globals.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -36,13 +35,11 @@
 #include	"msg.h"
 #include	"_libld.h"
 
-Ofl_desc	Ofl;		/* provided for signal handler */
-Ld_heap *	ld_heap;	/* list of allocated blocks for */
+Ld_heap		*ld_heap;	/* list of allocated blocks for */
 				/* 	link-edit dynamic allocations */
-List		lib_support;	/* List of support libraries specified */
+List		lib_support;	/* list of support libraries specified */
 				/*	(-S option) */
-
-uint_t		dbg_mask = 0;	/* liblddbg enabled */
+int		demangle_flag;	/* symbol demangling required */
 
 /*
  * Paths and directories for library searches.  These are used to set up
@@ -54,12 +51,12 @@
 Listnode	*insert_lib;	/* insertion point for -L libraries */
 
 /*
- * liblddbg sometimes takes an ehdr in order to figure out the elf class or
- * machine type.  Symbols that are added by ld, such as _etext, don't have a
- * corresponding ehdr, so we pass this instead.
+ * A default library search path is used if one was not supplied on the command
+ * line.  Note: these strings can not use MSG_ORIG() since they are modified as
+ * part of the path processing.
  */
-Ehdr		def_ehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3,
-			M_CLASS, M_DATA }, 0, M_MACH };
+char		def64_Plibpath[] = "/lib/64:/usr/lib/64";
+char		def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
 
 /*
  * For backward compatibility provide a /dev/zero file descriptor.
--- a/usr/src/cmd/sgs/libld/common/groups.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/groups.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -29,7 +29,7 @@
 #include	<stdio.h>
 #include	<string.h>
 #include	<link.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -73,7 +73,7 @@
  * Determine whether a (COMDAT) group has already been encountered.  If so,
  * tag the new group having the same name as discardable.
  */
-uintptr_t
+static uintptr_t
 gpavl_loaded(Ofl_desc *ofl, Group_desc * gdp)
 {
 	Grp_node	gpn, *gpnp;
@@ -113,7 +113,7 @@
 }
 
 Group_desc *
-get_group(Ofl_desc *ofl, Is_desc *isp)
+ld_get_group(Ofl_desc *ofl, Is_desc *isp)
 {
 	Ifl_desc	*ifl = isp->is_file;
 	Elf		*elf = ifl->ifl_elf;
@@ -144,7 +144,8 @@
 			 */
 			if ((shdr->sh_link == SHN_UNDEF) ||
 			    (shdr->sh_link >= ifl->ifl_shnum)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_FIL_INVSHLINK),
 				    ifl->ifl_name, elf_strptr(elf,
 				    ifl->ifl_shstrndx, shdr->sh_name),
 				    EC_XWORD(shdr->sh_link));
@@ -153,7 +154,7 @@
 			}
 
 			if (shdr->sh_entsize == 0) {
-				eprintf(ERR_FATAL,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
 				    MSG_INTL(MSG_FIL_INVSHENTSIZE),
 				    ifl->ifl_name, elf_strptr(elf,
 				    ifl->ifl_shstrndx, shdr->sh_name),
@@ -176,7 +177,8 @@
 			if ((shdr->sh_info == SHN_UNDEF) ||
 			    (shdr->sh_info >= (Word)(_shdr->sh_size /
 			    _shdr->sh_entsize))) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_FIL_INVSHINFO),
 				    ifl->ifl_name, elf_strptr(elf,
 				    ifl->ifl_shstrndx, shdr->sh_name),
 				    EC_XWORD(shdr->sh_info));
@@ -235,8 +237,8 @@
 		}
 	}
 
-	eprintf(ERR_FATAL, MSG_INTL(MSG_ELF_NOGROUPSECT), ifl->ifl_name,
-	    isp->is_name);
+	eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ELF_NOGROUPSECT),
+	    ifl->ifl_name, isp->is_name);
 	ofl->ofl_flags |= FLG_OF_FATAL;
 	return (0);
 }
--- a/usr/src/cmd/sgs/libld/common/ldentry.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/ldentry.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -54,7 +53,7 @@
 }
 
 void
-ldmap_out(Ofl_desc * ofl)
+ld_map_out(Ofl_desc * ofl)
 {
 	Listnode *	lnp1, * lnp2, * lnp3;
 	Os_desc *	osp;
@@ -168,8 +167,8 @@
 			sym_muldef_title();
 
 		ducp = sdp->sd_file->ifl_name;
-		(void) printf(MSG_INTL(MSG_ENT_MUL_ENTRY_1),
-		    demangle(name), ducp);
+		(void) printf(MSG_INTL(MSG_ENT_MUL_ENTRY_1), demangle(name),
+		    ducp);
 		for (LIST_TRAVERSE(dfiles, lnp2, adcp)) {
 			/*
 			 * Ignore the referenced symbol.
@@ -185,7 +184,7 @@
  * been met and print error message.  (only in the case of reordering)
  */
 void
-ent_check(Ofl_desc * ofl)
+ld_ent_check(Ofl_desc * ofl)
 {
 	Listnode *	lnp;
 	Ent_desc *	enp;
@@ -204,11 +203,13 @@
 
 			if ((_lnp != NULL) && (_lnp->data != NULL) &&
 			    (char *)(_lnp->data) != NULL) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ENT_NOSEC_1),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ENT_NOSEC_1),
 				    enp->ec_segment->sg_name, enp->ec_name,
 				    (const char *)(_lnp->data));
 			} else {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_ENT_NOSEC_2),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ENT_NOSEC_2),
 				    enp->ec_segment->sg_name, enp->ec_name);
 			}
 		}
--- a/usr/src/cmd/sgs/libld/common/ldlibs.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/ldlibs.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -39,7 +38,7 @@
 #include	<string.h>
 #include	<limits.h>
 #include	<errno.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -56,7 +55,7 @@
  * documented anymore makes it even more unlikely this processing will occur.
  */
 static char *
-compat_YL_YU(char *path, int index)
+compat_YL_YU(Ofl_desc *ofl, char *path, int index)
 {
 	if (index == YLDIR) {
 		if (Llibdir) {
@@ -65,7 +64,8 @@
 			 * corresponds for compatibility to -YL (as defined in
 			 * sgs/include/paths.h)
 			 */
-			DBG_CALL(Dbg_libs_ylu(Llibdir, path, index));
+			DBG_CALL(Dbg_libs_ylu(ofl->ofl_lml, Llibdir,
+			    path, index));
 			return (Llibdir);
 		}
 	} else if (index == YUDIR) {
@@ -75,7 +75,8 @@
 			 * corresponds for compatibility to -YU (as defined in
 			 * sgs/include/paths.h)
 			 */
-			DBG_CALL(Dbg_libs_ylu(Ulibdir, path, index));
+			DBG_CALL(Dbg_libs_ylu(ofl->ofl_lml, Ulibdir,
+			    path, index));
 			return (Ulibdir);
 		}
 	}
@@ -83,7 +84,7 @@
 }
 
 static char *
-process_lib_path(List *list, char *path, Boolean subsflag)
+process_lib_path(Ofl_desc *ofl, List *list, char *path, Boolean subsflag)
 {
 	int	i;
 	char	*cp;
@@ -95,12 +96,12 @@
 		if (cp == NULL) {
 			if (*path == '\0') {
 				if (seenflg)
-					if (list_appendc(list, subsflag ?
-					    compat_YL_YU(dot, i) : dot) == 0)
-						return ((char *)S_ERROR);
+				    if (list_appendc(list, subsflag ?
+					compat_YL_YU(ofl, dot, i) : dot) == 0)
+					    return ((char *)S_ERROR);
 			} else
 				if (list_appendc(list, subsflag ?
-				    compat_YL_YU(path, i) : path) == 0)
+				    compat_YL_YU(ofl, path, i) : path) == 0)
 					return ((char *)S_ERROR);
 			return (cp);
 		}
@@ -109,11 +110,11 @@
 			*cp = '\0';
 			if (cp == path) {
 				if (list_appendc(list, subsflag ?
-				    compat_YL_YU(dot, i) : dot) == 0)
+				    compat_YL_YU(ofl, dot, i) : dot) == 0)
 					return ((char *)S_ERROR);
 			} else {
 				if (list_appendc(list, subsflag ?
-				    compat_YL_YU(path, i) : path) == 0)
+				    compat_YL_YU(ofl, path, i) : path) == 0)
 					return ((char *)S_ERROR);
 			}
 			path = cp + 1;
@@ -125,12 +126,12 @@
 
 		if (cp != path) {
 			if (list_appendc(list, subsflag ?
-			    compat_YL_YU(path, i) : path) == 0)
+			    compat_YL_YU(ofl, path, i) : path) == 0)
 				return ((char *)S_ERROR);
 		} else {
 			if (seenflg)
 				if (list_appendc(list, subsflag ?
-				    compat_YL_YU(dot, i) : dot) == 0)
+				    compat_YL_YU(ofl, dot, i) : dot) == 0)
 					return ((char *)S_ERROR);
 		}
 		return (cp);
@@ -143,7 +144,7 @@
  * adds the indicated path to those to be searched for libraries.
  */
 uintptr_t
-add_libdir(Ofl_desc *ofl, const char *path)
+ld_add_libdir(Ofl_desc *ofl, const char *path)
 {
 	if (insert_lib == NULL) {
 		if (list_prependc(&ofl->ofl_ulibdirs, path) == 0)
@@ -158,7 +159,8 @@
 	 * As -l and -L options can be interspersed, print the library
 	 * search paths each time a new path is added.
 	 */
-	DBG_CALL(Dbg_libs_update(&ofl->ofl_ulibdirs, &ofl->ofl_dlibdirs));
+	DBG_CALL(Dbg_libs_update(ofl->ofl_lml, &ofl->ofl_ulibdirs,
+	    &ofl->ofl_dlibdirs));
 	return (1);
 }
 
@@ -194,14 +196,14 @@
 	if (ofl->ofl_flags & FLG_OF_DYNLIBS) {
 		(void) snprintf(path, (PATH_MAX + 2), MSG_ORIG(MSG_STR_LIB_SO),
 		    _dir, file);
-		DBG_CALL(Dbg_libs_l(file, path));
+		DBG_CALL(Dbg_libs_l(ofl->ofl_lml, file, path));
 		if ((fd = open(path, O_RDONLY)) != -1) {
 
 			if ((_path = libld_malloc(strlen(path) + 1)) == 0)
 				return ((Ifl_desc *)S_ERROR);
 			(void) strcpy(_path, path);
 
-			ifl = process_open(_path, dlen, fd, ofl,
+			ifl = ld_process_open(_path, dlen, fd, ofl,
 			    FLG_IF_NEEDED, rej);
 			(void) close(fd);
 			return (ifl);
@@ -223,14 +225,14 @@
 	 */
 	(void) snprintf(path, (PATH_MAX + 2), MSG_ORIG(MSG_STR_LIB_A),
 	    _dir, file);
-	DBG_CALL(Dbg_libs_l(file, path));
+	DBG_CALL(Dbg_libs_l(ofl->ofl_lml, file, path));
 	if ((fd = open(path, O_RDONLY)) != -1) {
 
 		if ((_path = libld_malloc(strlen(path) + 1)) == 0)
 			return ((Ifl_desc *)S_ERROR);
 		(void) strcpy(_path, path);
 
-		ifl = process_open(_path, dlen, fd, ofl, FLG_IF_NEEDED, rej);
+		ifl = ld_process_open(_path, dlen, fd, ofl, FLG_IF_NEEDED, rej);
 		(void) close(fd);
 		return (ifl);
 
@@ -261,7 +263,7 @@
  * otherwise process the file appropriately depending on its type.
  */
 uintptr_t
-find_library(const char *name, Ofl_desc *ofl)
+ld_find_library(const char *name, Ofl_desc *ofl)
 {
 	Listnode	*lnp;
 	char		*path;
@@ -303,11 +305,12 @@
 	 * diagnostic.
 	 */
 	if (rej.rej_type)
-		eprintf(ERR_FATAL, MSG_INTL(reject[rej.rej_type]),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(reject[rej.rej_type]),
 		    rej.rej_name ? rej.rej_name : MSG_INTL(MSG_STR_UNKNOWN),
-		    conv_reject_str(&rej));
+		    conv_reject_desc(&rej));
 	else
-		eprintf(ERR_FATAL, MSG_INTL(MSG_LIB_NOTFOUND), name);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_LIB_NOTFOUND),
+		    name);
 
 	ofl->ofl_flags |= FLG_OF_FATAL;
 	return (0);
@@ -330,7 +333,7 @@
  * all taken as dirlist2.
  */
 uintptr_t
-lib_setup(Ofl_desc * ofl)
+ld_lib_setup(Ofl_desc * ofl)
 {
 	char	*path, *cp = NULL;
 
@@ -350,13 +353,13 @@
 		if ((path = libld_malloc(strlen(cp) + 1)) == 0)
 			return (S_ERROR);
 		(void) strcpy(path, cp);
-		DBG_CALL(Dbg_libs_path(path, LA_SER_DEFAULT, 0));
+		DBG_CALL(Dbg_libs_path(ofl->ofl_lml, path, LA_SER_DEFAULT, 0));
 
 		/*
 		 * Process the first path string (anything up to a null or
 		 * a `;');
 		 */
-		path = process_lib_path(&ofl->ofl_ulibdirs, path, FALSE);
+		path = process_lib_path(ofl, &ofl->ofl_ulibdirs, path, FALSE);
 
 
 		/*
@@ -369,25 +372,28 @@
 			insert_lib = ofl->ofl_ulibdirs.tail;
 			*path = '\0';
 			++path;
-			cp = process_lib_path(&ofl->ofl_ulibdirs, path, FALSE);
+			cp = process_lib_path(ofl, &ofl->ofl_ulibdirs, path,
+			    FALSE);
 			if (cp == (char *)S_ERROR)
 				return (S_ERROR);
 			else if (cp)
-				eprintf(ERR_WARNING, MSG_INTL(MSG_LIB_MALFORM));
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_LIB_MALFORM));
 		}
 	}
 
 	/*
 	 * Add the default LIBPATH or any -YP supplied path.
 	 */
-	DBG_CALL(Dbg_libs_yp(Plibpath));
-	cp = process_lib_path(&ofl->ofl_dlibdirs, Plibpath, TRUE);
+	DBG_CALL(Dbg_libs_yp(ofl->ofl_lml, Plibpath));
+	cp = process_lib_path(ofl, &ofl->ofl_dlibdirs, Plibpath, TRUE);
 	if (cp == (char *)S_ERROR)
 		return (S_ERROR);
 	else if (cp) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_LIB_BADYP));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_LIB_BADYP));
 		return (S_ERROR);
 	}
-	DBG_CALL(Dbg_libs_init(&ofl->ofl_ulibdirs, &ofl->ofl_dlibdirs));
+	DBG_CALL(Dbg_libs_init(ofl->ofl_lml, &ofl->ofl_ulibdirs,
+	    &ofl->ofl_dlibdirs));
 	return (1);
 }
--- a/usr/src/cmd/sgs/libld/common/ldmain.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/ldmain.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,59 +18,68 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
  * ld -- link/editor main program
  */
+#include	<sys/types.h>
+#include	<sys/mman.h>
 #include	<string.h>
 #include	<stdio.h>
-#include	<unistd.h>
 #include	<locale.h>
 #include	<stdarg.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
 /*
- * default library search path used if one was not supplied
- * on the command line.  Note:   These strings can not
- * use MSG_ORIG() since they are modified as part of the
- * path processing.
+ * A default library search path is used if one was not supplied on the command
+ * line.  Note: these strings can not use MSG_ORIG() since they are modified as
+ * part of the path processing.
  */
-#ifdef _ELF64
+#if	defined(_ELF64)
 static char	def_Plibpath[] = "/lib/64:/usr/lib/64";
 #else
 static char	def_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
 #endif
 
 /*
+ * A default elf header provides for simplifying diagnostic processing.
+ */
+static Ehdr	def_ehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3,
+			    M_CLASS, M_DATA }, 0, M_MACH, EV_CURRENT };
+
+/*
  * The main program
  */
 int
-ld_main(int argc, char ** argv)
+ld_main(int argc, char **argv)
 {
 	char		*sgs_support;	/* SGS_SUPPORT environment string */
-	Ofl_desc	*ofl = &Ofl;	/* Output file descriptor */
 	Half		etype;
 	uint_t		stflags;
 	int		suplib = 0;
+	Ofl_desc	*ofl;
 
 	/*
-	 * Initialize signal handlers, and output file variables.
+	 * Initialize signal handlers, and output file variables.  Establish a
+	 * default output ELF header to satisfy diagnostic requirements.
 	 */
-	init();
-	ofl->ofl_libver = EV_CURRENT;
-	ofl->ofl_e_machine = M_MACH;
-	ofl->ofl_e_flags = 0;
+	if ((ofl = libld_calloc(1, sizeof (Ofl_desc))) == 0)
+		return (1);
+
+	ofl->ofl_dehdr = &def_ehdr;
+
+	ld_init(ofl);
 
 	/*
 	 * Build up linker version string
@@ -88,10 +96,10 @@
 	 * would have been completed and the entrance criteria and segment
 	 * descriptor lists will be complete.
 	 */
-	if (process_flags(ofl, argc, argv) == S_ERROR)
+	if (ld_process_flags(ofl, argc, argv) == S_ERROR)
 		return (1);
 	if (ofl->ofl_flags & FLG_OF_FATAL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FLAGS));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FLAGS));
 		return (1);
 	}
 
@@ -135,7 +143,8 @@
 		char		*lib;
 		char		*lasts;
 
-		DBG_CALL(Dbg_support_req(sgs_support, DBG_SUP_ENVIRON));
+		DBG_CALL(Dbg_support_req(ofl->ofl_lml, sgs_support,
+		    DBG_SUP_ENVIRON));
 		if ((lib = strtok_r(sgs_support, sep, &lasts)) != NULL) {
 			do {
 				if (strcmp(lib,
@@ -143,8 +152,8 @@
 					if (suplib++)
 						continue;
 				}
-				if (ld_support_loadso(lib) == S_ERROR)
-					return (ldexit());
+				if (ld_sup_loadso(ofl, lib) == S_ERROR)
+					return (ld_exit(ofl));
 
 			} while ((lib = strtok_r(NULL, sep, &lasts)) != NULL);
 		}
@@ -154,23 +163,25 @@
 		char		*lib;
 
 		for (LIST_TRAVERSE(&lib_support, lnp, lib)) {
-			DBG_CALL(Dbg_support_req(lib, DBG_SUP_CMDLINE));
-			if (ld_support_loadso(lib) == S_ERROR)
-				return (ldexit());
+			DBG_CALL(Dbg_support_req(ofl->ofl_lml, lib,
+			    DBG_SUP_CMDLINE));
+			if (ld_sup_loadso(ofl, lib) == S_ERROR)
+				return (ld_exit(ofl));
 		}
 	} else {
 		if (suplib == 0) {
-			DBG_CALL(Dbg_support_req(MSG_ORIG(MSG_FIL_LIBSTAB),
-			    DBG_SUP_DEFAULT));
-			if (ld_support_loadso(MSG_ORIG(MSG_FIL_LIBSTAB)) ==
+			DBG_CALL(Dbg_support_req(ofl->ofl_lml,
+			    MSG_ORIG(MSG_FIL_LIBSTAB), DBG_SUP_DEFAULT));
+			if (ld_sup_loadso(ofl, MSG_ORIG(MSG_FIL_LIBSTAB)) ==
 			    S_ERROR)
-				return (ldexit());
+				return (ld_exit(ofl));
 		}
 	}
 
-	DBG_CALL(Dbg_ent_print(ofl->ofl_e_machine, &ofl->ofl_ents,
-		(ofl->ofl_flags & FLG_OF_DYNAMIC)));
-	DBG_CALL(Dbg_seg_list(ofl->ofl_e_machine, &ofl->ofl_segs));
+	DBG_CALL(Dbg_ent_print(ofl->ofl_lml, ofl->ofl_dehdr->e_machine,
+	    &ofl->ofl_ents, (ofl->ofl_flags & FLG_OF_DYNAMIC)));
+	DBG_CALL(Dbg_seg_list(ofl->ofl_lml, ofl->ofl_dehdr->e_machine,
+	    &ofl->ofl_segs));
 
 	/*
 	 * The objscnt and soscnt variables were used to estimate the expected
@@ -183,8 +194,8 @@
 	/*
 	 * Determine whether we can create the file before going any further.
 	 */
-	if (open_outfile(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_open_outfile(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
 	/*
 	 * If the user didn't supply a library path supply a default.  And, if
@@ -207,8 +218,8 @@
 	/*
 	 * Argument pass two.  Input all libraries and objects.
 	 */
-	if (lib_setup(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_lib_setup(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
 	/*
 	 * Call ld_start() with the etype of our output file and the
@@ -221,27 +232,28 @@
 	else
 		etype = ET_EXEC;
 
-	lds_start(ofl->ofl_name, etype, argv[0]);
+	ld_sup_start(ofl, etype, argv[0]);
 
 	/*
 	 * Process all input files.
 	 */
-	if (process_files(ofl, argc, argv) == S_ERROR)
-		return (ldexit());
+	if (ld_process_files(ofl, argc, argv) == S_ERROR)
+		return (ld_exit(ofl));
 	if (ofl->ofl_flags & FLG_OF_FATAL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FILES), ofl->ofl_name);
-		return (ldexit());
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FILES),
+		    ofl->ofl_name);
+		return (ld_exit(ofl));
 	}
 
-	lds_input_done();
+	ld_sup_input_done(ofl);
 
 	/*
 	 * If there were any partially initialized symbol,
 	 * do preparation works.
 	 */
 	if (ofl->ofl_ismove.head != 0) {
-		if (sunwmove_preprocess(ofl) == S_ERROR)
-			return (ldexit());
+		if (ld_sunwmove_preprocess(ofl) == S_ERROR)
+			return (ld_exit(ofl));
 	}
 
 	/*
@@ -253,8 +265,8 @@
 	 * it does take a little longer for the user to be told of any undefined
 	 * symbol errors).
 	 */
-	if (reloc_init(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_reloc_init(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
 	/*
 	 * Now that all symbol processing is complete see if any undefined
@@ -264,23 +276,25 @@
 	 * condition is fatal.  If creating a shared object with the -Bsymbolic
 	 * flag set, this condition is simply a warning.
 	 */
-	if (sym_validate(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_sym_validate(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
 	if (ofl->ofl_flags1 & FLG_OF1_OVRFLW) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FILES), ofl->ofl_name);
-		return (ldexit());
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FILES),
+		    ofl->ofl_name);
+		return (ld_exit(ofl));
 	} else if (ofl->ofl_flags & FLG_OF_FATAL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SYM_FATAL), ofl->ofl_name);
-		return (ldexit());
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_SYM_FATAL),
+		    ofl->ofl_name);
+		return (ld_exit(ofl));
 	} else if (ofl->ofl_flags & FLG_OF_WARN)
-		eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_SYM_WARN));
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_SYM_WARN));
 
 	/*
 	 * Generate any necessary sections.
 	 */
-	if (make_sections(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_make_sections(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
 	/*
 	 * Now that all sections have been added to the output file, check to
@@ -288,34 +302,33 @@
 	 * if any ordering directives were not matched.
 	 * Also, if SHF_ORDERED sections exist, set up sort key values.
 	 */
-	sec_validate(ofl);
+	ld_sec_validate(ofl);
 
 	/*
 	 * Having collected all the input data create the initial output file
 	 * image, assign virtual addresses to the image, and generate a load
 	 * map if the user requested one.
 	 */
-	if (create_outfile(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_create_outfile(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
-	if (update_outfile(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_update_outfile(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 	if (ofl->ofl_flags & FLG_OF_GENMAP)
-		ldmap_out(ofl);
+		ld_map_out(ofl);
 
 	/*
 	 * Build relocation sections and perform any relocation updates.
 	 */
-	if (reloc_process(ofl) == S_ERROR)
-		return (ldexit());
+	if (ld_reloc_process(ofl) == S_ERROR)
+		return (ld_exit(ofl));
 
-
-#if defined(__x86) && defined(_ELF64)
+#if	defined(__x86) && defined(_ELF64)
 	/*
 	 * Fill in contents for Unwind Header
 	 */
 	if (populate_amd64_unwindhdr(ofl) == S_ERROR)
-		return (ldexit());
+		return (ld_exit(ofl));
 #endif
 	/*
 	 * Finally create the files elf checksum.
@@ -327,11 +340,12 @@
 	 * We're done, so make sure the updates are flushed to the output file.
 	 */
 	if ((ofl->ofl_size = elf_update(ofl->ofl_welf, ELF_C_WRITE)) == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name);
-		return (ldexit());
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE),
+		    ofl->ofl_name);
+		return (ld_exit(ofl));
 	}
 
-	lds_atexit(0);
+	ld_sup_atexit(ofl, 0);
 
 	DBG_CALL(Dbg_statistics_ld(ofl));
 
@@ -349,71 +363,65 @@
 	return (0);
 }
 
-/* VARARGS1 */
-void
-dbg_print(const char *format, ...)
+/*
+ * Cleanup an Ifl_desc.
+ */
+static void
+ifl_list_cleanup(List *ifl_list)
 {
-	static char	*prestr = 0;
-	va_list		args;
+	Listnode	*lnp;
+	Ifl_desc	*ifl;
 
-	if (dbg_mask & DBG_G_SNAME) {
-		/*
-		 * If the debugging options have requested each diagnostic line
-		 * be prepended by a name create a prefix string.
-		 */
-		if ((prestr == 0) && Ofl.ofl_name) {
-			const char	*name, *cls;
-			size_t		len;
+	for (LIST_TRAVERSE(ifl_list, lnp, ifl))
+		if (ifl->ifl_elf)
+			(void) elf_end(ifl->ifl_elf);
+	ifl_list->head = 0;
+	ifl_list->tail = 0;
+}
 
-			/*
-			 * Select the fullname or basename of the output file
-			 * being created.
-			 */
-			if (dbg_mask & DBG_G_FNAME)
-				name = Ofl.ofl_name;
-			else {
-				if ((name = strrchr(Ofl.ofl_name, '/')) == 0)
-					name = Ofl.ofl_name;
-				else
-					name++;
-			}
-			len = strlen(name) +
-			    strlen(MSG_INTL(MSG_DBG_NAME_FMT)) + 1;
+/*
+ * Cleanup all memory that has been dynamically allocated during libld
+ * processing and elf_end() all Elf descriptors that are still open.
+ */
+void
+ld_ofl_cleanup(Ofl_desc *ofl)
+{
+	Ld_heap		*chp, *php;
+	Ar_desc		*adp;
+	Listnode	*lnp;
+
+	ifl_list_cleanup(&ofl->ofl_objs);
+	ifl_list_cleanup(&ofl->ofl_sos);
 
-			/*
-			 * Add the output file class if required.
-			 */
-			if (dbg_mask & DBG_G_CLASS) {
-#if	defined(_ELF64)
-				len += MSG_DBG_CLS64_FMT_SIZE;
-				cls = MSG_ORIG(MSG_DBG_CLS64_FMT);
-#else
-				len += MSG_DBG_CLS32_FMT_SIZE;
-				cls = MSG_ORIG(MSG_DBG_CLS32_FMT);
-#endif
-			}
+	for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) {
+		Ar_aux		*aup;
+		Elf_Arsym	*arsym;
 
-			/*
-			 * Allocate a string to build the prefix.
-			 */
-			if ((prestr = libld_malloc(len)) == 0)
-				prestr = (char *)MSG_INTL(MSG_DBG_DFLT_FMT);
-			else {
-				(void) snprintf(prestr, len,
-				    MSG_INTL(MSG_DBG_NAME_FMT), name);
-				if (dbg_mask & DBG_G_CLASS)
-					(void) strcat(prestr, cls);
+		for (arsym = adp->ad_start, aup = adp->ad_aux;
+		    arsym->as_name; ++arsym, ++aup) {
+			if ((aup->au_mem) && (aup->au_mem != FLG_ARMEM_PROC)) {
+				(void) elf_end(aup->au_mem->am_elf);
+
+				/*
+				 * Null out all entries to this member so
+				 * that we don't attempt to elf_end() it again.
+				 */
+				ld_ar_member(adp, arsym, aup, 0);
 			}
 		}
-		if (prestr)
-			(void) fputs(prestr, stderr);
-		else
-			(void) fputs(MSG_INTL(MSG_DBG_AOUT_FMT), stderr);
-	} else
-		(void) fputs(MSG_INTL(MSG_DBG_DFLT_FMT), stderr);
+		(void) elf_end(adp->ad_elf);
+	}
+
+	(void) elf_end(ofl->ofl_elf);
+	(void) elf_end(ofl->ofl_welf);
 
-	va_start(args, format);
-	(void) vfprintf(stderr, format, args);
-	(void) fprintf(stderr, MSG_ORIG(MSG_STR_NL));
-	va_end(args);
+	for (chp = ld_heap, php = 0; chp; php = chp, chp = chp->lh_next) {
+		if (php)
+			(void) munmap((void *)php,
+			    (size_t)php->lh_end - (size_t)php);
+	}
+	if (php)
+		(void) munmap((void *)php, (size_t)php->lh_end - (size_t)php);
+
+	ld_heap = 0;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/libld.chk.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,42 @@
+#
+# 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"
+#
+
+@ _START_
+
+# Messages to satisfy chkmsg target.  Numerous messages within common code
+# (reloc.h) aren't required for each target, but chkmsg has no way of dealing
+# with ifdefs, thus this file exists to satisfy common code messages.
+
+@ MSG_REL_UNIMPL	"relocation error: file %s:  symbol %s: \
+			 unimplemented relocation type: %d"
+@ MSG_REL_UNNOBITS	"relocation error: %s: file %s: symbol %s: \
+			 unsupported number of bits: %d"
+@ MSG_REL_LOSEBITS	"relocation error: %s: file %s: symbol %s: \
+			 value 0x%llx loses %d bits at offset 0x%llx"
+
+@ _END_
--- a/usr/src/cmd/sgs/libld/common/libld.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/libld.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
 #
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
--- a/usr/src/cmd/sgs/libld/common/libld.sparc.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/libld.sparc.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,6 +18,11 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 
 @ _START_
@@ -33,7 +34,7 @@
 @ MSG_REL_UNNOBITS	"relocation error: %s: file %s: symbol %s: \
 			 unsupported number of bits: %d"
 @ MSG_REL_LOSEBITS	"relocation error: %s: file %s: symbol %s: \
-			 value 0x%llx loses %d bits at offset 0x%llx\n"
+			 value 0x%llx loses %d bits at offset 0x%llx"
 @ MSG_REL_UNRELREL	"relocation error: %s: file %s: symbol %s: \
 			 non-relative PLT relocation can not be used in \
 			 building a shared object"
--- a/usr/src/cmd/sgs/libld/common/libs.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/libs.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,7 +33,7 @@
  */
 #include	<stdio.h>
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -45,7 +44,7 @@
  * contains another tentative definition, or a defined function symbol, then it
  * will not be used.
  */
-int
+static int
 process_member(Ar_mem *amp, const char *name, unsigned char obind,
     Ofl_desc *ofl)
 {
@@ -67,8 +66,8 @@
 
 		while (scn = elf_nextscn(amp->am_elf, scn)) {
 			if ((shdr = elf_getshdr(scn)) == NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
-				    amp->am_path);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_GETSHDR), amp->am_path);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				return (0);
 			}
@@ -77,8 +76,8 @@
 				break;
 		}
 		if ((data = elf_getdata(scn, NULL)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA),
-			    amp->am_path);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETDATA), amp->am_path);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
@@ -92,14 +91,14 @@
 		 */
 		if ((scn = elf_getscn(amp->am_elf, (size_t)shdr->sh_link)) ==
 		    NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN),
-			    amp->am_path);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSCN), amp->am_path);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
 		if ((data = elf_getdata(scn, NULL)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA),
-			    amp->am_path);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETDATA), amp->am_path);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
@@ -151,7 +150,7 @@
  * pick off where the last processing finished.
  */
 Ar_desc *
-ar_setup(const char *name, Elf *elf, Ofl_desc *ofl)
+ld_ar_setup(const char *name, Elf *elf, Ofl_desc *ofl)
 {
 	Ar_desc *	adp;
 	size_t		number;
@@ -163,10 +162,12 @@
 	 */
 	if ((start = elf_getarsym(elf, &number)) == 0) {
 		if (elf_errno()) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETARSYM), name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETARSYM), name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		} else
-			eprintf(ERR_WARNING, MSG_INTL(MSG_ELF_ARSYM), name);
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_ELF_ARSYM), name);
 
 		return (0);
 	}
@@ -200,11 +201,11 @@
 }
 
 /*
- * For each archive descriptor we maintain an `Ar_aux' table to parallel the
- * archive symbol table (returned from elf_getarsym(3e)).  We use this table to
- * hold the `Sym_desc' for each symbol (thus reducing the number of sym_find()'s
- * we have to do), and to hold the `Ar_mem' pointer.  The `Ar_mem' element can
- * have one of three values indicating the state of the archive member
+ * For each archive descriptor, maintain an `Ar_aux' table to parallel the
+ * archive symbol table (returned from elf_getarsym(3e)).  Use this table to
+ * hold a `Sym_desc' for each symbol (thus reducing the number of
+ * ld_sym_find()'s), and to hold the `Ar_mem' pointer.  The `Ar_mem' element
+ * can have one of three values indicating the state of the archive member
  * associated with the offset for this symbol table entry:
  *
  *  0		indicates that the member has not been processed.
@@ -226,7 +227,7 @@
  * has its `Ar_mem' pointer set to the member structures address.
  */
 void
-ar_member(Ar_desc * adp, Elf_Arsym * arsym, Ar_aux * aup, Ar_mem * amp)
+ld_ar_member(Ar_desc * adp, Elf_Arsym * arsym, Ar_aux * aup, Ar_mem * amp)
 {
 	Elf_Arsym *	_arsym = arsym;
 	Ar_aux *	_aup = aup;
@@ -262,7 +263,7 @@
  * through a complete pass without satisfying any unresolved symbols
  */
 uintptr_t
-process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl)
+ld_process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl)
 {
 	Elf_Arsym *	arsym;
 	Elf_Arhdr *	arhdr;
@@ -270,7 +271,8 @@
 	Ar_aux *	aup;
 	Sym_desc *	sdp;
 	char 		*arname, *arpath;
-	int		ndx, found = 0, again = 0;
+	Xword		ndx;
+	int		found, again;
 	int		allexrt = ofl->ofl_flags1 & FLG_OF1_ALLEXRT;
 	uintptr_t	err;
 	Rej_desc	rej = { 0 };
@@ -301,9 +303,10 @@
 	 * symbol table.  If so, and if that symbol is still unresolved or
 	 * tentative, process the corresponding archive member.
 	 */
+	found = again = 0;
 	do {
-		DBG_CALL(Dbg_file_archive(name, again));
-		DBG_CALL(Dbg_syms_ar_title(name, again));
+		DBG_CALL(Dbg_file_ar(ofl->ofl_lml, name, again));
+		DBG_CALL(Dbg_syms_ar_title(ofl->ofl_lml, name, again));
 
 		ndx = again = 0;
 		for (arsym = adp->ad_start, aup = adp->ad_aux; arsym->as_name;
@@ -328,10 +331,11 @@
 			 * (But you skip this if allextract is specified.)
 			 */
 			if ((allexrt == 0) && ((sdp = aup->au_syms) == 0)) {
-				if ((sdp = sym_find(arsym->as_name,
+				if ((sdp = ld_sym_find(arsym->as_name,
 				    /* LINTED */
 				    (Word)arsym->as_hash, 0, ofl)) == 0) {
-					DBG_CALL(Dbg_syms_ar_entry(ndx, arsym));
+					DBG_CALL(Dbg_syms_ar_entry(ofl->ofl_lml,
+					    ndx, arsym));
 					continue;
 				}
 				aup->au_syms = sdp;
@@ -369,7 +373,8 @@
 				    (sym->st_shndx != SHN_COMMON) && vers) ||
 				    ((ELF_ST_BIND(sym->st_info) == STB_WEAK) &&
 				    (!(ofl->ofl_flags1 & FLG_OF1_WEAKEXT)))) {
-					DBG_CALL(Dbg_syms_ar_entry(ndx, arsym));
+					DBG_CALL(Dbg_syms_ar_entry(ofl->ofl_lml,
+					    ndx, arsym));
 					continue;
 				}
 			}
@@ -390,7 +395,7 @@
 				 */
 				if (elf_rand(adp->ad_elf, arsym->as_off) !=
 				    arsym->as_off) {
-					eprintf(ERR_ELF,
+					eprintf(ofl->ofl_lml, ERR_ELF,
 					    MSG_INTL(MSG_ELF_ARMEM), name,
 					    EC_WORD(arsym->as_off), ndx,
 					    demangle(arsym->as_name));
@@ -399,7 +404,7 @@
 				}
 				if ((arelf = elf_begin(fd, ELF_C_READ,
 				    adp->ad_elf)) == NULL) {
-					eprintf(ERR_ELF,
+					eprintf(ofl->ofl_lml, ERR_ELF,
 					    MSG_INTL(MSG_ELF_BEGIN), name);
 					ofl->ofl_flags |= FLG_OF_FATAL;
 					return (0);
@@ -409,7 +414,7 @@
 				 * Construct the member filename.
 				 */
 				if ((arhdr = elf_getarhdr(arelf)) == NULL) {
-					eprintf(ERR_ELF,
+					eprintf(ofl->ofl_lml, ERR_ELF,
 					    MSG_INTL(MSG_ELF_GETARHDR), name);
 					ofl->ofl_flags |= FLG_OF_FATAL;
 					return (0);
@@ -450,8 +455,8 @@
 					amp->am_name = arname;
 					amp->am_path = arpath;
 				}
-				DBG_CALL(Dbg_syms_ar_checking(ndx, arsym,
-				    arname));
+				DBG_CALL(Dbg_syms_ar_checking(ofl->ofl_lml,
+				    ndx, arsym, arname));
 				if ((err = process_member(amp, arsym->as_name,
 				    bind, ofl)) == S_ERROR)
 					return (S_ERROR);
@@ -466,7 +471,8 @@
 				 */
 				if (err == 0) {
 					if (aup->au_mem == 0)
-						ar_member(adp, arsym, aup, amp);
+						ld_ar_member(adp, arsym,
+						    aup, amp);
 					continue;
 				}
 			}
@@ -475,9 +481,9 @@
 			 * Process the archive member.  Retain any error for
 			 * return to the caller.
 			 */
-			DBG_CALL(Dbg_syms_ar_resolve(ndx, arsym, arname,
-			    allexrt));
-			if ((err = (uintptr_t)process_ifl(arpath, NULL, fd,
+			DBG_CALL(Dbg_syms_ar_resolve(ofl->ofl_lml, ndx, arsym,
+			    arname, allexrt));
+			if ((err = (uintptr_t)ld_process_ifl(arpath, NULL, fd,
 			    arelf, FLG_IF_EXTRACT | FLG_IF_NEEDED, ofl,
 			    &_rej)) == S_ERROR)
 				return (S_ERROR);
@@ -494,7 +500,7 @@
 					rej.rej_info = _rej.rej_info;
 					rej.rej_name = (const char *)arpath;
 				}
-				ar_member(adp, arsym, aup, FLG_ARMEM_PROC);
+				ld_ar_member(adp, arsym, aup, FLG_ARMEM_PROC);
 				continue;
 			}
 
@@ -514,8 +520,8 @@
 			if (allexrt == 0)
 				again = 1;
 
-			ar_member(adp, arsym, aup, FLG_ARMEM_PROC);
-			DBG_CALL(Dbg_syms_nl());
+			ld_ar_member(adp, arsym, aup, FLG_ARMEM_PROC);
+			DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD));
 		}
 	} while (again);
 
@@ -526,9 +532,10 @@
 	 */
 	if (found == 0) {
 		if (rej.rej_type)
-			eprintf(ERR_WARNING, MSG_INTL(reject[rej.rej_type]),
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(reject[rej.rej_type]),
 			    rej.rej_name ? rej.rej_name :
-			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej));
+			    MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej));
 	}
 
 	/*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <debug.h>
+#include <elfcap.h>
+#include <_libld.h>
--- a/usr/src/cmd/sgs/libld/common/llib-lld	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/llib-lld	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -23,7 +22,7 @@
 /* PROTOLIB1 */
 
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -34,35 +33,22 @@
 /*
  * Generic interface definition for usr/src/lib/libld.
  */
+uintptr_t	ld32_create_outfile(Ofl_desc *);
+uintptr_t	ld64_create_outfile(Ofl_desc *);
 
-char *		add_string(char *, char *);
-uintptr_t	create_outfile(Ofl_desc *);
-uintptr_t	ent_setup(Ofl_desc *, Xword);
-uintptr_t	finish_libs(Ofl_desc *);
-int		ld_main(int, char **);
-uintptr_t	ld_support_loadso(const char *);
-Listnode *	list_appendc(List *, const void *);
-Listnode *	list_insertc(List *, const void *, Listnode *);
-Listnode *	list_prependc(List *, const void *);
-Listnode *	list_where(List *, Word);
-uintptr_t	make_sections(Ofl_desc *);
-void		ofl_cleanup(Ofl_desc *);
-uintptr_t	open_outfile(Ofl_desc *);
-Ifl_desc *	process_open(const char *, size_t, int, Ofl_desc *,
-		    Half, Rej_desc *);
-uintptr_t	reloc_init(Ofl_desc *);
-uintptr_t	reloc_process(Ofl_desc *);
-Sdf_desc *	sdf_find(const char *, List *);
-Sdf_desc *	sdf_add(const char *, List *);
-void		sec_validate(Ofl_desc *);
-uintptr_t	sunwmove_preprocess(Ofl_desc *);
-Sym_desc *	sym_add_u(const char *, Ofl_desc *);
-Sym_desc *	sym_enter(const char *, Sym *, Word, Ifl_desc *,
-		    Ofl_desc *, Word, Word, Word, Half, avl_index_t *);
-Sym_desc *	sym_find(const char *, Word, avl_index_t *, Ofl_desc *);
-uintptr_t	sym_validate(Ofl_desc *);
-uintptr_t	update_outfile(Ofl_desc *);
-Ver_desc *	vers_base(Ofl_desc *);
-uintptr_t	vers_check_defs(Ofl_desc *);
-Ver_desc *	vers_desc(const char *, Word, List *);
-Ver_desc *	vers_find(const char *, Word, List *);
+uintptr_t	ld32_ent_setup(Ofl_desc *, Xword);
+uintptr_t	ld64_ent_setup(Ofl_desc *, Xword);
+
+int		ld32_main(int, char **);
+int		ld64_main(int, char **);
+uintptr_t	ld32_make_sections(Ofl_desc *);
+uintptr_t	ld64_make_sections(Ofl_desc *);
+
+uintptr_t	ld32_reloc_init(Ofl_desc *);
+uintptr_t	ld64_reloc_process(Ofl_desc *);
+
+uintptr_t	ld32_sym_validate(Ofl_desc *);
+uintptr_t	ld64_sym_validate(Ofl_desc *);
+
+uintptr_t	ld32_update_outfile(Ofl_desc *);
+uintptr_t	ld64_update_outfile(Ofl_desc *);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/machrel.amd.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,1624 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<string.h>
+#include	<stdio.h>
+#include	<strings.h>
+#include	<sys/elf_amd64.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	"msg.h"
+#include	"_libld.h"
+
+Word
+ld_init_rel(Rel_desc *reld, void *reloc)
+{
+	Rela *	rel = (Rela *)reloc;
+
+	/* LINTED */
+	reld->rel_rtype = (Word)ELF_R_TYPE(rel->r_info);
+	reld->rel_roffset = rel->r_offset;
+	reld->rel_raddend = rel->r_addend;
+	reld->rel_typedata = 0;
+
+	reld->rel_flags |= FLG_REL_RELA;
+
+	return ((Word)ELF_R_SYM(rel->r_info));
+}
+
+void
+ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
+{
+	ofl->ofl_dehdr->e_flags |= ehdr->e_flags;
+}
+
+void
+ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
+{
+	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
+		/*
+		 * Create this entry if we are going to create a PLT table.
+		 */
+		if (ofl->ofl_pltcnt)
+			(*cnt)++;		/* DT_PLTGOT */
+	}
+}
+
+void
+ld_mach_update_odynamic(Ofl_desc *ofl, Dyn **dyn)
+{
+	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) {
+		(*dyn)->d_tag = DT_PLTGOT;
+		if (ofl->ofl_osgot)
+			(*dyn)->d_un.d_ptr = ofl->ofl_osgot->os_shdr->sh_addr;
+		else
+			(*dyn)->d_un.d_ptr = 0;
+		(*dyn)++;
+	}
+}
+
+Xword
+ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
+{
+	Xword	value;
+
+	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
+	    M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) * M_PLT_ENTSIZE);
+	return (value);
+}
+
+/*
+ *  Build a single plt entry - code is:
+ *	JMP	*name1@GOTPCREL(%rip)
+ *	PUSHL	$index
+ *	JMP	.PLT0
+ */
+static uchar_t pltn_entry[M_PLT_ENTSIZE] = {
+/* 0x00 jmpq *name1@GOTPCREL(%rip) */	0xff, 0x25, 0x00, 0x00, 0x00, 0x00,
+/* 0x06 pushq $index */			0x68, 0x00, 0x00, 0x00, 0x00,
+/* 0x0b jmpq  .plt0(%rip) */		0xe9, 0x00, 0x00, 0x00, 0x00
+/* 0x10 */
+};
+
+static uintptr_t
+plt_entry(Ofl_desc * ofl, Sym_desc * sdp)
+{
+	uchar_t		*plt0, *pltent, *gotent;
+	Sword		plt_off;
+	Word		got_off;
+	Xword		val1;
+	Word		flags = ofl->ofl_flags;
+	Word		dtflags1 = ofl->ofl_dtflags_1;
+
+	got_off = sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
+	plt_off = M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) *
+	    M_PLT_ENTSIZE);
+	plt0 = (uchar_t *)(ofl->ofl_osplt->os_outdata->d_buf);
+	pltent = plt0 + plt_off;
+	gotent = (uchar_t *)(ofl->ofl_osgot->os_outdata->d_buf) + got_off;
+
+	bcopy(pltn_entry, pltent, sizeof (pltn_entry));
+	/*
+	 * Fill in the got entry with the address of the next instruction.
+	 */
+	/* LINTED */
+	*(Word *)gotent = ofl->ofl_osplt->os_shdr->sh_addr + plt_off +
+	    M_PLT_INSSIZE;
+
+	/*
+	 * patchup:
+	 *	jmpq	*name1@gotpcrel(%rip)
+	 *
+	 * NOTE: 0x06 represents next instruction.
+	 */
+	val1 = (ofl->ofl_osgot->os_shdr->sh_addr + got_off) -
+		(ofl->ofl_osplt->os_shdr->sh_addr + plt_off) - 0x06;
+
+	/*
+	 * If '-z noreloc' is specified - skip the do_reloc
+	 * stage.
+	 */
+	if ((flags & FLG_OF_RELOBJ) ||
+	    !(dtflags1 & DF_1_NORELOC)) {
+		if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02],
+		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
+		    MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx,
+			    demangle(sdp->sd_name));
+			return (S_ERROR);
+		}
+	}
+
+	/*
+	 * patchup:
+	 *	pushq	$pltndx
+	 */
+	val1 = (Xword)(sdp->sd_aux->sa_PLTndx - 1);
+	/*
+	 * If '-z noreloc' is specified - skip the do_reloc
+	 * stage.
+	 */
+	if ((flags & FLG_OF_RELOBJ) ||
+	    !(dtflags1 & DF_1_NORELOC)) {
+		if (do_reloc(R_AMD64_32, &pltent[0x07],
+		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
+		    MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx,
+			    demangle(sdp->sd_name));
+			return (S_ERROR);
+		}
+	}
+
+	/*
+	 * patchup:
+	 *	jmpq	.plt0(%rip)
+	 * NOTE: 0x10 represents next instruction.  The rather complex series
+	 * of casts is necessary to sign extend an offset into a 64-bit value
+	 * while satisfying various compiler error checks.  Handle with care.
+	 */
+	val1 = (Xword)((intptr_t)((uintptr_t)plt0 -
+	    (uintptr_t)(&pltent[0x10])));
+
+	/*
+	 * If '-z noreloc' is specified - skip the do_reloc
+	 * stage.
+	 */
+	if ((flags & FLG_OF_RELOBJ) ||
+	    !(dtflags1 & DF_1_NORELOC)) {
+		if (do_reloc(R_AMD64_PC32, &pltent[0x0c],
+		    &val1, MSG_ORIG(MSG_SYM_PLTENT),
+		    MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx,
+			    demangle(sdp->sd_name));
+			return (S_ERROR);
+		}
+	}
+	return (1);
+}
+
+uintptr_t
+ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
+{
+	Os_desc *	relosp, * osp = 0;
+	Word		ndx;
+	Xword		roffset, value;
+	Sxword		raddend;
+	Rela		rea;
+	char		*relbits;
+	Sym_desc *	sdp, * psym = (Sym_desc *)0;
+	int		sectmoved = 0;
+
+	raddend = orsp->rel_raddend;
+	sdp = orsp->rel_sym;
+
+	/*
+	 * If the section this relocation is against has been discarded
+	 * (-zignore), then also discard (skip) the relocation itself.
+	 */
+	if (orsp->rel_isdesc && ((orsp->rel_flags &
+	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
+	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
+		DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp));
+		return (1);
+	}
+
+	/*
+	 * If this is a relocation against a move table, or expanded move
+	 * table, adjust the relocation entries.
+	 */
+	if (orsp->rel_move)
+		ld_adj_movereloc(ofl, orsp);
+
+	/*
+	 * If this is a relocation against a section then we need to adjust the
+	 * raddend field to compensate for the new position of the input section
+	 * within the new output section.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
+		if (ofl->ofl_parsym.head &&
+		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+		    /* LINTED */
+		    (psym = ld_am_I_partial(orsp, orsp->rel_raddend))) {
+			DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym));
+			sectmoved = 1;
+			if (ofl->ofl_flags & FLG_OF_RELOBJ)
+				raddend = psym->sd_sym->st_value;
+			else
+				raddend = psym->sd_sym->st_value -
+				    psym->sd_isc->is_osdesc->os_shdr->sh_addr;
+			/* LINTED */
+			raddend += (Off)_elf_getxoff(psym->sd_isc->is_indata);
+			if (psym->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
+				raddend +=
+				psym->sd_isc->is_osdesc->os_shdr->sh_addr;
+		} else {
+			/* LINTED */
+			raddend += (Off)_elf_getxoff(sdp->sd_isc->is_indata);
+			if (sdp->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
+				raddend +=
+				sdp->sd_isc->is_osdesc->os_shdr->sh_addr;
+		}
+	}
+
+	value = sdp->sd_sym->st_value;
+
+	if (orsp->rel_flags & FLG_REL_GOT) {
+		/*
+		 * Note: for GOT relative relocations on amd64
+		 *	 we discard the addend.  It was relevant
+		 *	 to the reference - not to the data item
+		 *	 being referenced (ie: that -4 thing).
+		 */
+		raddend = 0;
+		osp = ofl->ofl_osgot;
+		roffset = ld_calc_got_offset(orsp, ofl);
+
+	} else if (orsp->rel_flags & FLG_REL_PLT) {
+		/*
+		 * Note that relocations for PLT's actually
+		 * cause a relocation againt the GOT.
+		 */
+		osp = ofl->ofl_osplt;
+		roffset = (ofl->ofl_osgot->os_shdr->sh_addr) +
+		    sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
+		raddend = 0;
+		if (plt_entry(ofl, sdp) == S_ERROR)
+			return (S_ERROR);
+
+	} else if (orsp->rel_flags & FLG_REL_BSS) {
+		/*
+		 * This must be a R_AMD64_COPY.  For these set the roffset to
+		 * point to the new symbols location.
+		 */
+		osp = ofl->ofl_isbss->is_osdesc;
+		roffset = value;
+
+		/*
+		 * The raddend doesn't mean anything in a R_SPARC_COPY
+		 * relocation.  Null it out because it can confuse people.
+		 */
+		raddend = 0;
+	} else {
+		osp = orsp->rel_osdesc;
+
+		/*
+		 * Calculate virtual offset of reference point; equals offset
+		 * into section + vaddr of section for loadable sections, or
+		 * offset plus section displacement for nonloadable sections.
+		 */
+		roffset = orsp->rel_roffset +
+		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
+		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
+			roffset += orsp->rel_isdesc->is_osdesc->
+			    os_shdr->sh_addr;
+	}
+
+	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
+		relosp = ofl->ofl_osrel;
+
+	/*
+	 * Assign the symbols index for the output relocation.  If the
+	 * relocation refers to a SECTION symbol then it's index is based upon
+	 * the output sections symbols index.  Otherwise the index can be
+	 * derived from the symbols index itself.
+	 */
+	if (orsp->rel_rtype == R_AMD64_RELATIVE)
+		ndx = STN_UNDEF;
+	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
+		if (sectmoved == 0) {
+			/*
+			 * Check for a null input section. This can
+			 * occur if this relocation references a symbol
+			 * generated by sym_add_sym().
+			 */
+			if ((sdp->sd_isc != 0) &&
+			    (sdp->sd_isc->is_osdesc != 0))
+				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
+			else
+				ndx = sdp->sd_shndx;
+		} else
+			ndx = ofl->ofl_sunwdata1ndx;
+	} else
+		ndx = sdp->sd_symndx;
+
+	/*
+	 * Add the symbols 'value' to the addend field.
+	 */
+	if (orsp->rel_flags & FLG_REL_ADVAL)
+		raddend += value;
+
+	/*
+	 * addend field for R_AMD64_DTPMOD64 means nothing.  The addend
+	 * is propogated in the corresponding R_AMD64_DTPOFF64
+	 * relocation.
+	 */
+	if (orsp->rel_rtype == R_AMD64_DTPMOD64)
+		raddend = 0;
+
+	relbits = (char *)relosp->os_outdata->d_buf;
+
+	rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype);
+	rea.r_offset = roffset;
+	rea.r_addend = raddend;
+	DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea, relosp->os_name,
+	    orsp->rel_sname));
+
+	/*
+	 * Assert we haven't walked off the end of our relocation table.
+	 */
+	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
+
+	(void) memcpy((relbits + relosp->os_szoutrels),
+	    (char *)&rea, sizeof (Rela));
+	relosp->os_szoutrels += (Xword)sizeof (Rela);
+
+	/*
+	 * Determine if this relocation is against a non-writable, allocatable
+	 * section.  If so we may need to provide a text relocation diagnostic.
+	 * Note that relocations against the .plt (R_AMD64_JUMP_SLOT) actually
+	 * result in modifications to the .got.
+	 */
+	if (orsp->rel_rtype == R_AMD64_JUMP_SLOT)
+		osp = ofl->ofl_osgot;
+
+	ld_reloc_remain_entry(orsp, osp, ofl);
+	return (1);
+}
+
+/*
+ * amd64 Instructions for TLS processing
+ */
+static uchar_t tlsinstr_gd_ie[] = {
+	/*
+	 *	0x00 movq %fs:0, %rax
+	 */
+	0x64, 0x48, 0x8b, 0x04, 0x25,
+	0x00, 0x00, 0x00, 0x00,
+	/*
+	 *	0x09 addq x@gottpoff(%rip), %rax
+	 */
+	0x48, 0x03, 0x05, 0x00, 0x00,
+	0x00, 0x00
+};
+
+static uchar_t tlsinstr_gd_le[] = {
+	/*
+	 *	0x00 movq %fs:0, %rax
+	 */
+	0x64, 0x48, 0x8b, 0x04, 0x25,
+	0x00, 0x00, 0x00, 0x00,
+	/*
+	 *	0x09 leaq x@gottpoff(%rip), %rax
+	 */
+	0x48, 0x8d, 0x80, 0x00, 0x00,
+	0x00, 0x00
+};
+
+static uchar_t tlsinstr_ld_le[] = {
+	/*
+	 * .byte 0x66
+	 */
+	0x66,
+	/*
+	 * .byte 0x66
+	 */
+	0x66,
+	/*
+	 * .byte 0x66
+	 */
+	0x66,
+	/*
+	 * movq %fs:0, %rax
+	 */
+	0x64, 0x48, 0x8b, 0x04, 0x25,
+	0x00, 0x00, 0x00, 0x00
+};
+
+
+static Fixupret
+tls_fixups(Ofl_desc *ofl, Rel_desc *arsp)
+{
+	Sym_desc	*sdp = arsp->rel_sym;
+	Word		rtype = arsp->rel_rtype;
+	uchar_t		*offset;
+
+	offset = (uchar_t *)((uintptr_t)arsp->rel_roffset +
+	    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
+	    (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
+
+	if (sdp->sd_ref == REF_DYN_NEED) {
+		/*
+		 * IE reference model
+		 */
+		switch (rtype) {
+		case R_AMD64_TLSGD:
+			/*
+			 *  GD -> IE
+			 *
+			 * Transition:
+			 *	0x00 .byte 0x66
+			 *	0x01 leaq x@tlsgd(%rip), %rdi
+			 *	0x08 .word 0x6666
+			 *	0x0a rex64
+			 *	0x0b call __tls_get_addr@plt
+			 *	0x10
+			 * To:
+			 *	0x00 movq %fs:0, %rax
+			 *	0x09 addq x@gottpoff(%rip), %rax
+			 *	0x10
+			 */
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_AMD64_GOTTPOFF, arsp->rel_roffset,
+			    sdp->sd_name));
+			arsp->rel_rtype = R_AMD64_GOTTPOFF;
+			arsp->rel_roffset += 8;
+			arsp->rel_raddend = (Sxword)-4;
+
+			/*
+			 * Addjust 'offset' to beginning of instruction
+			 * sequence.
+			 */
+			offset -= 4;
+			(void) memcpy(offset, tlsinstr_gd_ie,
+			    sizeof (tlsinstr_gd_ie));
+			return (FIX_RELOC);
+
+		case R_AMD64_PLT32:
+			/*
+			 * Fixup done via the TLS_GD relocation
+			 */
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_AMD64_NONE, arsp->rel_roffset,
+			    sdp->sd_name));
+			return (FIX_DONE);
+		}
+	}
+
+	/*
+	 * LE reference model
+	 */
+	switch (rtype) {
+	case R_AMD64_TLSGD:
+		/*
+		 * GD -> LE
+		 *
+		 * Transition:
+		 *	0x00 .byte 0x66
+		 *	0x01 leaq x@tlsgd(%rip), %rdi
+		 *	0x08 .word 0x6666
+		 *	0x0a rex64
+		 *	0x0b call __tls_get_addr@plt
+		 *	0x10
+		 * To:
+		 *	0x00 movq %fs:0, %rax
+		 *	0x09 leaq x@tpoff(%rax), %rax
+		 *	0x10
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name));
+
+		arsp->rel_rtype = R_AMD64_TPOFF32;
+		arsp->rel_roffset += 8;
+		arsp->rel_raddend = 0;
+
+		/*
+		 * Addjust 'offset' to beginning of instruction
+		 * sequence.
+		 */
+		offset -= 4;
+		(void) memcpy(offset, tlsinstr_gd_le, sizeof (tlsinstr_gd_le));
+		return (FIX_RELOC);
+
+	case R_AMD64_GOTTPOFF:
+		/*
+		 * IE -> LE
+		 *
+		 * Transition:
+		 *	0x00 movq %fs:0, %rax
+		 *	0x09 addq x@gottopoff(%rip), %rax
+		 *	0x10
+		 * To:
+		 *	0x00 movq %fs:0, %rax
+		 *	0x09 leaq x@tpoff(%rax), %rax
+		 *	0x10
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name));
+
+		arsp->rel_rtype = R_AMD64_TPOFF32;
+		arsp->rel_raddend = 0;
+
+		/*
+		 * Addjust 'offset' to beginning of instruction
+		 * sequence.
+		 */
+		offset -= 12;
+
+		/*
+		 * Same code sequence used in the GD -> LE
+		 * transition.
+		 */
+		(void) memcpy(offset, tlsinstr_gd_le, sizeof (tlsinstr_gd_le));
+		return (FIX_RELOC);
+
+	case R_AMD64_TLSLD:
+		/*
+		 * LD -> LE
+		 *
+		 * Transition
+		 *	0x00 leaq x1@tlsgd(%rip), %rdi
+		 *	0x07 call __tls_get_addr@plt
+		 *	0x0c
+		 * To:
+		 *	0x00 .byte 0x66
+		 *	0x01 .byte 0x66
+		 *	0x02 .byte 0x66
+		 *	0x03 movq %fs:0, %rax
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_AMD64_NONE, arsp->rel_roffset, sdp->sd_name));
+		offset -= 3;
+		(void) memcpy(offset, tlsinstr_ld_le, sizeof (tlsinstr_ld_le));
+		return (FIX_DONE);
+
+	case R_AMD64_DTPOFF32:
+		/*
+		 * LD->LE
+		 *
+		 * Transition:
+		 *	0x00 leaq x1@dtpoff(%rax), %rcx
+		 * To:
+		 *	0x00 leaq x1@tpoff(%rax), %rcx
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_AMD64_TPOFF32;
+		arsp->rel_raddend = 0;
+		return (FIX_RELOC);
+	}
+
+	return (FIX_RELOC);
+}
+
+uintptr_t
+ld_do_activerelocs(Ofl_desc *ofl)
+{
+	Rel_desc	*arsp;
+	Rel_cache	*rcp;
+	Listnode	*lnp;
+	uintptr_t	return_code = 1;
+	Word		flags = ofl->ofl_flags;
+	Word		dtflags1 = ofl->ofl_dtflags_1;
+
+	DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml));
+	/*
+	 * Process active relocations.
+	 */
+	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
+		/* LINTED */
+		for (arsp = (Rel_desc *)(rcp + 1);
+		    arsp < rcp->rc_free; arsp++) {
+			uchar_t		*addr;
+			Xword 		value;
+			Sym_desc	*sdp;
+			const char	*ifl_name;
+			Xword		refaddr;
+			int		moved = 0;
+			Gotref		gref;
+
+			/*
+			 * If the section this relocation is against has been
+			 * discarded (-zignore), then discard (skip) the
+			 * relocation itself.
+			 */
+			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
+			    ((arsp->rel_flags &
+			    (FLG_REL_GOT | FLG_REL_BSS |
+			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
+				DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml,
+				    M_MACH, arsp));
+				continue;
+			}
+
+			/*
+			 * We deteremine what the 'got reference'
+			 * model (if required) is at this point.  This
+			 * needs to be done before tls_fixup() since
+			 * it may 'transition' our instructions.
+			 *
+			 * The got table entries have already been assigned,
+			 * and we bind to those initial entries.
+			 */
+			if (arsp->rel_flags & FLG_REL_DTLS)
+				gref = GOT_REF_TLSGD;
+			else if (arsp->rel_flags & FLG_REL_MTLS)
+				gref = GOT_REF_TLSLD;
+			else if (arsp->rel_flags & FLG_REL_STLS)
+				gref = GOT_REF_TLSIE;
+			else
+				gref = GOT_REF_GENERIC;
+
+			/*
+			 * Perform any required TLS fixups.
+			 */
+			if (arsp->rel_flags & FLG_REL_TLSFIX) {
+				Fixupret	ret;
+
+				if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR)
+					return (S_ERROR);
+				if (ret == FIX_DONE)
+					continue;
+			}
+
+			/*
+			 * If this is a relocation against a move table, or
+			 * expanded move table, adjust the relocation entries.
+			 */
+			if (arsp->rel_move)
+				ld_adj_movereloc(ofl, arsp);
+
+			sdp = arsp->rel_sym;
+			refaddr = arsp->rel_roffset +
+			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
+
+			if ((arsp->rel_flags & FLG_REL_CLVAL) ||
+			    (arsp->rel_flags & FLG_REL_GOTCL))
+				value = 0;
+			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
+			    STT_SECTION) {
+				Sym_desc	*sym;
+
+				/*
+				 * The value for a symbol pointing to a SECTION
+				 * is based off of that sections position.
+				 *
+				 * The second argument of the ld_am_I_partial()
+				 * is the value stored at the target address
+				 * relocation is going to be applied.
+				 */
+				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+				    /* LINTED */
+				    (sym = ld_am_I_partial(arsp, *(Xword *)
+				    ((uchar_t *)
+				    arsp->rel_isdesc->is_indata->d_buf +
+				    arsp->rel_roffset)))) {
+					/*
+					 * If the symbol is moved,
+					 * adjust the value
+					 */
+					value = sym->sd_sym->st_value;
+					moved = 1;
+				} else {
+					value = _elf_getxoff(
+					    sdp->sd_isc->is_indata);
+					if (sdp->sd_isc->is_shdr->sh_flags &
+					    SHF_ALLOC)
+					    value += sdp->sd_isc->is_osdesc->
+					    os_shdr->sh_addr;
+				}
+				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
+					value -= ofl->ofl_tlsphdr->p_vaddr;
+			} else {
+				/*
+				 * else the value is the symbols value
+				 */
+				value = sdp->sd_sym->st_value;
+			}
+
+			/*
+			 * Relocation against the GLOBAL_OFFSET_TABLE.
+			 */
+			if (arsp->rel_flags & FLG_REL_GOT)
+				arsp->rel_osdesc = ofl->ofl_osgot;
+
+			/*
+			 * If loadable and not producing a relocatable object
+			 * add the sections virtual address to the reference
+			 * address.
+			 */
+			if ((arsp->rel_flags & FLG_REL_LOAD) &&
+			    ((flags & FLG_OF_RELOBJ) == 0))
+				refaddr += arsp->rel_isdesc->is_osdesc->
+				    os_shdr->sh_addr;
+
+			/*
+			 * If this entry has a PLT assigned to it, it's
+			 * value is actually the address of the PLT (and
+			 * not the address of the function).
+			 */
+			if (IS_PLT(arsp->rel_rtype)) {
+				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
+					value = ld_calc_plt_addr(sdp, ofl);
+			}
+
+			/*
+			 * Add relocations addend to value.  Add extra
+			 * relocation addend if needed.
+			 *
+			 * Note: for GOT relative relocations on amd64
+			 *	 we discard the addend.  It was relevant
+			 *	 to the reference - not to the data item
+			 *	 being referenced (ie: that -4 thing).
+			 */
+			if ((arsp->rel_flags & FLG_REL_GOT) == 0)
+				value += arsp->rel_raddend;
+
+			/*
+			 * Determine whether the value needs further adjustment.
+			 * Filter through the attributes of the relocation to
+			 * determine what adjustment is required.  Note, many
+			 * of the following cases are only applicable when a
+			 * .got is present.  As a .got is not generated when a
+			 * relocatable object is being built, any adjustments
+			 * that require a .got need to be skipped.
+			 */
+			if ((arsp->rel_flags & FLG_REL_GOT) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword		R1addr;
+				uintptr_t	R2addr;
+				Word		gotndx;
+				Gotndx		*gnp;
+
+				/*
+				 * Perform relocation against GOT table.  Since
+				 * this doesn't fit exactly into a relocation
+				 * we place the appropriate byte in the GOT
+				 * directly
+				 *
+				 * Calculate offset into GOT at which to apply
+				 * the relocation.
+				 */
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, arsp);
+				assert(gnp);
+
+				if (arsp->rel_rtype == R_AMD64_DTPOFF64)
+					gotndx = gnp->gn_gotndx + 1;
+				else
+					gotndx = gnp->gn_gotndx;
+
+				R1addr = (Xword)(gotndx * M_GOT_ENTSIZE);
+
+				/*
+				 * Add the GOTs data's offset.
+				 */
+				R2addr = R1addr + (uintptr_t)
+				    arsp->rel_osdesc->os_outdata->d_buf;
+
+				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
+				    ELF_DBG_LD, M_MACH, SHT_RELA,
+				    arsp->rel_rtype, R1addr, value,
+				    arsp->rel_sname, arsp->rel_osdesc));
+
+				/*
+				 * And do it.
+				 */
+				*(Xword *)R2addr = value;
+				continue;
+
+			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				value -= ofl->ofl_osgot->os_shdr->sh_addr;
+
+			} else if (IS_GOTPCREL(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx *gnp;
+
+				/*
+				 * Calculation:
+				 *	G + GOT + A - P
+				 */
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+				    gref, ofl, arsp);
+				assert(gnp);
+				value = (Xword)(ofl->ofl_osgot->os_shdr->
+				    sh_addr) + ((Xword)gnp->gn_gotndx *
+				    M_GOT_ENTSIZE) + arsp->rel_raddend -
+				    refaddr;
+
+			} else if (IS_GOT_PC(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				value = (Xword)(ofl->ofl_osgot->os_shdr->
+				    sh_addr) - refaddr + arsp->rel_raddend;
+
+			} else if ((IS_PC_RELATIVE(arsp->rel_rtype)) &&
+			    (((flags & FLG_OF_RELOBJ) == 0) ||
+			    (arsp->rel_osdesc == sdp->sd_isc->is_osdesc))) {
+				value -= refaddr;
+
+			} else if (IS_TLS_INS(arsp->rel_rtype) &&
+			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx	*gnp;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, arsp);
+				assert(gnp);
+				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
+
+			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx *gnp;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+				    gref, ofl, arsp);
+				assert(gnp);
+				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
+
+			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword	tlsstatsize;
+
+				/*
+				 * This is the LE TLS reference model.  Static
+				 * offset is hard-coded.
+				 */
+				tlsstatsize =
+				    S_ROUND(ofl->ofl_tlsphdr->p_memsz,
+				    M_TLSSTATALIGN);
+				value = tlsstatsize - value;
+
+				/*
+				 * Since this code is fixed up, it assumes a
+				 * negative offset that can be added to the
+				 * thread pointer.
+				 */
+				if (arsp->rel_rtype == R_AMD64_TPOFF32)
+					value = -value;
+			}
+
+			if (arsp->rel_isdesc->is_file)
+				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
+			else
+				ifl_name = MSG_INTL(MSG_STR_NULL);
+
+			/*
+			 * Make sure we have data to relocate.  Compiler and
+			 * assembler developers have been known to generate
+			 * relocations against invalid sections (normally .bss),
+			 * so for their benefit give them sufficient information
+			 * to help analyze the problem.  End users should never
+			 * see this.
+			 */
+			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_EMPTYSEC),
+				    conv_reloc_amd64_type(arsp->rel_rtype),
+				    ifl_name, demangle(arsp->rel_sname),
+				    arsp->rel_isdesc->is_name);
+				return (S_ERROR);
+			}
+
+			/*
+			 * Get the address of the data item we need to modify.
+			 */
+			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
+			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
+			    is_indata));
+
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			    M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr),
+			    value, arsp->rel_sname, arsp->rel_osdesc));
+			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
+
+			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) >
+			    ofl->ofl_size) || (arsp->rel_roffset >
+			    arsp->rel_osdesc->os_shdr->sh_size)) {
+				int	class;
+
+				if (((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size)
+					class = ERR_FATAL;
+				else
+					class = ERR_WARNING;
+
+				eprintf(ofl->ofl_lml, class,
+				    MSG_INTL(MSG_REL_INVALOFFSET),
+				    conv_reloc_amd64_type(arsp->rel_rtype),
+				    ifl_name, arsp->rel_isdesc->is_name,
+				    demangle(arsp->rel_sname),
+				    EC_ADDR((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr));
+
+				if (class == ERR_FATAL) {
+					return_code = S_ERROR;
+					continue;
+				}
+			}
+
+			/*
+			 * The relocation is additive.  Ignore the previous
+			 * symbol value if this local partial symbol is
+			 * expanded.
+			 */
+			if (moved)
+				value -= *addr;
+
+			/*
+			 * If '-z noreloc' is specified - skip the do_reloc
+			 * stage.
+			 */
+			if ((flags & FLG_OF_RELOBJ) ||
+			    !(dtflags1 & DF_1_NORELOC)) {
+				if (do_reloc((uchar_t)arsp->rel_rtype,
+				    addr, &value, arsp->rel_sname, ifl_name,
+				    ofl->ofl_lml) == 0)
+					return_code = S_ERROR;
+			}
+		}
+	}
+	return (return_code);
+}
+
+uintptr_t
+ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
+{
+	Rel_desc	*orsp;
+	Rel_cache	*rcp;
+	Sym_desc	*sdp = rsp->rel_sym;
+
+	/*
+	 * Static executables *do not* want any relocations against them.
+	 * Since our engine still creates relocations against a WEAK UNDEFINED
+	 * symbol in a static executable, it's best to disable them here
+	 * instead of through out the relocation code.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC))
+		return (1);
+
+	/*
+	 * If no relocation cache structures are available allocate
+	 * a new one and link it into the cache list.
+	 */
+	if ((ofl->ofl_outrels.tail == 0) ||
+	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
+	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
+		static size_t	nextsize = 0;
+		size_t		size;
+
+		/*
+		 * Output relocation numbers can vary considerably between
+		 * building executables or shared objects (pic vs. non-pic),
+		 * etc.  But, they typically aren't very large, so for these
+		 * objects use a standard bucket size.  For building relocatable
+		 * objects, typically there will be an output relocation for
+		 * every input relocation.
+		 */
+		if (nextsize == 0) {
+			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
+				if ((size = ofl->ofl_relocincnt) == 0)
+					size = REL_LOIDESCNO;
+				if (size > REL_HOIDESCNO)
+					nextsize = REL_HOIDESCNO;
+				else
+					nextsize = REL_LOIDESCNO;
+			} else
+				nextsize = size = REL_HOIDESCNO;
+		} else
+			size = nextsize;
+
+		size = size * sizeof (Rel_desc);
+
+		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
+		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
+			return (S_ERROR);
+
+		/* LINTED */
+		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
+		/* LINTED */
+		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
+	}
+
+	/*
+	 * If we are adding a output relocation against a section
+	 * symbol (non-RELATIVE) then mark that section.  These sections
+	 * will be added to the .dynsym symbol table.
+	 */
+	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
+	    ((flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
+
+		/*
+		 * If this is a COMMON symbol - no output section
+		 * exists yet - (it's created as part of sym_validate()).
+		 * So - we mark here that when it's created it should
+		 * be tagged with the FLG_OS_OUTREL flag.
+		 */
+		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
+		    (sdp->sd_shndx == SHN_COMMON)) {
+			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
+				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
+			else
+				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
+		} else {
+			Os_desc	*osp = sdp->sd_isc->is_osdesc;
+
+			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
+				ofl->ofl_dynshdrcnt++;
+				osp->os_flags |= FLG_OS_OUTREL;
+			}
+		}
+	}
+
+	*orsp = *rsp;
+	orsp->rel_flags |= flags;
+
+	rcp->rc_free++;
+	ofl->ofl_outrelscnt++;
+
+	if (flags & FLG_REL_GOT)
+		ofl->ofl_relocgotsz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_PLT)
+		ofl->ofl_relocpltsz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_BSS)
+		ofl->ofl_relocbsssz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_NOINFO)
+		ofl->ofl_relocrelsz += (Xword)sizeof (Rela);
+	else
+		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rela);
+
+	if (orsp->rel_rtype == M_R_RELATIVE)
+		ofl->ofl_relocrelcnt++;
+
+	/*
+	 * We don't perform sorting on PLT relocations because
+	 * they have already been assigned a PLT index and if we
+	 * were to sort them we would have to re-assign the plt indexes.
+	 */
+	if (!(flags & FLG_REL_PLT))
+		ofl->ofl_reloccnt++;
+
+	/*
+	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
+	 */
+	if (IS_GOT_REQUIRED(orsp->rel_rtype))
+		ofl->ofl_flags |= FLG_OF_BLDGOT;
+
+	/*
+	 * Identify and possibly warn of a displacement relocation.
+	 */
+	if (orsp->rel_flags & FLG_REL_DISP) {
+		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
+
+		if (ofl->ofl_flags & FLG_OF_VERBOSE)
+			ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
+	}
+	DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_RELA,
+	    M_MACH, orsp));
+	return (1);
+}
+
+/*
+ * Stub routine since register symbols are not supported on amd64.
+ */
+/* ARGSUSED */
+uintptr_t
+ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
+{
+	eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOREG));
+	return (S_ERROR);
+}
+
+/*
+ * process relocation for a LOCAL symbol
+ */
+uintptr_t
+ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		flags = ofl->ofl_flags;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		shndx = rsp->rel_sym->sd_shndx;
+	Word		ortype = rsp->rel_rtype;
+
+	/*
+	 * if ((shared object) and (not pc relative relocation) and
+	 *    (not against ABS symbol))
+	 * then
+	 *	build R_AMD64_RELATIVE
+	 * fi
+	 */
+	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
+	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
+	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
+	    !(rsp->rel_isdesc != NULL &&
+	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
+	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
+	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
+
+		/*
+		 * R_AMD64_RELATIVE updates a 64bit address, if this
+		 * relocation isn't a 64bit binding then we can not
+		 * simplify it to a RELATIVE relocation.
+		 */
+		if (reloc_table[ortype].re_fsize != sizeof (Addr)) {
+			return (ld_add_outrel(NULL, rsp, ofl));
+		}
+
+		rsp->rel_rtype = R_AMD64_RELATIVE;
+		if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = ortype;
+		return (1);
+	}
+
+	/*
+	 * If the relocation is against a 'non-allocatable' section
+	 * and we can not resolve it now - then give a warning
+	 * message.
+	 *
+	 * We can not resolve the symbol if either:
+	 *	a) it's undefined
+	 *	b) it's defined in a shared library and a
+	 *	   COPY relocation hasn't moved it to the executable
+	 *
+	 * Note: because we process all of the relocations against the
+	 *	text segment before any others - we know whether
+	 *	or not a copy relocation will be generated before
+	 *	we get here (see reloc_init()->reloc_segments()).
+	 */
+	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
+	    ((shndx == SHN_UNDEF) ||
+	    ((sdp->sd_ref == REF_DYN_NEED) &&
+	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
+		/*
+		 * If the relocation is against a SHT_SUNW_ANNOTATE
+		 * section - then silently ignore that the relocation
+		 * can not be resolved.
+		 */
+		if (rsp->rel_osdesc &&
+		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
+			return (0);
+		(void) eprintf(ofl->ofl_lml, ERR_WARNING,
+		    MSG_INTL(MSG_REL_EXTERNSYM),
+		    conv_reloc_amd64_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
+		return (1);
+	}
+
+	/*
+	 * Perform relocation.
+	 */
+	return (ld_add_actrel(NULL, rsp, ofl));
+}
+
+
+uintptr_t
+/* ARGSUSED */
+ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	/*
+	 * Stub routine for common code compatibility, we shouldn't
+	 * actually get here on amd64.
+	 */
+	return (S_ERROR);
+}
+
+uintptr_t
+ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		rtype = rsp->rel_rtype;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		flags = ofl->ofl_flags;
+	Word		rflags;
+	Gotndx		*gnp;
+
+	/*
+	 * all TLS relocations are illegal in a static executable.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
+		    conv_reloc_amd64_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * Any TLS relocation must be against a STT_TLS symbol, all others
+	 * are illegal.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
+		Ifl_desc	*ifl = rsp->rel_isdesc->is_file;
+
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
+		    conv_reloc_amd64_type(rsp->rel_rtype),
+		    ifl->ifl_name, demangle(rsp->rel_sname),
+		    conv_sym_info_type(ifl->ifl_ehdr->e_machine,
+		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
+		return (S_ERROR);
+	}
+
+	/*
+	 * We're a executable - use either the IE or LE
+	 * access model.
+	 */
+	if (flags & FLG_OF_EXEC) {
+		/*
+		 * If we are using either IE or LE reference
+		 * model set the DF_STATIC_TLS flag.
+		 */
+		ofl->ofl_dtflags |= DF_STATIC_TLS;
+
+		if (!local) {
+			Gotref	gref;
+			/*
+			 * IE access model
+			 */
+			/*
+			 * It's not possible for LD or LE reference
+			 * models to reference a symbol external to
+			 * the current object.
+			 */
+			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_TLSBND),
+				    conv_reloc_amd64_type(rsp->rel_rtype),
+				    rsp->rel_isdesc->is_file->ifl_name,
+				    demangle(rsp->rel_sname),
+				    sdp->sd_file->ifl_name);
+				return (S_ERROR);
+			}
+
+			gref = GOT_REF_TLSIE;
+
+			/*
+			 * Assign a GOT entry for static TLS references
+			 */
+			if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+			    gref, ofl, rsp)) == 0) {
+				if (ld_assign_gotndx(&(sdp->sd_GOTndxs),
+				    gnp, gref, ofl, rsp, sdp) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = R_AMD64_TPOFF64;
+				if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS),
+				    rsp, ofl) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = rtype;
+			}
+			if (IS_TLS_IE(rtype))
+				return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+
+			/*
+			 * If (GD or LD) reference models - fixups
+			 * are required.
+			 */
+			return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+			    rsp, ofl));
+		}
+		/*
+		 * LE access model
+		 */
+		if (IS_TLS_LE(rtype))
+			return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+		return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+		    rsp, ofl));
+	}
+
+	/*
+	 * Building a shared object
+	 */
+
+	/*
+	 * Building a shared object - only GD & LD access models
+	 * will work here.
+	 */
+	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
+		    conv_reloc_amd64_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * LD access mode can only bind to local symbols.
+	 */
+	if (!local && IS_TLS_LD(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
+		    conv_reloc_amd64_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname),
+		    sdp->sd_file->ifl_name);
+		return (S_ERROR);
+	}
+
+
+	if (IS_TLS_LD(rtype) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+	    GOT_REF_TLSLD, ofl, rsp)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rflags = FLG_REL_GOT | FLG_REL_MTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+		rsp->rel_rtype = R_AMD64_DTPMOD64;
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = rtype;
+	} else if (IS_TLS_GD(rtype) &&
+	    ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSGD, ofl,
+	    rsp)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rflags = FLG_REL_GOT | FLG_REL_DTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+		rsp->rel_rtype = R_AMD64_DTPMOD64;
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		if (local == TRUE) {
+			rsp->rel_rtype = R_AMD64_DTPOFF64;
+			if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		} else {
+			rsp->rel_rtype = R_AMD64_DTPOFF64;
+			if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		}
+		rsp->rel_rtype = rtype;
+	}
+
+	if (IS_TLS_LD(rtype))
+		return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl));
+
+	return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl));
+}
+
+/* ARGSUSED3 */
+Gotndx *
+ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
+{
+	Listnode *	lnp;
+	Gotndx *	gnp;
+
+	assert(rdesc != 0);
+
+	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
+		return (ofl->ofl_tlsldgotndx);
+
+	for (LIST_TRAVERSE(lst, lnp, gnp)) {
+		if ((rdesc->rel_raddend == gnp->gn_addend) &&
+		    (gnp->gn_gotref == gref)) {
+			return (gnp);
+		}
+	}
+	return ((Gotndx *)0);
+}
+
+Xword
+ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
+{
+	Os_desc		*osp = ofl->ofl_osgot;
+	Sym_desc	*sdp = rdesc->rel_sym;
+	Xword		gotndx;
+	Gotref		gref;
+	Gotndx		*gnp;
+
+	if (rdesc->rel_flags & FLG_REL_DTLS)
+		gref = GOT_REF_TLSGD;
+	else if (rdesc->rel_flags & FLG_REL_MTLS)
+		gref = GOT_REF_TLSLD;
+	else if (rdesc->rel_flags & FLG_REL_STLS)
+		gref = GOT_REF_TLSIE;
+	else
+		gref = GOT_REF_GENERIC;
+
+	gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc);
+	assert(gnp);
+
+	gotndx = (Xword)gnp->gn_gotndx;
+
+	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
+	    (rdesc->rel_rtype == R_AMD64_DTPOFF64))
+		gotndx++;
+
+	return ((Xword)(osp->os_shdr->sh_addr + (gotndx * M_GOT_ENTSIZE)));
+}
+
+
+/* ARGSUSED5 */
+uintptr_t
+ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
+    Rel_desc * rsp, Sym_desc * sdp)
+{
+	Xword		raddend;
+	Gotndx		*gnp, *_gnp;
+	Listnode	*lnp, *plnp;
+	uint_t		gotents;
+
+	raddend = rsp->rel_raddend;
+	if (pgnp && (pgnp->gn_addend == raddend) &&
+	    (pgnp->gn_gotref == gref))
+		return (1);
+
+	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
+		gotents = 2;
+	else
+		gotents = 1;
+
+	plnp = 0;
+	for (LIST_TRAVERSE(lst, lnp, _gnp)) {
+		if (_gnp->gn_addend > raddend)
+			break;
+		plnp = lnp;
+	}
+
+	/*
+	 * Allocate a new entry.
+	 */
+	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
+		return (S_ERROR);
+	gnp->gn_addend = raddend;
+	gnp->gn_gotndx = ofl->ofl_gotcnt;
+	gnp->gn_gotref = gref;
+
+	ofl->ofl_gotcnt += gotents;
+
+	if (gref == GOT_REF_TLSLD) {
+		ofl->ofl_tlsldgotndx = gnp;
+		return (1);
+	}
+
+	if (plnp == 0) {
+		/*
+		 * Insert at head of list
+		 */
+		if (list_prependc(lst, (void *)gnp) == 0)
+			return (S_ERROR);
+	} else if (_gnp->gn_addend > raddend) {
+		/*
+		 * Insert in middle of lest
+		 */
+		if (list_insertc(lst, (void *)gnp, plnp) == 0)
+			return (S_ERROR);
+	} else {
+		/*
+		 * Append to tail of list
+		 */
+		if (list_appendc(lst, (void *)gnp) == 0)
+			return (S_ERROR);
+	}
+	return (1);
+}
+
+void
+ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
+{
+	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
+	sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++;
+	ofl->ofl_flags |= FLG_OF_BLDGOT;
+}
+
+static uchar_t plt0_template[M_PLT_ENTSIZE] = {
+/* 0x00 PUSHQ GOT+8(%rip) */	0xff, 0x35, 0x00, 0x00, 0x00, 0x00,
+/* 0x06 JMP   *GOT+16(%rip) */	0xff, 0x25, 0x00, 0x00, 0x00, 0x00,
+/* 0x0c NOP */			0x90,
+/* 0x0d NOP */			0x90,
+/* 0x0e NOP */			0x90,
+/* 0x0f NOP */			0x90
+};
+
+/*
+ * Initializes .got[0] with the _DYNAMIC symbol value.
+ */
+uintptr_t
+ld_fillin_gotplt(Ofl_desc * ofl)
+{
+	Word	flags = ofl->ofl_flags;
+	Word	dtflags1 = ofl->ofl_dtflags_1;
+
+	if (ofl->ofl_osgot) {
+		Sym_desc *	sdp;
+
+		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
+		    SYM_NOHASH, 0, ofl)) != NULL) {
+			uchar_t	*genptr =
+			    ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf +
+			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
+			/* LINTED */
+			*(Xword *)genptr = sdp->sd_sym->st_value;
+		}
+	}
+
+	/*
+	 * Fill in the reserved slot in the procedure linkage table the first
+	 * entry is:
+	 *	0x00 PUSHQ	GOT+8(%rip)	    # GOT[1]
+	 *	0x06 JMP	*GOT+16(%rip)	    # GOT[2]
+	 *	0x0c NOP
+	 *	0x0d NOP
+	 *	0x0e NOP
+	 *	0x0f NOP
+	 */
+	if ((flags & FLG_OF_DYNAMIC) && ofl->ofl_osplt) {
+		uchar_t		*pltent;
+		Xword		val1;
+
+		pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
+		bcopy(plt0_template, pltent, sizeof (plt0_template));
+
+		/*
+		 * filin:
+		 *	PUSHQ GOT + 8(%rip)
+		 *
+		 * Note: 0x06 below represents the offset to the
+		 *	 next instruction - which is what %rip will
+		 *	 be pointing at.
+		 */
+		val1 = (ofl->ofl_osgot->os_shdr->sh_addr) +
+			(M_GOT_XLINKMAP * M_GOT_ENTSIZE) -
+			ofl->ofl_osplt->os_shdr->sh_addr - 0x06;
+
+		/*
+		 * If '-z noreloc' is specified - skip the do_reloc
+		 * stage.
+		 */
+		if ((flags & FLG_OF_RELOBJ) ||
+		    !(dtflags1 & DF_1_NORELOC)) {
+			if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02],
+			    &val1, MSG_ORIG(MSG_SYM_PLTENT),
+			    MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_PLT_PLT0FAIL));
+				return (S_ERROR);
+			}
+		}
+
+		/*
+		 * filin:
+		 *  JMP	*GOT+16(%rip)
+		 */
+		val1 = (ofl->ofl_osgot->os_shdr->sh_addr) +
+			(M_GOT_XRTLD * M_GOT_ENTSIZE) -
+			ofl->ofl_osplt->os_shdr->sh_addr - 0x0c;
+		/*
+		 * If '-z noreloc' is specified - skip the do_reloc
+		 * stage.
+		 */
+		if ((flags & FLG_OF_RELOBJ) ||
+		    !(dtflags1 & DF_1_NORELOC)) {
+			if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x08],
+			    &val1, MSG_ORIG(MSG_SYM_PLTENT),
+			    MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_PLT_PLT0FAIL));
+				return (S_ERROR);
+			}
+		}
+	}
+	return (1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/machrel.intel.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,1568 @@
+/*
+ * 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 (c) 1990, 1991 UNIX System Laboratories, Inc.
+ *	Copyright (c) 1988 AT&T
+ *	  All Rights Reserved
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<string.h>
+#include	<stdio.h>
+#include	<sys/elf_386.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	"msg.h"
+#include	"_libld.h"
+
+Word
+ld_init_rel(Rel_desc *reld, void *reloc)
+{
+	Rel *	rel = (Rel *)reloc;
+
+	/* LINTED */
+	reld->rel_rtype = (Word)ELF_R_TYPE(rel->r_info);
+	reld->rel_roffset = rel->r_offset;
+	reld->rel_raddend = 0;
+	reld->rel_typedata = 0;
+
+	return ((Word)ELF_R_SYM(rel->r_info));
+}
+
+void
+ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
+{
+	ofl->ofl_dehdr->e_flags |= ehdr->e_flags;
+}
+
+void
+ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
+{
+	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
+		/*
+		 * Create this entry if we are going to create a PLT table.
+		 */
+		if (ofl->ofl_pltcnt)
+			(*cnt)++;		/* DT_PLTGOT */
+	}
+}
+
+void
+ld_mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn)
+{
+	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) {
+		(*dyn)->d_tag = DT_PLTGOT;
+		if (ofl->ofl_osgot)
+			(*dyn)->d_un.d_ptr = ofl->ofl_osgot->os_shdr->sh_addr;
+		else
+			(*dyn)->d_un.d_ptr = 0;
+		(*dyn)++;
+	}
+}
+
+Xword
+ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
+{
+	Xword	value;
+
+	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
+	    M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) * M_PLT_ENTSIZE);
+	return (value);
+}
+
+/*
+ *  Build a single plt entry - code is:
+ *	if (building a.out)
+ *		JMP	*got_off
+ *	else
+ *		JMP	*got_off@GOT(%ebx)
+ *	PUSHL	&rel_off
+ *	JMP	-n(%pc)		# -n is pcrel offset to first plt entry
+ *
+ *	The got_off@GOT entry gets filled with the address of the PUSHL,
+ *	so the first pass through the plt jumps back here, jumping
+ *	in turn to the first plt entry, which jumps to the dynamic
+ *	linker.	 The dynamic linker then patches the GOT, rerouting
+ *	future plt calls to the proper destination.
+ */
+static void
+plt_entry(Ofl_desc * ofl, Word rel_off, Sym_desc * sdp)
+{
+	uchar_t		*pltent, *gotent;
+	Sword		plt_off;
+	Word		got_off;
+
+	got_off = sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
+	plt_off = M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) *
+	    M_PLT_ENTSIZE);
+	pltent = (uchar_t *)(ofl->ofl_osplt->os_outdata->d_buf) + plt_off;
+	gotent = (uchar_t *)(ofl->ofl_osgot->os_outdata->d_buf) + got_off;
+
+	/*
+	 * Fill in the got entry with the address of the next instruction.
+	 */
+	/* LINTED */
+	*(Word *)gotent = ofl->ofl_osplt->os_shdr->sh_addr + plt_off +
+	    M_PLT_INSSIZE;
+
+	if (!(ofl->ofl_flags & FLG_OF_SHAROBJ)) {
+		pltent[0] = M_SPECIAL_INST;
+		pltent[1] = M_JMP_DISP_IND;
+		pltent += 2;
+		/* LINTED */
+		*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->sh_addr +
+			got_off);
+	} else {
+		pltent[0] = M_SPECIAL_INST;
+		pltent[1] = M_JMP_REG_DISP_IND;
+		pltent += 2;
+		/* LINTED */
+		*(Word *)pltent = (Word)got_off;
+	}
+	pltent += 4;
+
+	pltent[0] = M_INST_PUSHL;
+	pltent++;
+	/* LINTED */
+	*(Word *)pltent = (Word)rel_off;
+	pltent += 4;
+
+	plt_off = -(plt_off + 16);	/* JMP, PUSHL, JMP take 16 bytes */
+	pltent[0] = M_INST_JMP;
+	pltent++;
+	/* LINTED */
+	*(Word *)pltent = (Word)plt_off;
+}
+
+uintptr_t
+ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
+{
+	Os_desc *	relosp, * osp = 0;
+	Word		ndx, roffset, value;
+	Rel		rea;
+	char		*relbits;
+	Sym_desc *	sdp, * psym = (Sym_desc *)0;
+	int		sectmoved = 0;
+
+	sdp = orsp->rel_sym;
+
+	/*
+	 * If the section this relocation is against has been discarded
+	 * (-zignore), then also discard (skip) the relocation itself.
+	 */
+	if (orsp->rel_isdesc && ((orsp->rel_flags &
+	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
+	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
+		DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp));
+		return (1);
+	}
+
+	/*
+	 * If this is a relocation against a move table, or expanded move
+	 * table, adjust the relocation entries.
+	 */
+	if (orsp->rel_move)
+		ld_adj_movereloc(ofl, orsp);
+
+	/*
+	 * If this is a relocation against a section using a partial initialized
+	 * symbol, adjust the embedded symbol info.
+	 *
+	 * The second argument of the am_I_partial() is the value stored at the
+	 * target address relocation is going to be applied.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
+		if (ofl->ofl_parsym.head &&
+		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+		    /* LINTED */
+		    (psym = ld_am_I_partial(orsp, *(Xword *)
+		    ((uchar_t *)(orsp->rel_isdesc->is_indata->d_buf) +
+		    orsp->rel_roffset)))) {
+			DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym));
+			sectmoved = 1;
+		    }
+	}
+
+	value = sdp->sd_sym->st_value;
+
+	if (orsp->rel_flags & FLG_REL_GOT) {
+		osp = ofl->ofl_osgot;
+		roffset = (Word)ld_calc_got_offset(orsp, ofl);
+
+	} else if (orsp->rel_flags & FLG_REL_PLT) {
+		/*
+		 * Note that relocations for PLT's actually
+		 * cause a relocation againt the GOT.
+		 */
+		osp = ofl->ofl_osplt;
+		roffset = (Word) (ofl->ofl_osgot->os_shdr->sh_addr) +
+		    sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
+
+		plt_entry(ofl, osp->os_relosdesc->os_szoutrels, sdp);
+
+	} else if (orsp->rel_flags & FLG_REL_BSS) {
+		/*
+		 * This must be a R_386_COPY.  For these set the roffset to
+		 * point to the new symbols location.
+		 */
+		osp = ofl->ofl_isbss->is_osdesc;
+		roffset = (Word)value;
+	} else {
+		osp = orsp->rel_osdesc;
+
+		/*
+		 * Calculate virtual offset of reference point; equals offset
+		 * into section + vaddr of section for loadable sections, or
+		 * offset plus section displacement for nonloadable sections.
+		 */
+		roffset = orsp->rel_roffset +
+		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
+		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
+			roffset += orsp->rel_isdesc->is_osdesc->
+			    os_shdr->sh_addr;
+	}
+
+	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
+		relosp = ofl->ofl_osrel;
+
+	/*
+	 * Assign the symbols index for the output relocation.  If the
+	 * relocation refers to a SECTION symbol then it's index is based upon
+	 * the output sections symbols index.  Otherwise the index can be
+	 * derived from the symbols index itself.
+	 */
+	if (orsp->rel_rtype == R_386_RELATIVE)
+		ndx = STN_UNDEF;
+	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
+		if (sectmoved == 0) {
+			/*
+			 * Check for a null input section. This can
+			 * occur if this relocation references a symbol
+			 * generated by sym_add_sym().
+			 */
+			if ((sdp->sd_isc != 0) &&
+			    (sdp->sd_isc->is_osdesc != 0))
+				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
+			else
+				ndx = sdp->sd_shndx;
+		} else
+			ndx = ofl->ofl_sunwdata1ndx;
+	} else
+		ndx = sdp->sd_symndx;
+
+	relbits = (char *)relosp->os_outdata->d_buf;
+
+	rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype);
+	rea.r_offset = roffset;
+	DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_REL, &rea, relosp->os_name,
+	    orsp->rel_sname));
+
+	/*
+	 * Assert we haven't walked off the end of our relocation table.
+	 */
+	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
+
+	(void) memcpy((relbits + relosp->os_szoutrels),
+	    (char *)&rea, sizeof (Rel));
+	relosp->os_szoutrels += sizeof (Rel);
+
+	/*
+	 * Determine if this relocation is against a non-writable, allocatable
+	 * section.  If so we may need to provide a text relocation diagnostic.
+	 * Note that relocations against the .plt (R_386_JMP_SLOT) actually
+	 * result in modifications to the .got.
+	 */
+	if (orsp->rel_rtype == R_386_JMP_SLOT)
+		osp = ofl->ofl_osgot;
+
+	ld_reloc_remain_entry(orsp, osp, ofl);
+	return (1);
+}
+
+/*
+ * i386 Instructions for TLS processing
+ */
+static uchar_t tlsinstr_gd_ie[] = {
+	/*
+	 * 0x00	movl %gs:0x0, %eax
+	 */
+	0x65, 0xa1, 0x00, 0x00, 0x00, 0x00,
+	/*
+	 * 0x06	addl x(%eax), %eax
+	 * 0x0c ...
+	 */
+	0x03, 0x80, 0x00, 0x00, 0x00, 0x00
+};
+
+static uchar_t tlsinstr_gd_le[] = {
+	/*
+	 * 0x00 movl %gs:0x0, %eax
+	 */
+	0x65, 0xa1, 0x00, 0x00, 0x00, 0x00,
+	/*
+	 * 0x06 addl $0x0, %eax
+	 */
+	0x05, 0x00, 0x00, 0x00, 0x00,
+	/*
+	 * 0x0b nop
+	 * 0x0c
+	 */
+	0x90
+};
+
+static uchar_t tlsinstr_gd_ie_movgs[] = {
+	/*
+	 *	movl %gs:0x0,%eax
+	 */
+	0x65, 0xa1, 0x00, 0x00, 0x00, 00
+};
+
+#define	TLS_GD_IE_MOV	0x8b	/* movl opcode */
+#define	TLS_GD_IE_POP	0x58	/* popl + reg */
+
+#define	TLS_GD_LE_MOVL	0xb8	/* movl + reg */
+
+#define	TLS_NOP		0x90	/* NOP instruction */
+
+#define	MODRM_MSK_MOD	0xc0
+#define	MODRM_MSK_RO	0x38
+#define	MODRM_MSK_RM	0x07
+
+#define	SIB_MSK_SS	0xc0
+#define	SIB_MSK_IND	0x38
+#define	SIB_MSK_BS	0x07
+
+static Fixupret
+tls_fixups(Ofl_desc *ofl, Rel_desc *arsp)
+{
+	Sym_desc	*sdp = arsp->rel_sym;
+	Word		rtype = arsp->rel_rtype;
+	uchar_t		*offset, r1, r2;
+
+	offset = (uchar_t *)((uintptr_t)arsp->rel_roffset +
+	    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
+	    (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
+
+	if (sdp->sd_ref == REF_DYN_NEED) {
+		/*
+		 * IE reference model
+		 */
+		switch (rtype) {
+		case R_386_TLS_GD:
+			/*
+			 * Transition:
+			 *	0x0 leal x@tlsgd(,r1,1), %eax
+			 *	0x7 call ___tls_get_addr
+			 *	0xc
+			 * To:
+			 *	0x0 movl %gs:0, %eax
+			 *	0x6 addl x@gotntpoff(r1), %eax
+			 */
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_386_TLS_GOTIE, arsp->rel_roffset,
+			    sdp->sd_name));
+			arsp->rel_rtype = R_386_TLS_GOTIE;
+			arsp->rel_roffset += 5;
+
+			/*
+			 * Addjust 'offset' to beginning of instruction
+			 * sequence.
+			 */
+			offset -= 3;
+			r1 = (offset[2] & SIB_MSK_IND) >> 3;
+			(void) memcpy(offset, tlsinstr_gd_ie,
+			    sizeof (tlsinstr_gd_ie));
+
+			/*
+			 * set register %r1 into the addl
+			 * instruction.
+			 */
+			offset[0x7] |= r1;
+			return (FIX_RELOC);
+
+		case R_386_TLS_GD_PLT:
+			/*
+			 * Fixup done via the TLS_GD relocation
+			 */
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_386_NONE, arsp->rel_roffset,
+			    sdp->sd_name));
+			return (FIX_DONE);
+		}
+	}
+
+	/*
+	 * LE reference model
+	 */
+	switch (rtype) {
+	case R_386_TLS_GD:
+		/*
+		 * Transition:
+		 *	0x0 leal x@tlsgd(,r1,1), %eax
+		 *	0x7 call ___tls_get_addr
+		 *	0xc
+		 * To:
+		 *	0x0 movl %gs:0, %eax
+		 *	0x6 addl $x@ntpoff, %eax
+		 *	0xb nop
+		 *	0xc
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name));
+
+		arsp->rel_rtype = R_386_TLS_LE;
+		arsp->rel_roffset += 4;
+
+		/*
+		 * Addjust 'offset' to beginning of instruction
+		 * sequence.
+		 */
+		offset -= 3;
+		(void) memcpy(offset, tlsinstr_gd_le,
+		    sizeof (tlsinstr_gd_le));
+		return (FIX_RELOC);
+
+	case R_386_TLS_GD_PLT:
+	case R_386_PLT32:
+		/*
+		 * Fixup done via the TLS_GD relocation
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name));
+		return (FIX_DONE);
+
+	case R_386_TLS_LDM_PLT:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name));
+
+		/*
+		 * Transition:
+		 *	call __tls_get_addr()
+		 * to:
+		 *	nop
+		 *	nop
+		 *	nop
+		 *	nop
+		 *	nop
+		 */
+		*(offset - 1) = TLS_NOP;
+		*(offset) = TLS_NOP;
+		*(offset + 1) = TLS_NOP;
+		*(offset + 2) = TLS_NOP;
+		*(offset + 3) = TLS_NOP;
+		return (FIX_DONE);
+
+	case R_386_TLS_LDM:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name));
+
+		/*
+		 * Transition:
+		 *
+		 *  0x00 leal x1@tlsldm(%ebx), %eax
+		 *  0x06 call ___tls_get_addr
+		 *
+		 * to:
+		 *
+		 *  0x00 movl %gs:0, %eax
+		 */
+		(void) memcpy(offset - 2, tlsinstr_gd_ie_movgs,
+		    sizeof (tlsinstr_gd_ie_movgs));
+		return (FIX_DONE);
+
+	case R_386_TLS_LDO_32:
+		/*
+		 *  Instructions:
+		 *
+		 *  0x10 leal x1@dtpoff(%eax), %edx	R_386_TLS_LDO_32
+		 *		to
+		 *  0x10 leal x1@ntpoff(%eax), %edx	R_386_TLS_LE
+		 *
+		 */
+		offset -= 2;
+
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_386_TLS_LE;
+		return (FIX_RELOC);
+
+	case R_386_TLS_GOTIE:
+		/*
+		 * These transitions are a little different than the
+		 * others, in that we could have multiple instructions
+		 * pointed to by a single relocation.  Depending upon the
+		 * instruction, we perform a different code transition.
+		 *
+		 * Here's the known transitions:
+		 *
+		 *  1) movl foo@gotntpoff(%reg1), %reg2
+		 *	0x8b, 0x80 | (reg2 << 3) | reg1, foo@gotntpoff
+		 *
+		 *  2) addl foo@gotntpoff(%reg1), %reg2
+		 *	0x03, 0x80 | (reg2 << 3) | reg1, foo@gotntpoff
+		 *
+		 *  Transitions IE -> LE
+		 *
+		 *  1) movl $foo@ntpoff, %reg2
+		 *	0xc7, 0xc0 | reg2, foo@ntpoff
+		 *
+		 *  2) addl $foo@ntpoff, %reg2
+		 *	0x81, 0xc0 | reg2, foo@ntpoff
+		 *
+		 * Note: reg1 != 4 (%esp)
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+		    rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_386_TLS_LE;
+
+		offset -= 2;
+		r2 = (offset[1] & MODRM_MSK_RO) >> 3;
+		if (offset[0] == 0x8b) {
+			/* case 1 above */
+			offset[0] = 0xc7;	/* movl */
+			offset[1] = 0xc0 | r2;
+			return (FIX_RELOC);
+		}
+
+		if (offset[0] == 0x03) {
+			/* case 2 above */
+			assert(offset[0] == 0x03);
+			offset[0] = 0x81;	/* addl */
+			offset[1] = 0xc0 | r2;
+			return (FIX_RELOC);
+		}
+
+		/*
+		 * Unexpected instruction sequence - fatal error.
+		 */
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS),
+		    conv_reloc_386_type(arsp->rel_rtype),
+		    arsp->rel_isdesc->is_file->ifl_name,
+		    demangle(arsp->rel_sname), arsp->rel_isdesc->is_name,
+		    EC_OFF(arsp->rel_roffset));
+		return (FIX_ERROR);
+
+	case R_386_TLS_IE:
+		/*
+		 * These transitions are a little different than the
+		 * others, in that we could have multiple instructions
+		 * pointed to by a single relocation.  Depending upon the
+		 * instruction, we perform a different code transition.
+		 *
+		 * Here's the known transitions:
+		 *  1) movl foo@indntpoff, %eax
+		 *	0xa1, foo@indntpoff
+		 *
+		 *  2) movl foo@indntpoff, %eax
+		 *	0x8b, 0x05 | (reg << 3), foo@gotntpoff
+		 *
+		 *  3) addl foo@indntpoff, %eax
+		 *	0x03, 0x05 | (reg << 3), foo@gotntpoff
+		 *
+		 *  Transitions IE -> LE
+		 *
+		 *  1) movl $foo@ntpoff, %eax
+		 *	0xb8, foo@ntpoff
+		 *
+		 *  2) movl $foo@ntpoff, %reg
+		 *	0xc7, 0xc0 | reg, foo@ntpoff
+		 *
+		 *  3) addl $foo@ntpoff, %reg
+		 *	0x81, 0xc0 | reg, foo@ntpoff
+		 */
+		arsp->rel_rtype = R_386_TLS_LE;
+		offset--;
+		if (offset[0] == 0xa1) {
+			/* case 1 above */
+			offset[0] = 0xb8;	/*  movl */
+			return (FIX_RELOC);
+		}
+
+		offset--;
+		if (offset[0] == 0x8b) {
+			/* case 2 above */
+			r2 = (offset[1] & MODRM_MSK_RO) >> 3;
+			offset[0] = 0xc7;	/* movl */
+			offset[1] = 0xc0 | r2;
+			return (FIX_RELOC);
+		}
+		if (offset[0] == 0x03) {
+			/* case 3 above */
+			r2 = (offset[1] & MODRM_MSK_RO) >> 3;
+			offset[0] = 0x81;	/* addl */
+			offset[1] = 0xc0 | r2;
+			return (FIX_RELOC);
+		}
+		/*
+		 * Unexpected instruction sequence - fatal error.
+		 */
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS),
+		    conv_reloc_386_type(arsp->rel_rtype),
+		    arsp->rel_isdesc->is_file->ifl_name,
+		    demangle(arsp->rel_sname), arsp->rel_isdesc->is_name,
+		    EC_OFF(arsp->rel_roffset));
+		return (FIX_ERROR);
+	}
+	return (FIX_RELOC);
+}
+
+uintptr_t
+ld_do_activerelocs(Ofl_desc *ofl)
+{
+	Rel_desc	*arsp;
+	Rel_cache	*rcp;
+	Listnode	*lnp;
+	uintptr_t	return_code = 1;
+	Word		flags = ofl->ofl_flags;
+	Word		dtflags1 = ofl->ofl_dtflags_1;
+
+	DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml));
+	/*
+	 * Process active relocations.
+	 */
+	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
+		/* LINTED */
+		for (arsp = (Rel_desc *)(rcp + 1);
+		    arsp < rcp->rc_free; arsp++) {
+			uchar_t		*addr;
+			Xword 		value;
+			Sym_desc	*sdp;
+			const char	*ifl_name;
+			Xword		refaddr;
+			int		moved = 0;
+			Gotref		gref;
+
+			/*
+			 * If the section this relocation is against has been
+			 * discarded (-zignore), then discard (skip) the
+			 * relocation itself.
+			 */
+			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
+			    ((arsp->rel_flags &
+			    (FLG_REL_GOT | FLG_REL_BSS |
+			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
+				DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml,
+				    M_MACH, arsp));
+				continue;
+			}
+
+			/*
+			 * We deteremine what the 'got reference'
+			 * model (if required) is at this point.  This
+			 * needs to be done before tls_fixup() since
+			 * it may 'transition' our instructions.
+			 *
+			 * The got table entries have already been assigned,
+			 * and we bind to those initial entries.
+			 */
+			if (arsp->rel_flags & FLG_REL_DTLS)
+				gref = GOT_REF_TLSGD;
+			else if (arsp->rel_flags & FLG_REL_MTLS)
+				gref = GOT_REF_TLSLD;
+			else if (arsp->rel_flags & FLG_REL_STLS)
+				gref = GOT_REF_TLSIE;
+			else
+				gref = GOT_REF_GENERIC;
+
+			/*
+			 * Perform any required TLS fixups.
+			 */
+			if (arsp->rel_flags & FLG_REL_TLSFIX) {
+				Fixupret	ret;
+
+				if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR)
+					return (S_ERROR);
+				if (ret == FIX_DONE)
+					continue;
+			}
+
+			/*
+			 * If this is a relocation against a move table, or
+			 * expanded move table, adjust the relocation entries.
+			 */
+			if (arsp->rel_move)
+				ld_adj_movereloc(ofl, arsp);
+
+			sdp = arsp->rel_sym;
+			refaddr = arsp->rel_roffset +
+			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
+
+			if (arsp->rel_flags & FLG_REL_CLVAL)
+				value = 0;
+			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
+			    STT_SECTION) {
+				Sym_desc	*sym;
+
+				/*
+				 * The value for a symbol pointing to a SECTION
+				 * is based off of that sections position.
+				 *
+				 * The second argument of the ld_am_I_partial()
+				 * is the value stored at the target address
+				 * relocation is going to be applied.
+				 */
+				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+				    /* LINTED */
+				    (sym = ld_am_I_partial(arsp, *(Xword *)
+				    ((uchar_t *)
+				    arsp->rel_isdesc->is_indata->d_buf +
+				    arsp->rel_roffset)))) {
+					/*
+					 * If the symbol is moved,
+					 * adjust the value
+					 */
+					value = sym->sd_sym->st_value;
+					moved = 1;
+				} else {
+					value = _elf_getxoff(
+					    sdp->sd_isc->is_indata);
+					if (sdp->sd_isc->is_shdr->sh_flags &
+					    SHF_ALLOC)
+						value += sdp->sd_isc->
+						    is_osdesc->os_shdr->sh_addr;
+				}
+				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
+					value -= ofl->ofl_tlsphdr->p_vaddr;
+			} else {
+				/*
+				 * else the value is the symbols value
+				 */
+				value = sdp->sd_sym->st_value;
+			}
+
+			/*
+			 * Relocation against the GLOBAL_OFFSET_TABLE.
+			 */
+			if (arsp->rel_flags & FLG_REL_GOT)
+				arsp->rel_osdesc = ofl->ofl_osgot;
+
+			/*
+			 * If loadable and not producing a relocatable object
+			 * add the sections virtual address to the reference
+			 * address.
+			 */
+			if ((arsp->rel_flags & FLG_REL_LOAD) &&
+			    ((flags & FLG_OF_RELOBJ) == 0))
+				refaddr += arsp->rel_isdesc->is_osdesc->
+				    os_shdr->sh_addr;
+
+			/*
+			 * If this entry has a PLT assigned to it, it's
+			 * value is actually the address of the PLT (and
+			 * not the address of the function).
+			 */
+			if (IS_PLT(arsp->rel_rtype)) {
+				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
+					value = ld_calc_plt_addr(sdp, ofl);
+			}
+
+			/*
+			 * Determine whether the value needs further adjustment.
+			 * Filter through the attributes of the relocation to
+			 * determine what adjustment is required.  Note, many
+			 * of the following cases are only applicable when a
+			 * .got is present.  As a .got is not generated when a
+			 * relocatable object is being built, any adjustments
+			 * that require a .got need to be skipped.
+			 */
+			if ((arsp->rel_flags & FLG_REL_GOT) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword		R1addr;
+				uintptr_t	R2addr;
+				Word		gotndx;
+				Gotndx		*gnp;
+
+				/*
+				 * Perform relocation against GOT table.  Since
+				 * this doesn't fit exactly into a relocation
+				 * we place the appropriate byte in the GOT
+				 * directly
+				 *
+				 * Calculate offset into GOT at which to apply
+				 * the relocation.
+				 */
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, 0);
+				assert(gnp);
+
+				if (arsp->rel_rtype == R_386_TLS_DTPOFF32)
+					gotndx = gnp->gn_gotndx + 1;
+				else
+					gotndx = gnp->gn_gotndx;
+
+				R1addr = (Xword)(gotndx * M_GOT_ENTSIZE);
+
+				/*
+				 * Add the GOTs data's offset.
+				 */
+				R2addr = R1addr + (uintptr_t)
+				    arsp->rel_osdesc->os_outdata->d_buf;
+
+				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
+				    ELF_DBG_LD, M_MACH, SHT_REL,
+				    arsp->rel_rtype, R1addr, value,
+				    arsp->rel_sname, arsp->rel_osdesc));
+
+				/*
+				 * And do it.
+				 */
+				*(Xword *)R2addr = value;
+				continue;
+
+			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				value -= ofl->ofl_osgot->os_shdr->sh_addr;
+
+			} else if (IS_GOT_PC(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				value =
+				    (Xword)(ofl->ofl_osgot->os_shdr->sh_addr) -
+				    refaddr;
+
+			} else if ((IS_PC_RELATIVE(arsp->rel_rtype)) &&
+			    (((flags & FLG_OF_RELOBJ) == 0) ||
+			    (arsp->rel_osdesc == sdp->sd_isc->is_osdesc))) {
+				value -= refaddr;
+
+			} else if (IS_TLS_INS(arsp->rel_rtype) &&
+			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx	*gnp;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, 0);
+				assert(gnp);
+				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
+				if (arsp->rel_rtype == R_386_TLS_IE) {
+					value +=
+					    ofl->ofl_osgot->os_shdr->sh_addr;
+				}
+
+			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx *gnp;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+				    GOT_REF_GENERIC, ofl, 0);
+				assert(gnp);
+				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
+
+			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword	tlsstatsize;
+
+				/*
+				 * This is the LE TLS reference model.  Static
+				 * offset is hard-coded.
+				 */
+				tlsstatsize =
+				    S_ROUND(ofl->ofl_tlsphdr->p_memsz,
+				    M_TLSSTATALIGN);
+				value = tlsstatsize - value;
+
+				/*
+				 * Since this code is fixed up, it assumes a
+				 * negative offset that can be added to the
+				 * thread pointer.
+				 */
+				if ((arsp->rel_rtype == R_386_TLS_LDO_32) ||
+				    (arsp->rel_rtype == R_386_TLS_LE))
+					value = -value;
+			}
+
+			if (arsp->rel_isdesc->is_file)
+				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
+			else
+				ifl_name = MSG_INTL(MSG_STR_NULL);
+
+			/*
+			 * Make sure we have data to relocate.  Compiler and
+			 * assembler developers have been known to generate
+			 * relocations against invalid sections (normally .bss),
+			 * so for their benefit give them sufficient information
+			 * to help analyze the problem.  End users should never
+			 * see this.
+			 */
+			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_EMPTYSEC),
+				    conv_reloc_386_type(arsp->rel_rtype),
+				    ifl_name, demangle(arsp->rel_sname),
+				    arsp->rel_isdesc->is_name);
+				return (S_ERROR);
+			}
+
+			/*
+			 * Get the address of the data item we need to modify.
+			 */
+			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
+			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
+			    is_indata));
+
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			    M_MACH, SHT_REL, arsp->rel_rtype, EC_NATPTR(addr),
+			    value, arsp->rel_sname, arsp->rel_osdesc));
+			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
+
+			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) >
+			    ofl->ofl_size) || (arsp->rel_roffset >
+			    arsp->rel_osdesc->os_shdr->sh_size)) {
+				int	class;
+
+				if (((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size)
+					class = ERR_FATAL;
+				else
+					class = ERR_WARNING;
+
+				eprintf(ofl->ofl_lml, class,
+				    MSG_INTL(MSG_REL_INVALOFFSET),
+				    conv_reloc_386_type(arsp->rel_rtype),
+				    ifl_name, arsp->rel_isdesc->is_name,
+				    demangle(arsp->rel_sname),
+				    EC_ADDR((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr));
+
+				if (class == ERR_FATAL) {
+					return_code = S_ERROR;
+					continue;
+				}
+			}
+
+			/*
+			 * The relocation is additive.  Ignore the previous
+			 * symbol value if this local partial symbol is
+			 * expanded.
+			 */
+			if (moved)
+				value -= *addr;
+
+			/*
+			 * If '-z noreloc' is specified - skip the do_reloc
+			 * stage.
+			 */
+			if ((flags & FLG_OF_RELOBJ) ||
+			    !(dtflags1 & DF_1_NORELOC)) {
+				if (do_reloc((uchar_t)arsp->rel_rtype, addr,
+				    &value, arsp->rel_sname, ifl_name,
+				    ofl->ofl_lml) == 0)
+					return_code = S_ERROR;
+			}
+		}
+	}
+	return (return_code);
+}
+
+/*
+ * Add an output relocation record.
+ */
+uintptr_t
+ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
+{
+	Rel_desc	*orsp;
+	Rel_cache	*rcp;
+	Sym_desc	*sdp = rsp->rel_sym;
+
+	/*
+	 * Static executables *do not* want any relocations against them.
+	 * Since our engine still creates relocations against a WEAK UNDEFINED
+	 * symbol in a static executable, it's best to disable them here
+	 * instead of through out the relocation code.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC))
+		return (1);
+
+	/*
+	 * If no relocation cache structures are available allocate
+	 * a new one and link it into the cache list.
+	 */
+	if ((ofl->ofl_outrels.tail == 0) ||
+	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
+	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
+		static size_t	nextsize = 0;
+		size_t		size;
+
+		/*
+		 * Output relocation numbers can vary considerably between
+		 * building executables or shared objects (pic vs. non-pic),
+		 * etc.  But, they typically aren't very large, so for these
+		 * objects use a standard bucket size.  For building relocatable
+		 * objects, typically there will be an output relocation for
+		 * every input relocation.
+		 */
+		if (nextsize == 0) {
+			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
+				if ((size = ofl->ofl_relocincnt) == 0)
+					size = REL_LOIDESCNO;
+				if (size > REL_HOIDESCNO)
+					nextsize = REL_HOIDESCNO;
+				else
+					nextsize = REL_LOIDESCNO;
+			} else
+				nextsize = size = REL_HOIDESCNO;
+		} else
+			size = nextsize;
+
+		size = size * sizeof (Rel_desc);
+
+		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
+		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
+			return (S_ERROR);
+
+		/* LINTED */
+		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
+		/* LINTED */
+		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
+	}
+
+	/*
+	 * If we are adding a output relocation against a section
+	 * symbol (non-RELATIVE) then mark that section.  These sections
+	 * will be added to the .dynsym symbol table.
+	 */
+	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
+	    ((flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
+
+		/*
+		 * If this is a COMMON symbol - no output section
+		 * exists yet - (it's created as part of sym_validate()).
+		 * So - we mark here that when it's created it should
+		 * be tagged with the FLG_OS_OUTREL flag.
+		 */
+		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
+		    (sdp->sd_shndx == SHN_COMMON)) {
+			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
+				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
+			else
+				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
+		} else {
+			Os_desc	*osp = sdp->sd_isc->is_osdesc;
+
+			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
+				ofl->ofl_dynshdrcnt++;
+				osp->os_flags |= FLG_OS_OUTREL;
+			}
+		}
+	}
+
+	*orsp = *rsp;
+	orsp->rel_flags |= flags;
+
+	rcp->rc_free++;
+	ofl->ofl_outrelscnt++;
+
+	if (flags & FLG_REL_GOT)
+		ofl->ofl_relocgotsz += (Xword)sizeof (Rel);
+	else if (flags & FLG_REL_PLT)
+		ofl->ofl_relocpltsz += (Xword)sizeof (Rel);
+	else if (flags & FLG_REL_BSS)
+		ofl->ofl_relocbsssz += (Xword)sizeof (Rel);
+	else if (flags & FLG_REL_NOINFO)
+		ofl->ofl_relocrelsz += (Xword)sizeof (Rel);
+	else
+		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rel);
+
+	if (orsp->rel_rtype == M_R_RELATIVE)
+		ofl->ofl_relocrelcnt++;
+
+	/*
+	 * We don't perform sorting on PLT relocations because
+	 * they have already been assigned a PLT index and if we
+	 * were to sort them we would have to re-assign the plt indexes.
+	 */
+	if (!(flags & FLG_REL_PLT))
+		ofl->ofl_reloccnt++;
+
+	/*
+	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
+	 */
+	if (IS_GOT_REQUIRED(orsp->rel_rtype))
+		ofl->ofl_flags |= FLG_OF_BLDGOT;
+
+	/*
+	 * Identify and possibly warn of a displacement relocation.
+	 */
+	if (orsp->rel_flags & FLG_REL_DISP) {
+		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
+
+		if (ofl->ofl_flags & FLG_OF_VERBOSE)
+			ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
+	}
+	DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_REL,
+	    M_MACH, orsp));
+	return (1);
+}
+
+/*
+ * Stub routine since register symbols are not supported on i386.
+ */
+/* ARGSUSED */
+uintptr_t
+ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
+{
+	eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOREG));
+	return (S_ERROR);
+}
+
+/*
+ * process relocation for a LOCAL symbol
+ */
+uintptr_t
+ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		flags = ofl->ofl_flags;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		shndx = rsp->rel_sym->sd_shndx;
+
+	/*
+	 * if ((shared object) and (not pc relative relocation) and
+	 *    (not against ABS symbol))
+	 * then
+	 *	build R_386_RELATIVE
+	 * fi
+	 */
+	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
+	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
+	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
+	    !(rsp->rel_isdesc != NULL &&
+	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
+	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
+	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
+		Word	ortype = rsp->rel_rtype;
+
+		rsp->rel_rtype = R_386_RELATIVE;
+		if (ld_add_outrel(NULL, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = ortype;
+	}
+
+	/*
+	 * If the relocation is against a 'non-allocatable' section
+	 * and we can not resolve it now - then give a warning
+	 * message.
+	 *
+	 * We can not resolve the symbol if either:
+	 *	a) it's undefined
+	 *	b) it's defined in a shared library and a
+	 *	   COPY relocation hasn't moved it to the executable
+	 *
+	 * Note: because we process all of the relocations against the
+	 *	text segment before any others - we know whether
+	 *	or not a copy relocation will be generated before
+	 *	we get here (see reloc_init()->reloc_segments()).
+	 */
+	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
+	    ((shndx == SHN_UNDEF) ||
+	    ((sdp->sd_ref == REF_DYN_NEED) &&
+	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
+		/*
+		 * If the relocation is against a SHT_SUNW_ANNOTATE
+		 * section - then silently ignore that the relocation
+		 * can not be resolved.
+		 */
+		if (rsp->rel_osdesc &&
+		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
+			return (0);
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM),
+		    conv_reloc_386_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
+		return (1);
+	}
+
+	/*
+	 * Perform relocation.
+	 */
+	return (ld_add_actrel(NULL, rsp, ofl));
+}
+
+uintptr_t
+/* ARGSUSED */
+ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	/*
+	 * Stub routine for common code compatibility, we shouldn't
+	 * actually get here on x86.
+	 */
+	assert(0);
+	return (S_ERROR);
+}
+
+uintptr_t
+ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		rtype = rsp->rel_rtype;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		flags = ofl->ofl_flags;
+	Word		rflags;
+	Gotndx		*gnp;
+
+	/*
+	 * all TLS relocations are illegal in a static executable.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
+		    conv_reloc_386_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * Any TLS relocation must be against a STT_TLS symbol, all others
+	 * are illegal.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
+		Ifl_desc	*ifl = rsp->rel_isdesc->is_file;
+
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
+		    conv_reloc_386_type(rsp->rel_rtype),
+		    ifl->ifl_name, demangle(rsp->rel_sname),
+		    conv_sym_info_type(ifl->ifl_ehdr->e_machine,
+		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
+		return (S_ERROR);
+	}
+
+	/*
+	 * We're a executable - use either the IE or LE
+	 * access model.
+	 */
+	if (flags & FLG_OF_EXEC) {
+		/*
+		 * If we are using either IE or LE reference
+		 * model set the DF_STATIC_TLS flag.
+		 */
+		ofl->ofl_dtflags |= DF_STATIC_TLS;
+
+		if (!local) {
+			Gotref	gref;
+			/*
+			 * IE access model
+			 */
+			/*
+			 * It's not possible for LD or LE reference
+			 * models to reference a symbol external to
+			 * the current object.
+			 */
+			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_TLSBND),
+				    conv_reloc_386_type(rsp->rel_rtype),
+				    rsp->rel_isdesc->is_file->ifl_name,
+				    demangle(rsp->rel_sname),
+				    sdp->sd_file->ifl_name);
+				return (S_ERROR);
+			}
+
+			gref = GOT_REF_TLSIE;
+
+			/*
+			 * Assign a GOT entry for static TLS references
+			 */
+			if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+			    gref, ofl, 0)) == 0) {
+				if (ld_assign_gotndx(&(sdp->sd_GOTndxs),
+				    gnp, gref, ofl, rsp, sdp) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = R_386_TLS_TPOFF;
+				if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS),
+				    rsp, ofl) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = rtype;
+			}
+			if (IS_TLS_IE(rtype))
+				return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+
+			/*
+			 * If (GD or LD) reference models - fixups
+			 * are required.
+			 */
+			return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+			    rsp, ofl));
+		}
+		/*
+		 * LE access model
+		 */
+		if (IS_TLS_LE(rtype) || (rtype == R_386_TLS_LDO_32))
+			return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+
+		return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+		    rsp, ofl));
+	}
+
+	/*
+	 * Building a shared object
+	 */
+
+	/*
+	 * Building a shared object - only GD & LD access models
+	 * will work here.
+	 */
+	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
+		    conv_reloc_386_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * LD access mode can only bind to local symbols.
+	 */
+	if (!local && IS_TLS_LD(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
+		    conv_reloc_386_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname),
+		    sdp->sd_file->ifl_name);
+		return (S_ERROR);
+	}
+
+
+	if (IS_TLS_LD(rtype) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+	    GOT_REF_TLSLD, ofl, 0)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rflags = FLG_REL_GOT | FLG_REL_MTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+		rsp->rel_rtype = R_386_TLS_DTPMOD32;
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = rtype;
+	} else if (IS_TLS_GD(rtype) &&
+	    ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSGD,
+	    ofl, 0)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rflags = FLG_REL_GOT | FLG_REL_DTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+		rsp->rel_rtype = R_386_TLS_DTPMOD32;
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		if (local == TRUE) {
+			rsp->rel_rtype = R_386_TLS_DTPOFF32;
+			if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		} else {
+			rsp->rel_rtype = R_386_TLS_DTPOFF32;
+			if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		}
+		rsp->rel_rtype = rtype;
+	}
+	/*
+	 * For GD/LD TLS reference - TLS_{GD,LD}_CALL, this will eventually
+	 * cause a call to __tls_get_addr().  Let's convert this
+	 * relocation to that symbol now, and prepare for the PLT magic.
+	 */
+	if ((rtype == R_386_TLS_GD_PLT) || (rtype == R_386_TLS_LDM_PLT)) {
+		Sym_desc *	tlsgetsym;
+
+		if ((tlsgetsym = ld_sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_UU),
+		    ofl)) == (Sym_desc *)S_ERROR)
+			return (S_ERROR);
+		rsp->rel_sym = tlsgetsym;
+		rsp->rel_sname = tlsgetsym->sd_name;
+		rsp->rel_rtype = R_386_PLT32;
+		if (ld_reloc_plt(rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_sym = sdp;
+		rsp->rel_sname = sdp->sd_name;
+		rsp->rel_rtype = rtype;
+		return (1);
+	}
+
+	if (IS_TLS_LD(rtype))
+		return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl));
+
+	return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl));
+}
+
+/* ARGSUSED3 */
+Gotndx *
+ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
+{
+	Listnode *	lnp;
+	Gotndx *	gnp;
+
+	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
+		return (ofl->ofl_tlsldgotndx);
+
+	for (LIST_TRAVERSE(lst, lnp, gnp)) {
+		if (gnp->gn_gotref == gref)
+			return (gnp);
+	}
+	return ((Gotndx *)0);
+}
+
+Xword
+ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
+{
+	Os_desc		*osp = ofl->ofl_osgot;
+	Sym_desc	*sdp = rdesc->rel_sym;
+	Xword		gotndx;
+	Gotref		gref;
+	Gotndx		*gnp;
+
+	if (rdesc->rel_flags & FLG_REL_DTLS)
+		gref = GOT_REF_TLSGD;
+	else if (rdesc->rel_flags & FLG_REL_MTLS)
+		gref = GOT_REF_TLSLD;
+	else if (rdesc->rel_flags & FLG_REL_STLS)
+		gref = GOT_REF_TLSIE;
+	else
+		gref = GOT_REF_GENERIC;
+
+	gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0);
+	assert(gnp);
+
+	gotndx = (Xword)gnp->gn_gotndx;
+
+	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
+	    (rdesc->rel_rtype == R_386_TLS_DTPOFF32))
+		gotndx++;
+
+	return ((Xword)(osp->os_shdr->sh_addr + (gotndx * M_GOT_ENTSIZE)));
+}
+
+
+/* ARGSUSED4 */
+uintptr_t
+ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
+    Rel_desc * rsp, Sym_desc * sdp)
+{
+	Gotndx	*gnp;
+	uint_t	gotents;
+
+	if (pgnp)
+		return (1);
+
+	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
+		gotents = 2;
+	else
+		gotents = 1;
+
+	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
+		return (S_ERROR);
+	gnp->gn_gotndx = ofl->ofl_gotcnt;
+	gnp->gn_gotref = gref;
+
+	ofl->ofl_gotcnt += gotents;
+
+	if (gref == GOT_REF_TLSLD) {
+		ofl->ofl_tlsldgotndx = gnp;
+		return (1);
+	}
+
+	if (list_appendc(lst, (void *)gnp) == 0)
+		return (S_ERROR);
+
+	return (1);
+}
+
+void
+ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
+{
+	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
+	sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++;
+	ofl->ofl_flags |= FLG_OF_BLDGOT;
+}
+
+/*
+ * Initializes .got[0] with the _DYNAMIC symbol value.
+ */
+uintptr_t
+ld_fillin_gotplt(Ofl_desc * ofl)
+{
+	if (ofl->ofl_osgot) {
+		Sym_desc *	sdp;
+
+		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
+		    SYM_NOHASH, 0, ofl)) != NULL) {
+			uchar_t	*genptr = ((uchar_t *)
+			    ofl->ofl_osgot->os_outdata->d_buf +
+			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
+			/* LINTED */
+			*(Word *)genptr = (Word)sdp->sd_sym->st_value;
+		}
+	}
+
+	/*
+	 * Fill in the reserved slot in the procedure linkage table the first
+	 * entry is:
+	 *  if (building a.out) {
+	 *	PUSHL	got[1]		    # the address of the link map entry
+	 *	JMP *	got[2]		    # the address of rtbinder
+	 *  } else {
+	 *	PUSHL	got[1]@GOT(%ebx)    # the address of the link map entry
+	 *	JMP *	got[2]@GOT(%ebx)    # the address of rtbinder
+	 *  }
+	 */
+	if ((ofl->ofl_flags & FLG_OF_DYNAMIC) && ofl->ofl_osplt) {
+		uchar_t *pltent;
+
+		pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
+		if (!(ofl->ofl_flags & FLG_OF_SHAROBJ)) {
+			pltent[0] = M_SPECIAL_INST;
+			pltent[1] = M_PUSHL_DISP;
+			pltent += 2;
+			/* LINTED */
+			*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->
+				sh_addr + M_GOT_XLINKMAP * M_GOT_ENTSIZE);
+			pltent += 4;
+			pltent[0] = M_SPECIAL_INST;
+			pltent[1] = M_JMP_DISP_IND;
+			pltent += 2;
+			/* LINTED */
+			*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->
+				sh_addr + M_GOT_XRTLD * M_GOT_ENTSIZE);
+		} else {
+			pltent[0] = M_SPECIAL_INST;
+			pltent[1] = M_PUSHL_REG_DISP;
+			pltent += 2;
+			/* LINTED */
+			*(Word *)pltent = (Word)(M_GOT_XLINKMAP *
+				M_GOT_ENTSIZE);
+			pltent += 4;
+			pltent[0] = M_SPECIAL_INST;
+			pltent[1] = M_JMP_REG_DISP_IND;
+			pltent += 2;
+			/* LINTED */
+			*(Word *)pltent = (Word)(M_GOT_XRTLD *
+				M_GOT_ENTSIZE);
+		}
+	}
+	return (1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/machrel.sparc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,2100 @@
+/*
+ * 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 (c) 1988 AT&T
+ *	  All Rights Reserved
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<string.h>
+#include	<stdio.h>
+#include	<sys/elf_SPARC.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	"msg.h"
+#include	"_libld.h"
+
+/*
+ * Local Variable Definitions
+ */
+static Sword neggotoffset = 0;		/* off. of GOT table from GOT symbol */
+static Sword smlgotcnt = M_GOT_XNumber;	/* no. of small GOT symbols */
+
+Word
+ld_init_rel(Rel_desc *reld, void *reloc)
+{
+	Rela *	rela = (Rela *)reloc;
+
+	/* LINTED */
+	reld->rel_rtype = (Word)ELF_R_TYPE(rela->r_info);
+	reld->rel_roffset = rela->r_offset;
+	reld->rel_raddend = rela->r_addend;
+	reld->rel_typedata = (Word)ELF_R_TYPE_DATA(rela->r_info);
+
+	reld->rel_flags |= FLG_REL_RELA;
+
+	return ((Word)ELF_R_SYM(rela->r_info));
+}
+
+void
+ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
+{
+	Word		eflags = ofl->ofl_dehdr->e_flags;
+	Word		memopt1, memopt2;
+	static int	firstpass;
+
+	/*
+	 * If a *PLUS relocatable is included, the output object is type *PLUS.
+	 */
+	if ((ehdr->e_machine == EM_SPARC32PLUS) &&
+	    (ehdr->e_flags & EF_SPARC_32PLUS))
+		ofl->ofl_dehdr->e_machine = EM_SPARC32PLUS;
+
+	/*
+	 * On the first pass, we don't yet have a memory model to compare
+	 * against, therefore the initial file becomes our baseline.  Subsequent
+	 * passes will do the comparison described below.
+	 */
+	if (firstpass == 0) {
+		ofl->ofl_dehdr->e_flags |= ehdr->e_flags;
+		firstpass++;
+		return;
+	}
+
+	/*
+	 * Determine which memory model to mark the binary with.  The options
+	 * are (most restrictive to least):
+	 *
+	 *	EF_SPARCV9_TSO		0x0 	Total Store Order
+	 *	EF_SPARCV9_PSO		0x1	Partial Store Order
+	 *	EF_SPARCV9_RMO		0x2	Relaxed Memory Order
+	 *
+	 * Mark the binary with the most restrictive option encountered from a
+	 * relocatable object included in the link.
+	 */
+	eflags |= (ehdr->e_flags & ~EF_SPARCV9_MM);
+	memopt1 = eflags & EF_SPARCV9_MM;
+	memopt2 = ehdr->e_flags & EF_SPARCV9_MM;
+	eflags &= ~EF_SPARCV9_MM;
+
+	if ((memopt1 == EF_SPARCV9_TSO) || (memopt2 == EF_SPARCV9_TSO))
+		/* EMPTY */
+		;
+	else if ((memopt1 == EF_SPARCV9_PSO) || (memopt2 == EF_SPARCV9_PSO))
+		eflags |= EF_SPARCV9_PSO;
+	else
+		eflags |= EF_SPARCV9_RMO;
+
+	ofl->ofl_dehdr->e_flags = eflags;
+}
+
+void
+ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
+{
+	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
+		/*
+		 * Create this entry if we are going to create a PLT table.
+		 */
+		if (ofl->ofl_pltcnt)
+			(*cnt)++;		/* DT_PLTGOT */
+	}
+}
+
+void
+ld_mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn)
+{
+	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) {
+		(*dyn)->d_tag = DT_PLTGOT;
+		if (ofl->ofl_osplt)
+			(*dyn)->d_un.d_ptr = ofl->ofl_osplt->os_shdr->sh_addr;
+		else
+			(*dyn)->d_un.d_ptr = 0;
+		(*dyn)++;
+	}
+}
+
+#if	defined(_ELF64)
+
+Xword
+ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
+{
+	Xword	value, pltndx, farpltndx;
+
+	pltndx = sdp->sd_aux->sa_PLTndx + M_PLT_XNumber - 1;
+
+	if ((pltndx) < M64_PLT_NEARPLTS) {
+		value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
+		    (pltndx * M_PLT_ENTSIZE);
+		return (value);
+	}
+
+	farpltndx = pltndx - M64_PLT_NEARPLTS;
+
+	/*
+	 * pltoffset of a far plt is calculated by:
+	 *
+	 *	<size of near plt table> +
+	 *	<size of preceding far plt blocks> +
+	 *	<blockndx * sizeof (far plt entsize)>
+	 */
+	value =
+	    /* size of near plt table */
+	    (M64_PLT_NEARPLTS * M_PLT_ENTSIZE) +
+	    /* size of preceding far plt blocks */
+	    ((farpltndx / M64_PLT_FBLKCNTS) *
+	    ((M64_PLT_FENTSIZE + sizeof (Addr)) *
+	    M64_PLT_FBLKCNTS)) +
+	    /* pltblockendx * fentsize */
+	    ((farpltndx % M64_PLT_FBLKCNTS) * M64_PLT_FENTSIZE);
+
+	value += (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
+	return (value);
+}
+
+/*
+ * Instructions required for Far PLT's
+ */
+static uint32_t farplt_instrs[6] = {
+	0x8a10000f,			/* mov   %o7, %g5	*/
+	0x40000002,			/* call  . + 0x8	*/
+	0x01000000,			/* nop			*/
+	0xc25be000,			/* ldx   [%o7 + 0], %g1	*/
+	0x83c3c001,			/* jmpl  %o7 + %g1, %g1	*/
+	0x9e100005			/* mov   %g5, %o7	*/
+};
+
+/*
+ * Far PLT'S:
+ *
+ * Far PLT's are established in blocks of '160' at a time.  These
+ * PLT's consist of 6 instructions (24 bytes) and 1 pointer (8 bytes).
+ * The instructions are collected together in blocks of 160 entries
+ * followed by 160 pointers.  The last group of entries and pointers
+ * may contain less then 160 items.  No padding is required.
+ *
+ *	.PLT32768:
+ *		mov	%o7, %g5
+ *		call	. + 8
+ *		nop
+ *		ldx	[%o7 + .PLTP32768 - (.PLT32768 + 4)], %g1
+ *		jmpl	%o7 + %g1, %g1
+ *		mov	%g5, %o7
+ *	................................
+ *	.PLT32927:
+ *		mov	%o7, %g5
+ *		call	. + 8
+ *		nop
+ *		ldx	[%o7 + .PLTP32927 - (.PLT32927 + 4)], %g1
+ *		jmpl	%o7 + %g1, %g1
+ *		mov	%g5, %o7
+ *	.PLTP32768:
+ *		.xword .PLT0-(.PLT32768+4)
+ *	................................
+ *	.PLTP32927:
+ *		.xword .PLT0-(.PLT32927+4)
+ *
+ */
+void
+plt_far_entry(Ofl_desc *ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
+{
+	uint_t		blockndx;	/* # of far PLT blocks */
+	uint_t		farblkcnt;	/* Index to far PLT block */
+	Xword		farpltndx;	/* index of Far Plt */
+	Xword		farpltblkndx;	/* index of PLT in BLOCK */
+	uint32_t	*pltent;	/* ptr to plt instr. sequence */
+	uint64_t	*pltentptr;	/* ptr to plt addr ptr */
+	Sxword		pltblockoff;	/* offset to Far plt block */
+	Sxword		pltoff;		/* offset to PLT instr. sequence */
+	Sxword		pltptroff;	/* offset to PLT addr ptr */
+	uchar_t		*pltbuf;	/* ptr to PLT's in file */
+
+
+	farblkcnt = ((ofl->ofl_pltcnt - 1 +
+		M_PLT_XNumber - M64_PLT_NEARPLTS) / M64_PLT_FBLKCNTS);
+
+	/*
+	 * Determine the 'Far' PLT index.
+	 */
+	farpltndx = pltndx - 1 + M_PLT_XNumber - M64_PLT_NEARPLTS;
+	farpltblkndx = farpltndx % M64_PLT_FBLKCNTS;
+
+	/*
+	 * Determine what FPLT block this plt falls into.
+	 */
+	blockndx = (uint_t)(farpltndx / M64_PLT_FBLKCNTS);
+
+	/*
+	 * Calculate the starting offset of the Far PLT block
+	 * that this PLT is a member of.
+	 */
+	pltblockoff = (M64_PLT_NEARPLTS * M_PLT_ENTSIZE) +
+		(blockndx * M64_PLT_FBLOCKSZ);
+
+	pltoff = pltblockoff +
+		(farpltblkndx * M64_PLT_FENTSIZE);
+
+	pltptroff = pltblockoff;
+
+
+	if (farblkcnt > blockndx) {
+		/*
+		 * If this is a full block - the 'pltptroffs' start
+		 * after 160 fplts.
+		 */
+		pltptroff += (M64_PLT_FBLKCNTS * M64_PLT_FENTSIZE) +
+			(farpltblkndx * M64_PLT_PSIZE);
+	} else {
+		Xword	lastblkpltndx;
+		/*
+		 * If this is the last block - the the pltptr's start
+		 * after the last FPLT instruction sequence.
+		 */
+		lastblkpltndx = (ofl->ofl_pltcnt - 1 + M_PLT_XNumber -
+			M64_PLT_NEARPLTS) % M64_PLT_FBLKCNTS;
+		pltptroff += ((lastblkpltndx + 1) * M64_PLT_FENTSIZE) +
+			(farpltblkndx * M64_PLT_PSIZE);
+	}
+	pltbuf = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
+
+	/*
+	 * For far-plts, the Raddend and Roffset fields are defined
+	 * to be:
+	 *
+	 *	roffset:	address of .PLTP#
+	 *	raddend:	-(.PLT#+4)
+	 */
+	*roffset = pltptroff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
+	*raddend = -(pltoff + 4 + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr));
+
+	/* LINTED */
+	pltent = (uint32_t *)(pltbuf + pltoff);
+	/* LINTED */
+	pltentptr = (uint64_t *)(pltbuf + pltptroff);
+	(void) memcpy(pltent, farplt_instrs, sizeof (farplt_instrs));
+
+	/*
+	 *  update
+	 *	ldx   [%o7 + 0], %g1
+	 * to
+	 *	ldx   [%o7 + .PLTP# - (.PLT# + 4)], %g1
+	 */
+	/* LINTED */
+	pltent[3] |= (uint32_t)(pltptroff - (pltoff + 4));
+
+	/*
+	 * Store:
+	 *	.PLTP#
+	 *		.xword	.PLT0 - .PLT# + 4
+	 */
+	*pltentptr = -(pltoff + 4);
+}
+
+/*
+ *	Build a single V9 P.L.T. entry - code is:
+ *
+ *	For Target Addresses +/- 4GB of the entry
+ *	-----------------------------------------
+ *	sethi	(. - .PLT0), %g1
+ *	ba,a	%xcc, .PLT1
+ *	nop
+ *	nop
+ *	nop
+ *	nop
+ *	nop
+ *	nop
+ *
+ *	For Target Addresses +/- 2GB of the entry
+ *	-----------------------------------------
+ *
+ *	.PLT0 is the address of the first entry in the P.L.T.
+ *	This one is filled in by the run-time link editor. We just
+ *	have to leave space for it.
+ */
+static void
+plt_entry(Ofl_desc *ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
+{
+	uchar_t		*pltent;	/* PLT entry being created. */
+	Sxword		pltoff;		/* Offset of this entry from PLT top */
+
+	/*
+	 *  The second part of the V9 ABI (sec. 5.2.4)
+	 *  applies to plt entries greater than 0x8000 (32,768).
+	 *  This is handled in 'plt_far_entry()'
+	 */
+	if ((pltndx - 1 + M_PLT_XNumber) >= M64_PLT_NEARPLTS) {
+		plt_far_entry(ofl, pltndx, roffset, raddend);
+		return;
+	}
+
+	pltoff = M_PLT_RESERVSZ + (pltndx - 1) * M_PLT_ENTSIZE;
+	pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf +
+		pltoff;
+
+	*roffset = pltoff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
+	*raddend = 0;
+
+	/*
+	 * PLT[0]: sethi %hi(. - .L0), %g1
+	 */
+	/* LINTED */
+	*(Word *)pltent = M_SETHIG1 | pltoff;
+
+	/*
+	 * PLT[1]: ba,a %xcc, .PLT1 (.PLT1 accessed as a
+	 * PC-relative index of longwords).
+	 */
+	pltent += M_PLT_INSSIZE;
+	pltoff += M_PLT_INSSIZE;
+	pltoff = -pltoff;
+	/* LINTED */
+	*(Word *)pltent = M_BA_A_XCC |
+		(((pltoff + M_PLT_ENTSIZE) >> 2) & S_MASK(19));
+
+	/*
+	 * PLT[2]: sethi 0, %g0 (NOP for delay slot of eventual CTI).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+
+	/*
+	 * PLT[3]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+
+	/*
+	 * PLT[4]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+
+	/*
+	 * PLT[5]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+
+	/*
+	 * PLT[6]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+
+	/*
+	 * PLT[7]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_NOP;
+}
+
+
+#else  /* Elf 32 */
+
+Xword
+ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
+{
+	Xword	value, pltndx;
+
+	pltndx = sdp->sd_aux->sa_PLTndx + M_PLT_XNumber - 1;
+	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
+	    (pltndx * M_PLT_ENTSIZE);
+	return (value);
+}
+
+
+/*
+ *	Build a single P.L.T. entry - code is:
+ *
+ *	sethi	(. - .L0), %g1
+ *	ba,a	.L0
+ *	sethi	0, %g0		(nop)
+ *
+ *	.L0 is the address of the first entry in the P.L.T.
+ *	This one is filled in by the run-time link editor. We just
+ *	have to leave space for it.
+ */
+static void
+plt_entry(Ofl_desc * ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
+{
+	Byte *	pltent;	/* PLT entry being created. */
+	Sxword	pltoff;	/* Offset of this entry from PLT top */
+
+	pltoff = M_PLT_RESERVSZ + (pltndx - 1) * M_PLT_ENTSIZE;
+	pltent = (Byte *)ofl->ofl_osplt->os_outdata->d_buf + pltoff;
+
+	*roffset = pltoff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
+	*raddend = 0;
+
+	/*
+	 * PLT[0]: sethi %hi(. - .L0), %g1
+	 */
+	/* LINTED */
+	*(Word *)pltent = M_SETHIG1 | pltoff;
+
+	/*
+	 * PLT[1]: ba,a .L0 (.L0 accessed as a PC-relative index of longwords)
+	 */
+	pltent += M_PLT_INSSIZE;
+	pltoff += M_PLT_INSSIZE;
+	pltoff = -pltoff;
+	/* LINTED */
+	*(Word *)pltent = M_BA_A | ((pltoff >> 2) & S_MASK(22));
+
+	/*
+	 * PLT[2]: sethi 0, %g0 (NOP for delay slot of eventual CTI).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_SETHIG0;
+
+	/*
+	 * PLT[3]: sethi 0, %g0 (NOP for PLT padding).
+	 */
+	pltent += M_PLT_INSSIZE;
+	/* LINTED */
+	*(Word *)pltent = M_SETHIG0;
+}
+
+#endif /* _ELF64 */
+
+uintptr_t
+ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
+{
+	Os_desc *		relosp, * osp = 0;
+	Xword			ndx, roffset, value;
+	Sxword			raddend;
+	const Rel_entry *	rep;
+	Rela			rea;
+	char			*relbits;
+	Sym_desc *		sdp, * psym = (Sym_desc *)0;
+	int			sectmoved = 0;
+	Word			dtflags1 = ofl->ofl_dtflags_1;
+	Word			flags = ofl->ofl_flags;
+
+	raddend = orsp->rel_raddend;
+	sdp = orsp->rel_sym;
+
+	/*
+	 * Special case, a regsiter symbol associated with symbol
+	 * index 0 is initialized (i.e. relocated) to a constant
+	 * in the r_addend field rather than to a symbol value.
+	 */
+	if ((orsp->rel_rtype == M_R_REGISTER) && !sdp) {
+		relosp = ofl->ofl_osrel;
+		relbits = (char *)relosp->os_outdata->d_buf;
+
+		rea.r_info = ELF_R_INFO(0,
+		    ELF_R_TYPE_INFO(orsp->rel_typedata, orsp->rel_rtype));
+		rea.r_offset = orsp->rel_roffset;
+		rea.r_addend = raddend;
+		DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea,
+		    relosp->os_name, orsp->rel_sname));
+
+		assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
+		(void) memcpy((relbits + relosp->os_szoutrels),
+		    (char *)&rea, sizeof (Rela));
+		relosp->os_szoutrels += (Xword)sizeof (Rela);
+
+		return (1);
+	}
+
+	/*
+	 * If the section this relocation is against has been discarded
+	 * (-zignore), then also discard (skip) the relocation itself.
+	 */
+	if (orsp->rel_isdesc && ((orsp->rel_flags &
+	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
+	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
+		DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp));
+		return (1);
+	}
+
+	/*
+	 * If this is a relocation against a move table, or expanded move
+	 * table, adjust the relocation entries.
+	 */
+	if (orsp->rel_move)
+		ld_adj_movereloc(ofl, orsp);
+
+	/*
+	 * If this is a relocation against a section then we need to adjust the
+	 * raddend field to compensate for the new position of the input section
+	 * within the new output section.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
+		if (ofl->ofl_parsym.head &&
+		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+		    (psym = ld_am_I_partial(orsp, orsp->rel_raddend))) {
+			/*
+			 * If the symbol is moved, adjust the value
+			 */
+			DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym));
+			sectmoved = 1;
+			if (ofl->ofl_flags & FLG_OF_RELOBJ)
+				raddend = psym->sd_sym->st_value;
+			else
+				raddend = psym->sd_sym->st_value -
+				    psym->sd_isc->is_osdesc->os_shdr->sh_addr;
+			/* LINTED */
+			raddend += (Off)_elf_getxoff(psym->sd_isc->is_indata);
+			if (psym->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
+				raddend +=
+				psym->sd_isc->is_osdesc->os_shdr->sh_addr;
+		} else {
+			/* LINTED */
+			raddend += (Off)_elf_getxoff(sdp->sd_isc->is_indata);
+			if (sdp->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
+				raddend +=
+				sdp->sd_isc->is_osdesc->os_shdr->sh_addr;
+		}
+	}
+
+	value = sdp->sd_sym->st_value;
+
+	if (orsp->rel_flags & FLG_REL_GOT) {
+		osp = ofl->ofl_osgot;
+		roffset = ld_calc_got_offset(orsp, ofl);
+
+	} else if (orsp->rel_flags & FLG_REL_PLT) {
+		osp = ofl->ofl_osplt;
+		plt_entry(ofl, sdp->sd_aux->sa_PLTndx, &roffset, &raddend);
+	} else if (orsp->rel_flags & FLG_REL_BSS) {
+		/*
+		 * This must be a R_SPARC_COPY.  For these set the roffset to
+		 * point to the new symbols location.
+		 */
+		osp = ofl->ofl_isbss->is_osdesc;
+		roffset = (Xword)value;
+
+		/*
+		 * The raddend doesn't mean anything in an R_SPARC_COPY
+		 * relocation.  Null it out because it can confuse people.
+		 */
+		raddend = 0;
+	} else if (orsp->rel_flags & FLG_REL_REG) {
+		/*
+		 * The offsets of relocations against register symbols
+		 * identifiy the register directly - so the offset
+		 * does not need to be adjusted.
+		 */
+		roffset = orsp->rel_roffset;
+	} else {
+		osp = orsp->rel_osdesc;
+
+		/*
+		 * Calculate virtual offset of reference point; equals offset
+		 * into section + vaddr of section for loadable sections, or
+		 * offset plus section displacement for nonloadable sections.
+		 */
+		roffset = orsp->rel_roffset +
+		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
+		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
+			roffset += orsp->rel_isdesc->is_osdesc->
+			    os_shdr->sh_addr;
+	}
+
+	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
+		relosp = ofl->ofl_osrel;
+
+	/*
+	 * Verify that the output relocations offset meets the
+	 * alignment requirements of the relocation being processed.
+	 */
+	rep = &reloc_table[orsp->rel_rtype];
+	if (((flags & FLG_OF_RELOBJ) || !(dtflags1 & DF_1_NORELOC)) &&
+	    !(rep->re_flags & FLG_RE_UNALIGN)) {
+		if (((rep->re_fsize == 2) && (roffset & 0x1)) ||
+		    ((rep->re_fsize == 4) && (roffset & 0x3)) ||
+		    ((rep->re_fsize == 8) && (roffset & 0x7))) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_NONALIGN),
+			    conv_reloc_SPARC_type(orsp->rel_rtype),
+			    orsp->rel_isdesc->is_file->ifl_name,
+			    demangle(orsp->rel_sname), EC_XWORD(roffset));
+			return (S_ERROR);
+		}
+	}
+
+	/*
+	 * Assign the symbols index for the output relocation.  If the
+	 * relocation refers to a SECTION symbol then it's index is based upon
+	 * the output sections symbols index.  Otherwise the index can be
+	 * derived from the symbols index itself.
+	 */
+	if (orsp->rel_rtype == R_SPARC_RELATIVE)
+		ndx = STN_UNDEF;
+	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
+		if (sectmoved == 0) {
+			/*
+			 * Check for a null input section. This can
+			 * occur if this relocation references a symbol
+			 * generated by sym_add_sym().
+			 */
+			if ((sdp->sd_isc != 0) &&
+			    (sdp->sd_isc->is_osdesc != 0))
+				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
+			else
+				ndx = sdp->sd_shndx;
+		} else
+			ndx = ofl->ofl_sunwdata1ndx;
+	} else
+		ndx = sdp->sd_symndx;
+
+	/*
+	 * Add the symbols 'value' to the addend field.
+	 */
+	if (orsp->rel_flags & FLG_REL_ADVAL)
+		raddend += value;
+
+	/*
+	 * addend field for R_SPARC_TLS_DTPMOD32 &&
+	 * R_SPARC_TLS_DTPMOD64 mean nothing.  The addend
+	 * is propogated in the corresponding R_SPARC_TLS_DTPOFF*
+	 * relocations.
+	 */
+	if (orsp->rel_rtype == M_R_DTPMOD) {
+		raddend = 0;
+	}
+
+	relbits = (char *)relosp->os_outdata->d_buf;
+
+	rea.r_info = ELF_R_INFO(ndx, ELF_R_TYPE_INFO(orsp->rel_typedata,
+			orsp->rel_rtype));
+	rea.r_offset = roffset;
+	rea.r_addend = raddend;
+	DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea, relosp->os_name,
+	    orsp->rel_sname));
+
+	/*
+	 * Assert we haven't walked off the end of our relocation table.
+	 */
+	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
+
+	(void) memcpy((relbits + relosp->os_szoutrels),
+	    (char *)&rea, sizeof (Rela));
+	relosp->os_szoutrels += (Xword)sizeof (Rela);
+
+	/*
+	 * Determine if this relocation is against a non-writable, allocatable
+	 * section.  If so we may need to provide a text relocation diagnostic.
+	 */
+	ld_reloc_remain_entry(orsp, osp, ofl);
+	return (1);
+}
+
+
+/*
+ * Sparc Instructions for TLS processing
+ */
+#if	defined(_ELF64)
+#define	TLS_GD_IE_LD	0xd0580000	/* ldx [%g0 + %g0], %o0 */
+#else
+#define	TLS_GD_IE_LD	0xd0000000	/* ld [%g0 + %g0], %o0 */
+#endif
+#define	TLS_GD_IE_ADD	0x9001c008	/* add %g7, %o0, %o0 */
+
+#define	TLS_GD_LE_XOR	0x80182000	/* xor %g0, 0, %g0 */
+#define	TLS_IE_LE_OR	0x80100000	/* or %g0, %o0, %o1 */
+					/*  synthetic: mov %g0, %g0 */
+
+#define	TLS_LD_LE_CLRO0	0x90100000	/* clr	%o0 */
+
+#define	FM3_REG_MSK_RD	(0x1f << 25)	/* Formate (3) rd register mask */
+					/*	bits 25->29 */
+#define	FM3_REG_MSK_RS1	(0x1f << 14)	/* Formate (3) rs1 register mask */
+					/*	bits 14->18 */
+#define	FM3_REG_MSK_RS2	0x1f		/* Formate (3) rs2 register mask */
+					/*	bits 0->4 */
+
+#define	REG_G7		7		/* %g7 register */
+
+static Fixupret
+tls_fixups(Ofl_desc *ofl, Rel_desc *arsp)
+{
+	Sym_desc	*sdp = arsp->rel_sym;
+	Word		rtype = arsp->rel_rtype;
+	uint_t		*offset;
+
+	offset = (uint_t *)((uintptr_t)arsp->rel_roffset +
+		(uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
+		(uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
+
+	if (sdp->sd_ref == REF_DYN_NEED) {
+		/*
+		 * IE reference model
+		 */
+		switch (rtype) {
+		case R_SPARC_TLS_GD_HI22:
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_SPARC_TLS_IE_HI22, arsp->rel_roffset,
+			    sdp->sd_name));
+			arsp->rel_rtype = R_SPARC_TLS_IE_HI22;
+			return (FIX_RELOC);
+
+		case R_SPARC_TLS_GD_LO10:
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_SPARC_TLS_IE_LO10, arsp->rel_roffset,
+			    sdp->sd_name));
+			arsp->rel_rtype = R_SPARC_TLS_IE_LO10;
+			return (FIX_RELOC);
+
+		case R_SPARC_TLS_GD_ADD:
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_SPARC_NONE, arsp->rel_roffset,
+			    sdp->sd_name));
+			*offset = (TLS_GD_IE_LD |
+			    (*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RS2)));
+			return (FIX_DONE);
+
+		case R_SPARC_TLS_GD_CALL:
+			DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH,
+			    rtype, R_SPARC_NONE, arsp->rel_roffset,
+			    sdp->sd_name));
+			*offset = TLS_GD_IE_ADD;
+			return (FIX_DONE);
+		}
+		return (FIX_RELOC);
+	}
+
+	/*
+	 * LE reference model
+	 */
+	switch (rtype) {
+	case R_SPARC_TLS_IE_HI22:
+	case R_SPARC_TLS_GD_HI22:
+	case R_SPARC_TLS_LDO_HIX22:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_TLS_LE_HIX22, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_SPARC_TLS_LE_HIX22;
+		return (FIX_RELOC);
+
+	case R_SPARC_TLS_LDO_LOX10:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_TLS_LE_LOX10, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_SPARC_TLS_LE_LOX10;
+		return (FIX_RELOC);
+
+	case R_SPARC_TLS_IE_LO10:
+	case R_SPARC_TLS_GD_LO10:
+		/*
+		 * Current instruction is:
+		 *
+		 *	or r1, %lo(x), r2
+		 *		or
+		 *	add r1, %lo(x), r2
+		 *
+		 *
+		 * Need to udpate this to:
+		 *
+		 *	xor r1, %lox(x), r2
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_TLS_LE_LOX10, arsp->rel_roffset, sdp->sd_name));
+		*offset = TLS_GD_LE_XOR |
+		    (*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RD));
+		arsp->rel_rtype = R_SPARC_TLS_LE_LOX10;
+		return (FIX_RELOC);
+
+	case R_SPARC_TLS_IE_LD:
+	case R_SPARC_TLS_IE_LDX:
+		/*
+		 * Current instruction:
+		 * 	ld{x}	[r1 + r2], r3
+		 *
+		 * Need to update this to:
+		 *
+		 *	mov	r2, r3   (or  %g0, r2, r3)
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name));
+		*offset = ((*offset) & (FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) |
+		    TLS_IE_LE_OR;
+		return (FIX_DONE);
+
+	case R_SPARC_TLS_LDO_ADD:
+	case R_SPARC_TLS_GD_ADD:
+		/*
+		 * Current instruction is:
+		 *
+		 *	add gptr_reg, r2, r3
+		 *
+		 * Need to updated this to:
+		 *
+		 *	add %g7, r2, r3
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name));
+		*offset = *offset & (~FM3_REG_MSK_RS1);
+		*offset = *offset | (REG_G7 << 14);
+		return (FIX_DONE);
+
+	case R_SPARC_TLS_LDM_CALL:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name));
+		*offset = TLS_LD_LE_CLRO0;
+		return (FIX_DONE);
+
+	case R_SPARC_TLS_LDM_HI22:
+	case R_SPARC_TLS_LDM_LO10:
+	case R_SPARC_TLS_LDM_ADD:
+	case R_SPARC_TLS_IE_ADD:
+	case R_SPARC_TLS_GD_CALL:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name));
+		*offset = M_NOP;
+		return (FIX_DONE);
+	}
+	return (FIX_RELOC);
+}
+
+#define	GOTOP_ADDINST	0x80000000	/* add %g0, %g0, %g0 */
+
+static Fixupret
+gotop_fixups(Ofl_desc *ofl, Rel_desc *arsp)
+{
+	Sym_desc	*sdp = arsp->rel_sym;
+	Word		rtype = arsp->rel_rtype;
+	uint_t		*offset;
+	const char	*ifl_name;
+
+	switch (rtype) {
+	case R_SPARC_GOTDATA_OP_HIX22:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_GOTDATA_HIX22, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_SPARC_GOTDATA_HIX22;
+		return (FIX_RELOC);
+
+	case R_SPARC_GOTDATA_OP_LOX10:
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_GOTDATA_LOX10, arsp->rel_roffset, sdp->sd_name));
+		arsp->rel_rtype = R_SPARC_GOTDATA_LOX10;
+		return (FIX_RELOC);
+
+	case R_SPARC_GOTDATA_OP:
+		/*
+		 * Current instruction:
+		 * 	ld{x}	[r1 + r2], r3
+		 *
+		 * Need to update this to:
+		 *
+		 *	add	r1, r2, r3
+		 */
+		DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype,
+		    R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name));
+		offset = (uint_t *)(uintptr_t)(arsp->rel_roffset +
+		    _elf_getxoff(arsp->rel_isdesc->is_indata) +
+		    (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
+
+		*offset = ((*offset) & (FM3_REG_MSK_RS1 |
+		    FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) | GOTOP_ADDINST;
+		return (FIX_DONE);
+	}
+	/*
+	 * We should not get here
+	 */
+	if (arsp->rel_isdesc->is_file)
+		ifl_name = arsp->rel_isdesc->is_file->ifl_name;
+	else
+		ifl_name = MSG_INTL(MSG_STR_NULL);
+
+	eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADGOTFIX),
+	    conv_reloc_SPARC_type(arsp->rel_rtype),
+	    ifl_name, demangle(arsp->rel_sname));
+
+	assert(0);
+	return (FIX_ERROR);
+}
+
+uintptr_t
+ld_do_activerelocs(Ofl_desc *ofl)
+{
+	Rel_desc	*arsp;
+	Rel_cache	*rcp;
+	Listnode	*lnp;
+	uintptr_t	return_code = 1;
+	Word		flags = ofl->ofl_flags;
+	Word		dtflags1 = ofl->ofl_dtflags_1;
+
+	DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml));
+	/*
+	 * Process active relocations.
+	 */
+	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
+		/* LINTED */
+		for (arsp = (Rel_desc *)(rcp + 1);
+		    arsp < rcp->rc_free; arsp++) {
+			uchar_t		*addr;
+			Xword		value;
+			Sym_desc	*sdp;
+			const char	*ifl_name;
+			Xword		refaddr;
+
+			/*
+			 * If the section this relocation is against has been
+			 * discarded (-zignore), then discard (skip) the
+			 * relocation itself.
+			 */
+			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
+			    ((arsp->rel_flags &
+			    (FLG_REL_GOT | FLG_REL_BSS |
+			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
+				DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml,
+				    M_MACH, arsp));
+				continue;
+			}
+
+			/*
+			 * Perform any required TLS fixups.
+			 */
+			if (arsp->rel_flags & FLG_REL_TLSFIX) {
+				Fixupret	ret;
+
+				if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR)
+					return (S_ERROR);
+				if (ret == FIX_DONE)
+					continue;
+			}
+
+			/*
+			 * Perform any required GOTOP fixups.
+			 */
+			if (arsp->rel_flags & FLG_REL_GOTFIX) {
+				Fixupret	ret;
+
+				if ((ret =
+				    gotop_fixups(ofl, arsp)) == FIX_ERROR)
+					return (S_ERROR);
+				if (ret == FIX_DONE)
+					continue;
+			}
+
+			/*
+			 * If this is a relocation against the move table, or
+			 * expanded move table, adjust the relocation entries.
+			 */
+			if (arsp->rel_move)
+				ld_adj_movereloc(ofl, arsp);
+
+			sdp = arsp->rel_sym;
+			refaddr = arsp->rel_roffset +
+			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
+
+			if ((arsp->rel_flags & FLG_REL_CLVAL) ||
+			    (arsp->rel_flags & FLG_REL_GOTCL))
+				value = 0;
+			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
+			    STT_SECTION) {
+				Sym_desc	*sym;
+
+				/*
+				 * The value for a symbol pointing to a SECTION
+				 * is based off of that sections position.
+				 */
+				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
+				    (sym = ld_am_I_partial(arsp,
+				    arsp->rel_roffset))) {
+					/*
+					 * If the symbol is moved,
+					 * adjust the value
+					 */
+					value = _elf_getxoff(
+					    sym->sd_isc->is_indata);
+					if (sym->sd_isc->is_shdr->sh_flags &
+					    SHF_ALLOC)
+						value += sym->sd_isc->
+						    is_osdesc->os_shdr->sh_addr;
+				} else {
+					value = _elf_getxoff(
+					    sdp->sd_isc->is_indata);
+					if (sdp->sd_isc->is_shdr->sh_flags &
+					    SHF_ALLOC)
+						value += sdp->sd_isc->
+						    is_osdesc->os_shdr->sh_addr;
+				}
+
+				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
+					value -= ofl->ofl_tlsphdr->p_vaddr;
+			} else {
+				/*
+				 * else the value is the symbols value
+				 */
+				value = sdp->sd_sym->st_value;
+			}
+
+			/*
+			 * Relocation against the GLOBAL_OFFSET_TABLE.
+			 */
+			if (arsp->rel_flags & FLG_REL_GOT)
+				arsp->rel_osdesc = ofl->ofl_osgot;
+
+			/*
+			 * If loadable and not producing a relocatable object
+			 * add the sections virtual address to the reference
+			 * address.
+			 */
+			if ((arsp->rel_flags & FLG_REL_LOAD) &&
+			    ((flags & FLG_OF_RELOBJ) == 0))
+				refaddr += arsp->rel_isdesc->is_osdesc->
+				    os_shdr->sh_addr;
+
+			/*
+			 * If this entry has a PLT assigned to it, it's
+			 * value is actually the address of the PLT (and
+			 * not the address of the function).
+			 */
+			if (IS_PLT(arsp->rel_rtype)) {
+				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
+					value = ld_calc_plt_addr(sdp, ofl);
+			}
+
+			/*
+			 * Add relocations addend to value.  Add extra
+			 * relocation addend if needed.
+			 */
+			value += arsp->rel_raddend;
+			if (IS_EXTOFFSET(arsp->rel_rtype))
+				value += arsp->rel_typedata;
+
+			/*
+			 * Determine whether the value needs further adjustment.
+			 * Filter through the attributes of the relocation to
+			 * determine what adjustment is required.  Note, many
+			 * of the following cases are only applicable when a
+			 * .got is present.  As a .got is not generated when a
+			 * relocatable object is being built, any adjustments
+			 * that require a .got need to be skipped.
+			 */
+			if ((arsp->rel_flags & FLG_REL_GOT) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword		R1addr;
+				uintptr_t	R2addr;
+				Sword		gotndx;
+				Gotndx		*gnp;
+				Gotref		gref;
+
+				/*
+				 * Clear the GOT table entry, on SPARC we clear
+				 * the entry and the 'value' if needed is stored
+				 * in an output relocations addend.
+				 *
+				 * Calculate offset into GOT at which to apply
+				 * the relocation.
+				 */
+				if (arsp->rel_flags & FLG_REL_DTLS)
+					gref = GOT_REF_TLSGD;
+				else if (arsp->rel_flags & FLG_REL_MTLS)
+					gref = GOT_REF_TLSLD;
+				else if (arsp->rel_flags & FLG_REL_STLS)
+					gref = GOT_REF_TLSIE;
+				else
+					gref = GOT_REF_GENERIC;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, arsp);
+				assert(gnp);
+
+				if (arsp->rel_rtype == M_R_DTPOFF)
+					gotndx = gnp->gn_gotndx + 1;
+				else
+					gotndx = gnp->gn_gotndx;
+
+				/* LINTED */
+				R1addr = (Xword)((-neggotoffset *
+				    M_GOT_ENTSIZE) + (gotndx * M_GOT_ENTSIZE));
+
+				/*
+				 * Add the GOTs data's offset.
+				 */
+				R2addr = R1addr + (uintptr_t)
+				    arsp->rel_osdesc->os_outdata->d_buf;
+
+				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
+				    ELF_DBG_LD, M_MACH, SHT_RELA,
+				    arsp->rel_rtype, R1addr, value,
+				    arsp->rel_sname, arsp->rel_osdesc));
+
+				/*
+				 * And do it.
+				 */
+				*(Xword *)R2addr = value;
+				continue;
+
+			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				value -= (ofl->ofl_osgot->os_shdr->sh_addr +
+					(-neggotoffset * M_GOT_ENTSIZE));
+
+			} else if (IS_PC_RELATIVE(arsp->rel_rtype)) {
+				value -= refaddr;
+
+			} else if (IS_TLS_INS(arsp->rel_rtype) &&
+			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx	*gnp;
+				Gotref	gref;
+
+				if (arsp->rel_flags & FLG_REL_STLS)
+					gref = GOT_REF_TLSIE;
+				else if (arsp->rel_flags & FLG_REL_DTLS)
+					gref = GOT_REF_TLSGD;
+				else if (arsp->rel_flags & FLG_REL_MTLS)
+					gref = GOT_REF_TLSLD;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref,
+				    ofl, arsp);
+				assert(gnp);
+
+				value = gnp->gn_gotndx * M_GOT_ENTSIZE;
+
+			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Gotndx	*gnp;
+
+				gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+				    GOT_REF_GENERIC, ofl, arsp);
+				assert(gnp);
+
+				value = gnp->gn_gotndx * M_GOT_ENTSIZE;
+
+			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
+			    ((flags & FLG_OF_RELOBJ) == 0)) {
+				Xword	tlsstatsize;
+
+				/*
+				 * This is the LE TLS
+				 * reference model.  Static offset
+				 * is hard-coded, and negated so that
+				 * it can be added to the thread pointer (%g7)
+				 */
+				tlsstatsize = S_ROUND(ofl->
+				    ofl_tlsphdr->p_memsz, M_TLSSTATALIGN);
+				value = -(tlsstatsize - value);
+			}
+
+			if (arsp->rel_isdesc->is_file)
+				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
+			else
+				ifl_name = MSG_INTL(MSG_STR_NULL);
+
+			/*
+			 * Make sure we have data to relocate.  Compiler and
+			 * assembler developers have been known to generate
+			 * relocations against invalid sections (normally .bss),
+			 * so for their benefit give them sufficient information
+			 * to help analyze the problem.  End users should never
+			 * see this.
+			 */
+			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_EMPTYSEC),
+				    conv_reloc_SPARC_type(arsp->rel_rtype),
+				    ifl_name, demangle(arsp->rel_sname),
+				    arsp->rel_isdesc->is_name);
+				return (S_ERROR);
+			}
+
+			/*
+			 * Get the address of the data item we need to modify.
+			 */
+			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
+			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
+			    is_indata));
+
+			/*LINTED*/
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			    M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr),
+			    value, arsp->rel_sname, arsp->rel_osdesc));
+			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
+
+			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) >
+			    ofl->ofl_size) || (arsp->rel_roffset >
+			    arsp->rel_osdesc->os_shdr->sh_size)) {
+				int	class;
+
+				if (((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size)
+					class = ERR_FATAL;
+				else
+					class = ERR_WARNING;
+
+				eprintf(ofl->ofl_lml, class,
+				    MSG_INTL(MSG_REL_INVALOFFSET),
+				    conv_reloc_SPARC_type(arsp->rel_rtype),
+				    ifl_name, arsp->rel_isdesc->is_name,
+				    demangle(arsp->rel_sname),
+				    EC_ADDR((uintptr_t)addr -
+				    (uintptr_t)ofl->ofl_nehdr));
+
+				if (class == ERR_FATAL) {
+					return_code = S_ERROR;
+					continue;
+				}
+			}
+
+			/*
+			 * If '-z noreloc' is specified - skip the do_reloc
+			 * stage.
+			 */
+			if ((flags & FLG_OF_RELOBJ) ||
+			    !(dtflags1 & DF_1_NORELOC)) {
+				if (do_reloc((uchar_t)arsp->rel_rtype, addr,
+				    &value, arsp->rel_sname, ifl_name,
+				    ofl->ofl_lml) == 0)
+					return_code = S_ERROR;
+			}
+		}
+	}
+	return (return_code);
+}
+
+uintptr_t
+ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
+{
+	Rel_desc	*orsp;
+	Rel_cache	*rcp;
+	Sym_desc	*sdp = rsp->rel_sym;
+
+	/*
+	 * Static executables *do not* want any relocations against them.
+	 * Since our engine still creates relocations against a WEAK UNDEFINED
+	 * symbol in a static executable, it's best to disable them here
+	 * instead of through out the relocation code.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC))
+		return (1);
+
+	/*
+	 * Certain relocations do not make sense in a 64bit shared object,
+	 * if building a shared object do a sanity check on the output
+	 * relocations being created.
+	 */
+	if (ofl->ofl_flags & FLG_OF_SHAROBJ) {
+		Word	rtype = rsp->rel_rtype;
+		/*
+		 * Because the R_SPARC_HIPLT22 & R_SPARC_LOPLT10 relocations
+		 * are not relative they make no sense to create in a shared
+		 * object - so emit the proper error message if that occurs.
+		 */
+		if ((rtype == R_SPARC_HIPLT22) ||
+		    (rtype == R_SPARC_LOPLT10)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_UNRELREL),
+			    conv_reloc_SPARC_type(rsp->rel_rtype),
+			    rsp->rel_isdesc->is_file->ifl_name,
+			    demangle(rsp->rel_sname));
+			return (S_ERROR);
+		}
+#if	defined(_ELF64)
+		/*
+		 * Each of the following relocations requires that the
+		 * object being built be loaded in either the upper 32 or
+		 * 44 bit range of memory.  Since shared libraries traditionally
+		 * are loaded in the lower range of memory - this isn't going
+		 * to work.
+		 */
+		if ((rtype == R_SPARC_H44) || (rtype == R_SPARC_M44) ||
+		    (rtype == R_SPARC_L44)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_SHOBJABS44),
+			    conv_reloc_SPARC_type(rsp->rel_rtype),
+			    rsp->rel_isdesc->is_file->ifl_name,
+			    demangle(rsp->rel_sname));
+			return (S_ERROR);
+		}
+#endif
+	}
+
+	/*
+	 * If no relocation cache structures are available allocate
+	 * a new one and link it into the cache list.
+	 */
+	if ((ofl->ofl_outrels.tail == 0) ||
+	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
+	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
+		static size_t	nextsize = 0;
+		size_t		size;
+
+		/*
+		 * Output relocation numbers can vary considerably between
+		 * building executables or shared objects (pic vs. non-pic),
+		 * etc.  But, they typically aren't very large, so for these
+		 * objects use a standard bucket size.  For building relocatable
+		 * objects, typically there will be an output relocation for
+		 * every input relocation.
+		 */
+		if (nextsize == 0) {
+			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
+				if ((size = ofl->ofl_relocincnt) == 0)
+					size = REL_LOIDESCNO;
+				if (size > REL_HOIDESCNO)
+					nextsize = REL_HOIDESCNO;
+				else
+					nextsize = REL_LOIDESCNO;
+			} else
+				nextsize = size = REL_HOIDESCNO;
+		} else
+			size = nextsize;
+
+		size = size * sizeof (Rel_desc);
+
+		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
+		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
+			return (S_ERROR);
+
+		/* LINTED */
+		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
+		/* LINTED */
+		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
+	}
+
+	/*
+	 * If we are adding a output relocation against a section
+	 * symbol (non-RELATIVE) then mark that section.  These sections
+	 * will be added to the .dynsym symbol table.
+	 */
+	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
+	    ((flags & FLG_REL_SCNNDX) ||
+	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
+
+		/*
+		 * If this is a COMMON symbol - no output section
+		 * exists yet - (it's created as part of sym_validate()).
+		 * So - we mark here that when it's created it should
+		 * be tagged with the FLG_OS_OUTREL flag.
+		 */
+		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
+		    (sdp->sd_shndx == SHN_COMMON)) {
+			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
+				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
+			else
+				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
+		} else {
+			Os_desc	*osp = sdp->sd_isc->is_osdesc;
+
+			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
+				ofl->ofl_dynshdrcnt++;
+				osp->os_flags |= FLG_OS_OUTREL;
+			}
+		}
+	}
+
+	*orsp = *rsp;
+	orsp->rel_flags |= flags;
+
+	rcp->rc_free++;
+	ofl->ofl_outrelscnt++;
+
+	if (flags & FLG_REL_GOT)
+		ofl->ofl_relocgotsz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_PLT)
+		ofl->ofl_relocpltsz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_BSS)
+		ofl->ofl_relocbsssz += (Xword)sizeof (Rela);
+	else if (flags & FLG_REL_NOINFO)
+		ofl->ofl_relocrelsz += (Xword)sizeof (Rela);
+	else
+		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rela);
+
+	if (orsp->rel_rtype == M_R_RELATIVE)
+		ofl->ofl_relocrelcnt++;
+
+#if	defined(_ELF64)
+	/*
+	 * When building a 64-bit object any R_SPARC_WDISP30 relocation is given
+	 * a plt padding entry, unless we're building a relocatable object
+	 * (ld -r) or -b is in effect.
+	 */
+	if ((orsp->rel_rtype == R_SPARC_WDISP30) &&
+	    ((ofl->ofl_flags & (FLG_OF_BFLAG | FLG_OF_RELOBJ)) == 0) &&
+	    ((orsp->rel_sym->sd_flags & FLG_SY_PLTPAD) == 0)) {
+		ofl->ofl_pltpad++;
+		orsp->rel_sym->sd_flags |= FLG_SY_PLTPAD;
+	}
+#endif
+	/*
+	 * We don't perform sorting on PLT relocations because
+	 * they have already been assigned a PLT index and if we
+	 * were to sort them we would have to re-assign the plt indexes.
+	 */
+	if (!(flags & FLG_REL_PLT))
+		ofl->ofl_reloccnt++;
+
+	/*
+	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
+	 */
+	if (IS_GOT_REQUIRED(orsp->rel_rtype))
+		ofl->ofl_flags |= FLG_OF_BLDGOT;
+
+	/*
+	 * Identify and possibly warn of a displacement relocation.
+	 */
+	if (orsp->rel_flags & FLG_REL_DISP) {
+		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
+
+		if (ofl->ofl_flags & FLG_OF_VERBOSE)
+			ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
+	}
+	DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_RELA,
+	    M_MACH, orsp));
+	return (1);
+}
+
+/*
+ * Process relocation against a register symbol.  Note, of -z muldefs is in
+ * effect there may have been multiple register definitions, which would have
+ * been processed as non-fatal, with the first definition winning.  But, we
+ * will also process multiple relocations for these multiple definitions.  In
+ * this case we must only preserve the relocation for the definition that was
+ * kept.  The sad part is that register relocations don't typically specify
+ * the register symbol with which they are associated, so we might have to
+ * search the input files global symbols to determine if this relocation is
+ * appropriate.
+ */
+uintptr_t
+ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
+{
+	if (ofl->ofl_flags & FLG_OF_MULDEFS) {
+		Ifl_desc *	ifl = isp->is_file;
+		Sym_desc *	sdp = rsp->rel_sym;
+
+		if (sdp == 0) {
+			Xword		offset = rsp->rel_roffset;
+			Word		ndx;
+
+			for (ndx = ifl->ifl_locscnt;
+			    ndx < ifl->ifl_symscnt; ndx++) {
+				if (((sdp = ifl->ifl_oldndx[ndx]) != 0) &&
+				    (sdp->sd_flags & FLG_SY_REGSYM) &&
+				    (sdp->sd_sym->st_value == offset))
+					break;
+			}
+		}
+		if (sdp && (sdp->sd_file != ifl))
+			return (1);
+	}
+	return (ld_add_outrel((rsp->rel_flags | FLG_REL_REG), rsp, ofl));
+}
+
+/*
+ * process relocation for a LOCAL symbol
+ */
+uintptr_t
+ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		flags = ofl->ofl_flags;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		shndx = rsp->rel_sym->sd_shndx;
+
+	/*
+	 * if ((shared object) and (not pc relative relocation) and
+	 *    (not against ABS symbol))
+	 * then
+	 *	if (rtype != R_SPARC_32)
+	 *	then
+	 *		build relocation against section
+	 *	else
+	 *		build R_SPARC_RELATIVE
+	 *	fi
+	 * fi
+	 */
+	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
+	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
+	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
+	    !(rsp->rel_isdesc != NULL &&
+	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
+	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
+	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
+		Word	ortype = rsp->rel_rtype;
+
+		if ((rsp->rel_rtype != R_SPARC_32) &&
+		    (rsp->rel_rtype != R_SPARC_PLT32) &&
+		    (rsp->rel_rtype != R_SPARC_64))
+			return (ld_add_outrel((FLG_REL_SCNNDX | FLG_REL_ADVAL),
+			    rsp, ofl));
+
+		rsp->rel_rtype = R_SPARC_RELATIVE;
+		if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = ortype;
+		return (1);
+	}
+
+	/*
+	 * If the relocation is against a 'non-allocatable' section
+	 * and we can not resolve it now - then give a warning
+	 * message.
+	 *
+	 * We can not resolve the symbol if either:
+	 *	a) it's undefined
+	 *	b) it's defined in a shared library and a
+	 *	   COPY relocation hasn't moved it to the executable
+	 *
+	 * Note: because we process all of the relocations against the
+	 *	text segment before any others - we know whether
+	 *	or not a copy relocation will be generated before
+	 *	we get here (see reloc_init()->reloc_segments()).
+	 */
+	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
+	    ((shndx == SHN_UNDEF) ||
+	    ((sdp->sd_ref == REF_DYN_NEED) &&
+	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
+		/*
+		 * If the relocation is against a SHT_SUNW_ANNOTATE
+		 * section - then silently ignore that the relocation
+		 * can not be resolved.
+		 */
+		if (rsp->rel_osdesc &&
+		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
+			return (0);
+		(void) eprintf(ofl->ofl_lml, ERR_WARNING,
+		    MSG_INTL(MSG_REL_EXTERNSYM),
+		    conv_reloc_SPARC_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
+		return (1);
+	}
+
+	/*
+	 * Perform relocation.
+	 */
+	return (ld_add_actrel(NULL, rsp, ofl));
+}
+
+uintptr_t
+ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word	rtype = rsp->rel_rtype;
+
+	if (!local) {
+		/*
+		 * When binding to a external symbol, no fixups are required
+		 * and the GOTDATA_OP relocation can be ignored.
+		 */
+		if (rtype == R_SPARC_GOTDATA_OP)
+			return (1);
+		return (ld_reloc_GOT_relative(local, rsp, ofl));
+	}
+
+	/*
+	 * When binding to a local symbol the relocations can be transitioned:
+	 *
+	 *	R_*_GOTDATA_OP_HIX22 -> R_*_GOTDATA_HIX22
+	 *	R_*_GOTDATA_OP_LOX10 -> R_*_GOTDATA_LOX10
+	 *	R_*_GOTDATA_OP ->	instruction fixup
+	 */
+	return (ld_add_actrel(FLG_REL_GOTFIX, rsp, ofl));
+}
+
+uintptr_t
+ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
+{
+	Word		rtype = rsp->rel_rtype;
+	Sym_desc	*sdp = rsp->rel_sym;
+	Word		flags = ofl->ofl_flags;
+	Word		rflags;
+	Gotndx		*gnp;
+
+	/*
+	 * all TLS relocations are illegal in a static executable.
+	 */
+	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
+	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
+		    conv_reloc_SPARC_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * Any TLS relocation must be against a STT_TLS symbol, all others
+	 * are illegal.
+	 */
+	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
+		Ifl_desc	*ifl = rsp->rel_isdesc->is_file;
+
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
+		    conv_reloc_SPARC_type(rsp->rel_rtype),
+		    ifl->ifl_name, demangle(rsp->rel_sname),
+		    conv_sym_info_type(ifl->ifl_ehdr->e_machine,
+		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
+		return (S_ERROR);
+	}
+
+	/*
+	 * We're a executable - use either the IE or LE
+	 * access model.
+	 */
+	if (flags & FLG_OF_EXEC) {
+		/*
+		 * If we are using either IE or LE reference
+		 * model set the DF_STATIC_TLS flag.
+		 */
+		ofl->ofl_dtflags |= DF_STATIC_TLS;
+
+		if (!local) {
+			/*
+			 * IE access model
+			 */
+			/*
+			 * When building a executable - these relocations
+			 * can be ignored.
+			 */
+			if ((rtype == R_SPARC_TLS_IE_LD) ||
+			    (rtype == R_SPARC_TLS_IE_LDX) ||
+			    (rtype == R_SPARC_TLS_IE_ADD))
+				return (1);
+
+			/*
+			 * It's not possible for LD or LE reference
+			 * models to reference a symbol external to
+			 * the current object.
+			 */
+			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_REL_TLSBND),
+				    conv_reloc_SPARC_type(rsp->rel_rtype),
+				    rsp->rel_isdesc->is_file->ifl_name,
+				    demangle(rsp->rel_sname),
+				    sdp->sd_file->ifl_name);
+				return (S_ERROR);
+			}
+
+			/*
+			 * Assign a GOT entry for static TLS references
+			 */
+			if (((rtype == R_SPARC_TLS_GD_HI22) ||
+			    (rtype == R_SPARC_TLS_GD_LO10) ||
+			    (rtype == R_SPARC_TLS_IE_HI22) ||
+			    (rtype == R_SPARC_TLS_IE_LO10)) &&
+			    ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+			    GOT_REF_TLSIE, ofl, rsp)) == 0)) {
+				if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp,
+				    GOT_REF_TLSIE, ofl, rsp, sdp) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = M_R_TPOFF;
+				if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS),
+				    rsp, ofl) == S_ERROR)
+					return (S_ERROR);
+				rsp->rel_rtype = rtype;
+			}
+
+			if (IS_TLS_IE(rtype))
+				return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+
+			/*
+			 * If (GD) reference models - fixups
+			 * are required.
+			 */
+			return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+			    rsp, ofl));
+		}
+		/*
+		 * LE access model
+		 */
+		if (IS_TLS_LE(rtype))
+			return (ld_add_actrel(FLG_REL_STLS, rsp, ofl));
+
+		/*
+		 * When building a executable - these relocations
+		 * can be ignored.
+		 */
+		if (rtype == R_SPARC_TLS_IE_ADD)
+			return (1);
+
+		return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
+		    rsp, ofl));
+	}
+
+	/*
+	 * Building a shared object
+	 */
+
+	/*
+	 * Building a shared object - only GD & LD access models
+	 * will work here.
+	 */
+	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
+		    conv_reloc_SPARC_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname));
+		return (S_ERROR);
+	}
+
+	/*
+	 * LD access mode can only bind to local symbols.
+	 */
+	if (!local && IS_TLS_LD(rtype)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
+		    conv_reloc_SPARC_type(rsp->rel_rtype),
+		    rsp->rel_isdesc->is_file->ifl_name,
+		    demangle(rsp->rel_sname),
+		    sdp->sd_file->ifl_name);
+		return (S_ERROR);
+	}
+
+	/*
+	 * For dynamic TLS references - ADD relocations
+	 * are ignored.
+	 */
+	if ((rtype == R_SPARC_TLS_GD_ADD) || (rtype == R_SPARC_TLS_LDM_ADD) ||
+	    (rtype == R_SPARC_TLS_LDO_ADD))
+		return (1);
+
+	/*
+	 * Assign a GOT entry for a dynamic TLS reference.
+	 */
+	if (((rtype == R_SPARC_TLS_LDM_HI22) ||
+	    (rtype == R_SPARC_TLS_LDM_LO10)) &&
+	    ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+	    GOT_REF_TLSLD, ofl, rsp)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = M_R_DTPMOD;
+		rflags = FLG_REL_GOT | FLG_REL_MTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+
+		rsp->rel_rtype = rtype;
+
+	} else if (((rtype == R_SPARC_TLS_GD_HI22) || (rtype ==
+	    R_SPARC_TLS_GD_LO10)) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs),
+	    GOT_REF_TLSGD, ofl, rsp)) == 0)) {
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
+		    ofl, rsp, sdp) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_rtype = M_R_DTPMOD;
+		rflags = FLG_REL_GOT | FLG_REL_DTLS;
+		if (local)
+			rflags |= FLG_REL_SCNNDX;
+
+		if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+
+		if (local == TRUE) {
+			rsp->rel_rtype = M_R_DTPOFF;
+			if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		} else {
+			rsp->rel_rtype = M_R_DTPOFF;
+			if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
+			    ofl) == S_ERROR)
+				return (S_ERROR);
+		}
+		rsp->rel_rtype = rtype;
+	}
+	/*
+	 * For GD/LD TLS reference - TLS_{GD,LD}_CALL, this will eventually
+	 * cause a call to __tls_get_addr().  Let's convert this
+	 * relocation to that symbol now, and prepare for the PLT magic.
+	 */
+	if ((rtype == R_SPARC_TLS_GD_CALL) || (rtype == R_SPARC_TLS_LDM_CALL)) {
+		Sym_desc *	tlsgetsym;
+
+		if ((tlsgetsym = ld_sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_U),
+		    ofl)) == (Sym_desc *)S_ERROR)
+			return (S_ERROR);
+		rsp->rel_sym = tlsgetsym;
+		rsp->rel_sname = tlsgetsym->sd_name;
+		rsp->rel_rtype = R_SPARC_WPLT30;
+		if (ld_reloc_plt(rsp, ofl) == S_ERROR)
+			return (S_ERROR);
+		rsp->rel_sym = sdp;
+		rsp->rel_sname = sdp->sd_name;
+		rsp->rel_rtype = rtype;
+		return (1);
+	}
+
+	if (IS_TLS_LD(rtype))
+		return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl));
+
+	return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl));
+}
+
+/*
+ * ld_allocate_got: if a GOT is to be made, after the section is built this
+ * function is called to allocate all the GOT slots.  The allocation is
+ * deferred until after all GOTs have been counted and sorted according
+ * to their size, for only then will we know how to allocate them on
+ * a processor like SPARC which has different models for addressing the
+ * GOT.  SPARC has two: small and large, small uses a signed 13-bit offset
+ * into the GOT, whereas large uses an unsigned 32-bit offset.
+ */
+static	Sword small_index;	/* starting index for small GOT entries */
+static	Sword large_index;	/* starting index for large GOT entries */
+
+uintptr_t
+ld_assign_got(Ofl_desc *ofl, Sym_desc * sdp)
+{
+	Listnode *	lnp;
+	Gotndx *	gnp;
+
+	for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp, gnp)) {
+		uint_t	gotents;
+		Gotref	gref;
+		gref = gnp->gn_gotref;
+		if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
+			gotents = 2;
+		else
+			gotents = 1;
+
+		switch (gnp->gn_gotndx) {
+		case M_GOT_SMALL:
+			gnp->gn_gotndx = small_index;
+			small_index += gotents;
+			if (small_index == 0)
+				small_index = M_GOT_XNumber;
+			break;
+		case M_GOT_LARGE:
+			gnp->gn_gotndx = large_index;
+			large_index += gotents;
+			break;
+		default:
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_ASSIGNGOT),
+			    EC_XWORD(gnp->gn_gotndx), demangle(sdp->sd_name));
+			return (S_ERROR);
+		}
+	}
+	return (1);
+}
+
+/*
+ * Search the GOT index list for a GOT entry with the proper addend.
+ */
+Gotndx *
+ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
+{
+	Listnode *	lnp;
+	Gotndx *	gnp;
+
+	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
+		return (ofl->ofl_tlsldgotndx);
+
+	for (LIST_TRAVERSE(lst, lnp, gnp)) {
+		if ((rdesc->rel_raddend == gnp->gn_addend) &&
+		    (gref == gnp->gn_gotref))
+			return (gnp);
+	}
+	return ((Gotndx *)0);
+}
+
+Xword
+ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
+{
+	Os_desc		*osp = ofl->ofl_osgot;
+	Sym_desc	*sdp = rdesc->rel_sym;
+	Xword		gotndx;
+	Gotref		gref;
+	Gotndx		*gnp;
+
+	if (rdesc->rel_flags & FLG_REL_DTLS)
+		gref = GOT_REF_TLSGD;
+	else if (rdesc->rel_flags & FLG_REL_MTLS)
+		gref = GOT_REF_TLSLD;
+	else if (rdesc->rel_flags & FLG_REL_STLS)
+		gref = GOT_REF_TLSIE;
+	else
+		gref = GOT_REF_GENERIC;
+
+	gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc);
+	assert(gnp);
+
+	gotndx = (Xword)gnp->gn_gotndx;
+
+	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
+	    (rdesc->rel_rtype == M_R_DTPOFF))
+		gotndx++;
+
+	return ((Xword)((osp->os_shdr->sh_addr) + (gotndx * M_GOT_ENTSIZE) +
+	    (-neggotoffset * M_GOT_ENTSIZE)));
+}
+
+uintptr_t
+ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
+    Rel_desc * rsp, Sym_desc * sdp)
+{
+	Xword		raddend;
+	Gotndx *	gnp, * _gnp;
+	Listnode *	lnp, * plnp;
+	uint_t		gotents;
+
+	raddend = rsp->rel_raddend;
+	if (pgnp && (pgnp->gn_addend == raddend) && (pgnp->gn_gotref == gref)) {
+		/*
+		 * If an entry for this addend already exists, determine if it
+		 * should be changed to a SMALL got.
+		 */
+		if ((pgnp->gn_gotndx != M_GOT_SMALL) &&
+		    (rsp->rel_rtype == R_SPARC_GOT13)) {
+			smlgotcnt++;
+			pgnp->gn_gotndx = M_GOT_SMALL;
+			sdp->sd_flags |= FLG_SY_SMGOT;
+		}
+		return (1);
+	}
+
+	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
+		gotents = 2;
+	else
+		gotents = 1;
+
+	plnp = 0;
+	for (LIST_TRAVERSE(lst, lnp, _gnp)) {
+		if (_gnp->gn_addend > raddend)
+			break;
+		plnp = lnp;
+	}
+
+	/*
+	 * Allocate a new entry.
+	 */
+	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
+		return (S_ERROR);
+	gnp->gn_addend = raddend;
+	gnp->gn_gotref = gref;
+	ofl->ofl_gotcnt += gotents;
+
+	if (rsp->rel_rtype == R_SPARC_GOT13) {
+		gnp->gn_gotndx = M_GOT_SMALL;
+		smlgotcnt++;
+		sdp->sd_flags |= FLG_SY_SMGOT;
+	} else
+		gnp->gn_gotndx = M_GOT_LARGE;
+
+	if (gref == GOT_REF_TLSLD) {
+		ofl->ofl_tlsldgotndx = gnp;
+		return (1);
+	}
+
+	if (plnp == 0) {
+		/*
+		 * Insert at head of list
+		 */
+		if (list_prependc(lst, (void *)gnp) == 0)
+			return (S_ERROR);
+	} else if (_gnp->gn_addend > raddend) {
+		/*
+		 * Insert in middle of lest
+		 */
+		if (list_insertc(lst, (void *)gnp, plnp) == 0)
+			return (S_ERROR);
+	} else {
+		/*
+		 * Append to tail of list
+		 */
+		if (list_appendc(lst, (void *)gnp) == 0)
+			return (S_ERROR);
+	}
+	return (1);
+}
+
+void
+ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
+{
+	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
+}
+
+
+uintptr_t
+ld_allocate_got(Ofl_desc * ofl)
+{
+	Sym_desc *	sdp;
+	Addr		addr;
+
+	/*
+	 * Sanity check -- is this going to fit at all?
+	 */
+	if (smlgotcnt >= M_GOT_MAXSMALL) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_SMALLGOT),
+		    EC_WORD(smlgotcnt), M_GOT_MAXSMALL);
+		return (S_ERROR);
+	}
+
+	/*
+	 * Set starting offset to be either 0, or a negative index into
+	 * the GOT based on the number of small symbols we've got.
+	 */
+	neggotoffset = ((smlgotcnt > (M_GOT_MAXSMALL / 2)) ?
+	    -((smlgotcnt - (M_GOT_MAXSMALL / 2))) : 0);
+
+	/*
+	 * Initialize the large and small got offsets (used in assign_got()).
+	 */
+	small_index = neggotoffset == 0 ? M_GOT_XNumber : neggotoffset;
+	large_index = neggotoffset + smlgotcnt;
+
+	/*
+	 * Assign bias to GOT symbols.
+	 */
+	addr = -neggotoffset * M_GOT_ENTSIZE;
+	if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl))
+		sdp->sd_sym->st_value = addr;
+	if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl))
+		sdp->sd_sym->st_value = addr;
+
+	if (ofl->ofl_tlsldgotndx) {
+		ofl->ofl_tlsldgotndx->gn_gotndx = large_index;
+		large_index += 2;
+	}
+	return (1);
+}
+
+
+/*
+ * Initializes .got[0] with the _DYNAMIC symbol value.
+ */
+uintptr_t
+ld_fillin_gotplt(Ofl_desc * ofl)
+{
+	if (ofl->ofl_osgot) {
+		Sym_desc *	sdp;
+
+		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
+		    SYM_NOHASH, 0, ofl)) != NULL) {
+			uchar_t	*genptr = ((uchar_t *)
+			    ofl->ofl_osgot->os_outdata->d_buf +
+			    (-neggotoffset * M_GOT_ENTSIZE) +
+			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
+			/* LINTED */
+			*((Xword *)genptr) = sdp->sd_sym->st_value;
+		}
+	}
+	return (1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/machsym.intel.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<stdio.h>
+#include	<debug.h>
+#include	"_libld.h"
+
+
+/*
+ * This file contains stub routines since currently register symbols
+ * are not relevant to the i386 architecture.  But - having these
+ * stub routines avoids #ifdefs in common codes - and I hate that.
+ */
+/* ARGSUSED */
+int
+ld_reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl,
+    Ofl_desc * ofl)
+{
+	return (1);
+}
+
+/* ARGSUSED */
+int
+ld_mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl)
+{
+	return (0);
+}
+
+/* ARGSUSED */
+const char *
+ld_is_regsym(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs,
+    int symndx, Word shndx, const char *symsecname, Word * flags)
+{
+	return (0);
+}
+
+/* ARGSUSED */
+Sym_desc *
+ld_reg_find(Sym * sym, Ofl_desc * ofl)
+{
+	return (0);
+}
+
+/* ARGSUSED */
+int
+ld_reg_enter(Sym_desc * sdp, Ofl_desc * ofl)
+{
+	return (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/machsym.sparc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,248 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<stdio.h>
+#include	<string.h>
+#include	<alloca.h>
+#include	<sys/types.h>
+#include	<debug.h>
+#include	"msg.h"
+#include	"_libld.h"
+
+/*
+ * Matrix of legal combinations of usage of a given register:
+ *
+ *	Obj1 \ Obj2      Scratch	Named
+ *	Scratch          OK		NO
+ *	Named            NO		*
+ *
+ * (*) OK if the symbols are identical, NO if they are not.  Two symbols
+ * are identical if and only if one of the following is true:
+ *   A. They are both global and have the same name.
+ *   B. They are both local, have the same name, and are defined in the same
+ *	object.  (Note that a local symbol in one object is never identical to
+ *	a local symbol in another object, even if the name is the same.)
+ *
+ * Matrix of legal combinations of st_shndx for the same register symbol:
+ *
+ *	Obj1 \ Obj2      UNDEF		ABS
+ *	UNDEF            OK		OK
+ *	ABS              OK		NO
+ *
+ */
+int
+ld_reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl,
+    Ofl_desc * ofl)
+{
+	Sym		*osym = sdp->sd_sym;
+	const char	*oname = sdp->sd_name;
+
+	/*
+	 * Scratch register definitions are compatible.
+	 */
+	if ((osym->st_name == 0) && (nsym->st_name == 0))
+		return (0);
+
+	/*
+	 * A local and a global, or another local is incompatible.
+	 */
+	if ((ELF_ST_BIND(osym->st_info) == STB_LOCAL) ||
+	    (ELF_ST_BIND(nsym->st_info) == STB_LOCAL)) {
+		if (osym->st_value == nsym->st_value) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_INCOMPREG3),
+			    conv_sym_SPARC_value(osym->st_value),
+			    sdp->sd_file->ifl_name, demangle(oname),
+			    ifl->ifl_name, demangle(nname));
+			ofl->ofl_flags |= FLG_OF_FATAL;
+			return (1);
+		}
+		return (0);
+	}
+
+	if (osym->st_value == nsym->st_value) {
+		/*
+		 * A scratch register and a named register are incompatible.
+		 * So are two different named registers.
+		 */
+		if (((osym->st_name == 0) || (nsym->st_name == 0)) ||
+		    (strcmp(oname, nname) != 0)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_INCOMPREG1),
+			    conv_sym_SPARC_value(osym->st_value),
+			    sdp->sd_file->ifl_name, demangle(oname),
+			    ifl->ifl_name, demangle(nname));
+			ofl->ofl_flags |= FLG_OF_FATAL;
+			return (1);
+		}
+
+		/*
+		 * A multiply initialized symbol is also illegal.
+		 */
+		if ((osym->st_shndx == SHN_ABS) &&
+		    (nsym->st_shndx == SHN_ABS)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_MULTINIREG),
+			    conv_sym_SPARC_value(osym->st_value),
+			    demangle(nname), sdp->sd_file->ifl_name,
+			    ifl->ifl_name);
+			ofl->ofl_flags |= FLG_OF_FATAL;
+			return (1);
+		}
+
+	} else if (strcmp(oname, nname) == 0) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG2),
+		    demangle(sdp->sd_name), sdp->sd_file->ifl_name,
+		    conv_sym_SPARC_value(osym->st_value), ifl->ifl_name,
+		    conv_sym_SPARC_value(nsym->st_value));
+		ofl->ofl_flags |= FLG_OF_FATAL;
+		return (1);
+	}
+	return (0);
+}
+
+int
+ld_mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl)
+{
+	Sym	*osym = sdp->sd_sym;
+	Byte	otype = ELF_ST_TYPE(osym->st_info);
+	Byte	ntype = ELF_ST_TYPE(nsym->st_info);
+
+	if (otype != ntype) {
+		if ((otype == STT_SPARC_REGISTER) ||
+		    (ntype == STT_SPARC_REGISTER)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name));
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_FILETYPES),
+			    sdp->sd_file->ifl_name, conv_sym_info_type(
+			    sdp->sd_file->ifl_ehdr->e_machine, otype),
+			    ifl->ifl_name,
+			    conv_sym_info_type(ifl->ifl_ehdr->e_machine,
+			    ntype));
+			ofl->ofl_flags |= FLG_OF_FATAL;
+			return (1);
+		}
+	} else if (otype == STT_SPARC_REGISTER)
+		return (ld_reg_check(sdp, nsym, sdp->sd_name, ifl, ofl));
+
+	return (0);
+}
+
+static const char *registers[] = { 0,
+	MSG_ORIG(MSG_STO_REGISTERG1),	MSG_ORIG(MSG_STO_REGISTERG2),
+	MSG_ORIG(MSG_STO_REGISTERG3),	MSG_ORIG(MSG_STO_REGISTERG4),
+	MSG_ORIG(MSG_STO_REGISTERG5),	MSG_ORIG(MSG_STO_REGISTERG6),
+	MSG_ORIG(MSG_STO_REGISTERG7)
+};
+
+const char *
+ld_is_regsym(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs,
+    int symndx, Word shndx, const char *symsecname, Word * flags)
+{
+	const char	*name;
+
+	/*
+	 * Only do something if this is a register symbol.
+	 */
+	if (ELF_ST_TYPE(sym->st_info) != STT_SPARC_REGISTER)
+		return (0);
+
+	/*
+	 * Check for bogus register number.
+	 */
+	if ((sym->st_value < STO_SPARC_REGISTER_G1) ||
+	    (sym->st_value > STO_SPARC_REGISTER_G7)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_BADREG),
+		    ifl->ifl_name, symsecname, symndx, EC_XWORD(sym->st_value));
+		return ((const char *)S_ERROR);
+	}
+
+	/*
+	 * A register symbol can only be undefined or defined (absolute).
+	 */
+	if ((shndx != SHN_ABS) && (shndx != SHN_UNDEF)) {
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_BADREG),
+		    ifl->ifl_name, symsecname, symndx, EC_XWORD(sym->st_value));
+		return ((const char *)S_ERROR);
+	}
+
+	/*
+	 * Determine whether this is a scratch (unnamed) definition.
+	 */
+	if (sym->st_name == 0) {
+		/*
+		 * Check for bogus scratch register definitions.
+		 */
+		if ((ELF_ST_BIND(sym->st_info) != STB_GLOBAL) ||
+		    (shndx != SHN_UNDEF)) {
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_BADSCRATCH),
+			    ifl->ifl_name, symsecname, symndx,
+			    conv_sym_SPARC_value(sym->st_value));
+			return ((const char *)S_ERROR);
+		}
+
+		/*
+		 * Fabricate a name for this register so that this definition
+		 * can be processed through the symbol resolution engine.
+		 */
+		name = registers[sym->st_value];
+	} else
+		name = strs + sym->st_name;
+
+	/*
+	 * Indicate we're dealing with a register and return its name.
+	 */
+	*flags |= FLG_SY_REGSYM;
+	return (name);
+}
+
+Sym_desc *
+ld_reg_find(Sym * sym, Ofl_desc * ofl)
+{
+	if (ofl->ofl_regsyms == 0)
+		return (0);
+
+	return (ofl->ofl_regsyms[sym->st_value]);
+}
+
+int
+ld_reg_enter(Sym_desc * sdp, Ofl_desc * ofl)
+{
+	if (ofl->ofl_regsyms == 0) {
+		ofl->ofl_regsymsno = STO_SPARC_REGISTER_G7 + 1;
+		if ((ofl->ofl_regsyms = libld_calloc(sizeof (Sym_desc *),
+		    ofl->ofl_regsymsno)) == 0) {
+			ofl->ofl_flags |= FLG_OF_FATAL;
+			return (0);
+		}
+	}
+
+	ofl->ofl_regsyms[sdp->sd_sym->st_value] = sdp;
+	return (1);
+}
--- a/usr/src/cmd/sgs/libld/common/map.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/map.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -42,17 +41,17 @@
 #include	<dirent.h>
 #include	<ctype.h>
 #include	<elfcap.h>
+#include	<debug.h>
 #include	"msg.h"
-#include	"debug.h"
 #include	"_libld.h"
 
-#ifdef _ELF64
+#if	defined(_ELF64)
 #define	STRTOADDR	strtoull
 #define	XWORD_MAX	ULLONG_MAX
 #else	/* Elf32 */
 #define	STRTOADDR	strtoul
 #define	XWORD_MAX	UINT_MAX
-#endif /* _ELF64 */
+#endif	/* _ELF64 */
 
 typedef enum {
 	TK_STRING,	TK_COLON,	TK_SEMICOLON,	TK_EQUAL,
@@ -80,7 +79,7 @@
  * Get a token from the mapfile.
  */
 static Token
-gettoken(const char *mapfile)
+gettoken(Ofl_desc *ofl, const char *mapfile)
 {
 	static char	oldchr = '\0';	/* Char at end of current token. */
 	char		*end;		/* End of the current token. */
@@ -94,8 +93,9 @@
 		if (!isascii(*nextchr) ||
 		    (!isprint(*nextchr) && !isspace(*nextchr) &&
 		    (*nextchr != '\0'))) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_ILLCHAR),
-			    mapfile, EC_XWORD(Line_num), *((uchar_t *)nextchr));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_ILLCHAR), mapfile,
+			    EC_XWORD(Line_num), *((uchar_t *)nextchr));
 			/* LINTED */
 			return ((Token)S_ERROR);
 		}
@@ -143,8 +143,9 @@
 			if (((end = strpbrk(nextchr,
 			    MSG_ORIG(MSG_MAP_TOK_1))) == NULL) ||
 			    (*end != '"')) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_NOTERM),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_NOTERM), mapfile,
+				    EC_XWORD(Line_num));
 				/* LINTED */
 				return ((Token)S_ERROR);
 			}
@@ -194,18 +195,20 @@
 	Xword	number;
 	int	used = 0;
 
-	while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 		/* LINTED */
 		if (tok == (Token)S_ERROR)
 			return (S_ERROR);
 		if (tok == TK_EOF) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_PREMEOF), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 		if (tok != TK_STRING) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGATT),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSEGATT), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -255,15 +258,16 @@
 			number = (Xword)strtoul(&Start_tok[1], &end_tok, 0);
 			if (errno) {
 				int	err = errno;
-				eprintf(ERR_FATAL,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
 				    MSG_INTL(MSG_MAP_BADCAPVAL),
 				    mapfile, EC_XWORD(Line_num), Start_tok,
 				    strerror(err));
 				return (S_ERROR);
 			}
 			if (end_tok != strchr(Start_tok, '\0')) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_BADCAPVAL),
-				    mapfile, EC_XWORD(Line_num), Start_tok,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_BADCAPVAL), mapfile,
+				    EC_XWORD(Line_num), Start_tok,
 				    MSG_INTL(MSG_MAP_NOBADFRM));
 				return (S_ERROR);
 			}
@@ -280,7 +284,7 @@
 		 * We have an unknown token.
 		 */
 		used++;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKCAPATTR),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_UNKCAPATTR),
 		    mapfile, EC_XWORD(Line_num), Start_tok);
 		return (S_ERROR);
 	}
@@ -290,7 +294,7 @@
 	 * have been initialized if necessary.
 	 */
 	if (used == 0) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_EMPTYCAP),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_EMPTYCAP),
 		    mapfile, EC_XWORD(Line_num));
 	} else if (type == CA_SUNW_SF_1) {
 		Lword	badsf1;
@@ -305,14 +309,15 @@
 		 * capabilities that are known.
 		 */
 		if ((badsf1 = (ofl->ofl_sfcap_1 & ~SF1_SUNW_MASK)) != 0) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_BADSF1),
-			    mapfile, EC_XWORD(Line_num), EC_LWORD(badsf1));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_MAP_BADSF1), mapfile,
+			    EC_XWORD(Line_num), EC_LWORD(badsf1));
 			ofl->ofl_sfcap_1 &= SF1_SUNW_MASK;
 		}
 		if (ofl->ofl_sfcap_1 == SF1_SUNW_FPUSED) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1),
-			    mapfile, EC_XWORD(Line_num),
-			    EC_LWORD(SF1_SUNW_FPUSED));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_FIL_BADSF1), mapfile,
+			    EC_XWORD(Line_num), EC_LWORD(SF1_SUNW_FPUSED));
 			ofl->ofl_sfcap_1 = 0;
 		}
 	}
@@ -337,18 +342,20 @@
 	Boolean	b_paddr = FALSE;	/* True if seg physical addr found. */
 	Boolean	b_align = FALSE;	/* True if seg alignment found. */
 
-	while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 		/* LINTED */
 		if (tok == (Token)S_ERROR)
 			return (S_ERROR);
 		if (tok == TK_EOF) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_PREMEOF), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 		if (tok != TK_STRING) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGATT),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSEGATT), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -361,23 +368,26 @@
 		 */
 		if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_LOAD)) == 0) {
 			if (b_type) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGTYP));
 				return (S_ERROR);
 			}
 			if ((sgp->sg_flags & FLG_SG_TYPE) &&
 			    (sgp->sg_phdr.p_type != PT_LOAD))
-				eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_MAP_REDEFATT), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGTYP), sgp->sg_name);
 			sgp->sg_phdr.p_type = PT_LOAD;
 			sgp->sg_flags |= FLG_SG_TYPE;
 			b_type = TRUE;
 		} else if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_STACK)) == 0) {
 			if (b_type) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGTYP));
 				return (S_ERROR);
 			}
@@ -386,15 +396,17 @@
 			b_type = TRUE;
 		} else if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_NOTE)) == 0) {
 			if (b_type) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGTYP));
 				return (S_ERROR);
 			}
 			if ((sgp->sg_flags & FLG_SG_TYPE) &&
 			    (sgp->sg_phdr.p_type != PT_NOTE))
-				eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_MAP_REDEFATT), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGTYP), sgp->sg_name);
 			sgp->sg_phdr.p_type = PT_NOTE;
 			sgp->sg_flags |= FLG_SG_TYPE;
@@ -409,8 +421,9 @@
 			char	*flag_tok = Start_tok + 1;
 
 			if (b_flags) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGFLAG));
 				return (S_ERROR);
 			}
@@ -443,7 +456,7 @@
 						sgp->sg_flags |= FLG_SG_NOHDR;
 						break;
 					default:
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_UNKSEGFLG),
 						    mapfile, EC_XWORD(Line_num),
 						    *flag_tok);
@@ -462,8 +475,9 @@
 			    !(sgp->sg_phdr.p_type == PT_LOAD &&
 			    (tmp_flags & (PF_R|PF_W)) == (PF_R|PF_W) &&
 			    (tmp_flags ^ sgp->sg_phdr.p_flags) == PF_X)) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_MAP_REDEFATT), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGFLAG), sgp->sg_name);
 			}
 			sgp->sg_flags |= FLG_SG_FLAGS;
@@ -482,15 +496,17 @@
 
 			if ((number = (Xword)STRTOADDR(&Start_tok[1], &end_tok,
 			    0))	>= XWORD_MAX) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR),
-				    mapfile, EC_XWORD(Line_num), Start_tok,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_SEGADDR), mapfile,
+				    EC_XWORD(Line_num), Start_tok,
 				    MSG_INTL(MSG_MAP_EXCLIMIT));
 				return (S_ERROR);
 			}
 
 			if (end_tok != strchr(Start_tok, '\0')) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR),
-				    mapfile, EC_XWORD(Line_num), Start_tok,
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_SEGADDR), mapfile,
+				    EC_XWORD(Line_num), Start_tok,
 				    MSG_INTL(MSG_MAP_NOBADFRM));
 				return (S_ERROR);
 			}
@@ -498,7 +514,7 @@
 			switch (*Start_tok) {
 			case 'l':
 				if (b_len) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_MOREONCE),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGLEN));
@@ -506,7 +522,7 @@
 				}
 				if ((sgp->sg_flags & FLG_SG_LENGTH) &&
 				    (sgp->sg_length != number))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_REDEFATT),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGLEN),
@@ -517,7 +533,7 @@
 				break;
 			case 'r':
 				if (b_round) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_MOREONCE),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGROUND));
@@ -525,7 +541,7 @@
 				}
 				if ((sgp->sg_flags & FLG_SG_ROUND) &&
 				    (sgp->sg_round != number))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_REDEFATT),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGROUND),
@@ -536,7 +552,7 @@
 				break;
 			case 'v':
 				if (b_vaddr) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_MOREONCE),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGVADDR));
@@ -544,7 +560,7 @@
 				}
 				if ((sgp->sg_flags & FLG_SG_VADDR) &&
 				    (sgp->sg_phdr.p_vaddr != number))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_REDEFATT),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGVADDR),
@@ -557,7 +573,7 @@
 				break;
 			case 'p':
 				if (b_paddr) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_MOREONCE),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGPHYS));
@@ -565,7 +581,7 @@
 				}
 				if ((sgp->sg_flags & FLG_SG_PADDR) &&
 				    (sgp->sg_phdr.p_paddr != number))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_REDEFATT),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGPHYS),
@@ -577,7 +593,7 @@
 				break;
 			case 'a':
 				if (b_align) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_MOREONCE),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGALIGN));
@@ -585,7 +601,7 @@
 				}
 				if ((sgp->sg_flags & FLG_SG_ALIGN) &&
 				    (sgp->sg_phdr.p_align != number))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_REDEFATT),
 					    mapfile, EC_XWORD(Line_num),
 					    MSG_INTL(MSG_MAP_SEGALIGN),
@@ -597,8 +613,9 @@
 				break;
 			}
 		} else {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGATT),
-			    mapfile, EC_XWORD(Line_num), Start_tok);
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_UNKSEGATT), mapfile,
+			    EC_XWORD(Line_num), Start_tok);
 			return (S_ERROR);
 		}
 	}
@@ -612,25 +629,29 @@
 	if ((sgp->sg_flags & FLG_SG_EMPTY) &&
 	    (sgp->sg_phdr.p_type != PT_SUNWSTACK)) {
 		if (!(ofl->ofl_flags & FLG_OF_EXEC)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPEXE),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_SEGEMPEXE), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 		if (sgp->sg_phdr.p_flags != 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMNOPERM),
-				mapfile, EC_XWORD(Line_num),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_SEGEMNOPERM), mapfile,
+			    EC_XWORD(Line_num),
 				EC_WORD(sgp->sg_phdr.p_flags));
 			return (S_ERROR);
 		}
 		if ((sgp->sg_flags & (FLG_SG_LENGTH | FLG_SG_VADDR)) !=
 		    (FLG_SG_LENGTH | FLG_SG_VADDR)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPATT),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_SEGEMPATT), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 		if (sgp->sg_phdr.p_type != PT_LOAD) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_SEGEMPLOAD),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_MAP_SEGEMPLOAD), mapfile,
+			    EC_XWORD(Line_num));
 			sgp->sg_phdr.p_type = PT_LOAD;
 		}
 	}
@@ -639,7 +660,7 @@
 	 * All segment attributes have now been scanned.  Certain flags do not
 	 * make sense if this is not a loadable segment, fix if necessary.
 	 * Note, if the segment is of type PT_NULL it must be new, and any
-	 * defaults will be applied back in map_parse().
+	 * defaults will be applied back in ld_map_parse().
 	 * When clearing an attribute leave the flag set as an indicator for
 	 * later entries re-specifying the same segment.
 	 */
@@ -654,29 +675,30 @@
 		if ((sgp->sg_flags & FLG_SG_FLAGS) &&
 		    (sgp->sg_phdr.p_type != PT_SUNWSTACK)) {
 			if (sgp->sg_phdr.p_flags != 0) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_NONLOAD),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_MAP_NONLOAD), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGFLAG));
 				sgp->sg_phdr.p_flags = 0;
 			}
 		}
 		if (sgp->sg_flags & FLG_SG_LENGTH)
 			if (sgp->sg_length != 0) {
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    fmt, mapfile, EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGLEN));
 				sgp->sg_length = 0;
 			}
 		if (sgp->sg_flags & FLG_SG_ROUND)
 			if (sgp->sg_round != 0) {
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    fmt, mapfile, EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGROUND));
 				sgp->sg_round = 0;
 			}
 		if (sgp->sg_flags & FLG_SG_VADDR) {
 			if (sgp->sg_phdr.p_vaddr != 0) {
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    fmt, mapfile, EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGVADDR));
 				sgp->sg_phdr.p_vaddr = 0;
@@ -684,14 +706,14 @@
 		}
 		if (sgp->sg_flags & FLG_SG_PADDR)
 			if (sgp->sg_phdr.p_paddr != 0) {
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    fmt, mapfile, EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGPHYS));
 				sgp->sg_phdr.p_paddr = 0;
 			}
 		if (sgp->sg_flags & FLG_SG_ALIGN)
 			if (sgp->sg_phdr.p_align != 0) {
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    fmt, mapfile, EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SEGALIGN));
 				sgp->sg_phdr.p_align = 0;
@@ -707,7 +729,7 @@
  * 	segment_attribute : section_name section_type section_flags;
  */
 static uintptr_t
-map_colon(const char *mapfile, Ent_desc *enp)
+map_colon(Ofl_desc *ofl, const char *mapfile, Ent_desc *enp)
 {
 	Token		tok;		/* Current token. */
 
@@ -718,13 +740,15 @@
 	static	Xword	index = 0;
 
 
-	while ((tok = gettoken(mapfile)) != TK_COLON && tok != TK_SEMICOLON) {
+	while (((tok = gettoken(ofl, mapfile)) != TK_COLON) &&
+	    (tok != TK_SEMICOLON)) {
 		/* LINTED */
 		if (tok == (Token)S_ERROR)
 			return (S_ERROR);
 		if (tok == TK_EOF) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_PREMEOF), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -732,8 +756,9 @@
 
 		if (*Start_tok == '$') {
 			if (b_type) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SECTYP));
 				return (S_ERROR);
 			}
@@ -768,8 +793,9 @@
 			    MSG_ORIG(MSG_STR_NOBITS)) == 0)
 				enp->ec_type = SHT_NOBITS;
 			else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSECTYP),
-				    mapfile, EC_XWORD(Line_num), Start_tok);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNKSECTYP), mapfile,
+				    EC_XWORD(Line_num), Start_tok);
 				return (S_ERROR);
 			}
 
@@ -783,8 +809,9 @@
 		 */
 		} else if (*Start_tok == '?') {
 			if (b_attr) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SECFLAG));
 				return (S_ERROR);
 			}
@@ -796,7 +823,7 @@
 				switch (*Start_tok) {
 				case '!':
 					if (b_bang) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_BADFLAG),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok);
@@ -806,7 +833,7 @@
 					break;
 				case 'a':
 					if (enp->ec_attrmask & SHF_ALLOC) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_BADFLAG),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok);
@@ -819,7 +846,7 @@
 					break;
 				case 'w':
 					if (enp->ec_attrmask & SHF_WRITE) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_BADFLAG),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok);
@@ -832,7 +859,7 @@
 					break;
 				case 'x':
 					if (enp->ec_attrmask & SHF_EXECINSTR) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_BADFLAG),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok);
@@ -844,7 +871,7 @@
 					b_bang = FALSE;
 					break;
 				default:
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_BADFLAG),
 					    mapfile, EC_XWORD(Line_num),
 					    Start_tok);
@@ -855,8 +882,9 @@
 		 */
 		} else {
 			if (b_name) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MOREONCE), mapfile,
+				    EC_XWORD(Line_num),
 				    MSG_INTL(MSG_MAP_SECNAME));
 				return (S_ERROR);
 			}
@@ -876,20 +904,22 @@
 		/*
 		 * File names.
 		 */
-		while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+		while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 			char	*file;
 
 			/* LINTED */
 			if (tok == (Token)S_ERROR)
 				return (S_ERROR);
 			if (tok == TK_EOF) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_PREMEOF), mapfile,
+				    EC_XWORD(Line_num));
 				return (S_ERROR);
 			}
 			if (tok != TK_STRING) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MALFORM),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_MALFORM), mapfile,
+				    EC_XWORD(Line_num));
 				return (S_ERROR);
 			}
 			if ((file =
@@ -947,17 +977,18 @@
 	Token		tok;		/* Current token. */
 	avl_index_t	where;
 
-	if ((tok = gettoken(mapfile)) != TK_STRING) {
+	if ((tok = gettoken(ofl, mapfile)) != TK_STRING) {
 		/* LINTED */
 		if (tok != (Token)S_ERROR)
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSYM_1),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSYM_1), mapfile,
+			    EC_XWORD(Line_num));
 		return (S_ERROR);
 	}
 
 	if (sgp->sg_sizesym != NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGSIZE), mapfile,
-			EC_XWORD(Line_num), sgp->sg_name);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SEGSIZE),
+		    mapfile, EC_XWORD(Line_num), sgp->sg_name);
 		return (S_ERROR);
 	}
 
@@ -973,7 +1004,7 @@
 	 * symbol has been scoped or versioned, in which case it does exist
 	 * but we can freely update it here.
 	 */
-	if ((sdp = sym_find(Start_tok, SYM_NOHASH, &where, ofl)) == NULL) {
+	if ((sdp = ld_sym_find(Start_tok, SYM_NOHASH, &where, ofl)) == NULL) {
 		char	*name;
 		Word hval;
 
@@ -987,15 +1018,15 @@
 		sym->st_size = 0;
 		sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
 
-		DBG_CALL(Dbg_map_size_new(name));
+		DBG_CALL(Dbg_map_size_new(ofl->ofl_lml, name));
 		/* LINTED */
 		hval = (Word)elf_hash(name);
-		if ((sdp = sym_enter(name, sym, hval, ifl, ofl, 0, SHN_ABS,
+		if ((sdp = ld_sym_enter(name, sym, hval, ifl, ofl, 0, SHN_ABS,
 		    (FLG_SY_SPECSEC | FLG_SY_GLOBREF), 0, &where)) ==
 		    (Sym_desc *)S_ERROR)
 			return (S_ERROR);
 		sdp->sd_flags &= ~FLG_SY_CLEAN;
-		DBG_CALL(Dbg_map_symbol(&def_ehdr, sdp));
+		DBG_CALL(Dbg_map_symbol(ofl, sdp));
 	} else {
 		sym = sdp->sd_sym;
 
@@ -1007,9 +1038,10 @@
 
 			sdp->sd_flags &= ~FLG_SY_MAPREF;
 
-			DBG_CALL(Dbg_map_size_old(&def_ehdr, sdp));
+			DBG_CALL(Dbg_map_size_old(ofl, sdp));
 		} else {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SYMDEF), mapfile,
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_SYMDEF), mapfile,
 			    EC_XWORD(Line_num), demangle(sdp->sd_name),
 			    sdp->sd_file->ifl_name);
 			return (S_ERROR);
@@ -1021,11 +1053,12 @@
 	 */
 	sgp->sg_sizesym = sdp;
 
-	if (gettoken(mapfile) != TK_SEMICOLON) {
+	if (gettoken(ofl, mapfile) != TK_SEMICOLON) {
 		/* LINTED */
 		if (tok != (Token)S_ERROR)
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSCOL), mapfile,
+			    EC_XWORD(Line_num));
 		return (S_ERROR);
 	} else
 		return (1);
@@ -1033,7 +1066,7 @@
 
 
 static uintptr_t
-map_pipe(const char *mapfile, Sg_desc *sgp)
+map_pipe(Ofl_desc *ofl, const char *mapfile, Sg_desc *sgp)
 {
 	char		*sec_name;	/* section name */
 	Token		tok;		/* current token. */
@@ -1041,10 +1074,11 @@
 	static Word	index = 0;	/* used to maintain a increasing */
 					/* 	index for section ordering. */
 
-	if ((tok = gettoken(mapfile)) != TK_STRING) {
+	if ((tok = gettoken(ofl, mapfile)) != TK_STRING) {
 		/* LINTED */
 		if (tok != (Token)S_ERROR)
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEC), mapfile,
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSEC), mapfile,
 			    EC_XWORD(Line_num));
 		return (S_ERROR);
 	}
@@ -1062,13 +1096,14 @@
 	if (list_appendc(&(sgp->sg_secorder), sc_order) == 0)
 		return (S_ERROR);
 
-	DBG_CALL(Dbg_map_pipe(sgp, sec_name, index));
+	DBG_CALL(Dbg_map_pipe(ofl->ofl_lml, sgp, sec_name, index));
 
-	if ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+	if ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 		/* LINTED */
 		if (tok != (Token)S_ERROR)
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSCOL), mapfile,
+			    EC_XWORD(Line_num));
 		return (S_ERROR);
 	}
 
@@ -1111,18 +1146,20 @@
 	/*
 	 * Get the shared object descriptor string.
 	 */
-	while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 		/* LINTED */
 		if (tok == (Token)S_ERROR)
 			return (S_ERROR);
 		if (tok == TK_EOF) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_PREMEOF), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 		if ((tok != TK_STRING) && (tok != TK_EQUAL)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSO),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSO), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -1131,12 +1168,12 @@
 		 * definition.
 		 */
 		if (tok == TK_EQUAL) {
-			if ((tok = gettoken(mapfile)) != TK_STRING) {
+			if ((tok = gettoken(ofl, mapfile)) != TK_STRING) {
 				/* LINTED */
 				if (tok == (Token)S_ERROR)
 					return (S_ERROR);
 				else {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_EXPSO), mapfile,
 					    EC_XWORD(Line_num));
 					return (S_ERROR);
@@ -1145,7 +1182,7 @@
 			switch (dolkey) {
 			case MD_NEEDED:
 				if (sdf->sdf_flags & FLG_SDF_SONAME) {
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_MULSONAME),
 					    mapfile, EC_XWORD(Line_num), name,
 					    sdf->sdf_soname, Start_tok);
@@ -1173,7 +1210,7 @@
 				if ((sdf->sdf_flags & (FLG_SDF_SPECVER |
 				    FLG_SDF_ADDVER)) == (FLG_SDF_SPECVER |
 				    FLG_SDF_ADDVER)) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_INCOMFLG),
 					    mapfile, EC_XWORD(Line_num),
 					    sdf->sdf_name);
@@ -1189,8 +1226,9 @@
 					return (S_ERROR);
 				break;
 			case MD_NONE:
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNEXTOK),
-				    mapfile, EC_XWORD(Line_num), '=');
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNEXTOK), mapfile,
+					EC_XWORD(Line_num), '=');
 				return (S_ERROR);
 			}
 			dolkey = MD_NONE;
@@ -1203,8 +1241,9 @@
 		 */
 		if (*Start_tok == '$') {
 			if (dolkey != MD_NONE) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNEXTOK),
-				    mapfile, EC_XWORD(Line_num), '$');
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNEXTOK), mapfile,
+				    EC_XWORD(Line_num), '$');
 				return (S_ERROR);
 			}
 			Start_tok++;
@@ -1219,8 +1258,9 @@
 			    MSG_ORIG(MSG_MAP_ADDVERS)) == 0)
 				dolkey = MD_ADDVERS;
 			else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSOTYP),
-				    mapfile, EC_XWORD(Line_num), Start_tok);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNKSOTYP), mapfile,
+				    EC_XWORD(Line_num), Start_tok);
 				return (S_ERROR);
 			}
 			continue;
@@ -1241,7 +1281,7 @@
 			return (S_ERROR);
 	}
 
-	DBG_CALL(Dbg_map_dash(name, sdf));
+	DBG_CALL(Dbg_map_dash(ofl->ofl_lml, name, sdf));
 	return (1);
 }
 
@@ -1311,7 +1351,7 @@
 	 * serves to initialize the output version descriptor count.
 	 */
 	if (ofl->ofl_vercnt == 0) {
-		if (vers_base(ofl) == (Ver_desc *)S_ERROR)
+		if (ld_vers_base(ofl) == (Ver_desc *)S_ERROR)
 			return (S_ERROR);
 	}
 
@@ -1328,8 +1368,8 @@
 		 */
 		/* LINTED */
 		hash = (Word)elf_hash(name);
-		if ((vdp = vers_find(name, hash, &ofl->ofl_verdesc)) == 0) {
-			if ((vdp = vers_desc(name, hash,
+		if ((vdp = ld_vers_find(name, hash, &ofl->ofl_verdesc)) == 0) {
+			if ((vdp = ld_vers_desc(name, hash,
 			    &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR)
 				return (S_ERROR);
 		}
@@ -1356,7 +1396,7 @@
 	/*
 	 * Scan the mapfile entry picking out scoping and symbol definitions.
 	 */
-	while ((tok = gettoken(mapfile)) != TK_RIGHTBKT) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_RIGHTBKT) {
 		Sym_desc * 	sdp;
 		Word		shndx = SHN_UNDEF;
 		uchar_t 	type = STT_NOTYPE;
@@ -1367,8 +1407,9 @@
 		uint_t		filter = 0, dftflag;
 
 		if ((tok != TK_STRING) && (tok != TK_COLON)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSYM_2),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSYM_2), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -1378,7 +1419,7 @@
 
 		if ((tok != TK_COLON) &&
 		    /* LINTED */
-		    (tok = gettoken(mapfile)) == (Token)S_ERROR)
+		    (tok = gettoken(ofl, mapfile)) == (Token)S_ERROR)
 			return (S_ERROR);
 
 		/*
@@ -1416,8 +1457,9 @@
 			    == 0)
 				scope = FLG_SCOPE_ELIM;
 			else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSYMSCO),
-				    mapfile, EC_XWORD(Line_num), _name);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNKSYMSCO), mapfile,
+				    EC_XWORD(Line_num), _name);
 				return (S_ERROR);
 			}
 			continue;
@@ -1429,8 +1471,7 @@
 			 * alignment specified and then fall through to process
 			 * the entire symbols information.
 			 */
-			while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
-
+			while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 				/*
 				 * If we had previously seen a filter or
 				 * auxiliary filter requirement, the next string
@@ -1438,7 +1479,7 @@
 				 */
 				if (filter) {
 					if (filtee) {
-					    eprintf(ERR_FATAL,
+					    eprintf(ofl->ofl_lml, ERR_FATAL,
 						MSG_INTL(MSG_MAP_MULTFILTEE),
 						mapfile, EC_XWORD(Line_num),
 						_name);
@@ -1464,7 +1505,7 @@
 					if ((number = (Lword)STRTOADDR(
 					    &Start_tok[1], &end_tok, 0)) ==
 					    XWORD_MAX) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_SEGADDR),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok,
@@ -1474,7 +1515,7 @@
 
 					if (end_tok !=
 					    strchr(Start_tok, '\0')) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_SEGADDR),
 						    mapfile, EC_XWORD(Line_num),
 						    Start_tok,
@@ -1485,7 +1526,7 @@
 					switch (*Start_tok) {
 					case 'v':
 					    if (value) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_MOREONCE),
 						    mapfile, EC_XWORD(Line_num),
 						    MSG_INTL(MSG_MAP_SYMVAL));
@@ -1496,7 +1537,7 @@
 					    break;
 					case 's':
 					    if (size) {
-						eprintf(ERR_FATAL,
+						eprintf(ofl->ofl_lml, ERR_FATAL,
 						    MSG_INTL(MSG_MAP_MOREONCE),
 						    mapfile, EC_XWORD(Line_num),
 						    MSG_INTL(MSG_MAP_SYMSIZE));
@@ -1553,7 +1594,7 @@
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 					continue;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_UNKSYMDEF),
 					    mapfile, EC_XWORD(Line_num),
 					    Start_tok);
@@ -1592,8 +1633,9 @@
 			 */
 			/* LINTED */
 			hash = (Word)elf_hash(_name);
-			DBG_CALL(Dbg_map_version(name, _name, scope));
-			if ((sdp = sym_find(_name, hash, &where,
+			DBG_CALL(Dbg_map_version(ofl->ofl_lml, name, _name,
+			    scope));
+			if ((sdp = ld_sym_find(_name, hash, &where,
 			    ofl)) == NULL) {
 				if ((sym = libld_calloc(sizeof (Sym), 1)) == 0)
 					return (S_ERROR);
@@ -1611,7 +1653,7 @@
 				sym->st_size = size;
 				sym->st_info = ELF_ST_INFO(STB_GLOBAL, type);
 
-				if ((sdp = sym_enter(_name, sym, hash, ifl,
+				if ((sdp = ld_sym_enter(_name, sym, hash, ifl,
 				    ofl, 0, shndx, sym_flags, sym_flags1,
 				    &where)) == (Sym_desc *)S_ERROR)
 					return (S_ERROR);
@@ -1683,7 +1725,7 @@
 					conflict = 7;
 
 				if (conflict) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_SYMDEF), mapfile,
 					    EC_XWORD(Line_num), demangle(_name),
 					    sdp->sd_file->ifl_name);
@@ -1737,7 +1779,7 @@
 			 */
 			if (type != STT_NOTYPE)
 				ofl->ofl_objscnt++;
-			DBG_CALL(Dbg_map_symbol(&def_ehdr, sdp));
+			DBG_CALL(Dbg_map_symbol(ofl, sdp));
 
 			/*
 			 * If this symbol has an associated filtee, record the
@@ -1746,8 +1788,9 @@
 			 * information with the necessary .dynamic entry.
 			 */
 			if (filter && (filtee == 0)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_NOFILTER),
-				    mapfile, EC_XWORD(Line_num), _name);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_NOFILTER), mapfile,
+				    EC_XWORD(Line_num), _name);
 				return (S_ERROR);
 			}
 
@@ -1801,8 +1844,9 @@
 			break;
 
 		default:
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_EXPSCOL), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 	}
@@ -1811,22 +1855,24 @@
 	 * Determine if any version references are provided after the close
 	 * bracket.
 	 */
-	while ((tok = gettoken(mapfile)) != TK_SEMICOLON) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) {
 		Ver_desc	*_vdp;
 		char		*_name;
 
 		if (tok != TK_STRING) {
 			/* LINTED */
 			if (tok != (Token)S_ERROR)
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPVERS),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_EXPVERS), mapfile,
+				    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
 		name = Start_tok;
 		if (vdp->vd_ndx == VER_NDX_GLOBAL) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_UNEXDEP),
-			    mapfile, EC_XWORD(Line_num), name);
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_MAP_UNEXDEP), mapfile,
+			    EC_XWORD(Line_num), name);
 			continue;
 		}
 
@@ -1836,12 +1882,12 @@
 		 */
 		/* LINTED */
 		hash = (Word)elf_hash(name);
-		if ((_vdp = vers_find(name, hash, &ofl->ofl_verdesc)) == 0) {
+		if ((_vdp = ld_vers_find(name, hash, &ofl->ofl_verdesc)) == 0) {
 			if ((_name = libld_malloc(strlen(name) + 1)) == 0)
 				return (S_ERROR);
 			(void) strcpy(_name, name);
 
-			if ((_vdp = vers_desc(_name, hash,
+			if ((_vdp = ld_vers_desc(_name, hash,
 			    &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR)
 				return (S_ERROR);
 		}
@@ -1852,7 +1898,7 @@
 		 * first reference (used for error disgnostics if undefined
 		 * version dependencies remain).
 		 */
-		if (vers_find(name, hash, &vdp->vd_deps) == 0)
+		if (ld_vers_find(name, hash, &vdp->vd_deps) == 0)
 			if (list_appendc(&vdp->vd_deps, _vdp) == 0)
 				return (S_ERROR);
 
@@ -1866,7 +1912,7 @@
  * Sort the segment list by increasing virtual address.
  */
 uintptr_t
-sort_seg_list(Ofl_desc *ofl)
+ld_sort_seg_list(Ofl_desc *ofl)
 {
 	List 		seg1, seg2;
 	Listnode	*lnp1, *lnp2, *lnp3;
@@ -1890,7 +1936,7 @@
 	 * Add the loadable segments to another list in sorted order.
 	 */
 	for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp1)) {
-		DBG_CALL(Dbg_map_sort_orig(sgp1));
+		DBG_CALL(Dbg_map_sort_orig(ofl->ofl_lml, sgp1));
 		if (sgp1->sg_phdr.p_type != PT_LOAD)
 			continue;
 		if (!(sgp1->sg_flags & FLG_SG_VADDR) ||
@@ -1936,7 +1982,7 @@
 				    sgp2->sg_phdr.p_vaddr) {
 					lnp3 = lnp2;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_SEGSAME),
 					    sgp1->sg_name, sgp2->sg_name);
 					return (S_ERROR);
@@ -1974,7 +2020,7 @@
 	 * segment/section ordering information if present.
 	 */
 	for (LIST_TRAVERSE(&seg1, lnp1, sgp1)) {
-		DBG_CALL(Dbg_map_sort_fini(sgp1));
+		DBG_CALL(Dbg_map_sort_fini(ofl->ofl_lml, sgp1));
 		if (list_appendc(&ofl->ofl_segs, sgp1) == 0)
 			return (S_ERROR);
 	}
@@ -1987,7 +2033,7 @@
  * Parse the mapfile.
  */
 uintptr_t
-map_parse(const char *mapfile, Ofl_desc *ofl)
+ld_map_parse(const char *mapfile, Ofl_desc *ofl)
 {
 	struct stat	stat_buf;	/* stat of mapfile */
 	int		mapfile_fd;	/* descriptor for mapfile */
@@ -2004,15 +2050,15 @@
 	static	int	num_stack = 0;	/* number of stack segment */
 	int		err;
 
-	DBG_CALL(Dbg_map_parse(mapfile));
+	DBG_CALL(Dbg_map_parse(ofl->ofl_lml, mapfile));
 
 	/*
 	 * Determine if we're dealing with a file or a directory.
 	 */
 	if (stat(mapfile, &stat_buf) == -1) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_STAT), mapfile,
-		    strerror(err));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_STAT),
+		    mapfile, strerror(err));
 		return (S_ERROR);
 	}
 	if (S_ISDIR(stat_buf.st_mode)) {
@@ -2037,13 +2083,14 @@
 				continue;
 			(void) snprintf(path, PATH_MAX, MSG_ORIG(MSG_STR_PATH),
 			    mapfile, denp->d_name);
-			if (map_parse(path, ofl) == S_ERROR)
+			if (ld_map_parse(path, ofl) == S_ERROR)
 				return (S_ERROR);
 		}
 		(void) closedir(dirp);
 		return (1);
 	} else if (!S_ISREG(stat_buf.st_mode)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_NOTREG), mapfile);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_NOTREG),
+		    mapfile);
 		return (S_ERROR);
 	}
 
@@ -2054,15 +2101,15 @@
 		return (S_ERROR);
 	if ((mapfile_fd = open(mapfile, O_RDONLY)) == -1) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), mapfile,
-		    strerror(err));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+		    mapfile, strerror(err));
 		return (S_ERROR);
 	}
 
 	if (read(mapfile_fd, Mapspace, stat_buf.st_size) != stat_buf.st_size) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_READ), mapfile,
-		    strerror(err));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_READ),
+		    mapfile, strerror(err));
 		return (S_ERROR);
 	}
 	Mapspace[stat_buf.st_size] = '\0';
@@ -2076,7 +2123,7 @@
 	/*
 	 * We now parse the mapfile until the gettoken routine returns EOF.
 	 */
-	while ((tok = gettoken(mapfile)) != TK_EOF) {
+	while ((tok = gettoken(ofl, mapfile)) != TK_EOF) {
 		int	ndx = -1;
 
 		/*
@@ -2098,8 +2145,9 @@
 		if (tok != TK_STRING) {
 			/* LINTED */
 			if (tok != (Token)S_ERROR)
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGNAM),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_EXPSEGNAM), mapfile,
+				    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -2115,7 +2163,7 @@
 		 * and `{' characters do not involve any segment manipulation so
 		 * we handle them first.
 		 */
-		if ((tok = gettoken(mapfile)) == TK_DASH) {
+		if ((tok = gettoken(ofl, mapfile)) == TK_DASH) {
 			if (map_dash(mapfile, name, ofl) == S_ERROR)
 				return (S_ERROR);
 			continue;
@@ -2148,11 +2196,12 @@
 		 */
 		if (tok == TK_PIPE) {
 			if (sgp1 == NULL) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SECINSEG),
-				    mapfile, EC_XWORD(Line_num), name);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_SECINSEG), mapfile,
+				    EC_XWORD(Line_num), name);
 				return (S_ERROR);
 			} else {
-				if (map_pipe(mapfile, sgp1) == S_ERROR)
+				if (map_pipe(ofl, mapfile, sgp1) == S_ERROR)
 					return (S_ERROR);
 				continue;
 			}
@@ -2176,8 +2225,9 @@
 		if ((strcmp(sgp1->sg_name, MSG_ORIG(MSG_STR_INTERP)) == 0) ||
 		    (strcmp(sgp1->sg_name, MSG_ORIG(MSG_STR_LD_DYNAMIC)) ==
 		    0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGRESV),
-			    mapfile, EC_XWORD(Line_num));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_MAP_SEGRESV), mapfile,
+			    EC_XWORD(Line_num));
 			return (S_ERROR);
 		}
 
@@ -2190,20 +2240,22 @@
 				if (map_cap(mapfile, CA_SUNW_HW_1,
 				    ofl) == S_ERROR)
 					return (S_ERROR);
-				Dbg_cap_mapfile(CA_SUNW_HW_1, ofl->ofl_hwcap_1,
-				    M_MACH);
+				DBG_CALL(Dbg_cap_mapfile(ofl->ofl_lml,
+				    CA_SUNW_HW_1, ofl->ofl_hwcap_1, M_MACH));
+
 			} else if (strcmp(sgp1->sg_name,
 			    MSG_ORIG(MSG_STR_SFCAP_1)) == 0) {
 				if (map_cap(mapfile, CA_SUNW_SF_1,
 				    ofl) == S_ERROR)
 					return (S_ERROR);
-				Dbg_cap_mapfile(CA_SUNW_SF_1, ofl->ofl_sfcap_1,
-				    M_MACH);
+				DBG_CALL(Dbg_cap_mapfile(ofl->ofl_lml,
+				    CA_SUNW_SF_1, ofl->ofl_sfcap_1, M_MACH));
+
 			} else {
 				if (map_equal(mapfile, sgp1, ofl) == S_ERROR)
 					return (S_ERROR);
 				ofl->ofl_flags |= FLG_OF_SEGSORT;
-				DBG_CALL(Dbg_map_equal(new_segment));
+				DBG_CALL(Dbg_map_set_equal(new_segment));
 			}
 		} else if (tok == TK_COLON) {
 			/*
@@ -2212,8 +2264,9 @@
 			 */
 			if ((new_segment == FALSE) &&
 			    (sgp1->sg_flags & FLG_SG_EMPTY)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPSEC),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_SEGEMPSEC), mapfile,
+				    EC_XWORD(Line_num));
 				return (S_ERROR);
 			}
 
@@ -2236,19 +2289,21 @@
 					return (S_ERROR);
 			}
 
-			if (map_colon(mapfile, enp) == S_ERROR)
+			if (map_colon(ofl, mapfile, enp) == S_ERROR)
 				return (S_ERROR);
 			ofl->ofl_flags |= FLG_OF_SEGSORT;
-			DBG_CALL(Dbg_map_ent(new_segment, enp, ofl));
+			DBG_CALL(Dbg_map_ent(ofl->ofl_lml, new_segment,
+			    enp, ofl));
 		} else if (tok == TK_ATSIGN) {
 			if (map_atsign(mapfile, sgp1, ofl) == S_ERROR)
 				return (S_ERROR);
-			DBG_CALL(Dbg_map_atsign(new_segment));
+			DBG_CALL(Dbg_map_set_atsign(new_segment));
 		} else {
 			/* LINTED */
 			if (tok != (Token)S_ERROR) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPEQU),
-				    mapfile, EC_XWORD(Line_num));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_EXPEQU), mapfile,
+				    EC_XWORD(Line_num));
 				return (S_ERROR);
 			}
 		}
@@ -2295,7 +2350,7 @@
 					 * Currently the number of sunw_stack
 					 * segment is limited to 1.
 					 */
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_MAP_NOSTACK2),
 					    mapfile, EC_XWORD(Line_num));
 					continue;
@@ -2305,8 +2360,9 @@
 				src_type = 9;
 				break;
 			default:
-				eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGTYP),
-				    mapfile, EC_XWORD(Line_num),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_MAP_UNKSEGTYP), mapfile,
+				    EC_XWORD(Line_num),
 				    EC_WORD(sgp1->sg_phdr.p_type));
 				return (S_ERROR);
 			}
@@ -2351,7 +2407,7 @@
 					dst_type = 12;
 					break;
 				default:
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_MAP_UNKSEGTYP),
 					    mapfile, EC_XWORD(Line_num),
 					    EC_WORD(sgp2->sg_phdr.p_type));
@@ -2372,7 +2428,7 @@
 				lnp2 = lnp1;
 			}
 		}
-		DBG_CALL(Dbg_map_seg(ofl->ofl_e_machine, ndx, sgp1));
+		DBG_CALL(Dbg_map_seg(ofl, ndx, sgp1));
 	}
 
 	/*
--- a/usr/src/cmd/sgs/libld/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -24,6 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 # Generic interface definition for usr/src/cmd/sgs/libld.
 #
 # For information regarding the establishment of versioned definitions see:
@@ -36,43 +37,41 @@
 # definitions see:
 #	Policy for Shared Library Version Names and Interface Definitions
 
+SUNWprivate_4.1 {
+	global:
+		dbg_print;
+
+		ld32_main;
+		ld64_main;
+
+		ld32_create_outfile;
+		ld64_create_outfile;
+		ld32_ent_setup;
+		ld64_ent_setup;
+		ld32_make_sections;
+		ld64_make_sections;
+		ld32_ofl_cleanup;
+		ld64_ofl_cleanup;
+		ld32_process_open;
+		ld64_process_open;
+		ld32_reloc_init;
+		ld64_reloc_init;
+		ld32_reloc_process;
+		ld64_reloc_process;
+		ld32_sym_validate;
+		ld64_sym_validate;
+		ld32_update_outfile;
+		ld64_update_outfile;
+
+		st_new;
+	local:
+		*;
+};
+
+# The following functions must be provided by our caller, or one of the
+# callers dependencies.
+
 {
 	global:
 		eprintf =	FUNCTION extern;
 };
-
-SUNWprivate_2.14 {
-	global:
-		add_string;
-		create_outfile;
-		dbg_print;
-		ent_setup;
-		finish_libs;
-		ld_main;
-		ld_support_loadso;
-		list_appendc;
-		list_insertc;
-		list_prependc;
-		list_where;
-		make_sections;
-		ofl_cleanup;
-		open_outfile;
-		process_open;
-		reloc_init;
-		reloc_process;
-		sdf_add;
-		sdf_find;
-		sec_validate;
-		st_new;
-		sym_add_u;
-		sym_enter;
-		sym_find;
-		sym_validate;
-		update_outfile;
-		vers_base;
-		vers_check_defs;
-		vers_desc;
-		vers_find;
-	local:
-		*;
-};
--- a/usr/src/cmd/sgs/libld/common/order.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/order.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -30,10 +30,9 @@
  * Processing of SHF_ORDERED sections.
  */
 #include	<stdio.h>
-#include	<string.h>
 #include	<fcntl.h>
 #include	<link.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -67,7 +66,7 @@
 }
 
 static Word
-get_shfordered_dest(Ifl_desc *ifl, Word ndx, Word limit)
+get_shfordered_dest(Ofl_desc *ofl, Ifl_desc *ifl, Word ndx, Word limit)
 {
 	Word t1_link = ndx, t2_link, ret_link;
 	Is_desc *isp, *isp1, *isp2;
@@ -140,7 +139,7 @@
 
 	if (error != 0) {
 		ret_link = 0;
-		DBG_CALL(Dbg_sec_order_error(ifl, ndx, error));
+		DBG_CALL(Dbg_sec_order_error(ofl->ofl_lml, ifl, ndx, error));
 	}
 	return (ret_link);
 }
@@ -150,7 +149,7 @@
  * This routine does the input processing of the ordered sections.
  */
 uintptr_t
-process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit)
+ld_process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit)
 {
 	Is_desc *	isp2, * isp = ifl->ifl_isdesc[ndx];
 	Xword		shflags = isp->is_shdr->sh_flags;
@@ -174,10 +173,10 @@
 		keylink = isp->is_shdr->sh_link;
 
 	if ((error = is_keylink_ok(ifl, keylink, limit)) != 0) {
-		DBG_CALL(Dbg_sec_order_error(ifl, ndx, error));
+		DBG_CALL(Dbg_sec_order_error(ofl->ofl_lml, ifl, ndx, error));
 		isp->is_flags &= ~FLG_IS_ORDERED;
 		if (isp->is_osdesc == NULL)
-			return ((uintptr_t)place_section(ofl, isp,
+			return ((uintptr_t)ld_place_section(ofl, isp,
 			    isp->is_key, 0));
 		return ((uintptr_t)isp->is_osdesc);
 	}
@@ -188,10 +187,11 @@
 	 * we follow the default rules for the desitination section.
 	 */
 	if (shflags & SHF_ORDERED) {
-		if ((dest_ndx = get_shfordered_dest(ifl, ndx, limit)) == 0) {
+		if ((dest_ndx = get_shfordered_dest(ofl, ifl,
+		    ndx, limit)) == 0) {
 			isp->is_flags &= ~FLG_IS_ORDERED;
 			if (isp->is_osdesc == NULL)
-				return ((uintptr_t)place_section(ofl, isp,
+				return ((uintptr_t)ld_place_section(ofl, isp,
 				    isp->is_key, 0));
 			return ((uintptr_t)isp->is_osdesc);
 		}
@@ -207,8 +207,8 @@
 	 * Place the section into it's output section.
 	 */
 	if ((osp = isp->is_osdesc) == NULL) {
-		if ((osp = place_section(ofl, isp, isp->is_ident, dest_ndx)) ==
-		    (Os_desc *)S_ERROR)
+		if ((osp = ld_place_section(ofl, isp, isp->is_ident,
+		    dest_ndx)) == (Os_desc *)S_ERROR)
 			return ((uintptr_t)S_ERROR);
 		if (!osp)
 			return (0);
@@ -245,10 +245,10 @@
 		st->st_ordercnt++;
 		isp2 = ifl->ifl_isdesc[keylink];
 		if (isp2->is_flags & FLG_IS_DISCARD) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_BADORDREF),
-			    ifl->ifl_name, isp->is_name, isp->is_scnndx,
-			    isp2->is_name, isp2->is_scnndx);
-
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_BADORDREF), ifl->ifl_name,
+			    isp->is_name, isp->is_scnndx, isp2->is_name,
+			    isp2->is_scnndx);
 			return (S_ERROR);
 		}
 		osp2 = isp2->is_osdesc;
@@ -270,7 +270,7 @@
  * there are any SHF_ORDERED key sections, and if so set up sort key values.
  */
 void
-sec_validate(Ofl_desc * ofl)
+ld_sec_validate(Ofl_desc * ofl)
 {
 	Listnode *	lnp1;
 	Sg_desc *	sgp;
@@ -283,7 +283,8 @@
 
 		for (LIST_TRAVERSE(&sgp->sg_secorder, lnp2, scop))
 			if (!(scop->sco_flags & FLG_SGO_USED))
-				eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_SECORDER),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_MAP_SECORDER),
 				    sgp->sg_name, scop->sco_secname);
 
 		if ((sgp->sg_flags & FLG_SG_KEY) == 0)
@@ -391,7 +392,7 @@
 }
 
 uintptr_t
-sort_ordered(Ofl_desc *ofl)
+ld_sort_ordered(Ofl_desc *ofl)
 {
 	Listnode *lnp1;
 	Os_desc *osp;
--- a/usr/src/cmd/sgs/libld/common/outfile.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/outfile.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -41,15 +40,41 @@
 #include	<errno.h>
 #include	<string.h>
 #include	<limits.h>
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
-#include	<debug.h>
+
+/*
+ * Determine a least common multiplier.  Input sections contain an alignment
+ * requirement, which elf_update() uses to insure that the section is aligned
+ * correctly off of the base of the elf image.  We must also insure that the
+ * sections mapping is congruent with this alignment requirement.  For each
+ * input section associated with a loadable segment determine whether the
+ * segments alignment must be adjusted to compensate for a sections alignment
+ * requirements.
+ */
+Xword
+ld_lcm(Xword a, Xword b)
+{
+	Xword	_r, _a, _b;
+
+	if ((_a = a) == 0)
+		return (b);
+	if ((_b = b) == 0)
+		return (a);
+
+	if (_a > _b)
+		_a = b, _b = a;
+	while ((_r = _b % _a) != 0)
+		_b = _a, _a = _r;
+	return ((a / _a) * b);
+}
 
 /*
  * Open the output file and insure the correct access modes.
  */
 uintptr_t
-open_outfile(Ofl_desc * ofl)
+ld_open_outfile(Ofl_desc * ofl)
 {
 	mode_t		mask, mode;
 	struct stat	status;
@@ -79,8 +104,8 @@
 	    mode)) < 0) {
 		int	err = errno;
 
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ofl->ofl_name,
-		    strerror(err));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+		    ofl->ofl_name, strerror(err));
 		return (S_ERROR);
 	}
 
@@ -120,7 +145,7 @@
  *
  *  o	NOBITS sections must be converted into allocated, null filled sections.
  */
-uintptr_t
+static uintptr_t
 pad_outfile(Ofl_desc * ofl)
 {
 	Listnode *	lnp1, * lnp2;
@@ -135,11 +160,13 @@
 	 * section headers and data buffers as they relate to the new image.
 	 */
 	if (elf_update(ofl->ofl_welf, ELF_C_NULL) == -1) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 	if ((ehdr = elf_getehdr(ofl->ofl_welf)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), ofl->ofl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -170,8 +197,8 @@
 			    offset);
 
 			if ((data = elf_newdata(oscn)) == NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWDATA),
-				    ofl->ofl_name);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_NEWDATA), ofl->ofl_name);
 				return (S_ERROR);
 			}
 			if ((data->d_buf = libld_calloc(size, 1)) == 0)
@@ -180,7 +207,7 @@
 			data->d_type = ELF_T_BYTE;
 			data->d_size = size;
 			data->d_align = 1;
-			data->d_version = ofl->ofl_libver;
+			data->d_version = ofl->ofl_dehdr->e_version;
 		}
 
 		/*
@@ -234,7 +261,7 @@
  *		becomes a linked list of input data buffers).
  */
 uintptr_t
-create_outfile(Ofl_desc * ofl)
+ld_create_outfile(Ofl_desc * ofl)
 {
 	Listnode *	lnp1, * lnp2, * lnp3;
 	Sg_desc *	sgp;
@@ -268,27 +295,30 @@
 	/*
 	 * If there are any ordered section, handle them here.
 	 */
-	if ((ofl->ofl_ordered.head != NULL) && (sort_ordered(ofl) == S_ERROR))
+	if ((ofl->ofl_ordered.head != NULL) &&
+	    (ld_sort_ordered(ofl) == S_ERROR))
 		return (S_ERROR);
 
 	/*
 	 * Tell the access library about our new temporary file.
 	 */
 	if ((ofl->ofl_welf = elf_begin(fd, cmd, 0)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), ofl->ofl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
 	/*
 	 * Obtain a new Elf header.
 	 */
-	if ((ofl->ofl_ehdr = elf_newehdr(ofl->ofl_welf)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWEHDR), ofl->ofl_name);
+	if ((ofl->ofl_nehdr = elf_newehdr(ofl->ofl_welf)) == NULL) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_NEWEHDR),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
-	ofl->ofl_ehdr->e_machine = ofl->ofl_e_machine;
+	ofl->ofl_nehdr->e_machine = ofl->ofl_dehdr->e_machine;
 
-	DBG_CALL(Dbg_util_nl());
+	DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD));
 	for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp)) {
 		int	frst = 0;
 		Phdr	*phdr = &(sgp->sg_phdr);
@@ -375,8 +405,8 @@
 			 * Get a section descriptor for the section.
 			 */
 			if ((scn = elf_newscn(ofl->ofl_welf)) == NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWSCN),
-				    ofl->ofl_name);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_NEWSCN), ofl->ofl_name);
 				return (S_ERROR);
 			}
 			osp->os_scn = scn;
@@ -388,8 +418,8 @@
 			 * (refer place_section()) we might as well free it up.
 			 */
 			if ((shdr = elf_getshdr(scn)) == NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
-				    ofl->ofl_name);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name);
 				return (S_ERROR);
 			}
 			*shdr = *(osp->os_shdr);
@@ -443,12 +473,14 @@
 				    ((ptype == PT_LOAD) &&
 				    ((isp->is_flags & FLG_IS_SECTREF) == 0) &&
 				    (isp->is_shdr->sh_size > 0)))) {
+					Lm_list	*lml = ofl->ofl_lml;
+
 					if (ifl->ifl_flags & FLG_IF_IGNORE) {
-						isp->is_flags |= FLG_IS_DISCARD;
-						DBG_CALL(Dbg_unused_sec(isp));
-						continue;
+					    isp->is_flags |= FLG_IS_DISCARD;
+					    DBG_CALL(Dbg_unused_sec(lml, isp));
+					    continue;
 					} else
-						DBG_CALL(Dbg_unused_sec(isp));
+					    DBG_CALL(Dbg_unused_sec(lml, isp));
 				}
 
 				dataidx++;
@@ -481,7 +513,7 @@
 				 * the old data.
 				 */
 				if ((data = elf_newdata(scn)) == NULL) {
-					eprintf(ERR_ELF,
+					eprintf(ofl->ofl_lml, ERR_ELF,
 					    MSG_INTL(MSG_ELF_NEWDATA),
 					    ofl->ofl_name);
 					return (S_ERROR);
@@ -504,7 +536,8 @@
 				    (isp->is_shdr->sh_flags & SHF_TLS)) {
 					if (tlsdata == 0)
 						tlsdata = data;
-					tlsdata->d_align = lcm(tlsdata->d_align,
+					tlsdata->d_align =
+					    ld_lcm(tlsdata->d_align,
 					    isp->is_shdr->sh_addralign);
 				}
 
@@ -569,8 +602,8 @@
 	if (nseg) {
 		if ((ofl->ofl_phdr = elf_newphdr(ofl->ofl_welf,
 		    nseg)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWPHDR),
-			    ofl->ofl_name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_NEWPHDR), ofl->ofl_name);
 			return (S_ERROR);
 		}
 	}
@@ -606,7 +639,8 @@
 	 */
 	if ((ofl->ofl_size = (size_t)elf_update(ofl->ofl_welf,
 	    ELF_C_WRIMAGE)) == (size_t)-1) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -619,17 +653,19 @@
 	 */
 	if ((ofl->ofl_elf = elf_begin(0, ELF_C_IMAGE,
 	    ofl->ofl_welf)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), ofl->ofl_name);
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
-	if ((ofl->ofl_ehdr = elf_getehdr(ofl->ofl_elf)) == NULL) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), ofl->ofl_name);
+	if ((ofl->ofl_nehdr = elf_getehdr(ofl->ofl_elf)) == NULL) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 	if (!(flags & FLG_OF_RELOBJ))
 		if ((ofl->ofl_phdr = elf_getphdr(ofl->ofl_elf)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETPHDR),
-			    ofl->ofl_name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETPHDR), ofl->ofl_name);
 			return (S_ERROR);
 		}
 
@@ -645,14 +681,15 @@
 		for (LIST_TRAVERSE(&(sgp->sg_osdescs), lnp2, osp)) {
 			if ((osp->os_scn = elf_getscn(ofl->ofl_elf, ++ndx)) ==
 			    NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN),
-				    ofl->ofl_name, ndx);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_GETSCN), ofl->ofl_name,
+				    ndx);
 				return (S_ERROR);
 			}
 			if ((osp->os_shdr = elf_getshdr(osp->os_scn)) ==
 			    NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
-				    ofl->ofl_name);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name);
 				return (S_ERROR);
 			}
 			if ((fixalign == TRUE) && (sgp->sg_fscn != 0) &&
@@ -661,7 +698,7 @@
 
 				scn = sgp->sg_fscn;
 				if ((fndx = elf_ndxscn(scn)) == SHN_UNDEF) {
-					eprintf(ERR_ELF,
+					eprintf(ofl->ofl_lml, ERR_ELF,
 					    MSG_INTL(MSG_ELF_NDXSCN),
 					    ofl->ofl_name);
 					return (S_ERROR);
@@ -674,8 +711,8 @@
 
 			if ((osp->os_outdata =
 			    elf_getdata(osp->os_scn, NULL)) == NULL) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA),
-				    ofl->ofl_name);
+				eprintf(ofl->ofl_lml, ERR_ELF,
+				    MSG_INTL(MSG_ELF_GETDATA), ofl->ofl_name);
 				return (S_ERROR);
 			}
 
@@ -684,7 +721,7 @@
 			 * that the segments alignment is appropriate.
 			 */
 			if (_phdr->p_type == PT_LOAD) {
-				_phdr->p_align = (Xword)lcm(_phdr->p_align,
+				_phdr->p_align = ld_lcm(_phdr->p_align,
 				    osp->os_shdr->sh_addralign);
 			}
 		}
--- a/usr/src/cmd/sgs/libld/common/place.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/place.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,21 +33,19 @@
  */
 #include	<stdio.h>
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
 /*
  * Each time a section is placed, the function set_addralign()
- * is called. This function performs:
- * 	*) if the section is from an external file,
- *	   check if this is empty or not. If not,
- *	   we know the segment this section will belong
- *	   needs a program header. (Of course, the program
- *	   needed only if this section falls into a
- *	   loadable segment.)
- * 	*) compute the Least Common Multiplier for setting
- *	   the segment alignment.
+ * is called.  This function performs:
+ *
+ *  .	if the section is from an external file, check if this is empty or not.
+ *	If not, we know the segment this section will belong needs a program
+ *	header. (Of course, the program is needed only if this section falls
+ *	into a loadable segment.)
+ *  .	compute the Least Common Multiplier for setting the segment alignment.
  */
 static void
 set_addralign(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
@@ -67,8 +64,8 @@
 	    (osp->os_sgdesc->sg_phdr).p_type != PT_LOAD)
 		return;
 
-	osp->os_sgdesc->sg_addralign = lcm(osp->os_sgdesc->sg_addralign,
-		shdr->sh_addralign);
+	osp->os_sgdesc->sg_addralign =
+	    ld_lcm(osp->os_sgdesc->sg_addralign, shdr->sh_addralign);
 }
 
 /*
@@ -76,8 +73,8 @@
  * os_txtndx.  This information is derived from the Sg_desc->sg_segorder
  * list that was built up from the Mapfile.
  */
-int
-set_os_txtndx(Is_desc *isp, Sg_desc * sgp)
+static int
+set_os_txtndx(Is_desc *isp, Sg_desc *sgp)
 {
 	Listnode *	lnp;
 	Sec_order *	scop;
@@ -95,7 +92,7 @@
  * Place a section into the appropriate segment.
  */
 Os_desc *
-place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link)
+ld_place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link)
 {
 	Listnode *	lnp1, * lnp2;
 	Ent_desc *	enp;
@@ -106,16 +103,16 @@
 	Xword		shflagmask, shflags = shdr->sh_flags;
 	Ifl_desc *	ifl = isp->is_file;
 
-	DBG_CALL(Dbg_sec_in(isp));
+	DBG_CALL(Dbg_sec_in(ofl->ofl_lml, isp));
 
 	if ((shflags & SHF_GROUP) || (shdr->sh_type == SHT_GROUP)) {
 		Group_desc *	gdesc;
 
-		if ((gdesc = get_group(ofl, isp)) == (Group_desc *)S_ERROR)
+		if ((gdesc = ld_get_group(ofl, isp)) == (Group_desc *)S_ERROR)
 			return ((Os_desc *)S_ERROR);
 
 		if (gdesc) {
-			DBG_CALL(Dbg_sec_group(isp, gdesc));
+			DBG_CALL(Dbg_sec_group(ofl->ofl_lml, isp, gdesc));
 
 			/*
 			 * If this group is marked as discarded, then this
@@ -249,20 +246,20 @@
 		osp = isp->is_file->ifl_isdesc[link]->is_osdesc;
 		/*
 		 * If this is a COMDAT section, then see if this
-		 * section is a keeper and/or if it is to
-		 * be discarded.
+		 * section is a keeper and/or if it is to be discarded.
 		 */
 		if (shdr->sh_type == SHT_SUNW_COMDAT) {
 			Listnode *	clist;
 			Is_desc *	cisp;
 
 			for (LIST_TRAVERSE(&(osp->os_comdats), clist, cisp)) {
-				if (strcmp(isp->is_basename,
-				    cisp->is_basename) == 0) {
-					isp->is_flags |= FLG_IS_DISCARD;
-					DBG_CALL(Dbg_sec_discarded(isp, cisp));
-					return (0);
-				}
+				if (strcmp(isp->is_basename, cisp->is_basename))
+					continue;
+
+				isp->is_flags |= FLG_IS_DISCARD;
+				DBG_CALL(Dbg_sec_discarded(ofl->ofl_lml,
+				    isp, cisp));
+				return (0);
 			}
 
 			/*
@@ -281,7 +278,7 @@
 			return ((Os_desc *)S_ERROR);
 		isp->is_osdesc = osp;
 		sgp = osp->os_sgdesc;
-		DBG_CALL(Dbg_sec_added(osp, sgp));
+		DBG_CALL(Dbg_sec_added(ofl->ofl_lml, osp, sgp));
 		return (osp);
 	}
 
@@ -332,12 +329,13 @@
 				for (LIST_TRAVERSE(&(osp->os_comdats),
 				    clist, cisp)) {
 					if (strcmp(isp->is_basename,
-					    cisp->is_basename) == 0) {
-						isp->is_flags |= FLG_IS_DISCARD;
-						DBG_CALL(Dbg_sec_discarded(isp,
-						    cisp));
-						return (0);
-					}
+					    cisp->is_basename))
+						continue;
+
+					isp->is_flags |= FLG_IS_DISCARD;
+					DBG_CALL(Dbg_sec_discarded(ofl->ofl_lml,
+					    isp, cisp));
+					return (0);
 				}
 
 				/*
@@ -397,14 +395,14 @@
 			 * section below.
 			 */
 			if (((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) ||
-			    dbg_mask) &&
+			    DBG_ENABLED) &&
 			    (osp->os_flags & FLG_OS_SECTREF)) {
 				isp->is_flags |= FLG_IS_SECTREF;
 				if (ifl)
 				    ifl->ifl_flags |= FLG_IF_FILEREF;
 			}
 
-			DBG_CALL(Dbg_sec_added(osp, sgp));
+			DBG_CALL(Dbg_sec_added(ofl->ofl_lml, osp, sgp));
 			return (osp);
 		}
 
@@ -512,7 +510,7 @@
 	    (strcmp(osp->os_name, MSG_ORIG(MSG_SCN_JCR)) == 0)) {
 		osp->os_flags |= FLG_OS_SECTREF;
 
-		if ((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) || dbg_mask) {
+		if ((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) || DBG_ENABLED) {
 			isp->is_flags |= FLG_IS_SECTREF;
 			if (ifl)
 			    ifl->ifl_flags |= FLG_IF_FILEREF;
@@ -544,8 +542,9 @@
 	 */
 	if (sgp->sg_phdr.p_type == PT_LOAD) {
 		if (!(osp->os_shdr->sh_flags & SHF_ALLOC)) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SCN_NONALLOC),
-			    ofl->ofl_name, osp->os_name);
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SCN_NONALLOC), ofl->ofl_name,
+			    osp->os_name);
 			osp->os_shdr->sh_flags |= SHF_ALLOC;
 		}
 	}
@@ -566,7 +565,7 @@
 	if (list_appendc(&(osp->os_isdescs), isp) == 0)
 		return ((Os_desc *)S_ERROR);
 
-	DBG_CALL(Dbg_sec_created(osp, sgp));
+	DBG_CALL(Dbg_sec_created(ofl->ofl_lml, osp, sgp));
 	isp->is_osdesc = osp;
 	if (lnp2) {
 		if (list_insertc(&(sgp->sg_osdescs), osp, lnp2) == 0)
--- a/usr/src/cmd/sgs/libld/common/relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -35,8 +34,8 @@
 #include	<string.h>
 #include	<stdio.h>
 #include	<alloca.h>
-#include	"debug.h"
-#include	"reloc.h"
+#include	<reloc.h>
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -72,8 +71,8 @@
 	 */
 	if ((ifl->ifl_flags & FLG_IF_DISPDONE) &&
 	    (ofl->ofl_flags & FLG_OF_VERBOSE))
-		eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL2),
-		    conv_reloc_type_str(ifl->ifl_ehdr->e_machine, M_R_COPY),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_DISPREL2),
+		    conv_reloc_type(ifl->ifl_ehdr->e_machine, M_R_COPY),
 		    ifl->ifl_name, demangle(sdp->sd_name));
 
 	if ((ifl->ifl_flags & FLG_IF_DISPPEND) == 0)
@@ -128,9 +127,9 @@
 					(void) strcpy(_str, str);
 					str = (const char *)_str;
 				}
-				eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1),
-				    conv_reloc_type_str(
-				    ifl->ifl_ehdr->e_machine,
+				eprintf(ofl->ofl_lml,
+				    ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1),
+				    conv_reloc_type(ifl->ifl_ehdr->e_machine,
 				    (uint_t)ELF_R_TYPE(reloc->r_info)),
 				    ifl->ifl_name, str,
 				    MSG_INTL(MSG_STR_UNKNOWN),
@@ -157,8 +156,9 @@
 				(void) strcpy(_str, str);
 				str = (const char *)_str;
 			}
-			eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1),
-			    conv_reloc_type_str(ifl->ifl_ehdr->e_machine,
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_REL_DISPREL1),
+			    conv_reloc_type(ifl->ifl_ehdr->e_machine,
 			    (uint_t)ELF_R_TYPE(reloc->r_info)), ifl->ifl_name,
 			    demangle(rsdp->sd_name), str,
 			    EC_XWORD(reloc->r_offset), str);
@@ -296,7 +296,7 @@
 }
 
 void
-disp_errmsg(const char *msg, Rel_desc *rsp, Ofl_desc *ofl)
+ld_disp_errmsg(const char *msg, Rel_desc *rsp, Ofl_desc *ofl)
 {
 	Sym_desc	*sdp;
 	const char	*str;
@@ -307,9 +307,9 @@
 	else
 		str = MSG_INTL(MSG_STR_UNKNOWN);
 
-	eprintf(ERR_WARNING, msg, conv_reloc_type_str(ifl->ifl_ehdr->e_machine,
-	    rsp->rel_rtype), ifl->ifl_name, rsp->rel_sname, str,
-	    EC_OFF(rsp->rel_roffset));
+	eprintf(ofl->ofl_lml, ERR_WARNING, msg,
+	    conv_reloc_type(ifl->ifl_ehdr->e_machine, rsp->rel_rtype),
+	    ifl->ifl_name, rsp->rel_sname, str, EC_OFF(rsp->rel_roffset));
 }
 
 /*
@@ -424,7 +424,7 @@
  * Add an active relocation record.
  */
 uintptr_t
-add_actrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
+ld_add_actrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
 {
 	Rel_desc	*arsp;
 	Rel_cache	*rcp;
@@ -492,15 +492,16 @@
 		ofl->ofl_dtflags_1 |= DF_1_DISPRELDNE;
 
 		if (ofl->ofl_flags & FLG_OF_VERBOSE)
-			disp_errmsg(MSG_INTL(MSG_REL_DISPREL3), arsp, ofl);
+			ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL3), arsp, ofl);
 	}
 
-	DBG_CALL(Dbg_reloc_ars_entry(M_MACH, arsp));
+	DBG_CALL(Dbg_reloc_ars_entry(ofl->ofl_lml, ELF_DBG_LD,
+	    arsp->rel_isdesc->is_shdr->sh_type, M_MACH, arsp));
 	return (1);
 }
 
 uintptr_t
-reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl)
+ld_reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl)
 {
 	Sym_desc	*sdp;
 	Word		flags = ofl->ofl_flags;
@@ -513,11 +514,11 @@
 	 * relocation we need to assign it a GOT token.  Once we've got
 	 * all of the GOT's assigned we can assign the actual indexes.
 	 */
-	if ((gnp = find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC,
+	if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC,
 	    ofl, rsp)) == 0) {
 		Word	rtype = rsp->rel_rtype;
 
-		if (assign_gotndx(&(sdp->sd_GOTndxs), 0, GOT_REF_GENERIC,
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), 0, GOT_REF_GENERIC,
 		    ofl, rsp, sdp) == S_ERROR)
 			return (S_ERROR);
 
@@ -540,7 +541,7 @@
 		 */
 		if (local == TRUE) {
 			if (flags & FLG_OF_SHAROBJ) {
-				if (add_actrel((FLG_REL_GOT | FLG_REL_GOTCL),
+				if (ld_add_actrel((FLG_REL_GOT | FLG_REL_GOTCL),
 				    rsp, ofl) == S_ERROR)
 					return (S_ERROR);
 
@@ -552,25 +553,25 @@
 				    (sdp->sd_shndx != SHN_ABS)) ||
 				    (sdp->sd_aux && sdp->sd_aux->sa_symspec)) {
 					rsp->rel_rtype = M_R_RELATIVE;
-					if (add_outrel((FLG_REL_GOT |
+					if (ld_add_outrel((FLG_REL_GOT |
 					    FLG_REL_ADVAL), rsp,
 					    ofl) == S_ERROR)
 						return (S_ERROR);
 					rsp->rel_rtype = rtype;
 				}
 			} else {
-				if (add_actrel(FLG_REL_GOT, rsp,
+				if (ld_add_actrel(FLG_REL_GOT, rsp,
 				    ofl) == S_ERROR)
 					return (S_ERROR);
 			}
 		} else {
 			rsp->rel_rtype = M_R_GLOB_DAT;
-			if (add_outrel(FLG_REL_GOT, rsp, ofl) == S_ERROR)
+			if (ld_add_outrel(FLG_REL_GOT, rsp, ofl) == S_ERROR)
 				return (S_ERROR);
 			rsp->rel_rtype = rtype;
 		}
 	} else {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_GENERIC,
+		if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_GENERIC,
 		    ofl, rsp, sdp) == S_ERROR)
 			return (S_ERROR);
 	}
@@ -578,7 +579,7 @@
 	/*
 	 * Perform relocation to GOT table entry.
 	 */
-	return (add_actrel(NULL, rsp, ofl));
+	return (ld_add_actrel(NULL, rsp, ofl));
 }
 
 
@@ -586,30 +587,28 @@
  * Perform relocations for PLT's
  */
 uintptr_t
-reloc_plt(Rel_desc *rsp, Ofl_desc *ofl)
+ld_reloc_plt(Rel_desc *rsp, Ofl_desc *ofl)
 {
 	Sym_desc	*sdp = rsp->rel_sym;
 
-#if defined(__i386) || defined(__amd64)
-#if defined(_ELF64)
+#if	defined(__i386) || defined(__amd64)
+#if	defined(_ELF64)
 	/*
-	 * AMD64 TLS code sequences do not use a unique
-	 * TLS relocation to reference the __tls_get_addr()
-	 * function call.
+	 * AMD64 TLS code sequences do not use a unique TLS relocation to
+	 * reference the __tls_get_addr() function call.
 	 */
 	if ((ofl->ofl_flags & FLG_OF_EXEC) &&
 	    (strcmp(sdp->sd_name, MSG_ORIG(MSG_SYM_TLSGETADDR_U)) == 0)) {
-		return (add_actrel(FLG_REL_TLSFIX, rsp, ofl));
+		return (ld_add_actrel(FLG_REL_TLSFIX, rsp, ofl));
 	}
 #else
 	/*
-	 * GNUC IA32 TLS code sequences do not use a unique
-	 * TLS relocation to reference the ___tls_get_addr()
-	 * function call.
+	 * GNUC IA32 TLS code sequences do not use a unique TLS relocation to
+	 * reference the ___tls_get_addr() function call.
 	 */
 	if ((ofl->ofl_flags & FLG_OF_EXEC) &&
 	    (strcmp(sdp->sd_name, MSG_ORIG(MSG_SYM_TLSGETADDR_UU)) == 0)) {
-		return (add_actrel(FLG_REL_TLSFIX, rsp, ofl));
+		return (ld_add_actrel(FLG_REL_TLSFIX, rsp, ofl));
 	}
 #endif
 #endif	/* __i386 && __amd64 */
@@ -624,7 +623,7 @@
 	if (sdp->sd_aux->sa_PLTndx == 0) {
 		Word	ortype = rsp->rel_rtype;
 
-		assign_plt_ndx(sdp, ofl);
+		ld_assign_plt_ndx(sdp, ofl);
 
 		/*
 		 * If this symbol is binding to a LAZYLOADED object then
@@ -637,7 +636,7 @@
 			sdp->sd_flags |= FLG_SY_LAZYLD;
 
 		rsp->rel_rtype = M_R_JMP_SLOT;
-		if (add_outrel(FLG_REL_PLT, rsp, ofl) == S_ERROR)
+		if (ld_add_outrel(FLG_REL_PLT, rsp, ofl) == S_ERROR)
 			return (S_ERROR);
 		rsp->rel_rtype = ortype;
 	}
@@ -650,18 +649,18 @@
 		Word	ortype	= rsp->rel_rtype;
 
 		rsp->rel_rtype = M_R_RELATIVE;
-		if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
+		if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
 			return (S_ERROR);
 		rsp->rel_rtype = ortype;
 		return (1);
 	} else
-		return (add_actrel(NULL, rsp, ofl));
+		return (ld_add_actrel(NULL, rsp, ofl));
 }
 
 /*
  * process GLOBAL undefined and ref_dyn_need symbols.
  */
-uintptr_t
+static uintptr_t
 reloc_exec(Rel_desc *rsp, Ofl_desc *ofl)
 {
 	Sym_desc	*_sdp, *sdp = rsp->rel_sym;
@@ -673,21 +672,21 @@
 	 * Reference is to a function so simply create a plt entry for it.
 	 */
 	if (ELF_ST_TYPE(sym->st_info) == STT_FUNC)
-		return (reloc_plt(rsp, ofl));
+		return (ld_reloc_plt(rsp, ofl));
 
 	/*
 	 * Catch absolutes - these may cause a text relocation.
 	 */
 	if ((sdp->sd_flags & FLG_SY_SPECSEC) && (sdp->sd_shndx == SHN_ABS)) {
 		if ((ofl->ofl_flags1 & FLG_OF1_ABSEXEC) == 0)
-			return (add_outrel(NULL, rsp, ofl));
+			return (ld_add_outrel(NULL, rsp, ofl));
+
 		/*
-		 * If -zabsexec is set then promote the ABSOLUTE
-		 * symbol to current the current object and
-		 * perform the relocation now.
+		 * If -zabsexec is set then promote the ABSOLUTE symbol to
+		 * current the current object and perform the relocation now.
 		 */
 		sdp->sd_ref = REF_REL_NEED;
-		return (add_actrel(NULL, rsp, ofl));
+		return (ld_add_actrel(NULL, rsp, ofl));
 	}
 
 	/*
@@ -701,24 +700,24 @@
 	if ((ELF_ST_TYPE(sym->st_info) == STT_OBJECT) &&
 	    (rsp->rel_osdesc->os_shdr->sh_flags & SHF_WRITE)) {
 		if (sdp->sd_flags & FLG_SY_MVTOCOMM)
-			return (add_actrel(NULL, rsp, ofl));
+			return (ld_add_actrel(NULL, rsp, ofl));
 		else
-			return (add_outrel(NULL, rsp, ofl));
+			return (ld_add_outrel(NULL, rsp, ofl));
 	}
 
 	/*
-	 * If the reference isn't to an object (normally because some idiot
-	 * hasn't defined a .type directive in some assembler source), then
-	 * simply apply a generic relocation (this has a tendency to result in
-	 * text relocations).
+	 * If the reference isn't to an object (normally because a .type
+	 * directive hasn't defined in some assembler source), then simply apply
+	 * a generic relocation (this has a tendency to result in text
+	 * relocations).
 	 */
 	if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_REL_UNEXPSYM),
-		    conv_info_type_str(ofl->ofl_e_machine,
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_UNEXPSYM),
+		    conv_sym_info_type(sdp->sd_file->ifl_ehdr->e_machine,
 		    ELF_ST_TYPE(sym->st_info)),
 		    rsp->rel_isdesc->is_file->ifl_name,
 		    demangle(rsp->rel_sname), sdp->sd_file->ifl_name);
-		return (add_outrel(NULL, rsp, ofl));
+		return (ld_add_outrel(NULL, rsp, ofl));
 	}
 
 	/*
@@ -826,7 +825,7 @@
 		 */
 		_sdp = rsp->rel_usym;
 		stval = _sdp->sd_sym->st_value;
-		if (sym_copy(_sdp) == S_ERROR)
+		if (ld_sym_copy(_sdp) == S_ERROR)
 			return (S_ERROR);
 		_sdp->sd_shndx = _sdp->sd_sym->st_shndx = SHN_COMMON;
 		_sdp->sd_flags |= FLG_SY_SPECSEC;
@@ -861,7 +860,7 @@
 			return (S_ERROR);
 
 		rsp->rel_rtype = M_R_COPY;
-		if (add_outrel(FLG_REL_BSS, rsp, ofl) == S_ERROR)
+		if (ld_add_outrel(FLG_REL_BSS, rsp, ofl) == S_ERROR)
 			return (S_ERROR);
 		rsp->rel_rtype = rtype;
 
@@ -869,39 +868,40 @@
 		 * If this symbol is a protected symbol, warn it.
 		 */
 		if (_sdp->sd_flags & FLG_SY_PROT)
-			eprintf(ERR_WARNING, MSG_INTL(MSG_REL_COPY),
-			conv_reloc_type_str(_sdp->sd_file->ifl_ehdr->e_machine,
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			MSG_INTL(MSG_REL_COPY),
+			conv_reloc_type(_sdp->sd_file->ifl_ehdr->e_machine,
 			M_R_COPY), _sdp->sd_file->ifl_name, _sdp->sd_name);
-		DBG_CALL(Dbg_syms_reloc(sdp->sd_file->ifl_ehdr, sdp));
+		DBG_CALL(Dbg_syms_reloc(ofl, sdp));
 	}
-	return (add_actrel(NULL, rsp, ofl));
+	return (ld_add_actrel(NULL, rsp, ofl));
 }
 
 /*
  * All relocations should have been handled by the other routines.  This
- * routine is hear as a catch all, if we do enter it we've goofed - but
+ * routine is here as a catch all, if we do enter it we've goofed - but
  * we'll try and to the best we can.
  */
-uintptr_t
+static uintptr_t
 reloc_generic(Rel_desc *rsp, Ofl_desc *ofl)
 {
-	Word	flags = ofl->ofl_flags;
+	Ifl_desc	*ifl = rsp->rel_isdesc->is_file;
 
-	eprintf(ERR_WARNING, MSG_INTL(MSG_REL_UNEXPREL),
-	    conv_reloc_type_str(ofl->ofl_e_machine, rsp->rel_rtype),
-	    rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname));
+	eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_UNEXPREL),
+	    conv_reloc_type(ifl->ifl_ehdr->e_machine, rsp->rel_rtype),
+	    ifl->ifl_name, demangle(rsp->rel_sname));
 
 	/*
 	 * If building a shared object then put the relocation off
 	 * until runtime.
 	 */
-	if (flags & FLG_OF_SHAROBJ)
-		return (add_outrel(NULL, rsp, ofl));
+	if (ofl->ofl_flags & FLG_OF_SHAROBJ)
+		return (ld_add_outrel(NULL, rsp, ofl));
 
 	/*
 	 * Otherwise process relocation now.
 	 */
-	return (add_actrel(NULL, rsp, ofl));
+	return (ld_add_actrel(NULL, rsp, ofl));
 }
 
 /*
@@ -927,12 +927,12 @@
 	if (local && !IS_GOT_RELATIVE(rtype) && !IS_GOT_BASED(rtype) &&
 	    !IS_GOT_PC(rtype) && IS_PC_RELATIVE(rtype) &&
 	    ((sdp->sd_isc) && (sdp->sd_isc->is_osdesc == isp->is_osdesc)))
-		return (add_actrel(NULL, rsp, ofl));
+		return (ld_add_actrel(NULL, rsp, ofl));
 
 	/*
 	 * If -zredlocsym is in effect, translate all local symbol relocations
-	 * to be against section symbols, since section symbols are the only
-	 * symbols which will be added to the .symtab.
+	 * to be against against section symbols, since section symbols are
+	 * the only symbols which will be added to the .symtab.
 	 */
 	if (local && (((ofl->ofl_flags1 & FLG_OF1_REDLSYM) &&
 	    (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL)) ||
@@ -944,9 +944,10 @@
 		if (IS_GOT_RELATIVE(rsp->rel_rtype)) {
 			Ifl_desc	*ifl = rsp->rel_isdesc->is_file;
 
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PICREDLOC),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_PICREDLOC),
 			    demangle(rsp->rel_sname), ifl->ifl_name,
-			    conv_reloc_type_str(ifl->ifl_ehdr->e_machine,
+			    conv_reloc_type(ifl->ifl_ehdr->e_machine,
 			    rsp->rel_rtype));
 			return (S_ERROR);
 		}
@@ -974,15 +975,15 @@
 	 */
 	if ((ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) ||
 	    (oflags == FLG_REL_SCNNDX))
-		if (add_actrel(NULL, rsp, ofl) == S_ERROR)
+		if (ld_add_actrel(NULL, rsp, ofl) == S_ERROR)
 			return (S_ERROR);
 #endif
-	return (add_outrel(oflags, rsp, ofl));
+	return (ld_add_outrel(oflags, rsp, ofl));
 }
 
 uintptr_t
-process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc,
-    Is_desc * isp, const char *isname)
+ld_process_sym_reloc(Ofl_desc *ofl, Rel_desc *reld, Rel *reloc, Is_desc *isp,
+    const char *isname)
 {
 	Word		rtype = reld->rel_rtype;
 	Word		flags = ofl->ofl_flags;
@@ -990,8 +991,8 @@
 	Sym_aux		*sap;
 	Boolean		local;
 
-	DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, (void *)reloc,
-	    reld->rel_sname, isname));
+	DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH, M_REL_SHT_TYPE,
+	    (void *)reloc, isname, reld->rel_sname));
 
 	/*
 	 * Indicate this symbol is being used for relocation and therefore must
@@ -1095,10 +1096,11 @@
 	 * object - give a appropriate error message.
 	 */
 	if (!local && !(flags & FLG_OF_RELOBJ) && IS_GOT_BASED(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADGOTBASED),
-		    conv_reloc_type_str(ofl->ofl_e_machine, rtype),
-		    reld->rel_isdesc->is_file->ifl_name,
-		    demangle(sdp->sd_name));
+		Ifl_desc	*ifl = reld->rel_isdesc->is_file;
+
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADGOTBASED),
+		    conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype),
+		    ifl->ifl_name, demangle(sdp->sd_name));
 		return (S_ERROR);
 	}
 
@@ -1111,10 +1113,12 @@
 		 * non-allocable.
 		 */
 		if (reld->rel_osdesc->os_shdr->sh_flags & SHF_ALLOC) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLS),
-			    conv_reloc_type_str(ofl->ofl_e_machine, rtype),
-			    reld->rel_isdesc->is_file->ifl_name,
-			    demangle(sdp->sd_name));
+			Ifl_desc	*ifl = reld->rel_isdesc->is_file;
+
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_BADTLS),
+			    conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype),
+			    ifl->ifl_name, demangle(sdp->sd_name));
 			return (S_ERROR);
 		}
 	}
@@ -1123,30 +1127,30 @@
 	 * Select the relocation to perform.
 	 */
 	if (IS_REGISTER(rtype))
-		return (reloc_register(reld, isp, ofl));
+		return (ld_reloc_register(reld, isp, ofl));
 
 	if (flags & FLG_OF_RELOBJ)
 		return (reloc_relobj(local, reld, ofl));
 
 	if (IS_TLS_INS(rtype))
-		return (reloc_TLS(local, reld, ofl));
+		return (ld_reloc_TLS(local, reld, ofl));
 
 	if (IS_GOT_INS(rtype))
-		return (reloc_GOTOP(local, reld, ofl));
+		return (ld_reloc_GOTOP(local, reld, ofl));
 
 	if (IS_GOT_RELATIVE(rtype))
-		return (reloc_GOT_relative(local, reld, ofl));
+		return (ld_reloc_GOT_relative(local, reld, ofl));
 
 	if (local)
-		return (reloc_local(reld, ofl));
+		return (ld_reloc_local(reld, ofl));
 
 	if ((IS_PLT(rtype)) && ((flags & FLG_OF_BFLAG) == 0))
-		return (reloc_plt(reld, ofl));
+		return (ld_reloc_plt(reld, ofl));
 
 	if ((sdp->sd_ref == REF_REL_NEED) ||
 	    (flags & FLG_OF_BFLAG) || (flags & FLG_OF_SHAROBJ) ||
 	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_NOTYPE))
-		return (add_outrel(NULL, reld, ofl));
+		return (ld_add_outrel(NULL, reld, ofl));
 
 	if (sdp->sd_ref == REF_DYN_NEED)
 		return (reloc_exec(reld, ofl));
@@ -1172,8 +1176,8 @@
 	 * Make sure the relocation is in the valid range.
 	 */
 	if (rtype >= M_R_NUM) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_INVALRELT), ifl->ifl_name,
-		    isp->is_name, rtype);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_INVALRELT),
+		    ifl->ifl_name, isp->is_name, rtype);
 		return (S_ERROR);
 	}
 
@@ -1188,9 +1192,10 @@
 		reld->rel_sym = 0;
 		reld->rel_sname = MSG_ORIG(MSG_STR_EMPTY);
 
-		DBG_CALL(Dbg_reloc_in(M_MACH, isp->is_shdr->sh_type,
-		    (void *)reloc, reld->rel_sname, isp->is_name));
-		return (reloc_register(reld, isp, ofl));
+		DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH,
+		    isp->is_shdr->sh_type, (void *)reloc, isp->is_name,
+		    reld->rel_sname));
+		return (ld_reloc_register(reld, isp, ofl));
 	}
 
 	/*
@@ -1216,16 +1221,17 @@
 	 * state some time).  Normal users should never see this error.
 	 */
 	if (rtype == M_R_NONE) {
-		DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, (void *)reloc,
-		    reld->rel_sname, isp->is_name));
-		eprintf(ERR_WARNING, MSG_INTL(MSG_REL_NULL), ifl->ifl_name,
-		    isp->is_name);
+		DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH,
+		    M_REL_SHT_TYPE, (void *)reloc, isp->is_name,
+		    reld->rel_sname));
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_NULL),
+		    ifl->ifl_name, isp->is_name);
 		return (1);
 	}
 
 	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && IS_NOTSUP(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOTSUP),
-		    conv_reloc_type_str(ifl->ifl_ehdr->e_machine, rtype),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOTSUP),
+		    conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype),
 		    ifl->ifl_name, isp->is_name);
 		return (S_ERROR);
 	}
@@ -1235,8 +1241,8 @@
 	 * symbol. If no symbol is assigned, this is a fatal error.
 	 */
 	if (sdp == NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYMBOL),
-		    conv_reloc_type_str(ifl->ifl_ehdr->e_machine, rtype),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYMBOL),
+		    conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype),
 		    isp->is_name, ifl->ifl_name, EC_XWORD(reloc->r_offset));
 		return (S_ERROR);
 	}
@@ -1253,10 +1259,11 @@
 
 		if ((reld->rel_sname != sdp->sd_name) ||
 		    (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL) ||
-		    ((nsdp = sym_find(sdp->sd_name, SYM_NOHASH, 0,
+		    ((nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, 0,
 		    ofl)) == 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SYMDISC),
-			    ifl->ifl_name, isp->is_name, demangle(sdp->sd_name),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_REL_SYMDISC), ifl->ifl_name,
+			    isp->is_name, demangle(sdp->sd_name),
 			    sdp->sd_isc->is_name);
 			return (S_ERROR);
 		}
@@ -1268,7 +1275,7 @@
 	 * adjusting.
 	 */
 	if (sdp->sd_aux && ((sdp->sd_flags & FLG_SY_VISIBLE) == 0))
-		sym_adjust_vis(sdp, ofl);
+		ld_sym_adjust_vis(sdp, ofl);
 
 	/*
 	 * Ignore any relocation against a section that will not be in the
@@ -1286,15 +1293,15 @@
 	 */
 	if ((sdp->sd_flags & FLG_SY_INVALID) || (rsndx == 0) ||
 	    (rsndx >= ifl->ifl_symscnt)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNKNWSYM),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_UNKNWSYM),
 		    M_REL_CONTYPSTR(rtype), ifl->ifl_name, isp->is_name,
-		    demangle(reld->rel_sname), EC_XWORD(reloc->r_offset),
-		    EC_WORD(rsndx));
+		    demangle(reld->rel_sname),
+		    EC_XWORD(reloc->r_offset), EC_WORD(rsndx));
 		return (S_ERROR);
 	}
 
 	reld->rel_sym = sdp;
-	return (process_sym_reloc(ofl, reld, reloc, isp, isp->is_name));
+	return (ld_process_sym_reloc(ofl, reld, reloc, isp, isp->is_name));
 }
 
 static uintptr_t
@@ -1336,7 +1343,7 @@
 	if (shdr->sh_info == 0)
 		flags |= FLG_REL_NOINFO;
 
-	DBG_CALL(Dbg_reloc_proc(osect, isect, rsect));
+	DBG_CALL(Dbg_reloc_proc(ofl->ofl_lml, osect, isect, rsect));
 
 	for (rend = (Rel *)((uintptr_t)reloc + (uintptr_t)rsize);
 	    reloc < rend;
@@ -1350,7 +1357,7 @@
 		 * relocation records processing.
 		 */
 		reld.rel_flags = flags;
-		rsndx = init_rel(&reld, (void *)reloc);
+		rsndx = ld_init_rel(&reld, (void *)reloc);
 
 		if (process_reld(ofl, rsect, &reld, rsndx, reloc) == S_ERROR)
 			return (S_ERROR);
@@ -1358,8 +1365,7 @@
 	return (1);
 }
 
-
-uintptr_t
+static uintptr_t
 reloc_segments(int wr_flag, Ofl_desc *ofl)
 {
 	Listnode	*lnp1;
@@ -1494,7 +1500,7 @@
 		 * Initialize the relocation record information.
 		 */
 		reld.rel_flags = FLG_REL_LOAD;
-		rsndx = init_rel(&reld, (void *)reloc);
+		rsndx = ld_init_rel(&reld, (void *)reloc);
 
 		if (((mp = get_move_entry(rsect, reloc->r_offset)) == 0) ||
 		    ((reld.rel_move = libld_malloc(sizeof (Mv_desc))) == 0))
@@ -1569,7 +1575,7 @@
  * the relocation structures for later processing.
  */
 uintptr_t
-reloc_init(Ofl_desc *ofl)
+ld_reloc_init(Ofl_desc *ofl)
 {
 	Listnode	*lnp;
 	Is_desc		*isp;
@@ -1579,7 +1585,7 @@
 	 * sure we add any absolute (internal) symbols before continuing with
 	 * any relocation processing.
 	 */
-	if (sym_spec(ofl) == S_ERROR)
+	if (ld_sym_spec(ofl) == S_ERROR)
 		return (S_ERROR);
 
 	ofl->ofl_gotcnt = M_GOT_XNumber;
@@ -1644,15 +1650,17 @@
 	 */
 	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) &&
 	    ((ofl->ofl_flags & FLG_OF_BLDGOT) ||
-	    (sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl) != 0) ||
-	    (sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl) != 0))) {
-		if (make_got(ofl) == S_ERROR)
+	    (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL),
+	    SYM_NOHASH, 0, ofl) != 0) ||
+	    (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U),
+	    SYM_NOHASH, 0, ofl) != 0))) {
+		if (ld_make_got(ofl) == S_ERROR)
 			return (S_ERROR);
 
-#if defined(sparc) || defined(__sparcv9)
-		if (allocate_got(ofl) == S_ERROR)
+#if	defined(sparc) || defined(__sparcv9)
+		if (ld_allocate_got(ofl) == S_ERROR)
 			return (S_ERROR);
-#elif defined(i386) || defined(__amd64)
+#elif	defined(i386) || defined(__amd64)
 /* nothing to do */
 #else
 #error Unknown architecture!
@@ -1676,7 +1684,7 @@
  * This provides the most efficient traversal of the relocation
  * table at run-time.
  */
-int
+static int
 reloc_compare(Reloc_list *i, Reloc_list *j)
 {
 
@@ -1711,8 +1719,7 @@
 	return (0);
 }
 
-
-uintptr_t
+static uintptr_t
 do_sorted_outrelocs(Ofl_desc *ofl)
 {
 	Rel_desc	*orsp;
@@ -1744,7 +1751,8 @@
 		for (orsp = (Rel_desc *)(rcp + 1);
 		    orsp < rcp->rc_free; orsp++) {
 			if (debug == 0) {
-				DBG_CALL(Dbg_reloc_dooutrel(M_REL_SHT_TYPE));
+				DBG_CALL(Dbg_reloc_dooutrel(ofl->ofl_lml,
+				    M_REL_SHT_TYPE));
 				debug = 1;
 			}
 
@@ -1753,7 +1761,7 @@
 			 * order that it was originally processed.
 			 */
 			if (orsp->rel_flags & FLG_REL_PLT) {
-				if (perform_outreloc(orsp, ofl) == S_ERROR)
+				if (ld_perform_outreloc(orsp, ofl) == S_ERROR)
 					error = S_ERROR;
 				continue;
 			}
@@ -1773,7 +1781,7 @@
 
 			if (orsp->rel_flags & FLG_REL_GOT)
 				sorted_list[index].rl_key3 =
-					calc_got_offset(orsp, ofl);
+					ld_calc_got_offset(orsp, ofl);
 			else {
 				if (orsp->rel_rtype == M_R_REGISTER)
 					sorted_list[index].rl_key3 = 0;
@@ -1800,7 +1808,7 @@
 	 * and process each relocation.
 	 */
 	for (index = 0; index < ofl->ofl_reloccnt; index++) {
-		if (perform_outreloc(sorted_list[index].rl_rsp, ofl) ==
+		if (ld_perform_outreloc(sorted_list[index].rl_rsp, ofl) ==
 		    S_ERROR)
 			error = S_ERROR;
 	}
@@ -1813,7 +1821,7 @@
  * section and invokes reloc_sec() to relocate that section.
  */
 uintptr_t
-reloc_process(Ofl_desc *ofl)
+ld_reloc_process(Ofl_desc *ofl)
 {
 	Listnode	*lnp1;
 	Sg_desc		*sgp;
@@ -1846,7 +1854,7 @@
 	if (do_sorted_outrelocs(ofl) == S_ERROR)
 		return (S_ERROR);
 
-	if (do_activerelocs(ofl) == S_ERROR)
+	if (ld_do_activerelocs(ofl) == S_ERROR)
 		return (S_ERROR);
 
 	if ((ofl->ofl_flags1 & FLG_OF1_RELCNT) == 0) {
@@ -1910,7 +1918,7 @@
 	 */
 	if ((flags & (FLG_OF_PURETXT | FLG_OF_TEXTREL)) ==
 	    (FLG_OF_PURETXT | FLG_OF_TEXTREL)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_REMAIN_3));
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_REMAIN_3));
 		return (S_ERROR);
 	}
 
@@ -1919,7 +1927,7 @@
 	 * .dynamic section (_DYNAMIC).
 	 */
 	if (flags & FLG_OF_DYNAMIC) {
-		if (fillin_gotplt1(ofl) == S_ERROR)
+		if (ld_fillin_gotplt(ofl) == S_ERROR)
 			return (S_ERROR);
 	}
 
@@ -1944,9 +1952,8 @@
  * anything to fix the error - thus we've chosen not to give the user an error,
  * or warning, for this case.
  */
-
-void
-reloc_remain_title(int warning)
+static void
+reloc_remain_title(Ofl_desc *ofl, int warning)
 {
 	const char	*str1;
 
@@ -1955,7 +1962,7 @@
 	else
 		str1 = MSG_INTL(MSG_REL_RMN_ITM_11);
 
-	eprintf(ERR_NONE, MSG_INTL(MSG_REL_REMAIN_FMT_1),
+	eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_REL_REMAIN_FMT_1),
 		str1,
 		MSG_INTL(MSG_REL_RMN_ITM_31),
 		MSG_INTL(MSG_REL_RMN_ITM_12),
@@ -1965,7 +1972,7 @@
 }
 
 void
-reloc_remain_entry(Rel_desc *orsp, Os_desc *osp, Ofl_desc *ofl)
+ld_reloc_remain_entry(Rel_desc *orsp, Os_desc *osp, Ofl_desc *ofl)
 {
 	static Boolean	reloc_title = TRUE;
 
@@ -1999,14 +2006,15 @@
 		 * building a executable then only emit a 'warning'.
 		 */
 		if (ofl->ofl_flags & FLG_OF_PURETXT)
-			reloc_remain_title(0);
+			reloc_remain_title(ofl, 0);
 		else
-			reloc_remain_title(1);
+			reloc_remain_title(ofl, 1);
 		reloc_title = FALSE;
 	}
 
-	eprintf(ERR_NONE, MSG_INTL(MSG_REL_REMAIN_2), demangle(orsp->rel_sname),
-	    EC_OFF(orsp->rel_roffset), orsp->rel_isdesc->is_file->ifl_name);
+	eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_REL_REMAIN_2),
+	    demangle(orsp->rel_sname), EC_OFF(orsp->rel_roffset),
+	    orsp->rel_isdesc->is_file->ifl_name);
 }
 
 /*
@@ -2052,7 +2060,7 @@
 }
 
 void
-adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp)
+ld_adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp)
 {
 	Move		*move = arsp->rel_move->mvd_move;
 	Sym_desc	*psdp = arsp->rel_move->mvd_sym;
@@ -2064,19 +2072,18 @@
 		 */
 		(void) newroffset_for_move(psdp, move, arsp->rel_roffset,
 		    &newoffset);
-		DBG_CALL(Dbg_move_adjmovereloc(arsp->rel_roffset, newoffset,
-		    psdp->sd_name));
+		DBG_CALL(Dbg_move_adjmovereloc(ofl->ofl_lml, arsp->rel_roffset,
+		    newoffset, psdp->sd_name));
 		arsp->rel_roffset = newoffset;
 	} else {
 		/*
 		 * We are expanding the partial symbol.  So we are generating
 		 * the relocation entry relocating the expanded partial symbol.
 		 */
-		arsp->rel_roffset +=
-		    psdp->sd_sym->st_value -
+		arsp->rel_roffset += psdp->sd_sym->st_value -
 		    ofl->ofl_issunwdata1->is_osdesc->os_shdr->sh_addr;
-		DBG_CALL(Dbg_move_adjexpandreloc(arsp->rel_roffset,
-		    psdp->sd_name));
+		DBG_CALL(Dbg_move_adjexpandreloc(ofl->ofl_lml,
+		    arsp->rel_roffset, psdp->sd_name));
 	}
 }
 
@@ -2087,7 +2094,7 @@
  *	at the relocation target address.
  */
 Sym_desc *
-am_I_partial(Rel_desc *reld, Xword val)
+ld_am_I_partial(Rel_desc *reld, Xword val)
 {
 	Ifl_desc *	ifile = reld->rel_sym->sd_isc->is_file;
 	int 		nlocs = ifile->ifl_locscnt, i;
--- a/usr/src/cmd/sgs/libld/common/resolve.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/resolve.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"   /* SVR4 6.2/18.2 */
 
@@ -33,7 +32,7 @@
  * Symbol table resolution
  */
 #include	<stdio.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -72,7 +71,7 @@
 	/*
 	 * Perform any machine specific type checking.
 	 */
-	if (mach_sym_typecheck(sdp, nsym, ifl, ofl))
+	if (ld_mach_sym_typecheck(sdp, nsym, ifl, ofl))
 		return;
 
 	/*
@@ -100,11 +99,12 @@
 	if ((otype == ntype) || (otype == STT_NOTYPE) || (ntype == STT_NOTYPE))
 		return;
 
-	eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
+	eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
 	    demangle(sdp->sd_name));
-	eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name,
-	    conv_info_type_str(ofl->ofl_e_machine, otype), ifl->ifl_name,
-	    conv_info_type_str(ofl->ofl_e_machine, ntype));
+	eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
+	    sdp->sd_file->ifl_name,
+	    conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), ifl->ifl_name,
+	    conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype));
 }
 
 /*ARGSUSED4*/
@@ -115,7 +115,7 @@
 	/*
 	 * Perform any machine specific type checking.
 	 */
-	(void) mach_sym_typecheck(sdp, nsym, ifl, ofl);
+	(void) ld_mach_sym_typecheck(sdp, nsym, ifl, ofl);
 }
 
 /*
@@ -326,8 +326,9 @@
 	 */
 	if (((nsymflags & FLG_SY_SPECSEC) == 0) && (nshndx != SHN_UNDEF))
 		if ((sdp->sd_isc = ifl->ifl_isdesc[nshndx]) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_NOSECDEF),
-			    demangle(sdp->sd_name), ifl->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_NOSECDEF), demangle(sdp->sd_name),
+			    ifl->ifl_name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 }
@@ -383,13 +384,13 @@
 	 */
 	if ((ofile == ET_REL) && (nfile == ET_REL) && (obind != STB_WEAK) &&
 	    (nbind != STB_WEAK) && (!(ofl->ofl_flags & FLG_OF_MULDEFS))) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF),
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF),
 		    demangle(sdp->sd_name));
-		eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
+		eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
 		    sdp->sd_file->ifl_name,
-		    conv_info_type_str(ofl->ofl_e_machine, otype),
+		    conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype),
 		    ifl->ifl_name,
-		    conv_info_type_str(ofl->ofl_e_machine, ntype));
+		    conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype));
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return;
 	}
@@ -397,27 +398,28 @@
 	/*
 	 * Perform any machine specific type checking.
 	 */
-	if (mach_sym_typecheck(sdp, nsym, ifl, ofl))
+	if (ld_mach_sym_typecheck(sdp, nsym, ifl, ofl))
 		return;
 
 	/*
 	 * Check the symbols type and size.
 	 */
 	if (otype != ntype) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
 		    demangle(sdp->sd_name));
-		eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
+		eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
 		    sdp->sd_file->ifl_name,
-		    conv_info_type_str(ofl->ofl_e_machine, otype),
-		    ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine,
+		    conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype),
+		    ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine,
 		    ntype));
 		warn++;
 	} else if ((otype == STT_OBJECT) && (osym->st_size != nsym->st_size)) {
 		if (!(ofl->ofl_flags & FLG_OF_NOWARN)) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR),
-			    demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES),
-			    sdp->sd_file->ifl_name, EC_XWORD(osym->st_size),
-			    ifl->ifl_name, EC_XWORD(nsym->st_size));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name),
+			    MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name,
+			    EC_XWORD(osym->st_size), ifl->ifl_name,
+			    EC_XWORD(nsym->st_size));
 			warn++;
 		}
 	}
@@ -440,20 +442,20 @@
 	 */
 	if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    sdp->sd_file->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
 		return;
 	} else if ((nfile == ET_REL) && ((ofile == ET_DYN) ||
 	    ((obind == STB_WEAK) && (nbind != STB_WEAK)))) {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    ifl->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name);
 		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
 		return;
 	} else {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    sdp->sd_file->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
 		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
 		return;
 	}
@@ -494,19 +496,19 @@
 	if ((ofile == ET_REL) && (nfile == ET_REL) && (obind == nbind) &&
 	    ((otype == STT_FUNC) || (ntype == STT_FUNC))) {
 		if (ofl->ofl_flags & FLG_OF_MULDEFS) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
-			    demangle(sdp->sd_name));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name));
 			sym_promote(sdp, nsym, ifl, ofl, ndx,
 				nshndx, nsymflags);
 		} else {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF),
-			    demangle(sdp->sd_name));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_MULDEF), demangle(sdp->sd_name));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
-		eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
+		eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
 		    sdp->sd_file->ifl_name,
-		    conv_info_type_str(ofl->ofl_e_machine, otype),
-		    ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine,
+		    conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype),
+		    ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine,
 		    ntype));
 		return;
 	} else if (ofile != nfile) {
@@ -541,12 +543,12 @@
 	 * Check the symbols type and size.
 	 */
 	if (otype != ntype) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE),
 		    demangle(sdp->sd_name));
-		eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
+		eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
 		    sdp->sd_file->ifl_name,
-		    conv_info_type_str(ofl->ofl_e_machine, otype),
-		    ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine,
+		    conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype),
+		    ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine,
 		    ntype));
 		warn++;
 	} else if (osym->st_size != nsym->st_size) {
@@ -561,15 +563,18 @@
 		    (obind == nbind)) &&
 		    ((otent && (osym->st_size > nsym->st_size)) ||
 		    (ntent && (osym->st_size < nsym->st_size)))) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DIFFATTR),
-			    demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES),
-			    sdp->sd_file->ifl_name, EC_XWORD(osym->st_size),
-			    ifl->ifl_name, EC_XWORD(nsym->st_size));
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_TENTERR));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name),
+			    MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name,
+			    EC_XWORD(osym->st_size), ifl->ifl_name,
+			    EC_XWORD(nsym->st_size));
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_TENTERR));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		} else {
 			if (!(ofl->ofl_flags & FLG_OF_NOWARN)) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_SYM_DIFFATTR),
 				    demangle(sdp->sd_name),
 				    MSG_INTL(MSG_STR_SIZES),
 				    sdp->sd_file->ifl_name,
@@ -614,22 +619,22 @@
 
 	if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    sdp->sd_file->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
 		return;
 	}
 
 	if (((otent) && (!((obind != STB_WEAK) && (nbind == STB_WEAK)))) ||
 	    ((obind == STB_WEAK) && (nbind != STB_WEAK))) {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    ifl->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name);
 		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
 		return;
 	} else {
 		if (warn)
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN),
-			    sdp->sd_file->ifl_name);
+			eprintf(ofl->ofl_lml, ERR_NONE,
+			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
 		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
 		return;
 	}
@@ -716,8 +721,8 @@
 			alignscompliment = 0;
 
 		if (!(ofl->ofl_flags & FLG_OF_NOWARN) && !alignscompliment)
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR),
-			    demangle(sdp->sd_name),
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name),
 			    MSG_INTL(MSG_STR_ALIGNMENTS),
 			    sdp->sd_file->ifl_name, EC_XWORD(osym->st_value),
 			    ifl->ifl_name, EC_XWORD(nsym->st_value));
@@ -742,7 +747,7 @@
 			value = balign;
 		}
 		if (!(ofl->ofl_flags & FLG_OF_NOWARN) && !alignscompliment)
-			eprintf(ERR_NONE, emsg, file);
+			eprintf(ofl->ofl_lml, ERR_NONE, emsg, file);
 	}
 
 	/*
@@ -753,10 +758,11 @@
 		const char	*file;
 
 		if (!(ofl->ofl_flags & FLG_OF_NOWARN))
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR),
-			    demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES),
-			    sdp->sd_file->ifl_name, EC_XWORD(osym->st_size),
-			    ifl->ifl_name, EC_XWORD(nsym->st_size));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name),
+			    MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name,
+			    EC_XWORD(osym->st_size), ifl->ifl_name,
+			    EC_XWORD(nsym->st_size));
 
 
 		/*
@@ -765,7 +771,7 @@
 		 */
 		if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) {
 			if (!(ofl->ofl_flags & FLG_OF_NOWARN))
-				eprintf(ERR_NONE, emsg,
+				eprintf(ofl->ofl_lml, ERR_NONE, emsg,
 				    sdp->sd_file->ifl_name);
 			return;
 		}
@@ -814,7 +820,7 @@
 				file = sdp->sd_file->ifl_name;
 		}
 		if (!(ofl->ofl_flags & FLG_OF_NOWARN))
-			eprintf(ERR_NONE, emsg, file);
+			eprintf(ofl->ofl_lml, ERR_NONE, emsg, file);
 		if (size)
 			sdp->sd_sym->st_size = (Xword)size;
 	} else {
@@ -884,8 +890,8 @@
 };
 
 uintptr_t
-sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx,
-	Word nshndx, Word nsymflags)
+ld_sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx,
+    Word nshndx, Word nsymflags)
 {
 	int		row, column;		/* State table coordinates */
 	Sym		*osym = sdp->sd_sym;
@@ -953,8 +959,8 @@
 		}
 	}
 
-	DBG_CALL(Dbg_syms_resolving1(ndx, sdp->sd_name, row, column));
-	DBG_CALL(Dbg_syms_resolving2(ifl->ifl_ehdr, osym, nsym, sdp, ifl));
+	DBG_CALL(Dbg_syms_resolving(ofl, ndx, sdp->sd_name, row, column,
+	    osym, nsym, sdp, ifl));
 
 	/*
 	 * Record the input filename on the defined files list for possible
@@ -980,7 +986,7 @@
 	 */
 	if ((sdp->sd_file == ifl) && (nfile == ET_REL) && (ifl->ifl_versym) &&
 	    (nshndx != SHN_UNDEF))
-		vers_promote(sdp, ndx, ifl, ofl);
+		ld_vers_promote(sdp, ndx, ifl, ofl);
 
 	/*
 	 * Determine whether a mapfile reference has been satisfied.  Mapfile
@@ -1009,7 +1015,7 @@
 			sdp->sd_flags |= FLG_SY_MAPUSED;
 	}
 
-	DBG_CALL(Dbg_syms_resolved(ifl->ifl_ehdr, sdp));
+	DBG_CALL(Dbg_syms_resolved(ofl, sdp));
 
 	return (1);
 }
--- a/usr/src/cmd/sgs/libld/common/sections.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/sections.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -35,9 +34,8 @@
 #include	<string.h>
 #include	<strings.h>
 #include	<stdio.h>
-#include	<unistd.h>
 #include	<link.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -58,7 +56,7 @@
  *	  So even if -zignore is in effect, if the section is not allocatable,
  *	  we do not eliminate it.
  */
-uintptr_t
+static uintptr_t
 ignore_section_processing(Ofl_desc *ofl)
 {
 	Listnode	*lnp;
@@ -72,7 +70,8 @@
 		 * Diagnose (-D unused) a completely unreferenced file.
 		 */
 		if ((ifl->ifl_flags & FLG_IF_FILEREF) == 0)
-			DBG_CALL(Dbg_unused_file(ifl->ifl_name, 0, 0));
+			DBG_CALL(Dbg_unused_file(ofl->ofl_lml,
+			    ifl->ifl_name, 0, 0));
 		if (((ofl->ofl_flags1 & FLG_OF1_IGNPRC) == 0) ||
 		    ((ifl->ifl_flags & FLG_IF_IGNORE) == 0))
 			continue;
@@ -85,7 +84,7 @@
 		discard = 0;
 		if (ifl->ifl_flags & FLG_IF_FILEREF) {
 			for (num = 1; num < ifl->ifl_shnum; num++) {
-				Is_desc	*isp;
+				Is_desc	*isp = ifl->ifl_isdesc[num];
 				Os_desc *osp;
 				Sg_desc	*sgp;
 
@@ -161,9 +160,9 @@
 			 * the symbol is being defined in - skip it.
 			 */
 			if ((sdp->sd_isc->is_flags & FLG_IS_SECTREF) ||
-			    (((ifl->ifl_flags & FLG_IF_FILEREF) &&
+			    ((ifl->ifl_flags & FLG_IF_FILEREF) &&
 			    ((osp = sdp->sd_isc->is_osdesc) != 0) &&
-			    (osp->os_sgdesc->sg_phdr.p_type != PT_LOAD))))
+			    (osp->os_sgdesc->sg_phdr.p_type != PT_LOAD)))
 				continue;
 
 			/*
@@ -182,7 +181,8 @@
 					}
 					sdp->sd_flags |= FLG_SY_ISDISC;
 				}
-				DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc));
+				DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml,
+				    sdp, sdp->sd_isc));
 				continue;
 			}
 
@@ -201,7 +201,8 @@
 
 					sdp->sd_flags1 |= FLG_SY1_ELIM;
 				}
-				DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc));
+				DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml,
+				    sdp, sdp->sd_isc));
 				continue;
 			}
 		}
@@ -269,7 +270,7 @@
  * section required to represent them.
  */
 uintptr_t
-make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which)
+ld_make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which)
 {
 	Shdr		*shdr;
 	Elf_Data	*data;
@@ -286,7 +287,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = (size_t)size;
 	data->d_align = (size_t)align;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -330,7 +331,7 @@
 	 * Retain this .bss input section as this will be where global
 	 * symbol references are added.
 	 */
-	if ((osp = place_section(ofl, isec, ident, 0)) == (Os_desc *)S_ERROR)
+	if ((osp = ld_place_section(ofl, isec, ident, 0)) == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
 	/*
@@ -361,7 +362,7 @@
  * Build a SHT_{INIT|FINI|PREINIT}ARRAY section (specified via
  * ld -z *array=name
  */
-uintptr_t
+static uintptr_t
 make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list)
 {
 	uint_t		entcount;
@@ -391,7 +392,7 @@
 	data->d_type = ELF_T_ADDR;
 	data->d_size = sizeof (Addr) * entcount;
 	data->d_align = sizeof (Addr);
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -413,7 +414,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	if (place_section(ofl, isec, M_ID_ARRAY, 0) == (Os_desc *)S_ERROR)
+	if (ld_place_section(ofl, isec, M_ID_ARRAY, 0) == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
 	osp = isec->is_osdesc;
@@ -451,12 +452,12 @@
 	reloc.r_info = ELF_R_INFO(0, M_R_ARRAYADDR);
 	reloc.r_addend = 0;
 
-	DBG_CALL(Dbg_reloc_generate(osp, M_REL_SHT_TYPE));
+	DBG_CALL(Dbg_reloc_generate(ofl->ofl_lml, osp, M_REL_SHT_TYPE));
 	for (LIST_TRAVERSE(list, lnp, sdp)) {
 		reld.rel_sname = sdp->sd_name;
 		reld.rel_sym = sdp;
 
-		if (process_sym_reloc(ofl, &reld, (Rel *)&reloc, isec,
+		if (ld_process_sym_reloc(ofl, &reld, (Rel *)&reloc, isec,
 		    MSG_INTL(MSG_STR_COMMAND)) == S_ERROR)
 			return (S_ERROR);
 
@@ -470,7 +471,7 @@
 /*
  * Build a comment section (-Qy option).
  */
-uintptr_t
+static uintptr_t
 make_comment(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -486,7 +487,7 @@
 	data->d_buf = (void *)ofl->ofl_sgsid;
 	data->d_size = strlen(ofl->ofl_sgsid) + 1;
 	data->d_align = 1;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -506,7 +507,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	return ((uintptr_t)place_section(ofl, isec, M_ID_NOTE, 0));
+	return ((uintptr_t)ld_place_section(ofl, isec, M_ID_NOTE, 0));
 }
 
 /*
@@ -514,7 +515,7 @@
  * within this structure, they will be added to the global string table
  * (.dynstr).  This routine should be called before make_dynstr().
  */
-uintptr_t
+static uintptr_t
 make_dynamic(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -539,13 +540,13 @@
 	if (!(flags & FLG_OF_RELOBJ))
 		shdr->sh_flags |= SHF_ALLOC;
 	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = (Xword)elf_fsize(ELF_T_DYN, 1, ofl->ofl_libver);
-	if (shdr->sh_entsize == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name);
+	if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_DYN, 1,
+	    ofl->ofl_dehdr->e_version)) == 0) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
-
 	/*
 	 * Allocate and initialize the Elf_Data structure.
 	 */
@@ -554,7 +555,7 @@
 	data->d_type = ELF_T_DYN;
 	data->d_size = 0;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Is_desc structure.
@@ -566,7 +567,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	osp = ofl->ofl_osdynamic = place_section(ofl, isec, M_ID_DYNAMIC, 0);
+	osp = ofl->ofl_osdynamic = ld_place_section(ofl, isec, M_ID_DYNAMIC, 0);
 
 	/*
 	 * Reserve entries for any needed dependencies.
@@ -589,8 +590,8 @@
 		if ((ifl->ifl_flags & FLG_IF_NEEDSTR) ||
 		    ((ifl->ifl_flags & FLG_IF_DEPREQD) == 0)) {
 			if (unused++ == 0)
-				DBG_CALL(Dbg_util_nl());
-			DBG_CALL(Dbg_unused_file(ifl->ifl_soname,
+				DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD));
+			DBG_CALL(Dbg_unused_file(ofl->ofl_lml, ifl->ifl_soname,
 			    (ifl->ifl_flags & FLG_IF_NEEDSTR), 0));
 
 			if (ifl->ifl_flags & FLG_IF_NEEDSTR)
@@ -629,7 +630,7 @@
 	}
 
 	if (unused)
-		DBG_CALL(Dbg_util_nl());
+		DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD));
 
 	/*
 	 * Reserve entries for any per-symbol auxiliary/filter strings.
@@ -646,12 +647,12 @@
 	/*
 	 * Reserve entries for any _init() and _fini() section addresses.
 	 */
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U),
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U),
 	    SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) {
 		sdp->sd_flags |= FLG_SY_UPREQD;
 		cnt++;
 	}
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U),
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U),
 	    SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) {
 		sdp->sd_flags |= FLG_SY_UPREQD;
 		cnt++;
@@ -824,9 +825,9 @@
 		cnt++;				/* SYMBOLIC */
 
 	/*
-	 * Account for Architecture dependent .dynamic entries, and defaults
+	 * Account for Architecture dependent .dynamic entries, and defaults.
 	 */
-	mach_make_dynamic(ofl, &cnt);
+	ld_mach_make_dynamic(ofl, &cnt);
 
 	cnt += 3;				/* DT_FLAGS, DT_FLAGS_1, */
 						/*   and DT_NULL */
@@ -846,7 +847,7 @@
  * Build the GOT section and its associated relocation entries.
  */
 uintptr_t
-make_got(Ofl_desc *ofl)
+ld_make_got(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
 	Elf_Data	*data;
@@ -862,7 +863,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -884,7 +885,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	if ((ofl->ofl_osgot = place_section(ofl, isec, M_ID_GOT, 0)) ==
+	if ((ofl->ofl_osgot = ld_place_section(ofl, isec, M_ID_GOT, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -896,7 +897,7 @@
 /*
  * Build an interp section.
  */
-uintptr_t
+static uintptr_t
 make_interp(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -919,13 +920,13 @@
 	 * In the case of a dynamic executable supply a default interpretor
 	 * if a specific interpreter has not been specified.
 	 */
-	if (!iname) {
-		if (ofl->ofl_e_machine == EM_SPARCV9)
+	if (iname == 0) {
+		if (ofl->ofl_dehdr->e_machine == EM_SPARCV9)
 			iname = ofl->ofl_interp =
-				MSG_ORIG(MSG_PTH_RTLD_SPARCV9);
-		else if (ofl->ofl_e_machine == EM_AMD64)
+			    MSG_ORIG(MSG_PTH_RTLD_SPARCV9);
+		else if (ofl->ofl_dehdr->e_machine == EM_AMD64)
 			iname = ofl->ofl_interp =
-				MSG_ORIG(MSG_PTH_RTLD_AMD64);
+			    MSG_ORIG(MSG_PTH_RTLD_AMD64);
 		else
 			iname = ofl->ofl_interp = MSG_ORIG(MSG_PTH_RTLD);
 	}
@@ -939,7 +940,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -959,14 +960,14 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	ofl->ofl_osinterp = place_section(ofl, isec, M_ID_INTERP, 0);
+	ofl->ofl_osinterp = ld_place_section(ofl, isec, M_ID_INTERP, 0);
 	return ((uintptr_t)ofl->ofl_osinterp);
 }
 
 /*
  * Build a hardware/software capabilities section.
  */
-uintptr_t
+static uintptr_t
 make_cap(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -993,7 +994,7 @@
 	if ((data = libld_calloc(sizeof (Elf_Data), 1)) == 0)
 		return (S_ERROR);
 	data->d_type = ELF_T_CAP;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 	data->d_align = M_WORD_ALIGN;
 
 	/*
@@ -1004,9 +1005,10 @@
 	shdr->sh_type = SHT_SUNW_cap;
 	shdr->sh_flags = SHF_ALLOC;
 	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = (Xword)elf_fsize(ELF_T_CAP, 1, ofl->ofl_libver);
-	if (shdr->sh_entsize == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name);
+	if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_CAP, 1,
+	    ofl->ofl_dehdr->e_version)) == 0) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -1046,7 +1048,7 @@
 	 * If we're not creating a relocatable object, save the output section
 	 * to trigger the creation of an associated  a program header.
 	 */
-	osec = place_section(ofl, isec, M_ID_CAP, 0);
+	osec = ld_place_section(ofl, isec, M_ID_CAP, 0);
 	if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0)
 		ofl->ofl_oscap = osec;
 
@@ -1056,7 +1058,7 @@
 /*
  * Build the PLT section and its associated relocation entries.
  */
-uintptr_t
+static uintptr_t
 make_plt(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1067,7 +1069,7 @@
 				(size_t)ofl->ofl_pltpad) * M_PLT_ENTSIZE);
 	size_t		rsize = (size_t)ofl->ofl_relocpltsz;
 
-#if defined(sparc)
+#if	defined(sparc)
 	/*
 	 * Account for the NOP at the end of the plt.
 	 */
@@ -1082,7 +1084,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = M_PLT_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1104,7 +1106,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	if ((ofl->ofl_osplt = place_section(ofl, isec, M_ID_PLT, 0)) ==
+	if ((ofl->ofl_osplt = ld_place_section(ofl, isec, M_ID_PLT, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1118,7 +1120,7 @@
  * libraries, and provides hashed lookup into the global symbol table
  * (.dynsym) for the run-time linker to resolve symbol lookups.
  */
-uintptr_t
+static uintptr_t
 make_hash(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1135,7 +1137,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_WORD;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1145,9 +1147,10 @@
 	shdr->sh_type = SHT_HASH;
 	shdr->sh_flags = SHF_ALLOC;
 	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = (Xword)elf_fsize(ELF_T_WORD, 1, ofl->ofl_libver);
-	if (shdr->sh_entsize == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name);
+	if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_WORD, 1,
+	    ofl->ofl_dehdr->e_version)) == 0) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -1164,7 +1167,7 @@
 	 * Place the section first since it will affect the local symbol
 	 * count.
 	 */
-	if ((ofl->ofl_oshash = place_section(ofl, isec, M_ID_HASH, 0)) ==
+	if ((ofl->ofl_oshash = ld_place_section(ofl, isec, M_ID_HASH, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1200,7 +1203,7 @@
  * Generate the standard symbol table.  Contains all locals and globals,
  * and resides in a non-allocatable section (ie. it can be stripped).
  */
-uintptr_t
+static uintptr_t
 make_symtab(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1217,7 +1220,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_SYM;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1226,9 +1229,10 @@
 		return (S_ERROR);
 	shdr->sh_type = SHT_SYMTAB;
 	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, ofl->ofl_libver);
-	if (shdr->sh_entsize == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name);
+	if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1,
+	    ofl->ofl_dehdr->e_version)) == 0) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -1245,7 +1249,7 @@
 	 * Place the section first since it will affect the local symbol
 	 * count.
 	 */
-	if ((ofl->ofl_ossymtab = place_section(ofl, isec, M_ID_SYMTAB, 0)) ==
+	if ((ofl->ofl_ossymtab = ld_place_section(ofl, isec, M_ID_SYMTAB, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1262,7 +1266,7 @@
 			return (S_ERROR);
 		xdata->d_type = ELF_T_WORD;
 		xdata->d_align = M_WORD_ALIGN;
-		xdata->d_version = ofl->ofl_libver;
+		xdata->d_version = ofl->ofl_dehdr->e_version;
 		if ((xshdr = libld_calloc(sizeof (Shdr), 1)) == 0)
 			return (S_ERROR);
 		xshdr->sh_type = SHT_SYMTAB_SHNDX;
@@ -1273,7 +1277,7 @@
 		xisec->is_name = MSG_ORIG(MSG_SCN_SYMTAB_SHNDX);
 		xisec->is_shdr = xshdr;
 		xisec->is_indata = xdata;
-		if ((ofl->ofl_ossymshndx = place_section(ofl, xisec,
+		if ((ofl->ofl_ossymshndx = ld_place_section(ofl, xisec,
 		    M_ID_SYMTAB_NDX, 0)) == (Os_desc *)S_ERROR)
 			return (S_ERROR);
 	}
@@ -1309,7 +1313,7 @@
  * Build a dynamic symbol table.  Contains only globals symbols and resides
  * in the text segment of a dynamic executable or shared library.
  */
-uintptr_t
+static uintptr_t
 make_dynsym(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1325,7 +1329,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_SYM;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1335,9 +1339,10 @@
 	shdr->sh_type = SHT_DYNSYM;
 	shdr->sh_flags = SHF_ALLOC;
 	shdr->sh_addralign = M_WORD_ALIGN;
-	shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, ofl->ofl_libver);
-	if (shdr->sh_entsize == 0) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name);
+	if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1,
+	    ofl->ofl_dehdr->e_version)) == 0) {
+		eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE),
+		    ofl->ofl_name);
 		return (S_ERROR);
 	}
 
@@ -1354,7 +1359,7 @@
 	 * Place the section first since it will affect the local symbol
 	 * count.
 	 */
-	if ((ofl->ofl_osdynsym = place_section(ofl, isec, M_ID_DYNSYM, 0)) ==
+	if ((ofl->ofl_osdynsym = ld_place_section(ofl, isec, M_ID_DYNSYM, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1376,7 +1381,7 @@
 /*
  * Build a SHT_SYMTAB_SHNDX for the .dynsym
  */
-uintptr_t
+static uintptr_t
 make_dynsym_shndx(Ofl_desc *ofl)
 {
 	Is_desc		*isec;
@@ -1391,7 +1396,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_WORD;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate the Shdr structure.
@@ -1411,7 +1416,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	if ((ofl->ofl_osdynshndx = place_section(ofl, isec,
+	if ((ofl->ofl_osdynshndx = ld_place_section(ofl, isec,
 	    M_ID_DYNSYM_NDX, 0)) == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1429,7 +1434,7 @@
 /*
  * Build a string table for the section headers.
  */
-uintptr_t
+static uintptr_t
 make_shstrtab(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1444,7 +1449,7 @@
 		return (S_ERROR);
 	data->d_type = ELF_T_BYTE;
 	data->d_align = 1;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate the Shdr structure.
@@ -1468,7 +1473,7 @@
 	 * Place the section first, as it may effect the number of section
 	 * headers to account for.
 	 */
-	if ((ofl->ofl_osshstrtab = place_section(ofl, isec, M_ID_NOTE, 0)) ==
+	if ((ofl->ofl_osshstrtab = ld_place_section(ofl, isec, M_ID_NOTE, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1486,7 +1491,7 @@
 /*
  * Build a string section for the standard symbol table.
  */
-uintptr_t
+static uintptr_t
 make_strtab(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1513,7 +1518,7 @@
 	data->d_size = size;
 	data->d_type = ELF_T_BYTE;
 	data->d_align = 1;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate the Shdr structure.
@@ -1534,14 +1539,14 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	ofl->ofl_osstrtab = place_section(ofl, isec, M_ID_STRTAB, 0);
+	ofl->ofl_osstrtab = ld_place_section(ofl, isec, M_ID_STRTAB, 0);
 	return ((uintptr_t)ofl->ofl_osstrtab);
 }
 
 /*
  * Build a string table for the dynamic symbol table.
  */
-uintptr_t
+static uintptr_t
 make_dynstr(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1597,7 +1602,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = 1;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate the Shdr structure.
@@ -1621,7 +1626,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	ofl->ofl_osdynstr = place_section(ofl, isec, M_ID_DYNSTR, 0);
+	ofl->ofl_osdynstr = ld_place_section(ofl, isec, M_ID_DYNSTR, 0);
 	return ((uintptr_t)ofl->ofl_osdynstr);
 }
 
@@ -1632,7 +1637,7 @@
  * If (osp == NULL) then we are creating the coalesced relocation section
  * for an executable and/or a shared object.
  */
-uintptr_t
+static uintptr_t
 make_reloc(Ofl_desc *ofl, Os_desc *osp)
 {
 	Shdr		*shdr;
@@ -1689,7 +1694,7 @@
 	data->d_type = M_REL_ELF_TYPE;
 	data->d_size = size;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1729,7 +1734,7 @@
 	 * Associate this relocation section to the section its going to
 	 * relocate.
 	 */
-	if ((rosp = place_section(ofl, isec, M_ID_REL, 0)) ==
+	if ((rosp = ld_place_section(ofl, isec, M_ID_REL, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -1773,7 +1778,7 @@
 /*
  * Generate version needed section.
  */
-uintptr_t
+static uintptr_t
 make_verneed(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1789,7 +1794,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1810,7 +1815,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	ofl->ofl_osverneed = place_section(ofl, isec, M_ID_VERSION, 0);
+	ofl->ofl_osverneed = ld_place_section(ofl, isec, M_ID_VERSION, 0);
 	return ((uintptr_t)ofl->ofl_osverneed);
 }
 
@@ -1820,7 +1825,7 @@
  *  o	the SHT_SUNW_verdef section defines the versions that exist within this
  *	image.
  */
-uintptr_t
+static uintptr_t
 make_verdef(Ofl_desc *ofl)
 {
 	Shdr		*shdr;
@@ -1856,7 +1861,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1877,7 +1882,7 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	ofl->ofl_osverdef = place_section(ofl, isec, M_ID_VERSION, 0);
+	ofl->ofl_osverdef = ld_place_section(ofl, isec, M_ID_VERSION, 0);
 	return ((uintptr_t)ofl->ofl_osverdef);
 }
 
@@ -1886,7 +1891,7 @@
  * section and the SHT_SUNW_syminfo section.  Each of these sections
  * provides additional symbol information.
  */
-Os_desc *
+static Os_desc *
 make_sym_sec(Ofl_desc *ofl, const char *sectname, Word entsize,
     Word stype, int ident)
 {
@@ -1902,7 +1907,7 @@
 		return ((Os_desc *)S_ERROR);
 	data->d_type = ELF_T_BYTE;
 	data->d_align = M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1931,14 +1936,14 @@
 	isec->is_shdr = shdr;
 	isec->is_indata = data;
 
-	return (place_section(ofl, isec, ident, 0));
+	return (ld_place_section(ofl, isec, ident, 0));
 }
 
 /*
  * Build a .sunwbss section for allocation of tentative definitions.
  */
 uintptr_t
-make_sunwbss(Ofl_desc *ofl, size_t size, Xword align)
+ld_make_sunwbss(Ofl_desc *ofl, size_t size, Xword align)
 {
 	Shdr		*shdr;
 	Elf_Data	*data;
@@ -1952,7 +1957,7 @@
 	data->d_type = ELF_T_BYTE;
 	data->d_size = size;
 	data->d_align = align;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -1978,7 +1983,7 @@
 	 * symbol references are added.
 	 */
 	ofl->ofl_issunwbss = isec;
-	if (place_section(ofl, isec, 0, 0) == (Os_desc *)S_ERROR)
+	if (ld_place_section(ofl, isec, 0, 0) == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
 	return (1);
@@ -1988,7 +1993,7 @@
  * This routine is called when -z nopartial is in effect.
  */
 uintptr_t
-make_sunwdata(Ofl_desc *ofl, size_t size, Xword align)
+ld_make_sunwdata(Ofl_desc *ofl, size_t size, Xword align)
 {
 	Shdr		*shdr;
 	Elf_Data	*data;
@@ -2005,7 +2010,7 @@
 	if ((data->d_buf = libld_calloc(size, 1)) == 0)
 		return (S_ERROR);
 	data->d_align = (size_t)M_WORD_ALIGN;
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -2035,7 +2040,7 @@
 	 * symbol references are added.
 	 */
 	ofl->ofl_issunwdata1 = isec;
-	if ((osp = place_section(ofl, isec, M_ID_DATA, 0)) ==
+	if ((osp = ld_place_section(ofl, isec, M_ID_DATA, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -2050,7 +2055,7 @@
  * Make .sunwmove section
  */
 uintptr_t
-make_sunwmove(Ofl_desc *ofl, int mv_nums)
+ld_make_sunwmove(Ofl_desc *ofl, int mv_nums)
 {
 	Shdr		*shdr;
 	Elf_Data	*data;
@@ -2075,7 +2080,7 @@
 		return (S_ERROR);
 	data->d_size = size;
 	data->d_align = sizeof (Lword);
-	data->d_version = ofl->ofl_libver;
+	data->d_version = ofl->ofl_dehdr->e_version;
 
 	/*
 	 * Allocate and initialize the Shdr structure.
@@ -2116,7 +2121,7 @@
 			cnt++;
 		}
 	}
-	if ((ofl->ofl_osmove = place_section(ofl, isec, 0, 0)) ==
+	if ((ofl->ofl_osmove = ld_place_section(ofl, isec, 0, 0)) ==
 	    (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
@@ -2132,7 +2137,7 @@
  * individual routines can compensate for later, known, additions.
  */
 uintptr_t
-make_sections(Ofl_desc *ofl)
+ld_make_sections(Ofl_desc *ofl)
 {
 	Word		flags = ofl->ofl_flags;
 	Listnode	*lnp1;
@@ -2178,7 +2183,7 @@
 	 * -Dunused a diagnostic for any unused components is generated, under
 	 * -zignore the component is removed from the final output.
 	 */
-	if (dbg_mask || (ofl->ofl_flags1 & FLG_OF1_IGNPRC)) {
+	if (DBG_ENABLED || (ofl->ofl_flags1 & FLG_OF1_IGNPRC)) {
 		if (ignore_section_processing(ofl) == S_ERROR)
 			return (S_ERROR);
 	}
--- a/usr/src/cmd/sgs/libld/common/sunwmove.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/sunwmove.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,15 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -87,16 +87,16 @@
 	}
 
 	if (mv_nums != 0) {
-		if (make_sunwmove(ofl, mv_nums) == S_ERROR)
+		if (ld_make_sunwmove(ofl, mv_nums) == S_ERROR)
 			return (S_ERROR);
 	}
 
 	/*
-	 * Generate the .sunwbss section now
-	 * that we know its size and alignment.
+	 * Generate the .sunwbss section now that we know its size and
+	 * alignment.
 	 */
 	if (size_sunwbss) {
-		if (make_sunwbss(ofl, size_sunwbss,
+		if (ld_make_sunwbss(ofl, size_sunwbss,
 		    align_sunwbss) == S_ERROR)
 			return (S_ERROR);
 	}
@@ -109,7 +109,7 @@
 	 */
 	if (size_sunwdata1) {
 		/* LINTED */
-		if (make_sunwdata(ofl, size_sunwdata1,
+		if (ld_make_sunwdata(ofl, size_sunwdata1,
 		    align_sunwdata1) == S_ERROR)
 			return (S_ERROR);
 	}
@@ -121,7 +121,7 @@
  * psymp.
  */
 static uintptr_t
-insert_mvitm(Psym_info *psymp, Mv_itm *itm)
+insert_mvitm(Ofl_desc *ofl, Psym_info *psymp, Mv_itm *itm)
 {
 	Listnode *	lnpc, *lnpp, *new;
 	Mv_itm *	mvp;
@@ -166,7 +166,8 @@
 
 		if ((itm->mv_start == mvp->mv_start) ||
 		    (small->mv_start + small->mv_length > large->mv_start)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_OVERLAP),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_PSYM_OVERLAP),
 			    psymp->psym_symd->sd_file->ifl_name,
 			    itm->mv_isp->is_name,
 			    demangle(psymp->psym_symd->sd_name));
@@ -216,7 +217,7 @@
  *	If overlapping occurs, mark it at psymp->psym_flags
  */
 static uintptr_t
-install_mv(Psym_info *psymp, Move *mv, Is_desc *isp)
+install_mv(Ofl_desc *ofl, Psym_info *psymp, Move *mv, Is_desc *isp)
 {
 	Mv_itm *	mvitmp;
 	int 		cnt = mv->m_repeat;
@@ -238,7 +239,7 @@
 		/*
 		 * Insert the item
 		 */
-		if (insert_mvitm(psymp, mvitmp) == S_ERROR)
+		if (insert_mvitm(ofl, psymp, mvitmp) == S_ERROR)
 			return (S_ERROR);
 		mvitmp++;
 	}
@@ -363,7 +364,7 @@
  *
  */
 uintptr_t
-sunwmove_preprocess(Ofl_desc *ofl)
+ld_sunwmove_preprocess(Ofl_desc *ofl)
 {
 	Listnode *	lnp;
 	Is_desc *	isp;
@@ -376,11 +377,12 @@
 		Ifl_desc *	ifile = isp->is_file;
 		Xword		i, num;
 
-		DBG_CALL(Dbg_move_input1(ifile->ifl_name));
+		DBG_CALL(Dbg_move_input(ofl->ofl_lml, ifile->ifl_name));
 		mv = (Move *) isp->is_indata->d_buf;
 
 		if (isp->is_shdr->sh_entsize == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHENTSIZE),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_INVSHENTSIZE),
 			    isp->is_file->ifl_name, isp->is_name, EC_XWORD(0));
 			return (S_ERROR);
 		}
@@ -390,19 +392,23 @@
 
 			if ((ndx >= (Xword) isp->is_file->ifl_symscnt) ||
 			    (ndx == 0)) {
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMINFO1),
-				isp->is_file->ifl_name, isp->is_name, i,
-				EC_XWORD(mv->m_info));
-			    return (S_ERROR);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_PSYM_INVMINFO1),
+				    isp->is_file->ifl_name, isp->is_name, i,
+				    EC_XWORD(mv->m_info));
+				return (S_ERROR);
 			}
 			if (mv->m_repeat == 0) {
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMREPEAT),
-				isp->is_file->ifl_name, isp->is_name, i,
-				EC_XWORD(mv->m_repeat));
-			    return (S_ERROR);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_PSYM_INVMREPEAT),
+				    isp->is_file->ifl_name, isp->is_name, i,
+				    EC_XWORD(mv->m_repeat));
+				return (S_ERROR);
 			}
+
 			sdp = isp->is_file->ifl_oldndx[ndx];
-			DBG_CALL(Dbg_move_mventry(0, mv, sdp));
+			DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0, mv, sdp));
+
 			/*
 			 * Check if this entry has a valid size of not
 			 */
@@ -411,24 +417,24 @@
 			case 1: case 2: case 4: case 8:
 				break;
 			default:
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMINFO2),
-				isp->is_file->ifl_name, isp->is_name, i,
-				EC_XWORD(mv->m_info));
-			    return (S_ERROR);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_PSYM_INVMINFO2),
+				    isp->is_file->ifl_name, isp->is_name, i,
+				    EC_XWORD(mv->m_info));
+				return (S_ERROR);
 			}
 
 			/*
-			 * If this is a global symbol, adjust the visibility
+			 * If this is a global symbol, adjust the visibility.
 			 */
 			if (sdp->sd_aux &&
 			    ((sdp->sd_flags & FLG_SY_VISIBLE) == 0))
-				sym_adjust_vis(sdp, ofl);
+				ld_sym_adjust_vis(sdp, ofl);
 
 			if (sdp->sd_psyminfo == (Psym_info *)NULL) {
 				/*
-				 * Mark the symbol as partial
-				 * and intall the symbol in
-				 * partial symbol list.
+				 * Mark the symbol as partial, and install the
+				 * symbol in the partial symbol list.
 				 */
 				if ((psym =
 				    libld_calloc(sizeof (Psym_info), 1)) == 0)
@@ -437,9 +443,9 @@
 				sdp->sd_psyminfo = psym;
 
 				/*
-				 * Even if the -zredlocsym is in effect,
-				 * the local symbol used for partial
-				 * initialization will be kept.
+				 * Even if the -zredlocsym is in effect, the
+				 * local symbol used for partial initialization
+				 * is kept.
 				 */
 				if ((ofl->ofl_flags1 & FLG_OF1_REDLSYM) &&
 				    (ELF_ST_BIND(sdp->sd_sym->st_info) ==
@@ -485,7 +491,7 @@
 			} else
 				psym = sdp->sd_psyminfo;
 
-			if (install_mv(psym, mv, isp) == S_ERROR)
+			if (install_mv(ofl, psym, mv, isp) == S_ERROR)
 				return (S_ERROR);
 			if ((psym->psym_flag & FLG_PSYM_OVERLAP) != 0)
 				errcnt++;
@@ -525,7 +531,7 @@
 				if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
 				    STT_SECTION) {
 					errcnt++;
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_PSYM_CANNOTEXPND),
 					    psym->psym_symd->sd_file->ifl_name,
 					    isp->is_name, i,
@@ -536,7 +542,7 @@
 			} else if ((ofl->ofl_flags1 & FLG_OF1_NOPARTI) != 0) {
 				if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
 				    STT_SECTION) {
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_PSYM_CANNOTEXPND),
 					    psym->psym_symd->sd_file->ifl_name,
 					    isp->is_name, i,
--- a/usr/src/cmd/sgs/libld/common/support.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/support.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,22 +18,22 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
+
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdio.h>
 #include	<dlfcn.h>
 #include	<libelf.h>
 #include	<link.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
-
-
 /*
  * Table which defines the default functions to be called by the library
  * SUPPORT (-S <libname>).  These functions can be redefined by the
@@ -43,13 +42,13 @@
 static Support_list support[LDS_NUM] = {
 	{MSG_ORIG(MSG_SUP_VERSION),	{ 0, 0 }},	/* LDS_VERSION */
 	{MSG_ORIG(MSG_SUP_INPUT_DONE),	{ 0, 0 }},	/* LDS_INPUT_DONE */
-#ifdef _ELF64
+#if	defined(_ELF64)
 	{MSG_ORIG(MSG_SUP_START_64),	{ 0, 0 }},	/* LDS_START64 */
 	{MSG_ORIG(MSG_SUP_ATEXIT_64),	{ 0, 0 }},	/* LDS_ATEXIT64 */
 	{MSG_ORIG(MSG_SUP_FILE_64),	{ 0, 0 }},	/* LDS_FILE64 */
 	{MSG_ORIG(MSG_SUP_INP_SECTION_64), { 0, 0 }},	/* LDS_INP_SECTION64 */
 	{MSG_ORIG(MSG_SUP_SECTION_64),	{ 0, 0 }}	/* LDS_SECTION64 */
-#else  /* Elf32 */
+#else	/* Elf32 */
 	{MSG_ORIG(MSG_SUP_START),	{ 0, 0 }},	/* LDS_START */
 	{MSG_ORIG(MSG_SUP_ATEXIT),	{ 0, 0 }},	/* LDS_ATEXIT */
 	{MSG_ORIG(MSG_SUP_FILE),	{ 0, 0 }},	/* LDS_FILE */
@@ -62,13 +61,9 @@
  * Loads in a support shared object specified using the SGS_SUPPORT environment
  * variable or the -S ld option, and determines which interface functions are
  * provided by that object.
- *
- * return values for ld_support_loadso:
- *	1 -	shared object loaded sucessfully
- *	S_ERROR - aww, damn!
  */
 uintptr_t
-ld_support_loadso(const char *obj)
+ld_sup_loadso(Ofl_desc *ofl, const char *obj)
 {
 	void		*handle;
 	void		(*fptr)();
@@ -81,7 +76,8 @@
 	 * with a fatal error.
 	 */
 	if ((handle = dlopen(obj, RTLD_LAZY)) == NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SUP_NOLOAD), obj, dlerror());
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SUP_NOLOAD),
+		    obj, dlerror());
 		return (S_ERROR);
 	}
 
@@ -89,25 +85,25 @@
 	for (i = 0; i < LDS_NUM; i++) {
 		if (fptr = (void (*)())dlsym(handle, support[i].sup_name)) {
 
-			if ((flp = (Func_list *)
-			    libld_malloc(sizeof (Func_list))) == NULL)
+			if ((flp = libld_malloc(sizeof (Func_list))) == NULL)
 				return (S_ERROR);
 
 			flp->fl_obj = obj;
 			flp->fl_fptr = fptr;
-			DBG_CALL(Dbg_support_load(obj, support[i].sup_name));
+			DBG_CALL(Dbg_support_load(ofl->ofl_lml, obj,
+			    support[i].sup_name));
+
 			if (i == LDS_VERSION) {
-				DBG_CALL(Dbg_support_action(flp->fl_obj,
-				    support[LDS_VERSION].sup_name,
+				DBG_CALL(Dbg_support_action(ofl->ofl_lml,
+				    flp->fl_obj, support[LDS_VERSION].sup_name,
 				    LDS_VERSION, 0));
 				ver_level = ((uint_t(*)())
 				    flp->fl_fptr)(LD_SUP_VCURRENT);
 				if ((ver_level == LD_SUP_VNONE) ||
 				    (ver_level > LD_SUP_VCURRENT)) {
-					eprintf(ERR_FATAL,
-						MSG_INTL(MSG_SUP_BADVERSION),
-						LD_SUP_VCURRENT,
-						ver_level);
+					eprintf(ofl->ofl_lml, ERR_FATAL,
+					    MSG_INTL(MSG_SUP_BADVERSION),
+					    LD_SUP_VCURRENT, ver_level);
 					(void) dlclose(handle);
 					return (S_ERROR);
 				}
@@ -121,40 +117,38 @@
 	return (1);
 }
 
-
 /*
  * Wrapper routines for the ld support library calls.
  */
 void
-lds_start(const char *ofile, const Half etype, const char *caller)
+ld_sup_start(Ofl_desc *ofl, const Half etype, const char *caller)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
 
 	for (LIST_TRAVERSE(&support[LDS_START].sup_funcs, lnp, flp)) {
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
-		    support[LDS_START].sup_name, LDS_START, ofile));
-		(*flp->fl_fptr)(ofile, etype, caller);
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
+		    support[LDS_START].sup_name, LDS_START, ofl->ofl_name));
+		(*flp->fl_fptr)(ofl->ofl_name, etype, caller);
 	}
 }
 
-
 void
-lds_atexit(int exit_code)
+ld_sup_atexit(Ofl_desc *ofl, int ecode)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
 
 	for (LIST_TRAVERSE(&support[LDS_ATEXIT].sup_funcs, lnp, flp)) {
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
 		    support[LDS_ATEXIT].sup_name, LDS_ATEXIT, 0));
-		(*flp->fl_fptr)(exit_code);
+		(*flp->fl_fptr)(ecode);
 	}
 }
 
-
 void
-lds_file(const char *ifile, const Elf_Kind ekind, int flags, Elf *elf)
+ld_sup_file(Ofl_desc *ofl, const char *ifile, const Elf_Kind ekind, int flags,
+    Elf *elf)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
@@ -169,15 +163,15 @@
 		if (flags & FLG_IF_EXTRACT)
 			_flags |= LD_SUP_EXTRACTED;
 
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
 		    support[LDS_FILE].sup_name, LDS_FILE, ifile));
 		(*flp->fl_fptr)(ifile, ekind, _flags, elf);
 	}
 }
 
 uintptr_t
-lds_input_section(const char *scnname, Shdr **shdr, Word ndx,
-    const char *file, Elf_Scn *scn, Elf *elf, Ofl_desc *ofl)
+ld_sup_input_section(Ofl_desc * ofl, const char *scnname, Shdr **shdr, Word ndx,
+    const char *file, Elf_Scn *scn, Elf *elf)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
@@ -186,21 +180,20 @@
 
 	for (LIST_TRAVERSE(&support[LDS_INP_SECTION].sup_funcs, lnp, flp)) {
 		/*
-		 * This interface was introduced in VERSION2 - so only
-		 * call it for libraries reporting support for
-		 * version 2 or above.
+		 * This interface was introduced in VERSION2 - so only call it
+		 * for libraries reporting support for * version 2 or above.
 		 */
 		if (flp->fl_version < LD_SUP_VERSION2)
 			continue;
 		if ((data == NULL) &&
 		    ((data = elf_getdata(scn, NULL)) == NULL)) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA),
-				file);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETDATA), file);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (S_ERROR);
 		}
 
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
 		    support[LDS_INP_SECTION].sup_name, LDS_INP_SECTION,
 		    scnname));
 		(*flp->fl_fptr)(scnname, shdr, ndx, data, elf, &flags);
@@ -209,21 +202,21 @@
 }
 
 void
-lds_section(const char *scn, Shdr *shdr, Word ndx,
+ld_sup_section(Ofl_desc *ofl, const char *scn, Shdr *shdr, Word ndx,
     Elf_Data *data, Elf *elf)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
 
 	for (LIST_TRAVERSE(&support[LDS_SECTION].sup_funcs, lnp, flp)) {
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
 		    support[LDS_SECTION].sup_name, LDS_SECTION, scn));
 		(*flp->fl_fptr)(scn, shdr, ndx, data, elf);
 	}
 }
 
 void
-lds_input_done(void)
+ld_sup_input_done(Ofl_desc *ofl)
 {
 	Func_list	*flp;
 	Listnode	*lnp;
@@ -231,13 +224,12 @@
 
 	for (LIST_TRAVERSE(&support[LDS_INPUT_DONE].sup_funcs, lnp, flp)) {
 		/*
-		 * This interface was introduced in VERSION2 - so only
-		 * call it for libraries reporting support for
-		 * version 2 or above.
+		 * This interface was introduced in VERSION2 - so only call it
+		 * for libraries reporting support for version 2 or above.
 		 */
 		if (flp->fl_version < LD_SUP_VERSION2)
 			continue;
-		DBG_CALL(Dbg_support_action(flp->fl_obj,
+		DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj,
 		    support[LDS_INPUT_DONE].sup_name, LDS_INPUT_DONE, 0));
 		(*flp->fl_fptr)(&flags);
 	}
--- a/usr/src/cmd/sgs/libld/common/syms.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/syms.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,7 +34,7 @@
  */
 #include	<stdio.h>
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -45,7 +45,7 @@
  *	key of the symbol name itself.
  */
 int
-sym_avl_comp(const void *elem1, const void *elem2)
+ld_sym_avl_comp(const void *elem1, const void *elem2)
 {
 	int	res;
 	Sym_avlnode	*sav1 = (Sym_avlnode *)elem1;
@@ -73,22 +73,25 @@
 /*
  * Focal point for verifying symbol names.
  */
-const char *
-string(Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, int symndx,
-    Word shndx, const char *symsecname, const char *strsecname, Word * flags)
+static const char *
+string(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize,
+    int symndx, Word shndx, const char *symsecname, const char *strsecname,
+    Word *flags)
 {
 	const char	*regname;
 	Word		name = sym->st_name;
 
 	if (name) {
 		if ((ifl->ifl_flags & FLG_IF_HSTRTAB) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_NOSTRTABLE),
-			    ifl->ifl_name, symsecname, symndx, EC_XWORD(name));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_NOSTRTABLE), ifl->ifl_name,
+			    symsecname, symndx, EC_XWORD(name));
 			return (0);
 		}
 		if (name >= (Word)strsize) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_EXCSTRTABLE),
-			    ifl->ifl_name, symsecname, symndx, EC_XWORD(name),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_EXCSTRTABLE), ifl->ifl_name,
+			    symsecname, symndx, EC_XWORD(name),
 			    strsecname, EC_XWORD(strsize));
 			return (0);
 		}
@@ -98,7 +101,7 @@
 	 * Determine if we're dealing with a register and if so validate it.
 	 * If it's a scratch register, a fabricated name will be returned.
 	 */
-	if ((regname = is_regsym(ifl, sym, strs, symndx, shndx,
+	if ((regname = ld_is_regsym(ofl, ifl, sym, strs, symndx, shndx,
 	    symsecname, flags)) == (const char *)S_ERROR) {
 		return (0);
 	}
@@ -114,7 +117,7 @@
 	 * world and hasn't, as yet, been a problem.
 	 */
 	if ((name == 0) && (ELF_ST_BIND(sym->st_info) != STB_LOCAL)) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NONAMESYM),
+		eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_NONAMESYM),
 		    ifl->ifl_name, symsecname, symndx, EC_XWORD(name));
 	}
 	return (strs + name);
@@ -128,7 +131,7 @@
  * referenced, mark it so that we don't directly bind to it.
  */
 uintptr_t
-sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl)
+ld_sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl)
 {
 	Shdr		*sifshdr, *symshdr;
 	Syminfo		*sifdata;
@@ -170,7 +173,7 @@
 		sym = (Sym *)(symdata + _cnt);
 		str = (char *)(strdata + sym->st_name);
 
-		if (sdp = sym_find(str, SYM_NOHASH, 0, ofl)) {
+		if (sdp = ld_sym_find(str, SYM_NOHASH, 0, ofl)) {
 			if (ifl != sdp->sd_file)
 				continue;
 
@@ -195,7 +198,7 @@
  * of reference and hence performance, and thus this copying is not necessary.
  */
 uintptr_t
-sym_copy(Sym_desc *sdp)
+ld_sym_copy(Sym_desc *sdp)
 {
 	Sym	*nsym;
 
@@ -215,7 +218,7 @@
  * Sym_desc entry is returned, or NULL if the symbol is not found.
  */
 Sym_desc *
-sym_find(const char *name, Word hash, avl_index_t *where, Ofl_desc *ofl)
+ld_sym_find(const char *name, Word hash, avl_index_t *where, Ofl_desc *ofl)
 {
 	Sym_avlnode	qsav;
 	Sym_avlnode	*sav;
@@ -253,8 +256,9 @@
  * has been internally generated (ie. _etext, _edata, etc.).
  */
 Sym_desc *
-sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl,
-    Word ndx, Word shndx, Word sdflags, Half sdflags1, avl_index_t *where)
+ld_sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl,
+    Ofl_desc *ofl, Word ndx, Word shndx, Word sdflags, Half sdflags1,
+    avl_index_t *where)
 {
 	Sym_desc	*sdp;
 	Sym_aux		*sap;
@@ -262,7 +266,6 @@
 	char		*_name;
 	Sym		*nsym;
 	Half		etype;
-	Ehdr		*ehdr;
 	avl_index_t	_where;
 
 	/*
@@ -312,7 +315,7 @@
 		/* LINTED */
 		Sym_avlnode	*_savl;
 		/*
-		 * If a previous sym_find() hasn't initialized 'where' do it
+		 * If a previous ld_sym_find() hasn't initialized 'where' do it
 		 * now.
 		 */
 		where = &_where;
@@ -340,8 +343,9 @@
 		 * out as many error conditions as possible.
 		 */
 		if ((etype == ET_REL) && (sdp->sd_isc == 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INVSEC), name,
-			    ifl->ifl_name, EC_XWORD(shndx));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_INVSEC), name, ifl->ifl_name,
+			    EC_XWORD(shndx));
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (sdp);
 		}
@@ -480,7 +484,7 @@
 			 * promoted to the versioning of the output file.
 			 */
 			if (ifl->ifl_versym)
-				vers_promote(sdp, ndx, ifl, ofl);
+				ld_vers_promote(sdp, ndx, ifl, ofl);
 		}
 
 		if ((ofl->ofl_flags & FLG_OF_GENMAP) &&
@@ -489,12 +493,7 @@
 				return ((Sym_desc *)S_ERROR);
 	}
 
-	if (sdp->sd_file)
-		ehdr = sdp->sd_file->ifl_ehdr;
-	else
-		ehdr = &def_ehdr;
-	DBG_CALL(Dbg_syms_entered(ehdr, nsym, sdp));
-
+	DBG_CALL(Dbg_syms_entered(ofl, nsym, sdp));
 	return (sdp);
 }
 
@@ -531,7 +530,7 @@
 
 	/* LINTED */
 	hash = (Word)elf_hash(uname);
-	if (usdp = sym_find(uname, hash, &where, ofl)) {
+	if (usdp = ld_sym_find(uname, hash, &where, ofl)) {
 		/*
 		 * If the underscore symbol exists and is undefined, or was
 		 * defined in a shared library, convert it to a local symbol.
@@ -570,10 +569,10 @@
 			if (usdp->sd_flags & FLG_SY_MAPREF)
 				usdp->sd_flags |= FLG_SY_MAPUSED;
 
-			DBG_CALL(Dbg_syms_updated((ofl->ofl_ehdr) ?
-			    ofl->ofl_ehdr : &def_ehdr, usdp, uname));
+			DBG_CALL(Dbg_syms_updated(ofl, usdp, uname));
 		} else
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_RESERVE), uname,
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_RESERVE), uname,
 			    usdp->sd_file->ifl_name);
 	} else {
 		/*
@@ -585,8 +584,8 @@
 		sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
 		sym->st_size = 0;
 		sym->st_value = 0;
-		DBG_CALL(Dbg_syms_created(uname));
-		if ((usdp = sym_enter(uname, sym, hash, (Ifl_desc *)NULL,
+		DBG_CALL(Dbg_syms_created(ofl->ofl_lml, uname));
+		if ((usdp = ld_sym_enter(uname, sym, hash, (Ifl_desc *)NULL,
 		    ofl, 0, SHN_ABS, FLG_SY_SPECSEC, 0, &where)) ==
 		    (Sym_desc *)S_ERROR)
 			return (S_ERROR);
@@ -600,7 +599,7 @@
 		usdp->sd_flags1 |= flags1;
 	}
 
-	if (name && (sdp = sym_find(name, SYM_NOHASH, 0, ofl)) &&
+	if (name && (sdp = ld_sym_find(name, SYM_NOHASH, 0, ofl)) &&
 	    (sdp->sd_shndx == SHN_UNDEF)) {
 		uchar_t	bind;
 
@@ -646,8 +645,7 @@
 		if (sdp->sd_flags & FLG_SY_MAPREF)
 			sdp->sd_flags |= FLG_SY_MAPUSED;
 
-		DBG_CALL(Dbg_syms_updated((ofl->ofl_ehdr) ? ofl->ofl_ehdr :
-		    &def_ehdr, sdp, name));
+		DBG_CALL(Dbg_syms_updated(ofl, sdp, name));
 	}
 	return (1);
 }
@@ -658,10 +656,10 @@
  */
 static Boolean	undef_title = TRUE;
 
-void
-sym_undef_title()
+static void
+sym_undef_title(Ofl_desc *ofl)
 {
-	eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FMT_UNDEF),
+	eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FMT_UNDEF),
 		MSG_INTL(MSG_SYM_UNDEF_ITM_11),
 		MSG_INTL(MSG_SYM_UNDEF_ITM_21),
 		MSG_INTL(MSG_SYM_UNDEF_ITM_12),
@@ -702,15 +700,15 @@
 	MSG_SYM_UND_BNDLOCAL		/* MSG_INTL(MSG_SYM_UND_BNDLOCAL) */
 };
 
-void
-sym_undef_entry(Sym_desc *sdp, Type type)
+static void
+sym_undef_entry(Ofl_desc *ofl, Sym_desc *sdp, Type type)
 {
 	const char	*name1, *name2, *name3;
 	Ifl_desc	*ifl = sdp->sd_file;
 	Sym_aux		*sap = sdp->sd_aux;
 
 	if (undef_title)
-		sym_undef_title();
+		sym_undef_title(ofl);
 
 	switch (type) {
 	case UNDEF:
@@ -733,8 +731,8 @@
 		return;
 	}
 
-	eprintf(ERR_NONE, MSG_INTL(format[type]), demangle(sdp->sd_name),
-	    name1, name2, name3);
+	eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(format[type]),
+	    demangle(sdp->sd_name), name1, name2, name3);
 }
 
 /*
@@ -743,13 +741,13 @@
  * symbols.
  */
 uintptr_t
-sym_spec(Ofl_desc *ofl)
+ld_sym_spec(Ofl_desc *ofl)
 {
 	Word		flags = ofl->ofl_flags;
 
 	if (!(flags & FLG_OF_RELOBJ)) {
 
-		DBG_CALL(Dbg_syms_spec_title());
+		DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml));
 
 		if (sym_add_spec(MSG_ORIG(MSG_SYM_ETEXT),
 		    MSG_ORIG(MSG_SYM_ETEXT_U), SDAUX_ID_ETEXT,
@@ -788,7 +786,7 @@
 			    FLG_SY1_GLOB, ofl) == S_ERROR)
 				return (S_ERROR);
 
-		if (sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl))
+		if (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl))
 			if (sym_add_spec(MSG_ORIG(MSG_SYM_GOFTBL),
 			    MSG_ORIG(MSG_SYM_GOFTBL_U), SDAUX_ID_GOT,
 			    FLG_SY1_GLOB, ofl) == S_ERROR)
@@ -803,7 +801,7 @@
  * reloc_init() or sym_validate().
  */
 void
-sym_adjust_vis(Sym_desc *sdp, Ofl_desc *ofl)
+ld_sym_adjust_vis(Sym_desc *sdp, Ofl_desc *ofl)
 {
 	Word	symvis, oflags = ofl->ofl_flags, oflags1 = ofl->ofl_flags1;
 	Sym	*sym = sdp->sd_sym;
@@ -895,7 +893,7 @@
  *		first symbol that it will contain).
  */
 uintptr_t
-sym_validate(Ofl_desc *ofl)
+ld_sym_validate(Ofl_desc *ofl)
 {
 	Sym_avlnode	*sav;
 	Sym_desc	*sdp;
@@ -984,7 +982,8 @@
 
 			if ((isp == 0) || (isp->is_shdr == 0) ||
 			    ((isp->is_shdr->sh_flags & SHF_TLS) == 0)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_TLS),
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_SYM_TLS),
 				    demangle(sdp->sd_name), ifl->ifl_name);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				continue;
@@ -992,13 +991,12 @@
 		}
 
 		if ((sdp->sd_flags & FLG_SY_VISIBLE) == 0)
-			sym_adjust_vis(sdp, ofl);
+			ld_sym_adjust_vis(sdp, ofl);
 
 		if ((sdp->sd_flags & FLG_SY_REDUCED) &&
 		    (oflags & FLG_OF_PROCRED)) {
-			DBG_CALL(Dbg_syms_reduce(DBG_SYM_REDUCE_GLOBAL,
-			    (ofl->ofl_ehdr) ? ofl->ofl_ehdr :
-			    &def_ehdr, sdp, 0, 0));
+			DBG_CALL(Dbg_syms_reduce(ofl, DBG_SYM_REDUCE_GLOBAL,
+			    sdp, 0, 0));
 		}
 
 		/*
@@ -1009,7 +1007,7 @@
 		if (!(oflags & FLG_OF_RELOBJ) &&
 		    ELF_ST_VISIBILITY(sym->st_other) && (shndx == SHN_UNDEF) &&
 		    (ELF_ST_BIND(sym->st_info) != STB_WEAK)) {
-			sym_undef_entry(sdp, BNDLOCAL);
+			sym_undef_entry(ofl, sdp, BNDLOCAL);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
 		}
@@ -1070,7 +1068,7 @@
 			    FLG_SY_MAPREF) &&
 			    ((sdp->sd_flags1 & (FLG_SY1_LOCL |
 			    FLG_SY1_PROT)) == 0)))) {
-				sym_undef_entry(sdp, UNDEF);
+				sym_undef_entry(ofl, sdp, UNDEF);
 				ofl->ofl_flags |= undef;
 				undeferr = 1;
 			}
@@ -1089,7 +1087,7 @@
 			if ((sdp->sd_flags &
 			    (FLG_SY_MAPREF | FLG_SY_MAPUSED)) ==
 			    FLG_SY_MAPREF) {
-				sym_undef_entry(sdp, UNDEF);
+				sym_undef_entry(ofl, sdp, UNDEF);
 				ofl->ofl_flags |= FLG_OF_WARN;
 				undeferr = 1;
 			}
@@ -1123,7 +1121,7 @@
 				if (vip->vi_flags & FLG_VER_AVAIL) {
 					vip->vi_flags |= FLG_VER_REFER;
 				} else {
-					sym_undef_entry(sdp, NOTAVAIL);
+					sym_undef_entry(ofl, sdp, NOTAVAIL);
 					ofl->ofl_flags |= FLG_OF_FATAL;
 					continue;
 				}
@@ -1138,7 +1136,7 @@
 		if (needed && !undeferr && (sdp->sd_flags & FLG_SY_GLOBREF) &&
 		    (sdp->sd_ref == REF_DYN_NEED) &&
 		    (sdp->sd_flags & FLG_SY_NOTAVAIL)) {
-			sym_undef_entry(sdp, IMPLICIT);
+			sym_undef_entry(ofl, sdp, IMPLICIT);
 			ofl->ofl_flags |= needed;
 			continue;
 		}
@@ -1150,7 +1148,7 @@
 		 */
 		if ((sdp->sd_ref == REF_DYN_NEED) &&
 		    (sdp->sd_flags1 & (FLG_SY1_LOCL | FLG_SY1_PROT))) {
-			sym_undef_entry(sdp, BNDLOCAL);
+			sym_undef_entry(ofl, sdp, BNDLOCAL);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
 		}
@@ -1163,7 +1161,7 @@
 		    (shndx != SHN_UNDEF) &&
 		    (!(sdp->sd_flags1 & FLG_SY1_LOCL)) &&
 		    (sdp->sd_aux->sa_overndx == 0)) {
-			sym_undef_entry(sdp, NOVERSION);
+			sym_undef_entry(ofl, sdp, NOVERSION);
 			ofl->ofl_flags |= verdesc;
 			continue;
 		}
@@ -1346,16 +1344,16 @@
 	 * Generate the .bss section now that we know its size and alignment.
 	 */
 	if (bsssize || !(oflags & FLG_OF_RELOBJ)) {
-		if (make_bss(ofl, bsssize, bssalign, MAKE_BSS) == S_ERROR)
+		if (ld_make_bss(ofl, bsssize, bssalign, MAKE_BSS) == S_ERROR)
 			return (S_ERROR);
 	}
 	if (tlssize) {
-		if (make_bss(ofl, tlssize, tlsalign, MAKE_TLS) == S_ERROR)
+		if (ld_make_bss(ofl, tlssize, tlsalign, MAKE_TLS) == S_ERROR)
 			return (S_ERROR);
 	}
 #if	(defined(__i386) || defined(__amd64)) && defined(_ELF64)
 	if (lbsssize && !(oflags & FLG_OF_RELOBJ)) {
-		if (make_bss(ofl, lbsssize, lbssalign, MAKE_LBSS) == S_ERROR)
+		if (ld_make_bss(ofl, lbsssize, lbssalign, MAKE_LBSS) == S_ERROR)
 			return (S_ERROR);
 	}
 #endif
@@ -1368,9 +1366,10 @@
 	 * option first, or the default entry points `_start' and `main'.
 	 */
 	if (ofl->ofl_entry) {
-		if (((sdp = sym_find(ofl->ofl_entry, SYM_NOHASH, 0, ofl)) ==
+		if (((sdp = ld_sym_find(ofl->ofl_entry, SYM_NOHASH, 0, ofl)) ==
 		    NULL) || (sdp->sd_ref != REF_REL_NEED)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_ENTRY),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_ENTRY),
 			    demangle((char *)ofl->ofl_entry));
 			return (S_ERROR);
 		}
@@ -1380,7 +1379,7 @@
 			sdp->sd_isc->is_flags |= FLG_IS_SECTREF;
 			sdp->sd_isc->is_file->ifl_flags |= FLG_IF_FILEREF;
 		}
-	} else if (((sdp = sym_find(MSG_ORIG(MSG_SYM_START),
+	} else if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_START),
 	    SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED)) {
 		ofl->ofl_entry = (void *)sdp;
 		sdp->sd_flags |= FLG_SY_UPREQD;
@@ -1388,7 +1387,7 @@
 			sdp->sd_isc->is_flags |= FLG_IS_SECTREF;
 			sdp->sd_isc->is_file->ifl_flags |= FLG_IF_FILEREF;
 		}
-	} else if (((sdp = sym_find(MSG_ORIG(MSG_SYM_MAIN),
+	} else if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_MAIN),
 	    SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED)) {
 		ofl->ofl_entry = (void *)sdp;
 		sdp->sd_flags |= FLG_SY_UPREQD;
@@ -1405,8 +1404,9 @@
 	if ((sdp = ofl->ofl_dtracesym) != 0) {
 		if ((sdp->sd_ref != REF_REL_NEED) ||
 		    (sdp->sd_shndx == SHN_UNDEF)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DTRACE),
-				demangle((char *)sdp->sd_name));
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_SYM_DTRACE),
+			    demangle((char *)sdp->sd_name));
 			return (S_ERROR);
 		}
 		sdp->sd_flags |= FLG_SY_UPREQD;
@@ -1421,7 +1421,7 @@
 	 * information calculate it now that all symbols have been validated.
 	 */
 	if ((oflags & (FLG_OF_VERNEED | FLG_OF_NOVERSEC)) == FLG_OF_VERNEED)
-		return (vers_check_need(ofl));
+		return (ld_vers_check_need(ofl));
 	else
 		return (1);
 }
@@ -1488,7 +1488,7 @@
  *		resolution function is called upon to resolve the conflict.
  */
 uintptr_t
-sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
+ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	Sym		*sym = (Sym *)isc->is_indata->d_buf;
 	Word		*symshndx = 0;
@@ -1513,7 +1513,7 @@
 	if (isc->is_symshndx)
 		symshndx = isc->is_symshndx->is_indata->d_buf;
 
-	DBG_CALL(Dbg_syms_process(ifl));
+	DBG_CALL(Dbg_syms_process(ofl->ofl_lml, ifl));
 
 	if (isc->is_name)
 		symsecname = isc->is_name;
@@ -1527,7 +1527,8 @@
 	if (ifl->ifl_flags & FLG_IF_HSTRTAB) {
 		ndx = shdr->sh_link;
 		if ((ndx == 0) || (ndx >= ifl->ifl_shnum)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_FIL_INVSHLINK),
 			    ifl->ifl_name, symsecname, EC_XWORD(ndx));
 			return (S_ERROR);
 		}
@@ -1599,7 +1600,7 @@
 			/*
 			 * Check if st_name has a valid value or not.
 			 */
-			if ((name = string(ifl, sym, strs, strsize, ndx,
+			if ((name = string(ofl, ifl, sym, strs, strsize, ndx,
 			    shndx, symsecname, strsecname, &sdflags)) == 0) {
 				ofl->ofl_flags |= FLG_OF_FATAL;
 				continue;
@@ -1616,14 +1617,14 @@
 			 */
 			rsdp = sdp = 0;
 			if (sdflags & FLG_SY_REGSYM) {
-				if ((rsdp = reg_find(sym, ofl)) != 0) {
+				if ((rsdp = ld_reg_find(sym, ofl)) != 0) {
 					/*
 					 * The fact that another register def-
 					 * inition has been found is fatal.
 					 * Call the verification routine to get
 					 * the error message and move on.
 					 */
-					(void) reg_check(rsdp, sym, name,
+					(void) ld_reg_check(rsdp, sym, name,
 					    ifl, ofl);
 					continue;
 				}
@@ -1653,7 +1654,7 @@
 				ifl->ifl_oldndx[ndx] = sdp;
 			}
 
-			DBG_CALL(Dbg_syms_entry(ndx, sdp));
+			DBG_CALL(Dbg_syms_entry(ofl->ofl_lml, ndx, sdp));
 
 			/*
 			 * Reclassify any SHN_SUNW_IGNORE symbols to SHN_UNDEF
@@ -1674,14 +1675,14 @@
 				 * register symbol, as this can be useful if a
 				 * register conflict is later discovered.
 				 */
-				DBG_CALL(Dbg_syms_entered(ifl->ifl_ehdr,
-				    sym, sdp));
+				DBG_CALL(Dbg_syms_entered(ofl, sym, sdp));
 
 				/*
 				 * If this register symbol hasn't already been
 				 * recorded, enter it now.
 				 */
-				if ((rsdp == 0) && (reg_enter(sdp, ofl) == 0))
+				if ((rsdp == 0) &&
+				    (ld_reg_enter(sdp, ofl) == 0))
 					return (S_ERROR);
 			}
 
@@ -1700,7 +1701,8 @@
 			if (sdp->sd_isc &&
 			    (sdp->sd_isc->is_flags & FLG_IS_DISCARD)) {
 				sdp->sd_flags |= FLG_SY_ISDISC;
-				DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc));
+				DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml,
+				    sdp, sdp->sd_isc));
 				continue;
 			}
 
@@ -1710,11 +1712,11 @@
 			 */
 			if ((type = ELF_ST_TYPE(sym->st_info)) == STT_SECTION) {
 				if (shndx == SHN_UNDEF) {
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_SYM_INVSHNDX),
 					    demangle(sdp->sd_name),
 					    ifl->ifl_name,
-					    conv_shndx_str(shndx));
+					    conv_sym_shndx(shndx));
 				}
 				continue;
 			}
@@ -1728,7 +1730,7 @@
 
 				if ((isp == 0) || (isp->is_shdr == 0) ||
 				    ((isp->is_shdr->sh_flags & SHF_TLS) == 0)) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_SYM_TLS),
 					    demangle(sdp->sd_name),
 					    ifl->ifl_name);
@@ -1749,9 +1751,10 @@
 			    ((shndx == SHN_COMMON)) ||
 			    ((type == STT_FILE) && (shndx != SHN_ABS))) ||
 			    (sdp->sd_isc && (sdp->sd_isc->is_osdesc == 0))) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_SYM_INVSHNDX),
 				    demangle(sdp->sd_name), ifl->ifl_name,
-				    conv_shndx_str(shndx));
+				    conv_sym_shndx(shndx));
 				sdp->sd_isc = NULL;
 				sdp->sd_flags |= FLG_SY_INVALID;
 				continue;
@@ -1800,7 +1803,7 @@
 		/*
 		 * Check if st_name has a valid value or not.
 		 */
-		if ((name = string(ifl, sym, strs, strsize, ndx, shndx,
+		if ((name = string(ofl, ifl, sym, strs, strsize, ndx, shndx,
 		    symsecname, strsecname, &sdflags)) == 0) {
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
@@ -1832,9 +1835,9 @@
 		 */
 		bind = ELF_ST_BIND(sym->st_info);
 		if ((bind != STB_GLOBAL) && (bind != STB_WEAK)) {
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_NONGLOB),
-			    demangle(name), ifl->ifl_name,
-			    conv_info_bind_str(bind));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_SYM_NONGLOB), demangle(name),
+			    ifl->ifl_name, conv_sym_info_bind(bind));
 			continue;
 		}
 
@@ -1853,9 +1856,9 @@
 				 * the output file, which won't be a problem
 				 * unless a relocation is required against it.
 				 */
-				eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX),
-				    demangle(name), ifl->ifl_name,
-				    conv_shndx_str(shndx));
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_SYM_INVSHNDX), demangle(name),
+				    ifl->ifl_name, conv_sym_shndx(shndx));
 				continue;
 			}
 
@@ -1877,7 +1880,8 @@
 				sdp->sd_flags = FLG_SY_ISDISC;
 				ifl->ifl_oldndx[ndx] = sdp;
 
-				DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc));
+				DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, sdp,
+				    sdp->sd_isc));
 				continue;
 			}
 		}
@@ -1890,13 +1894,13 @@
 		 */
 		/* LINTED */
 		hash = (Word)elf_hash((const char *)name);
-		if ((sdp = sym_find(name, hash, &where, ofl)) == NULL) {
-			DBG_CALL(Dbg_syms_global(ndx, name));
-			if ((sdp = sym_enter(name, sym, hash, ifl, ofl, ndx,
+		if ((sdp = ld_sym_find(name, hash, &where, ofl)) == NULL) {
+			DBG_CALL(Dbg_syms_global(ofl->ofl_lml, ndx, name));
+			if ((sdp = ld_sym_enter(name, sym, hash, ifl, ofl, ndx,
 			    shndx, sdflags, 0, &where)) == (Sym_desc *)S_ERROR)
 				return (S_ERROR);
 
-		} else if (sym_resolve(sdp, sym, ifl, ofl, ndx, shndx,
+		} else if (ld_sym_resolve(sdp, sym, ifl, ofl, ndx, shndx,
 		    sdflags) == S_ERROR)
 			return (S_ERROR);
 
@@ -1924,11 +1928,11 @@
 		if (sdp->sd_flags & FLG_SY_REGSYM) {
 			Sym_desc	*rsdp;
 
-			if ((rsdp = reg_find(sdp->sd_sym, ofl)) == 0) {
-				if (reg_enter(sdp, ofl) == 0)
+			if ((rsdp = ld_reg_find(sdp->sd_sym, ofl)) == 0) {
+				if (ld_reg_enter(sdp, ofl) == 0)
 					return (S_ERROR);
 			} else if (rsdp != sdp) {
-				(void) reg_check(rsdp, sdp->sd_sym,
+				(void) ld_reg_check(rsdp, sdp->sd_sym,
 				    sdp->sd_name, ifl, ofl);
 			}
 		}
@@ -2025,7 +2029,7 @@
  * Add an undefined symbol to the symbol table (ie. from -u name option)
  */
 Sym_desc *
-sym_add_u(const char *name, Ofl_desc *ofl)
+ld_sym_add_u(const char *name, Ofl_desc *ofl)
 {
 	Sym		*sym;
 	Ifl_desc	*ifl = 0, *_ifl;
@@ -2041,7 +2045,7 @@
 	 */
 	/* LINTED */
 	hash = (Word)elf_hash(name);
-	if (sdp = sym_find(name, hash, &where, ofl)) {
+	if (sdp = ld_sym_find(name, hash, &where, ofl)) {
 		if (sdp->sd_ref == REF_DYN_SEEN)
 			sdp->sd_ref = REF_DYN_NEED;
 		return (sdp);
@@ -2085,9 +2089,10 @@
 	sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
 	sym->st_shndx = SHN_UNDEF;
 
-	DBG_CALL(Dbg_syms_process(ifl));
-	DBG_CALL(Dbg_syms_global(0, name));
-	sdp = sym_enter(name, sym, hash, ifl, ofl, 0, SHN_UNDEF, 0, 0, &where);
+	DBG_CALL(Dbg_syms_process(ofl->ofl_lml, ifl));
+	DBG_CALL(Dbg_syms_global(ofl->ofl_lml, 0, name));
+	sdp = ld_sym_enter(name, sym, hash, ifl, ofl, 0, SHN_UNDEF,
+	    0, 0, &where);
 	sdp->sd_flags &= ~FLG_SY_CLEAN;
 	sdp->sd_flags |= FLG_SY_CMDREF;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/libld/common/unwind.amd.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,706 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<string.h>
+#include	<stdio.h>
+#include	<sys/types.h>
+#include	<sgs.h>
+#include	<debug.h>
+#include	<_libld.h>
+#include	<sys/elf_amd64.h>
+#include	<dwarf.h>
+#include	<stdlib.h>
+
+/*
+ * A EH_FRAME_HDR consists of the following:
+ *
+ *	Encoding	Field
+ *	--------------------------------
+ *	unsigned byte	version
+ *	unsigned byte	eh_frame_ptr_enc
+ *	unsigned byte	fde_count_enc
+ *	unsigned byte	table_enc
+ *	encoded		eh_frame_ptr
+ *	encoded		fde_count
+ *	[ binary search table ]
+ *
+ * The binary search table entries each consists of:
+ *
+ *	encoded		initial_func_loc
+ *	encoded		FDE_address
+ *
+ * The entries in the binary search table are sorted
+ * in a increasing order by the initial location.
+ *
+ *
+ * version
+ *
+ *   Version of the .eh_frame_hdr format. This value shall be 1.
+ *
+ * eh_frame_ptr_enc
+ *
+ *    The encoding format of the eh_frame_ptr field.  For shared
+ *    libraries the encoding must be
+ *    DW_EH_PE_sdata4|DW_EH_PE_pcrel or
+ *    DW_EH_PE_sdata4|DW_EH_PE_datarel.
+ *
+ *
+ * fde_count_enc
+ *
+ *    The encoding format of the fde_count field. A value of
+ *    DW_EH_PE_omit indicates the binary search table is not
+ *    present.
+ *
+ * table_enc
+ *
+ *    The encoding format of the entries in the binary search
+ *    table. A value of DW_EH_PE_omit indicates the binary search
+ *    table is not present. For shared libraries the encoding
+ *    must be DW_EH_PE_sdata4|DW_EH_PE_pcrel or
+ *    DW_EH_PE_sdata4|DW_EH_PE_datarel.
+ *
+ *
+ * eh_frame_ptr
+ *
+ *    The encoded value of the pointer to the start of the
+ *    .eh_frame section.
+ *
+ * fde_count
+ *
+ *    The encoded value of the count of entries in the binary
+ *    search table.
+ *
+ * binary search table
+ *
+ *    A binary search table containing fde_count entries. Each
+ *    entry of the table consist of two encoded values, the
+ *    initial location of the function to which an FDE applies,
+ *    and the address of the FDE. The entries are sorted in an
+ *    increasing order by the initial location value.
+ *
+ */
+
+
+/*
+ * EH_FRAME sections
+ * =================
+ *
+ * The call frame information needed for unwinding the stack is output in
+ * an ELF section(s) of type SHT_AMD64_UNWIND. In the simplest case there
+ * will be one such section per object file and it will be named
+ * ".eh_frame".  An .eh_frame section consists of one or more
+ * subsections. Each subsection contains a CIE (Common Information Entry)
+ * followed by varying number of FDEs (Frame Descriptor Entry). A FDE
+ * corresponds to an explicit or compiler generated function in a
+ * compilation unit, all FDEs can access the CIE that begins their
+ * subsection for data.
+ *
+ * If an object file contains C++ template instantiations there shall be
+ * a separate CIE immediately preceding each FDE corresponding to an
+ * instantiation.
+ *
+ * Using the preferred encoding specified below, the .eh_frame section can
+ * be entirely resolved at link time and thus can become part of the
+ * text segment.
+ *
+ * .eh_frame Section Layout
+ * ------------------------
+ *
+ * EH_PE encoding below refers to the pointer encoding as specified in the
+ * enhanced LSB Chapter 7 for Eh_Frame_Hdr.
+ *
+ * Common Information Entry (CIE)
+ * ------------------------------
+ * CIE has the following format:
+ *
+ *                           Length
+ *                              in
+ *     Field                   Byte      Description
+ *     -----                  ------     -----------
+ *  1. Length                   4        Length of CIE (not including
+ *					 this 4-byte field).
+ *
+ *  2. CIE id                   4        Value Zero (0) for .eh_frame
+ *					 (used to distinguish CIEs and
+ *					 FDEs when scanning the section)
+ *
+ *  3. Version                  1        Value One (1)
+ *
+ *  4. CIE Augmentation       string     Null-terminated string with legal
+ *					 values being "" or 'z' optionally
+ *					 followed by single occurrances of
+ *					 'P', 'L', or 'R' in any order.
+ *     String                            The presence of character(s) in the
+ *                                       string dictates the content of
+ *                                       field 8, the Augmentation Section.
+ *					 Each character has one or two
+ *					 associated operands in the AS.
+ *					 Operand order depends on
+ *					 position in the string ('z' must
+ *					 be first).
+ *
+ *  5. Code Align Factor      uleb128    To be multiplied with the
+ *					 "Advance Location" instructions in
+ *                                       the Call Frame Instructions
+ *
+ *  6. Data Align Factor      sleb128    To be multiplied with all offset
+ *                                       in the Call Frame Instructions
+ *
+ *  7. Ret Address Reg          1        A "virtual' register representation
+ *                                       of the return address. In Dwarf V2,
+ *                                       this is a byte, otherwise it is
+ *                                       uleb128. It is a byte in gcc 3.3.x
+ *
+ *  8. Optional CIE           varying    Present if Augmentation String in
+ *     Augmentation Section              field 4 is not 0.
+ *
+ *     z:
+ * 	size		   uleb128       Length of the remainder of the
+ *				         Augmentation Section
+ *
+ *     P:
+ * 	personality_enc    1	         Encoding specifier - preferred
+ *					 value is a pc-relative, signed
+ *				         4-byte
+ *
+ *
+ *        personality routine (encoded)  Encoded pointer to personality
+ *					 routine (actually to the PLT
+ *				         entry for the personality
+ *				         routine)
+ *     R:
+ * 	code_enc           1	      Non-default encoding for the
+ *				      code-pointers (FDE members
+ *				      "initial_location" and "address_range"
+ *				      and the operand for DW_CFA_set_loc)
+ *				      - preferred value is pc-relative,
+ *				      signed 4-byte.
+ *     L:
+ * 	lsda_enc	   1	      FDE augmentation bodies may contain
+ *				      LSDA pointers. If so they are
+ *				      encoded as specified here -
+ *				      preferred value is pc-relative,
+ *				      signed 4-byte possibly indirect
+ *				      thru a GOT entry.
+ *
+ *
+ *  9. Optional Call Frame varying
+ *     Instructions
+ *
+ * The size of the optional call frame instruction area must be computed
+ * based on the overall size and the offset reached while scanning the
+ * preceding fields of the CIE.
+ *
+ *
+ * Frame Descriptor Entry (FDE)
+ * ----------------------------
+ * FDE has the following format:
+ *
+ *                            Length
+ *                              in
+ *     Field                   Byte      Description
+ *     -----                  ------     -----------
+ *  1. Length                   4        Length of remainder of this FDE
+ *
+ *  2. CIE Pointer              4        Distance from this field to the
+ *				         nearest preceding CIE
+ *				         (uthe value is subtracted from the
+ *					 current address). This value
+ *				         can never be zero and thus can
+ *				         be used to distinguish CIE's and
+ *				         FDE's when scanning the
+ *				         .eh_frame section
+ *
+ *  3. Initial Location       varying    Reference to the function code
+ *                                       corresponding to this FDE.
+ *                                       If 'R' is missing from the CIE
+ *                                       Augmentation String, the field is an
+ *                                       8-byte absolute pointer. Otherwise,
+ *                                       the corresponding EH_PE encoding in the
+ *                                       CIE Augmentation Section is used to
+ *                                       interpret the reference.
+ *
+ *  4. Address Range          varying    Size of the function code corresponding
+ *                                       to this FDE.
+ *                                       If 'R' is missing from the CIE
+ *                                       Augmentation String, the field is an
+ *                                       8-byte unsigned number. Otherwise,
+ *                                       the size is determined by the
+ *				         corresponding EH_PE encoding in the
+ *                                       CIE Augmentation Section (the
+ *				         value is always absolute).
+ *
+ *  5. Optional FDE           varying    present if CIE augmentation
+ *     Augmentation Section	         string is non-empty.
+ *
+ *
+ *     'z':
+ * 	length		   uleb128       length of the remainder of the
+ *				         FDE augmentation section
+ *
+ *
+ *     'L' (and length > 0):
+ *         LSDA               varying    LSDA pointer, encoded in the
+ *				         format specified by the
+ *				         corresponding operand in the CIE's
+ *				         augmentation body.
+ *
+ *  6. Optional Call          varying
+ *     Frame Instructions
+ *
+ * The size of the optional call frame instruction area must be computed
+ * based on the overall size and the offset reached while scanning the
+ * preceding fields of the FDE.
+ *
+ * The overall size of a .eh_frame section is given in the ELF section
+ * header.  The only way to determine the number of entries is to scan
+ * the section till the end and count.
+ *
+ */
+
+
+
+
+/*
+ * The job of this function is to determine how much space
+ * will be required for the final table.  We'll build
+ * it later.
+ */
+uintptr_t
+make_amd64_unwindhdr(Ofl_desc *ofl)
+{
+	Shdr	    *shdr;
+	Elf_Data    *elfdata;
+	Is_desc	    *isec;
+	Xword	    size;
+	Xword	    fde_cnt;
+	Listnode    *lnp;
+	Os_desc	    *osp;
+
+	/*
+	 * we only build a unwind header if we have
+	 * sum unwind information in the file.
+	 */
+	if (ofl->ofl_unwind.head == NULL)
+		return (1);
+
+	/*
+	 * Allocate and initialize the Elf_Data structure.
+	 */
+	if ((elfdata = libld_calloc(sizeof (Elf_Data), 1)) == 0)
+		return (S_ERROR);
+	elfdata->d_type = ELF_T_BYTE;
+	elfdata->d_align = M_WORD_ALIGN;
+	elfdata->d_version = ofl->ofl_dehdr->e_version;
+
+
+	/*
+	 * Allocate and initialize the Shdr structure.
+	 */
+	if ((shdr = libld_calloc(sizeof (Shdr), 1)) == 0)
+		return (S_ERROR);
+	shdr->sh_type = SHT_AMD64_UNWIND;
+	shdr->sh_flags = SHF_ALLOC;
+	shdr->sh_addralign = M_WORD_ALIGN;
+	shdr->sh_entsize = 0;
+
+	/*
+	 * Allocate and initialize the Is_desc structure.
+	 */
+	if ((isec = libld_calloc(1, sizeof (Is_desc))) == 0)
+		return (S_ERROR);
+	isec->is_name = MSG_ORIG(MSG_SCN_UNWINDHDR);
+	isec->is_shdr = shdr;
+	isec->is_indata = elfdata;
+
+
+	if ((ofl->ofl_unwindhdr = ld_place_section(ofl, isec,
+	    M_ID_UNWINDHDR, 0)) == (Os_desc *)S_ERROR)
+		return (S_ERROR);
+
+	/*
+	 * Following we quickly scan through all of
+	 * the input Frame info - counting for each
+	 * FDE will have to index.  Each fde_entry
+	 * will get a corresponding entry in the
+	 * binary search table.
+	 */
+	fde_cnt = 0;
+	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, osp)) {
+		Is_desc	    *isp;
+		Listnode    *_lnp;
+		for (LIST_TRAVERSE(&osp->os_isdescs, _lnp, isp)) {
+			unsigned char	*data;
+			size_t		datasize;
+			uint64_t	off;
+			uint_t		length, id;
+
+			data = (unsigned char *)isp->is_indata->d_buf;
+			datasize = isp->is_indata->d_size;
+			off = 0;
+			while (off < datasize) {
+				uint_t	    ndx;
+
+				ndx = 0;
+				/*
+				 * extract length in lsb format
+				 */
+				length = LSB32EXTRACT(data + off + ndx);
+				ndx += 4;
+
+				/*
+				 * extract CIE id in lsb format
+				 */
+				id = LSB32EXTRACT(data + off + ndx);
+				ndx += 4;
+
+				/*
+				 * A CIE record has a id of '0', otherwise
+				 * this is a FDE entry and the 'id' is the
+				 *  CIE pointer.
+				 */
+				if (id == 0) {
+					uint_t	cieversion;
+					/*
+					 * The only CIE version supported
+					 * is '1' - quick sanity check
+					 * here.
+					 */
+					cieversion = data[off + ndx];
+					ndx += 1;
+					if (cieversion != 1) {
+					    eprintf(ofl->ofl_lml, ERR_FATAL,
+						MSG_INTL(MSG_UNW_BADCIEVERS),
+						isp->is_file->ifl_name,
+						isp->is_name, off);
+					    return (S_ERROR);
+					}
+				} else
+					fde_cnt++;
+				off += length + 4;
+			}
+		}
+	}
+
+
+	/*
+	 * section size:
+	 *	byte	    version		+1
+	 *	byte	    eh_frame_ptr_enc	+1
+	 *	byte	    fde_count_enc	+1
+	 *	byte	    table_enc		+1
+	 *	4 bytes	    eh_frame_ptr	+4
+	 *	4 bytes	    fde_count		+4
+	 *	[4 bytes] [4bytes] * fde_count	...
+	 */
+	size = 12 + (8 * fde_cnt);
+
+	if ((elfdata->d_buf = libld_calloc(size, 1)) == 0)
+		return (S_ERROR);
+	elfdata->d_size = size;
+	shdr->sh_size = (Xword)size;
+
+	return (1);
+}
+
+
+/*
+ * the comparator function needs to calculate
+ * the actual 'initloc' of a bintab entry - to
+ * do this we initialize the following global to point
+ * to it.
+ */
+static Addr framehdr_addr;
+
+static int
+bintabcompare(const void *p1, const void *p2)
+{
+	uint_t	    *bintab1, *bintab2;
+	uint_t	    ent1, ent2;
+
+	bintab1 = (uint_t *)p1;
+	bintab2 = (uint_t *)p2;
+
+	assert(bintab1 != 0);
+	assert(bintab2 != 0);
+
+	ent1 = *bintab1 + framehdr_addr;
+	ent2 = *bintab2 + framehdr_addr;
+
+	if (ent1 > ent2)
+		return (1);
+	if (ent1 < ent2)
+		return (-1);
+	return (0);
+}
+
+uintptr_t
+populate_amd64_unwindhdr(Ofl_desc *ofl)
+{
+	unsigned char	    *hdrdata;
+	uint_t		    *binarytable;
+	uint_t		    hdroff;
+	Listnode	    *lnp;
+	Addr		    hdraddr;
+	Os_desc		    *hdrosp;
+	Os_desc		    *osp;
+	Os_desc		    *first_unwind;
+	uint_t		    fde_count;
+	uint_t		    *uint_ptr;
+
+	/*
+	 * Are we building the unwind hdr?
+	 */
+	if ((hdrosp = ofl->ofl_unwindhdr) == 0)
+		return (1);
+
+	hdrdata = hdrosp->os_outdata->d_buf;
+	hdraddr = hdrosp->os_shdr->sh_addr;
+	hdroff = 0;
+
+	/*
+	 * version == 1
+	 */
+	hdrdata[hdroff++] = 1;
+	/*
+	 * The encodings are:
+	 *
+	 *  eh_frameptr_enc	sdata4 | pcrel
+	 *  fde_count_enc	udata4
+	 *  table_enc		sdata4 | datarel
+	 */
+	hdrdata[hdroff++] = DW_EH_PE_sdata4 | DW_EH_PE_pcrel;
+	hdrdata[hdroff++] = DW_EH_PE_udata4;
+	hdrdata[hdroff++] = DW_EH_PE_sdata4 | DW_EH_PE_datarel;
+
+	/*
+	 *	Header Offsets
+	 *	-----------------------------------
+	 *	byte	    version		+1
+	 *	byte	    eh_frame_ptr_enc	+1
+	 *	byte	    fde_count_enc	+1
+	 *	byte	    table_enc		+1
+	 *	4 bytes	    eh_frame_ptr	+4
+	 *	4 bytes	    fde_count		+4
+	 */
+	/* LINTED */
+	binarytable =  (uint_t *)(hdrdata + 12);
+	first_unwind = 0;
+	fde_count = 0;
+
+	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, osp)) {
+		unsigned char	*fdata;
+		uint64_t	fdatasize;
+		uint_t		foff;
+		uint64_t	fndx;
+		uint_t		cieRflag;
+		uint_t		ciePflag;
+		Shdr		*shdr;
+
+		/*
+		 * remember first UNWIND section to
+		 * point to in the frame_ptr entry.
+		 */
+		if (first_unwind == 0)
+			first_unwind = osp;
+
+		fdata = osp->os_outdata->d_buf;
+		shdr = osp->os_shdr;
+		fdatasize = shdr->sh_size;
+		foff = 0;
+		ciePflag = 0;
+		cieRflag = 0;
+		while (foff < fdatasize) {
+			uint_t	    length;
+			uint_t	    id;
+
+			fndx = 0;
+			/*
+			 * extract length in lsb format
+			 */
+			length = LSB32EXTRACT(fdata + foff + fndx);
+			fndx += 4;
+
+			/*
+			 * extract id in lsb format
+			 */
+			id = LSB32EXTRACT(fdata + foff + fndx);
+			fndx += 4;
+
+			/*
+			 * A CIE record has a id of '0'; otherwise
+			 * this is a FDE entry and the 'id' is the
+			 * CIE pointer.
+			 */
+			if (id == 0) {
+				char	*cieaugstr;
+				uint_t	cieaugndx;
+
+				ciePflag = 0;
+				cieRflag = 0;
+				/*
+				 * We need to drill through the CIE
+				 * to find the Rflag.  It's the Rflag
+				 * which describes how the FDE code-pointers
+				 * are encoded.
+				 */
+
+				/*
+				 * burn through version
+				 */
+				fndx++;
+				/*
+				 * augstr
+				 */
+				cieaugstr = (char *)(&fdata[foff + fndx]);
+				fndx += strlen(cieaugstr) + 1;
+
+				/*
+				 * calign & dalign
+				 */
+				(void) uleb_extract(&fdata[foff], &fndx);
+				(void) sleb_extract(&fdata[foff], &fndx);
+				/*
+				 * retreg
+				 */
+				fndx++;
+
+				/*
+				 * we walk through the augmentation
+				 * section now looking for the Rflag
+				 */
+				for (cieaugndx = 0; cieaugstr[cieaugndx];
+				    cieaugndx++) {
+					switch (cieaugstr[cieaugndx]) {
+					case 'z':
+					    /* size */
+					    (void) uleb_extract(&fdata[foff],
+						&fndx);
+					    break;
+					case 'P':
+					    /* personality */
+					    ciePflag = fdata[foff + fndx];
+					    fndx++;
+						/*
+						 * Just need to extract the
+						 * value to move on to the next
+						 * field.
+						 */
+					    (void) dwarf_ehe_extract(
+						&fdata[foff + fndx],
+						&fndx, ciePflag,
+						ofl->ofl_dehdr->e_ident,
+						shdr->sh_addr + foff + fndx);
+					    break;
+					case 'R':
+					    /* code encoding */
+					    cieRflag = fdata[foff + fndx];
+					    fndx++;
+					    break;
+					case 'L':
+					    /* lsda encoding */
+					    fndx++;
+					    break;
+					}
+				}
+			} else {
+				uint_t	    bintabndx;
+				uint64_t    initloc;
+				uint64_t    fdeaddr;
+
+				bintabndx = fde_count * 2;
+				fde_count++;
+
+				/*
+				 * FDEaddr is adjusted
+				 * to account for the length & id which
+				 * have already been consumed.
+				 */
+				fdeaddr = shdr->sh_addr + foff;
+
+				initloc = dwarf_ehe_extract(&fdata[foff],
+				    &fndx, cieRflag, ofl->ofl_dehdr->e_ident,
+				    shdr->sh_addr + foff + fndx);
+				binarytable[bintabndx] = (uint_t)(initloc -
+					hdraddr);
+				binarytable[bintabndx + 1] = (uint_t)(fdeaddr -
+					hdraddr);
+			}
+
+			/*
+			 * the length does not include the length
+			 * itself - so account for that too.
+			 */
+			foff += length + 4;
+		}
+	}
+
+	/*
+	 * Do a quick sort on the binary table
+	 */
+	framehdr_addr = hdraddr;
+	qsort((void *)binarytable, (size_t)fde_count,
+		(size_t)(sizeof (uint_t) * 2), bintabcompare);
+	/*
+	 * Fill in:
+	 *	first_frame_ptr
+	 *	fde_count
+	 */
+	hdroff = 4;
+	/* LINTED */
+	uint_ptr = (uint_t *)(&hdrdata[hdroff]);
+	*uint_ptr = first_unwind->os_shdr->sh_addr -
+		hdrosp->os_shdr->sh_addr + hdroff;
+
+	hdroff += 4;
+	/* LINTED */
+	uint_ptr = (uint_t *)&hdrdata[hdroff];
+	*uint_ptr = fde_count;
+
+	return (1);
+}
+
+uintptr_t
+append_amd64_unwind(Os_desc *osp, Ofl_desc * ofl)
+{
+	Listnode    *lnp;
+	Os_desc	    *_osp;
+	/*
+	 * Check to see if this output section is already
+	 * on the list.
+	 */
+	for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, _osp))
+		if (osp == _osp)
+		    return (1);
+
+	/*
+	 * Append output section to unwind list
+	 */
+	if (list_appendc(&ofl->ofl_unwind, osp) == 0)
+	    return (S_ERROR);
+	return (1);
+}
--- a/usr/src/cmd/sgs/libld/common/update.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/update.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -36,7 +35,7 @@
  */
 #include	<stdio.h>
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -57,7 +56,7 @@
  * file images to the output image and their values and index's updated in the
  * output image.
  */
-Addr
+static Addr
 update_osym(Ofl_desc *ofl)
 {
 	Listnode	*lnp1, *lnp2;
@@ -171,7 +170,7 @@
 	strtab = ofl->ofl_strtab;
 	dynstr = ofl->ofl_dynstrtab;
 
-	DBG_CALL(Dbg_syms_sec_title());
+	DBG_CALL(Dbg_syms_sec_title(ofl->ofl_lml));
 
 	/*
 	 * Add the output file name to the first .symtab symbol.
@@ -195,7 +194,7 @@
 	 * If we are to display GOT summary information, then allocate
 	 * the buffer to 'cache' the GOT symbols into now.
 	 */
-	if (dbg_mask) {
+	if (DBG_ENABLED) {
 		if ((_gottable = gottable = libld_calloc(ofl->ofl_gotcnt,
 		    sizeof (Gottable))) == 0)
 		return ((Addr)S_ERROR);
@@ -256,9 +255,9 @@
 			if ((dynsym == 0) || (osp->os_flags & FLG_OS_OUTREL)) {
 				if (versym)
 					versym[*symndx - 1] = 0;
-				DBG_CALL(Dbg_syms_sec_entry(*symndx - 1,
-					sgp, osp));
 				osp->os_scnsymndx = *symndx - 1;
+				DBG_CALL(Dbg_syms_sec_entry(ofl->ofl_lml,
+				    osp->os_scnsymndx, sgp, osp));
 			}
 
 			/*
@@ -334,7 +333,7 @@
 			etext_ndx = SHN_ABS;
 			etext_abs = 1;
 			if (ofl->ofl_flags & FLG_OF_VERBOSE)
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    MSG_INTL(MSG_UPD_NOREADSEG));
 		}
 		if (dsgp) {
@@ -344,7 +343,7 @@
 			edata_ndx = SHN_ABS;
 			edata_abs = 1;
 			if (ofl->ofl_flags & FLG_OF_VERBOSE)
-				eprintf(ERR_WARNING,
+				eprintf(ofl->ofl_lml, ERR_WARNING,
 				    MSG_INTL(MSG_UPD_NORDWRSEG));
 		}
 
@@ -394,11 +393,12 @@
 			end = (Addr) 0;
 			end_ndx = SHN_ABS;
 			end_abs = 1;
-			eprintf(ERR_WARNING,  MSG_INTL(MSG_UPD_NOSEG));
+			eprintf(ofl->ofl_lml, ERR_WARNING,
+			    MSG_INTL(MSG_UPD_NOSEG));
 		}
 	}
 
-	DBG_CALL(Dbg_syms_up_title(ofl->ofl_ehdr));
+	DBG_CALL(Dbg_syms_up_title(ofl->ofl_lml));
 
 	/*
 	 * Initialize the scoped symbol table entry point.  This is for all
@@ -448,18 +448,18 @@
 			sdp = ifl->ifl_oldndx[lndx];
 			sym = sdp->sd_sym;
 
-#if defined(sparc) || defined(__sparcv9)
+#if	defined(sparc) || defined(__sparcv9)
 			/*
 			 * Assign a got offset if necessary.
 			 */
-			if (assign_got(sdp) == S_ERROR)
+			if (ld_assign_got(ofl, sdp) == S_ERROR)
 				return ((Addr)S_ERROR);
 #elif defined(i386) || defined(__amd64)
 /* nothing to do */
 #else
 #error Unknown architecture!
 #endif
-			if (dbg_mask) {
+			if (DBG_ENABLED) {
 			    for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp2, gnp)) {
 				_gottable->gt_sym = sdp;
 				_gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx;
@@ -532,7 +532,7 @@
 				    (sym->st_shndx == SHN_ABS))
 					continue;
 
-				if (sym_copy(sdp) == S_ERROR)
+				if (ld_sym_copy(sdp) == S_ERROR)
 					return ((Addr)S_ERROR);
 				sym = sdp->sd_sym;
 			}
@@ -608,19 +608,19 @@
 	 * the `.init' and `.fini' sections.  In this case determine the size of
 	 * these sections and updated the symbols value accordingly.
 	 */
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0,
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0,
 	    ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED) && sdp->sd_isc &&
 	    (strcmp(sdp->sd_isc->is_name, MSG_ORIG(MSG_SCN_INIT)) == 0)) {
 
-		if (sym_copy(sdp) == S_ERROR)
+		if (ld_sym_copy(sdp) == S_ERROR)
 			return ((Addr)S_ERROR);
 		sdp->sd_sym->st_size =
 			sdp->sd_isc->is_osdesc->os_shdr->sh_size;
 	}
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0,
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0,
 	    ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED) && sdp->sd_isc &&
 	    (strcmp(sdp->sd_isc->is_name, MSG_ORIG(MSG_SCN_FINI)) == 0)) {
-		if (sym_copy(sdp) == S_ERROR)
+		if (ld_sym_copy(sdp) == S_ERROR)
 			return ((Addr)S_ERROR);
 		sdp->sd_sym->st_size =
 			sdp->sd_isc->is_osdesc->os_shdr->sh_size;
@@ -701,8 +701,8 @@
 		 * just be dropped from the output image.
 		 */
 		if (sdp->sd_flags & FLG_SY_INVALID) {
-			DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp));
-			DBG_CALL(Dbg_syms_ignore(ofl->ofl_ehdr, sdp));
+			DBG_CALL(Dbg_syms_old(ofl, sdp));
+			DBG_CALL(Dbg_syms_ignore(ofl, sdp));
 			continue;
 		}
 
@@ -872,15 +872,15 @@
 		/*
 		 * Assign a got offset if necessary.
 		 */
-#if defined(sparc) || defined(__sparcv9)
-		if (assign_got(sdp) == S_ERROR)
+#if	defined(sparc) || defined(__sparcv9)
+		if (ld_assign_got(ofl, sdp) == S_ERROR)
 			return ((Addr)S_ERROR);
-#elif defined(i386) || defined(__amd64)
+#elif	defined(i386) || defined(__amd64)
 /* nothing to do */
 #else
 #error Unknown architecture!
 #endif
-		if (dbg_mask) {
+		if (DBG_ENABLED) {
 			for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp2, gnp)) {
 				_gottable->gt_sym = sdp;
 				_gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx;
@@ -1203,7 +1203,7 @@
 			}
 		}
 
-		DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp));
+		DBG_CALL(Dbg_syms_old(ofl, sdp));
 
 		spec = NULL;
 		/*
@@ -1213,7 +1213,8 @@
 		if (sectndx == SHN_UNDEF) {
 			if (((sdp->sd_flags & FLG_SY_REGSYM) == 0) &&
 			    (sym->st_value != 0)) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_NOTNULL),
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_SYM_NOTNULL),
 				    demangle(name), sdp->sd_file->ifl_name);
 			}
 
@@ -1382,7 +1383,7 @@
 		    (ELF_ST_TYPE(sym->st_info) == STT_FUNC) &&
 		    !(flags & FLG_OF_BFLAG)) {
 			if (sap->sa_PLTndx)
-				sym->st_value = calc_plt_addr(sdp, ofl);
+				sym->st_value = ld_calc_plt_addr(sdp, ofl);
 		}
 
 		/*
@@ -1442,7 +1443,7 @@
 			dynsym_ndx++;
 		}
 
-		DBG_CALL(Dbg_syms_new(ofl->ofl_ehdr, sym, sdp));
+		DBG_CALL(Dbg_syms_new(ofl, sym, sdp));
 	}
 
 	/*
@@ -1478,7 +1479,7 @@
 		else
 			bind = STB_WEAK;
 
-		DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp));
+		DBG_CALL(Dbg_syms_old(ofl, sdp));
 		if ((sym = wkp->wk_symtab) != 0) {
 			sym = wkp->wk_symtab;
 			sym->st_value = _sym->st_value;
@@ -1499,13 +1500,13 @@
 			    ELF_ST_TYPE(sym->st_info));
 			__sym = sym;
 		}
-		DBG_CALL(Dbg_syms_new(ofl->ofl_ehdr, __sym, sdp));
+		DBG_CALL(Dbg_syms_new(ofl, __sym, sdp));
 	}
 
 	/*
-	 * Now display GOT debugging information if required
+	 * Now display GOT debugging information if required.
 	 */
-	DBG_CALL(Dbg_got_display(gottable, ofl));
+	DBG_CALL(Dbg_got_display(ofl, gottable));
 
 	/*
 	 * Update the section headers information.
@@ -1549,7 +1550,7 @@
 /*
  * Build the dynamic section.
  */
-int
+static int
 update_odynamic(Ofl_desc *ofl)
 {
 	Listnode	*lnp;
@@ -1617,14 +1618,14 @@
 			dyn++;
 		}
 	}
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U),
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U),
 	    SYM_NOHASH, 0, ofl)) != NULL) &&
 		sdp->sd_ref == REF_REL_NEED) {
 		dyn->d_tag = DT_INIT;
 		dyn->d_un.d_ptr = sdp->sd_sym->st_value;
 		dyn++;
 	}
-	if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U),
+	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U),
 	    SYM_NOHASH, 0, ofl)) != NULL) &&
 		sdp->sd_ref == REF_REL_NEED) {
 		dyn->d_tag = DT_FINI;
@@ -1915,7 +1916,7 @@
 	dyn->d_un.d_val = ofl->ofl_dtflags_1;
 	dyn++;
 
-	mach_update_odynamic(ofl, &dyn);
+	ld_mach_update_odynamic(ofl, &dyn);
 
 	dyn->d_tag = DT_NULL;
 	dyn->d_un.d_val = 0;
@@ -1926,7 +1927,7 @@
 /*
  * Build the version definition section
  */
-int
+static int
 update_overdef(Ofl_desc *ofl)
 {
 	Listnode	*lnp1, *lnp2;
@@ -1964,7 +1965,7 @@
 				vdp->vd_name = (const char *)(uintptr_t)stoff;
 			}
 		} else {
-			sdp = sym_find(vdp->vd_name, vdp->vd_hash, 0, ofl);
+			sdp = ld_sym_find(vdp->vd_name, vdp->vd_hash, 0, ofl);
 			/* LINTED */
 			vdp->vd_name = (const char *)
 				(uintptr_t)sdp->sd_sym->st_name;
@@ -2060,7 +2061,7 @@
 /*
  * Build the version needed section
  */
-int
+static int
 update_overneed(Ofl_desc *ofl)
 {
 	Listnode	*lnp;
@@ -2190,7 +2191,7 @@
 /*
  * Update syminfo section.
  */
-uintptr_t
+static uintptr_t
 update_osyminfo(Ofl_desc * ofl)
 {
 	Os_desc *	symosp, * infosp = ofl->ofl_ossyminfo;
@@ -2244,9 +2245,9 @@
 	/*
 	 * Display debugging information about section.
 	 */
-	DBG_CALL(Dbg_syminfo_title());
-	if (dbg_mask) {
-		size_t	_cnt, cnt = shdr->sh_size / shdr->sh_entsize;
+	DBG_CALL(Dbg_syminfo_title(ofl->ofl_lml));
+	if (DBG_ENABLED) {
+		Word	_cnt, cnt = shdr->sh_size / shdr->sh_entsize;
 		Sym *	symtab = symosp->os_outdata->d_buf;
 		Dyn *	dyn;
 
@@ -2258,7 +2259,7 @@
 		for (_cnt = 1; _cnt < cnt; _cnt++) {
 			if (sip[_cnt].si_flags || sip[_cnt].si_boundto)
 				/* LINTED */
-				DBG_CALL(Dbg_syminfo_entry((int)_cnt,
+				DBG_CALL(Dbg_syminfo_entry(ofl->ofl_lml, _cnt,
 				    &sip[_cnt], &symtab[_cnt], strtab, dyn));
 		}
 	}
@@ -2268,10 +2269,10 @@
 /*
  * Build the output elf header.
  */
-uintptr_t
+static uintptr_t
 update_oehdr(Ofl_desc * ofl)
 {
-	Ehdr *		ehdr = ofl->ofl_ehdr;
+	Ehdr	*ehdr = ofl->ofl_nehdr;
 
 	/*
 	 * If an entry point symbol has already been established (refer
@@ -2289,15 +2290,16 @@
 	 * machine dependent section.
 	 */
 	ehdr->e_ident[EI_DATA] = M_DATA;
-	if (ofl->ofl_e_machine != M_MACH) {
-		if (ofl->ofl_e_machine != M_MACHPLUS)
+	ehdr->e_machine = ofl->ofl_dehdr->e_machine;
+	ehdr->e_flags = ofl->ofl_dehdr->e_flags;
+	ehdr->e_version = ofl->ofl_dehdr->e_version;
+
+	if (ehdr->e_machine != M_MACH) {
+		if (ehdr->e_machine != M_MACHPLUS)
 			return (S_ERROR);
-		if ((ofl->ofl_e_flags & M_FLAGSPLUS) == 0)
+		if ((ehdr->e_flags & M_FLAGSPLUS) == 0)
 			return (S_ERROR);
 	}
-	ehdr->e_machine = ofl->ofl_e_machine;
-	ehdr->e_flags = ofl->ofl_e_flags;
-	ehdr->e_version = ofl->ofl_libver;
 
 	if (ofl->ofl_flags & FLG_OF_SHAROBJ)
 		ehdr->e_type = ET_DYN;
@@ -2334,7 +2336,8 @@
 	taddr = taddr + mv->m_poffset;
 	for (i = 0; i < mv->m_repeat; i++) {
 		/* LINTED */
-		DBG_CALL(Dbg_move_expanding(mv, (Addr)(taddr - taddr0)));
+		DBG_CALL(Dbg_move_expand(ofl->ofl_lml, mv,
+		    (Addr)(taddr - taddr0)));
 		stride = (unsigned int)mv->m_stride + 1;
 		/* LINTED */
 		switch (ELF_M_SIZE(mv->m_info)) {
@@ -2373,7 +2376,7 @@
 /*
  * Update Move sections.
  */
-uintptr_t
+static uintptr_t
 update_move(Ofl_desc *ofl)
 {
 	Word		ndx = 0;
@@ -2422,13 +2425,15 @@
 				s = MSG_INTL(MSG_PSYM_EXPREASON2);
 			else
 				s = MSG_INTL(MSG_PSYM_EXPREASON3);
-			DBG_CALL(Dbg_move_parexpn(psym->psym_symd->sd_name, s));
+			DBG_CALL(Dbg_move_parexpn(ofl->ofl_lml,
+			    psym->psym_symd->sd_name, s));
 			for (LIST_TRAVERSE(&(psym->psym_mvs), lnp2, mvp)) {
 				if ((mvp->mv_flag & FLG_MV_OUTSECT) == 0)
 					continue;
 				mv2 = mvp->mv_ientry;
 				sdp = psym->psym_symd;
-				DBG_CALL(Dbg_move_mventry(0, mv2, sdp));
+				DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0,
+				    mv2, sdp));
 				(void) expand_move(ofl, sdp, mv2);
 			}
 			continue;
@@ -2437,8 +2442,8 @@
 		/*
 		 * Process move table
 		 */
-		DBG_CALL(Dbg_move_outmove((const unsigned char *)
-			psym->psym_symd->sd_name));
+		DBG_CALL(Dbg_move_outmove(ofl->ofl_lml,
+		    psym->psym_symd->sd_name));
 		for (LIST_TRAVERSE(&(psym->psym_mvs), lnp2, mvp)) {
 			int	idx = 1;
 			if ((mvp->mv_flag & FLG_MV_OUTSECT) == 0)
@@ -2448,7 +2453,7 @@
 			sdp = isp->is_file->ifl_oldndx[
 				ELF_M_SYM(mv2->m_info)];
 
-			DBG_CALL(Dbg_move_mventry(0, mv2, sdp));
+			DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0, mv2, sdp));
 			*mv1 = *mv2;
 			if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) {
 				if (ELF_ST_BIND(sdp->sd_sym->st_info) ==
@@ -2487,9 +2492,8 @@
 					mv1->m_poffset += sdp->sd_sym->st_value;
 				} else {
 					if (isredloc)
-					    DBG_CALL(Dbg_syms_reduce(
-						DBG_SYM_REDUCE_RETAIN,
-						ofl->ofl_ehdr, sdp,
+					    DBG_CALL(Dbg_syms_reduce(ofl,
+						DBG_SYM_REDUCE_RETAIN, sdp,
 						idx, ofl->ofl_osmove->os_name));
 
 					mv1->m_info =
@@ -2497,7 +2501,7 @@
 					ELF_M_INFO(sdp->sd_symndx, mv2->m_info);
 				}
 			}
-			DBG_CALL(Dbg_move_mventry(1, mv1, sdp));
+			DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 1, mv1, sdp));
 			mv1++;
 			idx++;
 		}
@@ -2510,7 +2514,7 @@
  * Scan through the SHT_GROUP output sections.  Update their
  * sh_link/sh_info fields as well as the section contents.
  */
-uintptr_t
+static uintptr_t
 update_ogroup(Ofl_desc * ofl)
 {
 	Listnode	*lnp;
@@ -2553,9 +2557,9 @@
 			 * for the file it came from.
 			 */
 			if (gdata[i] >= ifl->ifl_shnum) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_GRP_INVALNDX),
-					isp->is_name, ifl->ifl_name, i,
-					gdata[i]);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_GRP_INVALNDX), isp->is_name,
+				    ifl->ifl_name, i, gdata[i]);
 				error = S_ERROR;
 				gdata[i] = 0;
 				continue;
@@ -2576,8 +2580,7 @@
 	return (error);
 }
 
-
-void
+static void
 update_ostrtab(Os_desc *osp, Str_tbl *stp)
 {
 	Elf_Data	*data;
@@ -2593,8 +2596,8 @@
  * Translate the shdr->sh_{link, info} from its input section value to that
  * of the corresponding shdr->sh_{link, info} output section value.
  */
-Word
-translate_link(Os_desc * osp, Word link, const char *msg)
+static Word
+translate_link(Ofl_desc *ofl, Os_desc *osp, Word link, const char *msg)
 {
 	Is_desc *	isp;
 	Ifl_desc *	ifl;
@@ -2619,7 +2622,7 @@
 	 * is within range for the input file.
 	 */
 	if (link >= ifl->ifl_shnum) {
-		eprintf(ERR_WARNING, msg, ifl->ifl_name,
+		eprintf(ofl->ofl_lml, ERR_WARNING, msg, ifl->ifl_name,
 		    isp->is_name, EC_XWORD(link));
 		return (link);
 	}
@@ -2659,14 +2662,14 @@
  *	expect this behavior).
  */
 uintptr_t
-update_outfile(Ofl_desc *ofl)
+ld_update_outfile(Ofl_desc *ofl)
 {
 	Addr		size, etext, vaddr = ofl->ofl_segorigin;
 	Listnode	*lnp1, *lnp2;
 	Sg_desc		*sgp;
 	Os_desc		*osp;
 	int		phdrndx = 0, capndx = 0, segndx = -1, secndx;
-	Ehdr		*ehdr = ofl->ofl_ehdr;
+	Ehdr		*ehdr = ofl->ofl_nehdr;
 	List		osecs;
 	Shdr		*hshdr;
 	Phdr		*_phdr = 0, *dtracephdr = 0;
@@ -2678,7 +2681,7 @@
 	/*
 	 * Loop through the segment descriptors and pick out what we need.
 	 */
-	DBG_CALL(Dbg_seg_title());
+	DBG_CALL(Dbg_seg_title(ofl->ofl_lml));
 	for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp)) {
 		Phdr *	phdr = &(sgp->sg_phdr);
 		Xword 	p_align;
@@ -2699,8 +2702,7 @@
 			if (ofl->ofl_osinterp) {
 				phdr->p_offset = ehdr->e_phoff;
 				phdr->p_filesz = phdr->p_memsz = phdrsz;
-				DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-				    segndx, sgp));
+				DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 				ofl->ofl_phdr[phdrndx++] = *phdr;
 			}
 			continue;
@@ -2712,8 +2714,7 @@
 				phdr->p_vaddr = phdr->p_memsz = 0;
 				phdr->p_offset = shdr->sh_offset;
 				phdr->p_filesz = shdr->sh_size;
-				DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-				    segndx, sgp));
+				DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 				ofl->ofl_phdr[phdrndx++] = *phdr;
 			}
 			continue;
@@ -2750,8 +2751,7 @@
 				phdr->p_offset = shdr->sh_offset;
 				phdr->p_filesz = shdr->sh_size;
 				phdr->p_flags = PF_R;
-				DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-				    segndx, sgp));
+				DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 				capndx = phdrndx;
 				ofl->ofl_phdr[phdrndx++] = *phdr;
 			}
@@ -2773,13 +2773,12 @@
 				phdr->p_offset = shdr->sh_offset;
 				phdr->p_filesz = shdr->sh_size;
 				phdr->p_flags = M_DATASEG_PERM;
-				DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-					segndx, sgp));
+				DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 				ofl->ofl_phdr[phdrndx++] = *phdr;
 			}
 			continue;
 		}
-#if defined(__x86) && defined(_ELF64)
+#if	defined(__x86) && defined(_ELF64)
 		if (phdr->p_type == PT_SUNW_UNWIND) {
 			Shdr	    *shdr;
 			if (ofl->ofl_unwindhdr == 0)
@@ -2828,8 +2827,7 @@
 			phdr->p_memsz = lastmemshdr->sh_offset +
 			    lastmemshdr->sh_size - phdr->p_offset;
 
-			DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-			    segndx, sgp));
+			DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 
 			ofl->ofl_tlsphdr = phdr;
 			ofl->ofl_phdr[phdrndx++] = *phdr;
@@ -2849,8 +2847,7 @@
 
 			vaddr = phdr->p_vaddr;
 			phdr->p_memsz = sgp->sg_length;
-			DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine,
-				segndx, sgp));
+			DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 			ofl->ofl_phdr[phdrndx++] = *phdr;
 
 			if (phdr->p_type != PT_LOAD)
@@ -2870,12 +2867,10 @@
 				p_e = p_s + (ofl->ofl_phdr[i]).p_memsz;
 				if (((p_s <= vaddr) && (p_e > vaddr)) ||
 				    ((vaddr <= p_s) && (v_e > p_s)))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_UPD_SEGOVERLAP),
-					    ofl->ofl_name,
-					    EC_ADDR(p_e),
-					    sgp->sg_name,
-					    EC_ADDR(vaddr));
+					    ofl->ofl_name, EC_ADDR(p_e),
+					    sgp->sg_name, EC_ADDR(vaddr));
 			}
 			continue;
 		}
@@ -2914,7 +2909,7 @@
 			offset += shdr->sh_size;
 			if (shdr->sh_type != SHT_NOBITS) {
 				if (nobits) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_UPD_NOBITS));
 					return (S_ERROR);
 				}
@@ -2974,7 +2969,7 @@
 			if ((sgp->sg_flags & FLG_SG_VADDR)) {
 				if (_phdr && (vaddr > phdr->p_vaddr) &&
 				    (phdr->p_type == PT_LOAD))
-					eprintf(ERR_WARNING,
+					eprintf(ofl->ofl_lml, ERR_WARNING,
 					    MSG_INTL(MSG_UPD_SEGOVERLAP),
 					    ofl->ofl_name, EC_ADDR(vaddr),
 					    sgp->sg_name,
@@ -3046,7 +3041,7 @@
 		    (phdr->p_flags & PF_X))
 			ehdr->e_entry = vaddr;
 
-		DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, segndx, sgp));
+		DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp));
 
 		/*
 		 * Traverse the output section descriptors for this segment so
@@ -3062,12 +3057,12 @@
 
 			if (shdr->sh_link)
 			    shdr->sh_link =
-				translate_link(osp, shdr->sh_link,
+				translate_link(ofl, osp, shdr->sh_link,
 				MSG_INTL(MSG_FIL_INVSHLINK));
 
 			if (shdr->sh_info && (shdr->sh_flags & SHF_INFO_LINK))
 			    shdr->sh_info =
-				translate_link(osp, shdr->sh_info,
+				translate_link(ofl, osp, shdr->sh_info,
 				MSG_INTL(MSG_FIL_INVSHINFO));
 
 			if (!(flags & FLG_OF_RELOBJ) &&
@@ -3099,9 +3094,9 @@
 		 * haven't exceeded any maximum segment length specification.
 		 */
 		if ((sgp->sg_length != 0) && (sgp->sg_length < phdr->p_memsz)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_UPD_LARGSIZE),
-			    ofl->ofl_name, sgp->sg_name,
-			    EC_XWORD(phdr->p_memsz),
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_UPD_LARGSIZE), ofl->ofl_name,
+			    sgp->sg_name, EC_XWORD(phdr->p_memsz),
 			    EC_XWORD(sgp->sg_length));
 			return (S_ERROR);
 		}
@@ -3199,9 +3194,12 @@
 	/*
 	 * Emit Strtab diagnostics.
 	 */
-	DBG_CALL(Dbg_sec_strtab(ofl->ofl_osshstrtab, ofl->ofl_shdrsttab));
-	DBG_CALL(Dbg_sec_strtab(ofl->ofl_osstrtab, ofl->ofl_strtab));
-	DBG_CALL(Dbg_sec_strtab(ofl->ofl_osdynstr, ofl->ofl_dynstrtab));
+	DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osshstrtab,
+	    ofl->ofl_shdrsttab));
+	DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osstrtab,
+	    ofl->ofl_strtab));
+	DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osdynstr,
+	    ofl->ofl_dynstrtab));
 
 	/*
 	 * Initialize the section headers string table index within the elf
@@ -3210,7 +3208,7 @@
 	/* LINTED */
 	if ((shscnndx = elf_ndxscn(ofl->ofl_osshstrtab->os_scn)) <
 	    SHN_LORESERVE) {
-		ofl->ofl_ehdr->e_shstrndx =
+		ofl->ofl_nehdr->e_shstrndx =
 		    /* LINTED */
 		    (Half)shscnndx;
 	} else {
@@ -3220,17 +3218,18 @@
 		 */
 		Elf_Scn	*scn;
 		Shdr	*shdr0;
+
 		if ((scn = elf_getscn(ofl->ofl_elf, 0)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN),
-				ofl->ofl_name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSCN), ofl->ofl_name);
 			return (S_ERROR);
 		}
 		if ((shdr0 = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR),
-			    ofl->ofl_name);
+			eprintf(ofl->ofl_lml, ERR_ELF,
+			    MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name);
 			return (S_ERROR);
 		}
-		ofl->ofl_ehdr->e_shstrndx = SHN_XINDEX;
+		ofl->ofl_nehdr->e_shstrndx = SHN_XINDEX;
 		shdr0->sh_link = shscnndx;
 	}
 
--- a/usr/src/cmd/sgs/libld/common/util.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/util.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -34,11 +33,13 @@
  */
 #include	<unistd.h>
 #include	<stdio.h>
+#include	<stdarg.h>
 #include	<string.h>
 #include	<fcntl.h>
 #include	<sys/types.h>
 #include	<sys/mman.h>
 #include	<errno.h>
+#include	<sgs.h>
 #include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
@@ -80,7 +81,7 @@
  *	by libld_malloc() must be 8 byte-aligned.  Even in a 32-bit environment,
  *	u_longlog_t pointers are employed.
  *
- * MAP_ANON arrived un Solaris 8, thus a fall-back is provided for older
+ * MAP_ANON arrived in Solaris 8, thus a fall-back is provided for older
  * systems.
  */
 static void *
@@ -89,7 +90,7 @@
 	void	*addr;
 	int	err;
 
-#if defined(MAP_ANON)
+#if	defined(MAP_ANON)
 	static int	noanon = 0;
 
 	if (noanon == 0) {
@@ -99,7 +100,7 @@
 
 		if ((errno != EBADF) && (errno != EINVAL)) {
 			err = errno;
-			(void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON),
+			eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON),
 			    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 			return (MAP_FAILED);
 		} else
@@ -109,7 +110,7 @@
 	if (dz_fd == -1) {
 		if ((dz_fd = open(MSG_ORIG(MSG_PTH_DEVZERO), O_RDONLY)) == -1) {
 			err = errno;
-			(void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
 			    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 			return (MAP_FAILED);
 		}
@@ -118,7 +119,7 @@
 	if ((addr = mmap(0, size, (PROT_READ | PROT_WRITE | PROT_EXEC),
 	    MAP_PRIVATE, dz_fd, 0)) == MAP_FAILED) {
 		err = errno;
-		(void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
+		eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
 		    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 		return (MAP_FAILED);
 	}
@@ -395,96 +396,6 @@
 }
 
 /*
- * Determine a least common multiplier.  Input sections contain an alignment
- * requirement, which elf_update() uses to insure that the section is aligned
- * correctly off of the base of the elf image.  We must also insure that the
- * sections mapping is congruent with this alignment requirement.  For each
- * input section associated with a loadable segment determine whether the
- * segments alignment must be adjusted to compensate for a sections alignment
- * requirements.
- */
-Xword
-lcm(Xword a, Xword b)
-{
-	Xword	_r, _a, _b;
-
-	if ((_a = a) == 0)
-		return (b);
-	if ((_b = b) == 0)
-		return (a);
-
-	if (_a > _b)
-		_a = b, _b = a;
-	while ((_r = _b % _a) != 0)
-		_b = _a, _a = _r;
-	return ((a / _a) * b);
-}
-
-/*
- * Cleanup an Ifl_desc
- */
-void
-ifl_list_cleanup(List *ifl_list)
-{
-	Listnode	*lnp;
-	Ifl_desc	*ifl;
-
-	for (LIST_TRAVERSE(ifl_list, lnp, ifl))
-		if (ifl->ifl_elf)
-			(void) elf_end(ifl->ifl_elf);
-	ifl_list->head = 0;
-	ifl_list->tail = 0;
-}
-
-/*
- * Cleanup all memory that has been dynamically allocated
- * durring libld processing and elf_end() all Elf descriptors that
- * are still open.
- */
-void
-ofl_cleanup(Ofl_desc *ofl)
-{
-	Ld_heap		*chp, *php;
-	Ar_desc		*adp;
-	Listnode	*lnp;
-
-	ifl_list_cleanup(&ofl->ofl_objs);
-	ifl_list_cleanup(&ofl->ofl_sos);
-
-	for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) {
-		Ar_aux		*aup;
-		Elf_Arsym	*arsym;
-
-		for (arsym = adp->ad_start, aup = adp->ad_aux;
-		    arsym->as_name; ++arsym, ++aup) {
-			if ((aup->au_mem) && (aup->au_mem != FLG_ARMEM_PROC)) {
-				(void) elf_end(aup->au_mem->am_elf);
-
-				/*
-				 * Null out all entries to this member so
-				 * that we don't attempt to elf_end() it again.
-				 */
-				ar_member(adp, arsym, aup, 0);
-			}
-		}
-		(void) elf_end(adp->ad_elf);
-	}
-
-	(void) elf_end(ofl->ofl_elf);
-	(void) elf_end(ofl->ofl_welf);
-
-	for (chp = ld_heap, php = 0; chp; php = chp, chp = chp->lh_next) {
-		if (php)
-			(void) munmap((void *)php,
-			    (size_t)php->lh_end - (size_t)php);
-	}
-	if (php)
-		(void) munmap((void *)php, (size_t)php->lh_end - (size_t)php);
-
-	ld_heap = 0;
-}
-
-/*
  * Add a string, separated by a colon, to an existing string.  Typically used
  * to maintain filter, rpath and audit names, of which there is normally only
  * one string supplied anyway.
@@ -524,7 +435,6 @@
 	return (new);
 }
 
-
 /*
  * Messaging support - funnel everything through _dgettext() as this provides
  * a stub binding to libc, or a real binding to libintl.
@@ -543,8 +453,8 @@
 const char *
 demangle(const char *name)
 {
-	if (Ofl.ofl_flags1 & FLG_OF1_DEMANGL)
-		return (Gelf_sym_dem(name));
+	if (demangle_flag)
+		return (Elf_demangle_name(name));
 	else
 		return (name);
 }
--- a/usr/src/cmd/sgs/libld/common/version.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/common/version.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,16 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<string.h>
 #include	<stdio.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"msg.h"
 #include	"_libld.h"
 
@@ -36,7 +36,7 @@
  * Locate a version descriptor.
  */
 Ver_desc *
-vers_find(const char *name, Word hash, List *lst)
+ld_vers_find(const char *name, Word hash, List *lst)
 {
 	Listnode	*lnp;
 	Ver_desc	*vdp;
@@ -57,7 +57,7 @@
  * until it is determined a descriptor need be created (see map_symbol())).
  */
 Ver_desc *
-vers_desc(const char *name, Word hash, List *lst)
+ld_vers_desc(const char *name, Word hash, List *lst)
 {
 	Ver_desc	*vdp;
 
@@ -88,7 +88,7 @@
 } Ver_Stack;
 
 static uintptr_t
-vers_visit_children(Ver_desc *vp, int flag)
+vers_visit_children(Ofl_desc *ofl, Ver_desc *vp, int flag)
 {
 	Listnode		*lnp1;
 	Ver_desc		*vdp;
@@ -121,23 +121,23 @@
 			 * cyclic dependency.
 			 */
 			if (err == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_VER_CYCLIC));
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_VER_CYCLIC));
 				err = 1;
 			}
 			for (tmp_sp = 0; tmp_sp < ver_stk.ver_sp; tmp_sp++) {
 				v = ver_stk.ver_stk[tmp_sp];
 				if ((v->vd_flags & FLG_VER_CYCLIC) == 0) {
 					v->vd_flags |= FLG_VER_CYCLIC;
-					eprintf(ERR_NONE,
-						MSG_INTL(MSG_VER_ADDVER),
-						v->vd_name);
+					eprintf(ofl->ofl_lml, ERR_NONE,
+					    MSG_INTL(MSG_VER_ADDVER),
+					    v->vd_name);
 				}
 			}
 			if ((vp->vd_flags & FLG_VER_CYCLIC) == 0) {
 				vp->vd_flags |= FLG_VER_CYCLIC;
-				eprintf(ERR_NONE,
-					MSG_INTL(MSG_VER_ADDVER),
-					vp->vd_name);
+				eprintf(ofl->ofl_lml, ERR_NONE,
+				    MSG_INTL(MSG_VER_ADDVER), vp->vd_name);
 			}
 			return (err);
 		}
@@ -159,7 +159,7 @@
 	 * Now visit children.
 	 */
 	for (LIST_TRAVERSE(&vp->vd_deps, lnp1, vdp))
-		if (vers_visit_children(vdp, 1) == S_ERROR)
+		if (vers_visit_children(ofl, vdp, 1) == S_ERROR)
 			return (S_ERROR);
 
 	/*
@@ -171,20 +171,20 @@
 }
 
 uintptr_t
-vers_check_defs(Ofl_desc *ofl)
+ld_vers_check_defs(Ofl_desc *ofl)
 {
 	Listnode	*lnp1, *lnp2;
 	Ver_desc	*vdp;
 	uintptr_t 	is_cyclic = 0;
 
 
-	DBG_CALL(Dbg_ver_def_title(ofl->ofl_name));
+	DBG_CALL(Dbg_ver_def_title(ofl->ofl_lml, ofl->ofl_name));
 
 	/*
 	 * First check if there are any cyclic dependency
 	 */
 	for (LIST_TRAVERSE(&ofl->ofl_verdesc, lnp1, vdp))
-		if ((is_cyclic = vers_visit_children(vdp, 0)) == S_ERROR)
+		if ((is_cyclic = vers_visit_children(ofl, vdp, 0)) == S_ERROR)
 			return (S_ERROR);
 	if (is_cyclic)
 		ofl->ofl_flags |= FLG_OF_FATAL;
@@ -199,14 +199,14 @@
 		avl_index_t	where;
 
 		if (vdp->vd_ndx == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_VER_UNDEF), name,
-			    vdp->vd_ref->vd_name,
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_VER_UNDEF), name, vdp->vd_ref->vd_name,
 			    vdp->vd_ref->vd_file->ifl_name);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
 		}
 
-		DBG_CALL(Dbg_ver_desc_entry(vdp));
+		DBG_CALL(Dbg_ver_desc_entry(ofl->ofl_lml, vdp));
 
 		/*
 		 * If a version definition contains no symbols this is possibly
@@ -214,7 +214,8 @@
 		 */
 		if ((vdp->vd_flags &
 		    (VER_FLG_BASE | VER_FLG_WEAK | FLG_VER_REFER)) == 0)
-			DBG_CALL(Dbg_ver_nointerface(vdp->vd_name));
+			DBG_CALL(Dbg_ver_nointerface(ofl->ofl_lml,
+			    vdp->vd_name));
 
 		/*
 		 * Update the version entry count to account for this new
@@ -249,7 +250,7 @@
 		else
 			bind = STB_GLOBAL;
 
-		if (sdp = sym_find(name, vdp->vd_hash, &where, ofl)) {
+		if (sdp = ld_sym_find(name, vdp->vd_hash, &where, ofl)) {
 			/*
 			 * If the symbol already exists and is undefined or was
 			 * defined in a shared library, convert it to an
@@ -275,8 +276,9 @@
 			} else if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
 			    (sdp->sd_shndx != SHN_ABS) &&
 			    (sdp->sd_ref == REF_REL_NEED)) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_VER_DEFINED),
-				    name, sdp->sd_file->ifl_name);
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_VER_DEFINED), name,
+				    sdp->sd_file->ifl_name);
 			}
 		} else {
 			/*
@@ -286,8 +288,8 @@
 				return (S_ERROR);
 			sym->st_shndx = SHN_ABS;
 			sym->st_info = ELF_ST_INFO(bind, STT_OBJECT);
-			DBG_CALL(Dbg_ver_symbol(name));
-			if ((sdp = sym_enter(name, sym, vdp->vd_hash,
+			DBG_CALL(Dbg_ver_symbol(ofl->ofl_lml, name));
+			if ((sdp = ld_sym_enter(name, sym, vdp->vd_hash,
 			    vdp->vd_file, ofl, 0, SHN_ABS, FLG_SY_SPECSEC,
 			    FLG_SY1_GLOB, &where)) == (Sym_desc *)S_ERROR)
 				return (S_ERROR);
@@ -301,7 +303,7 @@
 /*
  * Dereference dependencies as a part of normalizing (allows recursion).
  */
-void
+static void
 vers_derefer(Ifl_desc *ifl, Ver_desc *vdp, int weak)
 {
 	Listnode	*lnp;
@@ -326,7 +328,7 @@
  * required.
  */
 uintptr_t
-vers_check_need(Ofl_desc *ofl)
+ld_vers_check_need(Ofl_desc *ofl)
 {
 	Listnode	*lnp1;
 	Ifl_desc	*ifl;
@@ -455,22 +457,22 @@
 /*
  * Indicate dependency selection (allows recursion).
  */
-void
-vers_select(Ifl_desc *ifl, Ver_desc *vdp, const char *ref)
+static void
+vers_select(Ofl_desc *ofl, Ifl_desc *ifl, Ver_desc *vdp, const char *ref)
 {
 	Listnode	*lnp;
 	Ver_desc	*_vdp;
 	Ver_index	*vip = &ifl->ifl_verndx[vdp->vd_ndx];
 
 	vip->vi_flags |= FLG_VER_AVAIL;
-	DBG_CALL(Dbg_ver_avail_entry(vip, ref));
+	DBG_CALL(Dbg_ver_avail_entry(ofl->ofl_lml, vip, ref));
 
 	for (LIST_TRAVERSE(&vdp->vd_deps, lnp, _vdp))
-		vers_select(ifl, _vdp, ref);
+		vers_select(ofl, ifl, _vdp, ref);
 }
 
-Ver_index *
-vers_index(Ifl_desc *ifl, int avail)
+static Ver_index *
+vers_index(Ofl_desc *ofl, Ifl_desc *ifl, int avail)
 {
 	Listnode	*lnp;
 	Ver_desc	*vdp;
@@ -535,12 +537,12 @@
 			if (!(sdv->sdv_flags & FLG_SDV_MATCHED)) {
 				if (fail == 0) {
 					fail++;
-					eprintf(ERR_NONE,
+					eprintf(ofl->ofl_lml, ERR_NONE,
 					    MSG_INTL(MSG_VER_ADDVERS),
 					    sdf->sdf_rfile, sdf->sdf_name);
 				}
-				eprintf(ERR_NONE, MSG_INTL(MSG_VER_ADDVER),
-				    sdv->sdv_name);
+				eprintf(ofl->ofl_lml, ERR_NONE,
+				    MSG_INTL(MSG_VER_ADDVER), sdv->sdv_name);
 			}
 		}
 		if (fail)
@@ -554,23 +556,23 @@
  * Process a version symbol index section.
  */
 int
-vers_sym_process(Is_desc *isp, Ifl_desc *ifl)
+ld_vers_sym_process(Lm_list *lml, Is_desc *isp, Ifl_desc *ifl)
 {
 	Shdr	*symshdr;
 	Shdr	*vershdr = isp->is_shdr;
+
 	/*
-	 * Verify that the versym is the same size as the
-	 * linked symbol table.  If these two get out of sync
-	 * the file is considered corrupted.
+	 * Verify that the versym is the same size as the linked symbol table.
+	 * If these two get out of sync the file is considered corrupted.
 	 */
 	symshdr = ifl->ifl_isdesc[vershdr->sh_link]->is_shdr;
 	if ((symshdr->sh_size / symshdr->sh_entsize) != (vershdr->sh_size /
 	    vershdr->sh_entsize)) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_ELF_VERSYM), ifl->ifl_name,
-			isp->is_name,
-			EC_WORD(vershdr->sh_size / vershdr->sh_entsize),
-			ifl->ifl_isdesc[vershdr->sh_link]->is_name,
-			EC_WORD(symshdr->sh_size / symshdr->sh_entsize));
+		eprintf(lml, ERR_WARNING, MSG_INTL(MSG_ELF_VERSYM),
+		    ifl->ifl_name, isp->is_name,
+		    EC_WORD(vershdr->sh_size / vershdr->sh_entsize),
+		    ifl->ifl_isdesc[vershdr->sh_link]->is_name,
+		    EC_WORD(symshdr->sh_size / symshdr->sh_entsize));
 		return (1);
 	}
 	ifl->ifl_versym = (Versym *)isp->is_indata->d_buf;
@@ -585,7 +587,7 @@
  * descriptors will be promoted (concatenated) to the output files image.
  */
 uintptr_t
-vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl)
+ld_vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	const char	*str, *file = ifl->ifl_name;
 	Sdf_desc	*sdf = ifl->ifl_sdfdesc;
@@ -602,8 +604,9 @@
 		Listnode	*lnp;
 
 		for (LIST_TRAVERSE(&sdf->sdf_vers, lnp, sdv)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST),
-			    ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref);
+			eprintf(ofl->ofl_lml, ERR_FATAL,
+			    MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name,
+			    sdv->sdv_name, sdv->sdv_ref);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 		}
 		return (0);
@@ -617,8 +620,9 @@
 	 * data section will be of the same revision.
 	 */
 	if (vdf->vd_version > VER_DEF_CURRENT)
-		(void) eprintf(ERR_WARNING, MSG_INTL(MSG_VER_HIGHER),
-		    ifl->ifl_name, vdf->vd_version, VER_DEF_CURRENT);
+		(void) eprintf(ofl->ofl_lml, ERR_WARNING,
+		    MSG_INTL(MSG_VER_HIGHER), ifl->ifl_name, vdf->vd_version,
+		    VER_DEF_CURRENT);
 
 
 	num = isp->is_shdr->sh_info;
@@ -629,7 +633,7 @@
 	else
 		relobj = 0;
 
-	DBG_CALL(Dbg_ver_def_title(file));
+	DBG_CALL(Dbg_ver_def_title(ofl->ofl_lml, file));
 
 	/*
 	 * Loop through the version information setting up a version descriptor
@@ -655,8 +659,8 @@
 		name = (char *)(str + vdap->vda_name);
 		/* LINTED */
 		hash = (Word)elf_hash(name);
-		if ((ivdp = vers_find(name, hash, &ifl->ifl_verdesc)) == 0) {
-			if ((ivdp = vers_desc(name, hash,
+		if ((ivdp = ld_vers_find(name, hash, &ifl->ifl_verdesc)) == 0) {
+			if ((ivdp = ld_vers_desc(name, hash,
 			    &ifl->ifl_verdesc)) == (Ver_desc *)S_ERROR)
 				return (S_ERROR);
 		}
@@ -687,14 +691,14 @@
 				 * descriptor count.
 				 */
 				if (ofl->ofl_vercnt == 0) {
-					if (vers_base(ofl) ==
+					if (ld_vers_base(ofl) ==
 					    (Ver_desc *)S_ERROR)
 						return (S_ERROR);
 				}
 				ofl->ofl_flags |= FLG_OF_VERDEF;
-				if ((ovdp = vers_find(name, hash,
+				if ((ovdp = ld_vers_find(name, hash,
 				    &ofl->ofl_verdesc)) == 0) {
-					if ((ovdp = vers_desc(name, hash,
+					if ((ovdp = ld_vers_desc(name, hash,
 					    &ofl->ofl_verdesc)) ==
 					    (Ver_desc *)S_ERROR)
 						return (S_ERROR);
@@ -727,9 +731,9 @@
 			/* LINTED */
 			hash = (Word)elf_hash(name);
 
-			if ((_ivdp = vers_find(name, hash,
+			if ((_ivdp = ld_vers_find(name, hash,
 			    &ifl->ifl_verdesc)) == 0) {
-				if ((_ivdp = vers_desc(name, hash,
+				if ((_ivdp = ld_vers_desc(name, hash,
 				    &ifl->ifl_verdesc)) ==
 				    (Ver_desc *)S_ERROR)
 					return (S_ERROR);
@@ -737,14 +741,15 @@
 			if (list_appendc(&ivdp->vd_deps, _ivdp) == 0)
 				return (S_ERROR);
 		}
-		DBG_CALL(Dbg_ver_desc_entry(ivdp));
+		DBG_CALL(Dbg_ver_desc_entry(ofl->ofl_lml, ivdp));
 	}
 
 	/*
 	 * Now that we know the total number of version definitions for this
 	 * file, build an index array for fast access when processing symbols.
 	 */
-	if ((ifl->ifl_verndx = vers_index(ifl, relobj)) == (Ver_index *)S_ERROR)
+	if ((ifl->ifl_verndx =
+	    vers_index(ofl, ifl, relobj)) == (Ver_index *)S_ERROR)
 		return (S_ERROR);
 
 	if (relobj)
@@ -756,7 +761,7 @@
 	 * symbol bindings can occur.  Otherwise simply mark all versions as
 	 * available.
 	 */
-	DBG_CALL(Dbg_ver_avail_title(file));
+	DBG_CALL(Dbg_ver_avail_title(ofl->ofl_lml, file));
 
 	if (sdf && (sdf->sdf_flags & FLG_SDF_SELECT)) {
 		Listnode	*lnp1;
@@ -773,10 +778,11 @@
 				}
 			}
 			if (found)
-				vers_select(ifl, vdp, sdv->sdv_ref);
+				vers_select(ofl, ifl, vdp, sdv->sdv_ref);
 			else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST),
-				    ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name,
+				    sdv->sdv_name, sdv->sdv_ref);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
 		}
@@ -787,7 +793,7 @@
 		for (cnt = VER_NDX_GLOBAL; cnt <= ifl->ifl_vercnt; cnt++) {
 			vip = &ifl->ifl_verndx[cnt];
 			vip->vi_flags |= FLG_VER_AVAIL;
-			DBG_CALL(Dbg_ver_avail_entry(vip, 0));
+			DBG_CALL(Dbg_ver_avail_entry(ofl->ofl_lml, vip, 0));
 		}
 	}
 
@@ -806,7 +812,7 @@
  * Process a version needed section.
  */
 uintptr_t
-vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl)
+ld_vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	const char	*str, *file = ifl->ifl_name;
 	Word		num, _num;
@@ -819,15 +825,16 @@
 	 * structure as it is assumed all other version structures in this
 	 * data section will be of the same revision.
 	 */
-	if (vnd->vn_version > VER_DEF_CURRENT)
-		(void) eprintf(ERR_WARNING, MSG_INTL(MSG_VER_HIGHER),
-		    ifl->ifl_name, vnd->vn_version, VER_DEF_CURRENT);
-
+	if (vnd->vn_version > VER_DEF_CURRENT) {
+		(void) eprintf(ofl->ofl_lml, ERR_WARNING,
+		    MSG_INTL(MSG_VER_HIGHER), ifl->ifl_name, vnd->vn_version,
+		    VER_DEF_CURRENT);
+	}
 
 	num = isp->is_shdr->sh_info;
 	str = (char *)ifl->ifl_isdesc[isp->is_shdr->sh_link]->is_indata->d_buf;
 
-	DBG_CALL(Dbg_ver_need_title(file));
+	DBG_CALL(Dbg_ver_need_title(ofl->ofl_lml, file));
 
 	/*
 	 * Loop through the version information setting up a version descriptor
@@ -867,7 +874,8 @@
 			sdv->sdv_ref = file;
 			if (list_appendc(&sdf->sdf_vers, sdv) == 0)
 				return (S_ERROR);
-			DBG_CALL(Dbg_ver_need_entry(_cnt, name, sdv->sdv_name));
+			DBG_CALL(Dbg_ver_need_entry(ofl->ofl_lml, _cnt, name,
+			    sdv->sdv_name));
 		}
 	}
 
@@ -880,7 +888,7 @@
  * represented in the output file.
  */
 void
-vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl)
+ld_vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl)
 {
 	Half 	vndx;
 
@@ -915,8 +923,8 @@
 	 * version definition.
 	 */
 	if ((ifl->ifl_verndx == 0) || (vndx > ifl->ifl_vercnt)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_VER_INVALNDX), sdp->sd_name,
-		    ifl->ifl_name, vndx);
+		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_VER_INVALNDX),
+		    sdp->sd_name, ifl->ifl_name, vndx);
 		ofl->ofl_flags |= FLG_OF_FATAL;
 		return;
 	}
@@ -942,7 +950,7 @@
  * assigned to represent the file itself.  Known as the base version.
  */
 Ver_desc *
-vers_base(Ofl_desc *ofl)
+ld_vers_base(Ofl_desc *ofl)
 {
 	Ver_desc	*vdp;
 	const char	*name;
@@ -967,8 +975,8 @@
 	 * Generate the version descriptor.
 	 */
 	/* LINTED */
-	if ((vdp = vers_desc(name, (Word)elf_hash(name), &ofl->ofl_verdesc)) ==
-	    (Ver_desc *)S_ERROR)
+	if ((vdp = ld_vers_desc(name, (Word)elf_hash(name),
+	    &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR)
 		return ((Ver_desc *)S_ERROR);
 
 	/*
@@ -990,7 +998,7 @@
  * themselves (ie,. NEEDED dependencies).
  */
 int
-vers_verify(Ofl_desc *ofl)
+ld_vers_verify(Ofl_desc *ofl)
 {
 	Listnode	*lnp1;
 	Sdf_desc	*sdf;
@@ -1050,15 +1058,16 @@
 
 				vip = &ifl->ifl_verndx[vdp->vd_ndx];
 				if (!(vip->vi_flags & FLG_VER_AVAIL)) {
-					eprintf(ERR_FATAL,
+					eprintf(ofl->ofl_lml, ERR_FATAL,
 					    MSG_INTL(MSG_VER_UNAVAIL),
 					    ifl->ifl_name, sdv->sdv_name,
 					    sdv->sdv_ref);
 					ofl->ofl_flags |= FLG_OF_FATAL;
 				}
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST),
-				    ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref);
+				eprintf(ofl->ofl_lml, ERR_FATAL,
+				    MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name,
+				    sdv->sdv_name, sdv->sdv_ref);
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
 		}
--- a/usr/src/cmd/sgs/libld/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,104 +18,69 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-BASEPLAT=	i386
-
-include		$(SRC)/cmd/sgs/libld/Makefile.com
-COPTFLAG=
-
-LIB64=		libld.so.3
-$(LIB64) :=	SONAME = $(LIB64)
-
-L_MACHSRCS32=	machrel.c machsym.c
-L_MACHSRCS64=	../amd64/machrel.c machsym.c ../amd64/amd64unwind.c \
-		../../tools/common/leb128.c
-
-CHKSRCS =  machrel.c ../amd64/machrel.c ../amd64/amd64unwind.c \
-	    ../../tools/common/leb128.c
+E_TOOLOBJS =	leb128.o
+L_MACHOBJS32 =	machrel.intel32.o	machsym.intel32.o
+L_MACHOBJS64 =	machrel.amd64.o		machsym.intel64.o	unwind.amd64.o
 
-PICS64=		$(OBJECTS:%=pics64/%) pics64/amd64unwind.o pics64/leb128.o
-$(PICS64) :=	i386_CFLAGS += $(C_PICFLAGS)
-CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64)
-$(PICS64)  :=	CFLAGS += $(CTF_FLAGS)
-$(PICS64)  :=	CFLAGS64 += $(CTF_FLAGS)
-$(PICS64)  :=	CTFCONVERT_POST = $(CTFCONVERT_O)
-$(LIB64)   :=	CTFMERGE_POST = $(CTFMERGE_LIB64)
-$(PICS64) :=	CPPFLAGS +=	-I../../../../uts/intel/amd64/krtld
-$(PICS64) :=	CPPFLAGS += -DELF_TARGET_AMD64
-
-SGSMSGTARG +=	$(SGSMSGINTEL)
-
-.PARALLEL:	$(PICS64)
-
-ROOTFS_DYNLIB64=	$(ROOTFS_LIBDIR)/$(LIB64)
-$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
-
-$(PICS) :=	CPPFLAGS += -I../../../../uts/$(PLAT)/krtld
-$(LINTOUT32) :=	CPPFLAGS += -I../../../../uts/$(PLAT)/krtld
-$(LINTOUT64) :=	CPPFLAGS += -I../../../../uts/$(PLAT)/krtld \
-		-DELF_TARGET_AMD64
+include		../Makefile.com
 
 .KEEP_STATE:
 
-all:		$(DYNLIB) $(LIBLINKS) $(LIB64)
-
-$(LIB64) $(SGSPROTO)/$(LIB64): \
-		pics64 .WAIT $$(PICS64) $(MAPFILES)
-		$(CC) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS64) $(LDLIBS)
-		$(POST_PROCESS_SO)
-
-native:		$(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64)
-
-native-proto:
-		-@mkdir -p proto/$(MACH) proto/$(MACH64)
-
-
-lint:		$(LINTLIB64) $(LINTOUT64)
-.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
+SGSMSGCHK =	../common/libld.chk.msg
+SGSMSGTARG +=	$(SGSMSGINTEL)
 
-pics64:
-		-@mkdir -p $@
-
-clean: clean64
-
-clean64:
-		-$(RM) $(PICS64)
+#
+# For cross-compilation, it is necessary to trigger the correct include files
+# (see sys/elf.h).
+#
+ELFTARGET64 =	-DELF_TARGET_AMD64
+ELFTARGET32 =	-DELF_TARGET_386
 
-clobber:	clobber64
-
-clobber64:
-		-$(RM) $(LIB64)
-
-delete:
-		$(RM) $(DYNLIB) $(LIB64)
+all:		$(DYNLIB) $(LIBLINKS)
 
 install \
-package:	all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64)
+package:	all $(ROOTFS_DYNLIB)
+
+include		../Makefile.targ
+
+# Associate ELF32 and ELF64 objects to the appropriate headers.
+
+pics/%32.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld
+pics/%64.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld
+
+# Associate the various lint targets with the appropriate headers/files.
 
-#
-# Grab 64bit amd64 files for libld.so.3
-#
-pics64/amd64unwind.o: ../amd64/amd64unwind.c
-		$(COMPILE.c) -o $@ -D_ELF64 ../amd64/amd64unwind.c
+$(LINTOUT32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \
+		    $(ELFTARGET32)
+$(LINTOUT64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+$(LINTLIB32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \
+		    $(ELFTARGET32)
+$(LINTLIB64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+
+LINTSRCS32 +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c)
+LINTSRCS64 +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c)
+
+# Compensate chkmsg with the doreloc family.
+
+CHKSRCS +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c)
+CHKSRCS +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c)
+
+pics/%32.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
 		$(POST_PROCESS_O)
 
-pics64/machrel.o: ../amd64/machrel.c
-		$(COMPILE.c) -o $@ -D_ELF64 ../amd64/machrel.c
+pics/%64.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
 		$(POST_PROCESS_O)
-
-include		$(SRC)/cmd/sgs/libld/Makefile.targ
-
-pics64/%.o:	$(SRCBASE)/uts/intel/amd64/krtld/%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
-		$(POST_PROCESS_O)
-
-pics/%.o:	$(SRCBASE)/uts/$(PLAT)/krtld/%.c
-		$(COMPILE.c) -o $@ $<
-		$(POST_PROCESS_O)
--- a/usr/src/cmd/sgs/libld/i386/machrel.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1583 +0,0 @@
-/*
- * 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.
- *
- * 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 (c) 1990, 1991 UNIX System Laboratories, Inc.
- *	Copyright (c) 1988 AT&T
- *	  All Rights Reserved
- *
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<string.h>
-#include	<stdio.h>
-#include	<sys/elf_386.h>
-#include	"debug.h"
-#include	"reloc.h"
-#include	"msg.h"
-#include	"_libld.h"
-
-Word
-init_rel(Rel_desc *reld, void *reloc)
-{
-	Rel *	rel = (Rel *)reloc;
-
-	/* LINTED */
-	reld->rel_rtype = (Word)ELF_R_TYPE(rel->r_info);
-	reld->rel_roffset = rel->r_offset;
-	reld->rel_raddend = 0;
-	reld->rel_typedata = 0;
-
-	return ((Word)ELF_R_SYM(rel->r_info));
-}
-
-void
-mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
-{
-	ofl->ofl_e_flags |= ehdr->e_flags;
-}
-
-void
-mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		/*
-		 * Create this entry if we are going to create a PLT table.
-		 */
-		if (ofl->ofl_pltcnt)
-			(*cnt)++;		/* DT_PLTGOT */
-	}
-}
-
-void
-mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		if (ofl->ofl_pltcnt) {
-			(*dyn)->d_tag = DT_PLTGOT;
-			(*dyn)->d_un.d_ptr = fillin_gotplt2(ofl);
-			(*dyn)++;
-		}
-	}
-}
-
-Xword
-calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
-{
-	Xword	value;
-
-	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
-	    M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) * M_PLT_ENTSIZE);
-	return (value);
-}
-
-/*
- *  Build a single plt entry - code is:
- *	if (building a.out)
- *		JMP	*got_off
- *	else
- *		JMP	*got_off@GOT(%ebx)
- *	PUSHL	&rel_off
- *	JMP	-n(%pc)		# -n is pcrel offset to first plt entry
- *
- *	The got_off@GOT entry gets filled with the address of the PUSHL,
- *	so the first pass through the plt jumps back here, jumping
- *	in turn to the first plt entry, which jumps to the dynamic
- *	linker.	 The dynamic linker then patches the GOT, rerouting
- *	future plt calls to the proper destination.
- */
-static void
-plt_entry(Ofl_desc * ofl, Word rel_off, Sym_desc * sdp)
-{
-	uchar_t		*pltent, *gotent;
-	Sword		plt_off;
-	Word		got_off;
-
-	got_off = sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
-	plt_off = M_PLT_RESERVSZ + ((sdp->sd_aux->sa_PLTndx - 1) *
-	    M_PLT_ENTSIZE);
-	pltent = (uchar_t *)(ofl->ofl_osplt->os_outdata->d_buf) + plt_off;
-	gotent = (uchar_t *)(ofl->ofl_osgot->os_outdata->d_buf) + got_off;
-
-	/*
-	 * Fill in the got entry with the address of the next instruction.
-	 */
-	/* LINTED */
-	*(Word *)gotent = ofl->ofl_osplt->os_shdr->sh_addr + plt_off +
-	    M_PLT_INSSIZE;
-
-	if (!(ofl->ofl_flags & FLG_OF_SHAROBJ)) {
-		pltent[0] = M_SPECIAL_INST;
-		pltent[1] = M_JMP_DISP_IND;
-		pltent += 2;
-		/* LINTED */
-		*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->sh_addr +
-			got_off);
-	} else {
-		pltent[0] = M_SPECIAL_INST;
-		pltent[1] = M_JMP_REG_DISP_IND;
-		pltent += 2;
-		/* LINTED */
-		*(Word *)pltent = (Word)got_off;
-	}
-	pltent += 4;
-
-	pltent[0] = M_INST_PUSHL;
-	pltent++;
-	/* LINTED */
-	*(Word *)pltent = (Word)rel_off;
-	pltent += 4;
-
-	plt_off = -(plt_off + 16);	/* JMP, PUSHL, JMP take 16 bytes */
-	pltent[0] = M_INST_JMP;
-	pltent++;
-	/* LINTED */
-	*(Word *)pltent = (Word)plt_off;
-}
-
-uintptr_t
-perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
-{
-	Os_desc *	relosp, * osp = 0;
-	Word		ndx, roffset, value;
-	Rel		rea;
-	char		*relbits;
-	Sym_desc *	sdp, * psym = (Sym_desc *)0;
-	int		sectmoved = 0;
-
-	sdp = orsp->rel_sym;
-
-	/*
-	 * If the section this relocation is against has been discarded
-	 * (-zignore), then also discard (skip) the relocation itself.
-	 */
-	if (orsp->rel_isdesc && ((orsp->rel_flags &
-	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
-	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
-		DBG_CALL(Dbg_reloc_discard(M_MACH, orsp));
-		return (1);
-	}
-
-	/*
-	 * If this is a relocation against a move table, or expanded move
-	 * table, adjust the relocation entries.
-	 */
-	if (orsp->rel_move)
-		adj_movereloc(ofl, orsp);
-
-	/*
-	 * If this is a relocation against a section using a partial initialized
-	 * symbol, adjust the embedded symbol info.
-	 *
-	 * The second argument of the am_I_partial() is the value stored at the
-	 * target address relocation is going to be applied.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
-		if (ofl->ofl_parsym.head &&
-		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-		    /* LINTED */
-		    (psym = am_I_partial(orsp, *(Xword *)
-		    ((uchar_t *)(orsp->rel_isdesc->is_indata->d_buf) +
-		    orsp->rel_roffset)))) {
-			DBG_CALL(Dbg_move_outsctadj(psym));
-			sectmoved = 1;
-		    }
-	}
-
-	value = sdp->sd_sym->st_value;
-
-	if (orsp->rel_flags & FLG_REL_GOT) {
-		osp = ofl->ofl_osgot;
-		roffset = (Word)calc_got_offset(orsp, ofl);
-	} else if (orsp->rel_flags & FLG_REL_PLT) {
-		/*
-		 * Note that relocations for PLT's actually
-		 * cause a relocation againt the GOT.
-		 */
-		osp = ofl->ofl_osplt;
-		roffset = (Word) (ofl->ofl_osgot->os_shdr->sh_addr) +
-		    sdp->sd_aux->sa_PLTGOTndx * M_GOT_ENTSIZE;
-
-		plt_entry(ofl, osp->os_relosdesc->os_szoutrels, sdp);
-
-	} else if (orsp->rel_flags & FLG_REL_BSS) {
-		/*
-		 * This must be a R_386_COPY.  For these set the roffset to
-		 * point to the new symbols location.
-		 */
-		osp = ofl->ofl_isbss->is_osdesc;
-		roffset = (Word)value;
-	} else {
-		osp = orsp->rel_osdesc;
-
-		/*
-		 * Calculate virtual offset of reference point; equals offset
-		 * into section + vaddr of section for loadable sections, or
-		 * offset plus section displacement for nonloadable sections.
-		 */
-		roffset = orsp->rel_roffset +
-		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
-		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
-			roffset += orsp->rel_isdesc->is_osdesc->
-			    os_shdr->sh_addr;
-	}
-
-	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
-		relosp = ofl->ofl_osrel;
-
-	/*
-	 * Assign the symbols index for the output relocation.  If the
-	 * relocation refers to a SECTION symbol then it's index is based upon
-	 * the output sections symbols index.  Otherwise the index can be
-	 * derived from the symbols index itself.
-	 */
-	if (orsp->rel_rtype == R_386_RELATIVE)
-		ndx = STN_UNDEF;
-	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
-		if (sectmoved == 0) {
-			/*
-			 * Check for a null input section. This can
-			 * occur if this relocation references a symbol
-			 * generated by sym_add_sym().
-			 */
-			if ((sdp->sd_isc != 0) &&
-			    (sdp->sd_isc->is_osdesc != 0))
-				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
-			else
-				ndx = sdp->sd_shndx;
-		} else
-			ndx = ofl->ofl_sunwdata1ndx;
-	} else
-		ndx = sdp->sd_symndx;
-
-	relbits = (char *)relosp->os_outdata->d_buf;
-
-	rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype);
-	rea.r_offset = roffset;
-	DBG_CALL(Dbg_reloc_out(M_MACH, SHT_REL, &rea, orsp->rel_sname,
-	    relosp->os_name));
-
-	/*
-	 * Assert we haven't walked off the end of our relocation table.
-	 */
-	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
-
-	(void) memcpy((relbits + relosp->os_szoutrels),
-	    (char *)&rea, sizeof (Rel));
-	relosp->os_szoutrels += sizeof (Rel);
-
-	/*
-	 * Determine if this relocation is against a non-writable, allocatable
-	 * section.  If so we may need to provide a text relocation diagnostic.
-	 * Note that relocations against the .plt (R_386_JMP_SLOT) actually
-	 * result in modifications to the .got.
-	 */
-	if (orsp->rel_rtype == R_386_JMP_SLOT)
-		osp = ofl->ofl_osgot;
-
-	reloc_remain_entry(orsp, osp, ofl);
-	return (1);
-}
-
-/*
- * i386 Instructions for TLS processing
- */
-static uchar_t tlsinstr_gd_ie[] = {
-	/*
-	 * 0x00	movl %gs:0x0, %eax
-	 */
-	0x65, 0xa1, 0x00, 0x00, 0x00, 0x00,
-	/*
-	 * 0x06	addl x(%eax), %eax
-	 * 0x0c ...
-	 */
-	0x03, 0x80, 0x00, 0x00, 0x00, 0x00
-};
-
-static uchar_t tlsinstr_gd_le[] = {
-	/*
-	 * 0x00 movl %gs:0x0, %eax
-	 */
-	0x65, 0xa1, 0x00, 0x00, 0x00, 0x00,
-	/*
-	 * 0x06 addl $0x0, %eax
-	 */
-	0x05, 0x00, 0x00, 0x00, 0x00,
-	/*
-	 * 0x0b nop
-	 * 0x0c
-	 */
-	0x90
-};
-
-static uchar_t tlsinstr_gd_ie_movgs[] = {
-	/*
-	 *	movl %gs:0x0,%eax
-	 */
-	0x65, 0xa1, 0x00, 0x00, 0x00, 00
-};
-
-#define	TLS_GD_IE_MOV	0x8b	/* movl opcode */
-#define	TLS_GD_IE_POP	0x58	/* popl + reg */
-
-#define	TLS_GD_LE_MOVL	0xb8	/* movl + reg */
-
-#define	TLS_NOP		0x90	/* NOP instruction */
-
-#define	MODRM_MSK_MOD	0xc0
-#define	MODRM_MSK_RO	0x38
-#define	MODRM_MSK_RM	0x07
-
-#define	SIB_MSK_SS	0xc0
-#define	SIB_MSK_IND	0x38
-#define	SIB_MSK_BS	0x07
-
-
-Fixupret
-tls_fixups(Rel_desc *arsp)
-{
-	Sym_desc	*sdp = arsp->rel_sym;
-	Word		rtype = arsp->rel_rtype;
-	uchar_t		*offset, r1, r2;
-
-	offset = (uchar_t *)((uintptr_t)arsp->rel_roffset +
-	    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
-	    (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
-
-	if (sdp->sd_ref == REF_DYN_NEED) {
-		/*
-		 * IE reference model
-		 */
-		switch (rtype) {
-		case R_386_TLS_GD:
-			/*
-			 * Transition:
-			 *	0x0 leal x@tlsgd(,r1,1), %eax
-			 *	0x7 call ___tls_get_addr
-			 *	0xc
-			 * To:
-			 *	0x0 movl %gs:0, %eax
-			 *	0x6 addl x@gotntpoff(r1), %eax
-			 */
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_386_TLS_GOTIE,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			arsp->rel_rtype = R_386_TLS_GOTIE;
-			arsp->rel_roffset += 5;
-			/*
-			 * Addjust 'offset' to beginning of instruction
-			 * sequence.
-			 */
-			offset -= 3;
-			r1 = (offset[2] & SIB_MSK_IND) >> 3;
-			(void) memcpy(offset, tlsinstr_gd_ie,
-				sizeof (tlsinstr_gd_ie));
-			/*
-			 * set register %r1 into the addl
-			 * instruction.
-			 */
-			offset[0x7] |= r1;
-			return (FIX_RELOC);
-		case R_386_TLS_GD_PLT:
-			/*
-			 * Fixup done via the TLS_GD relocation
-			 */
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_386_NONE,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			return (FIX_DONE);
-		}
-	}
-
-	/*
-	 * LE reference model
-	 */
-	switch (rtype) {
-	case R_386_TLS_GD:
-		/*
-		 * Transition:
-		 *	0x0 leal x@tlsgd(,r1,1), %eax
-		 *	0x7 call ___tls_get_addr
-		 *	0xc
-		 * To:
-		 *	0x0 movl %gs:0, %eax
-		 *	0x6 addl $x@ntpoff, %eax
-		 *	0xb nop
-		 *	0xc
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_TLS_LE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-
-		arsp->rel_rtype = R_386_TLS_LE;
-		arsp->rel_roffset += 4;
-		/*
-		 * Addjust 'offset' to beginning of instruction
-		 * sequence.
-		 */
-		offset -= 3;
-		(void) memcpy(offset, tlsinstr_gd_le,
-			sizeof (tlsinstr_gd_le));
-		return (FIX_RELOC);
-	case R_386_TLS_GD_PLT:
-	case R_386_PLT32:
-		/*
-		 * Fixup done via the TLS_GD relocation
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		return (FIX_DONE);
-	case R_386_TLS_LDM_PLT:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		/*
-		 * Transition:
-		 *	call __tls_get_addr()
-		 * to:
-		 *	nop
-		 *	nop
-		 *	nop
-		 *	nop
-		 *	nop
-		 */
-		*(offset - 1) = TLS_NOP;
-		*(offset) = TLS_NOP;
-		*(offset + 1) = TLS_NOP;
-		*(offset + 2) = TLS_NOP;
-		*(offset + 3) = TLS_NOP;
-		return (FIX_DONE);
-	case R_386_TLS_LDM:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		/*
-		 * Transition:
-		 *
-		 *  0x00 leal x1@tlsldm(%ebx), %eax
-		 *  0x06 call ___tls_get_addr
-		 *
-		 * to:
-		 *
-		 *  0x00 movl %gs:0, %eax
-		 */
-		(void) memcpy(offset - 2, tlsinstr_gd_ie_movgs,
-			sizeof (tlsinstr_gd_ie_movgs));
-		return (FIX_DONE);
-	case R_386_TLS_LDO_32:
-		/*
-		 *
-		 *  Instructions:
-		 *
-		 *  0x10 leal x1@dtpoff(%eax), %edx	R_386_TLS_LDO_32
-		 *		to
-		 *  0x10 leal x1@ntpoff(%eax), %edx	R_386_TLS_LE
-		 *
-		 */
-		offset -= 2;
-
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_TLS_LE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_386_TLS_LE;
-		return (FIX_RELOC);
-	case R_386_TLS_GOTIE:
-		/*
-		 * These transitions are a little different than the
-		 * others, in that we could have multiple instructions
-		 * pointed to by a single relocation.  Depending upon the
-		 * instruction, we perform a different code transition.
-		 *
-		 * Here's the known transitions:
-		 *
-		 *  1) movl foo@gotntpoff(%reg1), %reg2
-		 *	0x8b, 0x80 | (reg2 << 3) | reg1, foo@gotntpoff
-		 *
-		 *  2) addl foo@gotntpoff(%reg1), %reg2
-		 *	0x03, 0x80 | (reg2 << 3) | reg1, foo@gotntpoff
-		 *
-		 *  Transitions IE -> LE
-		 *
-		 *  1) movl $foo@ntpoff, %reg2
-		 *	0xc7, 0xc0 | reg2, foo@ntpoff
-		 *
-		 *  2) addl $foo@ntpoff, %reg2
-		 *	0x81, 0xc0 | reg2, foo@ntpoff
-		 *
-		 *
-		 * Note: reg1 != 4 (%esp)
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_386_TLS_LE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_386_TLS_LE;
-		offset -= 2;
-		r2 = (offset[1] & MODRM_MSK_RO) >> 3;
-		if (offset[0] == 0x8b) {
-			/* case 1 above */
-			offset[0] = 0xc7;	/* movl */
-			offset[1] = 0xc0 | r2;
-			return (FIX_RELOC);
-		}
-
-		if (offset[0] == 0x03) {
-			/* case 2 above */
-			assert(offset[0] == 0x03);
-			offset[0] = 0x81;	/* addl */
-			offset[1] = 0xc0 | r2;
-			return (FIX_RELOC);
-		}
-
-		/*
-		 * Unexpected instruction sequence - fatal error.
-		 */
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS),
-		    conv_reloc_386_type_str(arsp->rel_rtype),
-		    arsp->rel_isdesc->is_file->ifl_name,
-		    demangle(arsp->rel_sname), arsp->rel_isdesc->is_name,
-		    EC_OFF(arsp->rel_roffset));
-		return (FIX_ERROR);
-	case R_386_TLS_IE:
-		/*
-		 * These transitions are a little different than the
-		 * others, in that we could have multiple instructions
-		 * pointed to by a single relocation.  Depending upon the
-		 * instruction, we perform a different code transition.
-		 *
-		 * Here's the known transitions:
-		 *  1) movl foo@indntpoff, %eax
-		 *	0xa1, foo@indntpoff
-		 *
-		 *  2) movl foo@indntpoff, %eax
-		 *	0x8b, 0x05 | (reg << 3), foo@gotntpoff
-		 *
-		 *  3) addl foo@indntpoff, %eax
-		 *	0x03, 0x05 | (reg << 3), foo@gotntpoff
-		 *
-		 *  Transitions IE -> LE
-		 *
-		 *  1) movl $foo@ntpoff, %eax
-		 *	0xb8, foo@ntpoff
-		 *
-		 *  2) movl $foo@ntpoff, %reg
-		 *	0xc7, 0xc0 | reg, foo@ntpoff
-		 *
-		 *  3) addl $foo@ntpoff, %reg
-		 *	0x81, 0xc0 | reg, foo@ntpoff
-		 */
-		arsp->rel_rtype = R_386_TLS_LE;
-		offset--;
-		if (offset[0] == 0xa1) {
-			/* case 1 above */
-			offset[0] = 0xb8;	/*  movl */
-			return (FIX_RELOC);
-		}
-
-		offset--;
-		if (offset[0] == 0x8b) {
-			/* case 2 above */
-			r2 = (offset[1] & MODRM_MSK_RO) >> 3;
-			offset[0] = 0xc7;	/* movl */
-			offset[1] = 0xc0 | r2;
-			return (FIX_RELOC);
-		}
-		if (offset[0] == 0x03) {
-			/* case 3 above */
-			r2 = (offset[1] & MODRM_MSK_RO) >> 3;
-			offset[0] = 0x81;	/* addl */
-			offset[1] = 0xc0 | r2;
-			return (FIX_RELOC);
-		}
-		/*
-		 * Unexpected instruction sequence - fatal error.
-		 */
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS),
-		    conv_reloc_386_type_str(arsp->rel_rtype),
-		    arsp->rel_isdesc->is_file->ifl_name,
-		    demangle(arsp->rel_sname), arsp->rel_isdesc->is_name,
-		    EC_OFF(arsp->rel_roffset));
-		return (FIX_ERROR);
-	}
-	return (FIX_RELOC);
-}
-
-uintptr_t
-do_activerelocs(Ofl_desc *ofl)
-{
-	Rel_desc	*arsp;
-	Rel_cache	*rcp;
-	Listnode	*lnp;
-	uintptr_t	return_code = 1;
-	Word		flags = ofl->ofl_flags;
-	Word		dtflags1 = ofl->ofl_dtflags_1;
-
-	DBG_CALL(Dbg_reloc_doactiverel());
-	/*
-	 * Process active relocations.
-	 */
-	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
-		/* LINTED */
-		for (arsp = (Rel_desc *)(rcp + 1);
-		    arsp < rcp->rc_free; arsp++) {
-			uchar_t		*addr;
-			Xword 		value;
-			Sym_desc	*sdp;
-			const char	*ifl_name;
-			Xword		refaddr;
-			int		moved = 0;
-			Gotref		gref;
-
-			/*
-			 * If the section this relocation is against has been
-			 * discarded (-zignore), then discard (skip) the
-			 * relocation itself.
-			 */
-			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
-			    ((arsp->rel_flags &
-			    (FLG_REL_GOT | FLG_REL_BSS |
-			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
-				DBG_CALL(Dbg_reloc_discard(M_MACH, arsp));
-				continue;
-			}
-
-			/*
-			 * We deteremine what the 'got reference'
-			 * model (if required) is at this point.  This
-			 * needs to be done before tls_fixup() since
-			 * it may 'transition' our instructions.
-			 *
-			 * The got table entries have already been assigned,
-			 * and we bind to those initial entries.
-			 */
-			if (arsp->rel_flags & FLG_REL_DTLS)
-				gref = GOT_REF_TLSGD;
-			else if (arsp->rel_flags & FLG_REL_MTLS)
-				gref = GOT_REF_TLSLD;
-			else if (arsp->rel_flags & FLG_REL_STLS)
-				gref = GOT_REF_TLSIE;
-			else
-				gref = GOT_REF_GENERIC;
-
-			/*
-			 * Perform any required TLS fixups.
-			 */
-			if (arsp->rel_flags & FLG_REL_TLSFIX) {
-				Fixupret	ret;
-
-				if ((ret = tls_fixups(arsp)) == FIX_ERROR)
-					return (S_ERROR);
-				if (ret == FIX_DONE)
-					continue;
-			}
-
-			/*
-			 * If this is a relocation against a move table, or
-			 * expanded move table, adjust the relocation entries.
-			 */
-			if (arsp->rel_move)
-				adj_movereloc(ofl, arsp);
-
-			sdp = arsp->rel_sym;
-			refaddr = arsp->rel_roffset +
-			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
-
-			if (arsp->rel_flags & FLG_REL_CLVAL)
-				value = 0;
-			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
-			    STT_SECTION) {
-				Sym_desc	*sym;
-
-				/*
-				 * The value for a symbol pointing to a SECTION
-				 * is based off of that sections position.
-				 *
-				 * The second argument of the am_I_partial() is
-				 * the value stored at the target address
-				 * relocation is going to be applied.
-				 */
-				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-				    /* LINTED */
-				    (sym = am_I_partial(arsp, *(Xword *)
-				    ((uchar_t *)
-				    arsp->rel_isdesc->is_indata->d_buf +
-				    arsp->rel_roffset)))) {
-					/*
-					 * If the symbol is moved,
-					 * adjust the value
-					 */
-					value = sym->sd_sym->st_value;
-					moved = 1;
-				} else {
-					value = _elf_getxoff(
-					    sdp->sd_isc->is_indata);
-					if (sdp->sd_isc->is_shdr->sh_flags &
-					    SHF_ALLOC)
-						value += sdp->sd_isc->
-						    is_osdesc->os_shdr->sh_addr;
-				}
-				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
-					value -= ofl->ofl_tlsphdr->p_vaddr;
-			} else {
-				/*
-				 * else the value is the symbols value
-				 */
-				value = sdp->sd_sym->st_value;
-			}
-
-			/*
-			 * Relocation against the GLOBAL_OFFSET_TABLE.
-			 */
-			if (arsp->rel_flags & FLG_REL_GOT)
-				arsp->rel_osdesc = ofl->ofl_osgot;
-
-			/*
-			 * If loadable and not producing a relocatable object
-			 * add the sections virtual address to the reference
-			 * address.
-			 */
-			if ((arsp->rel_flags & FLG_REL_LOAD) &&
-			    ((flags & FLG_OF_RELOBJ) == 0))
-				refaddr += arsp->rel_isdesc->is_osdesc->
-				    os_shdr->sh_addr;
-
-			/*
-			 * If this entry has a PLT assigned to it, it's
-			 * value is actually the address of the PLT (and
-			 * not the address of the function).
-			 */
-			if (IS_PLT(arsp->rel_rtype)) {
-				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
-					value = calc_plt_addr(sdp, ofl);
-			}
-
-			/*
-			 * Determine whether the value needs further adjustment.
-			 * Filter through the attributes of the relocation to
-			 * determine what adjustment is required.  Note, many
-			 * of the following cases are only applicable when a
-			 * .got is present.  As a .got is not generated when a
-			 * relocatable object is being built, any adjustments
-			 * that require a .got need to be skipped.
-			 */
-			if ((arsp->rel_flags & FLG_REL_GOT) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword		R1addr;
-				uintptr_t	R2addr;
-				Word		gotndx;
-				Gotndx		*gnp;
-
-				/*
-				 * Perform relocation against GOT table.  Since
-				 * this doesn't fit exactly into a relocation
-				 * we place the appropriate byte in the GOT
-				 * directly
-				 *
-				 * Calculate offset into GOT at which to apply
-				 * the relocation.
-				 */
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, 0);
-				assert(gnp);
-
-				if (arsp->rel_rtype == R_386_TLS_DTPOFF32)
-					gotndx = gnp->gn_gotndx + 1;
-				else
-					gotndx = gnp->gn_gotndx;
-
-				R1addr = (Xword)(gotndx * M_GOT_ENTSIZE);
-
-				/*
-				 * Add the GOTs data's offset.
-				 */
-				R2addr = R1addr + (uintptr_t)
-				    arsp->rel_osdesc->os_outdata->d_buf;
-
-				DBG_CALL(Dbg_reloc_doact(M_MACH,
-				    arsp->rel_rtype, R1addr, value,
-				    arsp->rel_sname, arsp->rel_osdesc));
-
-				/*
-				 * And do it.
-				 */
-				*(Xword *)R2addr = value;
-				continue;
-
-			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				value -= ofl->ofl_osgot->os_shdr->sh_addr;
-
-			} else if (IS_GOT_PC(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				value =
-				    (Xword)(ofl->ofl_osgot->os_shdr->sh_addr) -
-				    refaddr;
-
-			} else if ((IS_PC_RELATIVE(arsp->rel_rtype)) &&
-			    (((flags & FLG_OF_RELOBJ) == 0) ||
-			    (arsp->rel_osdesc == sdp->sd_isc->is_osdesc))) {
-				value -= refaddr;
-
-			} else if (IS_TLS_INS(arsp->rel_rtype) &&
-			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx	*gnp;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, 0);
-				assert(gnp);
-				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
-				if (arsp->rel_rtype == R_386_TLS_IE) {
-					value +=
-					    ofl->ofl_osgot->os_shdr->sh_addr;
-				}
-
-			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx *gnp;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs),
-				    GOT_REF_GENERIC, ofl, 0);
-				assert(gnp);
-				value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE;
-
-			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword	tlsstatsize;
-
-				/*
-				 * This is the LE TLS reference model.  Static
-				 * offset is hard-coded.
-				 */
-				tlsstatsize =
-				    S_ROUND(ofl->ofl_tlsphdr->p_memsz,
-				    M_TLSSTATALIGN);
-				value = tlsstatsize - value;
-
-				/*
-				 * Since this code is fixed up, it assumes a
-				 * negative offset that can be added to the
-				 * thread pointer.
-				 */
-				if ((arsp->rel_rtype == R_386_TLS_LDO_32) ||
-				    (arsp->rel_rtype == R_386_TLS_LE))
-					value = -value;
-			}
-
-			if (arsp->rel_isdesc->is_file)
-				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
-			else
-				ifl_name = MSG_INTL(MSG_STR_NULL);
-
-			/*
-			 * Make sure we have data to relocate.  Compiler and
-			 * assembler developers have been known to generate
-			 * relocations against invalid sections (normally .bss),
-			 * so for their benefit give them sufficient information
-			 * to help analyze the problem.  End users should never
-			 * see this.
-			 */
-			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC),
-				    conv_reloc_386_type_str(arsp->rel_rtype),
-				    ifl_name, demangle(arsp->rel_sname),
-				    arsp->rel_isdesc->is_name);
-				return (S_ERROR);
-			}
-
-			/*
-			 * Get the address of the data item we need to modify.
-			 */
-			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
-			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
-			    is_indata));
-
-			DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype,
-			    (uintptr_t)addr, value, arsp->rel_sname,
-			    arsp->rel_osdesc));
-			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
-
-			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) >
-			    ofl->ofl_size) || (arsp->rel_roffset >
-			    arsp->rel_osdesc->os_shdr->sh_size)) {
-				int	class;
-
-				if (((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size)
-					class = ERR_FATAL;
-				else
-					class = ERR_WARNING;
-
-				eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET),
-				    conv_reloc_386_type_str(arsp->rel_rtype),
-				    ifl_name, arsp->rel_isdesc->is_name,
-				    demangle(arsp->rel_sname),
-				    EC_ADDR((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr));
-
-				if (class == ERR_FATAL) {
-					return_code = S_ERROR;
-					continue;
-				}
-			}
-
-			/*
-			 * The relocation is additive.  Ignore the previous
-			 * symbol value if this local partial symbol is
-			 * expanded.
-			 */
-			if (moved)
-				value -= *addr;
-
-			/*
-			 * If '-z noreloc' is specified - skip the do_reloc
-			 * stage.
-			 */
-			if ((flags & FLG_OF_RELOBJ) ||
-			    !(dtflags1 & DF_1_NORELOC)) {
-				if (do_reloc((uchar_t)arsp->rel_rtype,
-				    addr, &value, arsp->rel_sname,
-				    ifl_name) == 0)
-					return_code = S_ERROR;
-			}
-		}
-	}
-	return (return_code);
-}
-
-/*
- * Add an output relocation record.
- */
-uintptr_t
-add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
-{
-	Rel_desc	*orsp;
-	Rel_cache	*rcp;
-	Sym_desc	*sdp = rsp->rel_sym;
-
-	/*
-	 * Static executables *do not* want any relocations against them.
-	 * Since our engine still creates relocations against a WEAK UNDEFINED
-	 * symbol in a static executable, it's best to disable them here
-	 * instead of through out the relocation code.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
-		return (1);
-
-	/*
-	 * If no relocation cache structures are available allocate
-	 * a new one and link it into the cache list.
-	 */
-	if ((ofl->ofl_outrels.tail == 0) ||
-	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
-	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
-		static size_t	nextsize = 0;
-		size_t		size;
-
-		/*
-		 * Output relocation numbers can vary considerably between
-		 * building executables or shared objects (pic vs. non-pic),
-		 * etc.  But, they typically aren't very large, so for these
-		 * objects use a standard bucket size.  For building relocatable
-		 * objects, typically there will be an output relocation for
-		 * every input relocation.
-		 */
-		if (nextsize == 0) {
-			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
-				if ((size = ofl->ofl_relocincnt) == 0)
-					size = REL_LOIDESCNO;
-				if (size > REL_HOIDESCNO)
-					nextsize = REL_HOIDESCNO;
-				else
-					nextsize = REL_LOIDESCNO;
-			} else
-				nextsize = size = REL_HOIDESCNO;
-		} else
-			size = nextsize;
-
-		size = size * sizeof (Rel_desc);
-
-		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
-		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
-			return (S_ERROR);
-
-		/* LINTED */
-		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
-		/* LINTED */
-		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
-	}
-
-	/*
-	 * If we are adding a output relocation against a section
-	 * symbol (non-RELATIVE) then mark that section.  These sections
-	 * will be added to the .dynsym symbol table.
-	 */
-	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
-	    ((flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
-
-		/*
-		 * If this is a COMMON symbol - no output section
-		 * exists yet - (it's created as part of sym_validate()).
-		 * So - we mark here that when it's created it should
-		 * be tagged with the FLG_OS_OUTREL flag.
-		 */
-		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
-		    (sdp->sd_shndx == SHN_COMMON)) {
-			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
-				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
-			else
-				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
-		} else {
-			Os_desc	*osp = sdp->sd_isc->is_osdesc;
-
-			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
-				ofl->ofl_dynshdrcnt++;
-				osp->os_flags |= FLG_OS_OUTREL;
-			}
-		}
-	}
-
-	*orsp = *rsp;
-	orsp->rel_flags |= flags;
-
-	rcp->rc_free++;
-	ofl->ofl_outrelscnt++;
-
-	if (flags & FLG_REL_GOT)
-		ofl->ofl_relocgotsz += (Xword)sizeof (Rel);
-	else if (flags & FLG_REL_PLT)
-		ofl->ofl_relocpltsz += (Xword)sizeof (Rel);
-	else if (flags & FLG_REL_BSS)
-		ofl->ofl_relocbsssz += (Xword)sizeof (Rel);
-	else if (flags & FLG_REL_NOINFO)
-		ofl->ofl_relocrelsz += (Xword)sizeof (Rel);
-	else
-		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rel);
-
-	if (orsp->rel_rtype == M_R_RELATIVE)
-		ofl->ofl_relocrelcnt++;
-
-	/*
-	 * We don't perform sorting on PLT relocations because
-	 * they have already been assigned a PLT index and if we
-	 * were to sort them we would have to re-assign the plt indexes.
-	 */
-	if (!(flags & FLG_REL_PLT))
-		ofl->ofl_reloccnt++;
-
-	/*
-	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
-	 */
-	if (IS_GOT_REQUIRED(orsp->rel_rtype))
-		ofl->ofl_flags |= FLG_OF_BLDGOT;
-
-	/*
-	 * Identify and possibly warn of a displacement relocation.
-	 */
-	if (orsp->rel_flags & FLG_REL_DISP) {
-		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
-
-		if (ofl->ofl_flags & FLG_OF_VERBOSE)
-			disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
-	}
-	DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp));
-	return (1);
-}
-
-/*
- * Stub routine since register symbols are not supported on i386.
- */
-/* ARGSUSED */
-uintptr_t
-reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
-{
-	eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOREG));
-	return (S_ERROR);
-}
-
-/*
- * process relocation for a LOCAL symbol
- */
-uintptr_t
-reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		flags = ofl->ofl_flags;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		shndx = rsp->rel_sym->sd_shndx;
-
-	/*
-	 * if ((shared object) and (not pc relative relocation) and
-	 *    (not against ABS symbol))
-	 * then
-	 *	build R_386_RELATIVE
-	 * fi
-	 */
-	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
-	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
-	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
-	    !(rsp->rel_isdesc != NULL &&
-	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
-	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
-	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
-		Word	ortype = rsp->rel_rtype;
-
-		rsp->rel_rtype = R_386_RELATIVE;
-		if (add_outrel(NULL, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = ortype;
-	}
-
-	/*
-	 * If the relocation is against a 'non-allocatable' section
-	 * and we can not resolve it now - then give a warning
-	 * message.
-	 *
-	 * We can not resolve the symbol if either:
-	 *	a) it's undefined
-	 *	b) it's defined in a shared library and a
-	 *	   COPY relocation hasn't moved it to the executable
-	 *
-	 * Note: because we process all of the relocations against the
-	 *	text segment before any others - we know whether
-	 *	or not a copy relocation will be generated before
-	 *	we get here (see reloc_init()->reloc_segments()).
-	 */
-	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
-	    ((shndx == SHN_UNDEF) ||
-	    ((sdp->sd_ref == REF_DYN_NEED) &&
-	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
-		/*
-		 * If the relocation is against a SHT_SUNW_ANNOTATE
-		 * section - then silently ignore that the relocation
-		 * can not be resolved.
-		 */
-		if (rsp->rel_osdesc &&
-		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
-			return (0);
-		(void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
-		return (1);
-	}
-
-	/*
-	 * Perform relocation.
-	 */
-	return (add_actrel(NULL, rsp, ofl));
-}
-
-uintptr_t
-/* ARGSUSED */
-reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	/*
-	 * Stub routine for common code compatibility, we shouldn't
-	 * actually get here on x86.
-	 */
-	assert(0);
-	return (S_ERROR);
-}
-
-uintptr_t
-reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		rtype = rsp->rel_rtype;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		flags = ofl->ofl_flags;
-	Word		rflags;
-	Gotndx		*gnp;
-
-	/*
-	 * all TLS relocations are illegal in a static executable.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * Any TLS relocation must be against a STT_TLS symbol, all others
-	 * are illegal.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    conv_info_type_str(ofl->ofl_e_machine,
-		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
-		return (S_ERROR);
-	}
-
-	/*
-	 * We're a executable - use either the IE or LE
-	 * access model.
-	 */
-	if (flags & FLG_OF_EXEC) {
-		/*
-		 * If we are using either IE or LE reference
-		 * model set the DF_STATIC_TLS flag.
-		 */
-		ofl->ofl_dtflags |= DF_STATIC_TLS;
-
-		if (!local) {
-			Gotref	gref;
-			/*
-			 * IE access model
-			 */
-			/*
-			 * It's not possible for LD or LE reference
-			 * models to reference a symbol external to
-			 * the current object.
-			 */
-			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-				    conv_reloc_386_type_str(rsp->rel_rtype),
-				    rsp->rel_isdesc->is_file->ifl_name,
-				    demangle(rsp->rel_sname),
-				    sdp->sd_file->ifl_name);
-				return (S_ERROR);
-			}
-
-			gref = GOT_REF_TLSIE;
-
-			/*
-			 * Assign a GOT entry for static TLS references
-			 */
-			if ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-			    gref, ofl, 0)) == 0) {
-				if (assign_gotndx(&(sdp->sd_GOTndxs),
-				    gnp, gref, ofl, rsp, sdp) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = R_386_TLS_TPOFF;
-				if (add_outrel((FLG_REL_GOT | FLG_REL_STLS),
-				    rsp, ofl) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = rtype;
-			}
-			if (IS_TLS_IE(rtype))
-				return (add_actrel(FLG_REL_STLS, rsp, ofl));
-
-			/*
-			 * If (GD or LD) reference models - fixups
-			 * are required.
-			 */
-			return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
-			    rsp, ofl));
-		}
-		/*
-		 * LE access model
-		 */
-		if (IS_TLS_LE(rtype) || (rtype == R_386_TLS_LDO_32))
-			return (add_actrel(FLG_REL_STLS, rsp, ofl));
-
-		return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl));
-	}
-
-	/*
-	 * Building a shared object
-	 */
-
-	/*
-	 * Building a shared object - only GD & LD access models
-	 * will work here.
-	 */
-	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * LD access mode can only bind to local symbols.
-	 */
-	if (!local && IS_TLS_LD(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-		    conv_reloc_386_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    sdp->sd_file->ifl_name);
-		return (S_ERROR);
-	}
-
-
-	if (IS_TLS_LD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSLD, ofl, 0)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rflags = FLG_REL_GOT | FLG_REL_MTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-		rsp->rel_rtype = R_386_TLS_DTPMOD32;
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = rtype;
-	} else if (IS_TLS_GD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSGD, ofl, 0)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rflags = FLG_REL_GOT | FLG_REL_DTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-		rsp->rel_rtype = R_386_TLS_DTPMOD32;
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		if (local == TRUE) {
-			rsp->rel_rtype = R_386_TLS_DTPOFF32;
-			if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		} else {
-			rsp->rel_rtype = R_386_TLS_DTPOFF32;
-			if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		}
-		rsp->rel_rtype = rtype;
-	}
-	/*
-	 * For GD/LD TLS reference - TLS_{GD,LD}_CALL, this will eventually
-	 * cause a call to __tls_get_addr().  Let's convert this
-	 * relocation to that symbol now, and prepare for the PLT magic.
-	 */
-	if ((rtype == R_386_TLS_GD_PLT) || (rtype == R_386_TLS_LDM_PLT)) {
-		Sym_desc *	tlsgetsym;
-
-		if ((tlsgetsym = sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_UU),
-		    ofl)) == (Sym_desc *)S_ERROR)
-			return (S_ERROR);
-		rsp->rel_sym = tlsgetsym;
-		rsp->rel_sname = tlsgetsym->sd_name;
-		rsp->rel_rtype = R_386_PLT32;
-		if (reloc_plt(rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_sym = sdp;
-		rsp->rel_sname = sdp->sd_name;
-		rsp->rel_rtype = rtype;
-		return (1);
-	}
-
-	if (IS_TLS_LD(rtype))
-		return (add_actrel(FLG_REL_MTLS, rsp, ofl));
-
-	return (add_actrel(FLG_REL_DTLS, rsp, ofl));
-}
-
-/* ARGSUSED3 */
-Gotndx *
-find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
-{
-	Listnode *	lnp;
-	Gotndx *	gnp;
-
-	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
-		return (ofl->ofl_tlsldgotndx);
-
-	for (LIST_TRAVERSE(lst, lnp, gnp)) {
-		if (gnp->gn_gotref == gref)
-			return (gnp);
-	}
-	return ((Gotndx *)0);
-}
-
-Xword
-calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
-{
-	Os_desc		*osp = ofl->ofl_osgot;
-	Sym_desc	*sdp = rdesc->rel_sym;
-	Xword		gotndx;
-	Gotref		gref;
-	Gotndx		*gnp;
-
-	if (rdesc->rel_flags & FLG_REL_DTLS)
-		gref = GOT_REF_TLSGD;
-	else if (rdesc->rel_flags & FLG_REL_MTLS)
-		gref = GOT_REF_TLSLD;
-	else if (rdesc->rel_flags & FLG_REL_STLS)
-		gref = GOT_REF_TLSIE;
-	else
-		gref = GOT_REF_GENERIC;
-
-	gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0);
-	assert(gnp);
-
-	gotndx = (Xword)gnp->gn_gotndx;
-
-	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
-	    (rdesc->rel_rtype == R_386_TLS_DTPOFF32))
-		gotndx++;
-
-	return ((Xword)(osp->os_shdr->sh_addr + (gotndx * M_GOT_ENTSIZE)));
-}
-
-
-/* ARGSUSED4 */
-uintptr_t
-assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
-    Rel_desc * rsp, Sym_desc * sdp)
-{
-	Gotndx	*gnp;
-	uint_t	gotents;
-
-	if (pgnp)
-		return (1);
-
-	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
-		gotents = 2;
-	else
-		gotents = 1;
-
-	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
-		return (S_ERROR);
-	gnp->gn_gotndx = ofl->ofl_gotcnt;
-	gnp->gn_gotref = gref;
-
-	ofl->ofl_gotcnt += gotents;
-
-	if (gref == GOT_REF_TLSLD) {
-		ofl->ofl_tlsldgotndx = gnp;
-		return (1);
-	}
-
-	if (list_appendc(lst, (void *)gnp) == 0)
-		return (S_ERROR);
-
-	return (1);
-}
-
-
-void
-assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
-{
-	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
-	sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++;
-	ofl->ofl_flags |= FLG_OF_BLDGOT;
-}
-
-/*
- * Initializes .got[0] with the _DYNAMIC symbol value.
- */
-uintptr_t
-fillin_gotplt1(Ofl_desc * ofl)
-{
-	if (ofl->ofl_osgot) {
-		Sym_desc *	sdp;
-
-		if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
-			uchar_t	*genptr = ((uchar_t *)
-			    ofl->ofl_osgot->os_outdata->d_buf +
-			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
-			/* LINTED */
-			*(Word *)genptr = (Word)sdp->sd_sym->st_value;
-		}
-	}
-
-	/*
-	 * Fill in the reserved slot in the procedure linkage table the first
-	 * entry is:
-	 *  if (building a.out) {
-	 *	PUSHL	got[1]		    # the address of the link map entry
-	 *	JMP *	got[2]		    # the address of rtbinder
-	 *  } else {
-	 *	PUSHL	got[1]@GOT(%ebx)    # the address of the link map entry
-	 *	JMP *	got[2]@GOT(%ebx)    # the address of rtbinder
-	 *  }
-	 */
-	if ((ofl->ofl_flags & FLG_OF_DYNAMIC) && ofl->ofl_osplt) {
-		uchar_t *pltent;
-
-		pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
-		if (!(ofl->ofl_flags & FLG_OF_SHAROBJ)) {
-			pltent[0] = M_SPECIAL_INST;
-			pltent[1] = M_PUSHL_DISP;
-			pltent += 2;
-			/* LINTED */
-			*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->
-				sh_addr + M_GOT_XLINKMAP * M_GOT_ENTSIZE);
-			pltent += 4;
-			pltent[0] = M_SPECIAL_INST;
-			pltent[1] = M_JMP_DISP_IND;
-			pltent += 2;
-			/* LINTED */
-			*(Word *)pltent = (Word)(ofl->ofl_osgot->os_shdr->
-				sh_addr + M_GOT_XRTLD * M_GOT_ENTSIZE);
-		} else {
-			pltent[0] = M_SPECIAL_INST;
-			pltent[1] = M_PUSHL_REG_DISP;
-			pltent += 2;
-			/* LINTED */
-			*(Word *)pltent = (Word)(M_GOT_XLINKMAP *
-				M_GOT_ENTSIZE);
-			pltent += 4;
-			pltent[0] = M_SPECIAL_INST;
-			pltent[1] = M_JMP_REG_DISP_IND;
-			pltent += 2;
-			/* LINTED */
-			*(Word *)pltent = (Word)(M_GOT_XRTLD *
-				M_GOT_ENTSIZE);
-		}
-	}
-	return (1);
-}
-
-/*
- * Return got[0].
- */
-Addr
-fillin_gotplt2(Ofl_desc * ofl)
-{
-	if (ofl->ofl_osgot)
-		return (ofl->ofl_osgot->os_shdr->sh_addr);
-	else
-		return (0);
-}
--- a/usr/src/cmd/sgs/libld/i386/machsym.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * 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.
- *
- * 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 1998,2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<stdio.h>
-#include	"debug.h"
-#include	"_libld.h"
-
-
-/*
- * This file contains stub routines since currently register symbols
- * are not relevant to the i386 architecture.  But - having these
- * stub routines avoids #ifdefs in common codes - and I hate that.
- */
-/* ARGSUSED */
-int
-reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl,
-    Ofl_desc * ofl)
-{
-	return (1);
-}
-
-/* ARGSUSED */
-int
-mach_sym_typecheck(Sym_desc * sdp, Sym * nsym, Ifl_desc * ifl, Ofl_desc * ofl)
-{
-	return (0);
-}
-
-/* ARGSUSED */
-const char *
-is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx,
-    const char *symsecname, Word * flags)
-{
-	return (0);
-}
-
-/* ARGSUSED */
-Sym_desc *
-reg_find(Sym * sym, Ofl_desc * ofl)
-{
-	return (0);
-}
-
-/* ARGSUSED */
-int
-reg_enter(Sym_desc * sdp, Ofl_desc * ofl)
-{
-	return (0);
-}
--- a/usr/src/cmd/sgs/libld/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,84 +18,60 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-BASEPLAT=	sparc
-include		$(SRC)/cmd/sgs/libld/Makefile.com
-
-L_MACHSRCS32=	machrel.c machsym.c
-L_MACHSRCS64=	$(L_MACHSRCS32)
-CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h $(L_MACHSRCS32)
-
-LIB64=		libld.so.3
-$(LIB64) :=	SONAME = $(LIB64)
+L_MACHOBJS32 =	machrel.sparc32.o	machsym.sparc32.o
+L_MACHOBJS64 =	machrel.sparc64.o	machsym.sparc64.o
 
-PICS64=		$(OBJECTS:%=pics64/%)
-$(PICS64)  :=	sparc_CFLAGS += -xregs=no%appl -K pic
-$(PICS64)  :=	CFLAGS += $(CTF_FLAGS)
-$(PICS64)  :=	CFLAGS64 += $(CTF_FLAGS)
-$(PICS64)  :=	CTFCONVERT_POST = $(CTFCONVERT_O)
-CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64)
-$(LIB64)   :=	CTFMERGE_POST = $(CTFMERGE_LIB64)
-CPPFLAGS +=	-I../../../../uts/sparc/krtld
-
-SGSMSGTARG +=	$(SGSMSGSPARC)
-
-.PARALLEL:	$(PICS64)
-
-ROOTFS_DYNLIB64=	$(ROOTFS_LIBDIR)/$(LIB64)
-$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+include		../Makefile.com
 
 .KEEP_STATE:
 
-all:		$(DYNLIB) $(LIBLINKS) .WAIT $(LIB64)
-
-
-$(LIB64) $(SGSPROTO)/$(LIB64): \
-		pics64 .WAIT $$(PICS64) $(MAPFILES)
-		$(CC) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS)
-		$(POST_PROCESS_SO)
+SGSMSGTARG +=	$(SGSMSGSPARC)
 
-native:		$(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64)
-
-native-proto:
-		-@mkdir -p proto/$(MACH) proto/$(MACH64)
-
-lint:		$(LINTLIB64) $(LINTOUT64)
-.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
-
-pics64:
-		-@mkdir -p $@
+all:		$(DYNLIB) $(LIBLINKS)
 
 install \
-package:	all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64)
+package:	all $(ROOTFS_DYNLIB)
 
-
-clean: clean64
+include		../Makefile.targ
 
-clean64:
-		-$(RM) $(PICS64)
+# Associate ELF32 and ELF64 objects to the appropriate headers.
 
-clobber:	clobber64
+pics/%32.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
+pics/%64.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
+
+# Associate the various lint targets with the appropriate headers/files.
 
-clobber64:
-		-$(RM) $(LIB64)
-
-delete:
-		$(RM) $(DYNLIB) $(LIB64)
+$(LINTOUT32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET32)
+$(LINTOUT64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+$(LINTLIB32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET32)
+$(LINTLIB64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET64) -D_ELF64
 
+LINTSRCS32 +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+LINTSRCS64 +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
 
-include		$(SRC)/cmd/sgs/libld/Makefile.targ
+# Compensate chkmsg with the doreloc family.
 
-pics64/%.o:	$(SRCBASE)/uts/sparc/krtld/%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
+CHKSRCS +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+CHKSRCS +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+
+pics/%32.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SRCBASE)/uts/sparc/krtld/%.c
-		$(COMPILE.c) -o $@ $<
+pics/%64.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
 		$(POST_PROCESS_O)
--- a/usr/src/cmd/sgs/libld/sparc/machrel.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2128 +0,0 @@
-/*
- * 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.
- *
- * 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 (c) 1988 AT&T
- *	  All Rights Reserved
- *
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<string.h>
-#include	<stdio.h>
-#include	<sys/elf_SPARC.h>
-#include	<debug.h>
-#include	<reloc.h>
-#include	<msg.h>
-#include	<_libld.h>
-
-/*
- * Local Variable Definitions
- */
-static Sword neggotoffset = 0;		/* off. of GOT table from GOT symbol */
-static Sword smlgotcnt = M_GOT_XNumber;	/* no. of small GOT symbols */
-
-Word
-init_rel(Rel_desc *reld, void *reloc)
-{
-	Rela *	rela = (Rela *)reloc;
-
-	/* LINTED */
-	reld->rel_rtype = (Word)ELF_R_TYPE(rela->r_info);
-	reld->rel_roffset = rela->r_offset;
-	reld->rel_raddend = rela->r_addend;
-	reld->rel_typedata = (Word)ELF_R_TYPE_DATA(rela->r_info);
-
-	reld->rel_flags |= FLG_REL_RELA;
-
-	return ((Word)ELF_R_SYM(rela->r_info));
-}
-
-void
-mach_eflags(Ehdr *ehdr, Ofl_desc *ofl)
-{
-	Word		eflags = ofl->ofl_e_flags;
-	Word		memopt1, memopt2;
-	static int	firstpass;
-
-	/*
-	 * If a *PLUS relocatable is included, the output object is type *PLUS.
-	 */
-	if ((ehdr->e_machine == EM_SPARC32PLUS) &&
-	    (ehdr->e_flags & EF_SPARC_32PLUS))
-		ofl->ofl_e_machine = EM_SPARC32PLUS;
-
-	/*
-	 * On the first pass, we don't yet have a memory model to compare
-	 * against, therefore the initial file becomes our baseline.  Subsequent
-	 * passes will do the comparison described below.
-	 */
-	if (firstpass == 0) {
-		ofl->ofl_e_flags |= ehdr->e_flags;
-		firstpass++;
-		return;
-	}
-
-	/*
-	 * Determine which memory model to mark the binary with.  The options
-	 * are (most restrictive to least):
-	 *
-	 *	EF_SPARCV9_TSO		0x0 	Total Store Order
-	 *	EF_SPARCV9_PSO		0x1	Partial Store Order
-	 *	EF_SPARCV9_RMO		0x2	Relaxed Memory Order
-	 *
-	 * Mark the binary with the most restrictive option encountered from a
-	 * relocatable object included in the link.
-	 */
-	eflags |= (ehdr->e_flags & ~EF_SPARCV9_MM);
-	memopt1 = eflags & EF_SPARCV9_MM;
-	memopt2 = ehdr->e_flags & EF_SPARCV9_MM;
-	eflags &= ~EF_SPARCV9_MM;
-
-	if ((memopt1 == EF_SPARCV9_TSO) || (memopt2 == EF_SPARCV9_TSO))
-		/* EMPTY */
-		;
-	else if ((memopt1 == EF_SPARCV9_PSO) || (memopt2 == EF_SPARCV9_PSO))
-		eflags |= EF_SPARCV9_PSO;
-	else
-		eflags |= EF_SPARCV9_RMO;
-
-	ofl->ofl_e_flags = eflags;
-}
-
-void
-mach_make_dynamic(Ofl_desc *ofl, size_t *cnt)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		/*
-		 * Create this entry if we are going to create a PLT table.
-		 */
-		if (ofl->ofl_pltcnt)
-			(*cnt)++;		/* DT_PLTGOT */
-	}
-}
-
-void
-mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn)
-{
-	if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) {
-		if (ofl->ofl_pltcnt) {
-			(*dyn)->d_tag = DT_PLTGOT;
-			(*dyn)->d_un.d_ptr = fillin_gotplt2(ofl);
-			(*dyn)++;
-		}
-	}
-}
-
-#if	defined(_ELF64)
-
-Xword
-calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
-{
-	Xword	value, pltndx, farpltndx;
-
-	pltndx = sdp->sd_aux->sa_PLTndx + M_PLT_XNumber - 1;
-
-	if ((pltndx) < M64_PLT_NEARPLTS) {
-		value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
-		    (pltndx * M_PLT_ENTSIZE);
-		return (value);
-	}
-
-	farpltndx = pltndx - M64_PLT_NEARPLTS;
-
-	/*
-	 * pltoffset of a far plt is calculated by:
-	 *
-	 *	<size of near plt table> +
-	 *	<size of preceding far plt blocks> +
-	 *	<blockndx * sizeof (far plt entsize)>
-	 */
-	value =
-	    /* size of near plt table */
-	    (M64_PLT_NEARPLTS * M_PLT_ENTSIZE) +
-	    /* size of preceding far plt blocks */
-	    ((farpltndx / M64_PLT_FBLKCNTS) *
-	    ((M64_PLT_FENTSIZE + sizeof (Addr)) *
-	    M64_PLT_FBLKCNTS)) +
-	    /* pltblockendx * fentsize */
-	    ((farpltndx % M64_PLT_FBLKCNTS) * M64_PLT_FENTSIZE);
-
-	value += (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
-	return (value);
-}
-
-/*
- * Instructions required for Far PLT's
- */
-static uint32_t farplt_instrs[6] = {
-	0x8a10000f,			/* mov   %o7, %g5	*/
-	0x40000002,			/* call  . + 0x8	*/
-	0x01000000,			/* nop			*/
-	0xc25be000,			/* ldx   [%o7 + 0], %g1	*/
-	0x83c3c001,			/* jmpl  %o7 + %g1, %g1	*/
-	0x9e100005			/* mov   %g5, %o7	*/
-};
-
-/*
- * Far PLT'S:
- *
- * Far PLT's are established in blocks of '160' at a time.  These
- * PLT's consist of 6 instructions (24 bytes) and 1 pointer (8 bytes).
- * The instructions are collected together in blocks of 160 entries
- * followed by 160 pointers.  The last group of entries and pointers
- * may contain less then 160 items.  No padding is required.
- *
- *	.PLT32768:
- *		mov	%o7, %g5
- *		call	. + 8
- *		nop
- *		ldx	[%o7 + .PLTP32768 - (.PLT32768 + 4)], %g1
- *		jmpl	%o7 + %g1, %g1
- *		mov	%g5, %o7
- *	................................
- *	.PLT32927:
- *		mov	%o7, %g5
- *		call	. + 8
- *		nop
- *		ldx	[%o7 + .PLTP32927 - (.PLT32927 + 4)], %g1
- *		jmpl	%o7 + %g1, %g1
- *		mov	%g5, %o7
- *	.PLTP32768:
- *		.xword .PLT0-(.PLT32768+4)
- *	................................
- *	.PLTP32927:
- *		.xword .PLT0-(.PLT32927+4)
- *
- */
-void
-plt_far_entry(Ofl_desc *ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
-{
-	uint_t		blockndx;	/* # of far PLT blocks */
-	uint_t		farblkcnt;	/* Index to far PLT block */
-	Xword		farpltndx;	/* index of Far Plt */
-	Xword		farpltblkndx;	/* index of PLT in BLOCK */
-	uint32_t	*pltent;	/* ptr to plt instr. sequence */
-	uint64_t	*pltentptr;	/* ptr to plt addr ptr */
-	Sxword		pltblockoff;	/* offset to Far plt block */
-	Sxword		pltoff;		/* offset to PLT instr. sequence */
-	Sxword		pltptroff;	/* offset to PLT addr ptr */
-	uchar_t		*pltbuf;	/* ptr to PLT's in file */
-
-
-	farblkcnt = ((ofl->ofl_pltcnt - 1 +
-		M_PLT_XNumber - M64_PLT_NEARPLTS) / M64_PLT_FBLKCNTS);
-
-	/*
-	 * Determine the 'Far' PLT index.
-	 */
-	farpltndx = pltndx - 1 + M_PLT_XNumber - M64_PLT_NEARPLTS;
-	farpltblkndx = farpltndx % M64_PLT_FBLKCNTS;
-
-	/*
-	 * Determine what FPLT block this plt falls into.
-	 */
-	blockndx = (uint_t)(farpltndx / M64_PLT_FBLKCNTS);
-
-	/*
-	 * Calculate the starting offset of the Far PLT block
-	 * that this PLT is a member of.
-	 */
-	pltblockoff = (M64_PLT_NEARPLTS * M_PLT_ENTSIZE) +
-		(blockndx * M64_PLT_FBLOCKSZ);
-
-	pltoff = pltblockoff +
-		(farpltblkndx * M64_PLT_FENTSIZE);
-
-	pltptroff = pltblockoff;
-
-
-	if (farblkcnt > blockndx) {
-		/*
-		 * If this is a full block - the 'pltptroffs' start
-		 * after 160 fplts.
-		 */
-		pltptroff += (M64_PLT_FBLKCNTS * M64_PLT_FENTSIZE) +
-			(farpltblkndx * M64_PLT_PSIZE);
-	} else {
-		Xword	lastblkpltndx;
-		/*
-		 * If this is the last block - the the pltptr's start
-		 * after the last FPLT instruction sequence.
-		 */
-		lastblkpltndx = (ofl->ofl_pltcnt - 1 + M_PLT_XNumber -
-			M64_PLT_NEARPLTS) % M64_PLT_FBLKCNTS;
-		pltptroff += ((lastblkpltndx + 1) * M64_PLT_FENTSIZE) +
-			(farpltblkndx * M64_PLT_PSIZE);
-	}
-	pltbuf = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf;
-
-	/*
-	 * For far-plts, the Raddend and Roffset fields are defined
-	 * to be:
-	 *
-	 *	roffset:	address of .PLTP#
-	 *	raddend:	-(.PLT#+4)
-	 */
-	*roffset = pltptroff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
-	*raddend = -(pltoff + 4 + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr));
-
-	/* LINTED */
-	pltent = (uint32_t *)(pltbuf + pltoff);
-	/* LINTED */
-	pltentptr = (uint64_t *)(pltbuf + pltptroff);
-	(void) memcpy(pltent, farplt_instrs, sizeof (farplt_instrs));
-
-	/*
-	 *  update
-	 *	ldx   [%o7 + 0], %g1
-	 * to
-	 *	ldx   [%o7 + .PLTP# - (.PLT# + 4)], %g1
-	 */
-	/* LINTED */
-	pltent[3] |= (uint32_t)(pltptroff - (pltoff + 4));
-
-	/*
-	 * Store:
-	 *	.PLTP#
-	 *		.xword	.PLT0 - .PLT# + 4
-	 */
-	*pltentptr = -(pltoff + 4);
-}
-
-/*
- *	Build a single V9 P.L.T. entry - code is:
- *
- *	For Target Addresses +/- 4GB of the entry
- *	-----------------------------------------
- *	sethi	(. - .PLT0), %g1
- *	ba,a	%xcc, .PLT1
- *	nop
- *	nop
- *	nop
- *	nop
- *	nop
- *	nop
- *
- *	For Target Addresses +/- 2GB of the entry
- *	-----------------------------------------
- *
- *	.PLT0 is the address of the first entry in the P.L.T.
- *	This one is filled in by the run-time link editor. We just
- *	have to leave space for it.
- */
-static void
-plt_entry(Ofl_desc *ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
-{
-	uchar_t		*pltent;	/* PLT entry being created. */
-	Sxword		pltoff;		/* Offset of this entry from PLT top */
-
-	/*
-	 *  The second part of the V9 ABI (sec. 5.2.4)
-	 *  applies to plt entries greater than 0x8000 (32,768).
-	 *  This is handled in 'plt_far_entry()'
-	 */
-	if ((pltndx - 1 + M_PLT_XNumber) >= M64_PLT_NEARPLTS) {
-		plt_far_entry(ofl, pltndx, roffset, raddend);
-		return;
-	}
-
-	pltoff = M_PLT_RESERVSZ + (pltndx - 1) * M_PLT_ENTSIZE;
-	pltent = (uchar_t *)ofl->ofl_osplt->os_outdata->d_buf +
-		pltoff;
-
-	*roffset = pltoff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
-	*raddend = 0;
-
-	/*
-	 * PLT[0]: sethi %hi(. - .L0), %g1
-	 */
-	/* LINTED */
-	*(Word *)pltent = M_SETHIG1 | pltoff;
-
-	/*
-	 * PLT[1]: ba,a %xcc, .PLT1 (.PLT1 accessed as a
-	 * PC-relative index of longwords).
-	 */
-	pltent += M_PLT_INSSIZE;
-	pltoff += M_PLT_INSSIZE;
-	pltoff = -pltoff;
-	/* LINTED */
-	*(Word *)pltent = M_BA_A_XCC |
-		(((pltoff + M_PLT_ENTSIZE) >> 2) & S_MASK(19));
-
-	/*
-	 * PLT[2]: sethi 0, %g0 (NOP for delay slot of eventual CTI).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-
-	/*
-	 * PLT[3]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-
-	/*
-	 * PLT[4]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-
-	/*
-	 * PLT[5]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-
-	/*
-	 * PLT[6]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-
-	/*
-	 * PLT[7]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_NOP;
-}
-
-
-#else  /* Elf 32 */
-
-Xword
-calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl)
-{
-	Xword	value, pltndx;
-
-	pltndx = sdp->sd_aux->sa_PLTndx + M_PLT_XNumber - 1;
-	value = (Xword)(ofl->ofl_osplt->os_shdr->sh_addr) +
-	    (pltndx * M_PLT_ENTSIZE);
-	return (value);
-}
-
-
-/*
- *	Build a single P.L.T. entry - code is:
- *
- *	sethi	(. - .L0), %g1
- *	ba,a	.L0
- *	sethi	0, %g0		(nop)
- *
- *	.L0 is the address of the first entry in the P.L.T.
- *	This one is filled in by the run-time link editor. We just
- *	have to leave space for it.
- */
-static void
-plt_entry(Ofl_desc * ofl, Xword pltndx, Xword *roffset, Sxword *raddend)
-{
-	Byte *	pltent;	/* PLT entry being created. */
-	Sxword	pltoff;	/* Offset of this entry from PLT top */
-
-	pltoff = M_PLT_RESERVSZ + (pltndx - 1) * M_PLT_ENTSIZE;
-	pltent = (Byte *)ofl->ofl_osplt->os_outdata->d_buf + pltoff;
-
-	*roffset = pltoff + (Xword)(ofl->ofl_osplt->os_shdr->sh_addr);
-	*raddend = 0;
-
-	/*
-	 * PLT[0]: sethi %hi(. - .L0), %g1
-	 */
-	/* LINTED */
-	*(Word *)pltent = M_SETHIG1 | pltoff;
-
-	/*
-	 * PLT[1]: ba,a .L0 (.L0 accessed as a PC-relative index of longwords)
-	 */
-	pltent += M_PLT_INSSIZE;
-	pltoff += M_PLT_INSSIZE;
-	pltoff = -pltoff;
-	/* LINTED */
-	*(Word *)pltent = M_BA_A | ((pltoff >> 2) & S_MASK(22));
-
-	/*
-	 * PLT[2]: sethi 0, %g0 (NOP for delay slot of eventual CTI).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_SETHIG0;
-
-	/*
-	 * PLT[3]: sethi 0, %g0 (NOP for PLT padding).
-	 */
-	pltent += M_PLT_INSSIZE;
-	/* LINTED */
-	*(Word *)pltent = M_SETHIG0;
-}
-
-#endif /* _ELF64 */
-
-uintptr_t
-perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl)
-{
-	Os_desc *		relosp, * osp = 0;
-	Xword			ndx, roffset, value;
-	Sxword			raddend;
-	const Rel_entry *	rep;
-	Rela			rea;
-	char			*relbits;
-	Sym_desc *		sdp, * psym = (Sym_desc *)0;
-	int			sectmoved = 0;
-	Word			dtflags1 = ofl->ofl_dtflags_1;
-	Word			flags = ofl->ofl_flags;
-
-	raddend = orsp->rel_raddend;
-	sdp = orsp->rel_sym;
-
-	/*
-	 * Special case, a regsiter symbol associated with symbol
-	 * index 0 is initialized (i.e. relocated) to a constant
-	 * in the r_addend field rather than to a symbol value.
-	 */
-	if ((orsp->rel_rtype == M_R_REGISTER) && !sdp) {
-		relosp = ofl->ofl_osrel;
-		relbits = (char *)relosp->os_outdata->d_buf;
-
-		rea.r_info = ELF_R_INFO(0,
-		    ELF_R_TYPE_INFO(orsp->rel_typedata, orsp->rel_rtype));
-		rea.r_offset = orsp->rel_roffset;
-		rea.r_addend = raddend;
-		DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea,
-		    orsp->rel_sname, relosp->os_name));
-
-		assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
-		(void) memcpy((relbits + relosp->os_szoutrels),
-		    (char *)&rea, sizeof (Rela));
-		relosp->os_szoutrels += (Xword)sizeof (Rela);
-
-		return (1);
-	}
-
-	/*
-	 * If the section this relocation is against has been discarded
-	 * (-zignore), then also discard (skip) the relocation itself.
-	 */
-	if (orsp->rel_isdesc && ((orsp->rel_flags &
-	    (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) &&
-	    (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) {
-		DBG_CALL(Dbg_reloc_discard(M_MACH, orsp));
-		return (1);
-	}
-
-	/*
-	 * If this is a relocation against a move table, or expanded move
-	 * table, adjust the relocation entries.
-	 */
-	if (orsp->rel_move)
-		adj_movereloc(ofl, orsp);
-
-	/*
-	 * If this is a relocation against a section then we need to adjust the
-	 * raddend field to compensate for the new position of the input section
-	 * within the new output section.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) {
-		if (ofl->ofl_parsym.head &&
-		    (sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-		    (psym = am_I_partial(orsp, orsp->rel_raddend))) {
-			/*
-			 * If the symbol is moved, adjust the value
-			 */
-			DBG_CALL(Dbg_move_outsctadj(psym));
-			sectmoved = 1;
-			if (ofl->ofl_flags & FLG_OF_RELOBJ)
-				raddend = psym->sd_sym->st_value;
-			else
-				raddend = psym->sd_sym->st_value -
-				    psym->sd_isc->is_osdesc->os_shdr->sh_addr;
-			/* LINTED */
-			raddend += (Off)_elf_getxoff(psym->sd_isc->is_indata);
-			if (psym->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
-				raddend +=
-				psym->sd_isc->is_osdesc->os_shdr->sh_addr;
-		} else {
-			/* LINTED */
-			raddend += (Off)_elf_getxoff(sdp->sd_isc->is_indata);
-			if (sdp->sd_isc->is_shdr->sh_flags & SHF_ALLOC)
-				raddend +=
-				sdp->sd_isc->is_osdesc->os_shdr->sh_addr;
-		}
-	}
-
-	value = sdp->sd_sym->st_value;
-
-	if (orsp->rel_flags & FLG_REL_GOT) {
-		osp = ofl->ofl_osgot;
-		roffset = calc_got_offset(orsp, ofl);
-	} else if (orsp->rel_flags & FLG_REL_PLT) {
-		osp = ofl->ofl_osplt;
-		plt_entry(ofl, sdp->sd_aux->sa_PLTndx, &roffset, &raddend);
-	} else if (orsp->rel_flags & FLG_REL_BSS) {
-		/*
-		 * This must be a R_SPARC_COPY.  For these set the roffset to
-		 * point to the new symbols location.
-		 */
-		osp = ofl->ofl_isbss->is_osdesc;
-		roffset = (Xword)value;
-
-		/*
-		 * The raddend doesn't mean anything in an R_SPARC_COPY
-		 * relocation.  Null it out because it can confuse people.
-		 */
-		raddend = 0;
-	} else if (orsp->rel_flags & FLG_REL_REG) {
-		/*
-		 * The offsets of relocations against register symbols
-		 * identifiy the register directly - so the offset
-		 * does not need to be adjusted.
-		 */
-		roffset = orsp->rel_roffset;
-	} else {
-		osp = orsp->rel_osdesc;
-
-		/*
-		 * Calculate virtual offset of reference point; equals offset
-		 * into section + vaddr of section for loadable sections, or
-		 * offset plus section displacement for nonloadable sections.
-		 */
-		roffset = orsp->rel_roffset +
-		    (Off)_elf_getxoff(orsp->rel_isdesc->is_indata);
-		if (!(ofl->ofl_flags & FLG_OF_RELOBJ))
-			roffset += orsp->rel_isdesc->is_osdesc->
-			    os_shdr->sh_addr;
-	}
-
-	if ((osp == 0) || ((relosp = osp->os_relosdesc) == 0))
-		relosp = ofl->ofl_osrel;
-
-	/*
-	 * Verify that the output relocations offset meets the
-	 * alignment requirements of the relocation being processed.
-	 */
-	rep = &reloc_table[orsp->rel_rtype];
-	if (((flags & FLG_OF_RELOBJ) ||
-	    !(dtflags1 & DF_1_NORELOC)) &&
-	    !(rep->re_flags & FLG_RE_UNALIGN)) {
-		if (((rep->re_fsize == 2) && (roffset & 0x1)) ||
-		    ((rep->re_fsize == 4) && (roffset & 0x3)) ||
-		    ((rep->re_fsize == 8) && (roffset & 0x7))) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN),
-			    conv_reloc_SPARC_type_str(orsp->rel_rtype),
-			    orsp->rel_isdesc->is_file->ifl_name,
-			    demangle(orsp->rel_sname), EC_XWORD(roffset));
-			return (S_ERROR);
-		}
-	}
-
-	/*
-	 * Assign the symbols index for the output relocation.  If the
-	 * relocation refers to a SECTION symbol then it's index is based upon
-	 * the output sections symbols index.  Otherwise the index can be
-	 * derived from the symbols index itself.
-	 */
-	if (orsp->rel_rtype == R_SPARC_RELATIVE)
-		ndx = STN_UNDEF;
-	else if ((orsp->rel_flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION)) {
-		if (sectmoved == 0) {
-			/*
-			 * Check for a null input section. This can
-			 * occur if this relocation references a symbol
-			 * generated by sym_add_sym().
-			 */
-			if ((sdp->sd_isc != 0) &&
-			    (sdp->sd_isc->is_osdesc != 0))
-				ndx = sdp->sd_isc->is_osdesc->os_scnsymndx;
-			else
-				ndx = sdp->sd_shndx;
-		} else
-			ndx = ofl->ofl_sunwdata1ndx;
-	} else
-		ndx = sdp->sd_symndx;
-
-	/*
-	 * Add the symbols 'value' to the addend field.
-	 */
-	if (orsp->rel_flags & FLG_REL_ADVAL)
-		raddend += value;
-
-	/*
-	 * addend field for R_SPARC_TLS_DTPMOD32 &&
-	 * R_SPARC_TLS_DTPMOD64 mean nothing.  The addend
-	 * is propogated in the corresponding R_SPARC_TLS_DTPOFF*
-	 * relocations.
-	 */
-	if (orsp->rel_rtype == M_R_DTPMOD) {
-		raddend = 0;
-	}
-
-	relbits = (char *)relosp->os_outdata->d_buf;
-
-	rea.r_info = ELF_R_INFO(ndx, ELF_R_TYPE_INFO(orsp->rel_typedata,
-			orsp->rel_rtype));
-	rea.r_offset = roffset;
-	rea.r_addend = raddend;
-	DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea, orsp->rel_sname,
-	    relosp->os_name));
-
-	/*
-	 * Assert we haven't walked off the end of our relocation table.
-	 */
-	assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size);
-
-	(void) memcpy((relbits + relosp->os_szoutrels),
-	    (char *)&rea, sizeof (Rela));
-	relosp->os_szoutrels += (Xword)sizeof (Rela);
-
-	/*
-	 * Determine if this relocation is against a non-writable, allocatable
-	 * section.  If so we may need to provide a text relocation diagnostic.
-	 */
-	reloc_remain_entry(orsp, osp, ofl);
-	return (1);
-}
-
-
-/*
- * Sparc Instructions for TLS processing
- */
-#if defined(_ELF64)
-#define	TLS_GD_IE_LD	0xd0580000	/* ldx [%g0 + %g0], %o0 */
-#else
-#define	TLS_GD_IE_LD	0xd0000000	/* ld [%g0 + %g0], %o0 */
-#endif
-#define	TLS_GD_IE_ADD	0x9001c008	/* add %g7, %o0, %o0 */
-
-#define	TLS_GD_LE_XOR	0x80182000	/* xor %g0, 0, %g0 */
-#define	TLS_IE_LE_OR	0x80100000	/* or %g0, %o0, %o1 */
-					/*  synthetic: mov %g0, %g0 */
-
-#define	TLS_LD_LE_CLRO0	0x90100000	/* clr	%o0 */
-
-#define	FM3_REG_MSK_RD	(0x1f << 25)	/* Formate (3) rd register mask */
-					/*	bits 25->29 */
-#define	FM3_REG_MSK_RS1	(0x1f << 14)	/* Formate (3) rs1 register mask */
-					/*	bits 14->18 */
-#define	FM3_REG_MSK_RS2	0x1f		/* Formate (3) rs2 register mask */
-					/*	bits 0->4 */
-
-#define	REG_G7		7		/* %g7 register */
-
-
-Fixupret
-tls_fixups(Rel_desc *arsp)
-{
-	Sym_desc	*sdp = arsp->rel_sym;
-	Word		rtype = arsp->rel_rtype;
-	uint_t		*offset;
-
-	offset = (uint_t *)((uintptr_t)arsp->rel_roffset +
-		(uintptr_t)_elf_getxoff(arsp->rel_isdesc->is_indata) +
-		(uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
-
-	if (sdp->sd_ref == REF_DYN_NEED) {
-		/*
-		 * IE reference model
-		 */
-		switch (rtype) {
-		case R_SPARC_TLS_GD_HI22:
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_SPARC_TLS_IE_HI22,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			arsp->rel_rtype = R_SPARC_TLS_IE_HI22;
-			return (FIX_RELOC);
-		case R_SPARC_TLS_GD_LO10:
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_SPARC_TLS_IE_LO10,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			arsp->rel_rtype = R_SPARC_TLS_IE_LO10;
-			return (FIX_RELOC);
-		case R_SPARC_TLS_GD_ADD:
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_SPARC_NONE,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			*offset = (TLS_GD_IE_LD |
-				(*offset & (FM3_REG_MSK_RS1 |
-				FM3_REG_MSK_RS2)));
-			return (FIX_DONE);
-		case R_SPARC_TLS_GD_CALL:
-			DBG_CALL(Dbg_reloc_transition(M_MACH,
-				rtype,
-				R_SPARC_NONE,
-				arsp->rel_roffset,
-				sdp->sd_name));
-			*offset = TLS_GD_IE_ADD;
-			return (FIX_DONE);
-
-		}
-		return (FIX_RELOC);
-	}
-
-	/*
-	 * LE reference model
-	 */
-	switch (rtype) {
-	case R_SPARC_TLS_IE_HI22:
-	case R_SPARC_TLS_GD_HI22:
-	case R_SPARC_TLS_LDO_HIX22:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_TLS_LE_HIX22,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_SPARC_TLS_LE_HIX22;
-		return (FIX_RELOC);
-	case R_SPARC_TLS_LDO_LOX10:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_TLS_LE_LOX10,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_SPARC_TLS_LE_LOX10;
-		return (FIX_RELOC);
-	case R_SPARC_TLS_IE_LO10:
-	case R_SPARC_TLS_GD_LO10:
-		/*
-		 * Current instruction is:
-		 *
-		 *	or r1, %lo(x), r2
-		 *		or
-		 *	add r1, %lo(x), r2
-		 *
-		 *
-		 * Need to udpate this to:
-		 *
-		 *	xor r1, %lox(x), r2
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_TLS_LE_LOX10,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		*offset = TLS_GD_LE_XOR |
-			(*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RD));
-		arsp->rel_rtype = R_SPARC_TLS_LE_LOX10;
-		return (FIX_RELOC);
-	case R_SPARC_TLS_IE_LD:
-	case R_SPARC_TLS_IE_LDX:
-		/*
-		 * Current instruction:
-		 * 	ld{x}	[r1 + r2], r3
-		 *
-		 * Need to update this to:
-		 *
-		 *	mov	r2, r3   (or  %g0, r2, r3)
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		*offset = ((*offset) & (FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) |
-			TLS_IE_LE_OR;
-		return (FIX_DONE);
-	case R_SPARC_TLS_LDO_ADD:
-	case R_SPARC_TLS_GD_ADD:
-		/*
-		 * Current instruction is:
-		 *
-		 *	add gptr_reg, r2, r3
-		 *
-		 * Need to updated this to:
-		 *
-		 *	add %g7, r2, r3
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		*offset = *offset & (~FM3_REG_MSK_RS1);
-		*offset = *offset | (REG_G7 << 14);
-		return (FIX_DONE);
-	case R_SPARC_TLS_LDM_CALL:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		*offset = TLS_LD_LE_CLRO0;
-		return (FIX_DONE);
-	case R_SPARC_TLS_LDM_HI22:
-	case R_SPARC_TLS_LDM_LO10:
-	case R_SPARC_TLS_LDM_ADD:
-	case R_SPARC_TLS_IE_ADD:
-	case R_SPARC_TLS_GD_CALL:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		*offset = M_NOP;
-		return (FIX_DONE);
-	}
-	return (FIX_RELOC);
-}
-
-#define	GOTOP_ADDINST	0x80000000	/* add %g0, %g0, %g0 */
-
-Fixupret
-gotop_fixups(Rel_desc *arsp)
-{
-	Sym_desc	*sdp = arsp->rel_sym;
-	Word		rtype = arsp->rel_rtype;
-	uint_t		*offset;
-	const char	*ifl_name;
-
-	switch (rtype) {
-	case R_SPARC_GOTDATA_OP_HIX22:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_GOTDATA_HIX22,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_SPARC_GOTDATA_HIX22;
-		return (FIX_RELOC);
-	case R_SPARC_GOTDATA_OP_LOX10:
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_GOTDATA_LOX10,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		arsp->rel_rtype = R_SPARC_GOTDATA_LOX10;
-		return (FIX_RELOC);
-	case R_SPARC_GOTDATA_OP:
-		/*
-		 * Current instruction:
-		 * 	ld{x}	[r1 + r2], r3
-		 *
-		 * Need to update this to:
-		 *
-		 *	add	r1, r2, r3
-		 */
-		DBG_CALL(Dbg_reloc_transition(M_MACH,
-			rtype,
-			R_SPARC_NONE,
-			arsp->rel_roffset,
-			sdp->sd_name));
-		offset = (uint_t *)(uintptr_t)(arsp->rel_roffset +
-			_elf_getxoff(arsp->rel_isdesc->is_indata) +
-			(uintptr_t)arsp->rel_osdesc->os_outdata->d_buf);
-
-		*offset = ((*offset) & (FM3_REG_MSK_RS1 |
-			FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) |
-			GOTOP_ADDINST;
-		return (FIX_DONE);
-	}
-	/*
-	 * We should not get here
-	 */
-	if (arsp->rel_isdesc->is_file)
-		ifl_name = arsp->rel_isdesc->is_file->ifl_name;
-	else
-		ifl_name = MSG_INTL(MSG_STR_NULL);
-	eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADGOTFIX),
-	    conv_reloc_SPARC_type_str(arsp->rel_rtype),
-	    ifl_name, demangle(arsp->rel_sname));
-	assert(0);
-	return (FIX_ERROR);
-}
-
-uintptr_t
-do_activerelocs(Ofl_desc *ofl)
-{
-	Rel_desc	*arsp;
-	Rel_cache	*rcp;
-	Listnode	*lnp;
-	uintptr_t	return_code = 1;
-	Word		flags = ofl->ofl_flags;
-	Word		dtflags1 = ofl->ofl_dtflags_1;
-
-	DBG_CALL(Dbg_reloc_doactiverel());
-	/*
-	 * Process active relocations.
-	 */
-	for (LIST_TRAVERSE(&ofl->ofl_actrels, lnp, rcp)) {
-		/* LINTED */
-		for (arsp = (Rel_desc *)(rcp + 1);
-		    arsp < rcp->rc_free; arsp++) {
-			uchar_t		*addr;
-			Xword		value;
-			Sym_desc	*sdp;
-			const char	*ifl_name;
-			Xword		refaddr;
-
-			/*
-			 * If the section this relocation is against has been
-			 * discarded (-zignore), then discard (skip) the
-			 * relocation itself.
-			 */
-			if ((arsp->rel_isdesc->is_flags & FLG_IS_DISCARD) &&
-			    ((arsp->rel_flags &
-			    (FLG_REL_GOT | FLG_REL_BSS |
-			    FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) {
-				DBG_CALL(Dbg_reloc_discard(M_MACH, arsp));
-				continue;
-			}
-
-			/*
-			 * Perform any required TLS fixups.
-			 */
-			if (arsp->rel_flags & FLG_REL_TLSFIX) {
-				Fixupret	ret;
-
-				if ((ret = tls_fixups(arsp)) == FIX_ERROR)
-					return (S_ERROR);
-				if (ret == FIX_DONE)
-					continue;
-			}
-
-			/*
-			 * Perform any required GOTOP fixups.
-			 */
-			if (arsp->rel_flags & FLG_REL_GOTFIX) {
-				Fixupret	ret;
-
-				if ((ret = gotop_fixups(arsp)) == FIX_ERROR)
-					return (S_ERROR);
-				if (ret == FIX_DONE)
-					continue;
-			}
-
-			/*
-			 * If this is a relocation against the move table, or
-			 * expanded move table, adjust the relocation entries.
-			 */
-			if (arsp->rel_move)
-				adj_movereloc(ofl, arsp);
-
-			sdp = arsp->rel_sym;
-			refaddr = arsp->rel_roffset +
-			    (Off)_elf_getxoff(arsp->rel_isdesc->is_indata);
-
-			if ((arsp->rel_flags & FLG_REL_CLVAL) ||
-			    (arsp->rel_flags & FLG_REL_GOTCL))
-				value = 0;
-			else if (ELF_ST_TYPE(sdp->sd_sym->st_info) ==
-			    STT_SECTION) {
-				Sym_desc	*sym;
-
-				/*
-				 * The value for a symbol pointing to a SECTION
-				 * is based off of that sections position.
-				 */
-				if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) &&
-				    (sym = am_I_partial(arsp,
-				    arsp->rel_roffset))) {
-					/*
-					 * If the symbol is moved,
-					 * adjust the value
-					 */
-					value = _elf_getxoff(
-					    sym->sd_isc->is_indata);
-					if (sym->sd_isc->is_shdr->sh_flags &
-					    SHF_ALLOC)
-						value += sym->sd_isc->
-						    is_osdesc->os_shdr->sh_addr;
-				} else {
-					value = _elf_getxoff(
-					    sdp->sd_isc->is_indata);
-					if (sdp->sd_isc->is_shdr->sh_flags &
-					    SHF_ALLOC)
-						value += sdp->sd_isc->
-						    is_osdesc->os_shdr->sh_addr;
-				}
-
-				if (sdp->sd_isc->is_shdr->sh_flags & SHF_TLS)
-					value -= ofl->ofl_tlsphdr->p_vaddr;
-			} else {
-				/*
-				 * else the value is the symbols value
-				 */
-				value = sdp->sd_sym->st_value;
-			}
-
-			/*
-			 * Relocation against the GLOBAL_OFFSET_TABLE.
-			 */
-			if (arsp->rel_flags & FLG_REL_GOT)
-				arsp->rel_osdesc = ofl->ofl_osgot;
-
-			/*
-			 * If loadable and not producing a relocatable object
-			 * add the sections virtual address to the reference
-			 * address.
-			 */
-			if ((arsp->rel_flags & FLG_REL_LOAD) &&
-			    ((flags & FLG_OF_RELOBJ) == 0))
-				refaddr += arsp->rel_isdesc->is_osdesc->
-				    os_shdr->sh_addr;
-
-			/*
-			 * If this entry has a PLT assigned to it, it's
-			 * value is actually the address of the PLT (and
-			 * not the address of the function).
-			 */
-			if (IS_PLT(arsp->rel_rtype)) {
-				if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx)
-					value = calc_plt_addr(sdp, ofl);
-			}
-
-			/*
-			 * Add relocations addend to value.  Add extra
-			 * relocation addend if needed.
-			 */
-			value += arsp->rel_raddend;
-			if (IS_EXTOFFSET(arsp->rel_rtype))
-				value += arsp->rel_typedata;
-
-			/*
-			 * Determine whether the value needs further adjustment.
-			 * Filter through the attributes of the relocation to
-			 * determine what adjustment is required.  Note, many
-			 * of the following cases are only applicable when a
-			 * .got is present.  As a .got is not generated when a
-			 * relocatable object is being built, any adjustments
-			 * that require a .got need to be skipped.
-			 */
-			if ((arsp->rel_flags & FLG_REL_GOT) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword		R1addr;
-				uintptr_t	R2addr;
-				Sword		gotndx;
-				Gotndx		*gnp;
-				Gotref		gref;
-
-				/*
-				 * Clear the GOT table entry, on SPARC we clear
-				 * the entry and the 'value' if needed is stored
-				 * in an output relocations addend.
-				 *
-				 * Calculate offset into GOT at which to apply
-				 * the relocation.
-				 */
-				if (arsp->rel_flags & FLG_REL_DTLS)
-					gref = GOT_REF_TLSGD;
-				else if (arsp->rel_flags & FLG_REL_MTLS)
-					gref = GOT_REF_TLSLD;
-				else if (arsp->rel_flags & FLG_REL_STLS)
-					gref = GOT_REF_TLSIE;
-				else
-					gref = GOT_REF_GENERIC;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, arsp);
-				assert(gnp);
-
-				if (arsp->rel_rtype == M_R_DTPOFF)
-					gotndx = gnp->gn_gotndx + 1;
-				else
-					gotndx = gnp->gn_gotndx;
-
-				/* LINTED */
-				R1addr = (Xword)((-neggotoffset *
-				    M_GOT_ENTSIZE) + (gotndx * M_GOT_ENTSIZE));
-
-				/*
-				 * Add the GOTs data's offset.
-				 */
-				R2addr = R1addr + (uintptr_t)
-				    arsp->rel_osdesc->os_outdata->d_buf;
-
-				DBG_CALL(Dbg_reloc_doact(M_MACH,
-				    arsp->rel_rtype, R1addr, value,
-				    arsp->rel_sname, arsp->rel_osdesc));
-
-				/*
-				 * And do it.
-				 */
-				*(Xword *)R2addr = value;
-				continue;
-
-			} else if (IS_GOT_BASED(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				value -= (ofl->ofl_osgot->os_shdr->sh_addr +
-					(-neggotoffset * M_GOT_ENTSIZE));
-
-			} else if (IS_PC_RELATIVE(arsp->rel_rtype)) {
-				value -= refaddr;
-
-			} else if (IS_TLS_INS(arsp->rel_rtype) &&
-			    IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx	*gnp;
-				Gotref	gref;
-
-				if (arsp->rel_flags & FLG_REL_STLS)
-					gref = GOT_REF_TLSIE;
-				else if (arsp->rel_flags & FLG_REL_DTLS)
-					gref = GOT_REF_TLSGD;
-				else if (arsp->rel_flags & FLG_REL_MTLS)
-					gref = GOT_REF_TLSLD;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs), gref,
-				    ofl, arsp);
-				assert(gnp);
-
-				value = gnp->gn_gotndx * M_GOT_ENTSIZE;
-
-			} else if (IS_GOT_RELATIVE(arsp->rel_rtype) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Gotndx	*gnp;
-
-				gnp = find_gotndx(&(sdp->sd_GOTndxs),
-				    GOT_REF_GENERIC, ofl, arsp);
-				assert(gnp);
-
-				value = gnp->gn_gotndx * M_GOT_ENTSIZE;
-
-			} else if ((arsp->rel_flags & FLG_REL_STLS) &&
-			    ((flags & FLG_OF_RELOBJ) == 0)) {
-				Xword	tlsstatsize;
-
-				/*
-				 * This is the LE TLS
-				 * reference model.  Static offset
-				 * is hard-coded, and negated so that
-				 * it can be added to the thread pointer (%g7)
-				 */
-				tlsstatsize = S_ROUND(ofl->
-				    ofl_tlsphdr->p_memsz, M_TLSSTATALIGN);
-				value = -(tlsstatsize - value);
-			}
-
-			if (arsp->rel_isdesc->is_file)
-				ifl_name = arsp->rel_isdesc->is_file->ifl_name;
-			else
-				ifl_name = MSG_INTL(MSG_STR_NULL);
-
-			/*
-			 * Make sure we have data to relocate.  Compiler and
-			 * assembler developers have been known to generate
-			 * relocations against invalid sections (normally .bss),
-			 * so for their benefit give them sufficient information
-			 * to help analyze the problem.  End users should never
-			 * see this.
-			 */
-			if (arsp->rel_isdesc->is_indata->d_buf == 0) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC),
-				    conv_reloc_SPARC_type_str(arsp->rel_rtype),
-				    ifl_name, demangle(arsp->rel_sname),
-				    arsp->rel_isdesc->is_name);
-				return (S_ERROR);
-			}
-
-			/*
-			 * Get the address of the data item we need to modify.
-			 */
-			addr = (uchar_t *)((uintptr_t)arsp->rel_roffset +
-			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
-			    is_indata));
-
-			/*LINTED*/
-			DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype,
-			    (Xword)(uintptr_t)addr, value, arsp->rel_sname,
-			    arsp->rel_osdesc));
-			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
-
-			if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) >
-			    ofl->ofl_size) || (arsp->rel_roffset >
-			    arsp->rel_osdesc->os_shdr->sh_size)) {
-				int	class;
-
-				if (((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size)
-					class = ERR_FATAL;
-				else
-					class = ERR_WARNING;
-
-				eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET),
-				    conv_reloc_SPARC_type_str(arsp->rel_rtype),
-				    ifl_name, arsp->rel_isdesc->is_name,
-				    demangle(arsp->rel_sname),
-				    EC_ADDR((uintptr_t)addr -
-				    (uintptr_t)ofl->ofl_ehdr));
-
-				if (class == ERR_FATAL) {
-					return_code = S_ERROR;
-					continue;
-				}
-			}
-
-			/*
-			 * If '-z noreloc' is specified - skip the do_reloc
-			 * stage.
-			 */
-			if ((flags & FLG_OF_RELOBJ) ||
-			    !(dtflags1 & DF_1_NORELOC)) {
-				if (do_reloc((uchar_t)arsp->rel_rtype, addr,
-				    &value, arsp->rel_sname, ifl_name) == 0)
-					return_code = S_ERROR;
-			}
-		}
-	}
-	return (return_code);
-}
-
-uintptr_t
-add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl)
-{
-	Rel_desc	*orsp;
-	Rel_cache	*rcp;
-	Sym_desc	*sdp = rsp->rel_sym;
-
-	/*
-	 * Static executables *do not* want any relocations against them.
-	 * Since our engine still creates relocations against a WEAK UNDEFINED
-	 * symbol in a static executable, it's best to disable them here
-	 * instead of through out the relocation code.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
-		return (1);
-
-	/*
-	 * Certain relocations do not make sense in a 64bit shared object,
-	 * if building a shared object do a sanity check on the output
-	 * relocations being created.
-	 */
-	if (ofl->ofl_flags & FLG_OF_SHAROBJ) {
-		Word	rtype = rsp->rel_rtype;
-		/*
-		 * Because the R_SPARC_HIPLT22 & R_SPARC_LOPLT10 relocations
-		 * are not relative they make no sense to create in a shared
-		 * object - so emit the proper error message if that occurs.
-		 */
-		if ((rtype == R_SPARC_HIPLT22) ||
-		    (rtype == R_SPARC_LOPLT10)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNRELREL),
-			    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-			    rsp->rel_isdesc->is_file->ifl_name,
-			    demangle(rsp->rel_sname));
-			return (S_ERROR);
-		}
-#if	defined(_ELF64)
-		/*
-		 * Each of the following relocations requires that the
-		 * object being built be loaded in either the upper 32 or
-		 * 44 bit range of memory.  Since shared libraries traditionally
-		 * are loaded in the lower range of memory - this isn't going
-		 * to work.
-		 */
-		if ((rtype == R_SPARC_H44) || (rtype == R_SPARC_M44) ||
-		    (rtype == R_SPARC_L44)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SHOBJABS44),
-			    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-			    rsp->rel_isdesc->is_file->ifl_name,
-			    demangle(rsp->rel_sname));
-			return (S_ERROR);
-		}
-#endif
-	}
-
-	/*
-	 * If no relocation cache structures are available allocate
-	 * a new one and link it into the cache list.
-	 */
-	if ((ofl->ofl_outrels.tail == 0) ||
-	    ((rcp = (Rel_cache *)ofl->ofl_outrels.tail->data) == 0) ||
-	    ((orsp = rcp->rc_free) == rcp->rc_end)) {
-		static size_t	nextsize = 0;
-		size_t		size;
-
-		/*
-		 * Output relocation numbers can vary considerably between
-		 * building executables or shared objects (pic vs. non-pic),
-		 * etc.  But, they typically aren't very large, so for these
-		 * objects use a standard bucket size.  For building relocatable
-		 * objects, typically there will be an output relocation for
-		 * every input relocation.
-		 */
-		if (nextsize == 0) {
-			if (ofl->ofl_flags & FLG_OF_RELOBJ) {
-				if ((size = ofl->ofl_relocincnt) == 0)
-					size = REL_LOIDESCNO;
-				if (size > REL_HOIDESCNO)
-					nextsize = REL_HOIDESCNO;
-				else
-					nextsize = REL_LOIDESCNO;
-			} else
-				nextsize = size = REL_HOIDESCNO;
-		} else
-			size = nextsize;
-
-		size = size * sizeof (Rel_desc);
-
-		if (((rcp = libld_malloc(sizeof (Rel_cache) + size)) == 0) ||
-		    (list_appendc(&ofl->ofl_outrels, rcp) == 0))
-			return (S_ERROR);
-
-		/* LINTED */
-		rcp->rc_free = orsp = (Rel_desc *)(rcp + 1);
-		/* LINTED */
-		rcp->rc_end = (Rel_desc *)((char *)rcp->rc_free + size);
-	}
-
-	/*
-	 * If we are adding a output relocation against a section
-	 * symbol (non-RELATIVE) then mark that section.  These sections
-	 * will be added to the .dynsym symbol table.
-	 */
-	if (sdp && (rsp->rel_rtype != M_R_RELATIVE) &&
-	    ((flags & FLG_REL_SCNNDX) ||
-	    (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION))) {
-
-		/*
-		 * If this is a COMMON symbol - no output section
-		 * exists yet - (it's created as part of sym_validate()).
-		 * So - we mark here that when it's created it should
-		 * be tagged with the FLG_OS_OUTREL flag.
-		 */
-		if ((sdp->sd_flags & FLG_SY_SPECSEC) &&
-		    (sdp->sd_shndx == SHN_COMMON)) {
-			if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS)
-				ofl->ofl_flags1 |= FLG_OF1_BSSOREL;
-			else
-				ofl->ofl_flags1 |= FLG_OF1_TLSOREL;
-		} else {
-			Os_desc	*osp = sdp->sd_isc->is_osdesc;
-
-			if ((osp->os_flags & FLG_OS_OUTREL) == 0) {
-				ofl->ofl_dynshdrcnt++;
-				osp->os_flags |= FLG_OS_OUTREL;
-			}
-		}
-	}
-
-	*orsp = *rsp;
-	orsp->rel_flags |= flags;
-
-	rcp->rc_free++;
-	ofl->ofl_outrelscnt++;
-
-	if (flags & FLG_REL_GOT)
-		ofl->ofl_relocgotsz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_PLT)
-		ofl->ofl_relocpltsz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_BSS)
-		ofl->ofl_relocbsssz += (Xword)sizeof (Rela);
-	else if (flags & FLG_REL_NOINFO)
-		ofl->ofl_relocrelsz += (Xword)sizeof (Rela);
-	else
-		orsp->rel_osdesc->os_szoutrels += (Xword)sizeof (Rela);
-
-	if (orsp->rel_rtype == M_R_RELATIVE)
-		ofl->ofl_relocrelcnt++;
-
-#ifdef	_ELF64
-	/*
-	 * When building a 64-bit object any R_SPARC_WDISP30 relocation is given
-	 * a plt padding entry, unless we're building a relocatable object
-	 * (ld -r) or -b is in effect.
-	 */
-	if ((orsp->rel_rtype == R_SPARC_WDISP30) &&
-	    ((ofl->ofl_flags & (FLG_OF_BFLAG | FLG_OF_RELOBJ)) == 0) &&
-	    ((orsp->rel_sym->sd_flags & FLG_SY_PLTPAD) == 0)) {
-		ofl->ofl_pltpad++;
-		orsp->rel_sym->sd_flags |= FLG_SY_PLTPAD;
-	}
-#endif
-	/*
-	 * We don't perform sorting on PLT relocations because
-	 * they have already been assigned a PLT index and if we
-	 * were to sort them we would have to re-assign the plt indexes.
-	 */
-	if (!(flags & FLG_REL_PLT))
-		ofl->ofl_reloccnt++;
-
-	/*
-	 * Insure a GLOBAL_OFFSET_TABLE is generated if required.
-	 */
-	if (IS_GOT_REQUIRED(orsp->rel_rtype))
-		ofl->ofl_flags |= FLG_OF_BLDGOT;
-
-	/*
-	 * Identify and possibly warn of a displacement relocation.
-	 */
-	if (orsp->rel_flags & FLG_REL_DISP) {
-		ofl->ofl_dtflags_1 |= DF_1_DISPRELPND;
-
-		if (ofl->ofl_flags & FLG_OF_VERBOSE)
-			disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl);
-	}
-	DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp));
-	return (1);
-}
-
-/*
- * Process relocation against a register symbol.  Note, of -z muldefs is in
- * effect there may have been multiple register definitions, which would have
- * been processed as non-fatal, with the first definition winning.  But, we
- * will also process multiple relocations for these multiple definitions.  In
- * this case we must only preserve the relocation for the definition that was
- * kept.  The sad part is that register relocations don't typically specify
- * the register symbol with which they are associated, so we might have to
- * search the input files global symbols to determine if this relocation is
- * appropriate.
- */
-uintptr_t
-reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl)
-{
-	if (ofl->ofl_flags & FLG_OF_MULDEFS) {
-		Ifl_desc *	ifl = isp->is_file;
-		Sym_desc *	sdp = rsp->rel_sym;
-
-		if (sdp == 0) {
-			Xword		offset = rsp->rel_roffset;
-			Word		ndx;
-
-			for (ndx = ifl->ifl_locscnt;
-			    ndx < ifl->ifl_symscnt; ndx++) {
-				if (((sdp = ifl->ifl_oldndx[ndx]) != 0) &&
-				    (sdp->sd_flags & FLG_SY_REGSYM) &&
-				    (sdp->sd_sym->st_value == offset))
-					break;
-			}
-		}
-		if (sdp && (sdp->sd_file != ifl))
-			return (1);
-	}
-	return (add_outrel((rsp->rel_flags | FLG_REL_REG), rsp, ofl));
-}
-
-/*
- * process relocation for a LOCAL symbol
- */
-uintptr_t
-reloc_local(Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		flags = ofl->ofl_flags;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		shndx = rsp->rel_sym->sd_shndx;
-
-	/*
-	 * if ((shared object) and (not pc relative relocation) and
-	 *    (not against ABS symbol))
-	 * then
-	 *	if (rtype != R_SPARC_32)
-	 *	then
-	 *		build relocation against section
-	 *	else
-	 *		build R_SPARC_RELATIVE
-	 *	fi
-	 * fi
-	 */
-	if ((flags & FLG_OF_SHAROBJ) && (rsp->rel_flags & FLG_REL_LOAD) &&
-	    !(IS_PC_RELATIVE(rsp->rel_rtype)) &&
-	    !(IS_GOT_BASED(rsp->rel_rtype)) &&
-	    !(rsp->rel_isdesc != NULL &&
-	    (rsp->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof)) &&
-	    (((sdp->sd_flags & FLG_SY_SPECSEC) == 0) ||
-	    (shndx != SHN_ABS) || (sdp->sd_aux && sdp->sd_aux->sa_symspec))) {
-		Word	ortype = rsp->rel_rtype;
-
-		if ((rsp->rel_rtype != R_SPARC_32) &&
-		    (rsp->rel_rtype != R_SPARC_PLT32) &&
-		    (rsp->rel_rtype != R_SPARC_64))
-			return (add_outrel((FLG_REL_SCNNDX | FLG_REL_ADVAL),
-			    rsp, ofl));
-
-		rsp->rel_rtype = R_SPARC_RELATIVE;
-		if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = ortype;
-		return (1);
-	}
-
-	/*
-	 * If the relocation is against a 'non-allocatable' section
-	 * and we can not resolve it now - then give a warning
-	 * message.
-	 *
-	 * We can not resolve the symbol if either:
-	 *	a) it's undefined
-	 *	b) it's defined in a shared library and a
-	 *	   COPY relocation hasn't moved it to the executable
-	 *
-	 * Note: because we process all of the relocations against the
-	 *	text segment before any others - we know whether
-	 *	or not a copy relocation will be generated before
-	 *	we get here (see reloc_init()->reloc_segments()).
-	 */
-	if (!(rsp->rel_flags & FLG_REL_LOAD) &&
-	    ((shndx == SHN_UNDEF) ||
-	    ((sdp->sd_ref == REF_DYN_NEED) &&
-	    ((sdp->sd_flags & FLG_SY_MVTOCOMM) == 0)))) {
-		/*
-		 * If the relocation is against a SHT_SUNW_ANNOTATE
-		 * section - then silently ignore that the relocation
-		 * can not be resolved.
-		 */
-		if (rsp->rel_osdesc &&
-		    (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE))
-			return (0);
-		(void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM),
-		    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname), rsp->rel_osdesc->os_name);
-		return (1);
-	}
-
-	/*
-	 * Perform relocation.
-	 */
-	return (add_actrel(NULL, rsp, ofl));
-}
-
-uintptr_t
-reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word	rtype = rsp->rel_rtype;
-
-	if (!local) {
-		/*
-		 * When binding to a external symbol, no fixups are required
-		 * and the GOTDATA_OP relocation can be ignored.
-		 */
-		if (rtype == R_SPARC_GOTDATA_OP)
-			return (1);
-		return (reloc_GOT_relative(local, rsp, ofl));
-	}
-
-	/*
-	 * When binding to a local symbol the relocations can be transitioned:
-	 *
-	 *	R_*_GOTDATA_OP_HIX22 -> R_*_GOTDATA_HIX22
-	 *	R_*_GOTDATA_OP_LOX10 -> R_*_GOTDATA_LOX10
-	 *	R_*_GOTDATA_OP ->	instruction fixup
-	 */
-	return (add_actrel(FLG_REL_GOTFIX, rsp, ofl));
-}
-
-uintptr_t
-reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl)
-{
-	Word		rtype = rsp->rel_rtype;
-	Sym_desc	*sdp = rsp->rel_sym;
-	Word		flags = ofl->ofl_flags;
-	Word		rflags;
-	Gotndx		*gnp;
-
-	/*
-	 * all TLS relocations are illegal in a static executable.
-	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
-		    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * Any TLS relocation must be against a STT_TLS symbol, all others
-	 * are illegal.
-	 */
-	if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM),
-		    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    conv_info_type_str(ofl->ofl_e_machine,
-		    ELF_ST_TYPE(sdp->sd_sym->st_info)));
-		return (S_ERROR);
-	}
-
-	/*
-	 * We're a executable - use either the IE or LE
-	 * access model.
-	 */
-	if (flags & FLG_OF_EXEC) {
-		/*
-		 * If we are using either IE or LE reference
-		 * model set the DF_STATIC_TLS flag.
-		 */
-		ofl->ofl_dtflags |= DF_STATIC_TLS;
-
-		if (!local) {
-			/*
-			 * IE access model
-			 */
-			/*
-			 * When building a executable - these relocations
-			 * can be ignored.
-			 */
-			if ((rtype == R_SPARC_TLS_IE_LD) ||
-			    (rtype == R_SPARC_TLS_IE_LDX) ||
-			    (rtype == R_SPARC_TLS_IE_ADD))
-				return (1);
-
-			/*
-			 * It's not possible for LD or LE reference
-			 * models to reference a symbol external to
-			 * the current object.
-			 */
-			if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-				    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-				    rsp->rel_isdesc->is_file->ifl_name,
-				    demangle(rsp->rel_sname),
-				    sdp->sd_file->ifl_name);
-				return (S_ERROR);
-			}
-
-			/*
-			 * Assign a GOT entry for static TLS references
-			 */
-			if (((rtype == R_SPARC_TLS_GD_HI22) ||
-			    (rtype == R_SPARC_TLS_GD_LO10) ||
-			    (rtype == R_SPARC_TLS_IE_HI22) ||
-			    (rtype == R_SPARC_TLS_IE_LO10)) &&
-			    ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-			    GOT_REF_TLSIE, ofl, rsp)) == 0)) {
-				if (assign_gotndx(&(sdp->sd_GOTndxs), gnp,
-				    GOT_REF_TLSIE, ofl, rsp, sdp) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = M_R_TPOFF;
-				if (add_outrel((FLG_REL_GOT | FLG_REL_STLS),
-				    rsp, ofl) == S_ERROR)
-					return (S_ERROR);
-				rsp->rel_rtype = rtype;
-			}
-
-			if (IS_TLS_IE(rtype))
-				return (add_actrel(FLG_REL_STLS, rsp, ofl));
-
-			/*
-			 * If (GD) reference models - fixups
-			 * are required.
-			 */
-			return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS),
-			    rsp, ofl));
-		}
-		/*
-		 * LE access model
-		 */
-		if (IS_TLS_LE(rtype))
-			return (add_actrel(FLG_REL_STLS, rsp, ofl));
-
-		/*
-		 * When building a executable - these relocations
-		 * can be ignored.
-		 */
-		if (rtype == R_SPARC_TLS_IE_ADD)
-			return (1);
-
-		return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl));
-	}
-
-	/*
-	 * Building a shared object
-	 */
-
-	/*
-	 * Building a shared object - only GD & LD access models
-	 * will work here.
-	 */
-	if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE),
-		    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname));
-		return (S_ERROR);
-	}
-
-	/*
-	 * LD access mode can only bind to local symbols.
-	 */
-	if (!local && IS_TLS_LD(rtype)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND),
-		    conv_reloc_SPARC_type_str(rsp->rel_rtype),
-		    rsp->rel_isdesc->is_file->ifl_name,
-		    demangle(rsp->rel_sname),
-		    sdp->sd_file->ifl_name);
-		return (S_ERROR);
-	}
-
-	/*
-	 * For dynamic TLS references - ADD relocations
-	 * are ignored.
-	 */
-	if ((rtype == R_SPARC_TLS_GD_ADD) || (rtype == R_SPARC_TLS_LDM_ADD) ||
-	    (rtype == R_SPARC_TLS_LDO_ADD))
-		return (1);
-
-	/*
-	 * Assign a GOT entry for a dynamic TLS reference.
-	 */
-	if (((rtype == R_SPARC_TLS_LDM_HI22) ||
-	    (rtype == R_SPARC_TLS_LDM_LO10)) &&
-	    ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSLD, ofl, rsp)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = M_R_DTPMOD;
-		rflags = FLG_REL_GOT | FLG_REL_MTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-
-		rsp->rel_rtype = rtype;
-
-	} else if (((rtype == R_SPARC_TLS_GD_HI22) || (rtype ==
-	    R_SPARC_TLS_GD_LO10)) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs),
-	    GOT_REF_TLSGD, ofl, rsp)) == 0)) {
-		if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD,
-		    ofl, rsp, sdp) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_rtype = M_R_DTPMOD;
-		rflags = FLG_REL_GOT | FLG_REL_DTLS;
-		if (local)
-			rflags |= FLG_REL_SCNNDX;
-
-		if (add_outrel(rflags, rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-
-		if (local == TRUE) {
-			rsp->rel_rtype = M_R_DTPOFF;
-			if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		} else {
-			rsp->rel_rtype = M_R_DTPOFF;
-			if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp,
-			    ofl) == S_ERROR)
-				return (S_ERROR);
-		}
-		rsp->rel_rtype = rtype;
-	}
-	/*
-	 * For GD/LD TLS reference - TLS_{GD,LD}_CALL, this will eventually
-	 * cause a call to __tls_get_addr().  Let's convert this
-	 * relocation to that symbol now, and prepare for the PLT magic.
-	 */
-	if ((rtype == R_SPARC_TLS_GD_CALL) || (rtype == R_SPARC_TLS_LDM_CALL)) {
-		Sym_desc *	tlsgetsym;
-
-		if ((tlsgetsym = sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_U),
-		    ofl)) == (Sym_desc *)S_ERROR)
-			return (S_ERROR);
-		rsp->rel_sym = tlsgetsym;
-		rsp->rel_sname = tlsgetsym->sd_name;
-		rsp->rel_rtype = R_SPARC_WPLT30;
-		if (reloc_plt(rsp, ofl) == S_ERROR)
-			return (S_ERROR);
-		rsp->rel_sym = sdp;
-		rsp->rel_sname = sdp->sd_name;
-		rsp->rel_rtype = rtype;
-		return (1);
-	}
-
-	if (IS_TLS_LD(rtype))
-		return (add_actrel(FLG_REL_MTLS, rsp, ofl));
-
-	return (add_actrel(FLG_REL_DTLS, rsp, ofl));
-}
-
-/*
- * allocate_got: if a GOT is to be made, after the section is built this
- * function is called to allocate all the GOT slots.  The allocation is
- * deferred until after all GOTs have been counted and sorted according
- * to their size, for only then will we know how to allocate them on
- * a processor like SPARC which has different models for addressing the
- * GOT.  SPARC has two: small and large, small uses a signed 13-bit offset
- * into the GOT, whereas large uses an unsigned 32-bit offset.
- */
-static	Sword small_index;	/* starting index for small GOT entries */
-static	Sword large_index;	/* starting index for large GOT entries */
-
-uintptr_t
-assign_got(Sym_desc * sdp)
-{
-	Listnode *	lnp;
-	Gotndx *	gnp;
-
-	for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp, gnp)) {
-		uint_t	gotents;
-		Gotref	gref;
-		gref = gnp->gn_gotref;
-		if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
-			gotents = 2;
-		else
-			gotents = 1;
-
-		switch (gnp->gn_gotndx) {
-		case M_GOT_SMALL:
-			gnp->gn_gotndx = small_index;
-			small_index += gotents;
-			if (small_index == 0)
-				small_index = M_GOT_XNumber;
-			break;
-		case M_GOT_LARGE:
-			gnp->gn_gotndx = large_index;
-			large_index += gotents;
-			break;
-		default:
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_ASSIGNGOT),
-			    EC_XWORD(gnp->gn_gotndx), demangle(sdp->sd_name));
-			return (S_ERROR);
-		}
-	}
-	return (1);
-}
-
-
-/*
- * Search the GOT index list for a GOT entry with the proper addend.
- */
-Gotndx *
-find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc)
-{
-	Listnode *	lnp;
-	Gotndx *	gnp;
-
-	if ((gref == GOT_REF_TLSLD) && ofl->ofl_tlsldgotndx)
-		return (ofl->ofl_tlsldgotndx);
-
-	for (LIST_TRAVERSE(lst, lnp, gnp)) {
-		if ((rdesc->rel_raddend == gnp->gn_addend) &&
-		    (gref == gnp->gn_gotref))
-			return (gnp);
-	}
-	return ((Gotndx *)0);
-}
-
-Xword
-calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl)
-{
-	Os_desc		*osp = ofl->ofl_osgot;
-	Sym_desc	*sdp = rdesc->rel_sym;
-	Xword		gotndx;
-	Gotref		gref;
-	Gotndx		*gnp;
-
-	if (rdesc->rel_flags & FLG_REL_DTLS)
-		gref = GOT_REF_TLSGD;
-	else if (rdesc->rel_flags & FLG_REL_MTLS)
-		gref = GOT_REF_TLSLD;
-	else if (rdesc->rel_flags & FLG_REL_STLS)
-		gref = GOT_REF_TLSIE;
-	else
-		gref = GOT_REF_GENERIC;
-
-	gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc);
-	assert(gnp);
-
-	gotndx = (Xword)gnp->gn_gotndx;
-
-	if ((rdesc->rel_flags & FLG_REL_DTLS) &&
-	    (rdesc->rel_rtype == M_R_DTPOFF))
-		gotndx++;
-
-	return ((Xword)((osp->os_shdr->sh_addr) + (gotndx * M_GOT_ENTSIZE) +
-	    (-neggotoffset * M_GOT_ENTSIZE)));
-}
-
-uintptr_t
-assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl,
-    Rel_desc * rsp, Sym_desc * sdp)
-{
-	Xword		raddend;
-	Gotndx *	gnp, * _gnp;
-	Listnode *	lnp, * plnp;
-	uint_t		gotents;
-
-	raddend = rsp->rel_raddend;
-	if (pgnp && (pgnp->gn_addend == raddend) && (pgnp->gn_gotref == gref)) {
-		/*
-		 * If an entry for this addend already exists, determine if it
-		 * should be changed to a SMALL got.
-		 */
-		if ((pgnp->gn_gotndx != M_GOT_SMALL) &&
-		    (rsp->rel_rtype == R_SPARC_GOT13)) {
-			smlgotcnt++;
-			pgnp->gn_gotndx = M_GOT_SMALL;
-			sdp->sd_flags |= FLG_SY_SMGOT;
-		}
-		return (1);
-	}
-
-	if ((gref == GOT_REF_TLSGD) || (gref == GOT_REF_TLSLD))
-		gotents = 2;
-	else
-		gotents = 1;
-
-	plnp = 0;
-	for (LIST_TRAVERSE(lst, lnp, _gnp)) {
-		if (_gnp->gn_addend > raddend)
-			break;
-		plnp = lnp;
-	}
-
-	/*
-	 * Allocate a new entry.
-	 */
-	if ((gnp = libld_calloc(sizeof (Gotndx), 1)) == 0)
-		return (S_ERROR);
-	gnp->gn_addend = raddend;
-	gnp->gn_gotref = gref;
-	ofl->ofl_gotcnt += gotents;
-
-	if (rsp->rel_rtype == R_SPARC_GOT13) {
-		gnp->gn_gotndx = M_GOT_SMALL;
-		smlgotcnt++;
-		sdp->sd_flags |= FLG_SY_SMGOT;
-	} else
-		gnp->gn_gotndx = M_GOT_LARGE;
-
-	if (gref == GOT_REF_TLSLD) {
-		ofl->ofl_tlsldgotndx = gnp;
-		return (1);
-	}
-
-	if (plnp == 0) {
-		/*
-		 * Insert at head of list
-		 */
-		if (list_prependc(lst, (void *)gnp) == 0)
-			return (S_ERROR);
-	} else if (_gnp->gn_addend > raddend) {
-		/*
-		 * Insert in middle of lest
-		 */
-		if (list_insertc(lst, (void *)gnp, plnp) == 0)
-			return (S_ERROR);
-	} else {
-		/*
-		 * Append to tail of list
-		 */
-		if (list_appendc(lst, (void *)gnp) == 0)
-			return (S_ERROR);
-	}
-	return (1);
-}
-
-void
-assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl)
-{
-	sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++;
-}
-
-
-uintptr_t
-allocate_got(Ofl_desc * ofl)
-{
-	Sym_desc *	sdp;
-	Addr		addr;
-
-	/*
-	 * Sanity check -- is this going to fit at all?
-	 */
-	if (smlgotcnt >= M_GOT_MAXSMALL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SMALLGOT),
-		    EC_WORD(smlgotcnt), M_GOT_MAXSMALL);
-		return (S_ERROR);
-	}
-
-	/*
-	 * Set starting offset to be either 0, or a negative index into
-	 * the GOT based on the number of small symbols we've got.
-	 */
-	neggotoffset = ((smlgotcnt > (M_GOT_MAXSMALL / 2)) ?
-	    -((smlgotcnt - (M_GOT_MAXSMALL / 2))) : 0);
-
-	/*
-	 * Initialize the large and small got offsets (used in assign_got()).
-	 */
-	small_index = neggotoffset == 0 ? M_GOT_XNumber : neggotoffset;
-	large_index = neggotoffset + smlgotcnt;
-
-	/*
-	 * Assign bias to GOT symbols.
-	 */
-	addr = -neggotoffset * M_GOT_ENTSIZE;
-	if (sdp = sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl))
-		sdp->sd_sym->st_value = addr;
-	if (sdp = sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl))
-		sdp->sd_sym->st_value = addr;
-
-	if (ofl->ofl_tlsldgotndx) {
-		ofl->ofl_tlsldgotndx->gn_gotndx = large_index;
-		large_index += 2;
-	}
-	return (1);
-}
-
-
-/*
- * Initializes .got[0] with the _DYNAMIC symbol value.
- */
-uintptr_t
-fillin_gotplt1(Ofl_desc * ofl)
-{
-	if (ofl->ofl_osgot) {
-		Sym_desc *	sdp;
-
-		if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
-			uchar_t	*genptr = ((uchar_t *)
-			    ofl->ofl_osgot->os_outdata->d_buf +
-			    (-neggotoffset * M_GOT_ENTSIZE) +
-			    (M_GOT_XDYNAMIC * M_GOT_ENTSIZE));
-			/* LINTED */
-			*((Xword *)genptr) = sdp->sd_sym->st_value;
-		}
-	}
-	return (1);
-}
-
-
-/*
- * Return plt[0].
- */
-Addr
-fillin_gotplt2(Ofl_desc * ofl)
-{
-	if (ofl->ofl_osplt)
-		return (ofl->ofl_osplt->os_shdr->sh_addr);
-	else
-		return (0);
-}
--- a/usr/src/cmd/sgs/libld/sparc/machsym.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
- * 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.
- *
- * 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 2000-2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include	<stdio.h>
-#include	<string.h>
-#include	<alloca.h>
-#include	<sys/types.h>
-#include	"debug.h"
-#include	"msg.h"
-#include	"_libld.h"
-
-/*
- * Matrix of legal combinations of usage of a given register:
- *
- *	Obj1 \ Obj2      Scratch	Named
- *	Scratch          OK		NO
- *	Named            NO		*
- *
- * (*) OK if the symbols are identical, NO if they are not.  Two symbols
- * are identical if and only if one of the following is true:
- *   A. They are both global and have the same name.
- *   B. They are both local, have the same name, and are defined in the same
- *	object.  (Note that a local symbol in one object is never identical to
- *	a local symbol in another object, even if the name is the same.)
- *
- * Matrix of legal combinations of st_shndx for the same register symbol:
- *
- *	Obj1 \ Obj2      UNDEF		ABS
- *	UNDEF            OK		OK
- *	ABS              OK		NO
- *
- */
-int
-reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl,
-    Ofl_desc * ofl)
-{
-	Sym		*osym = sdp->sd_sym;
-	const char	*oname = sdp->sd_name;
-
-	/*
-	 * Scratch register definitions are compatible.
-	 */
-	if ((osym->st_name == 0) && (nsym->st_name == 0))
-		return (0);
-
-	/*
-	 * A local and a global, or another local is incompatible.
-	 */
-	if ((ELF_ST_BIND(osym->st_info) == STB_LOCAL) ||
-	    (ELF_ST_BIND(nsym->st_info) == STB_LOCAL)) {
-		if (osym->st_value == nsym->st_value) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG3),
-			    conv_sym_SPARC_value_str((Lword)osym->st_value),
-			    sdp->sd_file->ifl_name, demangle(oname),
-			    ifl->ifl_name, demangle(nname));
-			ofl->ofl_flags |= FLG_OF_FATAL;
-			return (1);
-		}
-		return (0);
-	}
-
-	if (osym->st_value == nsym->st_value) {
-		/*
-		 * A scratch register and a named register are incompatible.
-		 * So are two different named registers.
-		 */
-		if (((osym->st_name == 0) || (nsym->st_name == 0)) ||
-		    (strcmp(oname, nname) != 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG1),
-			    conv_sym_SPARC_value_str((Lword)osym->st_value),
-			    sdp->sd_file->ifl_name, demangle(oname),
-			    ifl->ifl_name, demangle(nname));
-			ofl->ofl_flags |= FLG_OF_FATAL;
-			return (1);
-		}
-
-		/*
-		 * A multiply initialized symbol is also illegal.
-		 */
-		if ((osym->st_shndx == SHN_ABS) &&
-		    (nsym->st_shndx == SHN_ABS)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULTINIREG),
-			    conv_sym_SPARC_value_str((Lword)osym->st_value),
-			    demangle(nname), sdp->sd_file->ifl_name,
-			    ifl->ifl_name);
-			ofl->ofl_flags |= FLG_OF_FATAL;
-			return (1);
-		}
-
-	} else if (strcmp(oname, nname) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG2),
-		    demangle(sdp->sd_name), sdp->sd_file->ifl_name,
-		    conv_sym_SPARC_value_str((Lword)osym->st_value),
-		    ifl->ifl_name,
-		    conv_sym_SPARC_value_str((Lword)nsym->st_value));
-		ofl->ofl_flags |= FLG_OF_FATAL;
-		return (1);
-	}
-	return (0);
-}
-
-int
-mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl)
-{
-	Sym	*osym = sdp->sd_sym;
-	Byte	otype = ELF_ST_TYPE(osym->st_info);
-	Byte	ntype = ELF_ST_TYPE(nsym->st_info);
-
-	if (otype != ntype) {
-		if ((otype == STT_SPARC_REGISTER) ||
-		    (ntype == STT_SPARC_REGISTER)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DIFFTYPE),
-			    demangle(sdp->sd_name));
-			eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES),
-			    sdp->sd_file->ifl_name,
-			    conv_info_type_str(ofl->ofl_e_machine, otype),
-			    ifl->ifl_name,
-			    conv_info_type_str(ofl->ofl_e_machine, ntype));
-			ofl->ofl_flags |= FLG_OF_FATAL;
-			return (1);
-		}
-	} else if (otype == STT_SPARC_REGISTER)
-		return (reg_check(sdp, nsym, sdp->sd_name, ifl, ofl));
-
-	return (0);
-}
-
-static const char *registers[] = { 0,
-	MSG_ORIG(MSG_STO_REGISTERG1),	MSG_ORIG(MSG_STO_REGISTERG2),
-	MSG_ORIG(MSG_STO_REGISTERG3),	MSG_ORIG(MSG_STO_REGISTERG4),
-	MSG_ORIG(MSG_STO_REGISTERG5),	MSG_ORIG(MSG_STO_REGISTERG6),
-	MSG_ORIG(MSG_STO_REGISTERG7)
-};
-
-const char *
-is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx,
-    const char *symsecname, Word * flags)
-{
-	const char	*name;
-
-	/*
-	 * Only do something if this is a register symbol.
-	 */
-	if (ELF_ST_TYPE(sym->st_info) != STT_SPARC_REGISTER)
-		return (0);
-
-	/*
-	 * Check for bogus register number.
-	 */
-	if ((sym->st_value < STO_SPARC_REGISTER_G1) ||
-	    (sym->st_value > STO_SPARC_REGISTER_G7)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), ifl->ifl_name,
-		    symsecname, symndx, EC_XWORD(sym->st_value));
-		return ((const char *)S_ERROR);
-	}
-
-	/*
-	 * A register symbol can only be undefined or defined (absolute).
-	 */
-	if ((shndx != SHN_ABS) && (shndx != SHN_UNDEF)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), ifl->ifl_name,
-		    symsecname, symndx, EC_XWORD(sym->st_value));
-		return ((const char *)S_ERROR);
-	}
-
-	/*
-	 * Determine whether this is a scratch (unnamed) definition.
-	 */
-	if (sym->st_name == 0) {
-		/*
-		 * Check for bogus scratch register definitions.
-		 */
-		if ((ELF_ST_BIND(sym->st_info) != STB_GLOBAL) ||
-		    (shndx != SHN_UNDEF)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADSCRATCH),
-			    ifl->ifl_name, symsecname, symndx,
-			    conv_sym_SPARC_value_str((Lword)sym->st_value));
-			return ((const char *)S_ERROR);
-		}
-
-		/*
-		 * Fabricate a name for this register so that this definition
-		 * can be processed through the symbol resolution engine.
-		 */
-		name = registers[sym->st_value];
-	} else
-		name = strs + sym->st_name;
-
-	/*
-	 * Indicate we're dealing with a register and return its name.
-	 */
-	*flags |= FLG_SY_REGSYM;
-	return (name);
-}
-
-Sym_desc *
-reg_find(Sym * sym, Ofl_desc * ofl)
-{
-	if (ofl->ofl_regsyms == 0)
-		return (0);
-
-	return (ofl->ofl_regsyms[sym->st_value]);
-}
-
-int
-reg_enter(Sym_desc * sdp, Ofl_desc * ofl)
-{
-	if (ofl->ofl_regsyms == 0) {
-		ofl->ofl_regsymsno = STO_SPARC_REGISTER_G7 + 1;
-		if ((ofl->ofl_regsyms = libld_calloc(sizeof (Sym_desc *),
-		    ofl->ofl_regsymsno)) == 0) {
-			ofl->ofl_flags |= FLG_OF_FATAL;
-			return (0);
-		}
-	}
-
-	ofl->ofl_regsyms[sdp->sd_sym->st_value] = sdp;
-	return (1);
-}
--- a/usr/src/cmd/sgs/libld/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libld/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,119 +18,72 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-BASEPLAT=	sparc
-include		$(SRC)/cmd/sgs/libld/Makefile.com
-
-#
-# Share machrel.c with the 32-bit sparc directory since
-# they both need the Elf32 and the Elf64 code.
-#
-L_MACHSRCS32=	../$(MACH)/machrel.c ../$(MACH)/machsym.c
-L_MACHSRCS64=	$(L_MACHSRCS32)
-CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h $(L_MACHSRCS32)
-
-LIB64=		libld.so.3
-$(LIB64) :=	SONAME = $(LIB64)
-
-DBGLIB =	-L ../../liblddbg/$(MACH64)
-ELFLIB =	-L ../../libelf/$(MACH64)
-
-CONVLIBDIR=	$(CONVLIBDIR64)
-LDDBGLIBDIR=	$(LDDBGLIBDIR64)
-ELFLIBDIR=	$(ELFLIBDIR64)
+L_MACHOBJS32 =	machrel.sparc32.o	machsym.sparc32.o
+L_MACHOBJS64 =	machrel.sparc64.o	machsym.sparc64.o
 
-LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
-
-SGSMSGTARG +=	$(SGSMSGSPARC)
-
-.PARALLEL:	$(LINTOUT32) $(LINTOUT64)
-
-PICS64=		$(OBJECTS:%=pics64/%)
-$(PICS64) :=	sparcv9_CFLAGS += -xregs=no%appl -K pic
-CPPFLAGS +=     -I../../../../uts/sparc/krtld
-CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64)
-$(PICS64)  :=	CFLAGS += $(CTF_FLAGS)
-$(PICS64)  :=	CFLAGS64 += $(CTF_FLAGS)
-$(PICS64)  :=	CTFCONVERT_POST = $(CTFCONVERT_O)
-$(LIB64)   :=	CTFMERGE_POST = $(CTFMERGE_LIB64)
-
-.PARALLEL:	$(PICS64)
-
-ROOTFS_LIBDIR=		$(VAR_LIBLD_64_ROOTFS_LIBDIR)
-ROOTFS_DYNLIB64=	$(ROOTFS_LIBDIR)/$(LIB64)
-$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+include		../Makefile.com
 
 .KEEP_STATE:
 
-all:		$(DYNLIB) $(LIBLINKS) .WAIT $(LIB64)
+ROOTFS_LIBDIR64 = \
+		$(VAR_LIBLD_64_ROOTFS_LIBDIR)
+ROOTFS_DYNLIB64 = \
+		$(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
+
+SGSMSGTARG +=	$(SGSMSGSPARC)
+
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
 
-$(LIB64) $(SGSPROTO)/$(LIB64): \
-		pics64 .WAIT $$(PICS64) $(MAPFILES)
-		$(CC) $(sparcv9_XARCH) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS)
-		$(POST_PROCESS_SO)
+$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+
+all:		$(DYNLIB) $(LIBLINKS)
 
-lint:		$(LINTLIB64) $(LINTOUT64)
+install \
+package:	all $(ROOTFS_DYNLIB64)
+
+include		../Makefile.targ
+include		../../Makefile.sub.64
+
+# Associate ELF32 and ELF64 objects to the appropriate headers.
 
-#
-# Share machrel.c with the base architecture, since they
-# both need all the Elf32 and Elf64 code.
-#
-pics/machrel.o:	../sparc/machrel.c
-		$(COMPILE.c) -o $@ ../sparc/machrel.c
-		$(POST_PROCESS_O)
+pics/%32.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
+pics/%64.o :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
+
+# Associate the various lint targets with the appropriate headers/files.
 
-pics64/machrel.o:	../sparc/machrel.c
-		$(COMPILE.c) -D_ELF64 -o $@ ../sparc/machrel.c
-		$(POST_PROCESS_O)
+$(LINTOUT32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET32)
+$(LINTOUT64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET64) -D_ELF64
+$(LINTLIB32) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET32)
+$(LINTLIB64) :=	CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \
+		    $(ELFTARGET64) -D_ELF64
 
-pics/machsym.o:	../sparc/machsym.c
-		$(COMPILE.c) -o $@ ../sparc/machsym.c
-		$(POST_PROCESS_O)
+LINTSRCS32 +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+LINTSRCS64 +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+
+# Compensate chkmsg with the doreloc family.
 
-pics64/machsym.o:	../sparc/machsym.c
-		$(COMPILE.c) -D_ELF64 -o $@ ../sparc/machsym.c
+CHKSRCS +=	$(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+CHKSRCS +=	$(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c)
+
+pics/%32.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET32) $<
 		$(POST_PROCESS_O)
 
-native:		$(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64)
-
-native-proto:
-		-@mkdir -p proto/$(MACH) proto/$(MACH64)
-
-pics64:
-		-@mkdir -p $@
-
-
-install package:	all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64)
-
-
-clean: clean64
-
-clean64:
-	-$(RM) $(PICS64)
-
-clobber: clobber64
-clobber64:
-	-$(RM) $(LIB64)
-
-delete:
-		$(RM) $(DYNLIB) $(LIB64)
-
-include		$(SRC)/cmd/sgs/libld/Makefile.targ
-include		../../Makefile.sub.64
-
-$(LIBLINKS) :=	DYNLIB=$(LIB64)
-
-pics64/%.o:	$(SRCBASE)/uts/sparc/krtld/%.c
-		$(COMPILE.c) -o $@ -D_ELF64 $<
+pics/%64.o: \
+		$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c
+		$(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $<
 		$(POST_PROCESS_O)
-
-pics/%.o:	$(SRCBASE)/uts/sparc/krtld/%.c
-		$(COMPILE.c) -o $@ $<
-		$(POST_PROCESS_O)
--- a/usr/src/cmd/sgs/liblddbg/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,10 +18,12 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 include		$(SRC)/cmd/sgs/Makefile.sub
--- a/usr/src/cmd/sgs/liblddbg/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,74 +18,87 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-LIBRARY=	liblddbg.a
-VERS=		.4
+LIBRARY =	liblddbg.a
+VERS =		.4
+
+COMOBJS =	args.o		audit.o		debug.o		syminfo.o \
+		tls.o
+
+COMOBJS32 =	bindings32.o	cap32.o		dynamic32.o	elf32.o \
+		entry32.o	files32.o	got32.o 	libs32.o \
+		map32.o		move32.o	phdr32.o	relocate32.o \
+		sections32.o	segments32.o	shdr32.o	statistics32.o \
+		support32.o	syms32.o	unused32.o	util32.o \
+		version32.o
 
-COMOBJS=	args.o		bindings.o	cap.o		debug.o	\
-		dynamic.o	entry.o		elf.o		files.o \
-		libs.o		map.o		phdr.o \
-		relocate.o	sections.o	segments.o	shdr.o \
-		support.o	syms.o		audit.o		util.o \
-		version.o	got.o		move.o		statistics.o \
-		tls.o		unused.o
-COMOBJS64=	files64.o	map64.o		relocate64.o	sections64.o \
-		segments64.o	syms64.o	audit64.o	got64.o \
-		move64.o	version64.o	statistics64.o	tls64.o \
-		unused64.o	cap64.o
-BLTOBJ=		msg.o
+COMOBJS64 =	bindings64.o	cap64.o		dynamic64.o	elf64.o \
+		entry64.o	files64.o	got64.o		libs64.o \
+		map64.o		move64.o	phdr64.o	relocate64.o \
+		sections64.o	segments64.o	shdr64.o	statistics64.o \
+		support64.o	syms64.o	unused64.o	util64.o \
+		version64.o
 
-OBJECTS=	$(BLTOBJ)  $(COMOBJS)  $(COMOBJS64)
+BLTOBJ =	msg.o
+
+TOOLOBJ =	alist.o
+
+OBJECTS =	$(BLTOBJ) $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(TOOLOBJ)
+
 
 include		$(SRC)/lib/Makefile.lib
 include		$(SRC)/cmd/sgs/Makefile.com
 
-MAPFILES=	../common/mapfile-vers
-MAPOPTS=	$(MAPFILES:%=-M%)
+MAPFILES +=	../common/mapfile-vers
+MAPOPTS =	$(MAPFILES:%=-M%)
 
+LINTFLAGS +=	-u -D_REENTRANT
+LINTFLAGS64 +=	-u -D_REENTRANT
 
 CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc $(VAR_LIBLDDBG_CPPFLAGS)
-DYNFLAGS +=	$(VERSREF) $(CONVLIBDIR) $(ZLAZYLOAD)
-LDLIBS +=	-lconv -lc
-LINTFLAGS +=	-u $(CONVLIBDIR) -D_REENTRANT
-LINTFLAGS64 +=	-u $(CONVLIBDIR64) -D_REENTRANT -erroff=E_CAST_INT_TO_SMALL_INT
-
+DYNFLAGS +=	$(VERSREF) $(MAPOPTS) $(ZLAZYLOAD) -R/usr/tmp '-R$$ORIGIN'
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
 
 # A bug in pmake causes redundancy when '+=' is conditionally assigned, so
 # '=' is used with extra variables.
-# $(DYNLIB) :=  DYNFLAGS += -Yl,$(SGSPROTO)
+# $(DYNLIB) :=  DYNFLAGS += $(USE_PROTO)
 #
 XXXFLAGS=
-$(DYNLIB) :=    XXXFLAGS= $(USE_PROTO) $(MAPOPTS)
+$(DYNLIB) :=	XXXFLAGS= $(USE_PROTO)
 DYNFLAGS +=     $(XXXFLAGS)
 
 native :=	MAPOPTS=
 native :=	DYNFLAGS	+= $(CONVLIBDIR)
 
-BLTDEFS=	msg.h
-BLTDATA=	msg.c
-BLTMESG=	$(SGSMSGDIR)/liblddbg
+BLTDEFS =	msg.h
+BLTDATA =	msg.c
+BLTMESG =	$(SGSMSGDIR)/liblddbg
 
-BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
+BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM=	../common/liblddbg.msg
-SGSMSGTARG=	$(SGSMSGCOM)
-SGSMSGALL=	$(SGSMSGCOM)
-
+SGSMSGCOM =	../common/liblddbg.msg
+SGSMSGALL =	$(SGSMSGCOM)
+SGSMSGTARG =	$(SGSMSGCOM)
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n liblddbg_msg
 
-SRCS=		../common/llib-llddbg
-LIBSRCS=	$(COMOBJS:%.o=../common/%.c)  $(BLTDATA)
-LIBSRCS64=	$(COMOBJS64:%64.o=%.c)
-LINTSRCS=	$(LIBSRCS) ../common/lintsup.c
+CHKSRCS =	$(COMOBJS32:%32.o=../common/%.c)
+
+SRCS =		../common/llib-llddbg
+LIBSRCS =	$(COMOBJS:%.o=../common/%.c) \
+		$(TOOLOBJ:%.o=$(SGSTOOLS)/common/%.c) $(BLTDATA)
 
-CLEANFILES +=	$(LINTOUTS) $(LINTLIBS) $(BLTFILES)
-CLOBBERFILES +=	$(DYNLIB)  $(LINTLIBS) $(LIBLINKS)
+LINTSRCS =	$(LIBSRCS) ../common/lintsup.c
+LINTSRCS32 =	$(COMOBJS32:%32.o=../common/%.c)
+LINTSRCS64 =	$(COMOBJS64:%64.o=../common/%.c)
 
-ROOTFS_DYNLIB=	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
+CLEANFILES +=	$(LINTOUTS) $(BLTFILES)
+CLOBBERFILES +=	$(DYNLIB) $(LINTLIBS) $(LIBLINKS)
+
+ROOTFS_DYNLIB =	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
--- a/usr/src/cmd/sgs/liblddbg/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,17 +18,26 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright (c) 2001 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 pics/%.o:	../common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
+pics/%.o:	$(SGSTOOLS)/common/%.c
+		$(COMPILE.c) -o $@ $<
+		$(POST_PROCESS_O)
+
+pics/%32.o:	../common/%.c
+		$(COMPILE.c) -o $@ $<
+		$(POST_PROCESS_O)
+
 pics/%64.o:	../common/%.c
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
@@ -42,6 +50,11 @@
 delete:
 		$(RM) $(DYNLIB)
 
+.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
+
+lint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
+		    .WAIT $(SGSLINTOUT)
+
 # Special target for native builds (ie. when we need to build a version of ld
 # to build a version of ld :-).
 
@@ -57,19 +70,14 @@
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
-# Derived source and header files (messaging)
+# Derived source and header files (messaging).
 
 catalog:	$(BLTMESG)
 
-chkmsg:		$(LIBSRCS)
-		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
+chkmsg:		$(LIBSRCS) $(CHKSRCS)
+		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
 
 $(BLTDEFS) + \
 $(BLTDATA) + \
 $(BLTMESG):	$(SGSMSGALL)
 		$(SGSMSG) $(SGSMSGFLAGS) $(SGSMSGALL)
-
-.PARALLEL:	$(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64)
-
-lint:		$(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \
-			$(SGSLINTOUT)
--- a/usr/src/cmd/sgs/liblddbg/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,27 +18,33 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.com
-
-ROOTFS_LIBDIR=		$(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR)
-ROOTFS_DYNLIB64=	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
-
-.KEEP_STATE:
+include		../Makefile.com
 
-all:		$(DYNLIB) $(LIBLINKS)
-
-install:	all $(ROOTFS_DYNLIB64)
-
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.targ
-include		../../Makefile.sub.64
+ROOTFS_LIBDIR64 = \
+		$(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR)
+ROOTFS_DYNLIB64 = \
+		$(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
 
 CONVLIBDIR =	$(CONVLIBDIR64)
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
+
+.KEEP_STATE:
+
+$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+
+all:		$(DYNLIB) $(LIBLINKS)
+
+install \
+package:	all $(ROOTFS_DYNLIB64)
+
+include		../Makefile.targ
+include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/liblddbg/common/_debug.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/_debug.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -36,69 +36,173 @@
 extern "C" {
 #endif
 
-extern	uint_t		_Dbg_mask;
-
-
 /*
  * Debugging is enabled by various tokens (see debug.c) that result in an
- * internal bit mask (_Dbg_mask) being initialized.  Each debugging function is
+ * internal bit mask (d_class) being initialized.  Each debugging function is
  * appropriate for one or more of the classes specified by the bit mask.  Each
  * debugging function validates whether it is appropriate for the present
  * classes before printing anything.
  */
-#define	DBG_NOTCLASS(c)	!(_Dbg_mask & DBG_MSK_CLASS & (c))
-#define	DBG_NOTDETAIL()	!(_Dbg_mask & DBG_DETAIL)
-#define	DBG_NOTLONG()	!(_Dbg_mask & DBG_LONG)
-
-#define	DBG_GLOBAL	0xf0000000	/* see include/debug.h */
-#define	DBG_LOCAL	0x0fffffff
-#define	DBG_MSK_CLASS	0x00ffffff
-
-#define	DBG_DETAIL	0x01000000
-#define	DBG_LONG	0x02000000
+#define	DBG_NOTCLASS(c)	!(dbg_desc->d_class & (c))
 
-#define	DBG_ARGS	0x00000001
-#define	DBG_BASIC	0x00000002
-#define	DBG_BINDINGS	0x00000004
-#define	DBG_ENTRY	0x00000008
-#define	DBG_FILES	0x00000010
-#define	DBG_HELP	0x00000020
-#define	DBG_LIBS	0x00000040
-#define	DBG_MAP		0x00000080
-#define	DBG_RELOC	0x00000100
-#define	DBG_SECTIONS	0x00000200
-#define	DBG_SEGMENTS	0x00000400
-#define	DBG_SYMBOLS	0x00000800
-#define	DBG_SUPPORT	0x00001000
-#define	DBG_VERSIONS	0x00002000
-#define	DBG_AUDITING	0x00004000
-#define	DBG_GOT		0x00008000
-#define	DBG_MOVE	0x00010000
-#define	DBG_DEMANGLE	0x00020000
-#define	DBG_TLS		0x00040000
-#define	DBG_STRTAB	0x00080000
-#define	DBG_STATISTICS	0x00100000
-#define	DBG_UNUSED	0x00200000
-#define	DBG_CAP		0x00400000
-#define	DBG_INIT	0x00800000
+#define	DBG_C_ARGS	0x00000001
+#define	DBG_C_BASIC	0x00000002
+#define	DBG_C_BINDINGS	0x00000004
+#define	DBG_C_ENTRY	0x00000008
+#define	DBG_C_FILES	0x00000010
+#define	DBG_C_HELP	0x00000020
+#define	DBG_C_LIBS	0x00000040
+#define	DBG_C_MAP	0x00000080
+#define	DBG_C_RELOC	0x00000100
+#define	DBG_C_SECTIONS	0x00000200
+#define	DBG_C_SEGMENTS	0x00000400
+#define	DBG_C_SYMBOLS	0x00000800
+#define	DBG_C_SUPPORT	0x00001000
+#define	DBG_C_VERSIONS	0x00002000
+#define	DBG_C_AUDITING	0x00004000
+#define	DBG_C_GOT	0x00008000
+#define	DBG_C_MOVE	0x00010000
+#define	DBG_C_DEMANGLE	0x00020000
+#define	DBG_C_TLS	0x00040000
+#define	DBG_C_STRTAB	0x00080000
+#define	DBG_C_STATS	0x00100000
+#define	DBG_C_UNUSED	0x00200000
+#define	DBG_C_CAP	0x00400000
+#define	DBG_C_INIT	0x00800000
 
-typedef struct options {
+#define	DBG_C_ALL	0xffffffff
+
+typedef struct {
 	const char	*o_name;	/* command line argument name */
-	uint_t		o_mask;		/* associated bit mask for this name */
-} DBG_options, *DBG_opts;
+	uint_t		o_class;	/* associated class for this name */
+	uint_t		o_extra;	/* associated extra for this name */
+} DBG_options;
+
+#define	AL_CNT_DEBUG	4
 
+/*
+ * Some Dbg_*() format strings differ depending on whether they are used for
+ * 32-bit or 64-bit values.
+ */
+#if	defined(_ELF64)
+
+#define	MSG_EDATA_TITLE		MSG_EDATA_TITLE_64
+#define	MSG_EDATA_ENTRY		MSG_EDATA_ENTRY_64
+
+#else
+
+#define	MSG_EDATA_TITLE		MSG_EDATA_TITLE_32
+#define	MSG_EDATA_ENTRY		MSG_EDATA_ENTRY_32
+
+#endif
 
 /*
- * Internal debugging routines.
+ * Some Elf_*() format strings differ depending on whether they are used for
+ * 32-bit or 64-bit values.
  */
-#ifdef _ELF64
-#define	_Dbg_seg_desc_entry	_Dbg_seg_desc_entry64
+#if	defined(_ELF64)
+
+#define	MSG_GOT_TITLE		MSG_GOT_TITLE_64
+#define	MSG_GOT_ENTRY_RE	MSG_GOT_ENTRY_RE_64
+#define	MSG_GOT_ENTRY_NR	MSG_GOT_ENTRY_NR_64
+
+#define	MSG_PHD_VADDR		MSG_PHD_VADDR_64
+#define	MSG_PHD_PADDR		MSG_PHD_PADDR_64
+#define	MSG_PHD_FILESZ		MSG_PHD_FILESZ_64
+#define	MSG_PHD_OFFSET		MSG_PHD_OFFSET_64
+
+#define	MSG_REL_EFSA_TITLE	MSG_REL_EFSA_TITLE_64
+#define	MSG_REL_EFLA_TITLE	MSG_REL_EFLA_TITLE_64
+#define	MSG_REL_EFSN_TITLE	MSG_REL_EFSN_TITLE_64
+#define	MSG_REL_EFLN_TITLE	MSG_REL_EFLN_TITLE_64
+#define	MSG_REL_EFSA_ENTRY	MSG_REL_EFSA_ENTRY_64
+#define	MSG_REL_EFLA_ENTRY	MSG_REL_EFLA_ENTRY_64
+#define	MSG_REL_EFSN_ENTRY	MSG_REL_EFSN_ENTRY_64
+#define	MSG_REL_EFLN_ENTRY	MSG_REL_EFLN_ENTRY_64
+#define	MSG_REL_RT_APLREG	MSG_REL_RT_APLREG_64
+#define	MSG_REL_RT_APLVAL	MSG_REL_RT_APLVAL_64
+#define	MSG_REL_RTA_TITLE	MSG_REL_RTA_TITLE_64
+#define	MSG_REL_RTN_TITLE	MSG_REL_RTN_TITLE_64
+#define	MSG_REL_RTV_TITLE	MSG_REL_RTV_TITLE_64
+#define	MSG_REL_RTA_ENTRY	MSG_REL_RTA_ENTRY_64
+#define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_64
+#define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_64
+#define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_64
+#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_64
+#define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_64
+#define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_64
+#define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_64
+#define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_64
+#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_64
+#define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_64
+#define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_64
+
+#define	MSG_SHD_ADDR		MSG_SHD_ADDR_64
+#define	MSG_SHD_SIZE		MSG_SHD_SIZE_64
+#define	MSG_SHD_OFFSET		MSG_SHD_OFFSET_64
+#define	MSG_SHD_ALIGN		MSG_SHD_ALIGN_64
+#define	MSG_SHD_LINK		MSG_SHD_LINK_64
+
+#define	MSG_SYM_EFS_ENTRY	MSG_SYM_EFS_ENTRY_64
+#define	MSG_SYM_EFL_ENTRY	MSG_SYM_EFL_ENTRY_64
+#define	MSG_SYM_EFS_TITLE	MSG_SYM_EFS_TITLE_64
+#define	MSG_SYM_EFL_TITLE	MSG_SYM_EFL_TITLE_64
+#define	MSG_SYM_LDS_TITLE	MSG_SYM_LDS_TITLE_64
+#define	MSG_SYM_LDL_TITLE	MSG_SYM_LDL_TITLE_64
+
+#else
+
+#define	MSG_GOT_TITLE		MSG_GOT_TITLE_32
+#define	MSG_GOT_ENTRY_RE	MSG_GOT_ENTRY_RE_32
+#define	MSG_GOT_ENTRY_NR	MSG_GOT_ENTRY_NR_32
+
+#define	MSG_PHD_VADDR		MSG_PHD_VADDR_32
+#define	MSG_PHD_PADDR		MSG_PHD_PADDR_32
+#define	MSG_PHD_FILESZ		MSG_PHD_FILESZ_32
+#define	MSG_PHD_OFFSET		MSG_PHD_OFFSET_32
+
+#define	MSG_REL_EFSA_TITLE	MSG_REL_EFSA_TITLE_32
+#define	MSG_REL_EFLA_TITLE	MSG_REL_EFLA_TITLE_32
+#define	MSG_REL_EFSN_TITLE	MSG_REL_EFSN_TITLE_32
+#define	MSG_REL_EFLN_TITLE	MSG_REL_EFLN_TITLE_32
+#define	MSG_REL_EFSA_ENTRY	MSG_REL_EFSA_ENTRY_32
+#define	MSG_REL_EFLA_ENTRY	MSG_REL_EFLA_ENTRY_32
+#define	MSG_REL_EFSN_ENTRY	MSG_REL_EFSN_ENTRY_32
+#define	MSG_REL_EFLN_ENTRY	MSG_REL_EFLN_ENTRY_32
+#define	MSG_REL_RT_APLREG	MSG_REL_RT_APLREG_32
+#define	MSG_REL_RT_APLVAL	MSG_REL_RT_APLVAL_32
+#define	MSG_REL_RTA_TITLE	MSG_REL_RTA_TITLE_32
+#define	MSG_REL_RTN_TITLE	MSG_REL_RTN_TITLE_32
+#define	MSG_REL_RTV_TITLE	MSG_REL_RTV_TITLE_32
+#define	MSG_REL_RTA_ENTRY	MSG_REL_RTA_ENTRY_32
+#define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_32
+#define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_32
+#define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_32
+#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_32
+#define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_32
+#define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_32
+#define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_32
+#define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_32
+#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_32
+#define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_32
+#define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_32
+
+#define	MSG_SHD_ADDR		MSG_SHD_ADDR_32
+#define	MSG_SHD_SIZE		MSG_SHD_SIZE_32
+#define	MSG_SHD_OFFSET		MSG_SHD_OFFSET_32
+#define	MSG_SHD_ALIGN		MSG_SHD_ALIGN_32
+#define	MSG_SHD_LINK		MSG_SHD_LINK_32
+
+#define	MSG_SYM_EFS_ENTRY	MSG_SYM_EFS_ENTRY_32
+#define	MSG_SYM_EFL_ENTRY	MSG_SYM_EFL_ENTRY_32
+#define	MSG_SYM_EFS_TITLE	MSG_SYM_EFS_TITLE_32
+#define	MSG_SYM_EFL_TITLE	MSG_SYM_EFL_TITLE_32
+#define	MSG_SYM_LDS_TITLE	MSG_SYM_LDS_TITLE_32
+#define	MSG_SYM_LDL_TITLE	MSG_SYM_LDL_TITLE_32
+
 #endif
-extern	const char	*_Dbg_sym_dem(const char *);
-extern	void		_Dbg_elf_data_in(Os_desc *, Is_desc *);
-extern	void		_Dbg_elf_data_out(Os_desc *);
-extern	void		_Dbg_ent_entry(Half, Ent_desc * enp);
-extern	void		_Dbg_seg_desc_entry(Half, int, Sg_desc *);
+
+#define	INDEX_STR_SIZE		10
 
 #ifdef	__cplusplus
 }
--- a/usr/src/cmd/sgs/liblddbg/common/_synonyms.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/_synonyms.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 1996-2002 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #ifndef	_SYNONYMS_DOT_H
@@ -33,6 +33,8 @@
 extern "C" {
 #endif
 
+#if	!defined(__lint)
+
 /*
  * Some synonyms definitions - ld.so.1 exports sufficient functions from its
  * libc contents for liblddbg to bind.  The intention is insure that liblddbg
@@ -43,6 +45,8 @@
 #define	open	_open
 #define	write	_write
 
+#endif
+
 #ifdef	__cplusplus
 }
 #endif
--- a/usr/src/cmd/sgs/liblddbg/common/args.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/args.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,29 +18,32 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1998 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
+
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
+#include	<debug.h>
+#include	"_debug.h"
 #include	"msg.h"
-#include	"_debug.h"
 
 void
-Dbg_args_flags(int ndx, int c)
+Dbg_args_flags(Lm_list *lml, int ndx, int c)
 {
-	if (DBG_NOTCLASS(DBG_ARGS))
+	if (DBG_NOTCLASS(DBG_C_ARGS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_ARG_FLAG), ndx, c);
+	dbg_print(lml, MSG_INTL(MSG_ARG_FLAG), ndx, c);
 }
 
 void
-Dbg_args_files(int ndx, char * file)
+Dbg_args_files(Lm_list *lml, int ndx, char *file)
 {
-	if (DBG_NOTCLASS(DBG_ARGS))
+	if (DBG_NOTCLASS(DBG_C_ARGS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_ARG_FILE), ndx, file);
+	dbg_print(lml, MSG_INTL(MSG_ARG_FILE), ndx, file);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/audit.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/audit.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,54 +31,53 @@
 #include	"msg.h"
 #include	"libld.h"
 
-
 void
-Dbg_audit_version(const char *lib, ulong_t version)
+Dbg_audit_version(Lm_list *lml, const char *lib, ulong_t version)
 {
-	if (DBG_NOTCLASS(DBG_AUDITING))
+	if (DBG_NOTCLASS(DBG_C_AUDITING))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_AUD_VERSION), lib, (int)version);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_AUD_VERSION), lib, (int)version);
 }
 
 void
-Dbg_audit_lib(const char *lib)
+Dbg_audit_lib(Lm_list *lml, const char *lib)
 {
-	if (DBG_NOTCLASS(DBG_AUDITING))
+	if (DBG_NOTCLASS(DBG_C_AUDITING))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_AUD_INIT), lib);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_AUD_INIT), lib);
 }
 
 void
-Dbg_audit_interface(const char *lib, const char *interface)
+Dbg_audit_interface(Lm_list *lml, const char *lib, const char *interface)
 {
-	if (DBG_NOTCLASS(DBG_AUDITING))
+	if (DBG_NOTCLASS(DBG_C_AUDITING))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_AUD_INTERFACE), lib, interface);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_AUD_INTERFACE), lib, interface);
 }
 
 void
-Dbg_audit_object(const char *lib, const char *obj)
+Dbg_audit_object(Lm_list *lml, const char *lib, const char *obj)
 {
-	if (DBG_NOTCLASS(DBG_AUDITING))
+	if (DBG_NOTCLASS(DBG_C_AUDITING))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_AUD_OBJECT), lib, obj);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_AUD_OBJECT), lib, obj);
 }
 
 void
-Dbg_audit_symval(const char *lib, const char *func, const char *sym,
-    Addr pval, Addr nval)
+Dbg_audit_symval(Lm_list *lml, const char *lib, const char *func,
+    const char *sym, Addr pval, Addr nval)
 {
 	char	mesg[100];
 
-	if (DBG_NOTCLASS(DBG_AUDITING))
+	if (DBG_NOTCLASS(DBG_C_AUDITING))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -88,6 +87,6 @@
 	else
 		(void) sprintf(mesg, MSG_INTL(MSG_AUD_SYMNEW), EC_XWORD(nval));
 
-	dbg_print(MSG_INTL(MSG_AUD_SYM), lib, func, _Dbg_sym_dem(sym),
+	dbg_print(lml, MSG_INTL(MSG_AUD_SYM), lib, func, Dbg_demangle_name(sym),
 	    EC_XWORD(pval), mesg);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/bindings.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/bindings.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,31 +28,35 @@
 
 #include	<sys/types.h>
 #include	<string.h>
+#include	<debug.h>
+#include	<conv.h>
+#include	"_debug.h"
 #include	"msg.h"
-#include	"_debug.h"
 
 void
-Dbg_bind_plt_summary(Half mach, Word pltcnt21d, Word pltcnt24d, Word pltcntu32,
-    Word pltcntu44, Word pltcntfull, Word pltcntfar)
+Dbg_bind_plt_summary(Lm_list *lml, Half mach, Word pltcnt21d, Word pltcnt24d,
+    Word pltcntu32, Word pltcntu44, Word pltcntfull, Word pltcntfar)
 {
 	Word plttotal = pltcnt21d + pltcnt24d + pltcntu32 +
 		pltcntu44 + pltcntfull + pltcntfar;
 
-	if (DBG_NOTCLASS(DBG_BINDINGS))
+	if (DBG_NOTCLASS(DBG_C_BINDINGS))
 		return;
 
 	switch (mach) {
 	case EM_SPARC:
-		dbg_print(MSG_INTL(MSG_BND_PSUM_SPARC), EC_WORD(pltcnt21d),
+		dbg_print(lml, MSG_INTL(MSG_BND_PSUM_SPARC), EC_WORD(pltcnt21d),
 		    EC_WORD(pltcnt24d), EC_WORD(pltcntfull), EC_WORD(plttotal));
 		break;
 	case EM_SPARCV9:
-		dbg_print(MSG_INTL(MSG_BND_PSUM_SPARCV9), EC_WORD(pltcnt21d),
-		    EC_WORD(pltcnt24d), EC_WORD(pltcntu32), EC_WORD(pltcntu44),
-		    EC_WORD(pltcntfull), EC_WORD(pltcntfar), EC_WORD(plttotal));
+		dbg_print(lml, MSG_INTL(MSG_BND_PSUM_SPARCV9),
+		    EC_WORD(pltcnt21d), EC_WORD(pltcnt24d), EC_WORD(pltcntu32),
+		    EC_WORD(pltcntu44), EC_WORD(pltcntfull), EC_WORD(pltcntfar),
+		    EC_WORD(plttotal));
 		break;
 	default:
-		dbg_print(MSG_INTL(MSG_BND_PSUM_DEFAULT), EC_WORD(plttotal));
+		dbg_print(lml, MSG_INTL(MSG_BND_PSUM_DEFAULT),
+		    EC_WORD(plttotal));
 		break;
 	};
 }
@@ -68,99 +72,56 @@
 };
 
 #define	BINFOSZ	MSG_BINFO_START_SIZE + \
-		MSG_BINFO_DIRECT_SIZE + \
-		MSG_BINFO_SEP_SIZE + \
-		MSG_BINFO_COPYREF_SIZE + \
-		MSG_BINFO_SEP_SIZE + \
-		MSG_BINFO_FILTEE_SIZE + \
-		MSG_BINFO_SEP_SIZE + \
+		MSG_BINFO_DIRECT_SIZE +		MSG_BINFO_SEP_SIZE + \
+		MSG_BINFO_INTERPOSE_SIZE +	MSG_BINFO_SEP_SIZE + \
+		MSG_BINFO_COPYREF_SIZE +	MSG_BINFO_SEP_SIZE + \
+		MSG_BINFO_FILTEE_SIZE +		MSG_BINFO_SEP_SIZE + \
 		MSG_BINFO_PLTADDR_SIZE + \
-		MSG_BINFO_END_SIZE + 1
+		CONV_INV_STRSIZE + MSG_BINFO_END_SIZE
 
-/*
- * Normally we don't want to display any ld.so.1 bindings (i.e. the bindings
- * to these calls themselves). So, if a Dbg_bind_global() originates from
- * ld.so.1 don't print anything.  If we really want to see the ld.so.1 bindings,
- * simply give the run-time linker a different SONAME.
- */
+
 void
-Dbg_bind_global(const char *ffile, caddr_t fabs, caddr_t frel, Xword pltndx,
-    Pltbindtype pbtype, const char *tfile, caddr_t tabs, caddr_t trel,
+Dbg_bind_global(Rt_map *flmp, Addr fabs, Off foff, Xword pltndx,
+    Pltbindtype pbtype, Rt_map *tlmp, Addr tabs, Off toff,
     const char *sym, uint_t binfo)
 {
-	const char	*rfile;
+	static Val_desc vda[] = {
+		{ DBG_BINFO_DIRECT,	MSG_ORIG(MSG_BINFO_DIRECT) },
+		{ DBG_BINFO_INTERPOSE,	MSG_ORIG(MSG_BINFO_INTERPOSE) },
+		{ DBG_BINFO_COPYREF,	MSG_ORIG(MSG_BINFO_COPYREF) },
+		{ DBG_BINFO_FILTEE,	MSG_ORIG(MSG_BINFO_FILTEE) },
+		{ DBG_BINFO_PLTADDR,	MSG_ORIG(MSG_BINFO_PLTADDR) },
+		{ 0,			0 }
+	};
 	char		binfostr[BINFOSZ];
-
-	if (DBG_NOTCLASS(DBG_BINDINGS))
-		return;
+	const char	*ffile = NAME(flmp);
+	const char	*tfile = NAME(tlmp);
+	Lm_list		*lml = LIST(flmp);
 
-	if ((rfile = strrchr(ffile, '/')) == NULL)
-		rfile = ffile;
-	else
-		rfile++;
-
-	if (strcmp(rfile, MSG_ORIG(MSG_FIL_RTLD)) == 0)
+	if (DBG_NOTCLASS(DBG_C_BINDINGS))
 		return;
 
 	if (DBG_NOTDETAIL()) {
-		dbg_print(MSG_INTL(MSG_BND_BASIC), ffile, tfile,
-		    _Dbg_sym_dem(sym));
+		dbg_print(lml, MSG_INTL(MSG_BND_BASIC), ffile, tfile,
+		    Dbg_demangle_name(sym));
 		return;
 	}
 
 	/*
 	 * Determine if this binding has any associated information, such as
-	 * and interposition, direct binding, copy-relocations, etc.
+	 * interposition, direct binding, copy-relocations, etc.
 	 */
 	binfo &= ~DBG_BINFO_FOUND;
 	binfo &= DBG_BINFO_MSK;
 	if (binfo) {
-		int	_binfo = 0;
+		(void) strlcpy(binfostr, MSG_ORIG(MSG_BINFO_START), BINFOSZ);
 
-		(void) strcpy(binfostr, MSG_ORIG(MSG_BINFO_START));
-		if (binfo & DBG_BINFO_DIRECT) {
-			_binfo |= DBG_BINFO_DIRECT;
-			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_DIRECT));
-		}
-		if (binfo & DBG_BINFO_INTERPOSE) {
-			if (_binfo)
-			    (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP));
-			_binfo |= DBG_BINFO_INTERPOSE;
-			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_INTERPOSE));
-		}
-		if (binfo & DBG_BINFO_COPYREF) {
-			if (_binfo)
-			    (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP));
-			_binfo |= DBG_BINFO_COPYREF;
-			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_COPYREF));
-		}
-		if (binfo & DBG_BINFO_FILTEE) {
-			if (_binfo)
-			    (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP));
-			_binfo |= DBG_BINFO_FILTEE;
-			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_FILTEE));
-		}
-		if (binfo & DBG_BINFO_PLTADDR) {
-			if (_binfo)
-			    (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP));
-			_binfo |= DBG_BINFO_PLTADDR;
-			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_PLTADDR));
-		}
-		if (binfo & ~_binfo) {
-			size_t	len;
-
-			if (_binfo)
-			    (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP));
-
-			len = strlen(binfostr);
-			conv_invalid_str(&binfostr[len], (BINFOSZ - len),
-			    (Lword)(binfo & ~_binfo), 0);
-		}
-		(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_END));
+		if (conv_expn_field(binfostr, BINFOSZ, vda, binfo, binfo,
+		    MSG_ORIG(MSG_BINFO_SEP), 0))
+			(void) strcat(binfostr, MSG_ORIG(MSG_BINFO_END));
 	} else
 		binfostr[0] = '\0';
 
-
 	if (pltndx != (Xword)-1) {
 		const char	*pltstring;
 
@@ -172,48 +133,71 @@
 		/*
 		 * Called from a plt offset.
 		 */
-		dbg_print(MSG_INTL(MSG_BND_PLT), ffile, EC_ADDR(fabs),
-		    EC_ADDR(frel), EC_WORD(pltndx), pltstring, tfile,
-		    EC_ADDR(tabs), EC_ADDR(trel), _Dbg_sym_dem(sym), binfostr);
+		dbg_print(lml, MSG_INTL(MSG_BND_PLT), ffile, EC_ADDR(fabs),
+		    EC_OFF(foff), EC_XWORD(pltndx), pltstring, tfile,
+		    EC_ADDR(tabs), EC_OFF(toff), Dbg_demangle_name(sym),
+		    binfostr);
 
-	} else if ((fabs == 0) && (frel == 0)) {
+	} else if ((fabs == 0) && (foff == 0)) {
 		/*
 		 * Called from a dlsym().  We're not performing a relocation,
 		 * but are handing the address of the symbol back to the user.
 		 */
-		dbg_print(MSG_INTL(MSG_BND_DLSYM), ffile, tfile, EC_ADDR(tabs),
-		    EC_ADDR(trel), _Dbg_sym_dem(sym), binfostr);
-
+		dbg_print(lml, MSG_INTL(MSG_BND_DLSYM), ffile, tfile,
+		    EC_ADDR(tabs), EC_OFF(toff), Dbg_demangle_name(sym),
+		    binfostr);
 	} else {
 		/*
 		 * Standard relocation.
 		 */
-		dbg_print(MSG_INTL(MSG_BND_DEFAULT), ffile, EC_ADDR(fabs),
-		    EC_ADDR(frel), tfile, EC_ADDR(tabs), EC_ADDR(trel),
-		    _Dbg_sym_dem(sym), binfostr);
+		dbg_print(lml, MSG_INTL(MSG_BND_DEFAULT), ffile, EC_ADDR(fabs),
+		    EC_OFF(foff), tfile, EC_ADDR(tabs), EC_OFF(toff),
+		    Dbg_demangle_name(sym), binfostr);
 	}
 }
 
 void
-Dbg_bind_weak(const char *ffile, caddr_t fabs, caddr_t frel, const char *sym)
+Dbg_bind_weak(Rt_map *flmp, Addr fabs, Addr frel, const char *sym)
 {
-	if (DBG_NOTCLASS(DBG_BINDINGS))
+	Lm_list		*lml = LIST(flmp);
+	const char	*ffile = NAME(flmp);
+
+	if (DBG_NOTCLASS(DBG_C_BINDINGS))
 		return;
 
 	if (DBG_NOTDETAIL())
-		dbg_print(MSG_INTL(MSG_BND_WEAK_1), ffile, _Dbg_sym_dem(sym));
+		dbg_print(lml, MSG_INTL(MSG_BND_WEAK_1), ffile,
+		    Dbg_demangle_name(sym));
 	else
-		dbg_print(MSG_INTL(MSG_BND_WEAK_2), ffile, EC_ADDR(fabs),
-		    EC_ADDR(frel), _Dbg_sym_dem(sym));
+		dbg_print(lml, MSG_INTL(MSG_BND_WEAK_2), ffile, EC_ADDR(fabs),
+		    EC_ADDR(frel), Dbg_demangle_name(sym));
 }
 
+#if	defined(_ELF64)
+
 void
-Dbg_bind_profile(uint_t ndx, uint_t count)
+Dbg_bind_pltpad_to(Rt_map *lmp, Addr pltpad, const char *dfile,
+    const char *sname)
 {
-	if (DBG_NOTCLASS(DBG_BINDINGS))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_BND_PROFILE), EC_WORD(ndx), EC_WORD(count));
+	dbg_print(LIST(lmp), MSG_INTL(MSG_BND_PLTPAD_TO), EC_ADDR(pltpad),
+	    NAME(lmp), dfile, sname);
 }
+
+void
+Dbg_bind_pltpad_from(Rt_map *lmp, Addr pltpad, const char *sname)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	dbg_print(LIST(lmp), MSG_INTL(MSG_BND_PLTPAD_FROM), EC_ADDR(pltpad),
+	    NAME(lmp), sname);
+}
+
+#endif
--- a/usr/src/cmd/sgs/liblddbg/common/cap.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/cap.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,71 +18,49 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"_synonyms.h"
-
+#include	<debug.h>
+#include	<libld.h>
+#include	<conv.h>
 #include	"msg.h"
 #include	"_debug.h"
-#include	"libld.h"
-
-#if	!defined(_ELF64)
 
 void
-Dbg_cap_hw_candidate(const char *name)
+Dbg_cap_hw_candidate(Lm_list *lml, const char *name)
 {
-	if (DBG_NOTCLASS(DBG_CAP | DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_INTL(MSG_CAP_HW_CANDIDATE), name);
+	dbg_print(lml, MSG_INTL(MSG_CAP_HW_CANDIDATE), name);
 }
 
 void
-Dbg_cap_hw_filter(const char *dir, const char *filtee)
+Dbg_cap_hw_filter(Lm_list *lml, const char *dir, Rt_map *flmp)
 {
-	if (DBG_NOTCLASS(DBG_CAP | DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	if (filtee)
-		dbg_print(MSG_INTL(MSG_CAP_HWFILTR_1), dir, filtee);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	if (flmp)
+		dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_1), dir, NAME(flmp));
 	else
-		dbg_print(MSG_INTL(MSG_CAP_HWFILTR_2), dir);
+		dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_2), dir);
 }
 
 void
-Dbg_cap_sec_title(const char *file)
+Dbg_cap_val_hw1(Lm_list *lml, Xword val, Half mach)
 {
-	if (DBG_NOTCLASS(DBG_CAP))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_CAP_SEC_TITLE), file);
-}
-
-void
-Gelf_cap_title(void)
-{
-	dbg_print(MSG_INTL(MSG_CAP_ELF_TITLE));
+	Dbg_util_nl(lml, DBG_NL_FRC);
+	dbg_print(lml, MSG_INTL(MSG_CAP_VAL_HW1), conv_cap_val_hw1(val, mach));
+	Dbg_util_nl(lml, DBG_NL_FRC);
 }
 
-void
-Gelf_cap_print(GElf_Cap * cap, int ndx, Half mach)
-{
-	char	index[10];
-
-	(void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx);
-	dbg_print(MSG_INTL(MSG_CAP_ELF_ENTRY), index,
-	    conv_captag_str(cap->c_tag),
-	    conv_capval_str(cap->c_tag, cap->c_un.c_val, mach));
-}
-
-#endif
-
 static const Msg captype[] = {
 	MSG_STR_INITIAL,		/* MSG_INTL(MSG_STR_INITIAL) */
 	MSG_STR_IGNORE,			/* MSG_INTL(MSG_STR_IGNORE) */
@@ -93,29 +70,50 @@
 };
 
 void
-Dbg_cap_sec_entry(uint_t type, Xword tag, Xword val, Half mach)
+Dbg_cap_mapfile(Lm_list *lml, Xword tag, Xword val, Half mach)
 {
-	if (DBG_NOTCLASS(DBG_CAP))
+	if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_CAP))
 		return;
 
-	dbg_print(MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]),
-	    conv_captag_str(tag), conv_capval_str(tag, val, mach));
+	dbg_print(lml, MSG_INTL(MSG_MAP_CAP));
+	Dbg_cap_sec_entry(lml, DBG_CAP_INITIAL, tag, val, mach);
+}
+
+void
+Dbg_cap_sec_entry(Lm_list *lml, uint_t type, Xword tag, Xword val, Half mach)
+{
+	if (DBG_NOTCLASS(DBG_C_CAP))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]),
+	    conv_cap_tag(tag), conv_cap_val(tag, val, mach));
 }
 
 void
-Dbg_cap_mapfile(Xword tag, Xword val, Half mach)
+Dbg_cap_sec_title(Ofl_desc *ofl)
 {
-	if (DBG_NOTCLASS(DBG_MAP | DBG_CAP))
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_CAP))
 		return;
 
-	dbg_print(MSG_INTL(MSG_MAP_CAP));
-	Dbg_cap_sec_entry(DBG_CAP_INITIAL, tag, val, mach);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_CAP_SEC_TITLE), ofl->ofl_name);
 }
 
 void
-Dbg_cap_hw_1(Xword val, Half mach)
+Elf_cap_title(Lm_list *lml)
+{
+	dbg_print(lml, MSG_INTL(MSG_CAP_ELF_TITLE));
+}
+
+void
+Elf_cap_entry(Lm_list *lml, Cap *cap, int ndx, Half mach)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_CAP_HW_1), conv_hwcap_1_str(val, mach));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	char	index[INDEX_STR_SIZE];
+
+	(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx);
+	dbg_print(lml, MSG_INTL(MSG_CAP_ELF_ENTRY), index,
+	    conv_cap_tag(cap->c_tag),
+	    conv_cap_val(cap->c_tag, cap->c_un.c_val, mach));
 }
--- a/usr/src/cmd/sgs/liblddbg/common/debug.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/debug.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,144 +18,203 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
+#define		dgettext	_dgettext
+
+#include	<libintl.h>
+#include	<sys/varargs.h>
 #include	<stdio.h>
 #include	<string.h>
 #include	<stdlib.h>
-#include	"_debug.h"
-#include	"msg.h"
+#include	<alist.h>
+#include	<debug.h>
+#include	<_debug.h>
+#include	<msg.h>
 
-uint_t		_Dbg_mask;
-static int	_Dbg_count = 0;
+/*
+ * Define a debug descriptor.  Note, although this provides the default
+ * definition to which most users bind, ld.so.1 must provide its own definition,
+ * and thus interposition is expected.  This item should be defined NODIRECT.
+ */
+static Dbg_desc	_dbg_desc = { 0, 0, 0 };
+Dbg_desc	*dbg_desc = &_dbg_desc;
 
+int		_Dbg_cnt = 0;
 
 /*
- * Debugging initialization and processing.  The options structure defines
+ * Debugging initialization and processing.  The dbg_options[] array defines
  * a set of option strings that can be specified using the -D flag or from an
- * environment variable.  For each option, a class is enabled in the _Dbg_mask
- * bit mask.
+ * environment variable.  For each option, a class is enabled in the d_class
+ * bit mask, or an extra flag is enabled in the d_extra bit mask.
  */
-static DBG_options _Dbg_options[] = {
-	{MSG_ORIG(MSG_TOK_NAME),	DBG_G_SNAME},
-	{MSG_ORIG(MSG_TOK_FULLNAME),	DBG_G_SNAME | DBG_G_FNAME},
-	{MSG_ORIG(MSG_TOK_CLASS),	DBG_G_SNAME | DBG_G_CLASS},
+DBG_options _Dbg_options[] = {
+	{MSG_ORIG(MSG_TOK_DETAIL),	0,	DBG_E_DETAIL},
+	{MSG_ORIG(MSG_TOK_LONG),	0,	DBG_E_LONG},
+	{MSG_ORIG(MSG_TOK_NAME),	0,	DBG_E_SNAME},
+	{MSG_ORIG(MSG_TOK_FULLNAME),	0,	DBG_E_SNAME | DBG_E_FNAME},
+	{MSG_ORIG(MSG_TOK_CLASS),	0,	DBG_E_SNAME | DBG_E_CLASS},
+	{MSG_ORIG(MSG_TOK_LMID),	0,	DBG_E_LMID},
 
-	{MSG_ORIG(MSG_TOK_ALL),		DBG_LOCAL},
-	{MSG_ORIG(MSG_TOK_ARGS),	DBG_ARGS},
-	{MSG_ORIG(MSG_TOK_BASIC),	DBG_BASIC},
-	{MSG_ORIG(MSG_TOK_BINDINGS),	DBG_BINDINGS},
-	{MSG_ORIG(MSG_TOK_DETAIL),	DBG_DETAIL},
-	{MSG_ORIG(MSG_TOK_ENTRY),	DBG_ENTRY},
-	{MSG_ORIG(MSG_TOK_FILES),	DBG_FILES},
-	{MSG_ORIG(MSG_TOK_HELP),	DBG_HELP},
-	{MSG_ORIG(MSG_TOK_LIBS),	DBG_LIBS},
-	{MSG_ORIG(MSG_TOK_LONG),	DBG_LONG},
-	{MSG_ORIG(MSG_TOK_MAP),		DBG_MAP},
-	{MSG_ORIG(MSG_TOK_RELOC),	DBG_RELOC},
-	{MSG_ORIG(MSG_TOK_SECTIONS),	DBG_SECTIONS},
-	{MSG_ORIG(MSG_TOK_SEGMENTS),	DBG_SEGMENTS},
-	{MSG_ORIG(MSG_TOK_SUPPORT),	DBG_SUPPORT},
-	{MSG_ORIG(MSG_TOK_SYMBOLS),	DBG_SYMBOLS},
-	{MSG_ORIG(MSG_TOK_TLS),		DBG_TLS},
-	{MSG_ORIG(MSG_TOK_AUDIT),	DBG_AUDITING},
-	{MSG_ORIG(MSG_TOK_VERSIONS),	DBG_VERSIONS},
-	{MSG_ORIG(MSG_TOK_GOT),		DBG_GOT},
-	{MSG_ORIG(MSG_TOK_MOVE),	DBG_MOVE},
-	{MSG_ORIG(MSG_TOK_STRTAB),	DBG_STRTAB},
-	{MSG_ORIG(MSG_TOK_STATISTICS),	DBG_STATISTICS},
-	{MSG_ORIG(MSG_TOK_UNUSED),	DBG_UNUSED},
+	{MSG_ORIG(MSG_TOK_ALL),		DBG_C_ALL,	0},
+	{MSG_ORIG(MSG_TOK_ARGS),	DBG_C_ARGS,	0},
+	{MSG_ORIG(MSG_TOK_BASIC),	DBG_C_BASIC,	0},
+	{MSG_ORIG(MSG_TOK_BINDINGS),	DBG_C_BINDINGS,	0},
+	{MSG_ORIG(MSG_TOK_ENTRY),	DBG_C_ENTRY,	0},
+	{MSG_ORIG(MSG_TOK_FILES),	DBG_C_FILES,	0},
+	{MSG_ORIG(MSG_TOK_HELP),	DBG_C_HELP,	0},
+	{MSG_ORIG(MSG_TOK_LIBS),	DBG_C_LIBS,	0},
+	{MSG_ORIG(MSG_TOK_MAP),		DBG_C_MAP,	0},
+	{MSG_ORIG(MSG_TOK_RELOC),	DBG_C_RELOC,	0},
+	{MSG_ORIG(MSG_TOK_SECTIONS),	DBG_C_SECTIONS,	0},
+	{MSG_ORIG(MSG_TOK_SEGMENTS),	DBG_C_SEGMENTS,	0},
+	{MSG_ORIG(MSG_TOK_SUPPORT),	DBG_C_SUPPORT,	0},
+	{MSG_ORIG(MSG_TOK_SYMBOLS),	DBG_C_SYMBOLS,	0},
+	{MSG_ORIG(MSG_TOK_TLS),		DBG_C_TLS,	0},
+	{MSG_ORIG(MSG_TOK_AUDIT),	DBG_C_AUDITING,	0},
+	{MSG_ORIG(MSG_TOK_VERSIONS),	DBG_C_VERSIONS,	0},
+	{MSG_ORIG(MSG_TOK_GOT),		DBG_C_GOT,	0},
+	{MSG_ORIG(MSG_TOK_MOVE),	DBG_C_MOVE,	0},
+	{MSG_ORIG(MSG_TOK_STRTAB),	DBG_C_STRTAB,	0},
+	{MSG_ORIG(MSG_TOK_STATS),	DBG_C_STATS,	0},
+	{MSG_ORIG(MSG_TOK_UNUSED),	DBG_C_UNUSED,	0},
 #ifdef	DEMANGLE
-	{MSG_ORIG(MSG_TOK_DEMANGLE),	DBG_DEMANGLE},
+	{MSG_ORIG(MSG_TOK_DEMANGLE),	DBG_C_DEMANGLE,	0},
 #endif
-	{MSG_ORIG(MSG_TOK_CAP),		DBG_CAP},
-	{MSG_ORIG(MSG_TOK_INIT),	DBG_INIT},
+	{MSG_ORIG(MSG_TOK_CAP),		DBG_C_CAP,	0},
+	{MSG_ORIG(MSG_TOK_INIT),	DBG_C_INIT,	0},
 	{NULL,				NULL},
 };
 
 /*
+ * Tokens may also define identifiers for diagnostics.  Presently, only ld.so.1
+ * uses these strings to identify, or isolate its output to selected link-map
+ * lists.  See ld.so.1:dbg_print().
+ */
+const char *_Dbg_strs[] = {
+	MSG_ORIG(MSG_TOK_BASE),		MSG_ORIG(MSG_TOK_LDSO),
+	MSG_ORIG(MSG_TOK_NEWLM),	NULL
+};
+
+/*
  * Provide a debugging usage message
  */
-static void
-_Dbg_usage()
+void
+Dbg_usage()
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_A));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_B));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_C));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_D));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_E));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_F));
-	dbg_print(MSG_INTL(MSG_USE_RTLD_G));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_A));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_B));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_C));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_D));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_E));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_F));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_G));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_H));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_I));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_J));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_K));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_L));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_M));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_N));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_O));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_P));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_Q));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_R));
+	dbg_print(0, MSG_INTL(MSG_USE_RTLD_S));
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_USE_LD_A));
-	dbg_print(MSG_INTL(MSG_USE_LD_B));
-	dbg_print(MSG_INTL(MSG_USE_LD_C));
-	dbg_print(MSG_INTL(MSG_USE_LD_D));
-	dbg_print(MSG_INTL(MSG_USE_LD_E));
-	dbg_print(MSG_INTL(MSG_USE_LD_F));
-	dbg_print(MSG_INTL(MSG_USE_LD_G));
-	dbg_print(MSG_INTL(MSG_USE_LD_H));
-	dbg_print(MSG_INTL(MSG_USE_LD_I));
-	dbg_print(MSG_INTL(MSG_USE_LD_J));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_LD_A));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_B));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_C));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_D));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_E));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_F));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_G));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_H));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_LD_I));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_LD_J));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_K));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_LD_L));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_LD_M));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_N));
+	dbg_print(0, MSG_INTL(MSG_USE_LD_O));
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_USE_ARGS));
-	dbg_print(MSG_INTL(MSG_USE_AUDIT));
-	dbg_print(MSG_INTL(MSG_USE_BASIC));
-	dbg_print(MSG_INTL(MSG_USE_BINDINGS));
-	dbg_print(MSG_INTL(MSG_USE_BINDINGS_2));
-	dbg_print(MSG_INTL(MSG_USE_CAP));
-	dbg_print(MSG_INTL(MSG_USE_DETAIL));
+	Dbg_util_nl(0, DBG_NL_FRC);
+	Dbg_util_nl(0, DBG_NL_FRC);
+	dbg_print(0, MSG_INTL(MSG_USE_ARGS));
+	dbg_print(0, MSG_INTL(MSG_USE_AUDIT));
+	dbg_print(0, MSG_INTL(MSG_USE_BASIC));
+	dbg_print(0, MSG_INTL(MSG_USE_BINDINGS));
+	dbg_print(0, MSG_INTL(MSG_USE_BINDINGS_2));
+	dbg_print(0, MSG_INTL(MSG_USE_CAP));
+	dbg_print(0, MSG_INTL(MSG_USE_DETAIL));
 #ifdef	DEMANGLE
-	dbg_print(MSG_INTL(MSG_USE_DEMANGLE));
+	dbg_print(0, MSG_INTL(MSG_USE_DEMANGLE));
 #endif
-	dbg_print(MSG_INTL(MSG_USE_ENTRY));
-	dbg_print(MSG_INTL(MSG_USE_FILES));
-	dbg_print(MSG_INTL(MSG_USE_GOT));
-	dbg_print(MSG_INTL(MSG_USE_HELP));
-	dbg_print(MSG_INTL(MSG_USE_INIT));
-	dbg_print(MSG_INTL(MSG_USE_LIBS));
-	dbg_print(MSG_INTL(MSG_USE_LIBS_2));
-	dbg_print(MSG_INTL(MSG_USE_LONG));
-	dbg_print(MSG_INTL(MSG_USE_MAP));
-	dbg_print(MSG_INTL(MSG_USE_MOVE));
-	dbg_print(MSG_INTL(MSG_USE_RELOC));
-	dbg_print(MSG_INTL(MSG_USE_SECTIONS));
-	dbg_print(MSG_INTL(MSG_USE_SEGMENTS));
-	dbg_print(MSG_INTL(MSG_USE_SEGMENTS_2));
-	dbg_print(MSG_INTL(MSG_USE_STATISTICS));
-	dbg_print(MSG_INTL(MSG_USE_STRTAB));
-	dbg_print(MSG_INTL(MSG_USE_STRTAB_2));
-	dbg_print(MSG_INTL(MSG_USE_SUPPORT));
-	dbg_print(MSG_INTL(MSG_USE_SYMBOLS));
-	dbg_print(MSG_INTL(MSG_USE_SYMBOLS_2));
-	dbg_print(MSG_INTL(MSG_USE_TLS));
-	dbg_print(MSG_INTL(MSG_USE_UNUSED));
-	dbg_print(MSG_INTL(MSG_USE_UNUSED_2));
-	dbg_print(MSG_INTL(MSG_USE_VERSIONS));
+	dbg_print(0, MSG_INTL(MSG_USE_ENTRY));
+	dbg_print(0, MSG_INTL(MSG_USE_FILES));
+	dbg_print(0, MSG_INTL(MSG_USE_GOT));
+	dbg_print(0, MSG_INTL(MSG_USE_HELP));
+	dbg_print(0, MSG_INTL(MSG_USE_INIT));
+	dbg_print(0, MSG_INTL(MSG_USE_LIBS));
+	dbg_print(0, MSG_INTL(MSG_USE_LIBS_2));
+	dbg_print(0, MSG_INTL(MSG_USE_LMID));
+	dbg_print(0, MSG_INTL(MSG_USE_LONG));
+	dbg_print(0, MSG_INTL(MSG_USE_MAP));
+	dbg_print(0, MSG_INTL(MSG_USE_MOVE));
+	dbg_print(0, MSG_INTL(MSG_USE_RELOC));
+	dbg_print(0, MSG_INTL(MSG_USE_SECTIONS));
+	dbg_print(0, MSG_INTL(MSG_USE_SEGMENTS));
+	dbg_print(0, MSG_INTL(MSG_USE_SEGMENTS_2));
+	dbg_print(0, MSG_INTL(MSG_USE_STATS));
+	dbg_print(0, MSG_INTL(MSG_USE_STRTAB));
+	dbg_print(0, MSG_INTL(MSG_USE_STRTAB_2));
+	dbg_print(0, MSG_INTL(MSG_USE_SUPPORT));
+	dbg_print(0, MSG_INTL(MSG_USE_SYMBOLS));
+	dbg_print(0, MSG_INTL(MSG_USE_SYMBOLS_2));
+	dbg_print(0, MSG_INTL(MSG_USE_TLS));
+	dbg_print(0, MSG_INTL(MSG_USE_UNUSED));
+	dbg_print(0, MSG_INTL(MSG_USE_UNUSED_2));
+	dbg_print(0, MSG_INTL(MSG_USE_VERSIONS));
+	Dbg_util_nl(0, DBG_NL_FRC);
+}
+
+/*
+ * Messaging support - funnel everything through dgettext() as this provides
+ * the real binding to libc.
+ */
+const char *
+_liblddbg_msg(Msg mid)
+{
+	return (dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid)));
 }
 
 /*
  * Validate and enable the appropriate debugging classes.
  */
-uint_t
-Dbg_setup(const char *string)
+uintptr_t
+Dbg_setup(const char *string, Dbg_desc *dbp)
 {
-	char		*name, *_name;	/* Temporary buffer in which to */
-					/* perform strtok_r() operations. */
+	char		*name, *_name;	/* buffer in which to perform */
+					/* strtok_r() operations. */
 	char		*lasts;
-	DBG_opts 	opts;		/* Ptr to cycle thru _Dbg_options[]. */
 	const char	*delimit = MSG_ORIG(MSG_STR_DELIMIT);
 
 	if ((_name = (char *)malloc(strlen(string) + 1)) == 0)
-		return (0);
+		return (S_ERROR);
 	(void) strcpy(_name, string);
 
 	/*
@@ -165,66 +223,117 @@
 	 * flagged.
 	 */
 	if ((name = strtok_r(_name, delimit, &lasts)) != NULL) {
-		Boolean		found, set;
 		do {
-			found = FALSE;
-			set = TRUE;
+			DBG_options	*opt;
+			const char	*str;
+			Boolean		set, found = FALSE;
+			int		ndx = 0;
+
 			if (name[0] == '!') {
 				set = FALSE;
 				name++;
+			} else
+				set = TRUE;
+
+			/*
+			 * First, determine if the token represents a class or
+			 * extra.
+			 */
+			for (opt = _Dbg_options; opt->o_name != NULL; opt++) {
+				if (strcmp(name, opt->o_name) != 0)
+					continue;
+
+				if (set == TRUE) {
+				    if (opt->o_class)
+					dbp->d_class |= opt->o_class;
+				    if (opt->o_extra)
+					dbp->d_extra |= opt->o_extra;
+				} else {
+				    if (opt->o_class)
+					dbp->d_class &= ~(opt->o_class);
+				    if (opt->o_extra)
+					dbp->d_extra &= ~(opt->o_extra);
+				}
+				found = TRUE;
+				break;
 			}
-			for (opts = _Dbg_options; opts->o_name != NULL;
-				opts++) {
-				if (strcmp(name, opts->o_name) == 0) {
-					if (set == TRUE)
-						_Dbg_mask |= opts->o_mask;
-					else
-						_Dbg_mask &= ~(opts->o_mask);
-					found = TRUE;
-					break;
+			if (found == TRUE)
+				continue;
+
+			/*
+			 * Second, determine if the token represents a known
+			 * diagnostic identifier.  Note, newlm identifiers are
+			 * typically followed by a numeric id, for example
+			 * newlm1, newlm2 ...  Thus we only compare the
+			 * initial text of the string.
+			 */
+			while ((str = _Dbg_strs[ndx++]) != NULL)  {
+				char	*tup;
+
+				if (strncmp(name, str, strlen(str)) != 0)
+					continue;
+
+				/*
+				 * Translate lmid identifier to uppercase.
+				 */
+				for (tup = name; *tup; tup++) {
+					if ((*tup >= 'a') && (*tup <= 'z'))
+						*tup = *tup - ('a' - 'A');
 				}
+
+				/*
+				 * Save this lmid.  The whole token buffer has
+				 * been reallocated, so these names will remain
+				 * once this routine returns.
+				 */
+				if (alist_append(&(dbp->d_list), &name,
+				    sizeof (char *), AL_CNT_DEBUG) == 0)
+					return (S_ERROR);
+
+				found = TRUE;
+				break;
 			}
+
 			if (found == FALSE)
-				dbg_print(MSG_INTL(MSG_USE_UNRECOG), name);
+				dbg_print(0, MSG_INTL(MSG_USE_UNRECOG), name);
+
 		} while ((name = strtok_r(NULL, delimit, &lasts)) != NULL);
 	}
-	(void) free(_name);
 
 	/*
 	 * If the debug help option was specified dump a usage message.  If
-	 * this is the only debug option return an indication that the user
+	 * this is the only debug class, return an indication that the user
 	 * should exit.
 	 */
-	if ((_Dbg_mask & DBG_HELP) && !_Dbg_count) {
-		_Dbg_usage();
-		if (_Dbg_mask == DBG_HELP)
-			/* LINTED */
-			return ((uint_t)S_ERROR);
+	if ((_Dbg_cnt++ == 0) && (dbp->d_class & DBG_C_HELP)) {
+		Dbg_usage();
+		if (dbp->d_class == DBG_C_HELP)
+			return (0);
 	}
-
-	_Dbg_count++;
-
-	return (_Dbg_mask);
+	return (1);
 }
 
 /*
- * Set the specified flags to _Dbg_mask.
+ * Define our own printing routine.  This provides a basic fallback, as ld(1)
+ * and ld.so.1(1) provide their own routines that augment their diagnostic
+ * output, and direct the output to stderr.  This item should be defined
+ * NODIRECT.
  */
+/* PRINTFLIKE2 */
 void
-Dbg_set(uint_t flags)
+dbg_print(Lm_list *lml, const char *format, ...)
 {
-	_Dbg_mask = flags;
-}
-
+	va_list ap;
 
-/*
- * Messaging support - funnel everything through _dgettext() as this provides
- * a stub binding to libc, or a real binding to libintl.
- */
-extern char	*_dgettext(const char *, const char *);
-
-const char *
-_liblddbg_msg(Msg mid)
-{
-	return (_dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid)));
+#if	defined(lint)
+	/*
+	 * The lml argument is only meaningful for diagnostics sent to ld.so.1.
+	 * Supress the lint error by making a dummy assignment.
+	 */
+	lml = 0;
+#endif
+	va_start(ap, format);
+	(void) vprintf(format, ap);
+	(void) printf(MSG_ORIG(MSG_STR_NL));
+	va_end(ap);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/dynamic.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/dynamic.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,34 +18,35 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000,2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	<link.h>
+#include	<sgs.h>
 #include	<stdio.h>
-#include	"msg.h"
-#include	"_debug.h"
+#include	<debug.h>
+#include	<conv.h>
+#include	<_debug.h>
+#include	<msg.h>
 
 /*
  * Print out the dynamic section entries.
  */
 void
-Gelf_dyn_title()
+Elf_dyn_title(Lm_list *lml)
 {
-	dbg_print(MSG_INTL(MSG_DYN_TITLE));
+	dbg_print(lml, MSG_INTL(MSG_DYN_TITLE));
 }
 
 void
-Gelf_dyn_print(GElf_Dyn * dyn, int ndx, const char * name, Half mach)
+Elf_dyn_entry(Lm_list *lml, Dyn *dyn, int ndx, const char *name, Half mach)
 {
-	char	index[10];
+	char	index[INDEX_STR_SIZE];
 
-	(void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx);
-	dbg_print(MSG_INTL(MSG_DYN_ENTRY), index,
-	    /* LINTED */
-	    conv_dyntag_str((Sword)dyn->d_tag, mach),
-	    EC_XWORD(dyn->d_un.d_val), name);
+	(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx);
+	dbg_print(lml, MSG_INTL(MSG_DYN_ENTRY), index,
+	    conv_dyn_tag(dyn->d_tag, mach), EC_XWORD(dyn->d_un.d_val), name);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,151 +18,88 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"msg.h"
-#include	"_debug.h"
-#include	"libld.h"
-
-
-static void
-Elf_elf_data(const char *str1, Addr addr, Elf_Data *data, const char *file,
-    const char *str2)
-{
-	dbg_print(MSG_INTL(MSG_ELF_ENTRY), str1, EC_ADDR(addr),
-	    conv_d_type_str(data->d_type), EC_XWORD(data->d_size),
-	    EC_OFF(data->d_off), EC_XWORD(data->d_align), file, str2);
-}
-
-void
-Gelf_elf_data_title()
-{
-	dbg_print(MSG_INTL(MSG_ELF_TITLE));
-}
+#include	<sgs.h>
+#include	<_debug.h>
+#include	<conv.h>
+#include	<msg.h>
 
 void
-_Dbg_elf_data_in(Os_desc *osp, Is_desc *isp)
-{
-	Shdr		*shdr = osp->os_shdr;
-	Elf_Data	*data = isp->is_indata;
-	const char	*file, *str;
-	Addr		addr;
-
-	if (isp->is_flags & FLG_IS_DISCARD) {
-		str = MSG_INTL(MSG_ELF_IGNSCN);
-		addr = 0;
-	} else {
-		str = MSG_ORIG(MSG_STR_EMPTY);
-		addr = (Addr)(shdr->sh_addr + data->d_off);
-	}
-
-	if (isp->is_file && isp->is_file->ifl_name)
-		file = isp->is_file->ifl_name;
-	else
-		file = MSG_ORIG(MSG_STR_EMPTY);
-
-	Elf_elf_data(MSG_INTL(MSG_STR_IN), addr, data, file, str);
-}
-
-void
-_Dbg_elf_data_out(Os_desc *osp)
-{
-	Shdr		*shdr = osp->os_shdr;
-	Elf_Data	*data = osp->os_outdata;
-
-	Elf_elf_data(MSG_INTL(MSG_STR_OUT), shdr->sh_addr,
-	    data, MSG_ORIG(MSG_STR_EMPTY), MSG_ORIG(MSG_STR_EMPTY));
-}
-
-void
-Gelf_elf_header(GElf_Ehdr *ehdr, GElf_Shdr *shdr0)
+Elf_ehdr(Lm_list *lml, Ehdr *ehdr, Shdr *shdr0)
 {
 	Byte		*byte =	&(ehdr->e_ident[0]);
 	const char	*flgs;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_ELF_HEADER));
+	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_INTL(MSG_ELF_HEADER));
 
-	dbg_print(MSG_ORIG(MSG_ELF_MAGIC), byte[EI_MAG0],
+	dbg_print(lml, MSG_ORIG(MSG_ELF_MAGIC), byte[EI_MAG0],
 	    (byte[EI_MAG1] ? byte[EI_MAG1] : '0'),
 	    (byte[EI_MAG2] ? byte[EI_MAG2] : '0'),
 	    (byte[EI_MAG3] ? byte[EI_MAG3] : '0'));
-	dbg_print(MSG_ORIG(MSG_ELF_CLASS),
-	    conv_eclass_str(ehdr->e_ident[EI_CLASS]),
-	    conv_edata_str(ehdr->e_ident[EI_DATA]));
-	dbg_print(MSG_ORIG(MSG_ELF_MACHINE),
-	    conv_emach_str(ehdr->e_machine), conv_ever_str(ehdr->e_version));
-	dbg_print(MSG_ORIG(MSG_ELF_TYPE), conv_etype_str(ehdr->e_type));
+	dbg_print(lml, MSG_ORIG(MSG_ELF_CLASS),
+	    conv_ehdr_class(ehdr->e_ident[EI_CLASS]),
+	    conv_ehdr_data(ehdr->e_ident[EI_DATA]));
+	dbg_print(lml, MSG_ORIG(MSG_ELF_MACHINE),
+	    conv_ehdr_mach(ehdr->e_machine), conv_ehdr_vers(ehdr->e_version));
+	dbg_print(lml, MSG_ORIG(MSG_ELF_TYPE), conv_ehdr_type(ehdr->e_type));
 
 	/*
-	 * Line up the flags differently depending on wether we
-	 * received a numeric (e.g. "0x200") or text represent-
-	 * ation (e.g. "[ EF_SPARC_SUN_US1 ]").
+	 * Line up the flags differently depending on wether we received a
+	 * numeric (e.g. "0x200") or text representation (e.g.
+	 * "[ EF_SPARC_SUN_US1 ]").
 	 */
-	flgs = conv_eflags_str(ehdr->e_machine, ehdr->e_flags);
+	flgs = conv_ehdr_flags(ehdr->e_machine, ehdr->e_flags);
 	if (flgs[0] == '[')
-		dbg_print(MSG_ORIG(MSG_ELF_FLAGS_FMT), flgs);
+		dbg_print(lml, MSG_ORIG(MSG_ELF_FLAGS_FMT), flgs);
 	else
-		dbg_print(MSG_ORIG(MSG_ELF_FLAGS), flgs);
+		dbg_print(lml, MSG_ORIG(MSG_ELF_FLAGS), flgs);
 
 	if ((ehdr->e_shnum == 0) && (ehdr->e_shstrndx == SHN_XINDEX))
-		dbg_print(MSG_ORIG(MSG_ELFX_ESIZE), EC_ADDR(ehdr->e_entry),
-		    ehdr->e_ehsize);
+		dbg_print(lml, MSG_ORIG(MSG_ELFX_ESIZE),
+		    EC_ADDR(ehdr->e_entry), ehdr->e_ehsize);
 	else
-		dbg_print(MSG_ORIG(MSG_ELF_ESIZE), EC_ADDR(ehdr->e_entry),
+		dbg_print(lml, MSG_ORIG(MSG_ELF_ESIZE), EC_ADDR(ehdr->e_entry),
 		    ehdr->e_ehsize, ehdr->e_shstrndx);
 
 	if ((ehdr->e_shnum == 0) && shdr0 && (shdr0->sh_size != 0))
-		dbg_print(MSG_ORIG(MSG_ELFX_SHOFF), EC_OFF(ehdr->e_shoff),
+		dbg_print(lml, MSG_ORIG(MSG_ELFX_SHOFF), EC_OFF(ehdr->e_shoff),
 		    ehdr->e_shentsize);
 	else
-		dbg_print(MSG_ORIG(MSG_ELF_SHOFF), EC_OFF(ehdr->e_shoff),
+		dbg_print(lml, MSG_ORIG(MSG_ELF_SHOFF), EC_OFF(ehdr->e_shoff),
 		    ehdr->e_shentsize, ehdr->e_shnum);
 
-	if (ehdr->e_phnum == PN_XNUM)
-		dbg_print(MSG_ORIG(MSG_ELFX_PHOFF), EC_OFF(ehdr->e_phoff),
-		    ehdr->e_phentsize);
-	else
-		dbg_print(MSG_ORIG(MSG_ELF_PHOFF), EC_OFF(ehdr->e_phoff),
-		    ehdr->e_phentsize, ehdr->e_phnum);
+	dbg_print(lml, MSG_ORIG(MSG_ELF_PHOFF), EC_OFF(ehdr->e_phoff),
+	    ehdr->e_phentsize, ehdr->e_phnum);
 
-	if (shdr0 == NULL ||
-	    (ehdr->e_phnum != PN_XNUM &&
-	    (ehdr->e_shnum != 0 || shdr0->sh_size)))
+	if ((ehdr->e_shnum != 0) || (shdr0 == NULL) ||
+	    (shdr0->sh_size == 0))
 		return;
 
 	/*
 	 * If we have Extended ELF headers - print shdr0
 	 */
-	dbg_print(MSG_ORIG(MSG_SHD0_TITLE));
-	dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr0->sh_addr),
-	    /* LINTED */
-	    conv_secflg_str(ehdr->e_machine, shdr0->sh_flags));
-	if (ehdr->e_shnum == 0)
-		dbg_print(MSG_ORIG(MSG_SHD0_SIZE), EC_XWORD(shdr0->sh_size),
-		    conv_sectyp_str(ehdr->e_machine, shdr0->sh_type));
-	else
-		dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr0->sh_size),
-		    conv_sectyp_str(ehdr->e_machine, shdr0->sh_type));
-	dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr0->sh_offset),
+	dbg_print(lml, MSG_ORIG(MSG_SHD0_TITLE));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr0->sh_addr),
+	    conv_sec_flags(shdr0->sh_flags));
+	dbg_print(lml, MSG_ORIG(MSG_SHD0_SIZE), EC_XWORD(shdr0->sh_size),
+	    conv_sec_type(ehdr->e_machine, shdr0->sh_type));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr0->sh_offset),
 	    EC_XWORD(shdr0->sh_entsize));
 
-	if (ehdr->e_shstrndx == SHN_XINDEX && ehdr->e_phnum == PN_XNUM)
-		dbg_print(MSG_ORIG(MSG_SHD0_LINK1), EC_WORD(shdr0->sh_link),
-		    EC_WORD(shdr0->sh_info));
-	else if (ehdr->e_shstrndx == SHN_XINDEX)
-		dbg_print(MSG_ORIG(MSG_SHD0_LINK2), EC_WORD(shdr0->sh_link),
-		    EC_WORD(shdr0->sh_info));
-	else if (ehdr->e_phnum == PN_XNUM)
-		dbg_print(MSG_ORIG(MSG_SHD0_LINK3), EC_WORD(shdr0->sh_link),
-		    EC_WORD(shdr0->sh_info));
+	if (ehdr->e_shstrndx == SHN_XINDEX)
+		dbg_print(lml, MSG_ORIG(MSG_SHD0_LINK),
+		    EC_WORD(shdr0->sh_link), conv_sec_info(shdr0->sh_info,
+		    shdr0->sh_flags));
 	else
-		dbg_print(MSG_ORIG(MSG_SHD0_LINK4), EC_WORD(shdr0->sh_link),
-		    EC_WORD(shdr0->sh_info));
+		dbg_print(lml, MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr0->sh_link),
+		    conv_sec_info(shdr0->sh_info, shdr0->sh_flags));
 
-	dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr0->sh_addralign));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr0->sh_addralign));
 }
--- a/usr/src/cmd/sgs/liblddbg/common/entry.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/entry.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1998-1999 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -33,50 +33,48 @@
  * Print out a single `entry descriptor' entry.
  */
 void
-_Dbg_ent_entry(Half mach, Ent_desc *enp)
+Dbg_ent_entry(Lm_list *lml, Half mach, Ent_desc *enp)
 {
 	Listnode	*lnp;
 	char		*cp;
 
-	dbg_print(MSG_ORIG(MSG_ECR_NAME),
+	dbg_print(lml, MSG_ORIG(MSG_ECR_NAME),
 	    (enp->ec_name ? enp->ec_name : MSG_INTL(MSG_STR_NULL)),
-	    conv_secflg_str(mach, enp->ec_attrmask));
+	    conv_sec_flags(enp->ec_attrmask));
 
-	dbg_print(MSG_ORIG(MSG_ECR_SEGMENT),
+	dbg_print(lml, MSG_ORIG(MSG_ECR_SEGMENT),
 	    (enp->ec_segment->sg_name ? enp->ec_segment->sg_name :
-	    MSG_INTL(MSG_STR_NULL)), conv_secflg_str(mach, enp->ec_attrbits));
+	    MSG_INTL(MSG_STR_NULL)), conv_sec_flags(enp->ec_attrbits));
 
-	dbg_print(MSG_ORIG(MSG_ECR_NDX),
-	    EC_WORD(enp->ec_ndx), conv_sectyp_str(mach, enp->ec_type));
+	dbg_print(lml, MSG_ORIG(MSG_ECR_NDX),
+	    EC_WORD(enp->ec_ndx), conv_sec_type(mach, enp->ec_type));
 
 	if (enp->ec_files.head) {
-		dbg_print(MSG_ORIG(MSG_ECR_FILES));
+		dbg_print(lml, MSG_ORIG(MSG_ECR_FILES));
 		for (LIST_TRAVERSE(&(enp->ec_files), lnp, cp))
-			dbg_print(MSG_ORIG(MSG_ECR_FILE), cp);
+			dbg_print(lml, MSG_ORIG(MSG_ECR_FILE), cp);
 	}
 }
 
-
 /*
  * Print out all `entrance descriptor' entries.
  */
 void
-Dbg_ent_print(Half mach, List *len, Boolean dmode)
+Dbg_ent_print(Lm_list *lml, Half mach, List *len, Boolean dmode)
 {
 	Listnode	*lnp;
 	Ent_desc	*enp;
 	int		ndx = 1;
 
-	if (DBG_NOTCLASS(DBG_ENTRY))
+	if (DBG_NOTCLASS(DBG_C_ENTRY))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_ECR_TITLE),
-		(dmode ? MSG_INTL(MSG_ECR_DYNAMIC) : MSG_INTL(MSG_ECR_STATIC)));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_ECR_TITLE),
+	    (dmode ? MSG_INTL(MSG_ECR_DYNAMIC) : MSG_INTL(MSG_ECR_STATIC)));
 
 	for (LIST_TRAVERSE(len, lnp, enp)) {
-		dbg_print(MSG_INTL(MSG_ECR_DESC), ndx);
-		_Dbg_ent_entry(mach, enp);
-		ndx++;
+		dbg_print(lml, MSG_INTL(MSG_ECR_DESC), ndx++);
+		Dbg_ent_entry(lml, mach, enp);
 	}
 }
--- a/usr/src/cmd/sgs/liblddbg/common/files.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/files.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,103 +20,57 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"_synonyms.h"
-
 #include	<sys/auxv.h>
 #include	<string.h>
 #include	<unistd.h>
 #include	<fcntl.h>
 #include	<limits.h>
 #include	<stdio.h>
+#include	<libld.h>
+#include	<rtld.h>
+#include	<conv.h>
 #include	"msg.h"
 #include	"_debug.h"
-#include	"libld.h"
-#include	"rtld.h"
-
-
-void
-Dbg_file_generic(Ifl_desc *ifl)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name,
-		conv_etype_str(ifl->ifl_ehdr->e_type));
-}
 
 void
-Dbg_file_skip(const char *nname, const char *oname)
+Dbg_file_analyze(Rt_map *lmp)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	if (oname && strcmp(nname, oname))
-		dbg_print(MSG_INTL(MSG_FIL_SKIP_1), nname, oname);
-	else
-		dbg_print(MSG_INTL(MSG_FIL_SKIP_2), nname);
-}
-
-void
-Dbg_file_reuse(const char *nname, const char *oname)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_INTL(MSG_FIL_REUSE), nname, oname);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp),
+	    conv_dl_mode(MODE(lmp), 1));
 }
 
 void
-Dbg_file_archive(const char *name, int again)
+Dbg_file_aout(Lm_list *lml, const char *name, ulong_t dynamic, ulong_t base,
+    ulong_t size, const char *lmid, Aliste lmco)
 {
-	const char	*str;
-
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	if (again)
-		str = MSG_INTL(MSG_STR_AGAIN);
-	else
-		str = MSG_ORIG(MSG_STR_EMPTY);
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_ARCHIVE), name, str);
+	dbg_print(lml, MSG_INTL(MSG_FIL_AOUT), name);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_XWORD(dynamic),
+	    EC_ADDR(base));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_S), EC_XWORD(size));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
 }
 
 void
-Dbg_file_analyze(Rt_map * lmp)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp),
-	    conv_dlmode_str(MODE(lmp), 1));
-}
-
-void
-Dbg_file_aout(const char *name, ulong_t dynamic, ulong_t base, ulong_t size)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_INTL(MSG_FIL_AOUT), name);
-	dbg_print(MSG_INTL(MSG_FIL_DATA_1), EC_XWORD(dynamic),
-	    EC_ADDR(base), EC_XWORD(size));
-}
-
-void
-Dbg_file_elf(const char *name, ulong_t dynamic, ulong_t base,
-    ulong_t size, ulong_t entry, Lmid_t lmid, Aliste lmco)
+Dbg_file_elf(Lm_list *lml, const char *name, ulong_t dynamic, ulong_t base,
+    ulong_t size, ulong_t entry, const char *lmid, Aliste lmco)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
 	if (base == 0)
@@ -125,46 +78,56 @@
 	else
 		str = MSG_ORIG(MSG_STR_EMPTY);
 
-	dbg_print(MSG_INTL(MSG_FIL_ELF), name, str);
-	dbg_print(MSG_INTL(MSG_FIL_DATA_1), EC_XWORD(dynamic),
-	    EC_ADDR(base), EC_XWORD(size));
-	dbg_print(MSG_INTL(MSG_FIL_DATA_2), EC_XWORD(entry),
-	    EC_XWORD(lmid), EC_XWORD(lmco));
+	dbg_print(lml, MSG_INTL(MSG_FIL_ELF), name, str);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_XWORD(dynamic),
+	    EC_ADDR(base));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_SE), EC_XWORD(size),
+	    EC_XWORD(entry));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
 }
 
 void
-Dbg_file_ldso(const char *name, ulong_t dynamic, ulong_t base, char **envp,
-    auxv_t *auxv)
+Dbg_file_ldso(Rt_map *lmp, char **envp, auxv_t *auxv, const char *lmid,
+    Aliste lmco)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_LDSO), name);
-	dbg_print(MSG_INTL(MSG_FIL_DATA_3), EC_XWORD(dynamic),
-	    EC_ADDR(base));
-	dbg_print(MSG_INTL(MSG_FIL_DATA_4), EC_ADDR(envp), EC_ADDR(auxv));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_LDSO), PATHNAME(lmp));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_NATPTR(DYN(lmp)),
+	    EC_ADDR(ADDR(lmp)));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_EA), EC_NATPTR(envp),
+	    EC_NATPTR(auxv));
+	dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco));
+	Dbg_util_nl(lml, DBG_NL_STD);
+}
+
+
+void
+Dbg_file_prot(Rt_map *lmp, int prot)
+{
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_PROT), NAME(lmp), (prot ? '+' : '-'));
 }
 
 void
-Dbg_file_prot(const char *name, int prot)
+Dbg_file_delete(Rt_map *lmp)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_PROT), name, (prot ? '+' : '-'));
-}
-
-void
-Dbg_file_delete(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DELETE), name);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DELETE), NAME(lmp));
 }
 
 static int	hdl_title = 0;
@@ -173,7 +136,7 @@
 void
 Dbg_file_hdl_title(int type)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -198,43 +161,45 @@
 }
 
 void
-Dbg_file_hdl_collect(Grp_hdl * ghp, const char *name)
+Dbg_file_hdl_collect(Grp_hdl *ghp, const char *name)
 {
-	const char *str;
+	Lm_list		*lml = ghp->gh_ownlml;
+	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	if (ghp->gh_owner)
-		str = NAME(ghp->gh_owner);
+	if (ghp->gh_ownlmp)
+		str = NAME(ghp->gh_ownlmp);
 	else
 		str = MSG_INTL(MSG_STR_ORPHAN);
 
 	if (hdl_title) {
 		hdl_title = 0;
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		Dbg_util_nl(lml, DBG_NL_STD);
 	}
 	if (name)
-		dbg_print(MSG_INTL(MSG_FIL_HDL_RETAIN), str, name);
+		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_RETAIN), str, name);
 	else
-		dbg_print(MSG_INTL(MSG_FIL_HDL_COLLECT), str,
-		    conv_grphdrflags_str(ghp->gh_flags));
+		dbg_print(lml, MSG_INTL(MSG_FIL_HDL_COLLECT), str,
+		    conv_grphdl_flags(ghp->gh_flags));
 }
 
 void
-Dbg_file_hdl_action(Grp_hdl * ghp, Rt_map * lmp, int type)
+Dbg_file_hdl_action(Grp_hdl *ghp, Rt_map *lmp, int type)
 {
+	Lm_list	*lml = LIST(lmp);
 	Msg	str;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
 	if (hdl_title) {
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		Dbg_util_nl(lml, DBG_NL_STD);
 		if (hdl_str) {
 			const char	*name;
 
@@ -242,12 +207,12 @@
 			 * Protect ourselves in case this handle has no
 			 * originating owner.
 			 */
-			if (ghp->gh_owner)
-				name = NAME(ghp->gh_owner);
+			if (ghp->gh_ownlmp)
+				name = NAME(ghp->gh_ownlmp);
 			else
 				name = MSG_INTL(MSG_STR_UNKNOWN);
 
-			dbg_print(MSG_INTL(hdl_str), name);
+			dbg_print(lml, MSG_INTL(hdl_str), name);
 		}
 		hdl_title = 0;
 	}
@@ -277,14 +242,14 @@
 		else
 			mode = MSG_ORIG(MSG_STR_EMPTY);
 
-		dbg_print(MSG_INTL(str), NAME(lmp), mode);
+		dbg_print(lml, MSG_INTL(str), NAME(lmp), mode);
 	}
 }
 
 void
-Dbg_file_bind_entry(Bnd_desc *bdp)
+Dbg_file_bind_entry(Lm_list *lml, Bnd_desc *bdp)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -292,20 +257,21 @@
 	/*
 	 * Print the dependency together with the modes of the binding.
 	 */
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller));
-	dbg_print(MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend),
-	    conv_bindent_str(bdp->b_flags));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller));
+	dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend),
+	    conv_bnd_type(bdp->b_flags));
 }
 
 void
-Dbg_file_bindings(Rt_map *lmp, int flag, Word lmflags)
+Dbg_file_bindings(Rt_map *lmp, int flag)
 {
 	const char	*str;
 	Rt_map		*tlmp;
+	Lm_list		*lml = LIST(lmp);
 	int		next = 0;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -315,12 +281,13 @@
 	else
 		str = MSG_ORIG(MSG_SCN_FINI);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DEP_TITLE), str, conv_binding_str(lmflags));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DEP_TITLE), str,
+	    conv_bnd_obj(lml->lm_flags));
 
 	/* LINTED */
 	for (tlmp = lmp; tlmp; tlmp = (Rt_map *)NEXT(tlmp)) {
-		Bnd_desc **	bdpp;
+		Bnd_desc	**bdpp;
 		Aliste		off;
 
 		/*
@@ -346,40 +313,42 @@
 		}
 
 		if (next++)
-			dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+			Dbg_util_nl(lml, DBG_NL_STD);
 
 		if (DEPENDS(tlmp) == 0)
-			dbg_print(MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp));
+			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp));
 		else {
-			dbg_print(MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp));
+			dbg_print(lml, MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp));
 
 			for (ALIST_TRAVERSE(DEPENDS(tlmp), off, bdpp)) {
-				dbg_print(MSG_INTL(MSG_FIL_BND_FILE),
+				dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE),
 				    NAME((*bdpp)->b_depend),
-				    conv_bindent_str((*bdpp)->b_flags));
+				    conv_bnd_type((*bdpp)->b_flags));
 			}
 		}
 	}
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_file_dlopen(const char *name, const char *from, int mode)
+Dbg_file_dlopen(Rt_map *clmp, const char *name, int mode)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(clmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DLOPEN), name, from,
-	    conv_dlmode_str(mode, 1));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DLOPEN), name, NAME(clmp),
+	    conv_dl_mode(mode, 1));
 }
 
 void
-Dbg_file_dlclose(const char *name, int flag)
+Dbg_file_dlclose(Lm_list *lml, const char *name, int flag)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
 	if (flag == DBG_DLCLOSE_IGNORE)
@@ -387,104 +356,102 @@
 	else
 		str = MSG_ORIG(MSG_STR_EMPTY);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DLCLOSE), name, str);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DLCLOSE), name, str);
 }
 
 void
-Dbg_file_dldump(const char *ipath, const char *opath, int flags)
+Dbg_file_dldump(Rt_map *lmp, const char *path, int flags)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DLDUMP), ipath, opath,
-		conv_dlflag_str(flags, 0));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DLDUMP), NAME(lmp), path,
+		conv_dl_flag(flags, 0));
 }
 
 void
-Dbg_file_lazyload(const char *file, const char *from, const char *symname)
+Dbg_file_lazyload(Rt_map *clmp, const char *fname, const char *sname)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(clmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_LAZYLOAD), file, from,
-	    _Dbg_sym_dem(symname));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_LAZYLOAD), fname, NAME(clmp),
+	    Dbg_demangle_name(sname));
 }
 
 void
-Dbg_file_nl()
+Dbg_file_preload(Lm_list *lml, const char *name)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-	if (DBG_NOTDETAIL())
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_PRELOAD), name);
 }
 
 void
-Dbg_file_preload(const char *name)
+Dbg_file_needed(Rt_map *lmp, const char *name)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_INTL(MSG_FIL_PRELOAD), name);
-}
-
-void
-Dbg_file_needed(const char *name, const char *parent)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_NEEDED), name, parent);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_NEEDED), name, NAME(lmp));
 }
 
 void
-Dbg_file_filter(const char *filter, const char *filtee, int config)
+Dbg_file_filter(Lm_list *lml, const char *filter, const char *filtee,
+    int config)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
 	if (config)
-		dbg_print(MSG_INTL(MSG_FIL_FILTER_1), filter, filtee);
+		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_1), filter, filtee);
 	else
-		dbg_print(MSG_INTL(MSG_FIL_FILTER_2), filter, filtee);
+		dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_2), filter, filtee);
 }
 
 void
-Dbg_file_filtee(const char *filter, const char *filtee, int audit)
+Dbg_file_filtee(Lm_list *lml, const char *filter, const char *filtee, int audit)
 {
 	if (audit) {
-		if (DBG_NOTCLASS(DBG_AUDITING | DBG_FILES))
+		if (DBG_NOTCLASS(DBG_C_AUDITING | DBG_C_FILES))
 			return;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_FIL_FILTEE_3), filtee);
+		Dbg_util_nl(lml, DBG_NL_STD);
+		dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_3), filtee);
 	} else {
-		if (DBG_NOTCLASS(DBG_FILES))
+		if (DBG_NOTCLASS(DBG_C_FILES))
 			return;
 
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		Dbg_util_nl(lml, DBG_NL_STD);
 		if (filter)
-			dbg_print(MSG_INTL(MSG_FIL_FILTEE_1), filtee, filter);
+			dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_1), filtee,
+			    filter);
 		else
-			dbg_print(MSG_INTL(MSG_FIL_FILTEE_2), filtee);
+			dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_2), filtee);
 	}
 }
 
 void
-Dbg_file_fixname(const char *oname, const char *nname)
+Dbg_file_fixname(Lm_list *lml, const char *oname, const char *nname)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_FIXNAME), oname, nname);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_FIXNAME), oname, nname);
 }
 
 void
@@ -494,7 +461,7 @@
 	char		*oname, *nname, *ofile;
 	int		fd;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -514,20 +481,20 @@
 	 * write out the present Elf memory image.  As this is debugging we
 	 * ignore all errors.
 	 */
-	if ((nname = (char *)malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) {
+	if ((nname = malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) {
 		(void) strcpy(nname, prefix);
 		(void) strcat(nname, ofile);
 		if ((fd = open(nname, O_RDWR | O_CREAT | O_TRUNC,
 		    0666)) != -1) {
-			(void) write(fd, ofl->ofl_ehdr, ofl->ofl_size);
-			close(fd);
+			(void) write(fd, ofl->ofl_nehdr, ofl->ofl_size);
+			(void) close(fd);
 		}
 		free(nname);
 	}
 }
 
 void
-Dbg_file_config_dis(const char *config, int features)
+Dbg_file_config_dis(Lm_list *lml, const char *config, int features)
 {
 	const char	*str;
 	int		error = features & ~CONF_FEATMSK;
@@ -541,19 +508,20 @@
 	else if (error == DBG_CONF_CORRUPT)
 		str = MSG_INTL(MSG_FIL_CONFIG_ERR_4);
 	else
-		str = conv_config_str(features);
+		str = conv_config_feat(features);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_CONFIG_ERR), config, str);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_FRC);
+	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG_ERR), config, str);
+	Dbg_util_nl(lml, DBG_NL_FRC);
 }
 
 void
-Dbg_file_config_obj(const char *dir, const char *file, const char *config)
+Dbg_file_config_obj(Lm_list *lml, const char *dir, const char *file,
+    const char *config)
 {
 	char	*name, _name[PATH_MAX];
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
 	if (file) {
@@ -563,12 +531,99 @@
 	} else
 		name = (char *)dir;
 
-	dbg_print(MSG_INTL(MSG_FIL_CONFIG), name, config);
+	dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG), name, config);
+}
+
+void
+Dbg_file_del_rescan(Lm_list *lml)
+{
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_DEL_RESCAN));
+}
+
+void
+Dbg_file_mode_promote(Rt_map *lmp, int mode)
+{
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_PROMOTE), NAME(lmp),
+	    conv_dl_mode(mode, 0));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
-#if	!defined(_ELF64)
+void
+Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco)
+{
+	Lm_cntl	*lmc;
+	Aliste	off;
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco),
+	    EC_XWORD(tlmco));
+
+	for (ALIST_TRAVERSE(lml->lm_lists, off, lmc)) {
+		Rt_map	*lmp;
+
+		/* LINTED */
+		for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp))
+			dbg_print(lml, MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off),
+			    NAME(lmp));
+	}
+	Dbg_util_nl(lml, DBG_NL_STD);
+}
+
+void
+Dbg_file_ar_rescan(Lm_list *lml)
+{
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
 
-const Msg
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_AR_RESCAN));
+	Dbg_util_nl(lml, DBG_NL_STD);
+}
+
+void
+Dbg_file_ar(Lm_list *lml, const char *name, int again)
+{
+	const char	*str;
+
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+
+	if (again)
+		str = MSG_INTL(MSG_STR_AGAIN);
+	else
+		str = MSG_ORIG(MSG_STR_EMPTY);
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_ARCHIVE), name, str);
+}
+
+void
+Dbg_file_generic(Lm_list *lml, Ifl_desc *ifl)
+{
+	if (DBG_NOTCLASS(DBG_C_FILES))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name,
+		conv_ehdr_type(ifl->ifl_ehdr->e_type));
+}
+
+static const Msg
 reject[] = {
 	MSG_STR_EMPTY,
 	MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
@@ -586,75 +641,34 @@
 };
 
 void
-Dbg_file_rejected(Rej_desc *rej)
+Dbg_file_rejected(Lm_list *lml, Rej_desc *rej)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(reject[rej->rej_type]), rej->rej_name ?
-	    rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(rej));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-}
-
-void
-Dbg_file_del_rescan(void)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_DEL_RESCAN));
-}
-
-void
-Dbg_file_ar_rescan(void)
-{
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_AR_RESCAN));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(reject[rej->rej_type]), rej->rej_name ?
+	    rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(rej));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_file_mode_promote(const char *file, int mode)
+Dbg_file_reuse(Lm_list *lml, const char *nname, const char *oname)
 {
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_FIL_PROMOTE), file, conv_dlmode_str(mode, 0));
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_INTL(MSG_FIL_REUSE), nname, oname);
 }
 
 void
-Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco)
+Dbg_file_skip(Lm_list *lml, const char *oname, const char *nname)
 {
-	Lm_cntl	*lmc;
-	Aliste	off;
-
-	if (DBG_NOTCLASS(DBG_FILES))
-		return;
-	if (DBG_NOTDETAIL())
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco), EC_XWORD(tlmco));
-
-	for (ALIST_TRAVERSE(lml->lm_lists, off, lmc)) {
-		Rt_map	*lmp;
-
-		if (lmc->lc_head == 0) {
-			dbg_print(MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off),
-			    MSG_ORIG(MSG_STR_EMPTY));
-			continue;
-		}
-		for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp))
-			dbg_print(MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off),
-			    NAME(lmp));
-	}
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	if (oname && strcmp(nname, oname))
+		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_1), nname, oname);
+	else
+		dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_2), nname);
 }
-#endif
--- a/usr/src/cmd/sgs/liblddbg/common/got.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/got.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -32,10 +32,10 @@
 
 
 static int
-comparegotsym(Gottable * gtp1, Gottable * gtp2)
+Dbg_got_compare(Gottable *gtp1, Gottable *gtp2)
 {
-	Gotndx *	gnp1 = &gtp1->gt_gndx;
-	Gotndx *	gnp2 = &gtp2->gt_gndx;
+	Gotndx	*gnp1 = &gtp1->gt_gndx;
+	Gotndx	*gnp2 = &gtp2->gt_gndx;
 
 	if (gnp1->gn_gotndx > gnp2->gn_gotndx)
 		return (1);
@@ -46,26 +46,27 @@
 }
 
 void
-Dbg_got_display(Gottable * gtp, Ofl_desc *ofl)
+Dbg_got_display(Ofl_desc *ofl, Gottable *gtp)
 {
+	Lm_list	*lml = ofl->ofl_lml;
 	Word	gotndx;
 
-	if (DBG_NOTCLASS(DBG_GOT))
+	if (DBG_NOTCLASS(DBG_C_GOT))
 		return;
 
 	if (ofl->ofl_gotcnt == M_GOT_XNumber)
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_GOT_TITLE), EC_WORD(ofl->ofl_gotcnt));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_GOT_INFO), EC_WORD(ofl->ofl_gotcnt));
 
 	if (DBG_NOTDETAIL())
 		return;
 
 	qsort((char *)gtp, ofl->ofl_gotcnt, sizeof (Gottable),
-		(int(*)(const void *, const void *))comparegotsym);
+	    (int(*)(const void *, const void *))Dbg_got_compare);
 
-	dbg_print(MSG_ORIG(MSG_GOT_COLUMNS));
+	dbg_print(lml, MSG_ORIG(MSG_GOT_COLUMNS));
 
 	for (gotndx = 0; gotndx < ofl->ofl_gotcnt; gotndx++, gtp++) {
 		Sym_desc	*sdp;
@@ -78,20 +79,20 @@
 		if (sdp->sd_flags & FLG_SY_SMGOT)
 			refstr = MSG_ORIG(MSG_GOT_SMALL_PIC);
 		else
-			refstr = MSG_ORIG(MSG_GOT_PIC);
+			refstr = MSG_ORIG(MSG_GOT_BIG_PIC);
 
 		if (sdp->sd_name)
-			name = _Dbg_sym_dem(sdp->sd_name);
+			name = Dbg_demangle_name(sdp->sd_name);
 		else
 			name = MSG_INTL(MSG_STR_UNKNOWN);
 
 		if ((sdp->sd_sym->st_shndx == SHN_UNDEF) ||
 		    (sdp->sd_file == 0)) {
-			dbg_print(MSG_ORIG(MSG_GOT_FORMAT1),
+			dbg_print(lml, MSG_ORIG(MSG_GOT_FORMAT1),
 			    EC_SWORD(gnp->gn_gotndx), refstr,
 			    EC_LWORD(gnp->gn_addend), name);
 		} else {
-			dbg_print(MSG_ORIG(MSG_GOT_FORMAT2),
+			dbg_print(lml, MSG_ORIG(MSG_GOT_FORMAT2),
 			    EC_SWORD(gnp->gn_gotndx), refstr,
 			    EC_LWORD(gnp->gn_addend),
 			    sdp->sd_file->ifl_name, name);
@@ -99,54 +100,41 @@
 	}
 }
 
-
-#if	!defined(_ELF64)
 void
-Gelf_got_title(uchar_t class)
+Elf_got_title(Lm_list *lml)
 {
-	if (class == ELFCLASS64)
-		dbg_print(MSG_ORIG(MSG_GOT_ECOLUMNS_64));
-	else
-		dbg_print(MSG_ORIG(MSG_GOT_ECOLUMNS));
+	dbg_print(lml, MSG_INTL(MSG_GOT_TITLE));
 }
 
 void
-Gelf_got_entry(GElf_Ehdr *ehdr, Sword gotndx, GElf_Addr addr, GElf_Xword value,
-	GElf_Word rshtype, void *rel, const char *sname)
+Elf_got_entry(Lm_list *lml, Sword ndx, Addr addr, Xword value, Half mach,
+    Word type, void *reloc, const char *name)
 {
-	GElf_Word	rtype;
-	GElf_Sxword	addend;
-	const char	*rstring, * fmt;
+	Rela		*rela;
+	Rel		*rel;
+	const char	*str;
+	char		index[INDEX_STR_SIZE];
 
-	if (rel) {
-		if (rshtype == SHT_RELA) {
-			/* LINTED */
-			rtype = (GElf_Word)GELF_R_TYPE(
-			    ((GElf_Rela *)rel)->r_info);
-			addend = ((GElf_Rela *)rel)->r_addend;
+	(void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_GOT_INDEX),
+	    EC_SWORD(ndx));
+
+	if (reloc) {
+		if (type == SHT_RELA) {
+			rela = (Rela *)reloc;
+			str = conv_reloc_type(mach, ELF_R_TYPE(rela->r_info));
 		} else {
-			/* LINTED */
-			rtype = (GElf_Word)GELF_R_TYPE(
-			    ((GElf_Rel *)rel)->r_info);
-			addend = 0;
+			rel = (Rel *)reloc;
+			str = conv_reloc_type(mach, ELF_R_TYPE(rel->r_info));
 		}
-		rstring = conv_reloc_type_str(ehdr->e_machine, rtype);
-	} else {
-		addend = 0;
-		rstring = MSG_ORIG(MSG_STR_EMPTY);
-	}
+
+		if (name)
+			name = Elf_demangle_name(name);
+		else
+			name = MSG_ORIG(MSG_STR_EMPTY);
 
-	if (sname)
-		sname = _Dbg_sym_dem(sname);
-	else
-		sname = MSG_ORIG(MSG_STR_EMPTY);
-
-	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64)
-		fmt = MSG_ORIG(MSG_GOT_EFORMAT_64);
-	else
-		fmt = MSG_ORIG(MSG_GOT_EFORMAT);
-
-	dbg_print(fmt, EC_SWORD(gotndx), EC_ADDR(addr), EC_XWORD(value),
-	    rstring, EC_SXWORD(addend), sname);
+		dbg_print(lml, MSG_INTL(MSG_GOT_ENTRY_RE), index, EC_ADDR(addr),
+		    EC_XWORD(value), str, name);
+	} else
+		dbg_print(lml, MSG_INTL(MSG_GOT_ENTRY_NR), index, EC_ADDR(addr),
+		    EC_XWORD(value));
 }
-#endif	/* !defined(_ELF64) */
--- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
 #
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -40,71 +39,114 @@
 
 # TRANSLATION_NOTE - Use the following output in C as a reference, 1.
 #
-# 		 For debugging the runtime linking of an application:
-# 			LD_DEBUG=token1,token2  prog
-# 		 enables diagnostics to the stderr.  The additional option:
-# 			LD_DEBUG_OUTPUT=file
-# 		 redirects the diagnostics to an output file created using
-# 		 the specified name and the process id as a suffix.  All
-# 		 diagnostics are prepended with the process id.
-# 
-# 		 For debugging the link-editing of an application:
-# 			LD_OPTIONS=-Dtoken1,token2 cc -o prog ...
-# 		 or,
-# 			ld -Dtoken1,token2 -o prog ...
-# 		 where placement of -D on the command line is significant,
-# 		 and options can be switched off by prepending with `!'.  All
-#		 diagnostics are prepended with the string `debug', and
-#		 optionally with the output file basename or fullname, and
-#		 its class, if the `name' or `fullname', and `class' tokens
-#		 are specified respectively.
+# Runtime Linking
+#    Diagnostics that trace the runtime linking of an application can be
+#    enabled to stderr by using the environment variable setting:
+# 	LD_DEBUG=token1,token2
+#    Alternatively, the diagnostics can be redirected to an output file
+#    using the additional environment variable:
+# 	LD_DEBUG_OUTPUT=file
+#    The output file is given the specified name and the process id as a
+#    suffix.
 #
-#	The next 13 messages makes the above output in C locale.
-#	Use the tabs as alignment characters as needed.
+#    By default, all diagnostics are prepended with the process id,
+#    together with the thread id.  Note, all applications are effectively
+#    thread aware, and once thread capabilities are enabled, even a single
+#    threaded application is labeled as thread 1.
 #
-@ MSG_USE_RTLD_A	"\t\t  For debugging the runtime linking of an \
-			 application:"
+#    The token `lmid' prepends a link-map list identifier to each
+#    diagnostic.
 #
-# Be warned that the next two messages make a sentence.
-# That is:
-# 			LD_DEBUG=token1,token2  prog
-# 		 enables diagnostics to the stderr.  The additional option:
-# So do not translate the msgid separately, but handle them together
-# Same kind of sentences appear in this block of messages.
+#    The tokens `base', `ldso' and `newlm[0-9]*' can be used to isolate
+#    diagnostics to the associated link-map lists.   Note, by default, any
+#    diagnostics associated with loading components for the runtime linker
+#    itself are suppressed, unless `ldso' is explicitly specified.
+# 
+# Link-Editing
+#    Diagnostics that trace the link-editing of an application can be
+#    enabled to stderr using the -D option:
+#	ld -Dtoken1,token2 -o prog ...
+#    As the -D option can also be meaningful to compiler drivers, an
+#    alternative mechanism to enable diagnostics is to use the environment
+#    variable:
+#	LD_OPTIONS=-Dtoken1,token2 cc -o prog ...
 #
-@ MSG_USE_RTLD_B	"\t\t\tLD_DEBUG=token1,token2  prog"
-@ MSG_USE_RTLD_C	"\t\t  enables diagnostics to the stderr.  \
-			 The additional option:"
-@ MSG_USE_RTLD_D	"\t\t\tLD_DEBUG_OUTPUT=file"
-@ MSG_USE_RTLD_E	"\t\t  redirects the diagnostics to an output file \
-			 created using"
-@ MSG_USE_RTLD_F	"\t\t  the specified name and the process id as a \
-			 suffix.  All"
-@ MSG_USE_RTLD_G	"\t\t  diagnostics are prepended with the process id."
-
-@ MSG_USE_LD_A		"\t\t  For debugging the link-editing of an application:"
-@ MSG_USE_LD_B		"\t\t\tLD_OPTIONS=-Dtoken1,token2 cc -o prog ..."
-@ MSG_USE_LD_C		"\t\t  or,"
-@ MSG_USE_LD_D		"\t\t\tld -Dtoken1,token2 -o prog ..."
-@ MSG_USE_LD_E		"\t\t  where placement of -D on the command line is \
-			 significant,"
-@ MSG_USE_LD_F		"\t\t  and options can be switched off by prepending \
-			 with `!'.  All"
-@ MSG_USE_LD_G		"\t\t  diagnostics are prepended with the string \
-			 `debug', and"
-@ MSG_USE_LD_H		"\t\t  optionally with the output file basename or \
-			 fullname, and"
-@ MSG_USE_LD_I		"\t\t  its class, if the `name' or `fullname', and \
-			 `class' tokens"
-@ MSG_USE_LD_J		"\t\t  are specified respectively."
+#    The use of -D on the link-edit command line is significant.
+#    Diagnostics are enabled when a debug token is first encountered, and
+#    can be switched off by prepending the token with `!'.
 #
-#	END OF reference 1
+#    By default, all diagnostics are prepended with the string `debug'.
 #
+#    The tokens `name', `fullname' and `class' can be used to prepend the
+#    output file basename, fullname, and class respectively, to each
+#    diagnostic.
 
 
-# TRANSLATION_NOTE
-#	The next 23 messages make the following usage table.
-#	Tabs are used for alignment.
+# TRANSLATION_NOTE - The next series of messages makes the above output in C
+# locale.  Use tabs and space alignment characters as needed.
+#
+@ MSG_USE_RTLD_A	"Runtime Linking"
+@ MSG_USE_RTLD_B	"    Diagnostics that trace the runtime linking of an \
+			 application can be"
+@ MSG_USE_RTLD_C	"    enabled to stderr by using the environment \
+			 variable setting:"
+@ MSG_USE_RTLD_D	" 	LD_DEBUG=token1,token2 app ..."
+@ MSG_USE_RTLD_E	"    Alternatively, the diagnostics can be redirected \
+			 to an output file"
+@ MSG_USE_RTLD_F	"    using the additional environment variable:"
+@ MSG_USE_RTLD_G	" 	LD_DEBUG_OUTPUT=file"
+@ MSG_USE_RTLD_H	"    The output file is given the specified name and \
+			 the process id as a"
+@ MSG_USE_RTLD_I	"    suffix."
+@ MSG_USE_RTLD_J	"    By default, all diagnostics are prepended with \
+			 the process id,"
+@ MSG_USE_RTLD_K	"    together with the thread id.  Note, all \
+			 applications are effectively"
+@ MSG_USE_RTLD_L	"    thread aware, and once thread capabilities are \
+			 enabled, even a single"
+@ MSG_USE_RTLD_M	"    threaded application is labeled as thread 1."
+@ MSG_USE_RTLD_N	"    The token `lmid' prepends a link-map list \
+			 identifier to each"
+@ MSG_USE_RTLD_O	"    diagnostic."
+@ MSG_USE_RTLD_P	"    The tokens `base', `ldso' and `newlm[0-9]*' can \
+			 be used to isolate"
+@ MSG_USE_RTLD_Q	"    diagnostics to the associated link-map lists.  \
+			 Note, by default, any"
+@ MSG_USE_RTLD_R	"    diagnostics associated with loading components \
+			 for the runtime linker"
+@ MSG_USE_RTLD_S	"    itself are suppressed, unless `ldso' is \
+			 explicitly specified."
+
+@ MSG_USE_LD_A		"Link-Editing"
+@ MSG_USE_LD_B		"    Diagnostics that trace the link-editing of an \
+			 application can be"
+@ MSG_USE_LD_C		"    enabled to stderr using the -D option:"
+@ MSG_USE_LD_D		"       ld -Dtoken1,token2 -o prog ..."
+@ MSG_USE_LD_E		"    As the -D option can also be meaningful to \
+			 compiler drivers, an"
+@ MSG_USE_LD_F		"    alternative mechanism to enable diagnostics is to \
+			 use the environment"
+@ MSG_USE_LD_G		"    variable:"
+@ MSG_USE_LD_H		"       LD_OPTIONS=-Dtoken1,token2 cc -o prog ..."
+@ MSG_USE_LD_I		"    The use of -D on the link-edit command line is \
+			 significant."
+@ MSG_USE_LD_J		"    Diagnostics are enabled when a debug token is \
+			 first encountered, and"
+@ MSG_USE_LD_K		"    can be switched off by prepending the token \
+			 with `!'."
+@ MSG_USE_LD_L		"    By default, all diagnostics are prepended with \
+			 the string `debug'."
+@ MSG_USE_LD_M		"    The tokens `name', `fullname' and `class' can be \
+			 used to prepend"
+@ MSG_USE_LD_N		"    the output file basename, fullname, and class \
+			 respectively, to each"
+@ MSG_USE_LD_O		"    diagnostic."
+
+# TRANSLATION_NOTE - End of reference 1
+
+
+# TRANSLATION_NOTE - The next series of messages makes the following usage
+# table.  Use tabs and space alignment characters as needed.
 #
 # args		display input argument processing (ld only)
 # audit		display runtime link-audit processing (ld.so.1 only)
@@ -190,6 +232,10 @@
 			 shows actual"
 @ MSG_USE_LIBS_2	"\t\t    library lookup (-l) processing"
 
+# TRANSLATION_NOTE -- do not translate the first token `lmid'.
+@ MSG_USE_LMID		"lmid\t  display link-map list identifier \
+			(ld.so.1 only)"
+
 # TRANSLATION_NOTE -- do not translate the first token `long'.
 @ MSG_USE_LONG		"long\t  display long object names without truncation"
 
@@ -219,7 +265,7 @@
 @ MSG_USE_SYMBOLS_2	"\t\t    symbol table addition and resolution (ld only)"
 
 # TRANSLATION_NOTE -- do not translate the first token `statistics'.
-@ MSG_USE_STATISTICS	"statistics display processing statistics (ld only)"
+@ MSG_USE_STATS		"statistics display processing statistics (ld only)"
 
 # TRANSLATION_NOTE -- do not translate the first token `strtab'.
 @ MSG_USE_STRTAB	"strtab\t  display information about string table \
@@ -247,7 +293,7 @@
 # NOTE: these are used by appcert(1) and lari(1), use care when changing.
 
 @ MSG_BND_BASIC		"binding file=%s to file=%s: symbol `%s'"
-@ MSG_BND_PLT		"binding file=%s (%#llx:%#llx) at plt[%d]:%s to \
+@ MSG_BND_PLT		"binding file=%s (%#llx:%#llx) at plt[%lld]:%s to \
 			 file=%s (%#llx:%#llx): symbol `%s'%s"
 @ MSG_BND_DLSYM		"binding file=%s (dlsym) to file=%s \
 			 (%#llx:%#llx): symbol `%s'%s"
@@ -257,7 +303,9 @@
 @ MSG_BND_WEAK_2	"binding file=%s (%#llx:%#llx) to 0x0 \
 			 (undefined weak): symbol `%s'"
 
-@ MSG_BND_PROFILE	"    profiling symbol[%d];  call count=%d"
+@ MSG_BND_PLTPAD_TO	"   pltpad: %#llx: file=%s bound to file=%s: \
+			 symbol `%s'"
+@ MSG_BND_PLTPAD_FROM	"   pltpad: %#llx: bound from file=%s: symbol `%s'"
 
 @ MSG_BND_PSUM_SPARCV9	"Summary of PLT types bound: 21d=%d, 24d=%d, u32=%d, \
 			 u44=%d, full=%d, far=%d, Total=%d"
@@ -271,12 +319,15 @@
 @ MSG_REL_COLLECT	"collecting input relocations: section=%s, file=%s"
 @ MSG_REL_ACTIVE	"performing active relocations"
 @ MSG_REL_CREATING	"creating output relocations"
-@ MSG_REL_RELOC_START	"relocation processing: file=%s%s"
-@ MSG_REL_RELOC_FINISH	"relocation processing: file=%s; finished%s"
-@ MSG_REL_RELOC_NONE	"relocation processing: file=%s%s; nothing to do"
+@ MSG_REL_START		"relocation processing: file=%s%s"
+@ MSG_REL_FINISH	"relocation processing: file=%s; finished%s"
+@ MSG_REL_NONE		"relocation processing: file=%s%s; nothing to do"
 
-@ MSG_REL_RELOC_PLT	"  (plt processing only)"
-@ MSG_REL_RELOC_FAIL	"  (failed)"
+@ MSG_REL_PLT		"  (plt processing only)"
+@ MSG_REL_FAIL		"  (failed)"
+
+@ MSG_REL_BADROFFSET	"<offset lies outside memory image; \
+			 relocation discarded>"
 
 @ MSG_REL_TRANS		"relocation transition: offset: %#llx old reloc: %s \
 			 new reloc: %s symbol `%s'"
@@ -284,11 +335,6 @@
 			 relocation type=%s offset=0x%llx; relocation discarded"
 @ MSG_REL_COPY		"copy data from file=%s to file=%s: symbol `%s'%s"
 
-# Dynamic section messages
-
-@ MSG_DYN_TITLE		"     index  tag               value"
-@ MSG_DYN_ENTRY		"%10.10s  %-15.15s  %-#14llx    %s"
-
 # Entrance criteria messages
 
 @ MSG_ECR_TITLE		"%s Entrance Descriptor List (available)"
@@ -297,13 +343,21 @@
 @ MSG_ECR_DESC		"entrance descriptor[%d]"
 
 
-# Elf section messages
+# Elf Data (section) messages
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more standard 32-bit Elf_Data entries that align with the initial title.
+
+@ MSG_EDATA_TITLE_32	"            addr type        size   offset al file"
+@ MSG_EDATA_ENTRY_32	"  %3s %#10llx %-5s %#10llx %#8llx %2lld %s%s"
 
-@ MSG_ELF_TITLE		"            addr type        size   offset al file"
-@ MSG_ELF_ENTRY		"  %3s %#10llx %-5s %#10llx %#8llx %2lld %s%s"
-@ MSG_ELF_HEADER	"ELF Header"
-@ MSG_ELF_IGNSCN	"  (section ignored)"
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more standard 64-bit Elf_Data entries that align with the initial title.
 
+@ MSG_EDATA_TITLE_64	"                    addr type                \
+			 size           offset al file"
+@ MSG_EDATA_ENTRY_64	"  %3s %#18llx %-5s %#18llx %#8llx %2lld %s%s"
+
+@ MSG_EDATA_IGNSCN	"  (section ignored)"
 
 # File messages
 
@@ -336,10 +390,11 @@
 @ MSG_FIL_CONFIG	"file=%s  [ ELF ]; configuration alternate found: %s"
 
 
-@ MSG_FIL_DATA_1	"    dynamic:  %#10llx  base:  %#10llx  size:   %#10llx"
-@ MSG_FIL_DATA_2	"    entry:    %#10llx  lmid:  %#10llx  lmco:   %#10llx"
-@ MSG_FIL_DATA_3	"    dynamic:  %#10llx  base:  %#10llx"
-@ MSG_FIL_DATA_4	"    envp:     %#10llx  auxv:  %#10llx"
+@ MSG_FIL_DATA_DB	"    dynamic:  %#18llx  base:   %#18llx"
+@ MSG_FIL_DATA_SE	"    size:     %#18llx  entry:  %#18llx"
+@ MSG_FIL_DATA_S	"    size:     %#18llx"
+@ MSG_FIL_DATA_LL	"    lmid:     %18.18s  lmco:   %#18llx"
+@ MSG_FIL_DATA_EA	"    envp:     %#18llx  auxv:   %#18llx"
 
 @ MSG_FIL_BND_ADD	"file=%s;  add binding to:"
 @ MSG_FIL_BND_FILE	"    file=%s   %s"
@@ -444,20 +499,21 @@
 
 # Move messages
 
-@ MSG_MV_ADJEXPAND1	"for symbol=%s new roffset=0x%llx"
-@ MSG_MV_ADJMOVE1	"for symbol=%s roffset(from/to)=\
-			 (0x%llx/0x%llx)"
-@ MSG_MV_OUTSCTADJ1	"adjusting addend for symbol=%s"
-@ MSG_MV_MOVEDATA	"file=%s  processing move data"
-@ MSG_MV_EXPAND0	"expanding %s into .SUNW_data1: %s"
-@ MSG_MV_OUTMOVE0	"copying move entries for %s into .SUNW_move"
-@ MSG_MV_EXPAND1	"\t     0x%llx\t0x%llx    (expanded)"
+@ MSG_MOVE_FILE		"file=%s  processing move data"
+@ MSG_MOVE_TITLE2	"         address       value  repeat  stride  symbol"
+@ MSG_MOVE_ENTRY2	"   in %#10llx   %#10llx  %6d  %6d  %s"
+@ MSG_MOVE_EXPAND	"      %#10llx   %#10llx  (expanded)"
 
-@ MSG_MOVE_INPUT1	"collecting move entries: file=%s"
+@ MSG_MOVE_ADJEXPAND	"for symbol=%s roffset: new=0x%llx"
+@ MSG_MOVE_ADJMOVE	"for symbol=%s roffset: from=0x%llx, to=0x%llx"
+@ MSG_MOVE_OUTSCTADJ	"adjusting addend for symbol=%s"
+@ MSG_MOVE_PAREXPN	"expanding %s into .SUNW_data1: %s"
+@ MSG_MOVE_OUTMOVE	"copying move entries for %s into .SUNW_move"
+@ MSG_MOVE_INPUT	"collecting move entries: file=%s"
+
 @ MSG_MOVE_TITLE1	"\t i/o offset\tvalue\trepeat\tstride\tsymbol"
-@ MSG_MOVE_TITLE2	"\t     address\tvalue\trepeat\tstride\tsymbol"
-@ MSG_MOVE_MVENTRY1	"\t  in 0x%llx\t0x%llx\t0x%x\t0x%x\t%s"
-@ MSG_MOVE_MVENTRY2	"\t out 0x%llx\t0x%llx\t0x%x\t0x%x\t%s"
+@ MSG_MOVE_ENTRY1IN	"\t  in 0x%llx\t0x%llx\t0x%x\t0x%x\t%s"
+@ MSG_MOVE_ENTRY1OUT	"\t out 0x%llx\t0x%llx\t0x%x\t0x%x\t%s"
 
 # Section messages
 
@@ -533,10 +589,10 @@
 @ MSG_SYM_RETAINING	"symbol table processing; retaining local symbols"
 @ MSG_SYM_VERSION	"symbol table processing; adding version symbols"
 
-@ MSG_SYM_BASIC		"symbol[%lld]=%s"
-@ MSG_SYM_ADDING	"symbol[%lld]=%s  (global); adding"
+@ MSG_SYM_BASIC		"symbol[%d]=%s"
+@ MSG_SYM_ADDING	"symbol[%d]=%s  (global); adding"
 @ MSG_SYM_SECTION	"symbol[%d]=%s  (section); segment=%s"
-@ MSG_SYM_RESOLVING	"symbol[%lld]=%s  (global); resolving [%d][%d]"
+@ MSG_SYM_RESOLVING	"symbol[%d]=%s  (global); resolving [%d][%d]"
 @ MSG_SYM_UPDATE	"symbol=%s;  updated"
 @ MSG_SYM_CREATE	"symbol=%s;  creating"
 @ MSG_SYM_REDUCING	"symbol=%s;  reducing to local"
@@ -554,19 +610,16 @@
 
 @ MSG_SYM_LAZY_RESCAN	"rescanning for lazy dependencies for symbol: %s"
 
-# Syminfo strings
-@ MSG_SYMI_TITLE1	"syminfo information"
-@ MSG_SYMI_TITLE2	"     index  flgs         bound to           symbol"
-@ MSG_SYMI_SELF		"<self>"
-@ MSG_SYMI_PARENT	"<parent>"
-@ MSG_SYMI_EXTERN	"<extern>"
+# Syminfo string
+
+@ MSG_SYMINFO_INFO	"syminfo information"
 
 # Version strings
 
 @ MSG_VER_AVAIL_1	"version availability: file=%s"
 @ MSG_VER_AVAIL_2	" available  version                     selected from"
-@ MSG_VER_DEF_1		"version definition processing: file=%s"
-@ MSG_VER_NEED_1	"version needed processing: file=%s"
+@ MSG_VER_DEF_TITLE	"version definition processing: file=%s"
+@ MSG_VER_NEED_TITLE	"version needed processing: file=%s"
 @ MSG_VER_NOINTERFACE	"version definition has no interface symbols: %s"
 
 # SHF_ORDERED related messages. Token used is sections.
@@ -601,7 +654,7 @@
 
 # GOT Messages
 
-@ MSG_GOT_TITLE		"Global Offset Table information:  (%u entries)"
+@ MSG_GOT_INFO		"Global Offset Table information:  (%u entries)"
 
 # TRANSLATION_NOTE
 #	Do not translate .init or .fini, they represent reserved section names.
@@ -642,7 +695,6 @@
 @ MSG_STR_INITIAL	"initialized"
 @ MSG_STR_IN		" in"
 @ MSG_STR_OUT		"out"
-@ MSG_STR_ERROR		"error"
 @ MSG_STR_ACT		"act"
 @ MSG_STR_OLD		"old"
 @ MSG_STR_NEW		"new"
@@ -662,12 +714,6 @@
 @ MSG_STR_COPYZERO	"  (copy zero's unnecessary)"
 @ MSG_STR_TEMPORARY	"  (temporary)"
 
-# PLT padding messages
-
-@ MSG_REL_PADBOUNDTO	"   pltpad file=%s pad: 0x%8.8llx bound to \
-			 file=%s symbol `%s'"
-@ MSG_REL_PADBINDTO	"   pltpad file=%s symbol `%s' binds to pad: 0x%8.8llx"
-
 # TLS related messages
 
 @ MSG_TLS_STATBLOCK1	"static TLS module: [%2d] %s"
@@ -692,10 +738,8 @@
 @ MSG_STATS_RELOCS_IN	"  Relocations  input: records=%-10lld applied=%lld"
 
 # Hardware/Software capabilities messages
-@ MSG_CAP_ELF_TITLE	"     index  tag               value"
-@ MSG_CAP_ELF_ENTRY	"%10.10s  %-15.15s  %s"
 
-@ MSG_CAP_HW_1		"hardware capabilities - %s"
+@ MSG_CAP_VAL_HW1	"hardware capabilities - %s"
 
 @ MSG_CAP_SEC_TITLE	"hardware/software capabilities; input file=%s"
 @ MSG_CAP_SEC_ENTRY	"%12.12s  %-15.15s  %s"
@@ -705,6 +749,241 @@
 @ MSG_CAP_HWFILTR_1	"dir=%s;  hardware capability directory filtered by %s"
 @ MSG_CAP_HWFILTR_2	"dir=%s;  no hardware capability objects found"
 
+
+
+@ MSG_ELF_HEADER	"ELF Header"
+
+# Capabilities entries.
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more capabilities table entries that align with the initial title.
+
+@ MSG_CAP_ELF_TITLE	"     index  tag               value"
+@ MSG_CAP_ELF_ENTRY	"%10.10s  %-15.15s  %s"
+
+
+# Dynamic entries.
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more dynamic table entries that align with the initial title.
+
+@ MSG_DYN_TITLE		"     index  tag                value"
+@ MSG_DYN_ENTRY		"%10.10s  %-16.16s  %-#16llx    %s"
+
+
+# Symbol table entries.
+# TRANSLATION_NOTE - the following entries provide for a series of one or more
+# standard 32-bit symbol table entries that align with the initial title.
+
+@ MSG_SYM_EFS_TITLE_32	"     index    value      size      type bind \
+			 oth ver shndx          name"
+@ MSG_SYM_LDS_TITLE_32	"              value      size      type bind \
+			 oth ver shndx"
+@ MSG_SYM_EFS_ENTRY_32	"%10.10s  %10.10s 0x%8.8x  %4s %4s %2s %4d \
+			 %-14.14s %s"
+
+# TRANSLATION_NOTE - the following entries provide for a series of one or more
+# long 32-bit symbol table entries that align with the initial title.
+
+@ MSG_SYM_EFL_TITLE_32	"     index    value      size      type bind \
+			 oth ver shndx / name"
+@ MSG_SYM_LDL_TITLE_32	"              value      size      type bind \
+			 oth ver shndx"
+@ MSG_SYM_EFL_ENTRY_32	"%10.10s  %10.10s 0x%8.8x  %4s %4s %2s %4d \
+			 %-14s %s"
+
+# TRANSLATION_NOTE - the following entries provide for a series of one or more
+# standard 64-bit symbol table entries that align with the initial title.
+
+@ MSG_SYM_EFS_TITLE_64	"     index    value              size              \
+			 type bind oth ver shndx          name"
+@ MSG_SYM_LDS_TITLE_64	"              value              size              \
+			 type bind oth ver shndx"
+@ MSG_SYM_EFS_ENTRY_64	"%10.10s  %18.18s 0x%16.16llx  %4s %4s %2s %4d \
+			 %-14.14s %s"
+
+# TRANSLATION_NOTE - the following entries provide for a series of one or more
+# long 64-bit symbol table entries that align with the initial title.
+
+@ MSG_SYM_EFL_TITLE_64	"     index    value              size              \
+			 type bind oth ver shndx / name"
+@ MSG_SYM_LDL_TITLE_64	"              value              size              \
+			 type bind oth ver shndx"
+@ MSG_SYM_EFL_ENTRY_64	"%10.10s  %18.18s 0x%16.16llx  %4s %4s %2s %4d \
+			 %-14s %s"
+
+
+# Syminfo entries.
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more symbol information table entries that align with the initial title.
+
+@ MSG_SYMINFO_TITLE	"     index  flags        \
+			 bound to                 symbol"
+@ MSG_SYMINFO_ENTRY	"%10.10s  %-4s %7s %-24s %s"
+
+@ MSG_SYMINFO_SELF	"<self>"
+@ MSG_SYMINFO_PARENT	"<parent>"
+@ MSG_SYMINFO_EXTERN	"<extern>"
+
+
+# Global offset table entries.
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more 32-bit got table entries that align with the initial title.
+
+@ MSG_GOT_TITLE_32	"     index    addr        value     \
+			 pending relocation"
+@ MSG_GOT_ENTRY_RE_32	"%10.10s  0x%08llx  0x%08llx  %-24s  %s"
+@ MSG_GOT_ENTRY_NR_32	"%10.10s  0x%08llx  0x%08llx"
+
+# TRANSLATION_NOTE - the following two entries provide for a series of one or
+# more 64-bit got table entries that align with the initial title.
+
+@ MSG_GOT_TITLE_64	"     index    addr                \
+			 value             pending relocation"
+@ MSG_GOT_ENTRY_RE_64	"%10.10s  0x%016llx  0x%016llx  %-24s  %s"
+@ MSG_GOT_ENTRY_NR_64	"%10.10s  0x%016llx  0x%016llx"
+
+
+# Version table entries.
+@ MSG_VER_DEF		"     index  version                     dependency"
+@ MSG_VER_NEED		"            file                        version"
+
+@ MSG_VER_LINE_1	"%10.10s  %-26.26s  %-20s %s"
+@ MSG_VER_LLINE_1	"%10s  %-26s  %-20s %s"
+@ MSG_VER_LINE_2	"%47s  %s"
+@ MSG_VER_LINE_3	"%38s  %-20s %s"
+@ MSG_VER_LINE_4	"                                        %s"
+@ MSG_VER_LINE_5	"            %-26.26s  %s"
+@ MSG_VER_LLINE_5	"            %-26s  %s"
+
+
+# Relocation entries.
+# TRANSLATION_NOTE - the following strings are used by elfdump(1).  These
+# strings provide for a series of one or more 32-bit relocation table entries,
+# using truncated section names, that align with one of the initial titles.
+
+@ MSG_REL_EFSA_TITLE_32	"    type                       offset     addend  \
+			 section        symbol"
+@ MSG_REL_EFSN_TITLE_32	"    type                       offset             \
+			 section        symbol"
+@ MSG_REL_EFSA_ENTRY_32	"  %-24s %#10llx %#10llx  %-14.14s %s"
+@ MSG_REL_EFSN_ENTRY_32	"  %-24s %#10llx             %-14.14s %s"
+
+# TRANSLATION_NOTE - the following strings are used by elfdump(1).  These
+# strings provide for a series of one or more 32-bit relocation table entries,
+# using long section names, that align with one of the initial titles.
+
+@ MSG_REL_EFLA_TITLE_32	"    type                       offset     addend  \
+			 section / symbol"
+@ MSG_REL_EFLN_TITLE_32	"    type                       offset             \
+			 section / symbol"
+@ MSG_REL_EFLA_ENTRY_32	"  %-24s %#10llx %#10llx  %-14s %s"
+@ MSG_REL_EFLN_ENTRY_32	"  %-24s %#10llx             %-14s %s"
+
+
+# TRANSLATION_NOTE - the following strings are used by ld.so.1(1).  These
+# strings provide for a series of one or more 32-bit relocation table entries,
+# that align with the initial titles.
+
+@ MSG_REL_RTA_TITLE_32	"         type                       offset     \
+			 addend  symbol"
+@ MSG_REL_RTN_TITLE_32	"         type                       offset      \
+			 value  symbol"
+@ MSG_REL_RTV_TITLE_32	"                                                value"
+@ MSG_REL_RTA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %s"
+@ MSG_REL_RTN_ENTRY_32	" %5s %-24s %#10llx             %s"
+@ MSG_REL_RT_APLVAL_32	" apply                          %#10llx %#10llx"
+@ MSG_REL_RT_APLREG_32	" apply                          %10.10s %#10llx"
+
+
+# TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
+# provide for a series of one or more 32-bit relocation table entries, using
+# truncated section names, that align with one of the initial titles.
+
+@ MSG_REL_LDSA_TITLE_32	"         type                       \
+			 offset     addend  section        symbol"
+@ MSG_REL_LDSN_TITLE_32	"         type                       \
+			 offset             section        symbol"
+@ MSG_REL_LDSV_TITLE_32	"         type                       \
+			 offset      value  section        symbol"
+@ MSG_REL_LDSA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %-14.14s %s  %s"
+@ MSG_REL_LDSN_ENTRY_32	" %5s %-24s %#10llx             %-14.14s %s  %s"
+
+# TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
+# provide for a series of one or more 32-bit relocation table entries, using
+# long section names, that align with one of the initial titles.
+
+@ MSG_REL_LDLA_TITLE_32	"         type                       \
+			 offset     addend  section / symbol"
+@ MSG_REL_LDLN_TITLE_32	"         type                       \
+			 offset             section / symbol"
+@ MSG_REL_LDLV_TITLE_32	"         type                       \
+			 offset      value  section / symbol"
+@ MSG_REL_LDLA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %-14s %s  %s"
+@ MSG_REL_LDLN_ENTRY_32	" %5s %-24s %#10llx             %-14s %s  %s"
+
+
+# TRANSLATION_NOTE - the following strings are used by elfdump(1).  These
+# strings provide for a series of one or more 64-bit relocation table entries,
+# using truncated section names, that align with one of the initial titles.
+
+@ MSG_REL_EFSA_TITLE_64	"    type                               \
+			 offset             addend  section        symbol"
+@ MSG_REL_EFSN_TITLE_64	"    type                               \
+			 offset                     section        symbol"
+@ MSG_REL_EFSA_ENTRY_64	"  %-24s %#18llx %#18llx  %-14.14s %s"
+@ MSG_REL_EFSN_ENTRY_64	"  %-24s %#18llx                     %-14.14s %s"
+
+# TRANSLATION_NOTE - the following strings are used by elfdump(1).  These
+# strings provide for a series of one or more 64-bit relocation table entries,
+# using long section names, that align with one of the initial titles.
+
+@ MSG_REL_EFLA_TITLE_64	"    type                               \
+			 offset             addend  section / symbol"
+@ MSG_REL_EFLN_TITLE_64	"    type                               \
+			 offset                     section / symbol"
+@ MSG_REL_EFLA_ENTRY_64	"  %-24s %#18llx %#18llx  %-14s %s"
+@ MSG_REL_EFLN_ENTRY_64	"  %-24s %#18llx                     %-14s %s"
+
+
+# TRANSLATION_NOTE - the following strings are used by ld.so.1(1).  These
+# strings provide for a series of one or more 64-bit relocation table entries,
+# that align with the initial titles.
+
+@ MSG_REL_RTA_TITLE_64	"         type                               \
+			 offset             addend  symbol"
+@ MSG_REL_RTN_TITLE_64	"         type                               \
+			 offset              value  symbol"
+@ MSG_REL_RTV_TITLE_64	"                                                                value"
+@ MSG_REL_RTA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %s"
+@ MSG_REL_RTN_ENTRY_64	" %5s %-24s %#18llx                    %s"
+@ MSG_REL_RT_APLVAL_64	" apply                          %#18llx %#18llx"
+@ MSG_REL_RT_APLREG_64	" apply                          %18.18s %#18llx"
+
+# TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
+# provide for a series of one or more 64-bit relocation table entries, using
+# truncated section names, that align with one of the initial titles.
+
+@ MSG_REL_LDSA_TITLE_64	"         type                               \
+			 offset             addend  section        symbol"
+@ MSG_REL_LDSN_TITLE_64	"         type                               \
+			 offset                     section        symbol"
+@ MSG_REL_LDSV_TITLE_64	"         type                               \
+			 offset              value  section        symbol"
+@ MSG_REL_LDSA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14.14s %s  %s"
+@ MSG_REL_LDSN_ENTRY_64	" %5s %-24s %#18llx                     %-14.14s %s  %s"
+
+# TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
+# provide for a series of one or more 64-bit relocation table entries, using
+# long section names, that align with one of the initial titles.
+
+@ MSG_REL_LDLA_TITLE_64	"         type                               \
+			 offset             addend  section / symbol"
+@ MSG_REL_LDLN_TITLE_64	"         type                               \
+			 offset                     section / symbol"
+@ MSG_REL_LDLV_TITLE_64	"         type                               \
+			 offset              value  section / symbol"
+@ MSG_REL_LDLA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14s %s  %s"
+@ MSG_REL_LDLN_ENTRY_64	" %5s %-24s %#18llx                     %-14s %s  %s"
+
 @ _END_
 
 # Debug enabling tokens (for now these are untranslated)
@@ -714,13 +993,11 @@
 @ MSG_TOK_BINDINGS	"bindings"
 @ MSG_TOK_CAP		"cap"
 @ MSG_TOK_BASIC		"basic"
-@ MSG_TOK_DETAIL	"detail"
 @ MSG_TOK_ENTRY		"entry"
 @ MSG_TOK_FILES		"files"
 @ MSG_TOK_HELP		"help"
 @ MSG_TOK_INIT		"init"
 @ MSG_TOK_LIBS		"libs"
-@ MSG_TOK_LONG		"long"
 @ MSG_TOK_MAP		"map"
 @ MSG_TOK_RELOC		"reloc"
 @ MSG_TOK_SECTIONS	"sections"
@@ -734,12 +1011,18 @@
 @ MSG_TOK_MOVE		"move"
 @ MSG_TOK_DEMANGLE	"demangle"
 @ MSG_TOK_STRTAB	"strtab"
-@ MSG_TOK_STATISTICS	"statistics"
+@ MSG_TOK_STATS		"statistics"
 @ MSG_TOK_UNUSED	"unused"
 
+@ MSG_TOK_DETAIL	"detail"
+@ MSG_TOK_LONG		"long"
 @ MSG_TOK_NAME		"name"
 @ MSG_TOK_FULLNAME	"fullname"
 @ MSG_TOK_CLASS		"class"
+@ MSG_TOK_LMID		"lmid"
+@ MSG_TOK_BASE		"base"
+@ MSG_TOK_LDSO		"ldso"
+@ MSG_TOK_NEWLM		"newlm"
 
 # The following strings represent reserved words, files, pathnames and symbols.
 # Reference to this strings is via the MSG_ORIG() macro, and thus no message
@@ -764,7 +1047,6 @@
 @ MSG_FMT_PATH		"%s/%s"
 
 @ MSG_PTH_OBJECT	"/tmp/ld.so-OBJECT-"
-@ MSG_FIL_RTLD		"ld.so.1"
 
 @ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
 
@@ -776,55 +1058,10 @@
 @ MSG_ECR_FILES		"  ec_files:"
 @ MSG_ECR_FILE		"    %s"
 
-# Elf section messages
-
-@ MSG_ELF_MAGIC		"  ei_magic:   { 0x%x, %c, %c, %c }"
-@ MSG_ELF_CLASS		"  ei_class:   %-18s  ei_data:      %s"
-@ MSG_ELF_MACHINE	"  e_machine:  %-18s  e_version:    %s"
-@ MSG_ELF_TYPE		"  e_type:     %s"
-@ MSG_ELF_FLAGS		"  e_flags:    %18s"
-@ MSG_ELF_FLAGS_FMT	"  e_flags:    %s"
-@ MSG_ELF_ESIZE		"  e_entry:    %#18llx  e_ehsize:     %2d  \
-			 e_shstrndx:   %2d"
-@ MSG_ELFX_ESIZE	"  e_entry:    %#18llx  e_ehsize:     %2d  \
-			 e_shstrndx: [sh[0].sh_link]"
-@ MSG_ELF_SHOFF		"  e_shoff:    %#18llx  e_shentsize:  %2d  \
-			 e_shnum:      %2d"
-@ MSG_ELFX_SHOFF	"  e_shoff:    %#18llx  e_shentsize:  %2d  \
-			 e_shnum:    [sh[0].sh_size]"
-@ MSG_ELF_PHOFF		"  e_phoff:    %#18llx  e_phentsize:  %2d  \
-			 e_phnum:      %2d"
-@ MSG_ELFX_PHOFF	"  e_phoff:    %#18llx  e_phentsize:  %2d  \
-			 e_phnum:    [sh[0].sh_info]"
-
-# Shdr[0] messages
-@ MSG_SHD0_TITLE	"Section Header[0]: {ELF Ehdr extensions}"
-@ MSG_SHD0_SIZE		"    sh_size:      %-6lld [shnum]  sh_type:    %s"
-@ MSG_SHD0_LINK1	"    sh_link:      %-6d [strndx] sh_info:    %d [phnum]"
-@ MSG_SHD0_LINK2	"    sh_link:      %-6d [strndx] sh_info:    %d"
-@ MSG_SHD0_LINK3	"    sh_link:      %-14d  sh_info:    %d [phnum]"
-@ MSG_SHD0_LINK4	"    sh_link:      %-14d  sh_info:    %d"
-
-# Section header messages
-
-@ MSG_SHD_ADDR		"    sh_addr:      %#-14llx  sh_flags:   %s"
-@ MSG_SHD_SIZE		"    sh_size:      %#-14llx  sh_type:    %s"
-@ MSG_SHD_OFFSET	"    sh_offset:    %#-14llx  sh_entsize: %#llx"
-@ MSG_SHD_ALIGN		"    sh_addralign: %#-14llx"
-@ MSG_SHD_LINK		"    sh_link:      %-14d  sh_info:    %s"
-
 # Libs messages
 
 @ MSG_LIB_FILE		"  %s"
 
-# Program header messages
-
-@ MSG_PHD_VADDR		"    p_vaddr:      %#-14llx  p_flags:    %s"
-@ MSG_PHD_PADDR		"    p_paddr:      %#-14llx  p_type:     %s"
-@ MSG_PHD_FILESZ	"    p_filesz:     %#-14llx  p_memsz:    %#llx"
-@ MSG_PHD_OFFSET	"    p_offset:     %#-14llx  p_align:    %#llx"
-
-
 # PLT binding methods
 
 @ MSG_PLT_21D		"21d"
@@ -883,81 +1120,80 @@
 @ MSG_UTL_STA_DELETE	"RT_DELETE"
 @ MSG_UTL_STA_CONSIST	"RT_CONSISTENT"
 
-#
-# The following messages are placed here because:
-# 	*) it is difficult to keep the table aligned, and to document them,
-#	*) the information here are mainly for programmers, and not for
-#	   regular end-users.
-#
+# Version messages
 
-# Relocation messages
-@ MSG_REL_TITLE_1	"        type                        \
-			 offset      value  section        symbol"
-@ MSG_REL_REL_TITLE_2	"        type                        \
-			 offset             section        symbol"
-@ MSG_REL_RELA_TITLE_2	"        type                        \
-			 offset     addend  section        symbol"
-@ MSG_REL_REL_TITLE_3	"        type                        \
-			 offset      value                 symbol"
-@ MSG_REL_RELA_TITLE_3	"        type                        \
-			 offset     addend                 symbol"
-@ MSG_REL_RELA_TITLE_4	"                                           \
-			 value"
-@ MSG_REL_ARGS_2	"                       %#14llx %#10llx"
-@ MSG_REL_ARGS_6	"  %5s %-21s %#14llx %#10llx  %-14.14s %s  %s"
-@ MSG_REL_L_ARGS_6	"  %5s %-21s %#14llx %#10llx  %-14s %s  %s"
-@ MSG_REL_ARGS_5	"  %5s %-21s %#14llx             %-14.14s %s  %s"
-@ MSG_REL_L_ARGS_5	"  %5s %-21s %#14llx             %-14s %s  %s"
-@ MSG_REL_REGSYM	"                       %14.14s %#10llx"
-
-# Symbol strings
-@ MSG_SYM_TITLE		"%10.10s    value       size     type bind \
-			 oth ver shndx       %s"
-@ MSG_SYM_L_TITLE	"%10.10s    value       size     type bind \
-			 oth ver shndx/%s"
-@ MSG_SYM_ENTRY		"%10.10s  %10.10s 0x%8.8llx  %4s %4s %2s %4d \
-			 %-11.11s %s"
-@ MSG_SYM_L_ENTRY	"%10.10s  %10.10s 0x%8.8llx  %4s %4s %2s %4d \
-			 %-11s %s"
-
-@ MSG_SYM_TITLE_64	"%10.10s        value           size     type bind \
-			 oth ver shndx       %s"
-@ MSG_SYM_L_TITLE_64	"%10.10s        value           size     type bind \
-			 oth ver shndx/%s"
-@ MSG_SYM_ENTRY_64	"%10.10s  %14.14s 0x%12.12llx  %4s %4s %2s %4d \
-			 %-11.11s %s"
-@ MSG_SYM_L_ENTRY_64	"%10.10s  %14.14s 0x%12.12llx  %4s %4s %2s %4d \
-			 %-11s %s"
-
-# Version messages
 @ MSG_VER_SELECTED	"  SELECTED  %-26.26s  %s"
 @ MSG_VER_L_SELECTED	"  SELECTED  %-26s  %s"
 @ MSG_VER_ALL		"       ALL  %-26.26s"
 @ MSG_VER_L_ALL		"       ALL  %-26s"
-@ MSG_VER_DEF_2		"     index  version                     dependency"
-@ MSG_VER_NEED_2	"            file                        version"
-@ MSG_VER_LINE_1	"%10.10s  %-26.26s  %-20s %s"
-@ MSG_VER_L_LINE_1	"%10s  %-26s  %-20s %s"
-@ MSG_VER_LINE_2	"%47s  %s"
-@ MSG_VER_LINE_3	"%38s  %-20s %s"
-@ MSG_VER_LINE_4	"%38s  %s"
-@ MSG_VER_LINE_5	"            %-26.26s  %s"
-@ MSG_VER_L_LINE_5	"            %-26s  %s"
-
 
 # GOT messages
-@ MSG_GOT_COLUMNS	"index\tref\taddend\t\tsymbol"
+
+@ MSG_GOT_COLUMNS	"index  ref  addend  symbol"
 @ MSG_GOT_SMALL_PIC	"pic"
-@ MSG_GOT_PIC		"PIC"
+@ MSG_GOT_BIG_PIC	"PIC"
 @ MSG_GOT_FORMAT1	"[%05d] %3s  0x%08llx  %s"
 @ MSG_GOT_FORMAT2	"[%05d] %3s  0x%08llx  %s:%s"
-@ MSG_GOT_ECOLUMNS	" ndx     addr      value    reloc              \
-			 addend   symbol"
-@ MSG_GOT_ECOLUMNS_64	" ndx     addr          value        reloc              \
-			 addend       symbol"
-@ MSG_GOT_EFORMAT	"[%05d]  %08llx  %08llx %-18s %08llx %s"
-@ MSG_GOT_EFORMAT_64	"[%05d]  %012llx  %012llx %-18s %012llx %s"
-
-@ MSG_SYMI_FMT		"%10.10s  %-4s %7s %-18s %s"
 
 @ MSG_CNTL_ENTRY	"   [0x%llx]  %s"
+
+@ MSG_STR_EMPTY		""
+@ MSG_STR_NL		"\n"
+
+@ MSG_GOT_INDEX		" [%ld]"
+@ MSG_FMT_INDEX		" [%d]"
+
+@ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
+
+@ MSG_ELF_MAGIC		"  ei_magic:   { 0x%x, %c, %c, %c }"
+@ MSG_ELF_CLASS		"  ei_class:   %-18s  ei_data:      %s"
+@ MSG_ELF_MACHINE	"  e_machine:  %-18s  e_version:    %s"
+@ MSG_ELF_TYPE		"  e_type:     %s"
+@ MSG_ELF_FLAGS		"  e_flags:    %18s"
+@ MSG_ELF_FLAGS_FMT	"  e_flags:    %s"
+@ MSG_ELF_ESIZE		"  e_entry:    %#18llx  e_ehsize:     %2d  \
+			 e_shstrndx:   %2d"
+@ MSG_ELFX_ESIZE	"  e_entry:    %#18llx  e_ehsize:     %2d  \
+			 e_shstrndx: [sh[0].sh_link]"
+@ MSG_ELF_SHOFF		"  e_shoff:    %#18llx  e_shentsize:  %2d  \
+			 e_shnum:      %2d"
+@ MSG_ELFX_SHOFF	"  e_shoff:    %#18llx  e_shentsize:  %2d  \
+			 e_shnum:    [sh[0].sh_size]"
+@ MSG_ELF_PHOFF		"  e_phoff:    %#18llx  e_phentsize:  %2d  \
+			 e_phnum:      %2d"
+
+# Shdr[0] messages
+
+@ MSG_SHD0_TITLE	"Section Header[0]: {ELF Ehdr extensions}"
+@ MSG_SHD0_SIZE		"    sh_size:      %-6lld [shnum]  sh_type:    %s"
+@ MSG_SHD0_LINK		"    sh_link:      %-6d [strndx] sh_info:    %s"
+
+# Section header messages
+
+@ MSG_SHD_ADDR_32	"    sh_addr:      %#-10llx  sh_flags:   %s"
+@ MSG_SHD_SIZE_32	"    sh_size:      %#-10llx  sh_type:    %s"
+@ MSG_SHD_OFFSET_32	"    sh_offset:    %#-10llx  sh_entsize: %#llx"
+@ MSG_SHD_ALIGN_32	"    sh_addralign: %#-10llx"
+@ MSG_SHD_LINK_32	"    sh_link:      %-10d  sh_info:    %s"
+
+@ MSG_SHD_ADDR_64	"    sh_addr:      %#-18llx  sh_flags:   %s"
+@ MSG_SHD_SIZE_64	"    sh_size:      %#-18llx  sh_type:    %s"
+@ MSG_SHD_OFFSET_64	"    sh_offset:    %#-18llx  sh_entsize: %#llx"
+@ MSG_SHD_ALIGN_64	"    sh_addralign: %#-18llx"
+@ MSG_SHD_LINK_64	"    sh_link:      %-18d  sh_info:    %s"
+
+# Program header messages
+
+@ MSG_PHD_VADDR_32	"    p_vaddr:      %#-10llx  p_flags:    %s"
+@ MSG_PHD_PADDR_32	"    p_paddr:      %#-10llx  p_type:     %s"
+@ MSG_PHD_FILESZ_32	"    p_filesz:     %#-10llx  p_memsz:    %#llx"
+@ MSG_PHD_OFFSET_32	"    p_offset:     %#-10llx  p_align:    %#llx"
+
+@ MSG_PHD_VADDR_64	"    p_vaddr:      %#-18llx  p_flags:    %s"
+@ MSG_PHD_PADDR_64	"    p_paddr:      %#-18llx  p_type:     %s"
+@ MSG_PHD_FILESZ_64	"    p_filesz:     %#-18llx  p_memsz:    %#llx"
+@ MSG_PHD_OFFSET_64	"    p_offset:     %#-18llx  p_align:    %#llx"
+
+# Syminfo formats
+
+@ MSG_SYMINFO_UNKFLAG	" 0x%x"
--- a/usr/src/cmd/sgs/liblddbg/common/libs.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/libs.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -29,47 +29,89 @@
 #include	"_debug.h"
 #include	"libld.h"
 
+void
+Dbg_libs_audit(Lm_list *lml, const char *opath, const char *npath)
+{
+	if (DBG_NOTCLASS(DBG_C_LIBS | DBG_C_AUDITING))
+		return;
+
+	if (npath == opath)
+		return;
+	else if (npath == 0)
+		dbg_print(lml, MSG_INTL(MSG_LIB_SKIP), opath);
+	else
+		dbg_print(lml, MSG_INTL(MSG_LIB_ALTER), npath);
+}
+
+void
+Dbg_libs_find(Lm_list *lml, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_LIBS))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_LIB_FIND), name);
+}
+
+void
+Dbg_libs_found(Lm_list *lml, const char *path, int alter)
+{
+	if (DBG_NOTCLASS(DBG_C_LIBS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_LIB_TRYING), path, alter ?
+	    MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY));
+}
+
+void
+Dbg_libs_ignore(Lm_list *lml, const char *path)
+{
+	if (DBG_NOTCLASS(DBG_C_LIBS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_LIB_IGNORE), path);
+}
+
 static void
-Dbg_lib_dir_print(List * libdir)
+Dbg_lib_dir_print(Lm_list *lml, List *libdir)
 {
 	Listnode	*lnp;
 	char		*cp;
 
-	for (LIST_TRAVERSE(libdir, lnp, cp)) {
-		dbg_print(MSG_ORIG(MSG_LIB_FILE), cp);
-	}
+	for (LIST_TRAVERSE(libdir, lnp, cp))
+		dbg_print(lml, MSG_ORIG(MSG_LIB_FILE), cp);
 }
 
 void
-Dbg_libs_init(List * ulibdir, List * dlibdir)
+Dbg_libs_init(Lm_list *lml, List *ulibdir, List *dlibdir)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_LIB_INITPATH));
-	Dbg_lib_dir_print(ulibdir);
-	Dbg_lib_dir_print(dlibdir);
+	dbg_print(lml, MSG_INTL(MSG_LIB_INITPATH));
+	Dbg_lib_dir_print(lml, ulibdir);
+	Dbg_lib_dir_print(lml, dlibdir);
 }
 
 void
-Dbg_libs_l(const char *name, const char *path)
+Dbg_libs_l(Lm_list *lml, const char *name, const char *path)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_LIB_LOPT), name, path);
+	dbg_print(lml, MSG_INTL(MSG_LIB_LOPT), name, path);
 }
 
 void
-Dbg_libs_path(const char *path, Half orig, const char *obj)
+Dbg_libs_path(Lm_list *lml, const char *path, Half orig, const char *obj)
 {
 	const char	*fmt;
 
 	if (path == (const char *)0)
 		return;
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 
 	if (orig & LA_SER_LIBPATH) {
@@ -85,89 +127,47 @@
 		else
 			fmt = MSG_INTL(MSG_LIB_DEFAULT);
 	}
-	dbg_print(fmt, path, obj);
+	dbg_print(lml, fmt, path, obj);
 }
 
 void
-Dbg_libs_req(const char *so_name, const char *ref_file, const char *name)
+Dbg_libs_req(Lm_list *lml, const char *so_name, const char *ref_file,
+    const char *name)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file);
-}
-
-void
-Dbg_libs_update(List * ulibdir, List * dlibdir)
-{
-	if (DBG_NOTCLASS(DBG_LIBS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_LIB_UPPATH));
-	Dbg_lib_dir_print(ulibdir);
-	Dbg_lib_dir_print(dlibdir);
+	dbg_print(lml, MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file);
 }
 
 void
-Dbg_libs_yp(const char *path)
+Dbg_libs_update(Lm_list *lml, List *ulibdir, List *dlibdir)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_LIB_LIBPATH), path);
-}
-
-void
-Dbg_libs_ylu(const char *path, const char *orig, int index)
-{
-	if (DBG_NOTCLASS(DBG_LIBS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_LIB_YPATH), path, orig,
-		(index == YLDIR) ? 'L' : 'U');
+	dbg_print(lml, MSG_INTL(MSG_LIB_UPPATH));
+	Dbg_lib_dir_print(lml, ulibdir);
+	Dbg_lib_dir_print(lml, dlibdir);
 }
 
 void
-Dbg_libs_find(const char *name)
+Dbg_libs_yp(Lm_list *lml, const char *path)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_LIB_FIND), name);
-}
-
-void
-Dbg_libs_found(const char *path, int alter)
-{
-	if (DBG_NOTCLASS(DBG_LIBS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_LIB_TRYING), path, alter ?
-	    MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_INTL(MSG_LIB_LIBPATH), path);
 }
 
 void
-Dbg_libs_ignore(const char *path)
+Dbg_libs_ylu(Lm_list *lml, const char *path, const char *orig, int index)
 {
-	if (DBG_NOTCLASS(DBG_LIBS))
+	if (DBG_NOTCLASS(DBG_C_LIBS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_LIB_IGNORE), path);
+	dbg_print(lml, MSG_INTL(MSG_LIB_YPATH), path, orig,
+	    (index == YLDIR) ? 'L' : 'U');
 }
-
-void
-Dbg_libs_audit(const char *opath, const char *npath)
-{
-	if (DBG_NOTCLASS(DBG_LIBS | DBG_AUDITING))
-		return;
-
-	if (npath == opath)
-		return;
-	else if (npath == 0)
-		dbg_print(MSG_INTL(MSG_LIB_SKIP), opath);
-	else
-		dbg_print(MSG_INTL(MSG_LIB_ALTER), npath);
-}
--- a/usr/src/cmd/sgs/liblddbg/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,22 +18,28 @@
  *
  * CDDL HEADER END
  */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
 /* LINTLIBRARY */
 /* PROTOLIB1 */
 
 /*
- * Copyright (c) 1998 by Sun Microsystems, Inc. 
- * All rights reserved. 
- */ 
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-/*
- * Supplimental definitions for lint that help us avoid
- * options like `-x' that filter out things we want to
- * know about as well as things we don't.
+ * Supplemental definitions for lint that help us avoid options like `-x' that
+ * filter out things we want to know about as well as things we don't.
  */
-#include "libld.h"
+#include <libelf.h>
+#include <link.h>
+#include <sgs.h>
+#include <libld.h>
+#include <rtld.h>
+#include <conv.h>
+#include <msg.h>
 
 /*
  * Get the Elf32 side to think that the _ELF64 side
@@ -42,11 +47,11 @@
  */
 #if	defined(_ELF64)
 #undef	_ELF64
-#include "debug.h"
+#include <debug.h>
 #define	_ELF64
 #else
 #define	_ELF64
-#include "debug.h"
+#include <debug.h>
 #undef	_ELF64
 #endif
 
--- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -23,7 +22,7 @@
 /* PROTOLIB1 */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -31,314 +30,450 @@
 
 #include <sys/types.h>
 #include <sys/auxv.h>
-#include <gelf.h>
-#include "debug.h"
+#include <debug.h>
+
+uintptr_t
+	Dbg_setup(const char *, Dbg_desc *);
+const char *
+	Dbg_demangle_name(const char *);
+
+void	Dbg_args_files(Lm_list *, int, char *);
+void	Dbg_args_flags(Lm_list *, int, int);
+void	Dbg_audit_interface(Lm_list *, const char *, const char *);
+void	Dbg_audit_lib(Lm_list *, const char *);
+void	Dbg_audit_object(Lm_list *, const char *, const char *);
+void	Dbg_audit_symval(Lm_list *, const char *, const char *, const char *,
+	    Addr, Addr);
+void	Dbg_audit_version(Lm_list *, const char *, ulong_t);
+
+void	Dbg32_bind_global(Rt_map *, Elf32_Addr, Elf32_Off, Elf32_Word,
+	    Pltbindtype, Rt_map *, Elf32_Addr, Elf32_Off, const char *, uint_t);
+void	Dbg64_bind_global(Rt_map *, Elf64_Addr, Elf64_Off, Elf64_Xword,
+	    Pltbindtype, Rt_map *, Elf64_Addr, Elf64_Off, const char *, uint_t);
+void	Dbg64_bind_pltpad_to(Rt_map *, Addr, const char *, const char *);
+void	Dbg64_bind_pltpad_from(Rt_map *, Addr, const char *);
+void	Dbg32_bind_weak(Rt_map *, Elf32_Addr, Elf32_Addr, const char *);
+void	Dbg64_bind_weak(Rt_map *, Elf64_Addr, Elf64_Addr, const char *);
+
+void	Dbg32_cap_hw_candidate(Lm_list *, const char *);
+void	Dbg64_cap_hw_candidate(Lm_list *, const char *);
+void	Dbg32_cap_hw_filter(Lm_list *, const char *, Rt_map *);
+void	Dbg64_cap_hw_filter(Lm_list *, const char *, Rt_map *);
+void	Dbg32_cap_mapfile(Lm_list *, Elf32_Word, Elf32_Word, Elf32_Half);
+void	Dbg64_cap_mapfile(Lm_list *, Elf64_Xword, Elf64_Xword, Elf64_Half);
+void	Dbg32_cap_sec_entry(Lm_list *, uint_t, Elf32_Word, Elf32_Word,
+	    Elf32_Half);
+void	Dbg64_cap_sec_entry(Lm_list *, uint_t, Elf64_Xword, Elf64_Xword,
+	    Elf64_Half);
+void	Dbg32_cap_sec_title(Ofl_desc *);
+void	Dbg64_cap_sec_title(Ofl_desc *);
+void	Dbg32_cap_val_hw1(Lm_list *, Elf32_Word, Elf32_Half);
+void	Dbg64_cap_val_hw1(Lm_list *, Elf64_Xword, Elf64_Half);
+
+void	Dbg32_ent_print(Lm_list *, Elf32_Half, List *, Boolean);
+void	Dbg64_ent_print(Lm_list *, Elf64_Half, List *, Boolean);
 
-uint_t Dbg_setup(const char *);
-void Dbg_set(uint_t);
+void	Dbg32_file_analyze(Rt_map *);
+void	Dbg64_file_analyze64(Rt_map *);
+void	Dbg32_file_aout(Lm_list *, const char *, ulong_t, ulong_t, ulong_t,
+	    const char *, Aliste);
+void	Dbg64_file_aout(Lm_list *, const char *, ulong_t, ulong_t, ulong_t,
+	    const char *, Aliste);
+void	Dbg32_file_archive(Lm_list *, const char *, int);
+void	Dbg64_file_archive(Lm_list *, const char *, int);
+void	Dbg32_file_bind_entry(Lm_list *, Bnd_desc *);
+void	Dbg64_file_bind_entry(Lm_list *, Bnd_desc *);
+void	Dbg32_file_bindings(Rt_map *, int);
+void	Dbg64_file_bindings(Rt_map *, int);
+void	Dbg32_file_config_dis(Lm_list *, const char *, int);
+void	Dbg64_file_config_dis(Lm_list *, const char *, int);
+void	Dbg32_file_config_obj(Lm_list *, const char *, const char *,
+	    const char *);
+void	Dbg64_file_config_obj(Lm_list *, const char *, const char *,
+	    const char *);
+void	Dbg32_file_cntl(Lm_list *, Aliste, Aliste);
+void	Dbg64_file_cntl(Lm_list *, Aliste, Aliste);
+void	Dbg32_file_del_rescan(Lm_list *);
+void	Dbg64_file_del_rescan(Lm_list *);
+void	Dbg32_file_delete(Rt_map *);
+void	Dbg64_file_delete(Rt_map *);
+void	Dbg32_file_dlclose(Lm_list *, const char *, int);
+void	Dbg64_file_dlclose(Lm_list *, const char *, int);
+void	Dbg32_file_dldump(Rt_map *, const char *, int);
+void	Dbg64_file_dldump(Rt_map *, const char *, int);
+void	Dbg32_file_dlopen(Rt_map *, const char *, int);
+void	Dbg64_file_dlopen(Rt_map *, const char *, int);
+void	Dbg32_file_elf(Lm_list *, const char *, ulong_t, ulong_t, ulong_t,
+	    ulong_t, const char *, Aliste);
+void	Dbg64_file_elf(Lm_list *, const char *, ulong_t, ulong_t, ulong_t,
+	    ulong_t, const char *, Aliste);
+void	Dbg32_file_filtee(Lm_list *, const char *, const char *, int);
+void	Dbg64_file_filtee(Lm_list *, const char *, const char *, int);
+void	Dbg32_file_filter(Lm_list *, const char *, const char *, int);
+void	Dbg64_file_filter(Lm_list *, const char *, const char *, int);
+void	Dbg64_file_fixname(Lm_list *, const char *, const char *);
+void	Dbg32_file_fixname(Lm_list *, const char *, const char *);
+void	Dbg32_file_hdl_action(Grp_hdl *, Rt_map *, int);
+void	Dbg64_file_hdl_action(Grp_hdl *, Rt_map *, int);
+void	Dbg32_file_hdl_collect(Grp_hdl *, const char *);
+void	Dbg64_file_hdl_collect(Grp_hdl *, const char *);
+void	Dbg32_file_hdl_title(int);
+void	Dbg64_file_hdl_title(int);
+void	Dbg64_file_lazyload(Rt_map *, const char *, const char *);
+void	Dbg32_file_lazyload(Rt_map *, const char *, const char *);
+void	Dbg32_file_ldso(Rt_map *, char **, auxv_t *, const char *, Aliste);
+void	Dbg64_file_ldso(Rt_map *, char **, auxv_t *, const char *, Aliste);
+void	Dbg32_file_mode_promote(Rt_map *, int);
+void	Dbg64_file_mode_promote(Rt_map *, int);
+void	Dbg32_file_needed(Rt_map *, const char *);
+void	Dbg64_file_needed(Rt_map *, const char *);
+void	Dbg32_file_output(Ofl_desc *);
+void	Dbg64_file_output64(Ofl_desc *);
+void	Dbg32_file_preload(Lm_list *, const char *);
+void	Dbg64_file_preload(Lm_list *, const char *);
+void	Dbg32_file_prot(Rt_map *, int);
+void	Dbg64_file_prot(Rt_map *, int);
+void	Dbg32_file_rejected(Lm_list *, Rej_desc *);
+void	Dbg64_file_rejected(Lm_list *, Rej_desc *);
+void	Dbg32_file_reuse(Lm_list *, const char *, const char *);
+void	Dbg64_file_reuse(Lm_list *, const char *, const char *);
+void	Dbg32_file_skip(Lm_list *, const char *, const char *);
+void	Dbg64_file_skip(Lm_list *, const char *, const char *);
+
+void	Dbg32_got_display(Ofl_desc *, Gottable *);
+void	Dbg64_got_display(Ofl_desc *, Gottable *);
+
+void	Dbg32_libs_audit(Lm_list *, const char *, const char *);
+void	Dbg64_libs_audit(Lm_list *, const char *, const char *);
+void	Dbg32_libs_find(Lm_list *, const char *);
+void	Dbg64_libs_find(Lm_list *, const char *);
+void	Dbg32_libs_found(Lm_list *, const char *, int);
+void	Dbg64_libs_found(Lm_list *, const char *, int);
+void	Dbg32_libs_ignore(Lm_list *, const char *);
+void	Dbg64_libs_ignore(Lm_list *, const char *);
+void	Dbg32_libs_init(Lm_list *, List *, List *);
+void	Dbg64_libs_init(Lm_list *, List *, List *);
+void	Dbg32_libs_l(Lm_list *, const char *, const char *);
+void	Dbg64_libs_l(Lm_list *, const char *, const char *);
+void	Dbg32_libs_path(Lm_list *, const char *, Half, const char *);
+void	Dbg64_libs_path(Lm_list *, const char *, Half, const char *);
+void	Dbg32_libs_req(Lm_list *, const char *, const char *, const char *);
+void	Dbg64_libs_req(Lm_list *, const char *, const char *, const char *);
+void	Dbg32_libs_update(Lm_list *, List *, List *);
+void	Dbg64_libs_update(Lm_list *, List *, List *);
+void	Dbg32_libs_yp(Lm_list *, const char *);
+void	Dbg64_libs_yp(Lm_list *, const char *);
+void	Dbg32_libs_ylu(Lm_list *, const char *, const char *, int);
+void	Dbg64_libs_ylu(Lm_list *, const char *, const char *, int);
+
+void	Dbg32_map_dash(Lm_list *, const char *, Sdf_desc *);
+void	Dbg64_map_dash(Lm_list *, const char *, Sdf_desc *);
+void	Dbg32_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *);
+void	Dbg64_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *);
+void	Dbg32_map_parse(Lm_list *, const char *);
+void	Dbg64_map_parse(Lm_list *, const char *);
+void	Dbg32_map_pipe(Lm_list *, Sg_desc *, const char *, Elf32_Word);
+void	Dbg64_map_pipe(Lm_list *, Sg_desc *, const char *, Elf64_Word);
+void	Dbg32_map_set_atsign(Boolean);
+void	Dbg64_map_set_atsign(Boolean);
+void	Dbg32_map_seg(Ofl_desc *, int, Sg_desc *);
+void	Dbg64_map_seg(Ofl_desc *, int, Sg_desc *);
+void	Dbg32_map_set_equal(Boolean);
+void	Dbg64_map_set_equal(Boolean);
+void	Dbg32_map_size_new(Lm_list *, const char *);
+void	Dbg64_map_size_new(Lm_list *, const char *);
+void	Dbg32_map_size_old(Ofl_desc *, Sym_desc *);
+void	Dbg64_map_size_old(Ofl_desc *, Sym_desc *);
+void	Dbg32_map_sort_fini(Lm_list *, Sg_desc *);
+void	Dbg64_map_sort_fini(Lm_list *, Sg_desc *);
+void	Dbg32_map_sort_orig(Lm_list *, Sg_desc *);
+void	Dbg64_map_sort_orig(Lm_list *, Sg_desc *);
+void	Dbg32_map_symbol(Ofl_desc *, Sym_desc *);
+void	Dbg64_map_symbol(Ofl_desc *, Sym_desc *);
+void	Dbg32_map_version(Lm_list *, const char *, const char *, int);
+void	Dbg64_map_version(Lm_list *, const char *, const char *, int);
+
+void	Dbg32_move_adjexpandreloc(Lm_list *, Elf32_Word, const char *);
+void	Dbg64_move_adjexpandreloc(Lm_list *, Elf64_Xword, const char *);
+void	Dbg32_move_adjmovereloc(Lm_list *, Elf32_Word, Elf32_Word,
+	    const char *);
+void	Dbg64_move_adjmovereloc(Lm_list *, Elf64_Xword, Elf64_Xword,
+	    const char *);
+void	Dbg32_move_data(Rt_map *);
+void	Dbg64_move_data(Rt_map *);
+void	Dbg32_move_entry1(Lm_list *, int, Move *, Sym_desc *);
+void	Dbg64_move_entry1(Lm_list *, int, Move *, Sym_desc *);
+void	Dbg32_move_entry2(Lm_list *, Elf32_Move *, Elf32_Word, const char *);
+void	Dbg64_move_entry2(Lm_list *, Elf64_Move *, Elf64_Word, const char *);
+void	Dbg32_move_expand(Lm_list *, Elf32_Move *, Elf32_Addr);
+void	Dbg64_move_expand(Lm_list *, Elf64_Move *, Elf64_Addr);
+void	Dbg32_move_input(Lm_list *, const char *);
+void	Dbg64_move_input(Lm_list *, const char *);
+void	Dbg32_move_outmove(Lm_list *, const char *);
+void	Dbg64_move_outmove(Lm_list *, const char *);
+void	Dbg32_move_outsctadj(Lm_list *, Sym_desc *);
+void	Dbg64_move_outsctadj(Lm_list *, Sym_desc *);
+void	Dbg32_move_parexpn(Lm_list *, const char *, const char *);
+void	Dbg64_move_parexpn(Lm_list *, const char *, const char *);
 
-void Dbg_args_files(int, char *);
-void Dbg_args_flags(int, int);
-void Dbg_audit_interface(const char *, const char *);
-void Dbg_audit_interface64(const char *, const char *);
-void Dbg_audit_lib(const char *);
-void Dbg_audit_lib64(const char *);
-void Dbg_audit_object(const char *, const char *);
-void Dbg_audit_object64(const char *, const char *);
-void Dbg_audit_symval(const char *, const char *, const char *, Addr, Addr);
-void Dbg_audit_symval64(const char *, const char *, const char *, Addr, Addr);
-void Dbg_audit_version(const char *, ulong_t);
-void Dbg_audit_version64(const char *, ulong_t);
-void Dbg_bind_global(const char *, caddr_t, caddr_t, Xword, Pltbindtype,
-	const char *, caddr_t, caddr_t, const char *, uint_t);
-void Dbg_bind_profile(uint_t, uint_t);
-void Dbg_bind_weak(const char *, caddr_t, caddr_t, const char *);
-void Dbg_cap_hw_candidate(const char *);
-void Dbg_cap_hw_filter(const char *, const char *);
-void Dbg_cap_hw_1(Xword, Half);
-void Dbg_cap_sec_entry(uint_t, Xword, Xword, Half);
-void Dbg_cap_sec_title(const char *);
-void Dbg_ent_print(Half, List *, Boolean);
-void Dbg_file_analyze(Rt_map *);
-void Dbg_file_analyze64(Rt_map *);
-void Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t);
-void Dbg_file_aout64(const char *, ulong_t, ulong_t, ulong_t);
-void Dbg_file_archive(const char *, int);
-void Dbg_file_archive64(const char *, int);
-void Dbg_file_bind_entry(Bnd_desc *);
-void Dbg_file_bind_entry64(Bnd_desc *);
-void Dbg_file_bindings(Rt_map *, int, Word);
-void Dbg_file_bindings64(Rt_map *, int, Word);
-void Dbg_file_bind_title(int);
-void Dbg_file_bind_title64(int);
-void Dbg_file_cntl(Lm_list *, Aliste, Aliste);
-void Dbg_file_config_dis(const char *, int);
-void Dbg_file_config_dis64(const char *, int);
-void Dbg_file_config_obj(const char *, const char *, const char *);
-void Dbg_file_config_obj64(const char *, const char *, const char *);
-void Dbg_file_delete(const char *);
-void Dbg_file_delete64(const char *);
-void Dbg_file_dlclose(const char *, int);
-void Dbg_file_dlclose64(const char *, int);
-void Dbg_file_dldump(const char *, const char *, int);
-void Dbg_file_dldump64(const char *, const char *, int);
-void Dbg_file_dlopen(const char *, const char *, int);
-void Dbg_file_dlopen64(const char *, const char *, int);
-void Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
-	Aliste);
-void Dbg_file_elf64(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
-	Aliste);
-void Dbg_file_filtee(const char *, const char *, int);
-void Dbg_file_filtee64(const char *, const char *, int);
-void Dbg_file_filter(const char *, const char *, int);
-void Dbg_file_filter64(const char *, const char *, int);
-void Dbg_file_fixname(const char *, const char *);
-void Dbg_file_fixname64(const char *, const char *);
-void Dbg_file_generic(Ifl_desc *);
-void Dbg_file_generic64(Ifl_desc *);
-void Dbg_file_handle_collect(Grp_hdl *, const char *);
-void Dbg_file_handle_collect64(Grp_hdl *, const char *);
-void Dbg_file_handle(Grp_hdl *, Rt_map *, int);
-void Dbg_file_handle64(Grp_hdl *, Rt_map *, int);
-void Dbg_file_lazyload(const char *, const char *, const char *);
-void Dbg_file_lazyload64(const char *, const char *, const char *);
-void Dbg_file_ldso(const char *, ulong_t, ulong_t, char **, auxv_t *);
-void Dbg_file_ldso64(const char *, ulong_t, ulong_t, char **, auxv_t *);
-void Dbg_file_mode_promote(const char *, int);
-void Dbg_file_needed(const char *, const char *);
-void Dbg_file_needed64(const char *, const char *);
-void Dbg_file_nl(void);
-void Dbg_file_nl64(void);
-void Dbg_file_output(Ofl_desc *);
-void Dbg_file_output64(Ofl_desc *);
-void Dbg_file_preload(const char *);
-void Dbg_file_preload64(const char *);
-void Dbg_file_prot(const char *, int);
-void Dbg_file_prot64(const char *, int);
-void Dbg_file_rejected(Rej_desc *);
-void Dbg_file_reuse(const char *, const char *);
-void Dbg_file_reuse64(const char *, const char *);
-void Dbg_file_ar_rescan(void);
-void Dbg_file_del_rescan(void);
-void Dbg_file_skip(const char *, const char *);
-void Dbg_file_skip64(const char *, const char *);
-void Dbg_got_display(Gottable *, Ofl_desc *);
-void Dbg_got_display64(Gottable *, Ofl_desc *);
-void Dbg_libs_audit(const char *, const char *);
-void Dbg_libs_ignore(const char *);
-void Dbg_libs_init(List *, List *);
-void Dbg_libs_l(const char *, const char *);
-void Dbg_libs_path(const char *, Half, const char *);
-void Dbg_libs_req(const char *, const char *, const char *);
-void Dbg_libs_update(List *, List *);
-void Dbg_libs_yp(const char *);
-void Dbg_libs_ylu(const char *, const char *, int);
-void Dbg_libs_find(const char *);
-void Dbg_libs_found(const char *, int);
-void Dbg_map_atsign(Boolean);
-void Dbg_map_atsign64(Boolean);
-void Dbg_map_dash(const char *, Sdf_desc *);
-void Dbg_map_dash64(const char *, Sdf_desc *);
-void Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *);
-void Dbg_map_ent64(Boolean, Ent_desc *, Ofl_desc *);
-void Dbg_map_equal(Boolean);
-void Dbg_map_equal64(Boolean);
-void Dbg_map_parse(const char *);
-void Dbg_map_parse64(const char *);
-void Dbg_map_pipe(Sg_desc *, const char *, const Word);
-void Dbg_map_pipe64(Sg_desc *, const char *, const Word);
-void Dbg_map_seg(Half, int, Sg_desc *);
-void Dbg_map_seg64(Half, int, Sg_desc *);
-void Dbg_map_size_new(const char *);
-void Dbg_map_size_new64(const char *);
-void Dbg_map_size_old(Ehdr *, Sym_desc *);
-void Dbg_map_size_old64(Ehdr *, Sym_desc *);
-void Dbg_map_sort_fini(Sg_desc *);
-void Dbg_map_sort_fini64(Sg_desc *);
-void Dbg_map_sort_orig(Sg_desc *);
-void Dbg_map_sort_orig64(Sg_desc *);
-void Dbg_map_symbol(Ehdr *, Sym_desc *);
-void Dbg_map_symbol64(Ehdr *, Sym_desc *);
-void Dbg_map_version(const char *, const char *, int);
-void Dbg_map_version64(const char *, const char *, int);
-void Dbg_move_adjexpandreloc(ulong_t, const char *);
-void Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *);
-void Dbg_move_data(const char *);
-void Dbg_move_expanding(Move *, Addr);
-void Dbg_move_input1(const char *);
-void Dbg_move_mventry(int, Move *, Sym_desc *);
-void Dbg_move_mventry64(int, Move *, Sym_desc *);
-void Dbg_move_mventry2(Move *, Word, char *);
-void Dbg_move_mventry264(Move *, Word, char *);
-void Dbg_move_outmove(const uchar_t *);
-void Dbg_move_outsctadj(Sym_desc *);
-void Dbg_move_outsctadj64(Sym_desc *);
-void Dbg_move_parexpn(const char *, const char *);
-void Dbg_pltpad_bindto64(const char *, const char *, Addr);
-void Dbg_pltpad_boundto64(const char *, Addr, const char *, const char *);
-void Dbg_reloc_apply(unsigned long long, unsigned long long);
-void Dbg_reloc_ars_entry(Half, Rel_desc *);
-void Dbg_reloc_ars_entry64(Half, Rel_desc *);
-void Dbg_reloc_copy(const char *, const char *, const char *, int);
-void Dbg_reloc_discard(Half, Rel_desc *);
-void Dbg_reloc_discard64(Half, Rel_desc *);
-void Dbg_reloc_doact(Half, Word, Xword, Xword, const char *, Os_desc *);
-void Dbg_reloc_doact64(Half, Word, Xword, Xword, const char *, Os_desc *);
-void Dbg_reloc_doactiverel(void);
-void Dbg_reloc_dooutrel(GElf_Word);
-void Dbg_reloc_dooutrel64(GElf_Word);
-void Dbg_reloc_in(Half, Word, void *, const char *, const char *);
-void Dbg_reloc_in64(Half, Word, void *, const char *, const char *);
-void Dbg_reloc_ors_entry(Half, Rel_desc *);
-void Dbg_reloc_ors_entry64(Half, Rel_desc *);
-void Dbg_reloc_out(Half, Word, void *, const char *, const char *);
-void Dbg_reloc_out64(Half, Word, void *, const char *, const char *);
-void Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *);
-void Dbg_reloc_proc64(Os_desc *, Is_desc *, Is_desc *);
-void Dbg_reloc_run(const char *, uint_t, int, int);
-void Dbg_reloc_reg_apply(unsigned long long, unsigned long long);
-void Dbg_reloc_reg_apply64(unsigned long long, unsigned long long);
-void Dbg_sec_added(Os_desc *, Sg_desc *);
-void Dbg_sec_added64(Os_desc *, Sg_desc *);
-void Dbg_sec_created(Os_desc *, Sg_desc *);
-void Dbg_sec_created64(Os_desc *, Sg_desc *);
-void Dbg_sec_group(Is_desc *, Group_desc *);
-void Dbg_sec_group64(Is_desc *, Group_desc *);
-void Dbg_sec_in(Is_desc *);
-void Dbg_sec_in64(Is_desc *);
-void Dbg_sec_order_list(Ofl_desc *, int);
-void Dbg_sec_order_list64(Ofl_desc *, int);
-void Dbg_sec_order_error(Ifl_desc *, Word, int);
-void Dbg_sec_order_error64(Ifl_desc *, Word, int);
-void Dbg_seg_entry(Half, int, Sg_desc *);
-void Dbg_seg_entry64(Half, int, Sg_desc *);
-void Dbg_seg_list(Half, List *);
-void Dbg_seg_list64(Half, List *);
-void Dbg_seg_os(Ofl_desc *, Os_desc *, int);
-void Dbg_seg_os64(Ofl_desc *, Os_desc *, int);
-void Dbg_seg_title(void);
-void Dbg_seg_title64(void);
-void Dbg_statistics_ld(Ofl_desc *);
-void Dbg_statistics_ld64(Ofl_desc *);
-void Dbg_statistics_ar(Ofl_desc *);
-void Dbg_statistics_ar64(Ofl_desc *);
-void Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *);
-void Dbg_syms_ar_checking64(Xword, Elf_Arsym *, const char *);
-void Dbg_syms_ar_entry(Xword, Elf_Arsym *);
-void Dbg_syms_ar_entry64(Xword, Elf_Arsym *);
-void Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *, int);
-void Dbg_syms_ar_resolve64(Xword, Elf_Arsym *, const char *, int);
-void Dbg_syms_ar_title(const char *, int);
-void Dbg_syms_ar_title64(const char *, int);
-void Dbg_syms_created(const char *);
-void Dbg_syms_created64(const char *);
-void Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *);
-void Dbg_syms_entered64(Ehdr *, Sym *, Sym_desc *);
-void Dbg_syms_entry(Xword, Sym_desc *);
-void Dbg_syms_entry64(Xword, Sym_desc *);
-void Dbg_syms_global(Xword, const char *);
-void Dbg_syms_global64(Xword, const char *);
-void Dbg_syms_new(Ehdr *, Sym *, Sym_desc *);
-void Dbg_syms_new64(Ehdr *, Sym *, Sym_desc *);
-void Dbg_syms_nl(void);
-void Dbg_syms_nl64(void);
-void Dbg_syms_old(Ehdr *, Sym_desc *);
-void Dbg_syms_old64(Ehdr *, Sym_desc *);
-void Dbg_syms_process(Ifl_desc *);
-void Dbg_syms_process64(Ifl_desc *);
-void Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int, const char *);
-void Dbg_syms_reduce64(int, Ehdr *, Sym_desc *, int, const char *);
-void Dbg_syms_reloc(Ehdr *, Sym_desc *);
-void Dbg_syms_reloc64(Ehdr *, Sym_desc *);
-void Dbg_syms_resolved(Ehdr *, Sym_desc *);
-void Dbg_syms_resolved64(Ehdr *, Sym_desc *);
-void Dbg_syms_resolving1(Xword, const char *, int, int);
-void Dbg_syms_resolving164(Xword, const char *, int, int);
-void Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
-void Dbg_syms_resolving264(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
-void Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *);
-void Dbg_syms_sec_entry64(int, Sg_desc *, Os_desc *);
-void Dbg_syms_sec_title(void);
-void Dbg_syms_sec_title64(void);
-void Dbg_syms_sec_unused(Is_desc *, uint_t);
-void Dbg_syms_sec_unused64(Is_desc *, uint_t);
-void Dbg_syms_spec_title(void);
-void Dbg_syms_spec_title64(void);
-void Dbg_syms_up_title(Ehdr *);
-void Dbg_syms_up_title64(Ehdr *);
-void Dbg_syms_updated(Ehdr *, Sym_desc *, const char *);
-void Dbg_syms_updated64(Ehdr *, Sym_desc *, const char *);
-void Dbg_syms_dlsym(const char *, const char *, const char *, int);
-void Dbg_syms_dlsym64(const char *, const char *, const char *, int);
-void Dbg_syms_lookup_aout(const char *);
-void Dbg_syms_lookup_aout64(const char *);
-void Dbg_syms_lookup(const char *, const char *, const char *);
-void Dbg_syms_lookup64(const char *, const char *, const char *);
-void Dbg_syminfo_entry(int, Syminfo *, Sym *, const char *, Dyn *);
-void Dbg_syminfo_entry64(int, Syminfo *, Sym *, const char *, Dyn *);
-void Dbg_syminfo_title(void);
-void Dbg_syminfo_title64(void);
-void Dbg_support_action(const char *, const char *, Support_ndx, const char *);
-void Dbg_support_load(const char *, const char *);
-void Dbg_support_req(const char *, int);
-void Dbg_unused_file(const char *, int, int);
-void Dbg_unused_rtldinfo(const char *, const char *);
-void Dbg_unused_sec(Is_desc *);
-void Dbg_unused_sec64(Is_desc *);
-void Dbg_unused_unref(const char *, const char *);
-void Dbg_util_broadcast(const char *name);
-void Dbg_util_call_array(const char *libname, void *addr, uint_t ndx,
-    uint_t shtype);
-void Dbg_util_call_fini(const char *name);
-void Dbg_util_call_init(const char *name, int flag);
-void Dbg_util_call_main(const char *name);
-void Dbg_util_collect(const char *name, int flag, int ndx);
-void Dbg_util_dbnotify(rd_event_e event, r_state_e state);
-void Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag);
-void Dbg_util_edge_out(const char *cname, int ndx, const char *dname);
-void Dbg_util_intoolate(const char *name);
-void Dbg_util_nl();
-void Dbg_util_no_init(const char *name);
-void Dbg_util_scc_entry(uint_t idx, const char *name);
-void Dbg_util_scc_title(int sec);
-void Dbg_util_str(const char *name);
-void Dbg_util_wait(int what, const char *cname, const char *dname);
-void Dbg_ver_avail_entry(Ver_index *, const char *);
-void Dbg_ver_avail_entry64(Ver_index *, const char *);
-void Dbg_ver_avail_title(const char *);
-void Dbg_ver_def_title(const char *);
-void Dbg_ver_desc_entry(Ver_desc *);
-void Dbg_ver_desc_entry64(Ver_desc *);
-void Dbg_ver_need_title(const char *);
-void Dbg_ver_need_entry(Half, const char *, const char *);
-void Dbg_ver_symbol(const char *);
+void	Dbg32_reloc_apply_reg(Lm_list *, int, Elf32_Half, Elf32_Word,
+	    Elf32_Word);
+void	Dbg64_reloc_apply_reg(Lm_list *, int, Elf64_Half, Elf64_Xword,
+	    Elf64_Xword);
+void	Dbg32_reloc_apply_val(Lm_list *, int, Elf32_Word, Elf32_Word);
+void	Dbg64_reloc_apply_val(Lm_list *, int, Elf64_Xword, Elf64_Xword);
+void	Dbg32_reloc_ars_entry(Lm_list *, int, Elf32_Word, Elf32_Half, Rel_desc *);
+void	Dbg64_reloc_ars_entry(Lm_list *, int, Elf64_Word, Elf64_Half, Rel_desc *);
+void	Dbg32_reloc_copy(Rt_map *, Rt_map *, const char *, int);
+void	Dbg64_reloc_copy(Rt_map *, Rt_map *, const char *, int);
+void	Dbg32_reloc_discard(Lm_list *, Elf32_Half, Rel_desc *);
+void	Dbg64_reloc_discard(Lm_list *, Elf64_Half, Rel_desc *);
+void	Dbg32_reloc_doact(Lm_list *, int, Elf32_Half, Elf32_Word, Elf32_Word,
+	    Elf32_Word, Elf32_Word, const char *, Os_desc *);
+void	Dbg64_reloc_doact(Lm_list *, int, Elf64_Half, Elf64_Word, Elf64_Word,
+	    Elf64_Xword, Elf64_Xword, const char *, Os_desc *);
+void	Dbg32_reloc_doact_title(Lm_list *);
+void	Dbg64_reloc_doact_title(Lm_list *);
+void	Dbg32_reloc_dooutrel(Lm_list *, Elf32_Word);
+void	Dbg64_reloc_dooutrel(Lm_list *, Elf64_Word);
+void	Dbg32_reloc_entry(Lm_list *, const char *, Elf32_Half, Elf32_Word,
+	    void *, const char *, const char *, const char *);
+void	Dbg64_reloc_entry(Lm_list *, const char *, Elf64_Half, Elf64_Word,
+	    void *, const char *, const char *, const char *);
+void	Dbg32_reloc_error(Lm_list *, int, Elf32_Half, Elf32_Word, void *,
+	    const char *);
+void	Dbg64_reloc_error(Lm_list *, int, Elf64_Half, Elf64_Word, void *,
+	    const char *);
+void	Dbg32_reloc_generate(Lm_list *, Os_desc *, Elf32_Word);
+void	Dbg64_reloc_generate(Lm_list *, Os_desc *, Elf64_Word);
+void	Dbg32_reloc_in(Lm_list *, int, Elf32_Half, Elf32_Word, void *,
+	    const char *, const char *);
+void	Dbg64_reloc_in(Lm_list *, int, Elf64_Half, Elf64_Word, void *,
+	    const char *, const char *);
+void	Dbg32_reloc_ors_entry(Lm_list *, int, Elf32_Word, Elf32_Half, Rel_desc *);
+void	Dbg64_reloc_ors_entry(Lm_list *, int, Elf64_Word, Elf64_Half, Rel_desc *);
+void	Dbg32_reloc_out(Ofl_desc *, int, Elf32_Word, void *, const char *,
+	    const char *);
+void	Dbg64_reloc_out(Ofl_desc *, int, Elf64_Word, void *, const char *,
+	    const char *);
+void	Dbg32_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *);
+void	Dbg64_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *);
+void	Dbg32_reloc_run(Rt_map *, uint_t, int, int);
+void	Dbg64_reloc_run(Rt_map *, uint_t, int, int);
+void	Dbg32_reloc_transition(Lm_list *, Elf32_Half, Elf32_Word, Elf32_Word,
+	    Elf32_Word, const char *);
+void	Dbg64_reloc_transition(Lm_list *, Elf64_Half, Elf64_Word, Elf64_Word,
+	    Elf64_Xword, const char *);
+
+void	Dbg32_sec_added(Lm_list *, Os_desc *, Sg_desc *);
+void	Dbg64_sec_added(Lm_list *, Os_desc *, Sg_desc *);
+void	Dbg32_sec_created(Lm_list *, Os_desc *, Sg_desc *);
+void	Dbg64_sec_created(Lm_list *, Os_desc *, Sg_desc *);
+void	Dbg32_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
+void	Dbg64_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
+void	Dbg32_sec_group(Lm_list *, Is_desc *, Group_desc *);
+void	Dbg64_sec_group(Lm_list *, Is_desc *, Group_desc *);
+void	Dbg32_sec_in(Lm_list *, Is_desc *);
+void	Dbg64_sec_in(Lm_list *, Is_desc *);
+void	Dbg32_sec_order_error(Lm_list *, Ifl_desc *, Elf32_Word, int);
+void	Dbg64_sec_order_error(Lm_list *, Ifl_desc *, Elf64_Word, int);
+void	Dbg32_sec_order_list(Ofl_desc *, int);
+void	Dbg64_sec_order_list(Ofl_desc *, int);
+void	Dbg32_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
+void	Dbg64_sec_strtab(Lm_list *, Os_desc *, Str_tbl *);
+
+void	Dbg32_seg_desc_entry(Lm_list *, Elf32_Half, int, Sg_desc *);
+void	Dbg64_seg_desc_entry(Lm_list *, Elf64_Half, int, Sg_desc *);
+void	Dbg32_seg_entry(Ofl_desc *, int, Sg_desc *);
+void	Dbg64_seg_entry(Ofl_desc *, int, Sg_desc *);
+void	Dbg32_seg_list(Lm_list *, Elf32_Half, List *);
+void	Dbg64_seg_list(Lm_list *, Elf64_Half, List *);
+void	Dbg32_seg_os(Ofl_desc *, Os_desc *, int);
+void	Dbg64_seg_os(Ofl_desc *, Os_desc *, int);
+void    Dbg32_seg_title(Lm_list *);
+void    Dbg64_seg_title(Lm_list *);
+
+void	Dbg32_statistics_ar(Ofl_desc *);
+void	Dbg64_statistics_ar(Ofl_desc *);
+void	Dbg32_statistics_ld(Ofl_desc *);
+void	Dbg64_statistics_ld(Ofl_desc *);
+
+void	Dbg32_support_action(Lm_list *, const char *, const char *, Support_ndx,
+	    const char *);
+void	Dbg64_support_action(Lm_list *, const char *, const char *, Support_ndx,
+	    const char *);
+void	Dbg32_support_load(Lm_list *, const char *, const char *);
+void	Dbg64_support_load(Lm_list *, const char *, const char *);
+void	Dbg32_support_req(Lm_list *, const char *, int);
+void	Dbg64_support_req(Lm_list *, const char *, int);
+
+void	Dbg32_syminfo_entry(Lm_list *, Elf32_Word, Syminfo *, Sym *, const char *,
+	    Dyn *);
+void	Dbg64_syminfo_entry(Lm_list *, Elf64_Word, Syminfo *, Sym *, const char *,
+	    Dyn *);
+void	Dbg32_syminfo_title(Lm_list *);
+void	Dbg64_syminfo_title(Lm_list *);
 
-/*
- * Gelf related functions, used by elfdump
- */
-const char * Gelf_sym_dem(const char *);
+void	Dbg32_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *, const char *);
+void	Dbg64_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *, const char *);
+void	Dbg32_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *);
+void	Dbg64_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *);
+void	Dbg32_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *, const char *, int);
+void	Dbg64_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *, const char *, int);
+void	Dbg32_syms_ar_title(Lm_list *, const char *, int);
+void	Dbg64_syms_ar_title(Lm_list *, const char *, int);
+void	Dbg32_syms_created(Lm_list *, const char *);
+void	Dbg64_syms_created(Lm_list *, const char *);
+void	Dbg32_syms_discarded(Lm_list *, Sym_desc *, Is_desc *);
+void	Dbg64_syms_discarded(Lm_list *, Sym_desc *, Is_desc *);
+void	Dbg32_syms_dlsym(Rt_map *, const char *, const char *, int);
+void	Dbg64_syms_dlsym(Rt_map *, const char *, const char *, int);
+void	Dbg32_syms_entered(Ofl_desc *, Sym *, Sym_desc *);
+void	Dbg64_syms_entered(Ofl_desc *, Sym *, Sym_desc *);
+void	Dbg32_syms_entry(Lm_list *, Elf32_Word, Sym_desc *);
+void	Dbg64_syms_entry(Lm_list *, Elf64_Word, Sym_desc *);
+void	Dbg32_syms_global(Lm_list *, Elf32_Word, const char *);
+void	Dbg64_syms_global(Lm_list *, Elf64_Word, const char *);
+void	Dbg32_syms_ignore(Ofl_desc *, Sym_desc *);
+void	Dbg64_syms_ignore(Ofl_desc *, Sym_desc *);
+void	Dbg32_syms_lazy_rescan(Lm_list *, const char *);
+void	Dbg64_syms_lazy_rescan(Lm_list *, const char *);
+void	Dbg32_syms_lookup(Rt_map *, const char *, const char *);
+void	Dbg64_syms_lookup(Rt_map *, const char *, const char *);
+void	Dbg32_syms_lookup_aout(Lm_list *, const char *);
+void	Dbg32_syms_new(Ofl_desc *, Sym *, Sym_desc *);
+void	Dbg64_syms_new(Ofl_desc *, Sym *, Sym_desc *);
+void	Dbg32_syms_old(Ofl_desc *, Sym_desc *);
+void	Dbg64_syms_old(Ofl_desc *, Sym_desc *);
+void	Dbg32_syms_process(Lm_list *, Ifl_desc *);
+void	Dbg64_syms_process(Lm_list *, Ifl_desc *);
+void	Dbg32_syms_reduce(Ofl_desc *, int, Sym_desc *, int, const char *);
+void	Dbg64_syms_reduce(Ofl_desc *, int, Sym_desc *, int, const char *);
+void	Dbg32_syms_reloc(Ofl_desc *, Sym_desc *);
+void	Dbg64_syms_reloc(Ofl_desc *, Sym_desc *);
+void	Dbg32_syms_resolved(Ofl_desc *, Sym_desc *);
+void	Dbg64_syms_resolved(Ofl_desc *, Sym_desc *);
+void	Dbg32_syms_resolving(Ofl_desc *, Elf32_Word, const char *, int, int,
+	    Sym *, Sym *, Sym_desc *, Ifl_desc *);
+void	Dbg64_syms_resolving(Ofl_desc *, Elf64_Word, const char *, int, int,
+	    Sym *, Sym *, Sym_desc *, Ifl_desc *);
+void	Dbg32_syms_sec_entry(Lm_list *, Elf32_Word, Sg_desc *, Os_desc *);
+void	Dbg64_syms_sec_entry(Lm_list *, Elf64_Word, Sg_desc *, Os_desc *);
+void	Dbg32_syms_sec_title(Lm_list *);
+void	Dbg64_syms_sec_title(Lm_list *);
+void	Dbg32_syms_spec_title(Lm_list *);
+void	Dbg64_syms_spec_title(Lm_list *);
+void	Dbg32_syms_updated(Ofl_desc *, Sym_desc *, const char *);
+void	Dbg64_syms_updated(Ofl_desc *, Sym_desc *, const char *);
+void	Dbg32_syms_up_title(Lm_list *);
+void	Dbg64_syms_up_title(Lm_list *);
 
-void Gelf_cap_print(GElf_Cap *, int, Half);
-void Gelf_cap_title(void);
-void Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half);
-void Gelf_dyn_title(void);
-void Gelf_elf_data_title(void);
-void Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *);
-void Gelf_got_title(uchar_t);
-void Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr, GElf_Xword,
-	GElf_Word, void *, const char *);
-void Gelf_note_entry(GElf_Word *, GElf_Word);
-void Gelf_phdr_entry(Half, GElf_Phdr *);
-void Gelf_reloc_entry(const char *, GElf_Half, GElf_Word,
-	GElf_Rela *, const char *, const char *);
-void Gelf_shdr_entry(Half, GElf_Shdr *);
-void Gelf_sym_table_entry(const char *, GElf_Ehdr *, GElf_Sym *,
-	GElf_Word, const char *, const char *);
-void Gelf_sym_table_title(GElf_Ehdr *, const char *, const char *);
-void Gelf_syminfo_entry(int, GElf_Syminfo *, const char *, const char *);
-void Gelf_syminfo_title(void);
-void Gelf_ver_def_title(void);
-void Gelf_ver_need_title(void);
-void Gelf_ver_line_1(const char *, const char *, const char *, const char *);
-void Gelf_ver_line_2(const char *, const char *);
-void Gelf_ver_line_3(const char *, const char *, const char *);
+void	Dbg32_util_broadcast(Rt_map *);
+void	Dbg64_util_broadcast(Rt_map *);
+void	Dbg32_util_call_array(Rt_map *, void *, int, Elf32_Word);
+void	Dbg64_util_call_array(Rt_map *, void *, int, Elf64_Word);
+void	Dbg32_util_call_fini(Rt_map *);
+void	Dbg64_util_call_fini(Rt_map *);
+void	Dbg32_util_call_init(Rt_map *, int);
+void	Dbg64_util_call_init(Rt_map *, int);
+void	Dbg32_util_call_main(Rt_map *);
+void	Dbg64_util_call_main(Rt_map *);
+void	Dbg32_util_collect(Rt_map *, int, int);
+void	Dbg64_util_collect(Rt_map *, int, int);
+void	Dbg32_util_dbnotify(Lm_list *, rd_event_e, r_state_e);
+void	Dbg64_util_dbnotify(Lm_list *, rd_event_e, r_state_e);
+void	Dbg32_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *, int, int);
+void	Dbg64_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *, int, int);
+void	Dbg32_util_edge_out(Rt_map *, Rt_map *);
+void	Dbg64_util_edge_out(Rt_map *, Rt_map *);
+void	Dbg32_util_intoolate(Rt_map *);
+void	Dbg64_util_intoolate(Rt_map *);
+void	Dbg32_util_nl(Lm_list *, int);
+void	Dbg64_util_nl(Lm_list *, int);
+void	Dbg32_util_no_init(Rt_map *);
+void	Dbg64_util_no_init(Rt_map *);
+void	Dbg32_util_scc_entry(Rt_map *, uint_t);
+void	Dbg64_util_scc_entry(Rt_map *, uint_t);
+void	Dbg32_util_scc_title(Lm_list *, int);
+void	Dbg64_util_scc_title(Lm_list *, int);
+void	Dbg32_util_str(Lm_list *, const char  *);
+void	Dbg64_util_str(Lm_list *, const char  *);
+void	Dbg32_util_wait(Rt_map *, Rt_map *, int);
+void	Dbg64_util_wait(Rt_map *, Rt_map *, int);
+
+void	Dbg32_unused_file(Lm_list *, const char *, int, uint_t);
+void	Dbg64_unused_file(Lm_list *, const char *, int, uint_t);
+void	Dbg32_unused_rtldinfo(Rt_map *);
+void	Dbg64_unused_rtldinfo(Rt_map *);
+void	Dbg32_unused_sec(Lm_list *, Is_desc *);
+void	Dbg64_unused_sec(Lm_list *, Is_desc *);
+void	Dbg32_unused_unref(Rt_map *, const char *);
+void	Dbg64_unused_unref(Rt_map *, const char *);
+
+void	Dbg32_ver_need_entry(Lm_list *, Half, const char *, const char *);
+void	Dbg64_ver_need_entry(Lm_list *, Half, const char *, const char *);
+void	Dbg32_ver_need_title(Lm_list *, const char *);
+void	Dbg64_ver_need_title(Lm_list *, const char *);
+
+const char *Elf_demangle_name(const char *);
+
+void Elf_syminfo_entry(Lm_list *, Word, Syminfo *, const char *, const char *);
+void Elf_syminfo_title(Lm_list *);
+void Elf_ver_def_title(Lm_list *);
+void Elf_ver_need_title(Lm_list *);
+void Elf_ver_line_1(Lm_list *, const char *, const char *, const char *,
+    const char *);
+void Elf_ver_line_2(Lm_list *, const char *, const char *);
+void Elf_ver_line_3(Lm_list *, const char *, const char *, const char *);
+void Elf_ver_line_4(Lm_list *, const char *);
+void Elf_ver_line_5(Lm_list *, const char *, const char *);
+
+void Elf64_cap_entry(Lm_list *, Elf64_Cap *, int ndx, Elf64_Half);
+void Elf32_cap_entry(Lm_list *, Elf32_Cap *, int ndx, Elf32_Half);
+void Elf64_cap_title(Lm_list *);
+void Elf32_cap_title(Lm_list *);
+
+void Elf64_dyn_entry(Lm_list *, Elf64_Dyn *, int, const char *, Elf64_Half);
+void Elf32_dyn_entry(Lm_list *, Elf32_Dyn *, int, const char *, Elf32_Half);
+void Elf64_dyn_title(Lm_list *);
+void Elf32_dyn_title(Lm_list *);
+
+void Elf64_ehdr(Lm_list *, Elf64_Ehdr *, Elf64_Shdr *);
+void Elf32_ehdr(Lm_list *, Elf32_Ehdr *, Elf32_Shdr *);
+
+void Elf64_got_entry(Lm_list *, Elf64_Sword, Elf64_Addr, Elf64_Xword,
+    Elf64_Half, Elf64_Word, void *, const char *);
+void Elf32_got_entry(Lm_list *, Elf32_Sword, Elf32_Addr, Elf32_Word,
+    Elf32_Half, Elf32_Word, void *, const char *);
+void Elf64_got_title(Lm_list *);
+void Elf32_got_title(Lm_list *);
+
+void Elf64_phdr(Lm_list *, Elf64_Half, Elf64_Phdr *);
+void Elf32_phdr(Lm_list *, Elf32_Half, Elf32_Phdr *);
+
+void Elf64_reloc_apply_reg(Lm_list *, int, Elf64_Half, Elf64_Xword,
+    Elf64_Xword);
+void Elf32_reloc_apply_reg(Lm_list *, int, Elf32_Half, Elf32_Word,
+    Elf32_Word);
+void Elf64_reloc_apply_val(Lm_list *, int, Elf64_Xword, Elf64_Xword);
+void Elf32_reloc_apply_val(Lm_list *, int, Elf32_Word, Elf32_Word);
+void Elf64_reloc_entry_1(Lm_list *, int, const char *, Elf64_Half, Word, void *,
+    const char *, const char *, const char *);
+void Elf32_reloc_entry_1(Lm_list *, int, const char *, Elf32_Half, Word, void *,
+    const char *, const char *, const char *);
+void Elf64_reloc_entry_2(Lm_list *, int, const char *, Word, const char *,
+    Elf64_Addr, Elf64_Sxword, const char *, const char *, const char *);
+void Elf32_reloc_entry_2(Lm_list *, int, const char *, Word, const char *,
+    Elf32_Addr, Elf32_Sword, const char *, const char *, const char *);
+void Elf64_reloc_title(Lm_list *, int, Word);
+void Elf32_reloc_title(Lm_list *, int, Word);
+
+void Elf64_shdr(Lm_list *, Elf64_Half, Elf64_Shdr *);
+void Elf32_shdr(Lm_list *, Elf32_Half, Elf32_Shdr *);
+
+void Elf64_syms_table_entry(Lm_list *, int, const char *, Elf64_Half,
+    Elf64_Sym *, Elf64_Word, const char *, const char *);
+void Elf32_syms_table_entry(Lm_list *, int, const char *, Elf32_Half,
+    Elf32_Sym *, Elf32_Word, const char *, const char *);
+void Elf64_syms_table_title(Lm_list *, int);
+void Elf32_syms_table_title(Lm_list *, int);
--- a/usr/src/cmd/sgs/liblddbg/common/map.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/map.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -30,14 +30,38 @@
 #include	"libld.h"
 
 static const char
-	*_Dbg_decl =	NULL;
+	*Dbg_decl =	NULL;
 
 void
-Dbg_map_version(const char *version, const char *name, int scope)
+Dbg_map_set_atsign(Boolean new)
+{
+	if (DBG_NOTCLASS(DBG_C_MAP))
+		return;
+
+	if (new)
+		Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_4);
+	else
+		Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_5);
+}
+
+void
+Dbg_map_set_equal(Boolean new)
+{
+	if (DBG_NOTCLASS(DBG_C_MAP))
+		return;
+
+	if (new)
+		Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_1);
+	else
+		Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_2);
+}
+
+void
+Dbg_map_version(Lm_list *lml, const char *version, const char *name, int scope)
 {
 	const char	*str, *scp;
 
-	if (DBG_NOTCLASS(DBG_MAP | DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_SYMBOLS))
 		return;
 
 	str = MSG_INTL(MSG_MAP_SYM_SCOPE);
@@ -47,65 +71,70 @@
 		scp = MSG_ORIG(MSG_SYM_LOCAL);
 
 	if (version)
-		dbg_print(MSG_INTL(MSG_MAP_SYM_VER_1), str, version,
-		    _Dbg_sym_dem(name), scp);
+		dbg_print(lml, MSG_INTL(MSG_MAP_SYM_VER_1), str, version,
+		    Dbg_demangle_name(name), scp);
 	else
-		dbg_print(MSG_INTL(MSG_MAP_SYM_VER_2), str,
-		    _Dbg_sym_dem(name), scp);
+		dbg_print(lml, MSG_INTL(MSG_MAP_SYM_VER_2), str,
+		    Dbg_demangle_name(name), scp);
 }
 
 void
-Dbg_map_size_new(const char *name)
+Dbg_map_size_new(Lm_list *lml, const char *name)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	dbg_print(MSG_INTL(MSG_MAP_SYM_SIZE), _Dbg_sym_dem(name),
+	dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), Dbg_demangle_name(name),
 	    MSG_INTL(MSG_STR_ADD));
 }
 
 void
-Dbg_map_size_old(Ehdr *ehdr, Sym_desc *sdp)
+Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	dbg_print(MSG_INTL(MSG_MAP_SYM_SIZE), sdp->sd_name,
+	dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), sdp->sd_name,
 	    MSG_INTL(MSG_STR_UP_1));
 
 	if (DBG_NOTDETAIL())
 		return;
 
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_UP_2), ehdr, sdp->sd_sym,
+	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_UP_2),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-	    conv_deftag_str(sdp->sd_ref));
+	    conv_def_tag(sdp->sd_ref));
 }
 
-/*
- * Provide for printing mapfile entered symbols when symbol debugging hasn't
- * been enabled.
- */
 void
-Dbg_map_symbol(Ehdr *ehdr, Sym_desc *sdp)
+Dbg_map_symbol(Ofl_desc *ofl, Sym_desc *sdp)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		Elf_sym_table_entry(MSG_INTL(MSG_STR_ENTERED), ehdr,
-		    sdp->sd_sym,
+	/*
+	 * Provide for printing mapfile entered symbols when symbol debugging
+	 * hasn't been enabled.
+	 */
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
+		    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
 		    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-		    conv_deftag_str(sdp->sd_ref));
+		    conv_def_tag(sdp->sd_ref));
 }
 
 void
-Dbg_map_dash(const char *name, Sdf_desc *sdf)
+Dbg_map_dash(Lm_list *lml, const char *name, Sdf_desc *sdf)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
 	if (sdf->sdf_flags & FLG_SDF_SONAME)
@@ -113,15 +142,15 @@
 	else
 		str = MSG_INTL(MSG_MAP_CNT_DEF_2);
 
-	dbg_print(str, name, sdf->sdf_soname);
+	dbg_print(lml, str, name, sdf->sdf_soname);
 }
 
 void
-Dbg_map_sort_orig(Sg_desc *sgp)
+Dbg_map_sort_orig(Lm_list *lml, Sg_desc *sgp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -131,15 +160,15 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_INTL(MSG_MAP_SORTSEG), str);
+	dbg_print(lml, MSG_INTL(MSG_MAP_SORTSEG), str);
 }
 
 void
-Dbg_map_sort_fini(Sg_desc *sgp)
+Dbg_map_sort_fini(Lm_list *lml, Sg_desc *sgp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -149,75 +178,54 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_INTL(MSG_MAP_SEGSORT), str);
+	dbg_print(lml, MSG_INTL(MSG_MAP_SEGSORT), str);
 }
 
 void
-Dbg_map_parse(const char *file)
+Dbg_map_parse(Lm_list *lml, const char *file)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_MAP_MAPFILE), file);
-}
-
-void
-Dbg_map_equal(Boolean new)
-{
-	if (DBG_NOTCLASS(DBG_MAP))
-		return;
-
-	if (new)
-		_Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_1);
-	else
-		_Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_2);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_MAP_MAPFILE), file);
 }
 
 void
-Dbg_map_ent(Boolean new, Ent_desc *enp, Ofl_desc *ofl)
+Dbg_map_ent(Lm_list *lml, Boolean new, Ent_desc *enp, Ofl_desc *ofl)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	dbg_print(MSG_INTL(MSG_MAP_MAP_DIR));
-	_Dbg_ent_entry(ofl->ofl_e_machine, enp);
+	dbg_print(lml, MSG_INTL(MSG_MAP_MAP_DIR));
+	Dbg_ent_entry(lml, ofl->ofl_dehdr->e_machine, enp);
 	if (new)
-		_Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3);
+		Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3);
 }
 
 void
-Dbg_map_atsign(Boolean new)
+Dbg_map_pipe(Lm_list *lml, Sg_desc *sgp, const char *sec_name, const Word ndx)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	if (new)
-		_Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_4);
-	else
-		_Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_5);
-}
-
-void
-Dbg_map_pipe(Sg_desc *sgp, const char *sec_name, const Word ndx)
-{
-	if (DBG_NOTCLASS(DBG_MAP))
-		return;
-
-	dbg_print(MSG_INTL(MSG_MAP_SEC_ORDER), sgp->sg_name, sec_name,
+	dbg_print(lml, MSG_INTL(MSG_MAP_SEC_ORDER), sgp->sg_name, sec_name,
 	    EC_WORD(ndx));
 }
 
 void
-Dbg_map_seg(Half mach, int ndx, Sg_desc *sgp)
+Dbg_map_seg(Ofl_desc *ofl, int ndx, Sg_desc *sgp)
 {
-	if (DBG_NOTCLASS(DBG_MAP))
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_MAP))
 		return;
 
-	if (_Dbg_decl) {
-		dbg_print(MSG_ORIG(MSG_FMT_STR), _Dbg_decl);
-		_Dbg_seg_desc_entry(mach, ndx, sgp);
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		_Dbg_decl = NULL;
+	if (Dbg_decl) {
+		dbg_print(lml, MSG_ORIG(MSG_FMT_STR), Dbg_decl);
+		Dbg_seg_desc_entry(ofl->ofl_lml,
+		    ofl->ofl_dehdr->e_machine, ndx, sgp);
+		Dbg_util_nl(lml, DBG_NL_STD);
+		Dbg_decl = NULL;
 	}
 }
--- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
 #
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -39,8 +38,11 @@
 #	Policy for Shared Library Version Names and Interface Definitions
 
 
-SUNWprivate_4.47 {
+SUNWprivate_4.50 {
 	global:
+		dbg_desc = NODIRECT;	# interposed - ld.so.1(1)
+		dbg_print = NODIRECT;	# interposed - ld(1) and ld.so.1(1)
+
 		Dbg_args_files;
 		Dbg_args_flags;
 		Dbg_audit_interface;
@@ -48,294 +50,369 @@
 		Dbg_audit_object;
 		Dbg_audit_symval;
 		Dbg_audit_version;
-		Dbg_bind_global;
-		Dbg_bind_profile;
-		Dbg_bind_weak;
-		Dbg_bind_plt_summary;
-		Dbg_cap_hw_candidate;
-		Dbg_cap_hw_filter;
-		Dbg_cap_hw_1;
-		Dbg_cap_hw_164;
-		Dbg_cap_mapfile;
-		Dbg_cap_mapfile64;
-		Dbg_cap_sec_entry;
-		Dbg_cap_sec_entry64;
-		Dbg_cap_sec_title;
-		Dbg_ent_print;
-		Dbg_file_analyze;
-		Dbg_file_aout;
-		Dbg_file_archive;
-		Dbg_file_ar_rescan;
-		Dbg_file_bind_entry;
-		Dbg_file_bindings;
-		Dbg_file_cntl;
-		Dbg_file_config_dis;
-		Dbg_file_config_obj;
-		Dbg_file_delete;
-		Dbg_file_dlclose;
-		Dbg_file_dldump;
-		Dbg_file_dlopen;
-		Dbg_file_elf;
-		Dbg_file_filtee;
-		Dbg_file_filter;
-		Dbg_file_fixname;
-		Dbg_file_generic;
-		Dbg_file_hdl_action;
-		Dbg_file_hdl_collect;
-		Dbg_file_hdl_title;
-		Dbg_file_lazyload;
-		Dbg_file_ldso;
-		Dbg_file_mode_promote;
-		Dbg_file_needed;
-		Dbg_file_nl;
-		Dbg_file_output;
-		Dbg_file_preload;
-		Dbg_file_prot;
-		Dbg_file_rejected;
-		Dbg_file_del_rescan;
-		Dbg_file_reuse;
-		Dbg_file_skip;
-		Dbg_got_display;
-		Dbg_libs_audit;
-		Dbg_libs_ignore;
-		Dbg_libs_init;
-		Dbg_libs_l;
-		Dbg_libs_path;
-		Dbg_libs_req;
-		Dbg_libs_update;
-		Dbg_libs_yp;
-		Dbg_libs_ylu;
-		Dbg_libs_find;
-		Dbg_libs_found;
-		Dbg_map_atsign;
-		Dbg_map_dash;
-		Dbg_map_ent;
-		Dbg_map_equal;
-		Dbg_map_parse;
-		Dbg_map_pipe;
-		Dbg_map_seg;
-		Dbg_map_size_new;
-		Dbg_map_size_old;
-		Dbg_map_sort_fini;
-		Dbg_map_sort_orig;
-		Dbg_map_symbol;
-		Dbg_map_version;
-		Dbg_move_adjexpandreloc;
-		Dbg_move_adjmovereloc;
-		Dbg_move_data;
-		Dbg_move_expanding;
-		Dbg_move_input1;
-		Dbg_move_outsctadj;
-		Dbg_move_outsctadj64;
-		Dbg_move_outmove;
-		Dbg_move_mventry;
-		Dbg_move_mventry64;
-		Dbg_move_mventry2;
-		Dbg_move_mventry264;
-		Dbg_move_parexpn;
-		Dbg_reloc_apply;
-		Dbg_reloc_ars_entry;
-		Dbg_reloc_copy;
-		Dbg_reloc_discard;
-		Dbg_reloc_doact;
-		Dbg_reloc_doactiverel;
-		Dbg_reloc_dooutrel;
-		Dbg_reloc_error;
-		Dbg_reloc_generate;
-		Dbg_reloc_in;
-		Dbg_reloc_ors_entry;
-		Dbg_reloc_out;
-		Dbg_reloc_proc;
-		Dbg_reloc_reg_apply;
-		Dbg_reloc_run;
-		Dbg_reloc_transition;
-		Dbg_sec_added;
-		Dbg_sec_created;
-		Dbg_sec_discarded;
-		Dbg_sec_group;
-		Dbg_sec_in;
-		Dbg_sec_order_list;
-		Dbg_sec_order_error;
-		Dbg_sec_strtab;
-		Dbg_seg_entry;
-		Dbg_seg_list;
-		Dbg_seg_os;
-		Dbg_seg_title;
+
 		Dbg_setup;
-		Dbg_statistics_ar;
-		Dbg_statistics_ld;
-		Dbg_syms_ar_checking;
-		Dbg_syms_ar_entry;
-		Dbg_syms_ar_resolve;
-		Dbg_syms_ar_title;
-		Dbg_syms_created;
-		Dbg_syms_discarded;
-		Dbg_syms_entered;
-		Dbg_syms_entry;
-		Dbg_syms_global;
-		Dbg_syms_ignore;
-		Dbg_syms_lazy_rescan;
-		Dbg_syms_new;
-		Dbg_syms_nl;
-		Dbg_syms_old;
-		Dbg_syms_process;
-		Dbg_syms_reduce;
-		Dbg_syms_reloc;
-		Dbg_syms_resolved;
-		Dbg_syms_resolving1;
-		Dbg_syms_resolving2;
-		Dbg_syms_sec_entry;
-		Dbg_syms_sec_title;
-		Dbg_syms_spec_title;
-		Dbg_syms_up_title;
-		Dbg_syms_updated;
-		Dbg_syms_dlsym;
-		Dbg_syms_lookup_aout;
-		Dbg_syms_lookup;
-		Dbg_syminfo_entry;
-		Dbg_syminfo_title;
-		Dbg_support_action;
-		Dbg_support_load;
-		Dbg_support_req;
+
+		Dbg32_bind_global;
+		Dbg64_bind_global;
+		Dbg32_bind_plt_summary;
+		Dbg64_bind_plt_summary;
+		Dbg64_bind_pltpad_from;
+		Dbg64_bind_pltpad_to;
+		Dbg32_bind_weak;
+		Dbg64_bind_weak;
+
+		Dbg32_cap_hw_candidate;
+		Dbg64_cap_hw_candidate;
+		Dbg32_cap_hw_filter;
+		Dbg64_cap_hw_filter;
+		Dbg32_cap_mapfile;
+		Dbg64_cap_mapfile;
+		Dbg32_cap_sec_entry;
+		Dbg64_cap_sec_entry;
+		Dbg32_cap_sec_title;
+		Dbg64_cap_sec_title;
+		Dbg32_cap_val_hw1;
+		Dbg64_cap_val_hw1;
+
+		Dbg32_demangle_name;
+		Dbg64_demangle_name;
+
+		Dbg32_ent_print;
+		Dbg64_ent_print;
+
+		Dbg32_file_analyze;
+		Dbg64_file_analyze;
+		Dbg32_file_aout;
+		Dbg64_file_aout;
+		Dbg32_file_ar;
+		Dbg64_file_ar;
+		Dbg32_file_ar_rescan;
+		Dbg64_file_ar_rescan;
+		Dbg32_file_bind_entry;
+		Dbg64_file_bind_entry;
+		Dbg32_file_bindings;
+		Dbg64_file_bindings;
+		Dbg32_file_cntl;
+		Dbg64_file_cntl;
+		Dbg32_file_config_dis;
+		Dbg64_file_config_dis;
+		Dbg32_file_config_obj;
+		Dbg64_file_config_obj;
+		Dbg32_file_del_rescan;
+		Dbg64_file_del_rescan;
+		Dbg32_file_delete;
+		Dbg64_file_delete;
+		Dbg32_file_dlclose;
+		Dbg64_file_dlclose;
+		Dbg32_file_dldump;
+		Dbg64_file_dldump;
+		Dbg32_file_dlopen;
+		Dbg64_file_dlopen;
+		Dbg32_file_elf;
+		Dbg64_file_elf;
+		Dbg32_file_filtee;
+		Dbg64_file_filtee;
+		Dbg32_file_filter;
+		Dbg64_file_filter;
+		Dbg32_file_fixname;
+		Dbg64_file_fixname;
+		Dbg32_file_generic;
+		Dbg64_file_generic;
+		Dbg32_file_hdl_action;
+		Dbg64_file_hdl_action;
+		Dbg32_file_hdl_collect;
+		Dbg64_file_hdl_collect;
+		Dbg32_file_hdl_title;
+		Dbg64_file_hdl_title;
+		Dbg32_file_lazyload;
+		Dbg64_file_lazyload;
+		Dbg32_file_ldso;
+		Dbg64_file_ldso;
+		Dbg32_file_mode_promote;
+		Dbg64_file_mode_promote;
+		Dbg32_file_needed;
+		Dbg64_file_needed;
+		Dbg32_file_output;
+		Dbg64_file_output;
+		Dbg32_file_preload;
+		Dbg64_file_preload;
+		Dbg32_file_prot;
+		Dbg64_file_prot;
+		Dbg32_file_rejected;
+		Dbg64_file_rejected;
+		Dbg32_file_reuse;
+		Dbg64_file_reuse;
+		Dbg32_file_skip;
+		Dbg64_file_skip;
+
+		Dbg32_got_display;
+		Dbg64_got_display;
+
+		Dbg32_libs_audit;
+		Dbg64_libs_audit;
+		Dbg32_libs_find;
+		Dbg64_libs_find;
+		Dbg32_libs_found;
+		Dbg64_libs_found;
+		Dbg32_libs_ignore;
+		Dbg64_libs_ignore;
+		Dbg32_libs_init;
+		Dbg64_libs_init;
+		Dbg32_libs_l;
+		Dbg64_libs_l;
+		Dbg32_libs_path;
+		Dbg64_libs_path;
+		Dbg32_libs_req;
+		Dbg64_libs_req;
+		Dbg32_libs_update;
+		Dbg64_libs_update;
+		Dbg32_libs_yp;
+		Dbg64_libs_yp;
+		Dbg32_libs_ylu;
+		Dbg64_libs_ylu;
+
+		Dbg32_map_dash;
+		Dbg64_map_dash;
+		Dbg32_map_ent;
+		Dbg64_map_ent;
+		Dbg32_map_parse;
+		Dbg64_map_parse;
+		Dbg32_map_pipe;
+		Dbg64_map_pipe;
+		Dbg32_map_set_atsign;
+		Dbg64_map_set_atsign;
+		Dbg32_map_seg;
+		Dbg64_map_seg;
+		Dbg32_map_set_equal;
+		Dbg64_map_set_equal;
+		Dbg32_map_size_new;
+		Dbg64_map_size_new;
+		Dbg32_map_size_old;
+		Dbg64_map_size_old;
+		Dbg32_map_sort_fini;
+		Dbg64_map_sort_fini;
+		Dbg32_map_sort_orig;
+		Dbg64_map_sort_orig;
+		Dbg32_map_symbol;
+		Dbg64_map_symbol;
+		Dbg32_map_version;
+		Dbg64_map_version;
+
+		Dbg32_move_adjexpandreloc;
+		Dbg64_move_adjexpandreloc;
+		Dbg32_move_adjmovereloc;
+		Dbg64_move_adjmovereloc;
+		Dbg32_move_data;
+		Dbg64_move_data;
+		Dbg32_move_entry1;
+		Dbg64_move_entry1;
+		Dbg32_move_entry2;
+		Dbg64_move_entry2;
+		Dbg32_move_expand;
+		Dbg64_move_expand;
+		Dbg32_move_input;
+		Dbg64_move_input;
+		Dbg32_move_outmove;
+		Dbg64_move_outmove;
+		Dbg32_move_outsctadj;
+		Dbg64_move_outsctadj;
+		Dbg32_move_parexpn;
+		Dbg64_move_parexpn;
+
+		Dbg32_reloc_apply_reg;
+		Dbg64_reloc_apply_reg;
+		Dbg32_reloc_apply_val;
+		Dbg64_reloc_apply_val;
+		Dbg32_reloc_ars_entry;
+		Dbg64_reloc_ars_entry;
+		Dbg32_reloc_copy;
+		Dbg64_reloc_copy;
+		Dbg32_reloc_discard;
+		Dbg64_reloc_discard;
+		Dbg32_reloc_doact;
+		Dbg64_reloc_doact;
+		Dbg32_reloc_doact_title;
+		Dbg64_reloc_doact_title;
+		Dbg32_reloc_dooutrel;
+		Dbg64_reloc_dooutrel;
+		Dbg32_reloc_entry;
+		Dbg64_reloc_entry;
+		Dbg32_reloc_error;
+		Dbg64_reloc_error;
+		Dbg32_reloc_generate;
+		Dbg64_reloc_generate;
+		Dbg32_reloc_in;
+		Dbg64_reloc_in;
+		Dbg32_reloc_ors_entry;
+		Dbg64_reloc_ors_entry;
+		Dbg32_reloc_out;
+		Dbg64_reloc_out;
+		Dbg32_reloc_proc;
+		Dbg64_reloc_proc;
+		Dbg32_reloc_run;
+		Dbg64_reloc_run;
+		Dbg32_reloc_transition;
+		Dbg64_reloc_transition;
+
+		Dbg32_sec_added;
+		Dbg64_sec_added;
+		Dbg32_sec_created;
+		Dbg64_sec_created;
+		Dbg32_sec_discarded;
+		Dbg64_sec_discarded;
+		Dbg32_sec_group;
+		Dbg64_sec_group;
+		Dbg32_sec_in;
+		Dbg64_sec_in;
+		Dbg32_sec_order_error;
+		Dbg64_sec_order_error;
+		Dbg32_sec_order_list;
+		Dbg64_sec_order_list;
+		Dbg32_sec_strtab;
+		Dbg64_sec_strtab;
+
+		Dbg32_seg_entry;
+		Dbg64_seg_entry;
+		Dbg32_seg_list;
+		Dbg64_seg_list;
+		Dbg32_seg_os;
+		Dbg64_seg_os;
+		Dbg32_seg_title;
+		Dbg64_seg_title;
+
+		Dbg32_statistics_ar;
+		Dbg64_statistics_ar;
+		Dbg32_statistics_ld;
+		Dbg64_statistics_ld;
+
+		Dbg32_support_action;
+		Dbg64_support_action;
+		Dbg32_support_load;
+		Dbg64_support_load;
+		Dbg32_support_req;
+		Dbg64_support_req;
+
+		Dbg32_syminfo_entry;
+		Dbg64_syminfo_entry;
+		Dbg32_syminfo_title;
+		Dbg64_syminfo_title;
+
+		Dbg32_syms_ar_checking;
+		Dbg64_syms_ar_checking;
+		Dbg32_syms_ar_entry;
+		Dbg64_syms_ar_entry;
+		Dbg32_syms_ar_resolve;
+		Dbg64_syms_ar_resolve;
+		Dbg32_syms_ar_title;
+		Dbg64_syms_ar_title;
+		Dbg32_syms_created;
+		Dbg64_syms_created;
+		Dbg32_syms_discarded;
+		Dbg64_syms_discarded;
+		Dbg32_syms_dlsym;
+		Dbg64_syms_dlsym;
+		Dbg32_syms_entered;
+		Dbg64_syms_entered;
+		Dbg32_syms_entry;
+		Dbg64_syms_entry;
+		Dbg32_syms_global;
+		Dbg64_syms_global;
+		Dbg32_syms_ignore;
+		Dbg64_syms_ignore;
+		Dbg32_syms_lazy_rescan;
+		Dbg64_syms_lazy_rescan;
+		Dbg32_syms_lookup;
+		Dbg64_syms_lookup;
+		Dbg32_syms_lookup_aout;
+		Dbg32_syms_new;
+		Dbg64_syms_new;
+		Dbg32_syms_old;
+		Dbg64_syms_old;
+		Dbg32_syms_process;
+		Dbg64_syms_process;
+		Dbg32_syms_reduce;
+		Dbg64_syms_reduce;
+		Dbg32_syms_reloc;
+		Dbg64_syms_reloc;
+		Dbg32_syms_resolved;
+		Dbg64_syms_resolved;
+		Dbg32_syms_resolving;
+		Dbg64_syms_resolving;
+		Dbg32_syms_sec_entry;
+		Dbg64_syms_sec_entry;
+		Dbg32_syms_sec_title;
+		Dbg64_syms_sec_title;
+		Dbg32_syms_spec_title;
+		Dbg64_syms_spec_title;
+		Dbg32_syms_updated;
+		Dbg64_syms_updated;
+		Dbg32_syms_up_title;
+		Dbg64_syms_up_title;
+
 		Dbg_tls_modactivity;
 		Dbg_tls_static_block;
-		Dbg_unused_file;
-		Dbg_unused_rtldinfo;
-		Dbg_unused_sec;
-		Dbg_unused_unref;
-		Dbg_util_broadcast;
-		Dbg_util_call_array;
-		Dbg_util_call_fini;
-		Dbg_util_call_init;
-		Dbg_util_call_main;
-		Dbg_util_collect;
-		Dbg_util_dbnotify;
-		Dbg_util_edge_in;
-		Dbg_util_edge_out;
-		Dbg_util_intoolate;
-		Dbg_util_nl;
-		Dbg_util_no_init;
-		Dbg_util_scc_entry;
-		Dbg_util_scc_title;
-		Dbg_util_str;
-		Dbg_util_wait;
-		Dbg_ver_avail_entry;
-		Dbg_ver_avail_entry64;
-		Dbg_ver_avail_title;
-		Dbg_ver_def_title;
-		Dbg_ver_desc_entry;
-		Dbg_ver_desc_entry64;
-		Dbg_ver_need_title;
-		Dbg_ver_need_entry;
-		Dbg_ver_nointerface;
-		Dbg_ver_symbol;
-		Dbg_audit_interface64;
-		Dbg_audit_lib64;
-		Dbg_audit_object64;
-		Dbg_audit_symval64;
-		Dbg_audit_version64;
-		Dbg_file_analyze64;
-		Dbg_file_aout64;
-		Dbg_file_archive64;
-		Dbg_file_bind_entry64;
-		Dbg_file_bindings64;
-		Dbg_file_config_dis64;
-		Dbg_file_config_obj64;
-		Dbg_file_delete64;
-		Dbg_file_dlclose64;
-		Dbg_file_dldump64;
-		Dbg_file_dlopen64;
-		Dbg_file_elf64;
-		Dbg_file_filtee64;
-		Dbg_file_filter64;
-		Dbg_file_fixname64;
-		Dbg_file_generic64;
-		Dbg_file_hdl_action64;
-		Dbg_file_hdl_collect64;
-		Dbg_file_hdl_title64;
-		Dbg_file_lazyload64;
-		Dbg_file_ldso64;
-		Dbg_file_needed64;
-		Dbg_file_nl64;
-		Dbg_file_output64;
-		Dbg_file_preload64;
-		Dbg_file_prot64;
-		Dbg_file_reuse64;
-		Dbg_file_skip64;
-		Dbg_got_display64;
-		Dbg_map_atsign64;
-		Dbg_map_dash64;
-		Dbg_map_ent64;
-		Dbg_map_equal64;
-		Dbg_map_parse64;
-		Dbg_map_pipe64;
-		Dbg_map_seg64;
-		Dbg_map_size_new64;
-		Dbg_map_size_old64;
-		Dbg_map_sort_fini64;
-		Dbg_map_sort_orig64;
-		Dbg_map_symbol64;
-		Dbg_map_version64;
-		Dbg_pltpad_bindto64;
-		Dbg_pltpad_boundto64;
-		Dbg_reloc_ars_entry64;
-		Dbg_reloc_discard64;
-		Dbg_reloc_doact64;
-		Dbg_reloc_dooutrel64;
-		Dbg_reloc_error64;
-		Dbg_reloc_generate64;
-		Dbg_reloc_in64;
-		Dbg_reloc_ors_entry64;
-		Dbg_reloc_out64;
-		Dbg_reloc_proc64;
-		Dbg_reloc_reg_apply64;
-		Dbg_reloc_transition64;
-		Dbg_sec_added64;
-		Dbg_sec_created64;
-		Dbg_sec_discarded64;
-		Dbg_sec_group64;
-		Dbg_sec_in64;
-		Dbg_sec_order_list64;
-		Dbg_sec_order_error64;
-		Dbg_sec_strtab64;
-		Dbg_seg_entry64;
-		Dbg_seg_list64;
-		Dbg_seg_os64;
-		Dbg_seg_title64;
-		Dbg_statistics_ar64;
-		Dbg_statistics_ld64;
-		Dbg_syminfo_entry64;
-		Dbg_syminfo_title64;
-		Dbg_syms_ar_entry64;
-		Dbg_syms_ar_resolve64;
-		Dbg_syms_ar_checking64;
-		Dbg_syms_created64;
-		Dbg_syms_discarded64;
-		Dbg_syms_entered64;
-		Dbg_syms_entry64;
-		Dbg_syms_global64;
-		Dbg_syms_ignore64;
-		Dbg_syms_new64;
-		Dbg_syms_nl64;
-		Dbg_syms_old64;
-		Dbg_syms_process64;
-		Dbg_syms_reduce64;
-		Dbg_syms_reloc64;
-		Dbg_syms_resolved64;
-		Dbg_syms_resolving164;
-		Dbg_syms_resolving264;
-		Dbg_syms_sec_entry64;
-		Dbg_syms_sec_title64;
-		Dbg_syms_spec_title64;
-		Dbg_syms_up_title64;
-		Dbg_syms_updated64;
-		Dbg_syms_dlsym64;
-		Dbg_syms_lookup_aout64;
-		Dbg_syms_lookup64;
-		Dbg_tls_modactivity64;
-		Dbg_tls_static_block64;
-		Dbg_unused_sec64;
-} SUNWprivate_3.10;
+
+		Dbg32_util_broadcast;
+		Dbg64_util_broadcast;
+		Dbg32_util_call_array;
+		Dbg64_util_call_array;
+		Dbg32_util_call_fini;
+		Dbg64_util_call_fini;
+		Dbg32_util_call_init;
+		Dbg64_util_call_init;
+		Dbg32_util_call_main;
+		Dbg64_util_call_main;
+		Dbg32_util_collect;
+		Dbg64_util_collect;
+		Dbg32_util_dbnotify;
+		Dbg64_util_dbnotify;
+		Dbg32_util_edge_in;
+		Dbg64_util_edge_in;
+		Dbg32_util_edge_out;
+		Dbg64_util_edge_out;
+		Dbg32_util_intoolate;
+		Dbg64_util_intoolate;
+		Dbg32_util_nl;
+		Dbg64_util_nl;
+		Dbg32_util_no_init;
+		Dbg64_util_no_init;
+		Dbg32_util_scc_entry;
+		Dbg64_util_scc_entry;
+		Dbg32_util_scc_title;
+		Dbg64_util_scc_title;
+		Dbg32_util_str;
+		Dbg64_util_str;
+		Dbg32_util_wait;
+		Dbg64_util_wait;
+
+		Dbg32_unused_file;
+		Dbg64_unused_file;
+		Dbg32_unused_rtldinfo;
+		Dbg64_unused_rtldinfo;
+		Dbg32_unused_sec;
+		Dbg64_unused_sec;
+		Dbg32_unused_unref;
+		Dbg64_unused_unref;
+
+		Dbg32_ver_avail_entry;
+		Dbg64_ver_avail_entry;
+		Dbg32_ver_avail_title;
+		Dbg64_ver_avail_title;
+		Dbg32_ver_def_title;
+		Dbg64_ver_def_title;
+		Dbg32_ver_desc_entry;
+		Dbg64_ver_desc_entry;
+		Dbg32_ver_need_entry;
+		Dbg64_ver_need_entry;
+		Dbg32_ver_need_title;
+		Dbg64_ver_need_title;
+		Dbg32_ver_nointerface;
+		Dbg64_ver_nointerface;
+		Dbg32_ver_symbol;
+		Dbg64_ver_symbol;
+
+} SUNWprivate_3.20;
 
 
 # The following interfaces are used by various parts of the link-editors and
@@ -344,30 +421,67 @@
 # this interface, and thus by separating in from the ever changing Dbg_*
 # interfaces we can provide a stable verioning environment for this utility.
 
-SUNWprivate_3.10 {
+SUNWprivate_3.20 {
 	global:
-		Dbg_set;
-		Gelf_cap_print;
-		Gelf_cap_title;
-		Gelf_dyn_print;
-		Gelf_dyn_title;
-		Gelf_elf_data_title;
-		Gelf_elf_header;
-		Gelf_got_entry;
-		Gelf_got_title;
-		Gelf_phdr_entry;
-		Gelf_reloc_entry;
-		Gelf_shdr_entry;
-		Gelf_sym_dem;
-		Gelf_sym_table_entry;
-		Gelf_syminfo_entry;
-		Gelf_syminfo_title;
-		Gelf_sym_table_title;
-		Gelf_ver_def_title;
-		Gelf_ver_need_title;
-		Gelf_ver_line_1;
-		Gelf_ver_line_2;
-		Gelf_ver_line_3;
+		Elf_syminfo_entry;
+		Elf_syminfo_title;
+
+		Elf32_cap_entry;
+		Elf64_cap_entry;
+		Elf32_cap_title;
+		Elf64_cap_title;
+
+		Elf32_demangle_name;
+		Elf64_demangle_name;
+		Elf32_dyn_entry;
+		Elf64_dyn_entry;
+		Elf32_dyn_title;
+		Elf64_dyn_title;
+
+		Elf32_ehdr;
+		Elf64_ehdr;
+
+		Elf32_got_entry;
+		Elf64_got_entry;
+		Elf32_got_title;
+		Elf64_got_title;
+
+		Elf32_phdr;
+		Elf64_phdr;
+
+		Elf32_reloc_apply_reg;
+		Elf64_reloc_apply_reg;
+		Elf32_reloc_apply_val;
+		Elf64_reloc_apply_val;
+		Elf32_reloc_entry_1;
+		Elf64_reloc_entry_1;
+		Elf32_reloc_entry_2;
+		Elf64_reloc_entry_2;
+		Elf32_reloc_title;
+		Elf64_reloc_title;
+
+		Elf32_shdr;
+		Elf64_shdr;
+
+		Elf32_syms_table_title;
+		Elf64_syms_table_title;
+		Elf32_syms_table_entry;
+		Elf64_syms_table_entry;
+
+		Elf32_ver_def_title;
+		Elf64_ver_def_title;
+		Elf32_ver_line_1;
+		Elf64_ver_line_1;
+		Elf32_ver_line_2;
+		Elf64_ver_line_2;
+		Elf32_ver_line_3;
+		Elf64_ver_line_3;
+		Elf32_ver_line_4;
+		Elf64_ver_line_4;
+		Elf32_ver_line_5;
+		Elf64_ver_line_5;
+		Elf32_ver_need_title;
+		Elf64_ver_need_title;
 
 	local:
 		*;
@@ -383,16 +497,14 @@
 # we're capable of doing, rather than an admission that its really worth it :-).
 
 {
-		dbg_print =	FUNCTION parent;
-		free =		FUNCTION parent;
-		malloc =	FUNCTION parent;
-
 		_dgettext =	FUNCTION extern;
 		_close =	FUNCTION extern;
 		_open =		FUNCTION extern;
 		_write =	FUNCTION extern;
 		dlopen =	FUNCTION extern;
 		dlsym =		FUNCTION extern;
+		free =		FUNCTION parent;
+		malloc =	FUNCTION parent;
 		memcpy =	FUNCTION extern;
 		qsort =		FUNCTION extern;
 		snprintf =	FUNCTION extern;
--- a/usr/src/cmd/sgs/liblddbg/common/move.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/move.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -29,149 +29,142 @@
 #include	"_debug.h"
 #include	"libld.h"
 
-/*
- * Debug functions
- */
+void
+Dbg_move_data(Rt_map *lmp)
+{
+	Lm_list	*lml = LIST(lmp);
 
-#if	!defined(_ELF64)
-void
-Dbg_move_adjexpandreloc(ulong_t offset, const char *name)
-{
-	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_MOVE))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_MV_ADJEXPAND1), _Dbg_sym_dem(name),
+	dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp));
+	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2));
+}
+
+void
+Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name),
 	    EC_XWORD(offset));
 }
 
 void
-Dbg_move_adjmovereloc(ulong_t offset1, ulong_t offset2, const char *name)
+Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2,
+    const char *name)
 {
-	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_MV_ADJMOVE1), _Dbg_sym_dem(name),
+	dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name),
 	    EC_XWORD(offset1), EC_XWORD(offset2));
 }
-#endif	/* !defined(_ELF64) */
 
 void
-Dbg_move_outsctadj(Sym_desc * sdp)
+Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp)
 {
-	if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	dbg_print(MSG_INTL(MSG_MV_OUTSCTADJ1), _Dbg_sym_dem(sdp->sd_name));
-}
-
-#if	!defined(_ELF64)
-void
-Dbg_move_parexpn(const char *name, const char *reason)
-{
-	if (DBG_NOTCLASS(DBG_MOVE))
+	if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_MV_EXPAND0), name, reason);
-	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
+	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ),
+	    Dbg_demangle_name(sdp->sd_name));
 }
 
 void
-Dbg_move_outmove(const unsigned char *name)
+Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason)
 {
-	if (DBG_NOTCLASS(DBG_MOVE))
+	if (DBG_NOTCLASS(DBG_C_MOVE))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_MV_OUTMOVE0), name);
-	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
 }
 
 void
-Dbg_move_expanding(Move *mv, Addr addr)
+Dbg_move_outmove(Lm_list *lml, const char *name)
 {
-	if (DBG_NOTCLASS(DBG_MOVE))
+	if (DBG_NOTCLASS(DBG_C_MOVE))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_MV_EXPAND1), EC_ADDR(addr),
-	    EC_LWORD(mv->m_value));
-}
-
-
-void
-Dbg_move_input1(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_MOVE))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_MOVE_INPUT1), name);
-	dbg_print(MSG_INTL(MSG_MOVE_TITLE1));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
 }
 
 void
-Dbg_move_data(const char *name)
+Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr)
 {
-	if (DBG_NOTCLASS(DBG_MOVE))
+	if (DBG_NOTCLASS(DBG_C_MOVE))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_MV_MOVEDATA), _Dbg_sym_dem(name));
-	dbg_print(MSG_INTL(MSG_MOVE_TITLE2));
+	dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr),
+	    EC_LWORD(mv->m_value));
 }
-#endif	/* !defined(_ELF64) */
 
 void
-Dbg_move_mventry(int which, Move *mv, Sym_desc *s)
+Dbg_move_input(Lm_list *lml, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_MOVE))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1));
+}
+
+void
+Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s)
 {
 	const char *str;
 
-	if (DBG_NOTCLASS(DBG_MOVE))
+	if (DBG_NOTCLASS(DBG_C_MOVE))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
 	if (which)
-		str = MSG_INTL(MSG_MOVE_MVENTRY2);
+		str = MSG_INTL(MSG_MOVE_ENTRY1IN);
 	else
-		str = MSG_INTL(MSG_MOVE_MVENTRY1);
+		str = MSG_INTL(MSG_MOVE_ENTRY1OUT);
 
-	dbg_print(str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
-		mv->m_repeat, mv->m_stride, s->sd_name);
+	dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value),
+	    mv->m_repeat, mv->m_stride, s->sd_name);
 }
 
 void
-Dbg_move_mventry2(Move *mv, Word st_name, char *name)
+Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name)
 {
 	const char *sname;
 
+	if (DBG_NOTCLASS(DBG_C_MOVE))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
 	if (st_name)
-		sname = (const char *)name;
+		sname = name;
 	else
 		sname = MSG_INTL(MSG_STR_UNKNOWN);
 
-	if (DBG_NOTCLASS(DBG_MOVE))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	dbg_print(MSG_INTL(MSG_MOVE_MVENTRY1),
-		EC_XWORD(mv->m_poffset),
-		EC_LWORD(mv->m_value),
-		mv->m_repeat,
-		mv->m_stride,
-		sname);
+	dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRY2), EC_XWORD(mv->m_poffset),
+	    EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/phdr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/phdr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,46 +18,27 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1998 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"msg.h"
-#include	"_debug.h"
-
-
-#if !(defined(_ELF64) && defined(lint))
-
+#include	<sgs.h>
+#include	<_debug.h>
+#include	<conv.h>
+#include	<msg.h>
 
-/*
- * Print out a single `program header' entry.
- */
 void
-Elf_phdr_entry(Half mach, Elf32_Phdr * phdr)
+Elf_phdr(Lm_list *lml, Half mach, Phdr *phdr)
 {
-	dbg_print(MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr),
-	    conv_phdrflg_str(phdr->p_flags));
-	dbg_print(MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr),
-	    conv_phdrtyp_str(mach, phdr->p_type));
-	dbg_print(MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz),
+	dbg_print(lml, MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr),
+	    conv_phdr_flags(phdr->p_flags));
+	dbg_print(lml, MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr),
+	    conv_phdr_type(mach, phdr->p_type));
+	dbg_print(lml, MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz),
 	    EC_XWORD(phdr->p_memsz));
-	dbg_print(MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset),
+	dbg_print(lml, MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset),
 	    EC_XWORD(phdr->p_align));
 }
-
-void
-Gelf_phdr_entry(Half mach, GElf_Phdr * phdr)
-{
-	dbg_print(MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr),
-	    conv_phdrflg_str(phdr->p_flags));
-	dbg_print(MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr),
-	    conv_phdrtyp_str(mach, phdr->p_type));
-	dbg_print(MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz),
-	    EC_XWORD(phdr->p_memsz));
-	dbg_print(MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset),
-	    EC_XWORD(phdr->p_align));
-}
-
-#endif /* !(defined(_ELF64) && defined(lint)) */
--- a/usr/src/cmd/sgs/liblddbg/common/relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,43 +18,147 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"msg.h"
+#include	<sys/elf_SPARC.h>
+#include	<debug.h>
+#include	<libld.h>
+#include	<conv.h>
 #include	"_debug.h"
-#include	"libld.h"
-#include	<sys/elf_SPARC.h>
+#include	"msg.h"
 
+void
+Dbg_reloc_apply_reg(Lm_list *lml, int caller, Half mach, Xword off, Xword value)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
 
-void _gelf_reloc_entry(const char *prestr, GElf_Half mach,
-    GElf_Word type, void *reloc,
-    const char *sec, const char *name, const char *com);
+	/*
+	 * Print the actual relocation being applied to the specified output
+	 * section, the offset represents the actual relocation address, and the
+	 * value is the new data being written to that address.
+	 */
+	Elf_reloc_apply_reg(lml, caller, mach, off, value);
+}
 
 void
-Dbg_reloc_generate(Os_desc * osp, Word relshtype)
+Dbg_reloc_apply_val(Lm_list *lml, int caller, Xword off, Xword value)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_REL_GENERATE), osp->os_name);
 	if (DBG_NOTDETAIL())
 		return;
-	if (relshtype == SHT_RELA)
-		dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2));
-	else
-		dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2));
+
+	/*
+	 * Print the actual relocation being applied to the specified output
+	 * section, the offset represents the actual relocation address, and the
+	 * value is the new data being written to that address.
+	 */
+	Elf_reloc_apply_val(lml, caller, off, value);
+}
+
+void
+Dbg_reloc_error(Lm_list *lml, int caller, Half mach, Word type, void *reloc,
+    const char *sname)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_reloc_entry_1(lml, caller, MSG_INTL(MSG_STR_IN), mach, type, reloc,
+	    NULL, sname, MSG_INTL(MSG_REL_BADROFFSET));
 }
 
 void
-Dbg_reloc_proc(Os_desc *osp, Is_desc *isp, Is_desc *risp)
+Dbg_reloc_run(Rt_map *lmp, uint_t rtype, int info, int dtype)
+{
+	Lm_list		*lml = LIST(lmp);
+	const char	*str, *name = NAME(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+
+	if (dtype == DBG_REL_FINISH) {
+		if (info)
+			str = MSG_ORIG(MSG_STR_EMPTY);
+		else
+			str = MSG_INTL(MSG_REL_FAIL);
+	} else {
+		if (info)
+			str = MSG_INTL(MSG_REL_PLT);
+		else
+			str = MSG_ORIG(MSG_STR_EMPTY);
+	}
+
+	if (dtype == DBG_REL_START) {
+		Dbg_util_nl(lml, DBG_NL_STD);
+		dbg_print(lml, MSG_INTL(MSG_REL_START), name, str);
+
+		if (DBG_NOTDETAIL())
+			return;
+
+		Elf_reloc_title(lml, ELF_DBG_RTLD, rtype);
+
+	} else {
+		if (dtype == DBG_REL_NONE) {
+			dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
+			dbg_print(lml, MSG_INTL(MSG_REL_NONE), name, str);
+		} else
+			dbg_print(lml, MSG_INTL(MSG_REL_FINISH), name,
+			    str);
+
+		Dbg_util_nl(lml, DBG_NL_STD);
+	}
+}
+
+void
+Dbg_reloc_copy(Rt_map *dlmp, Rt_map *nlmp, const char *name, int zero)
+{
+	const char	*str;
+
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	if (zero)
+		str = MSG_INTL(MSG_STR_COPYZERO);
+	else
+		str = MSG_ORIG(MSG_STR_EMPTY);
+
+	dbg_print(LIST(dlmp), MSG_INTL(MSG_REL_COPY), NAME(dlmp), NAME(nlmp),
+	    name, str);
+}
+
+void
+Dbg_reloc_generate(Lm_list *lml, Os_desc *osp, Word type)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_REL_GENERATE), osp->os_name);
+
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_reloc_title(lml, ELF_DBG_LD, type);
+}
+
+void
+Dbg_reloc_proc(Lm_list *lml, Os_desc *osp, Is_desc *isp, Is_desc *risp)
 {
 	const char	*str1, *str2;
 
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 
 	if (osp && osp->os_name)
@@ -70,436 +173,420 @@
 	else
 		str2 = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_REL_COLLECT), str1, str2);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_REL_COLLECT), str1, str2);
+
 	if (DBG_NOTDETAIL())
 		return;
 
-	/*
-	 * Determine the relocation titles from the sections type.
-	 */
-	if (risp->is_shdr->sh_type == SHT_RELA)
-		dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2));
-	else
-		dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2));
+	Elf_reloc_title(lml, ELF_DBG_LD, risp->is_shdr->sh_type);
 }
 
-#if	!defined(_ELF64)
 void
-Dbg_reloc_doactiverel()
+Dbg_reloc_doact_title(Lm_list *lml)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_REL_ACTIVE));
-	dbg_print(MSG_ORIG(MSG_REL_TITLE_1));
-}
-#endif /* !defined(_ELF64) */
-
-void
-Dbg_reloc_doact(Half mach, Word rtype, Xword off, Xword value, const char *sym,
-    Os_desc *osp)
-{
-	const char	*sec;
-	const char	*msg;
-
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	if (DBG_NOTLONG())
-		msg = MSG_ORIG(MSG_REL_ARGS_6);
-	else
-		msg = MSG_ORIG(MSG_REL_L_ARGS_6);
-
-	if (osp) {
-		sec = osp->os_name;
-		off += osp->os_shdr->sh_offset;
-	} else
-		sec = MSG_ORIG(MSG_STR_EMPTY);
-
-	dbg_print(msg, MSG_ORIG(MSG_STR_EMPTY),
-	    conv_reloc_type_str(mach, rtype), EC_OFF(off), EC_XWORD(value),
-	    sec, _Dbg_sym_dem(sym), MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_REL_ACTIVE));
+	Elf_reloc_title(lml, ELF_DBG_LD, 0);
 }
 
 void
-Dbg_reloc_dooutrel(GElf_Word type)
+Dbg_reloc_doact(Lm_list *lml, int caller, Half mach, Word type, Word rtype,
+    Xword off, Xword value, const char *symname, Os_desc *osp)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	const char	*secname;
+
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_REL_CREATING));
+	if (osp) {
+		secname = osp->os_name;
+		off += osp->os_shdr->sh_offset;
+	} else
+		secname = MSG_ORIG(MSG_STR_EMPTY);
 
-	if (type == SHT_RELA)
-		dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2));
-	else
-		dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2));
+	Elf_reloc_entry_2(lml, caller, MSG_ORIG(MSG_STR_EMPTY), type,
+	    conv_reloc_type(mach, rtype), off, value, secname, symname,
+	    MSG_ORIG(MSG_STR_EMPTY));
 }
 
 void
-Dbg_reloc_discard(Half mach, Rel_desc *rsp)
+Dbg_reloc_dooutrel(Lm_list *lml, Word type)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_REL_CREATING));
+	Elf_reloc_title(lml, ELF_DBG_LD, type);
+}
+
+void
+Dbg_reloc_discard(Lm_list *lml, Half mach, Rel_desc *rsp)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_REL_DISCARDED), rsp->rel_isdesc->is_basename,
-		rsp->rel_isdesc->is_file->ifl_name,
-		conv_reloc_type_str(mach, rsp->rel_rtype),
-		EC_OFF(rsp->rel_roffset));
-}
-
-void
-Dbg_reloc_transition(Half mach, Word oldrtype, Word newrtype, Xword off,
-	const char *sym)
-{
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	dbg_print(MSG_INTL(MSG_REL_TRANS), EC_OFF(off),
-		conv_reloc_type_str(mach, oldrtype) + M_R_STR_LEN,
-		conv_reloc_type_str(mach, newrtype) + M_R_STR_LEN,
-		sym);
+	dbg_print(lml, MSG_INTL(MSG_REL_DISCARDED),
+	    rsp->rel_isdesc->is_basename, rsp->rel_isdesc->is_file->ifl_name,
+	    conv_reloc_type(mach, rsp->rel_rtype), EC_OFF(rsp->rel_roffset));
 }
 
 void
-Dbg_reloc_reg_apply(unsigned long long off, unsigned long long value)
+Dbg_reloc_transition(Lm_list *lml, Half mach, Word oldrtype, Word newrtype,
+    Xword off, const char *sym)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
-	dbg_print(MSG_ORIG(MSG_REL_REGSYM),
-#if	defined(_ELF64)
-		conv_sym_value_str(EM_SPARCV9, STT_SPARC_REGISTER, off),
-#else
-		conv_sym_value_str(EM_SPARC, STT_SPARC_REGISTER, off),
-#endif
-		value);
+
+	dbg_print(lml, MSG_INTL(MSG_REL_TRANS), EC_OFF(off),
+	    conv_reloc_type(mach, oldrtype) + M_R_STR_LEN,
+	    conv_reloc_type(mach, newrtype) + M_R_STR_LEN, sym);
 }
 
-#if	!defined(_ELF64)
 void
-Dbg_reloc_apply(unsigned long long off, unsigned long long value)
+Dbg_reloc_out(Ofl_desc *ofl, int caller, Word type, void *reloc,
+    const char *secname, const char *symname)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	/*
-	 * Print the actual relocation being applied to the specified output
-	 * section, the offset represents the actual relocation address, and the
-	 * value is the new data being written to that address).
-	 */
-	dbg_print(MSG_ORIG(MSG_REL_ARGS_2), off, value);
+	Elf_reloc_entry_1(ofl->ofl_lml, caller, MSG_ORIG(MSG_STR_EMPTY),
+	    ofl->ofl_dehdr->e_machine, type, reloc, secname, symname,
+	    MSG_ORIG(MSG_STR_EMPTY));
 }
-#endif	/* !defined(_ELF64) */
 
 void
-Dbg_reloc_out(Half mach, Word type, void *rel, const char *name,
-	const char *relsectname)
+Dbg_reloc_in(Lm_list *lml, int caller, Half mach, Word type, void *reloc,
+    const char *secname, const char *symname)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	_gelf_reloc_entry(MSG_ORIG(MSG_STR_EMPTY), mach, type, rel,
-	    relsectname, _Dbg_sym_dem(name), MSG_ORIG(MSG_STR_EMPTY));
+	Elf_reloc_entry_1(lml, caller, MSG_INTL(MSG_STR_IN), mach, type, reloc,
+	    secname, symname, MSG_ORIG(MSG_STR_EMPTY));
 }
 
+/*
+ * Print a output relocation structure (Rel_desc).
+ */
 void
-Dbg_reloc_in(Half mach, Word type, void *rel, const char *name,
-    const char *iname)
+Dbg_reloc_ors_entry(Lm_list *lml, int caller, Word type, Half mach,
+    Rel_desc *orsp)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
+	const char	*secname, *symname;
 
-	_gelf_reloc_entry(MSG_INTL(MSG_STR_IN), mach, type, rel,
-	    (iname ? iname : MSG_ORIG(MSG_STR_EMPTY)),
-	    (name ? _Dbg_sym_dem(name) : MSG_ORIG(MSG_STR_EMPTY)),
-	    MSG_ORIG(MSG_STR_EMPTY));
-}
-
-void
-Dbg_reloc_error(Half mach, Word type, void *rel, const char *name,
-    const char *com)
-{
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	_gelf_reloc_entry(MSG_INTL(MSG_STR_ERROR), mach, type, rel,
-	    MSG_ORIG(MSG_STR_EMPTY),
-	    (name ? _Dbg_sym_dem(name) : MSG_ORIG(MSG_STR_EMPTY)),
-	    (com ? com : MSG_ORIG(MSG_STR_EMPTY)));
-}
-
-/*
- * Print a output relocation structure(Rel_desc).
- */
-void
-Dbg_reloc_ors_entry(Half mach, Rel_desc *orsp)
-{
-	const char	*os_name;
-	const char	*sym_name;
-	const char 	*msg;
-
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	if (DBG_NOTLONG())
-		msg = MSG_ORIG(MSG_REL_ARGS_5);
+	if (orsp->rel_flags & (FLG_REL_GOT | FLG_REL_RFPTR1 | FLG_REL_RFPTR2))
+		secname = MSG_ORIG(MSG_SCN_GOT);
+	else if (orsp->rel_flags & FLG_REL_PLT)
+		secname = MSG_ORIG(MSG_SCN_PLT);
+	else if (orsp->rel_flags & FLG_REL_BSS)
+		secname = MSG_ORIG(MSG_SCN_BSS);
+	else if (orsp->rel_osdesc)
+		secname = orsp->rel_osdesc->os_name;
 	else
-		msg = MSG_ORIG(MSG_REL_L_ARGS_5);
-
-	if (orsp->rel_flags & (FLG_REL_GOT | FLG_REL_RFPTR1 | FLG_REL_RFPTR2))
-		os_name = MSG_ORIG(MSG_SCN_GOT);
-	else if (orsp->rel_flags & FLG_REL_PLT)
-		os_name = MSG_ORIG(MSG_SCN_PLT);
-	else if (orsp->rel_flags & FLG_REL_BSS)
-		os_name = MSG_ORIG(MSG_SCN_BSS);
-	else if (orsp->rel_osdesc)
-		os_name = orsp->rel_osdesc->os_name;
-	else
-		os_name = MSG_INTL(MSG_STR_NULL);
+		secname = MSG_INTL(MSG_STR_NULL);
 
 	/*
-	 * Register symbols can be relocated/initialized
-	 * to a constant, which is a special case where
-	 * the symbol index is 0.
+	 * Register symbols can be relocated/initialized to a constant, which
+	 * is a special case where the symbol index is 0.
 	 */
 	if (orsp->rel_sym != NULL)
-		sym_name = orsp->rel_sym->sd_name;
+		symname = orsp->rel_sym->sd_name;
 	else
-		sym_name = MSG_ORIG(MSG_STR_EMPTY);
+		symname = MSG_ORIG(MSG_STR_EMPTY);
 
-	dbg_print(msg, MSG_INTL(MSG_STR_OUT),
-	    conv_reloc_type_str(mach, orsp->rel_rtype),
-	    EC_OFF(orsp->rel_roffset), os_name,
-	    _Dbg_sym_dem(sym_name), MSG_ORIG(MSG_STR_EMPTY));
+	Elf_reloc_entry_2(lml, caller, MSG_INTL(MSG_STR_OUT), type,
+	    conv_reloc_type(mach, orsp->rel_rtype), orsp->rel_roffset,
+	    orsp->rel_raddend, secname, symname, MSG_ORIG(MSG_STR_EMPTY));
 }
 
 /*
  * Print a Active relocation structure (Rel_desc).
  */
 void
-Dbg_reloc_ars_entry(Half mach, Rel_desc *arsp)
+Dbg_reloc_ars_entry(Lm_list *lml, int caller, Word type, Half mach,
+    Rel_desc *arsp)
 {
-	const char	*os_name;
-	const char	*msg;
+	const char	*secname;
 
-	if (DBG_NOTCLASS(DBG_RELOC))
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
-	if (DBG_NOTLONG())
-		msg = MSG_ORIG(MSG_REL_ARGS_5);
-	else
-		msg = MSG_ORIG(MSG_REL_L_ARGS_5);
 
 	if (arsp->rel_flags & (FLG_REL_GOT | FLG_REL_FPTR))
-		os_name = MSG_ORIG(MSG_SCN_GOT);
+		secname = MSG_ORIG(MSG_SCN_GOT);
 	else
-		os_name = arsp->rel_osdesc->os_name;
-
-	dbg_print(msg, MSG_INTL(MSG_STR_ACT),
-	    conv_reloc_type_str(mach, arsp->rel_rtype),
-	    EC_OFF(arsp->rel_roffset), os_name,
-	    _Dbg_sym_dem(arsp->rel_sym->sd_name), MSG_ORIG(MSG_STR_EMPTY));
-}
-
-#if	!defined(_ELF64)
-void
-Dbg_reloc_run(const char *file, uint_t rel, int info, int type)
-{
-	const char	*str;
-
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
+		secname = arsp->rel_osdesc->os_name;
 
-	if (type == DBG_REL_FINISH) {
-		if (info)
-			str = MSG_ORIG(MSG_STR_EMPTY);
-		else
-			str = MSG_INTL(MSG_REL_RELOC_FAIL);
-	} else {
-		if (info)
-			str = MSG_INTL(MSG_REL_RELOC_PLT);
-		else
-			str = MSG_ORIG(MSG_STR_EMPTY);
-	}
-
-	if (type == DBG_REL_START) {
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_REL_RELOC_START), file, str);
-
-		if (DBG_NOTDETAIL())
-			return;
-
-		if (rel == SHT_RELA) {
-			dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_3));
-			dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_4));
-		} else
-			dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_3));
-	} else {
-		if (type == DBG_REL_NONE) {
-			dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-			dbg_print(MSG_INTL(MSG_REL_RELOC_NONE), file, str);
-		} else
-			dbg_print(MSG_INTL(MSG_REL_RELOC_FINISH), file, str);
-
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	}
+	Elf_reloc_entry_2(lml, caller, MSG_INTL(MSG_STR_ACT), type,
+	    conv_reloc_type(mach, arsp->rel_rtype), arsp->rel_roffset,
+	    arsp->rel_raddend, secname, arsp->rel_sym->sd_name,
+	    MSG_ORIG(MSG_STR_EMPTY));
 }
 
 void
-Dbg_reloc_copy(const char *dname, const char *rname, const char *sname,
-    int zero)
+Dbg_reloc_entry(Lm_list *lml, const char *prestr, Half mach, Word type,
+    void *reloc, const char *secname, const char *symname, const char *poststr)
 {
-	const char	*str;
+	/*
+	 * Register relocations can use a constant initializer, in which case
+	 * the associated symbol is 0.
+	 */
+	if (symname == NULL)
+		symname = MSG_ORIG(MSG_STR_EMPTY);
+
+	Elf_reloc_entry_1(lml, ELF_DBG_LD, prestr, mach, type, reloc, secname,
+	    symname, poststr);
+}
+
+#if	defined(_ELF64)
 
-	if (DBG_NOTCLASS(DBG_RELOC))
+void
+Dbg64_pltpad_to(Lm_list *lml, const char *file, Addr pltpad,
+    const char *dfile, const char *symname)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_BND_PLTPAD_TO), EC_ADDR(pltpad), file,
+	    dfile, symname);
+}
+
+void
+Dbg64_pltpad_from(Lm_list *lml, const char *file, const char *sname,
+    Addr pltpad)
+{
+	if (DBG_NOTCLASS(DBG_C_RELOC))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	if (zero)
-		str = MSG_INTL(MSG_STR_COPYZERO);
-	else
-		str = MSG_ORIG(MSG_STR_EMPTY);
-
-	dbg_print(MSG_INTL(MSG_REL_COPY), dname, rname, sname, str);
+	dbg_print(lml, MSG_INTL(MSG_BND_PLTPAD_FROM), EC_ADDR(pltpad), file,
+	    Dbg_demangle_name(sname));
 }
 
+#endif
+
 /*
- * Print a relocation entry. This can either be an input or output
- * relocation record, and specifies the relocation section for which is
- * associated.
+ * Relocation output can differ depending on the caller and the type of
+ * relocation record.  However, the final diagnostic is maintained here so
+ * that the various message strings remain consistent.
+ *
+ * elfdump:
+ *               type       offset     addend    section   symbol
+ *               X          X          X         X         X              (Rela)
+ *
+ *               type       offset               section   symbol
+ *               X          X                    X         X              (Rel)
+ *
+ * Note, it could be argued that the section name output with elfdump(1) is
+ * unnecessary, as the table itself is identified with a title that reveals
+ * the section name.  However, the output does provide for grep(1)'ing for
+ * individual entries and obtaining the section name with this type of input.
+ *
+ * ld.so.1:
+ *   (prestr)    type       offset     addend    symbol
+ *                                     value
+ *       in      X          X          X         X                        (Rela)
+ *    apply                 X          X
+ *
+ *   (prestr)    type       offset     value     symbol
+ *       in      X          X                    X                        (Rel)
+ *    apply                 X          X
+ *
+ * ld:
+ *   (prestr)    type       offset     addend    section   symbol
+ *       in      X          X          X         X         X              (Rela)
+ *      act      X          X                    X         X
+ *      out      X          X                    X         X
+ *
+ *   (prestr)    type       offset               section   symbol
+ *       in      X          X                    X         X              (Rel)
+ *      act      X          X                    X         X
+ *      out      X          X                    X         X
+ *
+ * Both Rela and Rel active relocations are printed as:
+ *
+ *               type       offset     value     section   symbol
+ *               X          X          X         X         X
  */
 void
-Gelf_reloc_entry(const char *prestr, GElf_Half mach, GElf_Word type,
-    GElf_Rela *rel, const char *sec, const char *name)
+Elf_reloc_title(Lm_list *lml, int caller, Word type)
 {
-	const char *msg;
-
-	if (type == SHT_RELA) {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_REL_ARGS_6);
-		else
-			msg = MSG_ORIG(MSG_REL_L_ARGS_6);
-	} else {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_REL_ARGS_5);
-		else
-			msg = MSG_ORIG(MSG_REL_L_ARGS_5);
+	if (caller == ELF_DBG_ELFDUMP) {
+		if (type == SHT_RELA) {
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_EFSA_TITLE));
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_EFLA_TITLE));
+		} else {
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_EFSN_TITLE));
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_EFLN_TITLE));
+		}
+		return;
 	}
-
-	if (type == SHT_RELA)
-		dbg_print(msg, prestr,
-		    conv_reloc_type_str(mach, (uint_t)GELF_R_TYPE(rel->r_info)),
-			EC_ADDR(rel->r_offset), EC_XWORD(rel->r_addend),
-			sec, _Dbg_sym_dem(name), MSG_ORIG(MSG_STR_EMPTY));
-	else
-		dbg_print(msg, prestr,
-		    conv_reloc_type_str(mach, (uint_t)GELF_R_TYPE(rel->r_info)),
-			EC_ADDR(rel->r_offset), sec, _Dbg_sym_dem(name),
-			MSG_ORIG(MSG_STR_EMPTY));
+	if (caller == ELF_DBG_RTLD) {
+		if (type == SHT_RELA) {
+			dbg_print(lml, MSG_INTL(MSG_REL_RTA_TITLE));
+			dbg_print(lml, MSG_INTL(MSG_REL_RTV_TITLE));
+		} else
+			dbg_print(lml, MSG_INTL(MSG_REL_RTN_TITLE));
+		return;
+	}
+	if (caller == ELF_DBG_LD) {
+		if (type == 0) {
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_LDSV_TITLE));
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_LDLV_TITLE));
+			return;
+		}
+		if (type == SHT_RELA) {
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_LDSA_TITLE));
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_LDLA_TITLE));
+		} else {
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_LDSN_TITLE));
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_LDLN_TITLE));
+		}
+	}
 }
 
 void
-_gelf_reloc_entry(const char *prestr, GElf_Half mach, GElf_Word type,
-    void *reloc, const char *sec, const char *name, const char *com)
+Elf_reloc_entry_2(Lm_list *lml, int caller, const char *prestr, Word type,
+    const char *typestr, Addr off, Sxword add, const char *secname,
+    const char *symname, const char *poststr)
 {
-	const char *msg;
-
-	/*
-	 * Register relocations can use a constant initialzer,
-	 * in which case the associated symbol is 0.
-	 */
-	if (name == NULL)
-		name = MSG_ORIG(MSG_STR_EMPTY);
-
-	if (type == SHT_RELA) {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_REL_ARGS_6);
-		else
-			msg = MSG_ORIG(MSG_REL_L_ARGS_6);
-	} else {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_REL_ARGS_5);
-		else
-			msg = MSG_ORIG(MSG_REL_L_ARGS_5);
-	}
-
-	if ((mach == EM_SPARCV9) || (mach == EM_AMD64)) {
-		Elf64_Rela * rel = (Elf64_Rela *)reloc;
+	if (symname)
+		symname = Elf_demangle_name(symname);
+	else
+		symname = MSG_ORIG(MSG_STR_EMPTY);
 
+	if (caller == ELF_DBG_ELFDUMP) {
 		if (type == SHT_RELA) {
-			dbg_print(msg, prestr,
-			    conv_reloc_type_str(mach,
-				(uint_t)ELF64_R_TYPE(rel->r_info)),
-			    EC_ADDR(rel->r_offset),
-			    EC_XWORD(rel->r_addend),
-			    sec, name, com);
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_EFSA_ENTRY),
+				    typestr, EC_OFF(off), EC_SXWORD(add),
+				    secname, symname);
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_EFLA_ENTRY),
+				    typestr, EC_OFF(off), EC_SXWORD(add),
+				    secname, symname);
 		} else {
-			dbg_print(msg, prestr,
-			    conv_reloc_type_str(mach,
-				(uint_t)ELF64_R_TYPE(rel->r_info)),
-			    EC_ADDR(rel->r_offset), sec, name, com);
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_EFSN_ENTRY),
+				    typestr, EC_OFF(off), secname, symname);
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_EFLN_ENTRY),
+				    typestr, EC_OFF(off), secname, symname);
 		}
-	} else {
-		Elf32_Rela * rel = (Elf32_Rela *)reloc;
-
+		return;
+	}
+	if (caller == ELF_DBG_RTLD) {
+		if (type == SHT_RELA)
+			dbg_print(lml, MSG_INTL(MSG_REL_RTA_ENTRY), prestr,
+			    typestr, EC_OFF(off), EC_SXWORD(add), symname);
+		else
+			dbg_print(lml, MSG_INTL(MSG_REL_RTN_ENTRY), prestr,
+			    typestr, EC_OFF(off), symname);
+		return;
+	}
+	if (caller == ELF_DBG_LD) {
 		if (type == SHT_RELA) {
-			dbg_print(msg, prestr,
-			    conv_reloc_type_str(mach,
-				ELF32_R_TYPE(rel->r_info)),
-			    EC_ADDR(rel->r_offset), EC_XWORD(rel->r_addend),
-			    sec, name, com);
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_LDSA_ENTRY),
+				    prestr, typestr, EC_OFF(off),
+				    EC_SXWORD(add), secname, symname, poststr);
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_LDLA_ENTRY),
+				    prestr, typestr, EC_OFF(off),
+				    EC_SXWORD(add), secname, symname, poststr);
 		} else {
-			dbg_print(msg, prestr,
-			    conv_reloc_type_str(mach,
-				ELF32_R_TYPE(rel->r_info)),
-			    EC_ADDR(rel->r_offset), sec, name, com);
+			if (DBG_NOTLONG())
+				dbg_print(lml, MSG_INTL(MSG_REL_LDSN_ENTRY),
+				    prestr, typestr, EC_OFF(off), secname,
+				    symname, poststr);
+			else
+				dbg_print(lml, MSG_INTL(MSG_REL_LDLN_ENTRY),
+				    prestr, typestr, EC_OFF(off), secname,
+				    symname, poststr);
 		}
 	}
 }
-#endif	/* !defined(_ELF64) */
 
-#if	defined(_ELF64)
 void
-Dbg_pltpad_boundto64(const char *file, Addr pltpad, const char *dfile,
-	const char *symname)
+Elf_reloc_entry_1(Lm_list *lml, int caller, const char *prestr, Half mach,
+    Word type, void *reloc, const char *secname, const char *symname,
+    const char *poststr)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	dbg_print(MSG_INTL(MSG_REL_PADBOUNDTO), file, EC_ADDR(pltpad),
-	    dfile, symname);
+	Addr		off;
+	Sxword		add;
+	const char	*str;
+
+	if (type == SHT_RELA) {
+		Rela	*rela = (Rela *)reloc;
+
+		str = conv_reloc_type(mach, ELF_R_TYPE(rela->r_info));
+		off = rela->r_offset;
+		add = rela->r_addend;
+	} else {
+		Rel	*rel = (Rel *)reloc;
+
+		str = conv_reloc_type(mach, ELF_R_TYPE(rel->r_info));
+		off = rel->r_offset;
+		add = 0;
+	}
+	Elf_reloc_entry_2(lml, caller, prestr, type, str, off, add, secname,
+	    symname, poststr);
 }
 
+/*
+ * Display any applied relocations.  Presently, these are only called from
+ * ld.so.1, but the interfaces are maintained here to insure consistency with
+ * other relocation diagnostics.
+ */
 void
-Dbg_pltpad_bindto64(const char *file, const char *sname, Addr pltpad)
+Elf_reloc_apply_val(Lm_list *lml, int caller, Xword offset, Xword value)
 {
-	if (DBG_NOTCLASS(DBG_RELOC))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-	dbg_print(MSG_INTL(MSG_REL_PADBINDTO), file, _Dbg_sym_dem(sname),
-	    EC_ADDR(pltpad));
+	if (caller == ELF_DBG_RTLD)
+		dbg_print(lml, MSG_INTL(MSG_REL_RT_APLVAL), EC_XWORD(offset),
+		    EC_XWORD(value));
 }
-#endif
+void
+Elf_reloc_apply_reg(Lm_list *lml, int caller, Half mach, Xword offset,
+    Xword value)
+{
+	if (caller == ELF_DBG_RTLD)
+		dbg_print(lml, MSG_INTL(MSG_REL_RT_APLREG),
+		    conv_sym_value(mach, STT_SPARC_REGISTER, offset),
+		    EC_XWORD(value));
+}
--- a/usr/src/cmd/sgs/liblddbg/common/sections.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/sections.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -42,49 +42,50 @@
 };
 
 void
-Dbg_sec_strtab(Os_desc *osp, Str_tbl *stp)
+Dbg_sec_strtab(Lm_list *lml, Os_desc *osp, Str_tbl *stp)
 {
-	uint_t		i;
+	uint_t	i;
 
-	if (DBG_NOTCLASS(DBG_STRTAB))
+	if (DBG_NOTCLASS(DBG_C_STRTAB))
 		return;
 
 	if (!osp)
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
 	if (stp->st_flags & FLG_STTAB_COMPRESS)
-		dbg_print(MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name,
-			stp->st_fullstringsize, stp->st_stringsize);
+		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name,
+		    stp->st_fullstringsize, stp->st_stringsize);
 	else
-		dbg_print(MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name,
-			stp->st_fullstringsize);
+		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name,
+		    stp->st_fullstringsize);
 
 	if ((DBG_NOTDETAIL()) ||
 	    ((stp->st_flags & FLG_STTAB_COMPRESS) == 0))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name,
-		stp->st_hbckcnt);
+	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name,
+	    stp->st_hbckcnt);
+
 	for (i = 0; i < stp->st_hbckcnt; i++) {
 		Str_hash	*sthash;
-		dbg_print(MSG_INTL(MSG_SEC_STRTAB_BCKT), i);
+
+		dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_BCKT), i);
+
 		for (sthash = stp->st_hashbcks[i]; sthash;
 		    sthash = sthash->hi_next) {
-			uint_t	stroff;
+			uint_t	stroff = sthash->hi_mstr->sm_stlen -
+			    sthash->hi_stlen;
 
-			stroff = sthash->hi_mstr->sm_stlen - sthash->hi_stlen;
 			if (stroff == 0) {
-				dbg_print(MSG_INTL(MSG_SEC_STRTAB_MSTR),
-					sthash->hi_refcnt,
-					sthash->hi_mstr->sm_str);
+				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_MSTR),
+				    sthash->hi_refcnt, sthash->hi_mstr->sm_str);
 			} else {
-				const char	*str;
-				str = &sthash->hi_mstr->sm_str[stroff];
-				dbg_print(MSG_INTL(MSG_SEC_STRTAB_SUFSTR),
-					sthash->hi_refcnt,
-					str, sthash->hi_mstr->sm_str);
+				dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_SUFSTR),
+				    sthash->hi_refcnt,
+				    &sthash->hi_mstr->sm_str[stroff],
+				    sthash->hi_mstr->sm_str);
 			}
 		}
 
@@ -92,11 +93,11 @@
 }
 
 void
-Dbg_sec_in(Is_desc *isp)
+Dbg_sec_in(Lm_list *lml, Is_desc *isp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 
 	if (isp->is_file != NULL)
@@ -104,15 +105,15 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_INTL(MSG_SEC_INPUT), isp->is_name, str);
+	dbg_print(lml, MSG_INTL(MSG_SEC_INPUT), isp->is_name, str);
 }
 
 void
-Dbg_sec_added(Os_desc *osp, Sg_desc *sgp)
+Dbg_sec_added(Lm_list *lml, Os_desc *osp, Sg_desc *sgp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 
 	if (sgp->sg_name && *sgp->sg_name)
@@ -120,15 +121,15 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_INTL(MSG_SEC_ADDED), osp->os_name, str);
+	dbg_print(lml, MSG_INTL(MSG_SEC_ADDED), osp->os_name, str);
 }
 
 void
-Dbg_sec_created(Os_desc *osp, Sg_desc *sgp)
+Dbg_sec_created(Lm_list *lml, Os_desc *osp, Sg_desc *sgp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 
 	if (sgp->sg_name && *sgp->sg_name)
@@ -136,26 +137,26 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_INTL(MSG_SEC_CREATED), osp->os_name, str);
+	dbg_print(lml, MSG_INTL(MSG_SEC_CREATED), osp->os_name, str);
 }
 
 void
-Dbg_sec_discarded(Is_desc *isp, Is_desc *disp)
+Dbg_sec_discarded(Lm_list *lml, Is_desc *isp, Is_desc *disp)
 {
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_SEC_DISCARDED), isp->is_basename,
+	dbg_print(lml, MSG_INTL(MSG_SEC_DISCARDED), isp->is_basename,
 	    isp->is_file->ifl_name, disp->is_basename,
 	    disp->is_file->ifl_name);
 }
 
 void
-Dbg_sec_group(Is_desc *isp, Group_desc *gdp)
+Dbg_sec_group(Lm_list *lml, Is_desc *isp, Group_desc *gdp)
 {
 	const char	*fmt;
 
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 
 	if (gdp->gd_flags & GRP_FLG_DISCARD)
@@ -163,7 +164,7 @@
 	else
 		fmt = MSG_INTL(MSG_SEC_GRP_INPUT);
 
-	dbg_print(fmt, isp->is_name, isp->is_file->ifl_name,
+	dbg_print(lml, fmt, isp->is_name, isp->is_file->ifl_name,
 	    gdp->gd_gsectname, gdp->gd_symname);
 }
 
@@ -173,9 +174,10 @@
 	Os_desc		*osp;
 	Is_desc		*isp1;
 	Listnode	*lnp1, *lnp2;
+	Lm_list		*lml = ofl->ofl_lml;
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -191,8 +193,8 @@
 	for (LIST_TRAVERSE(&ofl->ofl_ordered, lnp1, osp)) {
 		Sort_desc	*sort = osp->os_sort;
 
-		dbg_print(str, osp->os_name);
-		dbg_print(MSG_INTL(MSG_ORD_HDR_1),
+		dbg_print(lml, str, osp->os_name);
+		dbg_print(lml, MSG_INTL(MSG_ORD_HDR_1),
 		    EC_WORD(sort->st_beforecnt), EC_WORD(sort->st_aftercnt),
 		    EC_WORD(sort->st_ordercnt));
 
@@ -203,7 +205,7 @@
 			static const char	*msg;
 
 			if ((isp1->is_flags & FLG_IS_ORDERED) == 0) {
-				dbg_print(MSG_INTL(MSG_ORD_TITLE_0),
+				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_0),
 				    isp1->is_name, isp1->is_file->ifl_name);
 				continue;
 			}
@@ -218,28 +220,28 @@
 			}
 
 			if (link == SHN_BEFORE) {
-				dbg_print(MSG_INTL(MSG_ORD_TITLE_1),
+				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_1),
 				    isp1->is_name, isp1->is_file->ifl_name);
 				continue;
 			}
 
 			if (link == SHN_AFTER) {
-				dbg_print(MSG_INTL(MSG_ORD_TITLE_2),
+				dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_2),
 				    isp1->is_name, isp1->is_file->ifl_name);
 				continue;
 			}
 
 			isp2 = ifl->ifl_isdesc[link];
-			dbg_print(msg, isp1->is_name, ifl->ifl_name,
-				isp2->is_name, isp2->is_key);
+			dbg_print(lml, msg, isp1->is_name, ifl->ifl_name,
+			    isp2->is_name, isp2->is_key);
 		}
 	}
 }
 
 void
-Dbg_sec_order_error(Ifl_desc *ifl, Word ndx, int error)
+Dbg_sec_order_error(Lm_list *lml, Ifl_desc *ifl, Word ndx, int error)
 {
-	if (DBG_NOTCLASS(DBG_SECTIONS))
+	if (DBG_NOTCLASS(DBG_C_SECTIONS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -247,9 +249,9 @@
 	if (error == 0)
 		return;
 
-	dbg_print(MSG_INTL(MSG_ORD_ERR_TITLE),
-		ifl->ifl_isdesc[ndx]->is_name, ifl->ifl_name);
+	dbg_print(lml, MSG_INTL(MSG_ORD_ERR_TITLE),
+	    ifl->ifl_isdesc[ndx]->is_name, ifl->ifl_name);
 
 	if (error)
-		dbg_print(MSG_INTL(order_errors[error - 1]));
+		dbg_print(lml, MSG_INTL(order_errors[error - 1]));
 }
--- a/usr/src/cmd/sgs/liblddbg/common/segments.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/segments.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -34,7 +34,7 @@
  * Print out a single `segment descriptor' entry.
  */
 void
-_Dbg_seg_desc_entry(Half mach, int ndx, Sg_desc *sgp)
+Dbg_seg_desc_entry(Lm_list *lml, Half mach, int ndx, Sg_desc *sgp)
 {
 	const char	*str;
 
@@ -43,64 +43,67 @@
 	else
 		str = MSG_INTL(MSG_STR_NULL);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_ORIG(MSG_SEG_NAME), ndx, str);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_ORIG(MSG_SEG_NAME), ndx, str);
+
+	Elf_phdr(lml, mach, &sgp->sg_phdr);
 
-	Elf_phdr_entry(mach, &sgp->sg_phdr);
+	dbg_print(lml, MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length));
+	dbg_print(lml, MSG_ORIG(MSG_SEG_FLAGS),
+	    conv_seg_flags(sgp->sg_flags));
 
-	dbg_print(MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length));
-	dbg_print(MSG_ORIG(MSG_SEG_FLAGS), conv_segaflg_str(sgp->sg_flags));
 	if (sgp->sg_sizesym && sgp->sg_sizesym->sd_name)
-		dbg_print(MSG_ORIG(MSG_SEG_SIZESYM),
-		    _Dbg_sym_dem(sgp->sg_sizesym->sd_name));
+		dbg_print(lml, MSG_ORIG(MSG_SEG_SIZESYM),
+		    Dbg_demangle_name(sgp->sg_sizesym->sd_name));
+
 	if (sgp->sg_secorder.head) {
-		Listnode *	lnp;
-		Sec_order *	scop;
+		Listnode	*lnp;
+		Sec_order	*scop;
 
-		dbg_print(MSG_ORIG(MSG_SEG_ORDER));
+		dbg_print(lml, MSG_ORIG(MSG_SEG_ORDER));
 		for (LIST_TRAVERSE(&sgp->sg_secorder, lnp, scop)) {
-			dbg_print(MSG_ORIG(MSG_SEG_SECTION), scop->sco_secname,
-			    EC_WORD(scop->sco_index));
+			dbg_print(lml, MSG_ORIG(MSG_SEG_SECTION),
+			    scop->sco_secname, EC_WORD(scop->sco_index));
 		}
 	}
 }
 
 void
-Dbg_seg_title()
+Dbg_seg_title(Lm_list *lml)
 {
-	if (DBG_NOTCLASS(DBG_SEGMENTS))
+	if (DBG_NOTCLASS(DBG_C_SEGMENTS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SEG_DESC_INUSE));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SEG_DESC_INUSE));
 }
 
 void
-Dbg_seg_entry(Half mach, int ndx, Sg_desc *sgp)
+Dbg_seg_entry(Ofl_desc *ofl, int ndx, Sg_desc *sgp)
 {
-	if (DBG_NOTCLASS(DBG_SEGMENTS))
+	if (DBG_NOTCLASS(DBG_C_SEGMENTS))
 		return;
 
-	_Dbg_seg_desc_entry(mach, ndx, sgp);
+	Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, ndx, sgp);
 }
 
 /*
  * Print out the available segment descriptors.
  */
 void
-Dbg_seg_list(Half mach, List *lsg)
+Dbg_seg_list(Lm_list *lml, Half mach, List *lsg)
 {
 	Listnode	*lnp;
 	Sg_desc		*sgp;
 	int		ndx = 0;
 
-	if (DBG_NOTCLASS(DBG_SEGMENTS))
+	if (DBG_NOTCLASS(DBG_C_SEGMENTS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SEG_DESC_AVAIL));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SEG_DESC_AVAIL));
 	for (LIST_TRAVERSE(lsg, lnp, sgp))
-		_Dbg_seg_desc_entry(mach, ndx++, sgp);
+		Dbg_seg_desc_entry(lml, mach, ndx++, sgp);
 }
 
 /*
@@ -112,20 +115,52 @@
 void
 Dbg_seg_os(Ofl_desc *ofl, Os_desc *osp, int ndx)
 {
+	Lm_list		*lml = ofl->ofl_lml;
 	Listnode	*lnp;
 	Is_desc		*isp;
+	Elf_Data	*data;
+	Shdr		*shdr;
 
-	if (DBG_NOTCLASS(DBG_SEGMENTS))
+	if (DBG_NOTCLASS(DBG_C_SEGMENTS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_SEC_NAME), ndx, osp->os_name);
-	Elf_shdr_entry(ofl->ofl_e_machine, osp->os_shdr);
-	Gelf_elf_data_title();
-	_Dbg_elf_data_out(osp);
+	dbg_print(lml, MSG_ORIG(MSG_SEC_NAME), ndx, osp->os_name);
+	Elf_shdr(lml, ofl->ofl_dehdr->e_machine, osp->os_shdr);
+	dbg_print(lml, MSG_INTL(MSG_EDATA_TITLE));
+
+	shdr = osp->os_shdr;
+	data = osp->os_outdata;
+	dbg_print(lml, MSG_INTL(MSG_EDATA_ENTRY), MSG_INTL(MSG_STR_OUT),
+	    EC_ADDR(shdr->sh_addr), conv_elfdata_type(data->d_type),
+	    EC_XWORD(data->d_size), EC_OFF(data->d_off),
+	    EC_XWORD(data->d_align), MSG_ORIG(MSG_STR_EMPTY),
+	    MSG_ORIG(MSG_STR_EMPTY));
 
 	if (DBG_NOTDETAIL())
 		return;
 
-	for (LIST_TRAVERSE(&(osp->os_isdescs), lnp, isp))
-		_Dbg_elf_data_in(osp, isp);
+	for (LIST_TRAVERSE(&(osp->os_isdescs), lnp, isp)) {
+		const char	*file, *str;
+		Addr		addr;
+
+		data = isp->is_indata;
+
+		if (isp->is_flags & FLG_IS_DISCARD) {
+			str = MSG_INTL(MSG_EDATA_IGNSCN);
+			addr = 0;
+		} else {
+			str = MSG_ORIG(MSG_STR_EMPTY);
+			addr = (Addr)(shdr->sh_addr + data->d_off);
+		}
+
+		if (isp->is_file && isp->is_file->ifl_name)
+			file = isp->is_file->ifl_name;
+		else
+			file = MSG_ORIG(MSG_STR_EMPTY);
+
+		dbg_print(lml, MSG_INTL(MSG_EDATA_ENTRY), MSG_INTL(MSG_STR_IN),
+		    EC_ADDR(addr), conv_elfdata_type(data->d_type),
+		    EC_XWORD(data->d_size), EC_OFF(data->d_off),
+		    EC_XWORD(data->d_align), file, str);
+	}
 }
--- a/usr/src/cmd/sgs/liblddbg/common/shdr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/shdr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,48 +18,28 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-#include	"msg.h"
-#include	"_debug.h"
-
-
-#if !(defined(_ELF64) && defined(lint))
-
-
-/*
- * Print out a single `section header' entry.
- */
-void
-Elf_shdr_entry(Half mach, Elf32_Shdr * shdr)
-{
-	dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr),
-	    conv_secflg_str(mach, shdr->sh_flags));
-	dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size),
-	    conv_sectyp_str(mach, shdr->sh_type));
-	dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset),
-	    EC_XWORD(shdr->sh_entsize));
-	dbg_print(MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link),
-	    conv_secinfo_str(shdr->sh_info, shdr->sh_flags));
-	dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign));
-}
+#include	<sgs.h>
+#include	<_debug.h>
+#include	<conv.h>
+#include	<msg.h>
 
 void
-Gelf_shdr_entry(Half mach, GElf_Shdr * shdr)
+Elf_shdr(Lm_list *lml, Half mach, Shdr * shdr)
 {
-	dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr),
-	    conv_secflg_str(mach, (Word)shdr->sh_flags));
-	dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size),
-	    conv_sectyp_str(mach, shdr->sh_type));
-	dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset),
+	dbg_print(lml, MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr),
+	    conv_sec_flags(shdr->sh_flags));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size),
+	    conv_sec_type(mach, shdr->sh_type));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset),
 	    EC_XWORD(shdr->sh_entsize));
-	dbg_print(MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link),
-	    conv_secinfo_str(shdr->sh_info, (Word)shdr->sh_flags));
-	dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link),
+	    conv_sec_info(shdr->sh_info, shdr->sh_flags));
+	dbg_print(lml, MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign));
 }
-
-#endif /* !(defined(_ELF64) && defined(lint)) */
--- a/usr/src/cmd/sgs/liblddbg/common/statistics.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/statistics.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,34 +32,36 @@
 void
 Dbg_statistics_ld(Ofl_desc *ofl)
 {
-	if (DBG_NOTCLASS(DBG_STATISTICS))
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_STATS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_STATS_GENERAL));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_STATS_GENERAL));
 
 	if (ofl->ofl_objscnt || ofl->ofl_soscnt || ofl->ofl_arscnt) {
-		dbg_print(MSG_INTL(MSG_STATS_FILES),
+		dbg_print(lml, MSG_INTL(MSG_STATS_FILES),
 		    EC_XWORD(ofl->ofl_objscnt), EC_XWORD(ofl->ofl_soscnt),
 		    EC_XWORD(ofl->ofl_arscnt));
 	}
 
 	if (ofl->ofl_locscnt || ofl->ofl_globcnt) {
-		dbg_print(MSG_INTL(MSG_STATS_SYMBOLS_OUT),
+		dbg_print(lml, MSG_INTL(MSG_STATS_SYMBOLS_OUT),
 		    EC_XWORD(ofl->ofl_globcnt), EC_XWORD(ofl->ofl_locscnt));
 	}
 	if (ofl->ofl_entercnt || ofl->ofl_scopecnt || ofl->ofl_elimcnt) {
-		dbg_print(MSG_INTL(MSG_STATS_SYMBOLS_IN),
+		dbg_print(lml, MSG_INTL(MSG_STATS_SYMBOLS_IN),
 		    EC_XWORD(ofl->ofl_entercnt), EC_XWORD(ofl->ofl_scopecnt),
 		    EC_XWORD(ofl->ofl_elimcnt));
 	}
 
 	if (ofl->ofl_outrelscnt) {
-		dbg_print(MSG_INTL(MSG_STATS_RELOCS_OUT),
+		dbg_print(lml, MSG_INTL(MSG_STATS_RELOCS_OUT),
 		    EC_XWORD(ofl->ofl_outrelscnt));
 	}
 	if (ofl->ofl_entrelscnt || ofl->ofl_actrelscnt) {
-		dbg_print(MSG_INTL(MSG_STATS_RELOCS_IN),
+		dbg_print(lml, MSG_INTL(MSG_STATS_RELOCS_IN),
 		    EC_XWORD(ofl->ofl_entrelscnt),
 		    EC_XWORD(ofl->ofl_actrelscnt));
 	}
@@ -73,21 +74,22 @@
 	Ar_desc		*adp;
 	Elf_Arsym	*arsym;
 	Ar_aux		*aux;
+	Lm_list		*lml = ofl->ofl_lml;
 
-	if (DBG_NOTCLASS(DBG_STATISTICS | DBG_UNUSED))
+	if (DBG_NOTCLASS(DBG_C_STATS | DBG_C_UNUSED))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
 	for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) {
 		size_t	poffset = 0;
 		uint_t	count = 0, used = 0;
 
 		if ((adp->ad_flags & FLG_ARD_EXTRACT) == 0) {
-			Dbg_unused_file(adp->ad_name, 0, 0);
+			Dbg_unused_file(lml, adp->ad_name, 0, 0);
 			continue;
 		}
 
-		if (DBG_NOTCLASS(DBG_STATISTICS))
+		if (DBG_NOTCLASS(DBG_C_STATS))
 			continue;
 
 		arsym = adp->ad_start;
@@ -108,9 +110,9 @@
 		if ((count == 0) || (used == 0))
 			continue;
 #ifndef	UDIV_NOT_SUPPORTED
-		dbg_print(MSG_INTL(MSG_STATS_AR), adp->ad_name, count, used,
-		    ((used * 100) / count));
+		dbg_print(lml, MSG_INTL(MSG_STATS_AR), adp->ad_name, count,
+		    used, ((used * 100) / count));
 #endif
 	}
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/support.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/support.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1998-2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -29,11 +29,11 @@
 #include	"_debug.h"
 
 void
-Dbg_support_req(const char *define, int flag)
+Dbg_support_req(Lm_list *lml, const char *define, int flag)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SUPPORT))
+	if (DBG_NOTCLASS(DBG_C_SUPPORT))
 		return;
 
 	if (flag == DBG_SUP_ENVIRON)
@@ -43,26 +43,26 @@
 	else
 		str = MSG_INTL(MSG_SUP_REQ_DEF);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SUP_REQ), define, str);
+	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
+	dbg_print(lml, MSG_INTL(MSG_SUP_REQ), define, str);
 }
 
 void
-Dbg_support_load(const char *obj, const char *func)
+Dbg_support_load(Lm_list *lml, const char *obj, const char *func)
 {
-	if (DBG_NOTCLASS(DBG_SUPPORT))
+	if (DBG_NOTCLASS(DBG_C_SUPPORT))
 		return;
 
-	dbg_print(MSG_INTL(MSG_SUP_ROUTINE), obj, func);
+	dbg_print(lml, MSG_INTL(MSG_SUP_ROUTINE), obj, func);
 }
 
 void
-Dbg_support_action(const char *obj, const char *func, Support_ndx ndx,
-    const char *name)
+Dbg_support_action(Lm_list *lml, const char *obj, const char *func,
+    Support_ndx ndx, const char *name)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_SUPPORT))
+	if (DBG_NOTCLASS(DBG_C_SUPPORT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -78,7 +78,8 @@
 
 	if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) ||
 	    (ndx == LDS_INPUT_DONE))
-		dbg_print(MSG_INTL(MSG_SUP_CALLING_1), func, obj);
+		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_1), func, obj);
 	else
-		dbg_print(MSG_INTL(MSG_SUP_CALLING_2), func, obj, str, name);
+		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_2), func, obj,
+		    str, name);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/liblddbg/common/syminfo.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include	<sgs.h>
+#include	<debug.h>
+#include	<msg.h>
+
+void
+Elf_syminfo_title(Lm_list *lml)
+{
+	dbg_print(lml, MSG_INTL(MSG_SYMINFO_TITLE));
+}
+
+#define	FLAGSZ	16
+#define	NDXSZ	10
+
+void
+Elf_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, const char *name,
+    const char *needed)
+{
+	const char	*bndstr, *str;
+	char		flagstr[FLAGSZ], sndxstr[NDXSZ], dndxstr[NDXSZ];
+	int		flgndx = 0;
+	Half		flags = sip->si_flags;
+
+	if (flags & SYMINFO_FLG_DIRECT) {
+		if (sip->si_boundto == SYMINFO_BT_SELF)
+			bndstr = MSG_INTL(MSG_SYMINFO_SELF);
+		else if (sip->si_boundto == SYMINFO_BT_PARENT)
+			bndstr = MSG_INTL(MSG_SYMINFO_PARENT);
+		else
+			bndstr = needed;
+
+		flagstr[flgndx++] = 'D';
+		flags &= ~SYMINFO_FLG_DIRECT;
+
+	} else if (flags & SYMINFO_FLG_FILTER) {
+		bndstr = needed;
+		flagstr[flgndx++] = 'F';
+		flags &= ~SYMINFO_FLG_FILTER;
+
+	} else if (flags & SYMINFO_FLG_AUXILIARY) {
+		bndstr = needed;
+		flagstr[flgndx++] = 'A';
+		flags &= ~SYMINFO_FLG_AUXILIARY;
+
+	} else if (sip->si_boundto == SYMINFO_BT_EXTERN)
+		bndstr = MSG_INTL(MSG_SYMINFO_EXTERN);
+	else
+		bndstr = MSG_ORIG(MSG_STR_EMPTY);
+
+	if (flags & SYMINFO_FLG_DIRECTBIND) {
+		flagstr[flgndx++] = 'B';
+		flags &= ~SYMINFO_FLG_DIRECTBIND;
+	}
+	if (flags & SYMINFO_FLG_COPY) {
+		flagstr[flgndx++] = 'C';
+		flags &= ~SYMINFO_FLG_COPY;
+	}
+	if (flags & SYMINFO_FLG_LAZYLOAD) {
+		flagstr[flgndx++] = 'L';
+		flags &= ~SYMINFO_FLG_LAZYLOAD;
+	}
+	if (flags & SYMINFO_FLG_NOEXTDIRECT) {
+		flagstr[flgndx++] = 'N';
+		flags &= ~SYMINFO_FLG_NOEXTDIRECT;
+	}
+
+	/*
+	 * Did we account for all of the flags?
+	 */
+	if (flags)
+		(void) snprintf(&flagstr[flgndx], FLAGSZ - ndx,
+		    MSG_ORIG(MSG_SYMINFO_UNKFLAG), flags);
+	else
+		flagstr[flgndx] = '\0';
+
+	/*
+	 * If we've bound to a dependency, determine the dynamic entry index.
+	 */
+	if (bndstr == needed) {
+		(void) snprintf(dndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX),
+		    sip->si_boundto);
+		str = dndxstr;
+	} else
+		str = MSG_ORIG(MSG_STR_EMPTY);
+
+	(void) snprintf(sndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX), ndx);
+
+	dbg_print(lml, MSG_INTL(MSG_SYMINFO_ENTRY), sndxstr, flagstr, str,
+	    bndstr, Elf_demangle_name(name));
+}
--- a/usr/src/cmd/sgs/liblddbg/common/syms.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/syms.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,509 +18,51 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<stdio.h>
 #include	<dlfcn.h>
-#include	<strings.h>
 #include	"msg.h"
 #include	"_debug.h"
 #include	"libld.h"
 
-/*
- * Print out a single `symbol table node' entry.
- */
-#if	!defined(_ELF64)
-void
-Gelf_sym_table_title(GElf_Ehdr *ehdr, const char *index, const char *name)
-{
-	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) {
-		if (DBG_NOTLONG())
-			dbg_print(MSG_ORIG(MSG_SYM_TITLE_64), index, name);
-		else
-			dbg_print(MSG_ORIG(MSG_SYM_L_TITLE_64), index, name);
-	} else {
-		if (DBG_NOTLONG())
-			dbg_print(MSG_ORIG(MSG_SYM_TITLE), index, name);
-		else
-			dbg_print(MSG_ORIG(MSG_SYM_L_TITLE), index, name);
-	}
-}
-void
-Elf_sym_table_entry(const char *prestr, Elf32_Ehdr *ehdr, Elf32_Sym *sym,
-    Elf32_Word verndx, const char *sec, const char *poststr)
-{
-	const char *msg;
-
-	if (DBG_NOTLONG())
-		msg = MSG_ORIG(MSG_SYM_ENTRY);
-	else
-		msg = MSG_ORIG(MSG_SYM_L_ENTRY);
-
-	dbg_print(msg, prestr,
-	    conv_sym_value_str(ehdr->e_machine, ELF32_ST_TYPE(sym->st_info),
-	    EC_XWORD(sym->st_value)), EC_XWORD(sym->st_size),
-	    conv_info_type_str(ehdr->e_machine, ELF32_ST_TYPE(sym->st_info)),
-	    conv_info_bind_str(ELF32_ST_BIND(sym->st_info)),
-	    conv_sym_stother(sym->st_other), EC_WORD(verndx),
-	    sec ? sec : conv_shndx_str(sym->st_shndx),
-	    _Dbg_sym_dem(poststr));
-}
-
-void
-Gelf_sym_table_entry(const char *prestr, GElf_Ehdr *ehdr, GElf_Sym *sym,
-    GElf_Word verndx, const char *sec, const char *poststr)
-{
-	const char *msg;
-
-	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_SYM_ENTRY_64);
-		else
-			msg = MSG_ORIG(MSG_SYM_L_ENTRY_64);
-	} else {
-		if (DBG_NOTLONG())
-			msg = MSG_ORIG(MSG_SYM_ENTRY);
-		else
-			msg = MSG_ORIG(MSG_SYM_L_ENTRY);
-	}
-
-	dbg_print(msg, prestr, conv_sym_value_str(ehdr->e_machine,
-	    GELF_ST_TYPE(sym->st_info), EC_XWORD(sym->st_value)),
-	    EC_XWORD(sym->st_size),
-	    conv_info_type_str(ehdr->e_machine, GELF_ST_TYPE(sym->st_info)),
-	    conv_info_bind_str(GELF_ST_BIND(sym->st_info)),
-	    conv_sym_stother(sym->st_other), EC_WORD(verndx),
-	    sec ? sec : conv_shndx_str(sym->st_shndx),
-	    _Dbg_sym_dem(poststr));
-}
-
-void
-Gelf_syminfo_title()
-{
-	dbg_print(MSG_INTL(MSG_SYMI_TITLE2));
-}
+#if	!(defined(_ELF64))
 
 void
-Gelf_syminfo_entry(int ndx, GElf_Syminfo *sip, const char *sname,
-    const char *needed)
+Dbg_syms_lookup_aout(Lm_list *lml, const char *name)
 {
-	const char	*bind_str;
-	char		flags[16], index[32], bind_index[32] = " ";
-	int		flgndx = 0;
-	Half		symflags;
-
-	symflags = sip->si_flags;
-
-	if (symflags & SYMINFO_FLG_DIRECT) {
-		if (sip->si_boundto == SYMINFO_BT_SELF)
-			bind_str = MSG_INTL(MSG_SYMI_SELF);
-		else if (sip->si_boundto == SYMINFO_BT_PARENT)
-			bind_str = MSG_INTL(MSG_SYMI_PARENT);
-		else {
-			bind_str = needed;
-			(void) sprintf(bind_index, MSG_ORIG(MSG_FMT_INDEX),
-				sip->si_boundto);
-		}
-		flags[flgndx++] = 'D';
-		symflags &= ~SYMINFO_FLG_DIRECT;
-
-	} else if (symflags & (SYMINFO_FLG_FILTER | SYMINFO_FLG_AUXILIARY)) {
-		bind_str = needed;
-		(void) sprintf(bind_index, MSG_ORIG(MSG_FMT_INDEX),
-		    sip->si_boundto);
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
 
-		if (symflags & SYMINFO_FLG_FILTER) {
-			flags[flgndx++] = 'F';
-			symflags &= ~SYMINFO_FLG_FILTER;
-		}
-		if (symflags & SYMINFO_FLG_AUXILIARY) {
-			flags[flgndx++] = 'A';
-			symflags &= ~SYMINFO_FLG_AUXILIARY;
-		}
-	} else if (sip->si_boundto == SYMINFO_BT_EXTERN) {
-		bind_str = MSG_INTL(MSG_SYMI_EXTERN);
-	} else
-		bind_str = MSG_ORIG(MSG_STR_EMPTY);
-
-	if (symflags & SYMINFO_FLG_DIRECTBIND) {
-		flags[flgndx++] = 'B';
-		symflags &= ~SYMINFO_FLG_DIRECTBIND;
-	}
-	if (symflags & SYMINFO_FLG_COPY) {
-		flags[flgndx++] = 'C';
-		symflags &= ~SYMINFO_FLG_COPY;
-	}
-	if (symflags & SYMINFO_FLG_LAZYLOAD) {
-		flags[flgndx++] = 'L';
-		symflags &= ~SYMINFO_FLG_LAZYLOAD;
-	}
-	if (symflags & SYMINFO_FLG_NOEXTDIRECT) {
-		flags[flgndx++] = 'N';
-		symflags &= ~SYMINFO_FLG_NOEXTDIRECT;
-	}
-
-	/*
-	 * Did we account for all of the flags?
-	 */
-	if (symflags)
-		(void) sprintf(&flags[flgndx], " 0x%x", symflags);
-	else
-		flags[flgndx] = '\0';
-
-	(void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx);
-	dbg_print(MSG_ORIG(MSG_SYMI_FMT), index, flags, bind_index, bind_str,
-	    _Dbg_sym_dem(sname));
+	dbg_print(lml, MSG_INTL(MSG_SYM_AOUT), Dbg_demangle_name(name));
 }
 
-
-const char *
-Gelf_sym_dem(const char *name)
-{
-	return (conv_sym_dem(name));
-}
-
-const char *
-_Dbg_sym_dem(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_DEMANGLE))
-		return (name);
-
-	return (conv_sym_dem(name));
-}
-
-void
-Dbg_syms_ar_title(const char *file, int again)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_AR_FILE), file,
-	    again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY));
-}
-
-void
-Dbg_syms_lazy_rescan(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS | DBG_FILES))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_LAZY_RESCAN), _Dbg_sym_dem(name));
-}
-
-#endif /* !defined(_ELF64) */
+#endif
 
 void
-Dbg_syms_ar_entry(Xword ndx, Elf_Arsym *arsym)
+Dbg_syms_lookup(Rt_map *lmp, const char *name, const char *type)
 {
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
+	Lm_list	*lml = LIST(lmp);
 
-	dbg_print(MSG_INTL(MSG_SYM_AR_ENTRY), EC_XWORD(ndx),
-	    _Dbg_sym_dem(arsym->as_name));
-}
-
-void
-Dbg_syms_ar_checking(Xword ndx, Elf_Arsym *arsym, const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
 		return;
 
-	dbg_print(MSG_INTL(MSG_SYM_AR_CHECK), EC_XWORD(ndx),
-	    _Dbg_sym_dem(arsym->as_name), name);
-}
-
-void
-Dbg_syms_ar_resolve(Xword ndx, Elf_Arsym *arsym, const char *fname, int flag)
-{
-	const char	*fmt;
-
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	if (flag)
-		fmt = MSG_INTL(MSG_SYM_AR_FORCEDEXRT);
-	else
-		fmt = MSG_INTL(MSG_SYM_AR_RESOLVE);
-
-	dbg_print(fmt, EC_XWORD(ndx), _Dbg_sym_dem(arsym->as_name), fname);
-}
-
-void
-Dbg_syms_spec_title()
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_SPECIAL));
+	dbg_print(lml, MSG_INTL(MSG_SYM_LOOKUP), Dbg_demangle_name(name),
+	    NAME(lmp), type);
 }
 
 void
-Dbg_syms_discarded(Sym_desc *sdp, Is_desc *disp)
-{
-	const char	*sectname;
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	if ((sectname = disp->is_basename) == 0)
-		sectname = disp->is_name;
-
-	dbg_print(MSG_INTL(MSG_SYM_DISCARDED), _Dbg_sym_dem(sdp->sd_name),
-		sectname, disp->is_file->ifl_name);
-}
-
-
-void
-Dbg_syms_entered(Ehdr *ehdr, Sym *sym, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_ENTERED), ehdr, sym, sdp->sd_aux ?
-	    sdp->sd_aux->sa_overndx : 0, NULL, conv_deftag_str(sdp->sd_ref));
-}
-
-void
-Dbg_syms_process(Ifl_desc *ifl)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
-	    conv_etype_str(ifl->ifl_ehdr->e_type));
-}
-
-void
-Dbg_syms_entry(Xword ndx, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_BASIC), EC_XWORD(ndx),
-	    _Dbg_sym_dem(sdp->sd_name));
-}
-
-void
-Dbg_syms_global(Xword ndx, const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_ADDING), EC_XWORD(ndx), _Dbg_sym_dem(name));
-}
-
-void
-Dbg_syms_sec_title()
+Dbg_syms_dlsym(Rt_map *clmp, const char *sym, const char *next, int flag)
 {
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_INDEX));
-}
-
-void
-Dbg_syms_sec_entry(int ndx, Sg_desc *sgp, Os_desc *osp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_SECTION), ndx, osp->os_name,
-		(*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
-}
-
-void
-Dbg_syms_up_title(Ehdr *ehdr)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_FINAL));
-	/* LINTED */
-	Gelf_sym_table_title((GElf_Ehdr *)ehdr,
-	    MSG_ORIG(MSG_STR_EMPTY), MSG_ORIG(MSG_STR_EMPTY));
-}
-
-void
-Dbg_syms_ignore(Ehdr *ehdr, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_IGNORE), ehdr, sdp->sd_sym,
-	    0, NULL, MSG_INTL(MSG_STR_UNUSED));
-}
-
-void
-Dbg_syms_old(Ehdr *ehdr, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_OLD), ehdr, sdp->sd_sym,
-	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_name);
-}
-
-void
-Dbg_syms_new(Ehdr *ehdr, Sym *sym, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
+	const char	*str, *from = NAME(clmp);
+	Lm_list		*lml = LIST(clmp);
 
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_NEW), ehdr, sym,
-	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-	    conv_deftag_str(sdp->sd_ref));
-}
-
-void
-Dbg_syms_updated(Ehdr *ehdr, Sym_desc *sdp, const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_UPDATE), name);
-
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_ORIG(MSG_STR_EMPTY), ehdr, sdp->sd_sym,
-	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-	    conv_deftag_str(sdp->sd_ref));
-}
-
-void
-Dbg_syms_created(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_CREATE), _Dbg_sym_dem(name));
-}
-
-void
-Dbg_syms_resolving1(Xword ndx, const char *name, int row, int col)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_RESOLVING), EC_XWORD(ndx),
-	    _Dbg_sym_dem(name), row, col);
-}
-
-void
-Dbg_syms_resolving2(Ehdr *ehdr, Sym *osym, Sym *nsym, Sym_desc *sdp,
-	Ifl_desc *ifl)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_OLD), ehdr, osym, sdp->sd_aux ?
-	    sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_file->ifl_name);
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_NEW), ehdr, nsym, 0, NULL,
-	    ifl->ifl_name);
-}
-
-void
-Dbg_syms_resolved(Ehdr *ehdr, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_INTL(MSG_STR_RESOLVED), ehdr, sdp->sd_sym,
-	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-	    conv_deftag_str(sdp->sd_ref));
-}
-
-void
-Dbg_syms_nl()
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-}
-
-static Boolean	symbol_title = TRUE;
-
-static void
-_Dbg_syms_reloc_title()
-{
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYM_BSS));
-
-	symbol_title = FALSE;
-}
-void
-Dbg_syms_reloc(Ehdr *ehdr, Sym_desc *sdp)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	if (symbol_title)
-		_Dbg_syms_reloc_title();
-	dbg_print(MSG_INTL(MSG_SYM_UPDATE), _Dbg_sym_dem(sdp->sd_name));
-
-	if (DBG_NOTDETAIL())
-		return;
-
-	Elf_sym_table_entry(MSG_ORIG(MSG_SYM_COPY), ehdr, sdp->sd_sym,
-	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
-	    conv_deftag_str(sdp->sd_ref));
-}
-
-void
-Dbg_syms_lookup_aout(const char *name)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_AOUT), _Dbg_sym_dem(name));
-}
-
-void
-Dbg_syms_lookup(const char *name, const char *file, const char *type)
-{
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
-		return;
-
-	dbg_print(MSG_INTL(MSG_SYM_LOOKUP), _Dbg_sym_dem(name), file, type);
-}
-
-void
-Dbg_syms_dlsym(const char *sym, const char *from, const char *next, int flag)
-{
-	const char	*str;
-
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
 		return;
 
 	if (flag == DBG_DLSYM_NEXT)
@@ -535,76 +76,381 @@
 	else
 		str = MSG_ORIG(MSG_STR_EMPTY);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
 	if (next == 0)
-		dbg_print(MSG_INTL(MSG_SYM_DLSYM_1), _Dbg_sym_dem(sym),
-		    from, str);
+		dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_1),
+		    Dbg_demangle_name(sym), from, str);
+	else
+		dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_2),
+		    Dbg_demangle_name(sym), from, next, str);
+}
+
+void
+Dbg_syms_lazy_rescan(Lm_list *lml, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_FILES))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_LAZY_RESCAN), Dbg_demangle_name(name));
+}
+
+void
+Dbg_syms_ar_title(Lm_list *lml, const char *file, int again)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_AR_FILE), file,
+	    again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY));
+}
+
+void
+Dbg_syms_ar_entry(Lm_list *lml, Xword ndx, Elf_Arsym *arsym)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_AR_ENTRY), EC_XWORD(ndx),
+	    Dbg_demangle_name(arsym->as_name));
+}
+
+void
+Dbg_syms_ar_checking(Lm_list *lml, Xword ndx, Elf_Arsym *arsym,
+    const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_AR_CHECK), EC_XWORD(ndx),
+	    Dbg_demangle_name(arsym->as_name), name);
+}
+
+void
+Dbg_syms_ar_resolve(Lm_list *lml, Xword ndx, Elf_Arsym *arsym,
+    const char *fname, int flag)
+{
+	const char	*fmt;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	if (flag)
+		fmt = MSG_INTL(MSG_SYM_AR_FORCEDEXRT);
 	else
-		dbg_print(MSG_INTL(MSG_SYM_DLSYM_2), _Dbg_sym_dem(sym),
-		    from, next, str);
+		fmt = MSG_INTL(MSG_SYM_AR_RESOLVE);
+
+	dbg_print(lml, fmt, EC_XWORD(ndx), Dbg_demangle_name(arsym->as_name),
+	    fname);
+}
+
+void
+Dbg_syms_spec_title(Lm_list *lml)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_SPECIAL));
+}
+
+void
+Dbg_syms_discarded(Lm_list *lml, Sym_desc *sdp, Is_desc *disp)
+{
+	const char	*sectname;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	if ((sectname = disp->is_basename) == 0)
+		sectname = disp->is_name;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_DISCARDED),
+	    Dbg_demangle_name(sdp->sd_name), sectname, disp->is_file->ifl_name);
+}
+
+void
+Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
+{
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED),
+	    ofl->ofl_dehdr->e_machine, sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    conv_def_tag(sdp->sd_ref));
+}
+
+void
+Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name,
+	    conv_ehdr_type(ifl->ifl_ehdr->e_type));
+}
+
+void
+Dbg_syms_entry(Lm_list *lml, Word ndx, Sym_desc *sdp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_BASIC), EC_WORD(ndx),
+	    Dbg_demangle_name(sdp->sd_name));
+}
+
+void
+Dbg_syms_global(Lm_list *lml, Word ndx, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_ADDING), EC_WORD(ndx),
+	    Dbg_demangle_name(name));
+}
+
+void
+Dbg_syms_sec_title(Lm_list *lml)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_INDEX));
 }
 
 void
-Dbg_syms_reduce(int which, Ehdr *ehdr, Sym_desc *sdp,
-    int idx, const char *sname)
+Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name,
+	    (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL)));
+}
+
+void
+Dbg_syms_up_title(Lm_list *lml)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYM_FINAL));
+	Elf_syms_table_title(lml, ELF_DBG_LD);
+}
+
+void
+Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym, 0, NULL,
+	    MSG_INTL(MSG_STR_UNUSED));
+}
+
+void
+Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_name);
+}
+
+void
+Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
+	    ofl->ofl_dehdr->e_machine, sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    conv_def_tag(sdp->sd_ref));
+}
+
+void
+Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name)
+{
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name);
+
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    conv_def_tag(sdp->sd_ref));
+}
+
+void
+Dbg_syms_created(Lm_list *lml, const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name));
+}
+
+void
+Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row,
+    int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl)
+{
+	Lm_list	*lml = ofl->ofl_lml;
+	Half	mach = ofl->ofl_dehdr->e_machine;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx),
+	    Dbg_demangle_name(name), row, col);
+
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD),
+	    mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    sdp->sd_file->ifl_name);
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW),
+	    mach, nsym, 0, NULL, ifl->ifl_name);
+}
+
+void
+Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp)
+{
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD,
+	    MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_machine, sdp->sd_sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    conv_def_tag(sdp->sd_ref));
+}
+
+void
+Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp)
+{
+	static Boolean	symbol_title = TRUE;
+	Lm_list	*lml = ofl->ofl_lml;
+
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
+		return;
+
+	if (symbol_title) {
+		Dbg_util_nl(lml, DBG_NL_STD);
+		dbg_print(lml, MSG_INTL(MSG_SYM_BSS));
+
+		symbol_title = FALSE;
+	}
+	dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE),
+	    Dbg_demangle_name(sdp->sd_name));
+
+	if (DBG_NOTDETAIL())
+		return;
+
+	Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
+	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
+	    conv_def_tag(sdp->sd_ref));
+}
+
+void
+Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx,
+    const char *sname)
 {
 	static Boolean	sym_reduce_title = TRUE;
 	static Boolean	sym_retain_title = TRUE;
 	Boolean		isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL);
 	Boolean		isfromretain = (which == DBG_SYM_REDUCE_RETAIN);
+	Lm_list		*lml = ofl->ofl_lml;
 
-	if (DBG_NOTCLASS(DBG_SYMBOLS | DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS))
 		return;
 
 	if (sym_reduce_title && isfromglobal) {
 		sym_reduce_title = FALSE;
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_SYM_REDUCED));
+		Dbg_util_nl(lml, DBG_NL_STD);
+		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED));
 	} else if (sym_retain_title && isfromretain) {
 		sym_retain_title = FALSE;
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-		dbg_print(MSG_INTL(MSG_SYM_RETAINING));
+		Dbg_util_nl(lml, DBG_NL_STD);
+		dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
 	}
 
 	if ((sdp->sd_flags1 & FLG_SY1_ELIM) && isfromglobal)
-		dbg_print(MSG_INTL(MSG_SYM_ELIMINATING),
-		    _Dbg_sym_dem(sdp->sd_name));
+		dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
+		    Dbg_demangle_name(sdp->sd_name));
 	else if (isfromglobal)
-		dbg_print(MSG_INTL(MSG_SYM_REDUCING),
-		    _Dbg_sym_dem(sdp->sd_name));
+		dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING),
+		    Dbg_demangle_name(sdp->sd_name));
 	else
-		dbg_print(MSG_INTL(MSG_SYM_NOTELIMINATE),
-		    _Dbg_sym_dem(sdp->sd_name), sname, idx);
+		dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE),
+		    Dbg_demangle_name(sdp->sd_name), sname, idx);
 
 	if (DBG_NOTDETAIL())
 		return;
 
-	Elf_sym_table_entry(MSG_ORIG(MSG_SYM_LOCAL), ehdr, sdp->sd_sym,
+	Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL),
+	    ofl->ofl_dehdr->e_machine, sdp->sd_sym,
 	    sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL,
 	    sdp->sd_file->ifl_name);
 }
 
-
 void
-Dbg_syminfo_title()
+Dbg_syminfo_title(Lm_list *lml)
 {
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_SYMI_TITLE1));
-	Gelf_syminfo_title();
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO));
+	Elf_syminfo_title(lml);
 }
 
 void
-Dbg_syminfo_entry(int ndx, Syminfo *sip, Sym *sym, const char *strtab,
-	Dyn *dyn)
+Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym,
+    const char *strtab, Dyn *dyn)
 {
 	const char	*needed;
 
-	if (DBG_NOTCLASS(DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_SYMBOLS))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -614,6 +460,58 @@
 	else
 		needed = 0;
 
-	Gelf_syminfo_entry(ndx, (GElf_Syminfo *)sip,
-	    _Dbg_sym_dem(strtab + sym->st_name), needed);
+	Elf_syminfo_entry(lml, ndx, sip,
+	    Dbg_demangle_name(strtab + sym->st_name), needed);
 }
+
+/*
+ * Symbol table output can differ slightly depending on the caller.  However,
+ * the final diagnostic is maintained here so hat the various message strings
+ * remain consistent
+ *
+ * elfdump:   index    value       size     type bind oth ver shndx       name
+ * ld:                 value       size     type bind oth ver shndx
+ */
+void
+Elf_syms_table_title(Lm_list *lml, int caller)
+{
+	if (caller == ELF_DBG_ELFDUMP) {
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE));
+		else
+			dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE));
+		return;
+	}
+
+	if (caller == ELF_DBG_LD) {
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE));
+		else
+			dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE));
+		return;
+	}
+}
+
+void
+Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr, Half mach,
+    Sym *sym, Word verndx, const char *sec, const char *poststr)
+{
+	uchar_t		type = ELF_ST_TYPE(sym->st_info);
+	uchar_t		bind = ELF_ST_BIND(sym->st_info);
+	const char	*msg;
+
+	if ((caller == ELF_DBG_ELFDUMP) ||
+	    (caller == ELF_DBG_LD)) {
+		if (DBG_NOTLONG())
+			msg = MSG_INTL(MSG_SYM_EFS_ENTRY);
+		else
+			msg = MSG_INTL(MSG_SYM_EFL_ENTRY);
+
+		dbg_print(lml, msg, prestr,
+		    conv_sym_value(mach, type, sym->st_value), sym->st_size,
+		    conv_sym_info_type(mach, type), conv_sym_info_bind(bind),
+		    conv_sym_other(sym->st_other), verndx,
+		    sec ? sec : conv_sym_shndx(sym->st_shndx),
+		    Elf_demangle_name(poststr));
+	}
+}
--- a/usr/src/cmd/sgs/liblddbg/common/tls.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/tls.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,65 +18,68 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<link.h>
-#include	<stdio.h>
 #include	<libc_int.h>
 #include	<rtld.h>
+#include	<debug.h>
 #include	"msg.h"
 #include	"_debug.h"
 
 static void
-tls_modent(TLS_modinfo * tmodent)
+Dbg_tls_modent(Lm_list *lml, TLS_modinfo * tmodent)
 {
-	dbg_print(MSG_INTL(MSG_TLS_STMODENT1),
-		EC_XWORD((uintptr_t)tmodent->tm_tlsblock),
-		EC_XWORD(tmodent->tm_stattlsoffset),
-		EC_XWORD(tmodent->tm_flags));
-	dbg_print(MSG_INTL(MSG_TLS_STMODENT2),
-		EC_XWORD(tmodent->tm_filesz),
-		EC_XWORD(tmodent->tm_memsz),
-		EC_XWORD(tmodent->tm_modid));
+	dbg_print(lml, MSG_INTL(MSG_TLS_STMODENT1),
+	    EC_XWORD((uintptr_t)tmodent->tm_tlsblock),
+	    EC_XWORD(tmodent->tm_stattlsoffset), EC_XWORD(tmodent->tm_flags));
+	dbg_print(lml, MSG_INTL(MSG_TLS_STMODENT2),
+	    EC_XWORD(tmodent->tm_filesz), EC_XWORD(tmodent->tm_memsz),
+	    EC_XWORD(tmodent->tm_modid));
 }
 
 void
-Dbg_tls_static_block(void * vtlsmodlist, unsigned long tlsstatsize)
+Dbg_tls_static_block(Lm_list *lml, void *vtlsmodlist, ulong_t tlsstatsize)
 {
-	unsigned int	i;
+	uint_t		i;
 	TLS_modinfo **	tlsmodlist;
 
-	if (DBG_NOTCLASS(DBG_TLS))
+	if (DBG_NOTCLASS(DBG_C_TLS))
 		return;
+
 	tlsmodlist = (TLS_modinfo **)vtlsmodlist;
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+
 	for (i = 0; tlsmodlist[i]; i++) {
-		dbg_print(MSG_INTL(MSG_TLS_STATBLOCK1),
-			i, tlsmodlist[i]->tm_modname);
-		tls_modent(tlsmodlist[i]);
+		dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK1), i,
+		    tlsmodlist[i]->tm_modname);
+		Dbg_tls_modent(lml, tlsmodlist[i]);
 	}
-	dbg_print(MSG_INTL(MSG_TLS_STATBLOCK2), EC_XWORD(tlsstatsize));
+	dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK2), EC_XWORD(tlsstatsize));
 }
 
-
 void
-Dbg_tls_modactivity(void * vtlsmodent, uint_t flag)
+Dbg_tls_modactivity(Lm_list *lml, void *vtlsmodent, uint_t flag)
 {
 	const char	*str;
 	TLS_modinfo	*tlsmodent;
-	if (DBG_NOTCLASS(DBG_TLS))
+
+	if (DBG_NOTCLASS(DBG_C_TLS))
 		return;
+
 	if (flag == TM_FLG_MODADD)
 		str = MSG_INTL(MSG_TLS_ADD);
 	else
 		str = MSG_INTL(MSG_TLS_REMOVE);
+
 	tlsmodent = (TLS_modinfo *)vtlsmodent;
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_TLS_MODACT), str, tlsmodent->tm_modname);
-	tls_modent(tlsmodent);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_TLS_MODACT), str, tlsmodent->tm_modname);
+	Dbg_tls_modent(lml, tlsmodent);
 }
--- a/usr/src/cmd/sgs/liblddbg/common/unused.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/unused.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,11 +30,34 @@
 #include	"libld.h"
 
 void
-Dbg_unused_sec(Is_desc *isp)
+Dbg_unused_rtldinfo(Rt_map *lmp)
+{
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_UNUSED))
+		return;
+
+	dbg_print(lml, MSG_INTL(MSG_USD_RTLDINFO), NAME(lmp),
+	    NAME(lml->lm_info_lmp));
+}
+
+void
+Dbg_unused_unref(Rt_map *lmp, const char *depend)
+{
+	if (DBG_NOTCLASS(DBG_C_UNUSED))
+		return;
+	if (DBG_NOTDETAIL())
+		return;
+
+	dbg_print(LIST(lmp), MSG_INTL(MSG_USD_UNREF), NAME(lmp), depend);
+}
+
+void
+Dbg_unused_sec(Lm_list *lml, Is_desc *isp)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_UNUSED))
+	if (DBG_NOTCLASS(DBG_C_UNUSED))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -54,47 +76,20 @@
 	else
 		str = MSG_ORIG(MSG_STR_EMPTY);
 
-	dbg_print(MSG_INTL(MSG_USD_SEC), isp->is_basename,
+	dbg_print(lml, MSG_INTL(MSG_USD_SEC), isp->is_basename,
 	    EC_XWORD(isp->is_shdr->sh_size), isp->is_file->ifl_name, str);
 }
 
-/*
- * There are no ELF32/ELF64 data structures in these functions - only define
- * one copy in liblddbg.
- */
-#if	!defined(_ELF64)
-
 void
-Dbg_unused_file(const char *name, int needstr, int cycle)
+Dbg_unused_file(Lm_list *lml, const char *name, int needstr, uint_t cycle)
 {
-	if (DBG_NOTCLASS(DBG_UNUSED))
+	if (DBG_NOTCLASS(DBG_C_UNUSED))
 		return;
 
 	if (needstr)
-		dbg_print(MSG_INTL(MSG_USD_NEEDSTR), name);
+		dbg_print(lml, MSG_INTL(MSG_USD_NEEDSTR), name);
 	else if (cycle)
-		dbg_print(MSG_INTL(MSG_USD_FILECYCLIC), name, cycle);
+		dbg_print(lml, MSG_INTL(MSG_USD_FILECYCLIC), name, cycle);
 	else
-		dbg_print(MSG_INTL(MSG_USD_FILE), name);
+		dbg_print(lml, MSG_INTL(MSG_USD_FILE), name);
 }
-
-void
-Dbg_unused_unref(const char *caller, const char *depend)
-{
-	if (DBG_NOTCLASS(DBG_UNUSED))
-		return;
-	if (DBG_NOTDETAIL())
-		return;
-
-	dbg_print(MSG_INTL(MSG_USD_UNREF), caller, depend);
-}
-
-void
-Dbg_unused_rtldinfo(const char *fname1, const char *fname2)
-{
-	if (DBG_NOTCLASS(DBG_UNUSED))
-		return;
-
-	dbg_print(MSG_INTL(MSG_USD_RTLDINFO), fname1, fname2);
-}
-#endif
--- a/usr/src/cmd/sgs/liblddbg/common/util.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/util.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -30,32 +30,26 @@
 #include	"libld.h"
 
 /*
- * Generic new line generator.
- */
-void
-Dbg_util_nl()
-{
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-}
-
-/*
  * If any run-time linker debugging is being carried out always indicate the
  * fact and specify the point at which we transfer control to the main program.
  */
 void
-Dbg_util_call_main(const char *name)
+Dbg_util_call_main(Rt_map *lmp)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_TRANS), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Lm_list	*lml = LIST(lmp);
+
+	Dbg_util_nl(lml, DBG_NL_FRC);
+	dbg_print(lml, MSG_INTL(MSG_UTL_TRANS), NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_FRC);
 }
 
 void
-Dbg_util_call_init(const char *name, int flag)
+Dbg_util_call_init(Rt_map *lmp, int flag)
 {
-	const char *str;
+	Lm_list		*lml = LIST(lmp);
+	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 
 	if (flag == DBG_INIT_SORT)
@@ -67,37 +61,41 @@
 	else
 		str = MSG_INTL(MSG_UTL_DONE);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_INIT), str, name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_INIT), str, NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_no_init(const char *name)
+Dbg_util_no_init(Rt_map *lmp)
 {
-	if (DBG_NOTCLASS(DBG_INIT))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_NOINIT), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_NOINIT), NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_intoolate(const char *name)
+Dbg_util_intoolate(Rt_map *lmp)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_INTOOLATE), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Lm_list	*lml = LIST(lmp);
+
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_INTOOLATE), NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_dbnotify(rd_event_e event, r_state_e state)
+Dbg_util_dbnotify(Lm_list *lml, rd_event_e event, r_state_e state)
 {
 	const char	*estr;
 	const char	*sstr;
 
-	if (DBG_NOTCLASS(DBG_FILES))
+	if (DBG_NOTCLASS(DBG_C_FILES))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -134,18 +132,18 @@
 		break;
 	}
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_DBNOTIFY), estr, sstr);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_DBNOTIFY), estr, sstr);
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_call_array(const char *libname, void *addr, uint_t ndx,
-	uint_t shtype)
+Dbg_util_call_array(Rt_map *lmp, void *addr, int ndx, Word shtype)
 {
+	Lm_list		*lml = LIST(lmp);
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 
 	if (shtype == SHT_INIT_ARRAY)
@@ -154,34 +152,40 @@
 		str = MSG_ORIG(MSG_SCN_FINIARRAY);
 	else
 		str = MSG_ORIG(MSG_SCN_PREINITARRAY);
-	dbg_print(MSG_INTL(MSG_UTL_ARRAY), str, ndx, EC_ADDR(addr), libname);
+
+	dbg_print(lml, MSG_INTL(MSG_UTL_ARRAY), str, ndx, EC_NATPTR(addr),
+	    NAME(lmp));
 }
 
 void
-Dbg_util_call_fini(const char *name)
+Dbg_util_call_fini(Rt_map *lmp)
 {
-	if (DBG_NOTCLASS(DBG_INIT))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_FINI), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_FINI), NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_str(const char *name)
+Dbg_util_str(Lm_list *lml, const char *str)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_ORIG(MSG_FMT_STR), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	Dbg_util_nl(lml, DBG_NL_FRC);
+	dbg_print(lml, MSG_ORIG(MSG_FMT_STR), str);
+	Dbg_util_nl(lml, DBG_NL_FRC);
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_scc_title(int sec)
+Dbg_util_scc_title(Lm_list *lml, int sec)
 {
 	const char	*_sec;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -191,40 +195,43 @@
 	else
 		_sec = MSG_INTL(MSG_UTL_SCC_SUBF);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_SCC_TITLE), _sec);
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_SCC_TITLE), _sec);
 }
 
 void
-Dbg_util_scc_entry(uint_t idx, const char *name)
+Dbg_util_scc_entry(Rt_map *lmp, uint_t idx)
 {
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_UTL_SCC_ENTRY), idx, name);
+	dbg_print(LIST(lmp), MSG_ORIG(MSG_UTL_SCC_ENTRY), idx, NAME(lmp));
 }
 
 void
-Dbg_util_broadcast(const char *name)
+Dbg_util_broadcast(Rt_map *lmp)
 {
-	if (DBG_NOTCLASS(DBG_INIT))
+	Lm_list	*lml = LIST(lmp);
+
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_BROAD), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_BROAD), NAME(lmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 void
-Dbg_util_wait(int what, const char *cname, const char *dname)
+Dbg_util_wait(Rt_map *clmp, Rt_map *dlmp, int what)
 {
+	Lm_list		*lml = LIST(clmp);
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -236,19 +243,20 @@
 	else
 		str = MSG_INTL(MSG_STR_SYMBOL);
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_UTL_WAIT), str, cname, dname);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_UTL_WAIT), str, NAME(clmp), NAME(dlmp));
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
 static	int ectoggle = 0;
 
 void
-Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag)
+Dbg_util_edge_in(Lm_list *lml, Rt_map *clmp, uint_t flags, Rt_map *dlmp,
+    int ndx, int flag)
 {
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -259,34 +267,36 @@
 		str = MSG_ORIG(MSG_SCN_FINI);
 
 	if ((clmp == 0) || (ectoggle == 0))
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		Dbg_util_nl(lml, DBG_NL_STD);
 	if (clmp == 0) {
-		dbg_print(MSG_INTL(MSG_UTL_EDGE_TITLE), str);
-		dbg_print(MSG_INTL(MSG_UTL_EDGE_START), ndx, NAME(dlmp));
+		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_TITLE), str);
+		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_START), ndx, NAME(dlmp));
 	} else
-		dbg_print(MSG_INTL(MSG_UTL_EDGE_IN), ndx, NAME(dlmp),
-		    NAME(clmp), conv_bindent_str(flags));
+		dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_IN), ndx, NAME(dlmp),
+		    NAME(clmp), conv_bnd_type(flags));
 
 	ectoggle = 1;
 }
 
 void
-Dbg_util_edge_out(const char *cname, int ndx, const char *dname)
+Dbg_util_edge_out(Rt_map *clmp, Rt_map *dlmp)
 {
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
 
-	dbg_print(MSG_INTL(MSG_UTL_EDGE_OUT), ndx, cname, dname);
+	dbg_print(LIST(clmp), MSG_INTL(MSG_UTL_EDGE_OUT), SORTVAL(clmp),
+	    NAME(clmp), NAME(dlmp));
 }
 
 void
-Dbg_util_collect(const char *name, int ndx, int flag)
+Dbg_util_collect(Rt_map *lmp, int ndx, int flag)
 {
+	Lm_list		*lml = LIST(lmp);
 	const char	*str;
 
-	if (DBG_NOTCLASS(DBG_INIT))
+	if (DBG_NOTCLASS(DBG_C_INIT))
 		return;
 	if (DBG_NOTDETAIL())
 		return;
@@ -297,8 +307,47 @@
 		str = MSG_ORIG(MSG_SCN_FINI);
 
 	if (ectoggle == 1) {
-		dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+		Dbg_util_nl(lml, DBG_NL_STD);
 		ectoggle = 0;
 	}
-	dbg_print(MSG_INTL(MSG_UTL_COLLECT), ndx, name, str);
+	dbg_print(lml, MSG_INTL(MSG_UTL_COLLECT), ndx, NAME(lmp), str);
+}
+
+/*
+ * Generic new line generator.  To prevent multiple newlines from being
+ * generated, a flag is maintained in the global debug descriptor.  This flag
+ * is cleared by the callers dbg_print() function to indicate that a newline
+ * (actually, any line) has been printed.  Multiple newlines can be generated
+ * using the DBG_NL_FRC flag.
+ */
+void
+Dbg_util_nl(Lm_list *lml, int flag)
+{
+	if ((flag == DBG_NL_STD) && (dbg_desc->d_extra & DBG_E_STDNL))
+		return;
+
+	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
+
+	if (flag == DBG_NL_STD)
+		dbg_desc->d_extra |= DBG_E_STDNL;
 }
+
+/*
+ * Define name demanglers.
+ */
+const char *
+Dbg_demangle_name(const char *name)
+{
+	if (DBG_NOTCLASS(DBG_C_DEMANGLE))
+		return (name);
+
+	return (conv_demangle_name(name));
+}
+
+const char *
+Elf_demangle_name(const char *name)
+{
+	if (DBG_ISDEMANGLE())
+		return (conv_demangle_name(name));
+	return (name);
+}
--- a/usr/src/cmd/sgs/liblddbg/common/version.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/version.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,117 +18,80 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<link.h>
-#include	<stdio.h>
+#include	<debug.h>
 #include	"msg.h"
 #include	"_debug.h"
 
-#if	!defined(_ELF64)
 void
-Gelf_ver_def_title()
+Dbg_ver_avail_title(Lm_list *lml, const char *file)
 {
-	dbg_print(MSG_ORIG(MSG_VER_DEF_2));
-}
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
+		return;
 
-void
-Gelf_ver_need_title()
-{
-	dbg_print(MSG_ORIG(MSG_VER_NEED_2));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_1), file);
+	dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_2));
 }
 
 void
-Gelf_ver_line_1(const char * index, const char * name, const char * dep,
-    const char * flags)
-{
-	if (DBG_NOTLONG())
-		dbg_print(MSG_ORIG(MSG_VER_LINE_1), index, name, dep, flags);
-	else
-		dbg_print(MSG_ORIG(MSG_VER_L_LINE_1), index, name, dep, flags);
-}
-
-void
-Gelf_ver_line_2(const char * name, const char * dep)
+Dbg_ver_def_title(Lm_list *lml, const char *file)
 {
-	dbg_print(MSG_ORIG(MSG_VER_LINE_2), name, dep);
-}
-
-void
-Gelf_ver_line_3(const char * name, const char * dep, const char * flags)
-{
-	dbg_print(MSG_ORIG(MSG_VER_LINE_3), name, dep, flags);
-}
-
-void
-Dbg_ver_avail_title(const char * file)
-{
-	if (DBG_NOTCLASS(DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_VER_AVAIL_1), file);
-	dbg_print(MSG_INTL(MSG_VER_AVAIL_2));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_VER_DEF_TITLE), file);
+	Elf_ver_def_title(lml);
 }
 
 void
-Dbg_ver_def_title(const char * file)
+Dbg_ver_need_title(Lm_list *lml, const char *file)
 {
-	if (DBG_NOTCLASS(DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
 		return;
 
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_VER_DEF_1), file);
-	Gelf_ver_def_title();
-}
-
-void
-Dbg_ver_need_title(const char * file)
-{
-	if (DBG_NOTCLASS(DBG_VERSIONS))
-		return;
-
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_VER_NEED_1), file);
-	Gelf_ver_need_title();
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_VER_NEED_TITLE), file);
+	Elf_ver_need_title(lml);
 }
 
 void
-Dbg_ver_need_entry(Half cnt, const char * file, const char * version)
+Dbg_ver_need_entry(Lm_list *lml, Half cnt, const char *file,
+    const char *version)
 {
-	if (DBG_NOTCLASS(DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
 		return;
 
-	if (cnt == 0) {
-		if (DBG_NOTLONG())
-			dbg_print(MSG_ORIG(MSG_VER_LINE_5), file, version);
-		else
-			dbg_print(MSG_ORIG(MSG_VER_L_LINE_5), file, version);
-	} else
-		dbg_print(MSG_ORIG(MSG_VER_LINE_4), MSG_ORIG(MSG_STR_EMPTY),
-		    version);
+	if (cnt)
+		Elf_ver_line_4(lml, version);
+	else
+		Elf_ver_line_5(lml, file, version);
 }
 
 void
-Dbg_ver_symbol(const char * name)
+Dbg_ver_symbol(Lm_list *lml, const char *name)
 {
 	static Boolean	ver_symbol_title = TRUE;
 
-	if (DBG_NOTCLASS(DBG_VERSIONS | DBG_SYMBOLS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS | DBG_C_SYMBOLS))
 		return;
 
-	if (DBG_NOTCLASS(DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
 		if (ver_symbol_title) {
 			ver_symbol_title = FALSE;
-			dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-			dbg_print(MSG_INTL(MSG_SYM_VERSION));
+			Dbg_util_nl(lml, DBG_NL_STD);
+			dbg_print(lml, MSG_INTL(MSG_SYM_VERSION));
 		}
 
-	Dbg_syms_created(name);
+	Dbg_syms_created(lml, name);
 }
 
 /*
@@ -137,27 +99,22 @@
  * be generated for any debugging family.
  */
 void
-Dbg_ver_nointerface(const char * name)
+Dbg_ver_nointerface(Lm_list *lml, const char *name)
 {
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
-	dbg_print(MSG_INTL(MSG_VER_NOINTERFACE), name);
-	dbg_print(MSG_ORIG(MSG_STR_EMPTY));
+	Dbg_util_nl(lml, DBG_NL_STD);
+	dbg_print(lml, MSG_INTL(MSG_VER_NOINTERFACE), name);
+	Dbg_util_nl(lml, DBG_NL_STD);
 }
 
-#endif	/* !defined(_ELF64) */
-
-/*
- * Print a version descriptor.
- */
 void
-Dbg_ver_desc_entry(Ver_desc * vdp)
+Dbg_ver_desc_entry(Lm_list *lml, Ver_desc *vdp)
 {
-	const char *	dep;
-	Ver_desc *	_vdp, * __vdp;
+	const char	*dep;
+	Ver_desc	*_vdp, *__vdp;
 	Listnode *	lnp;
 	char		index[10];
 
-	if (DBG_NOTCLASS(DBG_VERSIONS))
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
 		return;
 
 	if (vdp->vd_deps.head) {
@@ -168,8 +125,8 @@
 		dep = MSG_ORIG(MSG_STR_EMPTY);
 	}
 	(void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), vdp->vd_ndx);
-	Gelf_ver_line_1(index, vdp->vd_name, dep,
-	    conv_verflg_str(vdp->vd_flags));
+	Elf_ver_line_1(lml, index, vdp->vd_name, dep,
+	    conv_ver_flags(vdp->vd_flags));
 
 	/*
 	 * Loop through the dependency list in case there are more that one
@@ -178,27 +135,79 @@
 	for (LIST_TRAVERSE(&vdp->vd_deps, lnp, __vdp)) {
 		if (_vdp == __vdp)
 			continue;
-		dbg_print(MSG_ORIG(MSG_VER_LINE_4), MSG_ORIG(MSG_STR_EMPTY),
-		    __vdp->vd_name);
+		Elf_ver_line_4(lml, __vdp->vd_name);
+	}
+}
+
+void
+Dbg_ver_avail_entry(Lm_list *lml, Ver_index *vip, const char *select)
+{
+	if (DBG_NOTCLASS(DBG_C_VERSIONS))
+		return;
+
+	if (select) {
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_ORIG(MSG_VER_SELECTED),
+			    vip->vi_name, select);
+		else
+			dbg_print(lml, MSG_ORIG(MSG_VER_L_SELECTED),
+			    vip->vi_name, select);
+	} else {
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_ORIG(MSG_VER_ALL), vip->vi_name);
+		else
+			dbg_print(lml, MSG_ORIG(MSG_VER_L_ALL), vip->vi_name);
 	}
 }
 
 void
-Dbg_ver_avail_entry(Ver_index * vip, const char * select)
+Elf_ver_def_title(Lm_list *lml)
+{
+	dbg_print(lml, MSG_INTL(MSG_VER_DEF));
+}
+
+void
+Elf_ver_need_title(Lm_list *lml)
 {
-	if (DBG_NOTCLASS(DBG_VERSIONS))
-		return;
+	dbg_print(lml, MSG_INTL(MSG_VER_NEED));
+}
+
+void
+Elf_ver_line_1(Lm_list *lml, const char *index, const char *name,
+    const char *dep, const char *flags)
+{
+	if (DBG_NOTLONG())
+		dbg_print(lml, MSG_INTL(MSG_VER_LINE_1), index, name,
+		    dep, flags);
+	else
+		dbg_print(lml, MSG_INTL(MSG_VER_LLINE_1), index, name,
+		    dep, flags);
+}
 
-	if (select) {
-		if (DBG_NOTLONG())
-		    dbg_print(MSG_ORIG(MSG_VER_SELECTED), vip->vi_name, select);
-		else
-		    dbg_print(MSG_ORIG(MSG_VER_L_SELECTED),
-		    vip->vi_name, select);
-	} else {
-		if (DBG_NOTLONG())
-		    dbg_print(MSG_ORIG(MSG_VER_ALL), vip->vi_name);
-		else
-		    dbg_print(MSG_ORIG(MSG_VER_L_ALL), vip->vi_name);
-	}
+void
+Elf_ver_line_2(Lm_list *lml, const char *name, const char *dep)
+{
+	dbg_print(lml, MSG_INTL(MSG_VER_LINE_2), name, dep);
+}
+
+void
+Elf_ver_line_3(Lm_list *lml, const char *name, const char *dep,
+    const char *flags)
+{
+	dbg_print(lml, MSG_INTL(MSG_VER_LINE_3), name, dep, flags);
 }
+
+void
+Elf_ver_line_4(Lm_list *lml, const char *version)
+{
+	dbg_print(lml, MSG_INTL(MSG_VER_LINE_4), version);
+}
+
+void
+Elf_ver_line_5(Lm_list *lml, const char *file, const char *version)
+{
+	if (DBG_NOTLONG())
+		dbg_print(lml, MSG_INTL(MSG_VER_LINE_5), file, version);
+	else
+		dbg_print(lml, MSG_INTL(MSG_VER_LLINE_5), file, version);
+}
--- a/usr/src/cmd/sgs/liblddbg/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,21 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.com
+include		../Makefile.com
 
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install:	all $(ROOTFS_DYNLIB)
+install \
+package:	all $(ROOTFS_DYNLIB)
 
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.targ
+include		../Makefile.targ
--- a/usr/src/cmd/sgs/liblddbg/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,21 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.com
+include		../Makefile.com
 
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LIBLINKS)
 
-install:	all $(ROOTFS_DYNLIB)
+install \
+package:	all $(ROOTFS_DYNLIB)
 
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.targ
+include		../Makefile.targ
--- a/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,28 +18,33 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1997-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.com
-
-ROOTFS_LIBDIR=		$(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR)
-ROOTFS_DYNLIB64=	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
+include		../Makefile.com
 
-.KEEP_STATE:
-
-all:		$(DYNLIB) $(LIBLINKS)
-
-install:	all $(ROOTFS_DYNLIB64)
-
-include		$(SRC)/cmd/sgs/liblddbg/Makefile.targ
-include		../../Makefile.sub.64
+ROOTFS_LIBDIR64 = \
+		$(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR)
+ROOTFS_DYNLIB64 = \
+		$(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
 
 CONVLIBDIR =	$(CONVLIBDIR64)
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
+
+.KEEP_STATE:
+
+$(ROOTFS_DYNLIB64) :=	FILEMODE= 755
+
+all:		$(DYNLIB) $(LIBLINKS)
+
+install \
+package:	all $(ROOTFS_DYNLIB64)
+
+include		../Makefile.targ
+include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/libldstab/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/libldstab/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -43,7 +43,7 @@
 MAPFILES=	../common/mapfile-vers
 MAPOPTS=	$(MAPFILES:%=-M%)
 
-LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc
 DYNFLAGS +=	$(VERSREF) $(MAPOPTS)
 
 LINTFLAGS +=	-erroff=E_NAME_DECL_NOT_USED_DEF2 \
--- a/usr/src/cmd/sgs/librtld/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -40,12 +40,13 @@
 include		$(SRC)/lib/Makefile.lib
 include		$(SRC)/cmd/sgs/Makefile.com
 
-MAPFILE=	../common/mapfile-vers
+MAPFILES =	../common/mapfile-vers
+MAPOPTS =	$(MAPFILES:%=-M%)
 
 CPPFLAGS +=	-I../../rtld/common -I$(SRCBASE)/lib/libc/inc \
 		-I$(SRCBASE)/uts/common/krtld
-DYNFLAGS +=	$(VERSREF) $(ZLAZYLOAD)
-LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc
+DYNFLAGS +=	$(VERSREF) $(ZLAZYLOAD) '-R$$ORIGIN'
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc
 
 LINTFLAGS +=	-u -erroff=E_NAME_DECL_NOT_USED_DEF2
 LINTFLAGS64 +=	-u -erroff=E_NAME_DECL_NOT_USED_DEF2
@@ -54,7 +55,7 @@
 # '=' is used with extra variables.
 #
 XXXFLAGS=
-$(DYNLIB) :=	XXXFLAGS= $(USE_PROTO) -M$(MAPFILE)
+$(DYNLIB) :=	XXXFLAGS= $(USE_PROTO) $(MAPOPTS)
 DYNFLAGS +=	$(XXXFLAGS)
 
 
--- a/usr/src/cmd/sgs/librtld/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,7 +28,8 @@
 
 include		$(SRC)/cmd/sgs/librtld/Makefile.com
 
-CPPFLAGS += -I../../../../uts/intel/amd64/krtld
+CPPFLAGS +=	-I../../../../uts/intel/amd64/krtld
+MAPFILES +=	../common/mapfile-64-vers
 
 .KEEP_STATE:
 
--- a/usr/src/cmd/sgs/librtld/amd64/_relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/amd64/_relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -32,125 +32,112 @@
 #include	"_librtld.h"
 #include	"_elf.h"
 
-
 /*
  * Undo relocations that have been applied to a memory image.  Basically this
  * involves copying the original files relocation offset into the new image
  * being created.
  */
+/* ARGSUSED3 */
 void
-undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr,
-    Reloc *reloc)
+undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc)
 {
-#if 0		/* XX64 -- fix me */
-	Rel		*rel = vrel;
-	/* LINTED */
-	unsigned long	*_oaddr = (unsigned long *)oaddr;
-	/* LINTED */
-	unsigned long	*_iaddr = (unsigned long *)iaddr;
+	Rela		*rel = vrel;
+	const Rel_entry	*rep;
+	Xword		rtype = ELF_R_TYPE(rel->r_info);
+	ulong_t		*_oaddr;
+	ulong_t		*_iaddr;
 
-	switch (ELF_R_TYPE(rel->r_info)) {
-	case R_386_NONE:
+	switch (rtype) {
+	case R_AMD64_NONE:
 		break;
-
-	case R_386_COPY:
+	case R_AMD64_COPY:
 		(void) memset((void *)oaddr, 0, (size_t)reloc->r_size);
 		break;
+	case R_AMD64_JUMP_SLOT:
+		/* LINTED */
+		_oaddr = (unsigned long *)oaddr;
+		/* LINTED */
+		_iaddr = (unsigned long *)iaddr;
 
-	case R_386_JMP_SLOT:
-		if (_iaddr)
-			*_oaddr = *_iaddr + reloc->r_value;
-		else
-			*_oaddr = reloc->r_value;
+		if (_iaddr) {
+			*_oaddr++ = *_iaddr++;
+			*_oaddr++ = *_iaddr++;
+			*_oaddr = *_iaddr;
+		} else {
+			*_oaddr++ = 0;
+			*_oaddr++ = 0;
+			*_oaddr = 0;
+		}
 		break;
-
 	default:
-		if (_iaddr)
-			*_oaddr = *_iaddr;
+		rep = &reloc_table[rtype];
+		if (iaddr)
+			(void) memcpy(oaddr, iaddr, rep->re_fsize);
 		else
-			*_oaddr = 0;
-		break;
+			(void) memset(oaddr, 0, rep->re_fsize);
 	}
-#endif	/* XX64 -- fix me */
 }
 
-
 /*
  * Copy a relocation record and increment its value.  The record must reflect
- * the new address to which this image is fixed.  Note that .got entries
- * associated with .plt's must be fixed to the new base address.
+ * the new address to which this image is fixed.
  */
+/* ARGSUSED3 */
 void
-inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr,
-    unsigned char *iaddr)
+inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr,
+    uchar_t *iaddr)
 {
-#if 0		/* XX64 -- fix me */
-	Rel		*nrel = vnrel;
-	Rel		*orel = vorel;
-	/* LINTED */
-	unsigned long	*_oaddr = (unsigned long *)oaddr;
-	/* LINTED */
-	unsigned long	*_iaddr = (unsigned long *)iaddr;
-
-	if (ELF_R_TYPE(nrel->r_info) == R_386_JMP_SLOT) {
-		if (_iaddr)
-			*_oaddr = *_iaddr + reloc->r_value;
-		else
-			*_oaddr = reloc->r_value;
-	}
+	Rela	*nrel = vnrel;
+	Rela	*orel = vorel;
 
 	*nrel = *orel;
 	nrel->r_offset += reloc->r_value;
-#endif	/* XX64 -- fix me */
 }
 
-
 /*
  * Clear a relocation record.  The relocation has been applied to the image and
  * thus the relocation must not occur again.
  */
 void
-clear_reloc(void * vrel)
+clear_reloc(void *vrel)
 {
-#if 0		/* XX64 -- fix me */
-	Rel *	rel = vrel;
+	Rela	*rel = vrel;
 
 	rel->r_offset = 0;
-	rel->r_info = ELF_R_INFO(0, R_386_NONE);
-#endif	/* XX64 -- fix me */
+	rel->r_info = ELF_R_INFO(0, R_AMD64_NONE);
+	rel->r_addend = 0;
 }
 
-
 /*
  * Apply a relocation to an image being built from an input file.  Use the
  * runtime linkers routines to do the necessary magic.
  */
 void
-apply_reloc(void *vrel, Reloc *reloc, const char *name,
-    unsigned char *oaddr, Rt_map *lmp)
+apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr,
+    Rt_map *lmp)
 {
-#if 0		/* XX64 -- fix me */
-	Rel	*rel = vrel;
-	Byte	type = ELF_R_TYPE(rel->r_info);
-	Word	value = reloc->r_value;
+	Rela	*rel = vrel;
+	Xword	type = ELF_R_TYPE(rel->r_info);
+	Xword	value = reloc->r_value + rel->r_addend;
 
-	if (type == R_386_JMP_SLOT) {
+	if (type == R_AMD64_JUMP_SLOT) {
 		uintptr_t	addr, vaddr;
 
 		if (FLAGS(lmp) & FLG_RT_FIXED)
 			vaddr = 0;
 		else
 			vaddr = ADDR(lmp);
+
 		addr = (uintptr_t)oaddr - rel->r_offset;
 		/* LINTED */
 		elf_plt_write((uintptr_t)addr, vaddr, rel,
 		    (uintptr_t)value, reloc->r_pltndx);
-	} else if (type == R_386_COPY) {
+
+	} else if (type == R_AMD64_COPY) {
 		(void) memcpy((void *)oaddr, (void *)value,
 		    (size_t)reloc->r_size);
-
 	} else {
-		(void) do_reloc(type, oaddr, &value, reloc->r_name, name);
+		(void) do_reloc(type, oaddr, &value, reloc->r_name, name,
+		    LIST(lmp));
 	}
-#endif	/* XX64 -- fix me */
 }
--- a/usr/src/cmd/sgs/librtld/common/_librtld.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/common/_librtld.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #ifndef	__LIBRTLD_H
@@ -84,15 +84,12 @@
 /*
  * Define any local prototypes.
  */
-extern	void	apply_reloc(void *, Reloc *, const char *, unsigned char *,
-		    Rt_map * lmp);
+extern	void	apply_reloc(void *, Reloc *, const char *, uchar_t *, Rt_map *);
 extern	void	clear_reloc(void *);
 extern	int	count_reloc(Cache *, Cache *, Rt_map *, int, Addr, Xword *,
 		    Xword *, Xword *);
-extern	void	inc_reloc(void *, void *, Reloc *, unsigned char *,
-		    unsigned char *);
-extern	void	undo_reloc(void *, unsigned char *, unsigned char *,
-		    Reloc *);
+extern	void	inc_reloc(void *, void *, Reloc *, uchar_t *, uchar_t *);
+extern	void	undo_reloc(void *, uchar_t *, uchar_t *, Reloc *);
 extern	int	update_dynamic(Cache *, Cache *, Rt_map *, int, Addr, Off,
 		    const char *, Xword, Xword, Xword, Xword, Xword);
 extern	void	update_reloc(Cache *, Cache *, Cache *, const char *,
--- a/usr/src/cmd/sgs/librtld/common/dldump.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/common/dldump.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * dldump(3c) creates a new file image from the specified input file.
@@ -162,6 +162,7 @@
 	Addr		edata;
 	char		*shstr, *_shstr, *ipath = NAME(lmp);
 	prstatus_t	*status = 0, _status;
+	Lm_list		*lml = LIST(lmp);
 
 	if (lmp == lml_main.lm_head) {
 		char	proc[16];
@@ -174,7 +175,7 @@
 		    (int)getpid());
 		if ((pfd = open(proc, O_RDONLY)) == -1) {
 			err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc,
 			    strerror(err));
 			return (1);
 		}
@@ -187,7 +188,7 @@
 		 */
 		if ((fd = ioctl(pfd, PIOCOPENM, (void *)0)) == -1) {
 			err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), ipath,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), ipath,
 			    strerror(err));
 			(void) close(pfd);
 			return (1);
@@ -204,7 +205,7 @@
 		if (!(flags & RTLD_NOHEAP)) {
 			if (ioctl(pfd, PIOCSTATUS, (void *)&_status) == -1) {
 				err = errno;
-				eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC),
+				eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC),
 				    ipath, strerror(err));
 				(void) close(fd);
 				(void) close(pfd);
@@ -220,7 +221,7 @@
 		 */
 		if ((fd = open(ipath, O_RDONLY, 0)) == -1) {
 			err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ipath,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ipath,
 			    strerror(err));
 			return (1);
 		}
@@ -232,7 +233,7 @@
 	 */
 	(void) elf_version(EV_CURRENT);
 	if ((ielf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), ipath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), ipath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, 0);
 		return (1);
 	}
@@ -241,7 +242,7 @@
 	if ((elf_kind(ielf) != ELF_K_ELF) ||
 	    ((iehdr = elf_getehdr(ielf)) == NULL) ||
 	    ((iehdr->e_type != ET_EXEC) && (iehdr->e_type != ET_DYN))) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_IMG_ELF), ipath);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_IMG_ELF), ipath);
 		cleanup(ielf, oelf, melf, icache, mcache, 0, 0);
 		return (1);
 	}
@@ -251,13 +252,13 @@
 	 */
 	if ((fd = open(opath, (O_RDWR | O_CREAT | O_TRUNC), 0777)) == -1) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath,
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath,
 		    strerror(err));
 		cleanup(ielf, oelf, melf, icache, mcache, 0, 0);
 		return (1);
 	}
 	if ((oelf = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -268,7 +269,7 @@
 	 * heap section size.
 	 */
 	if ((iphdr = elf_getphdr(ielf)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETPHDR), ipath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETPHDR), ipath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -300,7 +301,7 @@
 	 * segment, and would therefore have the wrong permissions).
 	 */
 	if (status && !data_phdr) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_IMG_DATASEG), ipath);
+		eprintf(lml, ERR_WARNING, MSG_INTL(MSG_IMG_DATASEG), ipath);
 		status = 0;
 	}
 
@@ -308,12 +309,12 @@
 	 * Obtain the input files section header string table.
 	 */
 	if ((scn = elf_getscn(ielf, iehdr->e_shstrndx)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSCN), ipath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSCN), ipath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
 	if ((data = elf_getdata(scn, NULL)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -345,13 +346,13 @@
 	for (scn = 0; scn = elf_nextscn(ielf, scn); _icache++) {
 
 		if ((_icache->c_shdr = shdr = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), ipath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), ipath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
 
 		if ((_icache->c_data = elf_getdata(scn, NULL)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
@@ -474,7 +475,7 @@
 	 * and disable the heap addition.
 	 */
 	if (!data_cache) {
-		eprintf(ERR_WARNING, MSG_INTL(MSG_IMG_DATASEC), ipath);
+		eprintf(lml, ERR_WARNING, MSG_INTL(MSG_IMG_DATASEC), ipath);
 		status = 0;
 		endx = 0;
 	}
@@ -503,7 +504,7 @@
 	 * that isn't calculated as part of elf_update().
 	 */
 	if ((oehdr = elf_newehdr(oelf)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWEHDR), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWEHDR), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -520,7 +521,7 @@
 	 * and the data segments size to reflect any new heap section.
 	 */
 	if ((ophdr = elf_newphdr(oelf, iehdr->e_phnum)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWPHDR), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWPHDR), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -561,12 +562,12 @@
 		 * Create a matching section header in the output file.
 		 */
 		if ((scn = elf_newscn(oelf)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWSCN), opath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWSCN), opath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
 		if ((shdr = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWSHDR), opath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWSHDR), opath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
@@ -586,7 +587,7 @@
 		 * Create a matching data buffer for this section.
 		 */
 		if ((data = elf_newdata(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWDATA), opath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWDATA), opath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
@@ -696,17 +697,17 @@
 	 * allow us to write and update the new image.
 	 */
 	if (elf_update(oelf, ELF_C_WRIMAGE) == -1) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
 	if ((melf = elf_begin(0, ELF_C_IMAGE, oelf)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
 	if ((mehdr = elf_getehdr(melf)) == NULL) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETEHDR), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETEHDR), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
@@ -724,13 +725,13 @@
 	for (scn = 0; scn = elf_nextscn(melf, scn); _mcache++) {
 
 		if ((_mcache->c_shdr = elf_getshdr(scn)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), opath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), opath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
 
 		if ((_mcache->c_data = elf_getdata(scn, NULL)) == NULL) {
-			eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), opath);
+			eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), opath);
 			cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 			return (1);
 		}
@@ -817,7 +818,7 @@
 	 * Having completed all section updates write the memory file out.
 	 */
 	if (elf_update(oelf, ELF_C_WRITE) == -1) {
-		eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath);
+		eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath);
 		cleanup(ielf, oelf, melf, icache, mcache, fd, opath);
 		return (1);
 	}
--- a/usr/src/cmd/sgs/librtld/common/dynamic.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/common/dynamic.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Update any dynamic entry offsets.  One issue with dynamic entries is that
@@ -38,13 +38,13 @@
 #include	"_librtld.h"
 
 int
-update_dynamic(Cache * cache, Cache * _cache, Rt_map * lmp, int flags,
+update_dynamic(Cache *cache, Cache *_cache, Rt_map *lmp, int flags,
     Addr addr, Off off, const char *file, Xword null, Xword data, Xword func,
     Xword entsize, Xword checksum)
 {
-	Dyn *		dyn = (Dyn *)_cache->c_data->d_buf, * posdyn = 0;
+	Dyn		*dyn = (Dyn *)_cache->c_data->d_buf, *posdyn = 0;
 	const char	*strs;
-	Cache *		__cache;
+	Cache		*__cache;
 
 	/*
 	 * If we're dealing with an object that might have bound to an external
@@ -62,7 +62,7 @@
 		switch ((Xword)dyn->d_tag) {
 		case DT_NEEDED:
 			if (posdyn) {
-				Rt_map *	dlmp;
+				Rt_map	*dlmp;
 
 				/*
 				 * Determine whether this dependency has been
@@ -256,7 +256,8 @@
 				}
 				break;
 			}
-			eprintf(ERR_WARNING, MSG_INTL(MSG_DT_UNKNOWN), file,
+			eprintf(LIST(lmp), ERR_WARNING,
+			    MSG_INTL(MSG_DT_UNKNOWN), file,
 			    EC_XWORD(dyn->d_tag));
 			return (1);
 		}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/librtld/common/mapfile-32-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,33 @@
+#
+# 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"
+#
+
+{
+	global:
+		do32_reloc =	FUNCTION parent;
+		reloc32_table =	DATA parent;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/librtld/common/mapfile-64-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,33 @@
+#
+# 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"
+#
+
+{
+	global:
+		do64_reloc =	FUNCTION parent;
+		reloc64_table =	DATA parent;
+};
--- a/usr/src/cmd/sgs/librtld/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
 #
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,13 +33,11 @@
 
 {
 	global:
-		do_reloc =	FUNCTION parent;
 		elf_plt_write =	FUNCTION parent;
 		eprintf =	FUNCTION parent;
 		is_so_loaded =	FUNCTION parent;
 		lookup_sym =	FUNCTION parent;
 
-		reloc_table =	DATA parent;
 		lml_main =	DATA parent;
 	local:
 		*;
--- a/usr/src/cmd/sgs/librtld/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,7 +28,8 @@
 
 include		$(SRC)/cmd/sgs/librtld/Makefile.com
 
-CPPFLAGS += -I../../../../uts/intel/ia32/krtld
+CPPFLAGS +=	-I../../../../uts/intel/ia32/krtld
+MAPFILES +=	../common/mapfile-32-vers
 
 .KEEP_STATE:
 
--- a/usr/src/cmd/sgs/librtld/i386/_relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/i386/_relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000-2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -31,21 +31,19 @@
 #include	"_librtld.h"
 #include	"_elf.h"
 
-
 /*
  * Undo relocations that have been applied to a memory image.  Basically this
  * involves copying the original files relocation offset into the new image
  * being created.
  */
 void
-undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr,
-    Reloc *reloc)
+undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc)
 {
-	Rel		*rel = vrel;
+	Rel	*rel = vrel;
 	/* LINTED */
-	unsigned long	*_oaddr = (unsigned long *)oaddr;
+	ulong_t	*_oaddr = (ulong_t *)oaddr;
 	/* LINTED */
-	unsigned long	*_iaddr = (unsigned long *)iaddr;
+	ulong_t	*_iaddr = (ulong_t *)iaddr;
 
 	switch (ELF_R_TYPE(rel->r_info)) {
 	case R_386_NONE:
@@ -71,22 +69,21 @@
 	}
 }
 
-
 /*
  * Copy a relocation record and increment its value.  The record must reflect
  * the new address to which this image is fixed.  Note that .got entries
  * associated with .plt's must be fixed to the new base address.
  */
 void
-inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr,
-    unsigned char *iaddr)
+inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr,
+    uchar_t *iaddr)
 {
-	Rel		*nrel = vnrel;
-	Rel		*orel = vorel;
+	Rel	*nrel = vnrel;
+	Rel	*orel = vorel;
 	/* LINTED */
-	unsigned long	*_oaddr = (unsigned long *)oaddr;
+	ulong_t	*_oaddr = (ulong_t *)oaddr;
 	/* LINTED */
-	unsigned long	*_iaddr = (unsigned long *)iaddr;
+	ulong_t	*_iaddr = (ulong_t *)iaddr;
 
 	if (ELF_R_TYPE(nrel->r_info) == R_386_JMP_SLOT) {
 		if (_iaddr)
@@ -99,31 +96,29 @@
 	nrel->r_offset += reloc->r_value;
 }
 
-
 /*
  * Clear a relocation record.  The relocation has been applied to the image and
  * thus the relocation must not occur again.
  */
 void
-clear_reloc(void * vrel)
+clear_reloc(void *vrel)
 {
-	Rel *	rel = vrel;
+	Rel	*rel = vrel;
 
 	rel->r_offset = 0;
 	rel->r_info = ELF_R_INFO(0, R_386_NONE);
 }
 
-
 /*
  * Apply a relocation to an image being built from an input file.  Use the
  * runtime linkers routines to do the necessary magic.
  */
 void
-apply_reloc(void *vrel, Reloc *reloc, const char *name,
-    unsigned char *oaddr, Rt_map *lmp)
+apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr,
+    Rt_map *lmp)
 {
 	Rel	*rel = vrel;
-	Byte	type = ELF_R_TYPE(rel->r_info);
+	Xword	type = ELF_R_TYPE(rel->r_info);
 	Word	value = reloc->r_value;
 
 	if (type == R_386_JMP_SLOT) {
@@ -137,11 +132,12 @@
 		/* LINTED */
 		elf_plt_write((uintptr_t)addr, vaddr, rel,
 		    (uintptr_t)value, reloc->r_pltndx);
+
 	} else if (type == R_386_COPY) {
 		(void) memcpy((void *)oaddr, (void *)value,
 		    (size_t)reloc->r_size);
-
 	} else {
-		(void) do_reloc(type, oaddr, &value, reloc->r_name, name);
+		(void) do_reloc(type, oaddr, &value, reloc->r_name, name,
+		    LIST(lmp));
 	}
 }
--- a/usr/src/cmd/sgs/librtld/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,7 +28,8 @@
 
 include		$(SRC)/cmd/sgs/librtld/Makefile.com
 
-CPPFLAGS += -I../../../../uts/sparc/krtld
+CPPFLAGS +=	-I../../../../uts/sparc/krtld
+MAPFILES +=	../common/mapfile-32-vers
 
 .KEEP_STATE:
 
--- a/usr/src/cmd/sgs/librtld/sparc/_relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/sparc/_relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000-2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -31,7 +31,6 @@
 #include	"_librtld.h"
 #include	"_elf.h"
 
-
 /*
  * Undo relocations that have been applied to a memory image.  Basically this
  * involves copying the original files relocation offset into the new image
@@ -39,14 +38,13 @@
  */
 /* ARGSUSED3 */
 void
-undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr,
-    Reloc *reloc)
+undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc)
 {
 	Rela		*rel = vrel;
 	const Rel_entry	*rep;
-	int		rtype = ELF_R_TYPE(rel->r_info);
-	unsigned long	*_oaddr;
-	unsigned long	*_iaddr;
+	Xword		rtype = ELF_R_TYPE(rel->r_info);
+	ulong_t		*_oaddr;
+	ulong_t		*_iaddr;
 
 	switch (rtype) {
 	case R_SPARC_NONE:
@@ -72,23 +70,21 @@
 		break;
 	default:
 		rep = &reloc_table[rtype];
-		if (_iaddr)
+		if (iaddr)
 			(void) memcpy(oaddr, iaddr, rep->re_fsize);
 		else
 			(void) memset(oaddr, 0, rep->re_fsize);
-		break;
 	}
 }
 
-
 /*
  * Copy a relocation record and increment its value.  The record must reflect
  * the new address to which this image is fixed.
  */
 /* ARGSUSED3 */
 void
-inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr,
-    unsigned char *iaddr)
+inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr,
+    uchar_t *iaddr)
 {
 	Rela	*nrel = vnrel;
 	Rela	*orel = vorel;
@@ -97,7 +93,6 @@
 	nrel->r_offset += reloc->r_value;
 }
 
-
 /*
  * Clear a relocation record.  The relocation has been applied to the image and
  * thus the relocation must not occur again.
@@ -112,18 +107,17 @@
 	rel->r_addend = 0;
 }
 
-
 /*
  * Apply a relocation to an image being built from an input file.  Use the
  * runtime linkers routines to do the necessary magic.
  */
 void
-apply_reloc(void *vrel, Reloc *reloc, const char *name,
-    unsigned char *oaddr, Rt_map *lmp)
+apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr,
+    Rt_map *lmp)
 {
-	Rela		*rel = vrel;
-	Byte		type = (Byte)ELF_R_TYPE(rel->r_info);
-	Xword		value = reloc->r_value + rel->r_addend;
+	Rela	*rel = vrel;
+	Xword	type = ELF_R_TYPE(rel->r_info);
+	Xword	value = reloc->r_value + rel->r_addend;
 
 	if (type == R_SPARC_JMP_SLOT) {
 		uintptr_t	addr, vaddr;
@@ -137,11 +131,14 @@
 		/* LINTED */
 		elf_plt_write((uintptr_t)addr, vaddr, rel,
 		    (uintptr_t)value, reloc->r_pltndx);
+
 	} else if (type == R_SPARC_COPY) {
 		(void) memcpy((void *)oaddr, (void *)value,
 		    (size_t)reloc->r_size);
-
 	} else {
-		(void) do_reloc(type, oaddr, &value, reloc->r_name, name);
+		if (IS_EXTOFFSET(type))
+			value += ELF_R_TYPE_DATA(rel->r_info);
+		(void) do_reloc(type, oaddr, &value, reloc->r_name, name,
+		    LIST(lmp));
 	}
 }
--- a/usr/src/cmd/sgs/librtld/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,16 +18,18 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include		$(SRC)/cmd/sgs/librtld/Makefile.com
-CPPFLAGS += -I../../../../uts/sparc/krtld
 
+CPPFLAGS +=	-I../../../../uts/sparc/krtld
+MAPFILES +=	../common/mapfile-64-vers
 
 .KEEP_STATE:
 
@@ -51,6 +52,3 @@
 
 CONVLIBDIR =	$(CONVLIBDIR64)
 ELFLIBDIR =	$(ELFLIBDIR64)
-
-
-
--- a/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,21 +18,19 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 2000-2001 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include	<string.h>
-#include	<stdio.h>
 #include	"machdep.h"
 #include	"reloc.h"
 #include	"_librtld.h"
 #include	"_elf.h"
 
-
-
 /*
  * Undo relocations that have been applied to a memory image.  Basically this
  * involves copying the original files relocation offset into the new image
@@ -41,15 +38,13 @@
  */
 /* ARGSUSED3 */
 void
-undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr,
-    Reloc *reloc)
+undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc)
 {
 	Rela		*rel = vrel;
 	const Rel_entry	*rep;
-	/* LINTED */
-	int		rtype = (int)ELF_R_TYPE(rel->r_info);
-	unsigned long	*_oaddr;
-	unsigned long	*_iaddr;
+	Xword		rtype = ELF_R_TYPE(rel->r_info);
+	ulong_t		*_oaddr;
+	ulong_t		*_iaddr;
 
 	switch (rtype) {
 	case R_SPARC_NONE:
@@ -62,6 +57,7 @@
 		_oaddr = (unsigned long *)oaddr;
 		/* LINTED */
 		_iaddr = (unsigned long *)iaddr;
+
 		if (_iaddr) {
 			*_oaddr++ = *_iaddr++;
 			*_oaddr++ = *_iaddr++;
@@ -81,15 +77,14 @@
 	}
 }
 
-
 /*
  * Copy a relocation record and increment its value.  The record must reflect
  * the new address to which this image is fixed.
  */
 /* ARGSUSED3 */
 void
-inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr,
-    unsigned char *iaddr)
+inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr,
+    uchar_t *iaddr)
 {
 	Rela	*nrel = vnrel;
 	Rela	*orel = vorel;
@@ -98,7 +93,6 @@
 	nrel->r_offset += reloc->r_value;
 }
 
-
 /*
  * Clear a relocation record.  The relocation has been applied to the image and
  * thus the relocation must not occur again.
@@ -113,18 +107,16 @@
 	rel->r_addend = 0;
 }
 
-
 /*
  * Apply a relocation to an image being built from an input file.  Use the
  * runtime linkers routines to do the necessary magic.
  */
 void
-apply_reloc(void *vrel, Reloc *reloc, const char *name,
-    unsigned char *oaddr, Rt_map *lmp)
+apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr,
+    Rt_map *lmp)
 {
 	Rela	*rel = vrel;
-	/* LINTED */
-	Byte	type = (Byte)ELF_R_TYPE(rel->r_info);
+	Xword	type = ELF_R_TYPE(rel->r_info);
 	Xword	value = reloc->r_value + rel->r_addend;
 
 	if (type == R_SPARC_JMP_SLOT) {
@@ -143,10 +135,10 @@
 	} else if (type == R_SPARC_COPY) {
 		(void) memcpy((void *)oaddr, (void *)value,
 		    (size_t)reloc->r_size);
-
 	} else {
 		if (IS_EXTOFFSET(type))
 			value += ELF_R_TYPE_DATA(rel->r_info);
-		(void) do_reloc(type, oaddr, &value, reloc->r_name, name);
+		(void) do_reloc(type, oaddr, &value, reloc->r_name, name,
+		    LIST(lmp));
 	}
 }
--- a/usr/src/cmd/sgs/librtld_db/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -40,11 +40,10 @@
 MAPFILE=	../common/mapfile-vers
 
 DYNFLAGS +=	-M$(MAPFILE) $(VERSREF)
-LDLIBS +=	$(CONVLIBDIR) -lconv -lc
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
 
-LINTFLAGS +=	-u
-LINTFLAGS64 +=	-u
-
+LINTFLAGS +=	-u -erroff=E_NAME_DECL_NOT_USED_DEF2
+LINTFLAGS64 +=	-u -erroff=E_NAME_DECL_NOT_USED_DEF2
 
 BLTDEFS=	msg.h
 BLTDATA=	msg.c
@@ -53,14 +52,13 @@
 
 SGSMSGCOM=	../common/librtld_db.msg
 SGSMSGINTEL=	../common/librtld_db.intel.msg
-SGSMSGSPARC=	../common/librtld_db.sparc.msg
+SGSMSGSPARCV9=	../common/librtld_db.sparcv9.msg
 SGSMSGTARG=	$(SGSMSGCOM)
 SGSMSGALL=	$(SGSMSGCOM)
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA)
 
 SRCS=		../common/llib-lrtld_db
-LINTSRCS=	$(COMOBJS:%.o=../common/%.c) $(PLTSRCS) \
-		$(BLTDATA) ../common/lintsup.c
+LINTSRCS=	$(COMOBJS:%.o=../common/%.c) $(PLTSRCS) $(BLTDATA)
 
 CLEANFILES +=	$(BLTFILES) $(LINTOUTS)
 CLOBBERFILES +=	$(DYNLIB) $(LINTLIB)
--- a/usr/src/cmd/sgs/librtld_db/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,14 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-lint:		$(LINTLIB) $(LINTOUT32) $(SGSLINTOUT)
-
 pics/%.o:	../common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
--- a/usr/src/cmd/sgs/librtld_db/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,16 +18,17 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-COMOBJS64=  rd_elf64.o
-PLTOBJS=        plt32_resolution.o plt64_resolution.o
-PLTSRCS=        ../i386/plt32_resolution.c plt64_resolution.c
+COMOBJS64 =	rd_elf64.o
+PLTOBJS =	plt32_resolution.o plt64_resolution.o
+PLTSRCS =	../i386/plt32_resolution.c plt64_resolution.c
 
 include		../Makefile.com
 
@@ -36,18 +36,21 @@
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 CPPFLAGS +=	-D_SYSCALL32
-CONVLIBDIR=	$(CONVLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
 
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LINTLIB)
+
 install:	all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) \
 		$(ROOTFS_LIBDIR64)/$(LINTLIB)
-lint:		$(LINTOUT64)
 
 pics/plt32_resolution.o: ../i386/plt32_resolution.c
-	$(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ ../i386/plt32_resolution.c
-	$(POST_PROCESS_O)
+		$(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ \
+		    ../i386/plt32_resolution.c
+		$(POST_PROCESS_O)
+
+lint:		$(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -54,7 +54,6 @@
 	uint32_t	pcrel;
 	psaddr_t	destaddr;
 	psaddr_t	pltoff, pltaddr;
-	prgregset_t	gr;
 
 
 	if (rtld_db_version >= RD_VERSION3) {
--- a/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -80,7 +80,7 @@
 extern rd_err_e		_rd_objpad_enable32(struct rd_agent *, size_t);
 extern rd_err_e		_rd_loadobj_iter32(rd_agent_t *, rl_iter_f *, void *);
 extern rd_err_e		find_dynamic_ent32(struct rd_agent *, psaddr_t,
-			    Xword, Elf32_Dyn *);
+			    Xword, Dyn *);
 
 extern rd_err_e		plt32_resolution(rd_agent_t *, psaddr_t, lwpid_t,
 			    psaddr_t, rd_plt_info_t *);
--- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,12 +18,17 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 
 # Message file for cmd/sgs/librtld_db - intel specific.
 
 @ _END_
 
-@ MSG_DB_READFAIL_X86_1	"rtld_db: rlif: read of 0x%llx failed\n"
-@ MSG_DB_NODYN_X86	"rtld_db: rlif: no PT_DYNAMIC found\n"
-@ MSG_DB_NOGOT_X86	"rtld_db: rpr: unable to resolve GOT addr\n"
+@ MSG_DB_READFAIL_X86_1	"rtld_db: rlif: read of 0x%llx failed"
+@ MSG_DB_NODYN_X86	"rtld_db: rlif: no PT_DYNAMIC found"
+@ MSG_DB_NOGOT_X86	"rtld_db: rpr: unable to resolve GOT addr"
--- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,13 +18,17 @@
 #
 # CDDL HEADER END
 #
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 # Message file for cmd/sgs/librtld_db.
 
 @ MSG_ID_LIBRTLD_DB
 
-
 # There presently seem little point in internationalizing these messages
 # as they provide debugging information for dbx developers and shouldn't
 # be see by anyone else.
--- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparc.msg	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# 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.
-#
-# 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
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-
-# Message file for cmd/sgs/librtld_db - SPARC specific.
-
-@ _END_
-
-
-@ MSG_DB_BADFPLT	"rtld_db: rpr: bad plt instruction found: \
-			 addr: 0x%llx instr:0x%llx"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparcv9.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,33 @@
+#
+# 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"
+
+# Message file for cmd/sgs/librtld_db - SPARCV9 specific.
+
+@ _END_
+
+@ MSG_DB_BADFPLT	"rtld_db: rpr: bad plt instruction found: \
+			 addr: 0x%llx instr:0x%llx"
--- a/usr/src/cmd/sgs/librtld_db/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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.
- *
- * 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
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc. 
- * All rights reserved. 
- */ 
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-/*
- * Supplimental definitions for lint that help us avoid
- * options like `-x' that filter out things we want to
- * know about as well as things we don't.
- */
-#include <thread.h>
-#include <rtld_db.h>
-#include "libld.h"
-#include "rtld.h"
-#include "msg.h"
-
--- a/usr/src/cmd/sgs/librtld_db/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,16 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
+#
 
-PLTOBJS =       plt32_resolution.o
-PLTSRCS =       plt32_resolution.c
+PLTOBJS =	plt32_resolution.o
+PLTSRCS =	plt32_resolution.c
 
 include		../Makefile.com
 
@@ -39,4 +40,6 @@
 install:	all $(ROOTFS_DYNLIB) $(ROOTFS_LINKS) \
 		$(ROOTFS_LIBDIR)/$(LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
 
+lint:		$(LINTLIB) $(LINTOUT32) $(SGSLINTOUT)
+
 include		../Makefile.targ
--- a/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
-
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
@@ -51,7 +50,6 @@
 #define	STACK_BIAS	0
 #endif
 
-
 static int
 get_frame(struct ps_prochandle *ph, psaddr_t fp, struct frame *frm)
 {
@@ -72,10 +70,9 @@
 
 		frm->fr_savpc = (long)frm32.fr_savpc;
 #if defined(__sparcv9)
-		frm->fr_savfp = (struct frame *)frm32.fr_savfp;
+		frm->fr_savfp = (struct frame *)(uintptr_t)frm32.fr_savfp;
 #elif defined(__amd64)
 		frm->fr_savfp = (long)frm32.fr_savfp;
-#else
 #endif
 		return (0);
 	}
@@ -89,10 +86,8 @@
 	return (0);
 }
 
-
 /*
- * Relatively architecture neutral routine to display
- * the callstack.
+ * Relatively architecture neutral routine to display the callstack.
  */
 void
 CallStack(struct ps_prochandle *ph)
--- a/usr/src/cmd/sgs/librtld_db/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,11 +18,13 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 PLTOBJS =	plt32_resolution.o
 PLTSRCS =	plt32_resolution.c
@@ -33,7 +34,10 @@
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LINTLIB)
+
 install:	all $(ROOTFS_DYNLIB) $(ROOTFS_LINKS) \
 		$(ROOTFS_LIBDIR)/$(LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC)
 
+lint:		$(LINTLIB) $(LINTOUT32) $(SGSLINTOUT)
+
 include		../Makefile.targ
--- a/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,34 +18,39 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
+#
 
-COMOBJS64=	rd_elf64.o
-PLTOBJS=	plt32_resolution.o plt64_resolution.o
-PLTSRCS=	../sparc/plt32_resolution.c plt64_resolution.c
+COMOBJS64 =	rd_elf64.o
+PLTOBJS =	plt32_resolution.o plt64_resolution.o
+PLTSRCS =	../sparc/plt32_resolution.c plt64_resolution.c
 
 include		../Makefile.com
 
-SGSMSGTARG +=   $(SGSMSGSPARC)
+SGSMSGTARG +=	$(SGSMSGSPARCV9)
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 CPPFLAGS +=	-D_SYSCALL32
-CONVLIBDIR=	$(CONVLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
 
 .KEEP_STATE:
 
 all:		$(DYNLIB) $(LINTLIB)
+
 install:	all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) \
 		$(ROOTFS_LIBDIR64)/$(LINTLIB)
-lint:		$(LINTOUT64)
 
 pics/plt32_resolution.o: ../sparc/plt32_resolution.c
-	$(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ ../sparc/plt32_resolution.c
-	$(POST_PROCESS_O)
+		$(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ \
+		    ../sparc/plt32_resolution.c
+		$(POST_PROCESS_O)
+
+lint:		$(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/link_audit/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/link_audit/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -68,8 +68,8 @@
 
 $(WHOPICS):=	SEMANTICCHK=
 
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB)
 
-LDLIBS +=	$(CONVLIBDIR) -lconv
 # Building SUNWonld results in a call to the `package' target.  Requirements
 # needed to run this application on older releases are established:
 #   dlopen/dlclose requires libdl.so.1 prior to 5.10
--- a/usr/src/cmd/sgs/link_audit/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/link_audit/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,11 +28,13 @@
 
 include		../Makefile.com
 
-CONVLIBDIR=	$(CONVLIBDIR64)
-ELFLIBDIR=	$(ELFLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+
+lint :=		CONV_LIB =	$(CONV_LIB64)
 
 $(ONLIBS) \
-$(CCSLIBS):=	CFLAGS64 +=	$(C_PICFLAGS64) $(NO_ASM_WARN)
+$(CCSLIBS) :=	CFLAGS64 +=	$(C_PICFLAGS64) $(NO_ASM_WARN)
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
--- a/usr/src/cmd/sgs/link_audit/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/link_audit/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,17 +18,20 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
 
 include		../Makefile.com
 
+lint :=		CONV_LIB =	$(CONV_LIB32)
+
 $(ONLIBS) \
-$(CCSLIBS):=	CFLAGS +=	$(C_PICFLAGS) $(NO_ASM_WARN)
+$(CCSLIBS) :=	CFLAGS +=	$(C_PICFLAGS) $(NO_ASM_WARN)
 
 .KEEP_STATE:
 
--- a/usr/src/cmd/sgs/link_audit/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/link_audit/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,17 +18,20 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
 
 include		../Makefile.com
 
+lint :=		CONV_LIB =	$(CONV_LIB32)
+
 $(ONLIBS) \
-$(CCSLIBS):=	CFLAGS +=	$(C_PICFLAGS) $(NO_ASM_WARN)
+$(CCSLIBS) :=	CFLAGS +=	$(C_PICFLAGS) $(NO_ASM_WARN)
 
 .KEEP_STATE:
 
--- a/usr/src/cmd/sgs/link_audit/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/link_audit/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -28,11 +28,13 @@
 
 include		../Makefile.com
 
-CONVLIBDIR=	$(CONVLIBDIR64)
-ELFLIBDIR=	$(ELFLIBDIR64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+
+lint :=		CONV_LIB =	$(CONV_LIB64)
 
 $(ONLIBS) \
-$(CCSLIBS):=	CFLAGS64 +=	$(C_PICFLAGS64) $(NO_ASM_WARN)
+$(CCSLIBS) :=	CFLAGS64 +=	$(C_PICFLAGS64) $(NO_ASM_WARN)
 
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
--- a/usr/src/cmd/sgs/mcs/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/mcs/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -43,11 +43,12 @@
 LLDFLAGS =	'-R$$ORIGIN/../../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../../lib/$(MACH64)'
 LDFLAGS +=	$(VERSREF) $(LLDFLAGS)
-LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+
+LINTFLAGS +=	-x
+LINTFLAGS64 +=	-x
 
-LINTFLAGS +=	-x $(LDLIBS)
-LINTFLAGS64 +=	-x $(LDLIBS)
+SRCS =		$(OBJS:%.o=../common/%.c)
+LINTSRCS =	$(SRCS)
 
-SRCS=		$(OBJS:%.o=../common/%.c)
-
-CLEANFILES +=	$(OBJS) $(LINTOUT)
+CLEANFILES +=	$(OBJS) $(LINTOUTS)
--- a/usr/src/cmd/sgs/mcs/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/mcs/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,11 +18,13 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 1998 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 %.o:		../common/%.c
 		$(COMPILE.c) $<
@@ -40,7 +41,7 @@
 install \
 package:	all $(ROOTCCSBINPROG) $(ROOTLINKS)
 
-lint:		$(LINTOUT)
+lint:		$(LINTOUT32) $(SGSLINTOUT)
 
 $(PROG):	$(OBJS)
 		$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
@@ -50,10 +51,8 @@
 		$(RM) $@
 		$(LN) $(ROOTCCSBINPROG) $@
 
-$(LINTOUT):	$(SRCS)
-		$(LINT.c) $(SRCS) > $(LINTOUT) 2>&1
-
 $(ROOTCCSBIN64)/%: %
-	$(INS.file)
+		$(INS.file)
 
 include		$(SRC)/cmd/Makefile.targ
+include		$(SRC)/cmd/sgs/Makefile.targ
--- a/usr/src/cmd/sgs/mcs/common/file.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/mcs/common/file.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -144,6 +143,8 @@
 
 	while ((elf = elf_begin(fd, cmd, arf)) != 0) {
 		if (ar_file) /* get header info */ {
+			size_t	len;
+
 			if ((mem_header = elf_getarhdr(elf)) == NULL) {
 				error_message(GETARHDR_ERROR,
 				LIBelf_ERROR, elf_errmsg(-1),
@@ -157,15 +158,18 @@
 
 			if (cur_filenm != NULL)
 				free(cur_filenm);
-			if ((cur_filenm = malloc((strlen(cur_file) + 3 +
-			    strlen(mem_header->ar_name)))) == NULL) {
+
+			len = (strlen(cur_file) + 3 +
+			    strlen(mem_header->ar_name));
+
+			if ((cur_filenm = malloc(len)) == NULL) {
 				error_message(MALLOC_ERROR,
 				PLAIN_ERROR, (char *)0,
 				prog);
 				mcs_exit(FAILURE);
 			}
 
-			(void) sprintf(cur_filenm, "%s[%s]",
+			(void) snprintf(cur_filenm, len, "%s[%s]",
 				cur_file, mem_header->ar_name);
 		}
 
@@ -1550,7 +1554,8 @@
 			grpcnt = 0;
 			grpdata = (Word *)(sinfo->data->d_buf);
 			for (i = 1; i < num; i++) {
-				if (sec_table[grpdata[i]].secno != DELETED)
+				if (sec_table[grpdata[i]].secno !=
+				    (GElf_Word)DELETED)
 					grpcnt++;
 			}
 
@@ -1618,7 +1623,7 @@
 		ngrpdata[0] = grpdata[0];
 		j = 1;
 		for (i = 1; i < num; i++) {
-			if (sec_table[grpdata[i]].secno != -1) {
+			if (sec_table[grpdata[i]].secno != (GElf_Word)DELETED) {
 				ngrpdata[j++] = sec_table[grpdata[i]].secno;
 			}
 		}
--- a/usr/src/cmd/sgs/mcs/common/message.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/mcs/common/message.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -23,9 +22,8 @@
  *	Copyright(c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright(c) 1995 by Sun Microsystems, Inc.
- *	All Rights Reserved
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 #include "mcs.h"
@@ -111,6 +109,7 @@
 	case ELFVER_ERROR:
 	case EXEC_AR_ERROR:
 	case LIBELF_ERROR:
+		/* LINTED */
 		(void) fprintf(stderr, message, va_arg(ap, char *));
 		break;
 	case OPEN_ERROR:
@@ -138,24 +137,27 @@
 	case ACT_APPEND2_ERROR:
 	case ACT_COMPRESS1_ERROR:
 	case ACT_COMPRESS2_ERROR: {
-		char * a = va_arg(ap, char *);
-		char * b = va_arg(ap, char *);
-		char * c = va_arg(ap, char *);
+		char *a = va_arg(ap, char *);
+		char *b = va_arg(ap, char *);
+		char *c = va_arg(ap, char *);
+		/* LINTED */
 		(void) fprintf(stderr, message, a, b, c);
 		break;
 	}
 	case ACT_DELETE2_ERROR: {
-		char * a = va_arg(ap, char *);
-		char * b = va_arg(ap, char *);
-		char * c = va_arg(ap, char *);
-		char * d = va_arg(ap, char *);
+		char *a = va_arg(ap, char *);
+		char *b = va_arg(ap, char *);
+		char *c = va_arg(ap, char *);
+		char *d = va_arg(ap, char *);
+		/* LINTED */
 		(void) fprintf(stderr, message, a, b, c, d);
 		break;
 	}
 	case GETARHDR_ERROR: {
-		char * a = va_arg(ap, char *);
-		char * b = va_arg(ap, char *);
+		char *a = va_arg(ap, char *);
+		char *b = va_arg(ap, char *);
 		long c = va_arg(ap, long);
+		/* LINTED */
 		(void) fprintf(stderr, message, a, b, c);
 		break;
 	}
--- a/usr/src/cmd/sgs/moe/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/moe/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -38,8 +38,8 @@
 
 MAPFILE=	../common/mapfile-vers
 
-LDFLAGS +=	-Wl,$(VERSREF) -Yl,$(SGSPROTO) -M $(MAPFILE)
-LDLIBS +=	$(CONVLIBDIR) -lconv
+LDFLAGS +=	-Wl,$(VERSREF) $(USE_PROTO) -M $(MAPFILE)
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB)
 
 LINTFLAGS +=	-x
 LINTFLAGS64 +=	-x
--- a/usr/src/cmd/sgs/nm/common/nm.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/nm/common/nm.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright (c) 1988 AT&T
  * Copyright (c) 1989 AT&T
  * All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -877,7 +876,7 @@
 	int adj = 0;
 
 	if (class == ELFCLASS64)
-		adj = 4;
+		adj = 11;
 
 	/*
 	 * Print header line if needed.
@@ -1067,7 +1066,7 @@
 	int adj		= 0;
 
 	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64)
-		adj = 4;
+		adj = 11;
 
 	if (is_sym_print(sym_data) != 1)
 		return;
@@ -1179,7 +1178,7 @@
 	int adj = 0;
 
 	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64)
-		adj = 4;
+		adj = 11;
 
 	if (is_sym_print(sym_data) != 1)
 		return;
@@ -1282,7 +1281,7 @@
 	int adj = 0;
 
 	if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64)
-		adj = 4;
+		adj = 11;
 
 	if (is_sym_print(sym_data) != 1)
 		return;
--- a/usr/src/cmd/sgs/packages/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/sgs/packages/Makefile
 
 include		$(SRC)/Makefile.master
 include		$(SRC)/cmd/sgs/Makefile.var
@@ -135,9 +134,6 @@
 			$(ROOT)/usr/include/rtld_db.h \
 			$(ROOT)/usr/include/link.h
 		@ cd $(SRC)/lib/libproc; pwd; $(MAKE) install_h
-$(VAR_SPEC_ON)	@ cd $(SRC)/head; pwd;	$(MAKE) \
-$(VAR_SPEC_ON)		$(ROOT)/usr/include/apptrace.h \
-$(VAR_SPEC_ON)		$(ROOT)/usr/include/apptrace_impl.h
 		@ cd $(SRC)/uts/common/sys; pwd; $(MAKE) \
 			$(ROOT)/usr/include/sys/elf.h \
 			$(ROOT)/usr/include/sys/elf_386.h \
@@ -152,9 +148,8 @@
 			$(ROOT)/usr/include/sys/link.h \
 			$(ROOT)/usr/include/sys/note.h \
 			$(ROOT)/usr/include/sys/systeminfo.h
-$(VAR_SPEC_ON)	@ cd $(SRC)/uts/$(M32)/sys; pwd; $(MAKE) \
+		@ cd $(SRC)/uts/$(M32)/sys; pwd; $(MAKE) \
 			$(ROOT)/usr/include/sys/machelf.h
-$(VAR_SPEC_ON)	@ cd $(SRC)/lib/abi; pwd; $(MAKE) spec
 		@ cd ../tools/$(MACH); pwd; $(MAKE) sgsmsg piglatin
 		@ cd ..; pwd; $(MAKE) _msg_sgsmsg
 		@ cd ..; pwd; $(MAKE) native-add
--- a/usr/src/cmd/sgs/packages/Makefile.lint	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/Makefile.lint	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -53,7 +53,6 @@
 		../ldprof \
 		../link_audit \
 		../libldmake \
-		../librtld_db \
 		../rtld/mdbmod
 
 LINTLDIRS=	../libld \
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README	Tue Mar 14 09:22:52 2006 -0800
@@ -1089,3 +1089,7 @@
 6380470 32-bit ld(1) incorrectly builds 64-bit relocatable objects
 6391407 Insufficient alignment of 32-bit object in archive makes ld segfault
         (libelf component only)
+6316708 LD_DEBUG should provide a means of identifying/isolating individual
+        link-map lists
+6280209 elfdump cores on memory model 0x3
+6197234 elfdump and dump don't handle 64-bit symbols correctly
--- a/usr/src/cmd/sgs/packages/common/prototype_com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/common/prototype_com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -55,8 +55,7 @@
 s none $SGSDIR/lib/libdl.so=./libdl.so.1
 f none $SGSDIR/lib/libelf.so.1=lib/libelf.so.1 755 root bin
 s none $SGSDIR/lib/libelf.so=./libelf.so.1
-f none $SGSDIR/lib/libld.so.2=lib/libld.so.2 755 root bin
-f none $SGSDIR/lib/libld.so.3=lib/libld.so.3 755 root bin
+f none $SGSDIR/lib/libld.so.4=lib/libld.so.4 755 root bin
 f none $SGSDIR/lib/liblddbg.so.4=lib/liblddbg.so.4 755 root bin
 f none $SGSDIR/lib/librtld.so.1=lib/librtld.so.1 755 root bin
 s none $SGSDIR/lib/librtld_db.so=librtld_db.so.1
--- a/usr/src/cmd/sgs/packages/common/prototype_i386	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/common/prototype_i386	Tue Mar 14 09:22:52 2006 -0800
@@ -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,11 +18,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 # This required package information file contains a list of package contents.
 # The 'pkgmk' command uses this file to identify the contents of a package
@@ -37,23 +37,19 @@
 
 !include prototype_com
 
-#
-# XX64 - still have files to fill in
-#
-
 d none $SGSDIR/lib/amd64=lib/amd64 755 root bin
 f none $SGSDIR/lib/amd64/ld.so.1=lib/amd64/ld.so.1 755 root bin
 f none $SGSDIR/lib/amd64/libdl.so.1=lib/amd64/libdl.so.1 755 root bin
 s none $SGSDIR/lib/amd64/libdl.so=libdl.so.1
 f none $SGSDIR/lib/amd64/libelf.so.1=lib/amd64/libelf.so.1 755 root bin
 s none $SGSDIR/lib/amd64/libelf.so=libelf.so.1
-f none $SGSDIR/lib/amd64/libld.so.2=lib/amd64/libld.so.2 755 root bin
-f none $SGSDIR/lib/amd64/libld.so.3=lib/amd64/libld.so.3 755 root bin
+f none $SGSDIR/lib/amd64/libld.so.4=lib/amd64/libld.so.4 755 root bin
 f none $SGSDIR/lib/amd64/liblddbg.so.4=lib/amd64/liblddbg.so.4 755 root bin
 f none $SGSDIR/lib/amd64/librtld.so.1=lib/amd64/librtld.so.1 755 root bin
 f none $SGSDIR/lib/amd64/librtld_db.so.1=lib/amd64/librtld_db.so.1 755 root bin
 s none $SGSDIR/lib/amd64/librtld_db.so=librtld_db.so.1
 d none $SGSDIR/usr/bin/amd64 755 root bin
+f none $SGSDIR/usr/bin/amd64/moe=usr/bin/amd64/moe 555 root bin
 f none $SGSDIR/usr/bin/amd64/pvs=usr/bin/amd64/pvs 555 root bin
 d none $SGSDIR/usr/ccs/bin/amd64 755 root bin
 f none $SGSDIR/usr/ccs/bin/amd64/elfdump=usr/ccs/bin/amd64/elfdump 0555 root bin
@@ -62,9 +58,9 @@
 l none $SGSDIR/usr/ccs/bin/amd64/strip=../../../../usr/ccs/bin/amd64/mcs
 d none $SGSDIR/usr/lib/link_audit/amd64 755 root bin
 s none $SGSDIR/usr/lib/link_audit/64=amd64
-#f none $SGSDIR/usr/lib/link_audit/amd64/ldprof.so.1=usr/lib/link_audit/amd64/ldprof.so.1 755 root bin
-#f none $SGSDIR/usr/lib/link_audit/amd64/truss.so.1=usr/lib/link_audit/amd64/truss.so.1 755 root bin
-#f none $SGSDIR/usr/lib/link_audit/amd64/who.so.1=usr/lib/link_audit/amd64/who.so.1 755 root bin
+f none $SGSDIR/usr/lib/link_audit/amd64/ldprof.so.1=usr/lib/link_audit/amd64/ldprof.so.1 755 root bin
+f none $SGSDIR/usr/lib/link_audit/amd64/truss.so.1=usr/lib/link_audit/amd64/truss.so.1 755 root bin
+f none $SGSDIR/usr/lib/link_audit/amd64/who.so.1=usr/lib/link_audit/amd64/who.so.1 755 root bin
 d none $SGSDIR/usr/lib/mdb/proc/amd64 755 root sys
 f none $SGSDIR/usr/lib/mdb/proc/amd64/ld.so=usr/lib/mdb/proc/amd64/ld.so 555 root sys
 d none $SGSDIR/usr/lib/secure/amd64 755 root bin
@@ -79,6 +75,6 @@
 d none opt/SUNWonld/lib/amd64 755 root bin
 s none opt/SUNWonld/lib/64=amd64
 f none opt/SUNWonld/lib/amd64/libldmake.so.1 755 root bin
-#f none opt/SUNWonld/lib/amd64/bindings.so.1 755 root bin
-#f none opt/SUNWonld/lib/amd64/perfcnt.so.1 755 root bin
-#f none opt/SUNWonld/lib/amd64/symbindrep.so.1 755 root bin
+f none opt/SUNWonld/lib/amd64/bindings.so.1 755 root bin
+f none opt/SUNWonld/lib/amd64/perfcnt.so.1 755 root bin
+f none opt/SUNWonld/lib/amd64/symbindrep.so.1 755 root bin
--- a/usr/src/cmd/sgs/packages/common/prototype_sparc	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/common/prototype_sparc	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -43,8 +43,7 @@
 s none $SGSDIR/lib/sparcv9/libdl.so=libdl.so.1
 f none $SGSDIR/lib/sparcv9/libelf.so.1=lib/sparcv9/libelf.so.1 755 root bin
 s none $SGSDIR/lib/sparcv9/libelf.so=libelf.so.1
-f none $SGSDIR/lib/sparcv9/libld.so.2=lib/sparcv9/libld.so.2 755 root bin
-f none $SGSDIR/lib/sparcv9/libld.so.3=lib/sparcv9/libld.so.3 755 root bin
+f none $SGSDIR/lib/sparcv9/libld.so.4=lib/sparcv9/libld.so.4 755 root bin
 f none $SGSDIR/lib/sparcv9/liblddbg.so.4=lib/sparcv9/liblddbg.so.4 755 root bin
 f none $SGSDIR/lib/sparcv9/librtld.so.1=lib/sparcv9/librtld.so.1 755 root bin
 f none $SGSDIR/lib/sparcv9/librtld_db.so.1=lib/sparcv9/librtld_db.so.1 755 root bin
--- a/usr/src/cmd/sgs/packages/inc.flg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/packages/inc.flg	Tue Mar 14 09:22:52 2006 -0800
@@ -3,9 +3,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.
@@ -22,7 +21,7 @@
 #
 
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI" 
@@ -59,7 +58,6 @@
 	usr/src/cmd/sgs/sgsdemangler \
 	usr/src/common/avl \
 	usr/src/common/elfcap \
-	usr/src/lib/abi/apptrace \
 	usr/src/lib/libc/inc \
 	usr/src/lib/libproc \
 	usr/src/lib/common
@@ -109,7 +107,3 @@
 echo_file usr/src/lib/Makefile.lib
 echo_file usr/src/lib/Makefile.lib.64
 echo_file usr/src/lib/Makefile.targ
-echo_file usr/src/lib/Makefile.spec
-echo_file usr/src/lib/Makefile.spec.arch
-echo_file usr/src/lib/abi/Makefile
-exec_file usr/src/lib/abi/req.flg
--- a/usr/src/cmd/sgs/pvs/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -41,8 +41,8 @@
 LLDFLAGS =	'-R$$ORIGIN/../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../lib/$(MACH64)'
 LDFLAGS +=	$(VERSREF) $(USE_PROTO) -M$(MAPFILE) $(LLDFLAGS)
-LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf $(LDDBGLIBDIR) \
-		$(LDDBG_LIB)
+LDLIBS +=	$(LDDBGLIBDIR) $(LDDBG_LIB) $(ELFLIBDIR) -lelf \
+		    $(CONVLIBDIR) $(CONV_LIB)
 LINTFLAGS +=	-x
 LINTFLAGS64 +=	-x
 
--- a/usr/src/cmd/sgs/pvs/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -30,13 +30,13 @@
 
 .KEEP_STATE:
 
-LLDFLAGS=	$(LLDFLAGS64)
-CONVLIBDIR=	$(CONVLIBDIR64)
-ELFLIBDIR=	$(ELFLIBDIR64)
-LDDBGLIBDIR=	$(LDDBGLIBDIR64)
+LLDFLAGS =	$(LLDFLAGS64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
-ROOTPROG=$(ROOTPROG64)
+ROOTPROG =	$(ROOTPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/pvs/common/lintsup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/common/lintsup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -23,8 +22,8 @@
 /* PROTOLIB1 */
 
 /*
- * Copyright (c) 2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -33,11 +32,11 @@
  * these symbols used.
  */
 
-#include "debug.h"
+#include <debug.h>
 #include "msg.h"
 
 void
 foo()
 {
-	dbg_print(_pvs_msg((Msg)&__pvs_msg[0]));
+	dbg_print(0, _pvs_msg((Msg)&__pvs_msg[0]));
 }
--- a/usr/src/cmd/sgs/pvs/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -25,12 +19,17 @@
 # CDDL HEADER END
 #
 
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 # Specify what global symbols we export (none).  Note that we're not
 # interested in declaring a version, simply scoping the file is sufficient.
 
 {
 	global:
-		dbg_print;
 		main;			# debuggers seem to like this.
 	local:
 		*;
--- a/usr/src/cmd/sgs/pvs/common/pvs.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/common/pvs.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -60,11 +60,10 @@
 #include	<unistd.h>
 #include	<locale.h>
 #include	<errno.h>
-#include	<sys/varargs.h>
-#include	"sgs.h"
-#include	"conv.h"
-#include	"debug.h"
-#include	"gelf.h"
+#include	<sgs.h>
+#include	<conv.h>
+#include	<gelf.h>
+#include	<debug.h>
 #include	"msg.h"
 
 #define		FLG_VER_AVAIL	0x10
@@ -105,29 +104,11 @@
 demangle(const char *name)
 {
 	if (Cflag)
-		return (Gelf_sym_dem(name));
+		return (Elf_demangle_name(name));
 	else
 		return (name);
 }
 
-
-/*
- * Define our own printing routine.  We don't actually use this, but because
- * we use liblddbg to demangle symbols we need to provide this to satisfy
- * liblddbg's binding requirements.
- */
-/*PRINTFLIKE1*/
-void
-dbg_print(const char *format, ...)
-{
-	va_list	ap;
-
-	va_start(ap, format);
-	(void) vprintf(format, ap);
-	(void) printf(MSG_ORIG(MSG_STR_NL));
-}
-
-
 /*
  * Print any reduced symbols.  The convention is that reduced symbols exist as
  * LOCL entries in the .symtab, between the FILE symbol for the output file and
--- a/usr/src/cmd/sgs/pvs/common/pvs.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/common/pvs.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,9 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 
-
 @ _START_
 
 # Message file for cmd/sgs/pvs.
@@ -78,6 +78,5 @@
 @ MSG_ELF_GETDATA	"%s: %s: elf_getdata: %s\n"
 
 @ MSG_STR_EMPTY		""
-@ MSG_STR_NL		"\n"
 
 @ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
--- a/usr/src/cmd/sgs/pvs/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/pvs/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2000-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -30,13 +29,13 @@
 
 .KEEP_STATE:
 
-LLDFLAGS=	$(LLDFLAGS64)
-CONVLIBDIR=	$(CONVLIBDIR64)
-ELFLIBDIR=	$(ELFLIBDIR64)
-LDDBGLIBDIR=	$(LDDBGLIBDIR64)
+LLDFLAGS =	$(LLDFLAGS64)
+CONVLIBDIR =	$(CONVLIBDIR64)
+ELFLIBDIR =	$(ELFLIBDIR64)
+LDDBGLIBDIR =	$(LDDBGLIBDIR64)
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 
-ROOTPROG=$(ROOTPROG64)
+ROOTPROG =	$(ROOTPROG64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/rtld/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -44,7 +44,8 @@
 
 include		$(SRC)/lib/Makefile.lib
 include		$(SRC)/cmd/sgs/Makefile.com
-PLAT=		$(VAR_PLAT_$(BASEPLAT))
+
+PLAT =		$(VAR_PLAT_$(BASEPLAT))
 
 # Dtrace needs an executable data segment.
 NX_MAP=
@@ -73,7 +74,7 @@
 CPPFEATUREMACROS= $(VAR_RTLD_CPPFEATUREMACROS)
 
 CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc -I$(SRCBASE)/uts/common/krtld \
-		$(CPPFEATUREMACROS)
+		    -I$(SRCBASE)/uts/$(PLAT)/krtld $(CPPFEATUREMACROS)
 ASFLAGS=	-P -D_ASM $(CPPFLAGS)
 LDLIB =		-L ../../libld/$(MACH)
 RTLDLIB =	-L ../../librtld/$(MACH)
@@ -85,12 +86,11 @@
 CPICLIB64 =	$(VAR_RTLD_CPICLIB64)
 CLIB =		-lc_pic
 
-LDLIBS=		$(LDLIBS.lib) \
-		$(CONVLIBDIR) -lconv \
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) \
 		$(CPICLIB) $(CLIB) \
-		$(LDLIB) $(LD_LIB) \
 		$(LDDBGLIBDIR) $(LDDBG_LIB) \
-		$(RTLDLIB) -lrtld
+		$(RTLDLIB) -lrtld \
+		$(LDLIB) $(LD_LIB) 
 
 DYNFLAGS +=	-i -e _rt_boot $(VERSREF) -Bsymbolic -zlazyload -znodlopen \
 		-zdtrace=dtrace_data $(MAPOPTS) '-R$$ORIGIN'
--- a/usr/src/cmd/sgs/rtld/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -65,7 +65,7 @@
 
 $(RTLD):	pics $(PICS) $(CRTS) $(MAPFILES)
 		$(SGSPROTO)/ld -o $@ -dy -G $(DYNFLAGS) $(CRTI) $(PICS) \
-		$(LDLIBS) $(CRTN)
+		    $(LDLIBS) $(CRTN)
 		$(POST_PROCESS_SO)
 
 delete:
--- a/usr/src/cmd/sgs/rtld/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,16 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+BASEPLAT =	amd64
+
 # Object lists are organized into primary (most frequently used code) and
 # secondary lists (less frequently used code, ie. a.out support).
 
@@ -33,7 +35,7 @@
 		analyze.o	elf.o		globals.o	malloc.o \
 		mutex.o		paths.o		setup.o		util.o \
 		dlfcns.o	config_elf.o	locale.o	tsort.o \
-		getcwd.o	remove.o	sunwmove.o	tls.o \
+		getcwd.o	remove.o	move.o		tls.o \
 		cap.o
 
 S_COMOBJS=	debug.o		audit.o		object.o
@@ -56,23 +58,17 @@
 CRTN=		pics/crtn.o
 CRTS=		$(CRTI)		$(CRTN)
 
-BASEPLAT=	amd64
-
-include		$(SRC)/Makefile.master
+include		$(SRC)/cmd/sgs/rtld/Makefile.com
+include		$(SRC)/lib/Makefile.lib.64
 
 # We build 64-bit objects with gcc by default
 MAPFILE-ORDER =			../common/mapfile-order-devpro
 $(__GNUC64)MAPFILE-ORDER =	../common/mapfile-order-gcc
 
-MAPFILE-PLAT =		 mapfile-amd64-vers
-
-include		$(SRC)/cmd/sgs/rtld/Makefile.com
-include		$(SRC)/lib/Makefile.lib.64
-
+MAPFILE-PLAT =	 mapfile-amd64-vers
 
 # Add any machine specific flags.
 
-CPPFLAGS +=	-I../../../../uts/intel/amd64/krtld -DELF_TARGET_AMD64
 CFLAGS +=	-xregs=no%appl
 ASFLAGS +=	-D__amd64 -D_ELF64 $(amd64_ASFLAGS)
 ADBGENFLAGS +=	-mlp64
@@ -84,8 +80,6 @@
 
 SGSMSGTARG +=	$(SGSMSGINTEL) $(SGSMSGINTEL64) $(SGSMSG64)
 
-DYNFLAGS +=	-zdtrace=dtrace_data 
-
 LDLIB =		-L ../../libld/$(MACH64)
 RTLDLIB =	-L ../../librtld/$(MACH64)
 
@@ -93,6 +87,7 @@
 LDDBGLIBDIR =	$(LDDBGLIBDIR64)
 CONVLIBDIR =	$(CONVLIBDIR64)
 
+MAPFILES +=	../common/mapfile-64-vers
 
 .KEEP_STATE:
 
@@ -106,11 +101,5 @@
 
 adbinstall:	adbmacros .WAIT $(ROOTADB64)
 
-
-pics/%.o:	$(SRCBASE)/uts/intel/amd64/krtld/%.c
-		$(COMPILE.c) -o $@ $<  $(WARNFLAGS)
-		$(POST_PROCESS_O)
-
-
 include		$(SRC)/cmd/sgs/rtld/Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/rtld/amd64/_setup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/amd64/_setup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -44,10 +44,10 @@
 #include	<sys/stat.h>
 #include	<link.h>
 #include	<dlfcn.h>
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"msg.h"
-#include	"debug.h"
 
 extern int	_end;
 extern int	_etext;
--- a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -38,13 +38,13 @@
 #include	<dlfcn.h>
 #include	<synch.h>
 #include	<string.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"reloc.h"
-#include	"conv.h"
 
 
 extern void	elf_rtbndr(Rt_map *, ulong_t, caddr_t);
@@ -148,6 +148,7 @@
 	if (*dyn_plt == 0) {
 		Sym *	symp;
 		Xword	symvalue;
+		Lm_list	*lml = LIST(rlmp);
 
 		(void) memcpy((void *)dyn_plt, dyn_plt_template,
 		    sizeof (dyn_plt_template));
@@ -161,9 +162,9 @@
 		 */
 		symvalue = (Xword)((uintptr_t)dyndata -
 		    (uintptr_t)(&dyn_plt[TRCREL1OFF]) - 4);
-		if (do_reloc(R_AMD64_PC32, &dyn_plt[TRCREL1OFF], &symvalue,
-		    MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		if (do_reloc(R_AMD64_PC32, &dyn_plt[TRCREL1OFF],
+		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -174,9 +175,9 @@
 		 *	R_AMD64_64	0x15	0	elf_plt_trace
 		 */
 		symvalue = (Xword)elf_plt_trace;
-		if (do_reloc(R_AMD64_64, &dyn_plt[TRCREL2OFF], &symvalue,
-		    MSG_ORIG(MSG_SYM_ELFPLTTRACE),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		if (do_reloc(R_AMD64_64, &dyn_plt[TRCREL2OFF],
+		    &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE),
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -218,9 +219,10 @@
 	char		*name;
 	Rela		*rptr;
 	Sym		*sym, *nsym;
-	uint_t		binfo, sb_flags = 0;
+	uint_t		binfo, sb_flags = 0, dbg_class;
 	Slookup		sl;
-	int		entry, dbg_save, lmflags;
+	int		entry, lmflags;
+	Lm_list		*lml;
 
 	/*
 	 * For compatibility with libthread (TI_VERSION 1) we track the entry
@@ -230,9 +232,10 @@
 	 */
 	entry = enter();
 
-	if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
+	lml = LIST(lmp);
+	if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
+		dbg_class = dbg_desc->d_class;
+		dbg_desc->d_class = 0;
 	}
 
 	/*
@@ -242,10 +245,10 @@
 	 */
 	if ((!lmp) && (pltndx <=
 	    (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp))) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
-		    conv_reloc_amd64_type_str(R_AMD64_JUMP_SLOT),
-		    EC_ADDR(lmp), EC_XWORD(pltndx), EC_ADDR(from));
-		rtldexit(LIST(lmp), 1);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
+		    conv_reloc_amd64_type(R_AMD64_JUMP_SLOT),
+		    EC_NATPTR(lmp), EC_XWORD(pltndx), EC_NATPTR(from));
+		rtldexit(lml, 1);
 	}
 	reloff = pltndx * (ulong_t)RELENT(lmp);
 
@@ -262,22 +265,22 @@
 	 * Determine the last link-map of this list, this'll be the starting
 	 * point for any tsort() processing.
 	 */
-	llmp = LIST(lmp)->lm_tail;
+	llmp = lml->lm_tail;
 
 	/*
 	 * Find definition for symbol.
 	 */
 	sl.sl_name = name;
 	sl.sl_cmap = lmp;
-	sl.sl_imap = LIST(lmp)->lm_head;
+	sl.sl_imap = lml->lm_head;
 	sl.sl_hash = 0;
 	sl.sl_rsymndx = rsymndx;
 	sl.sl_flags = LKUP_DEFT;
 
 	if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 		    demangle(name));
-		rtldexit(LIST(lmp), 1);
+		rtldexit(lml, 1);
 	}
 
 	symval = nsym->st_value;
@@ -289,10 +292,10 @@
 		 * Record that this new link map is now bound to the caller.
 		 */
 		if (bind_one(lmp, nlmp, BND_REFER) == 0)
-			rtldexit(LIST(lmp), 1);
+			rtldexit(lml, 1);
 	}
 
-	if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
+	if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
 		uint_t	symndx = (((uintptr_t)nsym -
 			(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
 		symval = audit_symbind(lmp, nlmp, nsym, symndx, symval,
@@ -303,7 +306,7 @@
 		addr = rptr->r_offset;
 		if (!(FLAGS(lmp) & FLG_RT_FIXED))
 			addr += ADDR(lmp);
-		if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) &
+		if (((lml->lm_tflags | FLAGS1(lmp)) &
 		    (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) &&
 		    AUDINFO(lmp)->ai_dynplts) {
 			int	fail = 0;
@@ -316,7 +319,7 @@
 			    nsym, symndx, pltndx, (caddr_t)symval, sb_flags,
 			    &fail);
 			if (fail)
-				rtldexit(LIST(lmp), 1);
+				rtldexit(lml, 1);
 		} else {
 			/*
 			 * Write standard PLT entry to jump directly
@@ -329,9 +332,9 @@
 	/*
 	 * Print binding information and rebuild PLT entry.
 	 */
-	DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp),
-	    (Xword)(reloff / sizeof (Rela)), PLT_T_FULL, NAME(nlmp),
-	    (caddr_t)symval, (caddr_t)nsym->st_value, name, binfo));
+	DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)),
+	    (Xword)(reloff / sizeof (Rela)), PLT_T_FULL, nlmp,
+	    (Addr)symval, nsym->st_value, name, binfo));
 
 	/*
 	 * Complete any processing for newly loaded objects.  Note we don't
@@ -348,7 +351,7 @@
 	 * result in objects being loaded on rtld's link-map, make sure these
 	 * objects are initialized also.
 	 */
-	if ((LIST(nlmp)->lm_flags & LML_FLG_RTLDLM) && LIST(nlmp)->lm_init)
+	if ((lml->lm_flags & LML_FLG_RTLDLM) && LIST(nlmp)->lm_init)
 		load_completion(nlmp, 0);
 
 	/*
@@ -363,11 +366,11 @@
 	 */
 	if (entry) {
 		is_dep_init(nlmp, lmp);
-		leave(LIST(lmp));
+		leave(lml);
 	}
 
 	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+		dbg_desc->d_class = dbg_class;
 
 	return (symval);
 }
@@ -558,10 +561,10 @@
 		}
 	}
 	if (!relbgn || (relbgn == relend)) {
-		DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE));
+		DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE));
 		return (1);
 	}
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START));
+	DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START));
 
 	/*
 	 * If we're processing a dynamic executable in lazy mode there is no
@@ -588,7 +591,7 @@
 		 * jump if we've been given a hint on the number of relocations.
 		 */
 		if ((rtype == R_AMD64_RELATIVE) &&
-		    !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) {
+		    ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) {
 			/*
 			 * It's possible that the relative relocation block
 			 * has relocations against the text segment as well
@@ -738,9 +741,8 @@
 				    (rtype != R_AMD64_COPY)) {
 					/* LINTED */
 					if (psymdef == 0) {
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					}
@@ -805,11 +807,13 @@
 					 * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND)
 					 */
 					if (symdef == 0) {
+					    Lm_list	*lml = LIST(lmp);
+
 					    if (bind != STB_WEAK) {
-						if (LIST(lmp)->lm_flags &
+						if (lml->lm_flags &
 						    LML_FLG_IGNRELERR) {
 						    continue;
-						} else if (LIST(lmp)->lm_flags &
+						} else if (lml->lm_flags &
 						    LML_FLG_TRC_WARN) {
 						    (void) printf(MSG_INTL(
 							MSG_LDD_SYM_NFOUND),
@@ -817,7 +821,7 @@
 							NAME(lmp));
 						    continue;
 						} else {
-						    eprintf(ERR_FATAL,
+						    eprintf(lml, ERR_FATAL,
 							MSG_INTL(MSG_REL_NOSYM),
 							NAME(lmp),
 							demangle(name));
@@ -828,9 +832,8 @@
 						psymndx = rsymndx;
 						psymdef = 0;
 
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					    }
@@ -935,7 +938,8 @@
 		/*
 		 * Call relocation routine to perform required relocation.
 		 */
-		DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL));
+		DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH,
+		    M_REL_SHT_TYPE, rel, NULL, name));
 
 		switch (rtype) {
 		case R_AMD64_COPY:
@@ -964,7 +968,8 @@
 				 * Write standard PLT entry to jump directly
 				 * to newly bound function.
 				 */
-				DBG_CALL(Dbg_reloc_apply((Xword)roffset,
+				DBG_CALL(Dbg_reloc_apply_val(LIST(lmp),
+				    ELF_DBG_RTLD, (Xword)roffset,
 				    (Xword)value));
 				*(ulong_t *)roffset = value;
 			}
@@ -975,11 +980,11 @@
 			 * Write the relocation out.
 			 */
 			if (do_reloc(rtype, (uchar_t *)roffset,
-			    (Xword *)&value, name, NAME(lmp)) == 0)
+			    (Xword *)&value, name, NAME(lmp), LIST(lmp)) == 0)
 				ret = 0;
 
-			DBG_CALL(Dbg_reloc_apply((Xword)roffset,
-			    (Xword)value));
+			DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD,
+			    (Xword)roffset, (Xword)value));
 		}
 
 		if ((ret == 0) &&
@@ -987,10 +992,9 @@
 			break;
 
 		if (binfo) {
-			DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset,
-			    (caddr_t)(roffset - basebgn), (Xword)(-1),
-			    PLT_T_FULL, NAME(_lmp), (caddr_t)value,
-			    (caddr_t)symdef->st_value, name, binfo));
+			DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset,
+			    (Off)(roffset - basebgn), (Xword)(-1), PLT_T_FULL,
+			    _lmp, (Addr)value, symdef->st_value, name, binfo));
 		}
 	}
 
@@ -1041,7 +1045,7 @@
  * ld.so.1.
  */
 const char *
-_conv_reloc_type_str(uint_t rel)
+_conv_reloc_type(uint_t rel)
 {
-	return (conv_reloc_amd64_type_str(rel));
+	return (conv_reloc_amd64_type(rel));
 }
--- a/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -41,25 +41,24 @@
 #include <stdio.h>
 
 static Dl_amd64_unwindinfo *
-getunwind_core(void * pc, Dl_amd64_unwindinfo *unwindinfo)
+getunwind_core(Rt_map *clmp, void *pc, Dl_amd64_unwindinfo *unwindinfo)
 {
-	Rt_map	    *lmp;
-
 	/*
-	 * Validate the version information
+	 * Validate the version information.
 	 */
 	if (unwindinfo == NULL) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL));
+		eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL));
 		return (0);
 	}
 	if ((unwindinfo->dlui_version < DLUI_VERS_1) ||
 	    (unwindinfo->dlui_version > DLUI_VERS_CURRENT)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_UNW_BADVERS),
+		eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_UNW_BADVERS),
 		    DLUI_VERS_CURRENT, unwindinfo->dlui_version);
 		return (0);
 	}
+
 	/*
-	 * clean out the structure
+	 * Clean out the structure.
 	 */
 	unwindinfo->dlui_flags = 0;
 	unwindinfo->dlui_objname = 0;
@@ -68,15 +67,16 @@
 	unwindinfo->dlui_segstart = 0;
 	unwindinfo->dlui_segend = 0;
 
-	lmp = _caller(pc, 0);
-	if (lmp) {
+	if (clmp) {
 		Mmap	*immap;
-		unwindinfo->dlui_objname = PATHNAME(lmp);
+
+		unwindinfo->dlui_objname = PATHNAME(clmp);
+
 		/*
-		 * Scan through the mmaps of this object to get
-		 * the specific segment found.
+		 * Scan through the mmaps of this object to get the specific
+		 * segment found.
 		 */
-		for (immap = MMAPS(lmp); immap->m_vaddr; immap++) {
+		for (immap = MMAPS(clmp); immap->m_vaddr; immap++) {
 			if (((caddr_t)pc >= immap->m_vaddr) &&
 			    ((caddr_t)pc < (immap->m_vaddr + immap->m_msize))) {
 				break;
@@ -84,26 +84,29 @@
 		}
 		unwindinfo->dlui_segstart = immap->m_vaddr;
 		unwindinfo->dlui_segend = immap->m_vaddr + immap->m_msize;
-		if (PTUNWIND(lmp) && (immap->m_vaddr)) {
+
+		if (PTUNWIND(clmp) && (immap->m_vaddr)) {
 			uintptr_t   base;
-			if (FLAGS(lmp) & FLG_RT_FIXED)
+
+			if (FLAGS(clmp) & FLG_RT_FIXED)
 				base = 0;
 			else
-				base = ADDR(lmp);
+				base = ADDR(clmp);
+
 			unwindinfo->dlui_unwindstart =
-			    (void *)(PTUNWIND(lmp)->p_vaddr + base);
+			    (void *)(PTUNWIND(clmp)->p_vaddr + base);
 			unwindinfo->dlui_unwindend =
-			    (void *)(PTUNWIND(lmp)->p_vaddr +
-			    PTUNWIND(lmp)->p_memsz + base);
-		} else if (immap->m_vaddr)  {
+			    (void *)(PTUNWIND(clmp)->p_vaddr +
+			    PTUNWIND(clmp)->p_memsz + base);
+
+		} else if (immap->m_vaddr)
 			unwindinfo->dlui_flags |= DLUI_FLG_NOUNWIND;
-		} else {
+		else
 			unwindinfo->dlui_flags |=
 			    DLUI_FLG_NOUNWIND | DLUI_FLG_NOOBJ;
-		}
 	} else {
 		/*
-		 * No object found
+		 * No object found.
 		 */
 		unwindinfo->dlui_flags = DLUI_FLG_NOOBJ | DLUI_FLG_NOUNWIND;
 	}
@@ -111,18 +114,18 @@
 }
 
 #pragma weak dlamd64getunwind = _dlamd64getunwind
-Dl_amd64_unwindinfo *
-_dlamd64getunwind(void * pc, Dl_amd64_unwindinfo *unwindinfo)
-{
-	int	    entry;
 
+Dl_amd64_unwindinfo *
+_dlamd64getunwind(void *pc, Dl_amd64_unwindinfo *unwindinfo)
+{
+	Rt_map	*clmp;
+	int	entry = enter();
 
-	entry = enter();
+	clmp = _caller(caller(), CL_NONE);
 
-	unwindinfo = getunwind_core(pc, unwindinfo);
+	unwindinfo = getunwind_core(clmp, pc, unwindinfo);
 
 	if (entry)
-	    leave(0);
-
+		leave(LIST(clmp));
 	return (unwindinfo);
 }
--- a/usr/src/cmd/sgs/rtld/common/_rtld.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/_rtld.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	  All Rights Reserved
  *
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -49,6 +48,7 @@
 #include <sgs.h>
 #include <machdep.h>
 #include <rtc.h>
+#include <debug.h>
 #include <msg.h>
 #include <libc_int.h>
 
@@ -299,10 +299,9 @@
 /*
  * Status flags for rtld_flags2
  */
-#define	RT_FL2_HASAUDIT	0x00000001	/* We have auditing lm_list */
+#define	RT_FL2_HASAUDIT	0x00000001	/* auditing lm_list is present */
 #define	RT_FL2_RTLDSEEN	0x00000002	/* rtldinfo has been set */
-#define	RT_FL2_UNIFPROC	0x00000004	/* we're running in libc/libthread */
-					/*	Unified environment */
+#define	RT_FL2_UNIFPROC	0x00000004	/* libc/libthread unified environment */
 #define	RT_FL2_NOMALIGN	0x00000008	/* mmap MAP_ALIGN isn't available */
 #define	RT_FL2_NOFLTCFG	0x00000010	/* disable config filter use */
 #define	RT_FL2_FLTCFG	0x00000020	/* filter config info available */
@@ -494,13 +493,13 @@
 extern int		alist_test(Alist **, void *, size_t, int);
 extern int		append_alias(Rt_map *, const char *, int *);
 extern int		analyze_lmc(Lm_list *, Aliste, Rt_map *);
-extern Am_ret		anon_map(caddr_t *, size_t, int, int);
+extern Am_ret		anon_map(Lm_list *, caddr_t *, size_t, int, int);
 extern Fct		*are_u_this(Rej_desc *, int, struct stat *,
 			    const char *);
 extern void		atexit_fini(void);
 extern int		bind_one(Rt_map *, Rt_map *, uint_t);
 extern int		bufprint(Prfbuf *, const char *, ...);
-extern void		call_array(Addr *, uint_t, Rt_map *, uint_t);
+extern void		call_array(Addr *, uint_t, Rt_map *, Word);
 extern void		call_fini(Lm_list *, Rt_map **);
 extern void		call_init(Rt_map **, int);
 extern int		callable(Rt_map *, Rt_map *, Grp_hdl *);
@@ -508,8 +507,8 @@
 extern caddr_t		caller(void);
 extern void		*calloc(size_t, size_t);
 extern void		cap_assign(Cap *, Rt_map *);
-extern const char	*_conv_reloc_type_str(uint_t rel);
-extern uint_t		dbg_setup(const char *);
+extern const char	*_conv_reloc_type(uint_t rel);
+extern uintptr_t	dbg_setup(const char *, Dbg_desc *);
 extern const char	*demangle(const char *);
 extern int		dlclose_intn(Grp_hdl *, Rt_map *);
 extern int		dlclose_core(Grp_hdl *, Rt_map *);
@@ -521,11 +520,11 @@
 extern size_t		doprf(const char *, va_list, Prfbuf *);
 extern int		dowrite(Prfbuf *);
 extern void		dz_init(int);
-extern caddr_t		dz_map(caddr_t, size_t, int, int);
+extern caddr_t		dz_map(Lm_list *, caddr_t, size_t, int, int);
 extern int		elf_config(Rt_map *, int);
 extern int		elf_mach_flags_check(Rej_desc *, Ehdr *);
 extern Rtc_obj		*elf_config_ent(const char *, Word, int, const char **);
-extern Pnode		*elf_config_flt(const char *, const char *);
+extern Pnode		*elf_config_flt(Lm_list *, const char *, const char *);
 extern ulong_t		elf_hash(const char *);
 extern void 		elf_reloc_bad(Rt_map *, void *, uchar_t, ulong_t,
 			    ulong_t);
@@ -534,7 +533,6 @@
 extern ulong_t		elf_reloc_relacount(ulong_t, ulong_t,
 			    ulong_t, ulong_t);
 extern int		enter(void);
-extern void		eprintf(Error, const char *, ...);
 extern uint_t		expand(char **, size_t *, char **, uint_t, uint_t,
 			    Rt_map *);
 extern Pnode		*expand_paths(Rt_map *, const char *, uint_t, uint_t);
@@ -579,10 +577,10 @@
 extern Rt_map		*load_one(Lm_list *, Aliste, Pnode *, Rt_map *, int,
 			    uint_t, Grp_hdl **);
 extern const char	*load_trace(Lm_list *, const char *, Rt_map *);
-extern caddr_t		nu_map(caddr_t, size_t, int, int);
+extern caddr_t		nu_map(Lm_list *, caddr_t, size_t, int, int);
 extern void		*malloc(size_t);
 extern void		move_data(Rt_map *);
-extern int		pr_open(void);
+extern int		pr_open(Lm_list *);
 extern void		rd_event(Lm_list *, rd_event_e, r_state_e);
 extern int		readenv_user(const char **, Word *, Word *, int);
 extern int		readenv_config(Rtc_env *, Addr, int);
@@ -606,9 +604,9 @@
 extern int		rt_mutex_lock(Rt_lock *);
 extern int		rt_mutex_unlock(Rt_lock *);
 extern thread_t		rt_thr_self(void);
-extern void		rtld_db_dlactivity(void);
-extern void		rtld_db_preinit(void);
-extern void		rtld_db_postinit(void);
+extern void		rtld_db_dlactivity(Lm_list *);
+extern void		rtld_db_preinit(Lm_list *);
+extern void		rtld_db_postinit(Lm_list *);
 extern void		rtldexit(Lm_list *, int);
 extern int		rtld_getopt(char **, char ***, auxv_t **, Word *,
 			    Word *, int);
--- a/usr/src/cmd/sgs/rtld/common/a.out.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/a.out.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -30,6 +30,9 @@
  */
 #include	"_synonyms.h"
 
+#include	<a.out.h>		/* Explicitly override M_SEGSIZE */
+#include	<machdep.h>		/*	used in M_SROUND */
+
 #include	<sys/mman.h>
 #include	<unistd.h>
 #include	<string.h>
@@ -37,11 +40,11 @@
 #include	<stdio.h>
 #include	<dlfcn.h>
 #include	<errno.h>
+#include	<debug.h>
 #include	"_a.out.h"
 #include	"cache_a.out.h"
 #include	"msg.h"
 #include	"_rtld.h"
-#include	"debug.h"
 
 /*
  * Default and secure dependency search paths.
@@ -111,7 +114,7 @@
  * filename.
  */
 static Pnode *
-aout_fix_name(const char *name)
+aout_fix_name(const char *name, Rt_map *clmp)
 {
 	size_t	len;
 	Pnode	*pnp;
@@ -137,7 +140,7 @@
 	if (pnp->p_name) {
 		pnp->p_len = len;
 		pnp->p_orig = PN_SER_NEEDED;
-		DBG_CALL(Dbg_file_fixname(pnp->p_name, name));
+		DBG_CALL(Dbg_file_fixname(LIST(clmp), pnp->p_name, name));
 		return (pnp);
 	}
 	free(pnp);
@@ -232,7 +235,7 @@
 			    name, ((Lnk_obj *)(need))->lo_major,
 			    ((Lnk_obj *)(need))->lo_minor);
 
-			DBG_CALL(Dbg_libs_find(file));
+			DBG_CALL(Dbg_libs_find(lml, file));
 
 			/*
 			 * We need to determine what filename will match the
@@ -258,9 +261,9 @@
 						break;
 				}
 				if (!path) {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_SYS_OPEN), file,
-						strerror(ENOENT));
+					    strerror(ENOENT));
 					return (0);
 				}
 				name = path;
@@ -274,10 +277,11 @@
 			 * it must be fixed to specify the current working
 			 * directory (ie. libc.so.1.2 -> ./libc.so.1.2).
 			 */
-			if ((pnp = aout_fix_name(name)) == 0)
+			if ((pnp = aout_fix_name(name, clmp)) == 0)
 				return (0);
 		}
-		DBG_CALL(Dbg_file_needed(name, NAME(clmp)));
+
+		DBG_CALL(Dbg_file_needed(clmp, name));
 
 		nlmp = load_one(lml, lmco, pnp, clmp, MODE(clmp), 0, 0);
 		remove_pnode(pnp);
@@ -442,7 +446,7 @@
 	char	name[PATH_MAX];
 	Slookup	sl = *slp;
 
-	DBG_CALL(Dbg_syms_lookup_aout(slp->sl_name));
+	DBG_CALL(Dbg_syms_lookup_aout(LIST(slp->sl_imap), slp->sl_name));
 
 	if (*sl.sl_name == '_')
 		++sl.sl_name;
@@ -471,7 +475,7 @@
 	Rt_map		*ilmp = slp->sl_imap;
 	struct nlist	*sp;
 
-	DBG_CALL(Dbg_syms_lookup(name, NAME(ilmp), MSG_ORIG(MSG_STR_AOUT)));
+	DBG_CALL(Dbg_syms_lookup(ilmp, name, MSG_ORIG(MSG_STR_AOUT)));
 
 	if (sp = aout_findsb(name, ilmp, slp->sl_flags)) {
 		if (sp->n_value != 0) {
@@ -520,7 +524,7 @@
 	if ((addr = mmap(0, size, (PROT_READ | PROT_EXEC), MAP_PRIVATE,
 	    fd, 0)) == MAP_FAILED) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
 		    strerror(err));
 		return (0);
 	}
@@ -549,7 +553,7 @@
 	    (int)exec->a_data, (PROT_READ | PROT_WRITE | PROT_EXEC),
 	    (MAP_FIXED | MAP_PRIVATE), fd, (off_t)exec->a_text) == MAP_FAILED) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
 		    strerror(err));
 		return (0);
 	}
@@ -558,7 +562,7 @@
 	 * Allocate pages for the object's bss, if necessary.
 	 */
 	if (exec->a_bss != 0) {
-		if (dz_map(addr + M_SROUND(exec->a_text) + exec->a_data,
+		if (dz_map(lml, addr + M_SROUND(exec->a_text) + exec->a_data,
 		    (int)exec->a_bss, PROT_READ | PROT_WRITE | PROT_EXEC,
 		    MAP_FIXED | MAP_PRIVATE) == MAP_FAILED)
 			goto error;
@@ -592,8 +596,8 @@
 	Rt_map	*lmp;
 	caddr_t offset;
 
-	DBG_CALL(Dbg_file_aout(pname, (ulong_t)ld, (ulong_t)addr,
-	    (ulong_t)size));
+	DBG_CALL(Dbg_file_aout(lml, pname, (ulong_t)ld, (ulong_t)addr,
+	    (ulong_t)size, lml->lm_lmidstr, lmco));
 
 	/*
 	 * Allocate space for the link-map and private a.out information.  Once
@@ -700,22 +704,22 @@
  * on the value of the argument.
  */
 int
-aout_set_prot(Rt_map *lm, int permission)
+aout_set_prot(Rt_map *lmp, int permission)
 {
 	int		prot;		/* protection setting */
 	caddr_t		et;		/* cached _etext of object */
 	size_t		size;		/* size of text segment */
 
-	DBG_CALL(Dbg_file_prot(NAME(lm), permission));
+	DBG_CALL(Dbg_file_prot(lmp, permission));
 
-	et = (caddr_t)ETEXT(lm);
-	size = M_PROUND((ulong_t)(et - TEXTBASE(lm)));
+	et = (caddr_t)ETEXT(lmp);
+	size = M_PROUND((ulong_t)(et - TEXTBASE(lmp)));
 	prot = PROT_READ | PROT_EXEC | permission;
-	if (mprotect((caddr_t)TEXTBASE(lm), size, prot) == -1) {
+	if (mprotect((caddr_t)TEXTBASE(lmp), size, prot) == -1) {
 		int	err = errno;
 
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MPROT), NAME(lm),
-		    strerror(err));
+		eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_SYS_MPROT),
+		    NAME(lmp), strerror(err));
 		return (0);
 	}
 	return (1);
--- a/usr/src/cmd/sgs/rtld/common/analyze.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/analyze.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -41,12 +40,12 @@
 #include	<dlfcn.h>
 #include	<errno.h>
 #include	<link.h>
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"conv.h"
 
 static Fct *	vector[] = {
 	&elf_fct,
@@ -360,7 +359,7 @@
 		else
 			tracing = 0;
 
-		DBG_CALL(Dbg_util_nl());
+		DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 
 		for (ALIST_TRAVERSE(COPY(nlmp), off1, lmpp)) {
 			Rt_map *	lmp = *lmpp;
@@ -375,8 +374,8 @@
 				 * filled memory.
 				 */
 				zero = copy_zerobits(rcp->r_dlmp, rcp->r_dsym);
-				DBG_CALL(Dbg_reloc_copy(NAME(rcp->r_dlmp),
-				    NAME(nlmp), rcp->r_name, zero));
+				DBG_CALL(Dbg_reloc_copy(rcp->r_dlmp, nlmp,
+				    rcp->r_name, zero));
 				if (zero)
 					continue;
 
@@ -392,7 +391,7 @@
 			}
 		}
 
-		DBG_CALL(Dbg_util_nl());
+		DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 
 		free(COPY(nlmp));
 		COPY(nlmp) = 0;
@@ -860,7 +859,7 @@
 	if (rej) {
 		/* LINTED */
 		(void) snprintf(_reject, PATH_MAX,
-		    MSG_INTL(ldd_reject[rej->rej_type]), conv_reject_str(rej));
+		    MSG_INTL(ldd_reject[rej->rej_type]), conv_reject_desc(rej));
 		if (rej->rej_name)
 			path = rej->rej_name;
 		reject = (char *)_reject;
@@ -924,7 +923,7 @@
 	pmode |= ((~omode & nmode) &
 	    (RTLD_GLOBAL | RTLD_WORLD | RTLD_NODELETE));
 	if (pmode) {
-		DBG_CALL(Dbg_file_mode_promote(NAME(lmp), pmode));
+		DBG_CALL(Dbg_file_mode_promote(lmp, pmode));
 		MODE(lmp) |= pmode;
 	}
 
@@ -1119,16 +1118,16 @@
 	}
 
 	if (rej->rej_type) {
-		eprintf(ERR_FATAL, MSG_INTL(err_reject[rej->rej_type]),
+		eprintf(lml, ERR_FATAL, MSG_INTL(err_reject[rej->rej_type]),
 		    rej->rej_name ? rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN),
-		    conv_reject_str(rej));
+		    conv_reject_desc(rej));
 		return;
 	}
 
 	if (secure)
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SEC_OPEN), name);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SEC_OPEN), name);
 	else
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name,
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name,
 		    strerror(ENOENT));
 }
 
@@ -1142,7 +1141,7 @@
 	fdesc->fd_oname = oname;
 
 	if ((err == 0) && (fdesc->fd_flags & FLG_FD_ALTER))
-		DBG_CALL(Dbg_file_config_obj(oname, 0, nname));
+		DBG_CALL(Dbg_file_config_obj(lml, oname, 0, nname));
 
 	/*
 	 * If we're dealing with a full pathname, determine whether this
@@ -1197,8 +1196,8 @@
 					    &added) == 0)
 						return (0);
 					if (added)
-						DBG_CALL(Dbg_file_skip(nname,
-						    NAME(nlmp)));
+					    DBG_CALL(Dbg_file_skip(LIST(nlmp),
+						NAME(nlmp), nname));
 					fdesc->fd_nname = nname;
 					fdesc->fd_lmp = nlmp;
 					return (1);
@@ -1232,7 +1231,8 @@
 				if ((nname[0] == '/') && (fpavl_insert(lml,
 				    nlmp, nname, 0) == 0))
 					return (0);
-				DBG_CALL(Dbg_file_skip(nname, NAME(nlmp)));
+				DBG_CALL(Dbg_file_skip(LIST(nlmp), NAME(nlmp),
+				    nname));
 			}
 			fdesc->fd_nname = nname;
 			fdesc->fd_lmp = nlmp;
@@ -1283,7 +1283,7 @@
 	if (rej->rej_type) {
 		rej->rej_name = nname;
 		rej->rej_flag = (fdesc->fd_flags & FLG_FD_ALTER);
-		DBG_CALL(Dbg_file_rejected(rej));
+		DBG_CALL(Dbg_file_rejected(lml, rej));
 	}
 	return (0);
 }
@@ -1329,7 +1329,8 @@
 				 * as optional, fall through to open the
 				 * original path.
 				 */
-				DBG_CALL(Dbg_libs_found(aname, FLG_FD_ALTER));
+				DBG_CALL(Dbg_libs_found(lml, aname,
+				    FLG_FD_ALTER));
 				if (((ret = file_open(0, lml, oname, aname,
 				    clmp, flags, fdesc, rej)) != 0) ||
 				    ((obj->co_flags & RTC_OBJ_OPTINAL) == 0))
@@ -1339,7 +1340,7 @@
 			}
 		}
 	}
-	DBG_CALL(Dbg_libs_found(oname, 0));
+	DBG_CALL(Dbg_libs_found(lml, oname, 0));
 	return (file_open(err, lml, oname, oname, clmp, flags, fdesc, rej));
 }
 
@@ -1350,7 +1351,7 @@
 _find_file(Lm_list *lml, const char *oname, const char *nname, Rt_map *clmp,
     uint_t flags, Fdesc * fdesc, Rej_desc *rej, Pnode * dir, int aflag)
 {
-	DBG_CALL(Dbg_libs_found(nname, aflag));
+	DBG_CALL(Dbg_libs_found(lml, nname, aflag));
 	if ((lml->lm_flags & LML_FLG_TRC_SEARCH) &&
 	    ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0)) {
 		(void) printf(MSG_INTL(MSG_LDD_PTH_TRYING), nname, aflag ?
@@ -1466,7 +1467,7 @@
 	 * Protect ourselves from building an invalid pathname.
 	 */
 	if ((olen + dir->p_len + 1) >= PATH_MAX) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), nname,
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), nname,
 		    strerror(ENAMETOOLONG));
 			return (0);
 	}
@@ -1720,7 +1721,7 @@
 #if	!defined(ISSOLOAD_BASENAME_DISABLED)
 		Rt_map		*nlmp;
 #endif
-		DBG_CALL(Dbg_libs_find(oname));
+		DBG_CALL(Dbg_libs_find(lml, oname));
 
 #if	!defined(ISSOLOAD_BASENAME_DISABLED)
 		if ((nlmp = is_so_loaded(lml, oname, 0)))
@@ -1824,7 +1825,8 @@
 		 * The auditor can indicate that this object should be ignored.
 		 */
 		if ((_name = audit_objsearch(clmp, name, LA_SER_ORIG)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_AUDITERM), name);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_AUDITERM),
+			    name);
 			return (0);
 		}
 
@@ -2092,7 +2094,7 @@
 			_rej.rej_name = name;
 			_rej.rej_type = SGS_REJ_STR;
 			_rej.rej_str = MSG_INTL(MSG_GEN_NOOPEN);
-			DBG_CALL(Dbg_file_rejected(&_rej));
+			DBG_CALL(Dbg_file_rejected(lml, &_rej));
 			rejection_inherit(rej, &_rej, nfdp);
 			remove_so(lml, nlmp);
 			return (0);
@@ -2125,7 +2127,7 @@
 			_rej.rej_name = name;
 			_rej.rej_type = SGS_REJ_STR;
 			_rej.rej_str = strerror(ENOENT);
-			DBG_CALL(Dbg_file_rejected(&_rej));
+			DBG_CALL(Dbg_file_rejected(lml, &_rej));
 			rejection_inherit(rej, &_rej, nfdp);
 			return (0);
 		}
@@ -2609,7 +2611,7 @@
 		if ((flags & LKUP_WEAK) || (LIST(lmp)->lm_lazy == 0))
 			return ((Sym *)0);
 
-		DBG_CALL(Dbg_syms_lazy_rescan(name));
+		DBG_CALL(Dbg_syms_lazy_rescan(LIST(clmp), name));
 
 		/*
 		 * If this request originated from a dlsym(RTLD_NEXT) then start
@@ -2651,9 +2653,9 @@
  * an existing descriptor.
  */
 int
-bind_one(Rt_map * clmp, Rt_map * dlmp, uint_t flags)
+bind_one(Rt_map *clmp, Rt_map *dlmp, uint_t flags)
 {
-	Bnd_desc **	bdpp, * bdp;
+	Bnd_desc	**bdpp, *bdp;
 	Aliste		off;
 	int		found = ALE_CREATE;
 
@@ -2700,7 +2702,7 @@
 		if (flags & BND_REFER)
 			FLAGS1(dlmp) |= FL1_RT_USED;
 
-		DBG_CALL(Dbg_file_bind_entry(bdp));
+		DBG_CALL(Dbg_file_bind_entry(LIST(clmp), bdp));
 	}
 	return (found);
 }
@@ -2711,7 +2713,7 @@
 int
 relocate_finish(Rt_map *lmp, Alist *bound, int textrel, int ret)
 {
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, ret, DBG_REL_FINISH));
+	DBG_CALL(Dbg_reloc_run(lmp, 0, ret, DBG_REL_FINISH));
 
 	/*
 	 * Establish bindings to all objects that have been bound to.
--- a/usr/src/cmd/sgs/rtld/common/audit.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/audit.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Audit interfaces.  Auditing can be enabled in two ways:
@@ -55,7 +55,7 @@
 #include	<stdarg.h>
 #include	<dlfcn.h>
 #include	<string.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
@@ -184,7 +184,7 @@
 	if (appl)
 		rtld_flags &= ~RT_FL_APPLIC;
 
-	DBG_CALL(Dbg_libs_audit(name, nname));
+	DBG_CALL(Dbg_libs_audit(LIST(clmp), name, nname));
 	return (nname);
 }
 
@@ -273,7 +273,8 @@
 		if (alp->al_objopen == 0)
 			continue;
 
-		DBG_CALL(Dbg_audit_object(alp->al_libname, NAME(nlmp)));
+		DBG_CALL(Dbg_audit_object(LIST(alp->al_lmp), alp->al_libname,
+		    NAME(nlmp)));
 
 		leave(LIST(alp->al_lmp));
 		flags = (*alp->al_objopen)((Link_map *)nlmp, lmid,
@@ -310,7 +311,7 @@
 }
 
 int
-audit_objopen(Rt_map * clmp, Rt_map * nlmp)
+audit_objopen(Rt_map *clmp, Rt_map *nlmp)
 {
 	Lmid_t		lmid = get_linkmap_id(LIST(nlmp));
 	int		appl = 0, respond = 1, ndx = 0;
@@ -457,7 +458,7 @@
 #endif
 		(void) enter();
 
-		DBG_CALL(Dbg_audit_symval(alp->al_libname,
+		DBG_CALL(Dbg_audit_symval(LIST(alp->al_lmp), alp->al_libname,
 		    MSG_ORIG(MSG_AUD_PLTENTER), name, prev, sym->st_name));
 	}
 }
@@ -622,7 +623,7 @@
 		if ((prev != sym->st_value) && (alp->al_vernum >= LAV_VERSION2))
 			*flags |= LA_SYMB_ALTVALUE;
 
-		DBG_CALL(Dbg_audit_symval(alp->al_libname,
+		DBG_CALL(Dbg_audit_symval(LIST(alp->al_lmp), alp->al_libname,
 		    MSG_ORIG(MSG_AUD_SYMBIND), name, prev, sym->st_value));
 	}
 	return (sym->st_value);
@@ -863,7 +864,8 @@
 		if (auflag)
 			audit_flags |= auflag;
 
-		DBG_CALL(Dbg_audit_interface(alp->al_libname, sname));
+		DBG_CALL(Dbg_audit_interface(LIST(alp->al_lmp),
+		    alp->al_libname, sname));
 		return (addr);
 	} else
 		return (0);
@@ -875,7 +877,7 @@
 static int
 audit_disable(char *name, Rt_map *clmp, Grp_hdl *ghp, Audit_list *alp)
 {
-	eprintf(ERR_FATAL, MSG_INTL(MSG_AUD_DISABLED), name);
+	eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_AUD_DISABLED), name);
 	if (ghp)
 		(void) dlclose_intn(ghp, clmp);
 	if (alp)
@@ -892,9 +894,10 @@
 audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig)
 {
 	char	*ptr, *next;
+	Lm_list	*clml = LIST(clmp);
 	int	error = 1;
 
-	DBG_CALL(Dbg_audit_lib(adp->ad_name));
+	DBG_CALL(Dbg_audit_lib(clml, adp->ad_name));
 
 	/*
 	 * Mark that we have at least one auditing link map
@@ -921,7 +924,7 @@
 			error = audit_disable(ptr, clmp, 0, 0);
 			continue;
 		}
-		lmp = ghp->gh_owner;
+		lmp = ghp->gh_ownlmp;
 
 		/*
 		 * If this auditor has already been loaded, reuse it.
@@ -931,7 +934,7 @@
 				return (audit_disable(ptr, clmp, ghp, alp));
 
 			adp->ad_cnt++;
-			DBG_CALL(Dbg_audit_version(alp->al_libname,
+			DBG_CALL(Dbg_audit_version(clml, alp->al_libname,
 			    alp->al_vernum));
 			adp->ad_flags |= alp->al_flags;
 			continue;
@@ -968,7 +971,7 @@
 		 */
 		if ((alp->al_version =
 		    (uint_t(*)())audit_symget(alp, AI_LAVERSION)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NOSYM),
+			eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_GEN_NOSYM),
 			    MSG_ORIG(MSG_SYM_LAVERSION));
 			error = audit_disable(ptr, clmp, ghp, alp);
 			continue;
@@ -987,7 +990,7 @@
 
 		if ((alp->al_vernum < LAV_VERSION1) ||
 		    (alp->al_vernum > LAV_CURRENT)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_AUD_BADVERS),
+			eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_AUD_BADVERS),
 			    LAV_CURRENT, alp->al_vernum);
 			error = audit_disable(ptr, clmp, ghp, alp);
 			continue;
@@ -997,7 +1000,8 @@
 			return (audit_disable(ptr, clmp, ghp, alp));
 
 		adp->ad_cnt++;
-		DBG_CALL(Dbg_audit_version(alp->al_libname, alp->al_vernum));
+		DBG_CALL(Dbg_audit_version(clml, alp->al_libname,
+		    alp->al_vernum));
 
 		/*
 		 * Collect any remaining entry points.
--- a/usr/src/cmd/sgs/rtld/common/cache_a.out.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/cache_a.out.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright (c) 1999 by Sun Microsystems, Inc.
- *	All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -120,7 +120,7 @@
 		return (NULL);
 	if (verscmp(file + to_min,
 	    &AP(dbp)[ep->dbe_name] + tlop->lo_minor) > 0)
-		eprintf(ERR_WARNING, MSG_INTL(MSG_GEN_OLDREV),
+		eprintf(&lml_main, ERR_WARNING, MSG_INTL(MSG_GEN_OLDREV),
 		    &AP(dbp)[ep->dbe_name], file + to_min);
 	return (&AP(dbp)[ep->dbe_name]);
 }
@@ -130,7 +130,7 @@
  * orginated from the mmapped file or temporarily created
  */
 struct db *
-lo_cache(const char * ds)
+lo_cache(const char *ds)
 {
 	struct db *dbp;			/* database pointer */
 	struct dbd *dbdp;		/* working database descriptor */
@@ -152,7 +152,7 @@
  * Build a database for the directory "ds".
  */
 static struct db *
-find_so(const char * ds)
+find_so(const char *ds)
 {
 	int fd;				/* descriptor on directory */
 	int n;				/* bytes from getdents */
@@ -259,7 +259,7 @@
 			}
 			for (ep = &(dbp->db_hash[index]); ep;
 			    /* LINTED */
-			    ep = (struct dbe *) &AP(dbp)[ep->dbe_next]) {
+			    ep = (struct dbe *)&AP(dbp)[ep->dbe_next]) {
 				/* LINTED */
 				tlop = (struct link_object *)
 				    &AP(dbp)[ep->dbe_lop];
@@ -475,10 +475,10 @@
  * greater than c2p
  */
 static int
-verscmp(const char * c1p, const char * c2p)
+verscmp(const char *c1p, const char *c2p)
 {
-	char *	l_c1p = (char *)c1p;	/* working copy of c1p */
-	char *	l_c2p = (char *)c2p;	/* working copy of c2p */
+	char	*l_c1p = (char *)c1p;	/* working copy of c1p */
+	char	*l_c2p = (char *)c2p;	/* working copy of c2p */
 	int	l_c1p_ok = 0;		/* is c1p a legal string */
 	int	c2p_dig = 0;		/* int that c1p currently */
 					/*	represents */
--- a/usr/src/cmd/sgs/rtld/common/cap.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/cap.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,12 +33,11 @@
 #include	<stdio.h>
 #include	<string.h>
 #include	<limits.h>
-#include	"conv.h"
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
-#include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
 
 /*
  * qsort(3c) comparison function.
@@ -95,7 +93,7 @@
 
 		if ((val = (cptr->c_un.c_val & ~hwcap)) != 0) {
 			rej->rej_type = SGS_REJ_HWCAP_1;
-			rej->rej_str = conv_hwcap_1_str(val, M_MACH);
+			rej->rej_str = conv_cap_val_hw1(val, M_MACH);
 			return (0);
 		}
 
@@ -162,7 +160,7 @@
 		_rej.rej_type = SGS_REJ_STR;
 		_rej.rej_name = name;
 		_rej.rej_str = strerror(errno);
-		DBG_CALL(Dbg_file_rejected(&_rej));
+		DBG_CALL(Dbg_file_rejected(lml, &_rej));
 		rejection_inherit(rej, &_rej, 0);
 		return (0);
 	}
@@ -205,7 +203,7 @@
 		if (find_path(lml, name, clmp, flags, &fdesc, &_rej) == 0)
 			rejection_inherit(rej, &_rej, &fdesc);
 		else {
-			DBG_CALL(Dbg_cap_hw_candidate(name));
+			DBG_CALL(Dbg_cap_hw_candidate(lml, name));
 
 			/*
 			 * If this object has already been loaded, obtain the
@@ -303,7 +301,7 @@
 		 * relocating.  Remove the file descriptor at this point, as it
 		 * is no longer required.
 		 */
-		DBG_CALL(Dbg_file_filtee(NAME(flmp), fdp->fd_nname, 0));
+		DBG_CALL(Dbg_file_filtee(lml, NAME(flmp), fdp->fd_nname, 0));
 
 		nlmp = load_path(lml, nlmco, fdp->fd_nname, flmp, mode,
 		    (flags | FLG_RT_HANDLE), &ghp, fdp, &rej);
@@ -398,7 +396,7 @@
 		 */
 		if (nlmp == 0) {
 			pnp->p_info = 0;
-			DBG_CALL(Dbg_file_filtee(0, pnp->p_name, audit));
+			DBG_CALL(Dbg_file_filtee(lml, 0, pnp->p_name, audit));
 			if (ghp)
 				(void) dlclose_core(ghp, flmp);
 
@@ -416,8 +414,9 @@
 {
 	Pnode		*pnp = *pnpp;
 	const char	*dir = pnp->p_name;
+	Lm_list		*flml = LIST(flmp);
 
-	DBG_CALL(Dbg_cap_hw_filter(dir, NAME(flmp)));
+	DBG_CALL(Dbg_cap_hw_filter(flml, dir, flmp));
 
 	if ((pnp = _hwcap_filtees(pnpp, nlmco, flmp, ref, dir, mode,
 	    flags)) != 0)
@@ -427,11 +426,11 @@
 	 * If no hardware capability filtees have been found, provide suitable
 	 * diagnostics and mark the incoming Pnode as unused.
 	 */
-	if ((LIST(flmp)->lm_flags & LML_FLG_TRC_ENABLE) &&
+	if ((flml->lm_flags & LML_FLG_TRC_ENABLE) &&
 	    (dip->di_flags & FLG_DI_AUXFLTR) && (rtld_flags & RT_FL_WARNFLTR))
 		(void) printf(MSG_INTL(MSG_LDD_HWCAP_NFOUND), dir);
 
-	DBG_CALL(Dbg_cap_hw_filter(dir, 0));
+	DBG_CALL(Dbg_cap_hw_filter(flml, dir, 0));
 
 	pnp = *pnpp;
 	pnp->p_len = 0;
--- a/usr/src/cmd/sgs/rtld/common/config_elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/config_elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,9 +34,9 @@
 #include	<limits.h>
 #include	<stdio.h>
 #include	<string.h>
-#include	"rtc.h"
-#include	"debug.h"
-#include	"conv.h"
+#include	<rtc.h>
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"msg.h"
 
@@ -48,8 +48,9 @@
  * Validate a configuration file.
  */
 static void
-elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp)
+elf_config_validate(Addr addr, Rtc_head *head, Rt_map *lmp)
 {
+	Lm_list		*lml = LIST(lmp);
 	const char	*str, *strtbl = config->c_strtbl;
 	Rtc_obj		*obj;
 	Rtc_dir		*dirtbl;
@@ -83,10 +84,11 @@
 			 * the shared object is part of.  In this case ignore
 			 * any mismatch name warnings.
 			 */
-			if ((LIST(lmp)->lm_flags & LML_FLG_TRC_ENABLE) &&
+			if ((lml->lm_flags & LML_FLG_TRC_ENABLE) &&
 			    ((FLAGS1(lmp) & FL1_RT_LDDSTUB) == 0)) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_APP),
-				    config->c_name, _cname);
+				eprintf(lml, ERR_WARNING,
+				    MSG_INTL(MSG_CONF_APP), config->c_name,
+				    _cname);
 				return;
 			}
 		}
@@ -132,7 +134,7 @@
 
 		if (stat(str, &status) != 0) {
 			err = errno;
-			eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_DSTAT),
+			eprintf(lml, ERR_WARNING, MSG_INTL(MSG_CONF_DSTAT),
 			    config->c_name, str, strerror(err));
 			continue;
 		}
@@ -158,8 +160,9 @@
 
 			if (stat(str, &status) != 0) {
 				err = errno;
-				eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_FSTAT),
-				    config->c_name, str, strerror(err));
+				eprintf(lml, ERR_WARNING,
+				    MSG_INTL(MSG_CONF_FSTAT), config->c_name,
+				    str, strerror(err));
 				continue;
 			}
 
@@ -168,15 +171,16 @@
 			 * changed.
 			 */
 			if (status.st_size != obj->co_info) {
-				eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_FCMP),
-				    config->c_name, str);
+				eprintf(lml, ERR_WARNING,
+				    MSG_INTL(MSG_CONF_FCMP), config->c_name,
+				    str);
 			}
 		}
 	}
 }
 
 int
-elf_config(Rt_map * lmp, int aout)
+elf_config(Rt_map *lmp, int aout)
 {
 	Rtc_head	*head;
 	int		fd, features = 0;
@@ -202,7 +206,7 @@
 		char	*name;
 
 		/*
-		 * If we're dealing with an alternative application fabricate
+		 * If we're dealing with an alternative application, fabricate
 		 * the need for a $ORIGIN/ld.config.app-name configuration file.
 		 */
 		if (rtld_flags & RT_FL_CONFAPP) {
@@ -276,10 +280,10 @@
 #ifndef	SGS_PRE_UNIFIED_PROCESS
 		if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
 #if	defined(_ELF64)
-			str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIB_64),
+			str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIB_64),
 			    MSG_ORIG(MSG_PTH_LIB_64), MSG_PTH_LIB_64_SIZE);
 #else
-			str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIB),
+			str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIB),
 			    MSG_ORIG(MSG_PTH_LIB), MSG_PTH_LIB_SIZE);
 #endif
 		}
@@ -294,11 +298,11 @@
 #ifndef	SGS_PRE_UNIFIED_PROCESS
 		if ((head->ch_cnflags & RTC_HDR_UPM) == 0) {
 #if	defined(_ELF64)
-			str = conv_upm_string(str,
+			str = conv_config_upm(str,
 			    MSG_ORIG(MSG_PTH_USRLIBSE_64),
 			    MSG_ORIG(MSG_PTH_LIBSE_64), MSG_PTH_LIBSE_64_SIZE);
 #else
-			str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIBSE),
+			str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIBSE),
 			    MSG_ORIG(MSG_PTH_LIBSE), MSG_PTH_LIBSE_SIZE);
 #endif
 		}
@@ -379,7 +383,8 @@
 
 			if (((config->c_bgn <= head->ch_resbgn) &&
 			    (config->c_bgn >= head->ch_resend)) ||
-			    (nu_map((caddr_t)(uintptr_t)head->ch_resbgn,
+			    (nu_map(LIST(lmp),
+			    (caddr_t)(uintptr_t)head->ch_resbgn,
 			    (head->ch_resend - head->ch_resbgn), PROT_NONE,
 			    MAP_FIXED | MAP_PRIVATE) == MAP_FAILED))
 				return (-1);
@@ -429,7 +434,7 @@
  * a Pnode list.
  */
 Pnode *
-elf_config_flt(const char *filter, const char *string)
+elf_config_flt(Lm_list *lml, const char *filter, const char *string)
 {
 	Rtc_fltr *	fltrtbl;
 	Pnode *		pnp = 0, *npnp, *opnp = 0;
@@ -462,7 +467,7 @@
 			    ((npnp->p_name = strdup(flte)) == 0))
 				return (0);
 
-			DBG_CALL(Dbg_file_filter(fltr, flte, 1));
+			DBG_CALL(Dbg_file_filter(lml, fltr, flte, 1));
 
 			if (opnp == 0)
 				pnp = npnp;
--- a/usr/src/cmd/sgs/rtld/common/debug.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/debug.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -38,7 +38,7 @@
 #include	<unistd.h>
 #include	<string.h>
 #include	<thread.h>
-#include	"debug.h"
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_elf.h"
 #include	"msg.h"
@@ -53,10 +53,10 @@
  * Enable diagnostic output.  All debugging functions reside in the linker
  * debugging library liblddbg.so which is lazy loaded when required.
  */
-uint_t
-dbg_setup(const char *options)
+uintptr_t
+dbg_setup(const char *options, Dbg_desc *dbp)
 {
-	uint_t		_dbg_mask;
+	uintptr_t	ret;
 	struct stat	status;
 
 	/*
@@ -87,8 +87,8 @@
 	 * categories selected.  The mask effectively enables calls to the
 	 * debugging library.
 	 */
-	if ((_dbg_mask = Dbg_setup(options)) == (uint_t)S_ERROR)
-		return (0);
+	if ((ret = Dbg_setup(options, dbp)) != (uintptr_t)1)
+		return (ret);
 
 	/*
 	 * If an LD_DEBUG_OUTPUT file was specified then we need to direct all
@@ -99,14 +99,14 @@
 	if (dbg_file) {
 		char 	file[MAXPATHLEN];
 
-		(void) snprintf(file, MAXPATHLEN, MSG_ORIG(MSG_DBG_FMT_FILE),
-		    dbg_file, (int)getpid());
+		(void) snprintf(file, MAXPATHLEN, MSG_ORIG(MSG_DBG_FILE),
+		    dbg_file, getpid());
 		if ((dbg_fd = open(file, (O_RDWR | O_CREAT), 0666)) == -1) {
 			int	err = errno;
 
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), file,
-			    strerror(err));
-			dbg_mask = 0;
+			eprintf(&lml_rtld, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			    file, strerror(err));
+			dbp->d_class = 0;
 			return (0);
 		}
 	} else {
@@ -126,21 +126,53 @@
 	dbg_ino = status.st_ino;
 	pid = getpid();
 
-	return (_dbg_mask);
+	return (ret);
+}
+
+static int
+dbg_lmid(Lm_list *lml)
+{
+	const char	**str;
+	Aliste		off;
+
+	for (ALIST_TRAVERSE(dbg_desc->d_list, off, str)) {
+		if (strcmp(lml->lm_lmidstr, *str) == 0)
+			return (1);
+	}
+	return (0);
 }
 
 /*
  * All diagnostic requests are funneled to this routine.
  */
-/*PRINTFLIKE1*/
+/* PRINTFLIKE2 */
 void
-dbg_print(const char *format, ...)
+dbg_print(Lm_list *lml, const char *format, ...)
 {
-	va_list			args;
-	char			buffer[ERRSIZE + 1];
-	pid_t			_pid;
-	struct stat		status;
-	Prfbuf			prf;
+	va_list		args;
+	char		buffer[ERRSIZE + 1];
+	pid_t		_pid;
+	struct stat	status;
+	Prfbuf		prf;
+
+	/*
+	 * Knock off any newline indicator to signify that a diagnostic has
+	 * been processed.
+	 */
+	dbg_desc->d_extra &= ~DBG_E_STDNL;
+
+	/*
+	 * If debugging has been isolated to individual link-map lists,
+	 * determine whether this request originates from a link-map list that
+	 * is being monitored.  Otherwise, process all link-map list diagnostics
+	 * except those that originate from ld.so.1 processing its own
+	 * dependencies.
+	 */
+	if (dbg_desc->d_list && lml && lml->lm_lmidstr) {
+		if (dbg_lmid(lml) == 0)
+			return;
+	} else if (lml && (lml->lm_flags & LML_FLG_RTLDLM))
+		return;
 
 	/*
 	 * If we're in the application make sure the debugging file descriptor
@@ -159,11 +191,10 @@
 				char 	file[MAXPATHLEN];
 
 				(void) snprintf(file, MAXPATHLEN,
-				    MSG_ORIG(MSG_DBG_FMT_FILE), dbg_file,
-				    (int)pid);
+				    MSG_ORIG(MSG_DBG_FILE), dbg_file, pid);
 				if ((dbg_fd = open(file, (O_RDWR | O_APPEND),
 				    0)) == -1) {
-					dbg_mask = 0;
+					dbg_desc->d_class = 0;
 					return;
 				}
 				(void) fstat(dbg_fd, &status);
@@ -174,40 +205,47 @@
 				 * If stderr has been stolen from us simply
 				 * turn debugging off.
 				 */
-				dbg_mask = 0;
+				dbg_desc->d_class = 0;
 				return;
 			}
 		}
 	}
 
+	prf.pr_buf = prf.pr_cur = buffer;
+	prf.pr_len = ERRSIZE;
+	prf.pr_fd = dbg_fd;
+
 	/*
-	 * The getpid() call is a 'special' interface between ld.so.1
-	 * and dbx, because of this getpid() can't be called freely
-	 * until after control has been given to the user program.
-	 * Once the control has been given to the user program
-	 * we know that the r_debug structure has been properly
-	 * initialized for the debugger.
+	 * The getpid() call is a 'special' interface between ld.so.1 and dbx,
+	 * because of this getpid() can't be called freely until after control
+	 * has been given to the user program.  Once the control has been given
+	 * to the user program we know that the r_debug structure has been
+	 * properly initialized for the debugger.
 	 */
 	if (rtld_flags & RT_FL_APPLIC)
 		_pid = getpid();
 	else
 		_pid = pid;
 
-	prf.pr_buf = prf.pr_cur = buffer;
-	prf.pr_len = ERRSIZE;
-	prf.pr_fd = dbg_fd;
+	if (lml)
+		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_PID), _pid);
+	else
+		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_UNDEF));
+	prf.pr_cur--;
 
-	if (rtld_flags & RT_FL_THREADS)
-		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_FMT_THREAD), _pid,
-			rt_thr_self());
-	else
-		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_FMT_DIAG), _pid);
+	if (DBG_ISLMID() && lml && lml->lm_lmidstr) {
+		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_LMID), lml->lm_lmidstr);
+		prf.pr_cur--;
+	}
+	if (rtld_flags & RT_FL_THREADS) {
+		(void) bufprint(&prf, MSG_ORIG(MSG_DBG_THREAD), rt_thr_self());
+		prf.pr_cur--;
+	}
 
 	/*
 	 * Format the message and print it.
 	 */
 	va_start(args, format);
-	prf.pr_cur--;
 	(void) doprf(format, args, &prf);
 	*(prf.pr_cur - 1) = '\n';
 	(void) dowrite(&prf);
--- a/usr/src/cmd/sgs/rtld/common/dlfcns.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/dlfcns.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -38,17 +35,17 @@
  */
 #include	"_synonyms.h"
 
+#include	<sys/debug.h>
 #include	<string.h>
 #include	<dlfcn.h>
 #include	<synch.h>
-#include	"debug.h"
+#include	<limits.h>
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
 
-#include	<stdio.h>
-
 /*
  * Determine who called us - given a pc determine in which object it resides.
  *
@@ -112,9 +109,9 @@
 char *
 _dlerror()
 {
-	char		*error;
-	Rt_map		*clmp;
-	int		entry;
+	char	*error;
+	Rt_map	*clmp;
+	int	entry;
 
 	entry = enter();
 
@@ -134,9 +131,9 @@
  * is newly created.
  */
 int
-hdl_add(Grp_hdl * ghp, Rt_map * lmp, uint_t flags)
+hdl_add(Grp_hdl *ghp, Rt_map *lmp, uint_t flags)
 {
-	Grp_desc *	gdp;
+	Grp_desc	*gdp;
 	Aliste		off;
 	int		found = ALE_CREATE;
 
@@ -189,8 +186,8 @@
 Grp_hdl *
 hdl_alloc()
 {
-	Grp_hdl *	ghp;
-	uint_t		ndx;
+	Grp_hdl	*ghp;
+	uint_t	ndx;
 
 	if ((ghp = calloc(sizeof (Grp_hdl), 1)) == 0)
 		return (0);
@@ -209,11 +206,11 @@
  * Create a handle.
  */
 Grp_hdl *
-hdl_create(Lm_list * lml, Rt_map * nlmp, Rt_map * clmp, uint_t flags)
+hdl_create(Lm_list *lml, Rt_map *nlmp, Rt_map *clmp, uint_t flags)
 {
-	Grp_hdl *	ghp = 0, ** ghpp;
+	Grp_hdl		*ghp = 0, ** ghpp;
 	uint_t		hflags;
-	Alist **	alpp;
+	Alist		**alpp;
 	Aliste		off;
 
 	/*
@@ -277,11 +274,13 @@
 		 * GLOBAL visibility.
 		 */
 		if (flags & GPH_ZERO) {
-			ghp->gh_owner = lml->lm_head;
+			ghp->gh_ownlmp = lml->lm_head;
+			ghp->gh_ownlml = lml;
 		} else {
 			uint_t	hflags = GPD_AVAIL;
 
-			ghp->gh_owner = nlmp;
+			ghp->gh_ownlmp = nlmp;
+			ghp->gh_ownlml = LIST(nlmp);
 
 			/*
 			 * As an optimization, a handle for ld.so.1 itself
@@ -314,7 +313,7 @@
 			list_delete(&hdl_list[HDLIST_ORP], ghp);
 			(void) list_append(&hdl_list[ndx], ghp);
 
-			if (dbg_mask) {
+			if (DBG_ENABLED) {
 				Aliste		off;
 				Grp_desc *	gdp;
 
@@ -413,19 +412,19 @@
  * Sanity check a program-provided handle.
  */
 static int
-hdl_validate(Grp_hdl * ghp)
+hdl_validate(Grp_hdl *ghp)
 {
-	Listnode *	lnp;
-	Grp_hdl *	_ghp;
+	Listnode	*lnp;
+	Grp_hdl		*lghp;
 	uint_t		ndx;
 
 	/* LINTED */
 	ndx = (uintptr_t)ghp % HDLIST_SZ;
 
-	for (LIST_TRAVERSE(&hdl_list[ndx], lnp, _ghp))
-		if ((_ghp == ghp) && (ghp->gh_refcnt != 0))
+	for (LIST_TRAVERSE(&hdl_list[ndx], lnp, lghp)) {
+		if ((lghp == ghp) && (ghp->gh_refcnt != 0))
 			return (1);
-
+	}
 	return (0);
 }
 
@@ -446,7 +445,7 @@
 	 * Diagnose what we're up to.
 	 */
 	if (ghp->gh_flags & GPH_ZERO) {
-		DBG_CALL(Dbg_file_dlclose(MSG_ORIG(MSG_STR_ZERO),
+		DBG_CALL(Dbg_file_dlclose(LIST(clmp), MSG_ORIG(MSG_STR_ZERO),
 		    DBG_DLCLOSE_IGNORE));
 	} else {
 		Rt_map		*olmp;
@@ -455,12 +454,12 @@
 		/*
 		 * Determine if we've an owner for this handle.
 		 */
-		if ((olmp = ghp->gh_owner) != 0)
+		if ((olmp = ghp->gh_ownlmp) != 0)
 			owner = NAME(olmp);
 		else
 			owner = MSG_INTL(MSG_STR_UNKNOWN);
 
-		DBG_CALL(Dbg_file_dlclose(owner, DBG_DLCLOSE_NULL));
+		DBG_CALL(Dbg_file_dlclose(LIST(clmp), owner, DBG_DLCLOSE_NULL));
 	}
 
 	/*
@@ -489,11 +488,9 @@
 int
 dlclose_intn(Grp_hdl *ghp, Rt_map *clmp)
 {
-	Rt_map		*nlmp = 0;
-	Lm_list		*olml = 0;
-	Aliste		off;
-	Grp_desc	*gdp;
-	int		error;
+	Rt_map	*nlmp = 0;
+	Lm_list	*olml = 0;
+	int	error;
 
 	/*
 	 * Although we're deleting object(s) it's quite possible that additional
@@ -502,14 +499,7 @@
 	 * link-map list as those objects being deleted.  Remember this list
 	 * for later investigation.
 	 */
-	if (ghp->gh_owner)
-		olml = LIST(ghp->gh_owner);
-	else {
-		for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) {
-			if ((olml = LIST(gdp->gd_depend)) != 0)
-				break;
-		}
-	}
+	olml = ghp->gh_ownlml;
 
 	error = dlclose_core(ghp, clmp);
 
@@ -539,10 +529,10 @@
 static int
 dlclose_check(void *handle, Rt_map *clmp)
 {
-	Grp_hdl *	ghp = (Grp_hdl *)handle;
+	Grp_hdl	*ghp = (Grp_hdl *)handle;
 
-	if (!hdl_validate(ghp)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
+	if (hdl_validate(ghp) == 0) {
+		eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
 		return (1);
 	}
 	return (dlclose_intn(ghp, clmp));
@@ -557,34 +547,52 @@
 _dlclose(void *handle)
 {
 	int		error, entry;
-	uint_t		dbg_save;
-	Word		lmflags;
 	Rt_map		*clmp;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 
-	if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
 	error = dlclose_check(handle, clmp);
 
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
-
 	if (entry)
 		leave(LIST(clmp));
 	return (error);
 }
 
+static uint_t	lmid = 0;
+
+/*
+ * The addition of new link-map lists is assumed to be in small quantities.
+ * Here, we assign a unique link-map id for diagnostic use.  Simply update the
+ * running link-map count until we max out.
+ */
+int
+newlmid(Lm_list *lml)
+{
+	char	buffer[MSG_LMID_ALT_SIZE + 12];
+
+	if (lmid == UINT_MAX) {
+		lml->lm_lmid = UINT_MAX;
+		(void) strncpy(buffer, MSG_ORIG(MSG_LMID_MAXED),
+		    MSG_LMID_ALT_SIZE + 12);
+	} else {
+		lml->lm_lmid = lmid++;
+		(void) snprintf(buffer, MSG_LMID_ALT_SIZE + 12,
+		    MSG_ORIG(MSG_LMID_FMT), MSG_ORIG(MSG_LMID_ALT),
+		    lml->lm_lmid);
+	}
+	if ((lml->lm_lmidstr = strdup(buffer)) == 0)
+		return (0);
+
+	return (1);
+}
+
 /*
  * Core dlopen activity.
  */
 static Grp_hdl *
-dlmopen_core(Lm_list * lml, const char *path, int mode, Rt_map * clmp,
+dlmopen_core(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
     uint_t flags, uint_t orig)
 {
 	Rt_map	*nlmp;
@@ -593,8 +601,8 @@
 	Aliste	olmco, nlmco;
 	Lm_cntl	*lmc;
 
-	DBG_CALL(Dbg_file_dlopen((path ? path : MSG_ORIG(MSG_STR_ZERO)),
-	    NAME(clmp), mode));
+	DBG_CALL(Dbg_file_dlopen(clmp,
+	    (path ? path : MSG_ORIG(MSG_STR_ZERO)), mode));
 
 	/*
 	 * Check for magic link-map list values:
@@ -623,7 +631,8 @@
 			lml->lm_flags |= LML_FLG_NOAUDIT;
 		}
 
-		if (list_append(&dynlm_list, lml) == 0) {
+		if ((list_append(&dynlm_list, lml) == 0) ||
+		    (newlmid(lml) == 0)) {
 			free(lml);
 			return (0);
 		}
@@ -693,7 +702,7 @@
 	    ((mode & RTLD_FIRST) == 0)) {
 		remove_pnode(pnp);
 		remove_lml(lml);
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_5));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_5));
 		return (0);
 	}
 
@@ -771,8 +780,8 @@
 dlmopen_intn(Lm_list * lml, const char *path, int mode, Rt_map * clmp,
     uint_t flags, uint_t orig, int *loaded)
 {
-	Rt_map *	dlmp = 0;
-	Grp_hdl *	ghp;
+	Rt_map	*dlmp = 0;
+	Grp_hdl	*ghp;
 
 	/*
 	 * Determine the link-map that has just been loaded.
@@ -785,7 +794,7 @@
 		 * file (crle(1)).
 		 */
 		if ((mode & RTLD_CONFGEN) == 0)
-			dlmp = ghp->gh_owner;
+			dlmp = ghp->gh_ownlmp;
 	}
 
 	/*
@@ -803,14 +812,14 @@
  * Argument checking for dlopen.  Only called via external entry.
  */
 static Grp_hdl *
-dlmopen_check(Lm_list * lml, const char *path, int mode, Rt_map * clmp,
+dlmopen_check(Lm_list *lml, const char *path, int mode, Rt_map *clmp,
     int *loaded)
 {
 	/*
 	 * Verify that a valid pathname has been supplied.
 	 */
 	if (path && (*path == '\0')) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH));
 		return (0);
 	}
 
@@ -820,19 +829,19 @@
 	 * requires a specific pathname, and use of RTLD_PARENT is meaningless.
 	 */
 	if ((mode & (RTLD_NOW | RTLD_LAZY | RTLD_NOLOAD)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_1));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_1));
 		return (0);
 	}
 	if ((mode & (RTLD_NOW | RTLD_LAZY)) == (RTLD_NOW | RTLD_LAZY)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_2));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_2));
 		return (0);
 	}
 	if ((lml == (Lm_list *)LM_ID_NEWLM) && (path == 0)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_3));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_3));
 		return (0);
 	}
 	if ((lml == (Lm_list *)LM_ID_NEWLM) && (mode & RTLD_PARENT)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_4));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_4));
 		return (0);
 	}
 	if (((mode & (RTLD_GROUP | RTLD_WORLD)) == 0) &&
@@ -856,31 +865,21 @@
 void *
 _dlopen(const char *path, int mode)
 {
-	int		entry, loaded = 0;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map *	clmp;
-	Grp_hdl *	ghp;
-	Lm_list *	lml;
+	int	entry, loaded = 0;
+	Rt_map	*clmp;
+	Grp_hdl	*ghp;
+	Lm_list	*lml;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 	lml = LIST(clmp);
 
-	if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
 	ghp = dlmopen_check(lml, path, mode, clmp, &loaded);
 
 	if (entry && ghp && loaded)
 		unused(lml);
 
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
-
 	if (entry)
 		leave(lml);
 	return ((void *)ghp);
@@ -894,28 +893,18 @@
 void *
 _dlmopen(Lmid_t lmid, const char *path, int mode)
 {
-	int		entry, loaded = 0;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map *	clmp;
-	Grp_hdl *	ghp;
+	int	entry, loaded = 0;
+	Rt_map	*clmp;
+	Grp_hdl	*ghp;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 
-	if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
 	ghp = dlmopen_check((Lm_list *)lmid, path, mode, clmp, &loaded);
 
-	if (entry && ghp && ghp->gh_owner && loaded)
-		unused(LIST(ghp->gh_owner));
-
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+	if (entry && ghp && ghp->gh_ownlmp && loaded)
+		unused(LIST(ghp->gh_ownlmp));
 
 	if (entry)
 		leave(LIST(clmp));
@@ -928,7 +917,7 @@
 Sym *
 dlsym_handle(Grp_hdl * ghp, Slookup * slp, Rt_map ** _lmp, uint_t *binfo)
 {
-	Rt_map		*nlmp, * lmp = ghp->gh_owner;
+	Rt_map		*nlmp, * lmp = ghp->gh_ownlmp;
 	Rt_map		*clmp = slp->sl_cmap;
 	const char	*name = slp->sl_name;
 	Sym		*sym = 0;
@@ -985,7 +974,7 @@
 		 * need for elf_lazy_find_sym() to descend the link-maps itself.
 		 */
 		if (LIST(lmp)->lm_lazy) {
-			DBG_CALL(Dbg_syms_lazy_rescan(name));
+			DBG_CALL(Dbg_syms_lazy_rescan(LIST(lmp), name));
 
 			sl.sl_flags |= LKUP_NODESCENT;
 
@@ -1028,7 +1017,7 @@
 		 * attempt to exhaust the search.
 		 */
 		if (LIST(lmp)->lm_lazy) {
-			DBG_CALL(Dbg_syms_lazy_rescan(name));
+			DBG_CALL(Dbg_syms_lazy_rescan(LIST(lmp), name));
 
 			for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) {
 				nlmp = gdp->gd_depend;
@@ -1116,7 +1105,7 @@
 		 */
 		sl.sl_imap = nlmp = (Rt_map *)NEXT(clmp);
 
-		DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), (nlmp ? NAME(nlmp) :
+		DBG_CALL(Dbg_syms_dlsym(clmp, name, (nlmp ? NAME(nlmp) :
 		    MSG_INTL(MSG_STR_NULL)), DBG_DLSYM_NEXT));
 
 		if (nlmp == 0)
@@ -1129,7 +1118,7 @@
 		/*
 		 * If the handle is RTLD_SELF start searching from the caller.
 		 */
-		DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), NAME(clmp),
+		DBG_CALL(Dbg_syms_dlsym(clmp, name, NAME(clmp),
 		    DBG_DLSYM_SELF));
 
 		sl.sl_imap = clmp;
@@ -1143,8 +1132,7 @@
 		 * If the handle is RTLD_DEFAULT mimic the standard symbol
 		 * lookup as would be triggered by a relocation.
 		 */
-		DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), 0,
-		    DBG_DLSYM_DEFAULT));
+		DBG_CALL(Dbg_syms_dlsym(clmp, name, 0, DBG_DLSYM_DEFAULT));
 
 		sl.sl_imap = hlmp;
 		sl.sl_flags = LKUP_SPEC;
@@ -1162,7 +1150,7 @@
 		 * loaded to satisfy this request, but no exhaustive lazy load
 		 * rescan is carried out.
 		 */
-		DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), 0, DBG_DLSYM_PROBE));
+		DBG_CALL(Dbg_syms_dlsym(clmp, name, 0, DBG_DLSYM_PROBE));
 
 		sl.sl_imap = hlmp;
 		sl.sl_flags = (LKUP_SPEC | LKUP_NOFALBACK);
@@ -1175,23 +1163,22 @@
 		 * Look in the shared object specified by the handle and in all
 		 * of its dependencies.
 		 */
-		DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), NAME(ghp->gh_owner),
+		DBG_CALL(Dbg_syms_dlsym(clmp, name, NAME(ghp->gh_ownlmp),
 		    DBG_DLSYM_DEF));
 		sym = LM_DLSYM(clmp)(ghp, &sl, dlmp, &binfo);
 	}
 
 	if (sym) {
+		Lm_list	*lml = LIST(clmp);
 		Addr	addr = sym->st_value;
 
 		if (!(FLAGS(*dlmp) & FLG_RT_FIXED))
 			addr += ADDR(*dlmp);
 
-		DBG_CALL(Dbg_bind_global(NAME(clmp), 0, 0, (Xword)-1,
-		    PLT_T_NONE, NAME(*dlmp), (caddr_t)addr,
-		    (caddr_t)sym->st_value, name, binfo));
+		DBG_CALL(Dbg_bind_global(clmp, 0, 0, (Xword)-1, PLT_T_NONE,
+		    *dlmp, addr, sym->st_value, name, binfo));
 
-		if ((LIST(clmp)->lm_tflags | FLAGS1(clmp)) &
-		    LML_TFLG_AUD_SYMBIND) {
+		if ((lml->lm_tflags | FLAGS1(clmp)) & LML_TFLG_AUD_SYMBIND) {
 			uint_t	sb_flags = LA_SYMB_DLSYM;
 			/* LINTED */
 			uint_t	symndx = (uint_t)(((Xword)sym -
@@ -1211,10 +1198,10 @@
 void *
 dlsym_intn(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp)
 {
-	Rt_map *	llmp = 0;
-	void *		error;
+	Rt_map		*llmp = 0;
+	void		*error;
 	Aliste		off;
-	Grp_desc *	gdp;
+	Grp_desc	*gdp;
 
 	/*
 	 * While looking for symbols it's quite possible that additional objects
@@ -1228,8 +1215,8 @@
 	else {
 		Grp_hdl *	ghp = (Grp_hdl *)handle;
 
-		if (ghp->gh_owner)
-			llmp = LIST(ghp->gh_owner)->lm_tail;
+		if (ghp->gh_ownlmp)
+			llmp = LIST(ghp->gh_ownlmp)->lm_tail;
 		else {
 			for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) {
 				if ((llmp = LIST(gdp->gd_depend)->lm_tail) != 0)
@@ -1245,7 +1232,7 @@
 		 */
 		if (nosym_str == 0)
 			nosym_str = MSG_INTL(MSG_GEN_NOSYM);
-		eprintf(ERR_FATAL, nosym_str, name);
+		eprintf(LIST(clmp), ERR_FATAL, nosym_str, name);
 	}
 
 	load_completion(llmp, clmp);
@@ -1263,13 +1250,13 @@
 	 * Verify the arguments.
 	 */
 	if (name == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLSYM));
+		eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_ILLSYM));
 		return (0);
 	}
 	if ((handle != RTLD_NEXT) && (handle != RTLD_DEFAULT) &&
 	    (handle != RTLD_SELF) && (handle != RTLD_PROBE) &&
 	    (hdl_validate((Grp_hdl *)handle) == 0)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
+		eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
 		return (0);
 	}
 	return (dlsym_intn(handle, name, clmp, dlmp));
@@ -1285,21 +1272,14 @@
 void *
 _dlsym(void *handle, const char *name)
 {
-	int		entry;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map		*clmp, *dlmp = 0;
-	void		*addr;
+	int	entry;
+	Rt_map	*clmp, *dlmp = 0;
+	void	*addr;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 
-	if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
 	addr = dlsym_check(handle, name, clmp, &dlmp);
 
 	if (dlmp)
@@ -1308,9 +1288,6 @@
 	if (entry && dlmp)
 		is_dep_init(dlmp, clmp);
 
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
-
 	if (entry)
 		leave(LIST(clmp));
 	return (addr);
@@ -1346,10 +1323,8 @@
 int
 _dladdr(void *addr, Dl_info *dlip)
 {
-	int		entry, error;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map		*clmp;
+	int	entry, error;
+	Rt_map	*clmp;
 
 	entry = enter();
 
@@ -1359,18 +1334,11 @@
 	 * indicate the failure.
 	 */
 	if ((clmp = _caller((caddr_t)addr, CL_NONE)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), EC_ADDR(addr));
+		eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR),
+		    EC_NATPTR(addr));
 		error = 0;
 	} else {
-		if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-			dbg_save = dbg_mask;
-			dbg_mask = 0;
-		}
-
 		dladdr_core(clmp, addr, dlip, 0, 0);
-
-		if (lmflags & LML_FLG_RTLDLM)
-			dbg_mask = dbg_save;
 		error = 1;
 	}
 
@@ -1384,10 +1352,8 @@
 int
 _dladdr1(void *addr, Dl_info *dlip, void **info, int flags)
 {
-	int		entry, error = 0;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map		*clmp;
+	int	entry, error = 0;
+	Rt_map	*clmp;
 
 	/*
 	 * Validate any flags.
@@ -1397,11 +1363,12 @@
 
 		if (((request = (flags & RTLD_DL_MASK)) != RTLD_DL_SYMENT) &&
 		    (request != RTLD_DL_LINKMAP)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLFLAGS), flags);
+			eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_ILLFLAGS),
+			    flags);
 			return (0);
 		}
 		if (info == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLINFO), flags);
+			eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_ILLINFO), flags);
 			return (0);
 		}
 	}
@@ -1414,20 +1381,14 @@
 	 * indicate the failure.
 	 */
 	if ((clmp = _caller((caddr_t)addr, CL_NONE)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), EC_ADDR(addr));
+		eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR),
+		    EC_NATPTR(addr));
 		error = 0;
 	} else {
-		if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-			dbg_save = dbg_mask;
-			dbg_mask = 0;
-		}
-
 		dladdr_core(clmp, addr, dlip, info, flags);
-
-		if (lmflags & LML_FLG_RTLDLM)
-			dbg_mask = dbg_save;
 		error = 1;
 	}
+
 	if (entry)
 		leave(0);
 	return (error);
@@ -1437,43 +1398,50 @@
  * Core dldump activity.
  */
 static int
-dldump_core(const char *ipath, const char *opath, int flags)
+dldump_core(Lm_list *lml, const char *ipath, const char *opath, int flags)
 {
-	Addr		addr = 0;
-	Rt_map		*lmp;
+	Addr	addr = 0;
+	Rt_map	*lmp;
 
 	/*
 	 * Verify any arguments first.
 	 */
 	if ((!opath || (*opath == '\0')) || (ipath && (*ipath == '\0'))) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH));
 		return (1);
 	}
 
 	/*
-	 * If an input file is specified make sure its one of our dependencies.
+	 * If an input file is specified make sure its one of our dependencies
+	 * on the main link-map list.  Note, this has really all evolved for
+	 * crle(), which uses libcrle.so on an alternative link-map to trigger
+	 * dumping objects from the main link-map list.   If we ever want to
+	 * dump objects from alternative link-maps, this model is going to
+	 * have to be revisited.
 	 */
 	if (ipath) {
 		if ((lmp = is_so_loaded(&lml_main, ipath, 0)) == 0)
 			lmp = is_so_loaded(&lml_main, ipath, 1);
 
 		if (lmp == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NOFILE), ipath);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_NOFILE),
+			    ipath);
 			return (1);
 		}
 		if (FLAGS(lmp) & FLG_RT_ALTER) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_ALTER), ipath);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_ALTER), ipath);
 			return (1);
 		}
 		if (FLAGS(lmp) & FLG_RT_NODUMP) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NODUMP), ipath);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_NODUMP),
+			    ipath);
 			return (1);
 		}
 	} else
 		lmp = lml_main.lm_head;
 
 
-	DBG_CALL(Dbg_file_dldump(NAME(lmp), opath, flags));
+	DBG_CALL(Dbg_file_dldump(lmp, opath, flags));
 
 	/*
 	 * If the object being dump'ed isn't fixed identify its mapping.
@@ -1497,29 +1465,19 @@
 #pragma weak dldump = _dldump
 
 /*
- * External entry for dldump(3dl).  Returns 0 on success, non-zero otherwise.
+ * External entry for dldump(3c).  Returns 0 on success, non-zero otherwise.
  */
 int
 _dldump(const char *ipath, const char *opath, int flags)
 {
-	int		error, entry;
-	uint_t		dbg_save;
-	Word		lmflags;
-	Rt_map		*clmp;
+	int	error, entry;
+	Rt_map	*clmp;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 
-	if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
-	error = dldump_core(ipath, opath, flags);
-
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+	error = dldump_core(LIST(clmp), ipath, opath, flags);
 
 	if (entry)
 		leave(LIST(clmp));
@@ -1553,10 +1511,11 @@
 static int
 dlinfo_core(void *handle, int request, void *p, Rt_map *clmp)
 {
+	Lm_list	*lml = LIST(clmp);
 	Rt_map	*lmp;
 
 	if ((request > RTLD_DI_MAX) || (p == 0)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL));
 		return (-1);
 	}
 
@@ -1568,7 +1527,7 @@
 
 		if ((config->c_name == 0) || (config->c_bgn == 0) ||
 		    (config->c_end == 0)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOCONFIG));
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_NOCONFIG));
 			return (-1);
 		}
 		dlip->dli_fname = config->c_name;
@@ -1581,7 +1540,7 @@
 	 */
 	if (request == RTLD_DI_PROFILENAME) {
 		if (profile_name == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOPROFNAME));
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_NOPROFNAME));
 			return (-1);
 		}
 
@@ -1617,7 +1576,7 @@
 		 */
 		(void) sigfillset(&set);
 		if (sigismember(&set, sig) != 1) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVSIG), sig);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_INVSIG), sig);
 			return (-1);
 		}
 
@@ -1634,10 +1593,10 @@
 		Grp_hdl *	ghp = (Grp_hdl *)handle;
 
 		if (!hdl_validate(ghp)) {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL));
 			return (-1);
 		}
-		lmp = ghp->gh_owner;
+		lmp = ghp->gh_ownlmp;
 	}
 
 	/*
@@ -1726,13 +1685,14 @@
 			 * there's sufficient space.
 			 */
 			if (size > info->dls_size) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SERSIZE),
+				eprintf(lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_SERSIZE),
 				    EC_OFF(info->dls_size));
 				return (-1);
 			}
 			if (cnt > info->dls_cnt) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SERCNT),
-				    info->dls_cnt);
+				eprintf(lml, ERR_FATAL,
+				    MSG_INTL(MSG_ARG_SERCNT), info->dls_cnt);
 				return (-1);
 			}
 
@@ -1785,24 +1745,14 @@
 _dlinfo(void *handle, int request, void *p)
 {
 	int	error, entry;
-	uint_t	dbg_save;
-	Word	lmflags;
 	Rt_map	*clmp;
 
 	entry = enter();
 
 	clmp = _caller(caller(), CL_EXECDEF);
 
-	if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
-	}
-
 	error = dlinfo_core(handle, request, p, clmp);
 
-	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
-
 	if (entry)
 		leave(LIST(clmp));
 	return (error);
--- a/usr/src/cmd/sgs/rtld/common/elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -41,12 +40,12 @@
 #include	<string.h>
 #include	<limits.h>
 #include	<dlfcn.h>
-#include	"conv.h"
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
 
 /*
  * Default and secure dependency search paths.
@@ -142,7 +141,8 @@
 	    (strcmp(name, MSG_ORIG(MSG_FIL_RTLD)) == 0)) {
 		Pnode	*pnp;
 
-		DBG_CALL(Dbg_file_fixname(name, MSG_ORIG(MSG_PTH_LIBSYS)));
+		DBG_CALL(Dbg_file_fixname(LIST(clmp), name,
+		    MSG_ORIG(MSG_PTH_LIBSYS)));
 		if (((pnp = calloc(sizeof (Pnode), 1)) == 0) ||
 		    ((pnp->p_name = strdup(MSG_ORIG(MSG_PTH_LIBSYS))) == 0)) {
 			if (pnp)
@@ -299,7 +299,7 @@
 	 * dependencies processing has initiated.
 	 */
 	name = STRTAB(clmp) + DYN(clmp)[ndx].d_un.d_val;
-	DBG_CALL(Dbg_file_lazyload(name, NAME(clmp), sym));
+	DBG_CALL(Dbg_file_lazyload(clmp, name, sym));
 	if (lml->lm_flags & LML_FLG_TRC_ENABLE)
 		dip->di_flags |= FLG_DI_PROCESSD;
 
@@ -467,6 +467,7 @@
 	 * Traverse the callers version needed information and determine if any
 	 * specific versions are required from the dependency.
 	 */
+	DBG_CALL(Dbg_ver_need_title(LIST(clmp), NAME(clmp)));
 	for (_num = 1; _num <= num; _num++,
 	    vnd = (Verneed *)((Xword)vnd + vnd->vn_next)) {
 		Half		cnt = vnd->vn_cnt;
@@ -480,7 +481,6 @@
 		if (strcmp(name, need) != 0)
 			continue;
 
-		DBG_CALL(Dbg_ver_need_title(NAME(clmp)));
 		if ((lml->lm_flags & LML_FLG_TRC_VERBOSE) &&
 		    ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0))
 			(void) printf(MSG_INTL(MSG_LDD_VER_FIND), name);
@@ -499,7 +499,7 @@
 			int		found = 0;
 
 			version = (char *)(cstrs + vnap->vna_name);
-			DBG_CALL(Dbg_ver_need_entry(0, need, version));
+			DBG_CALL(Dbg_ver_need_entry(lml, 0, need, version));
 
 			for (_num = 1; _num <= num; _num++,
 			    vdf = (Verdef *)((Xword)vdf + vdf->vd_next)) {
@@ -552,13 +552,14 @@
 			 */
 			if ((found == 0) && (num != 0) &&
 			    (!(vnap->vna_flags & VER_FLG_WEAK))) {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NFOUND),
-				    need, version, NAME(clmp));
+				eprintf(lml, ERR_FATAL,
+				    MSG_INTL(MSG_VER_NFOUND), need, version,
+				    NAME(clmp));
 				return (0);
 			}
 		}
-		return (1);
 	}
+	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 	return (1);
 }
 
@@ -668,7 +669,7 @@
 			continue;
 		}
 
-		DBG_CALL(Dbg_file_needed(name, NAME(clmp)));
+		DBG_CALL(Dbg_file_needed(clmp, name));
 		if (lml->lm_flags & LML_FLG_TRC_ENABLE)
 			dip->di_flags |= FLG_DI_PROCESSD;
 
@@ -711,7 +712,7 @@
 }
 
 static int
-elf_map_check(const char *name, caddr_t vaddr, Off size)
+elf_map_check(Lm_list *lml, const char *name, caddr_t vaddr, Off size)
 {
 	prmap_t		*maps, *_maps;
 	int		pfd, num, _num;
@@ -734,12 +735,13 @@
 	/*
 	 * Determine the mappings presently in use by this process.
 	 */
-	if ((pfd = pr_open()) == FD_UNAVAIL)
+	if ((pfd = pr_open(lml)) == FD_UNAVAIL)
 		return (1);
 
 	if (ioctl(pfd, PIOCNMAP, (void *)&num) == -1) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, strerror(err));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name,
+		    strerror(err));
 		return (1);
 	}
 
@@ -748,7 +750,8 @@
 
 	if (ioctl(pfd, PIOCMAP, (void *)maps) == -1) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, strerror(err));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name,
+		    strerror(err));
 		free(maps);
 		return (1);
 	}
@@ -775,8 +778,8 @@
 		else
 			str = MSG_INTL(MSG_STR_UNKNOWN);
 
-		eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_MAPINUSE), name,
-		    EC_ADDR(vaddr), EC_OFF(size), str);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_MAPINUSE), name,
+		    EC_NATPTR(vaddr), EC_OFF(size), str);
 		return (1);
 	}
 	free(maps);
@@ -790,8 +793,8 @@
  * reservation using the file as backing.
  */
 static Am_ret
-elf_map_reserve(const char *name, caddr_t *maddr, Off msize, int mperm,
-    int fd, Xword align)
+elf_map_reserve(Lm_list *lml, const char *name, caddr_t *maddr, Off msize,
+    int mperm, int fd, Xword align)
 {
 	Am_ret	amret;
 	int	mflag = MAP_PRIVATE | MAP_NORESERVE;
@@ -802,7 +805,7 @@
 		*maddr = (caddr_t)align;
 	}
 #endif
-	if ((amret = anon_map(maddr, msize, PROT_NONE, mflag)) == AM_ERROR)
+	if ((amret = anon_map(lml, maddr, msize, PROT_NONE, mflag)) == AM_ERROR)
 		return (amret);
 
 	if (amret == AM_OK)
@@ -817,7 +820,8 @@
 	if ((*maddr = mmap(*maddr, msize, mperm, MAP_PRIVATE,
 	    fd, 0)) == MAP_FAILED) {
 		int	err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), name, strerror(err));
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), name,
+		    strerror(err));
 		return (AM_ERROR);
 	}
 	return (AM_NOSUP);
@@ -864,6 +868,7 @@
  */
 static caddr_t
 elf_map_it(
+	Lm_list		*lml,		/* link-map list */
 	const char	*name,		/* actual name stored for pathname */
 	Off		fsize,		/* total mapping claim of the file */
 	Ehdr		*ehdr,		/* ELF header of file */
@@ -934,7 +939,7 @@
 		rsize = fsize + padpsize + padsize;
 
 		if (lml_main.lm_head) {
-			if (elf_map_check(name, raddr, rsize) != 0)
+			if (elf_map_check(lml, name, raddr, rsize) != 0)
 				return (0);
 		}
 
@@ -963,7 +968,7 @@
 		 * be remapped.
 		 */
 		rsize = fsize + padmsize + padsize;
-		if ((amret = elf_map_reserve(name, &raddr, rsize, mperm,
+		if ((amret = elf_map_reserve(lml, name, &raddr, rsize, mperm,
 		    fd, align)) == AM_ERROR)
 			return (0);
 		maddr = raddr + padmsize;
@@ -989,8 +994,8 @@
 			(void) munmap(raddr, rsize);
 
 			rsize += align;
-			if ((amret = elf_map_reserve(name, &raddr, rsize, mperm,
-			    fd, align)) == AM_ERROR)
+			if ((amret = elf_map_reserve(lml, name, &raddr, rsize,
+			    mperm, fd, align)) == AM_ERROR)
 				return (0);
 
 			maddr = faddr = (caddr_t)S_ROUND((Off)(raddr +
@@ -1047,8 +1052,9 @@
 	 */
 	if (padsize) {
 		if (amret == AM_NOSUP) {
-			if (dz_map(raddr, padpsize, PROT_NONE, (MAP_PRIVATE |
-			    MAP_FIXED | MAP_NORESERVE)) == MAP_FAILED)
+			if (dz_map(lml, raddr, padpsize, PROT_NONE,
+			    (MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE)) ==
+			    MAP_FAILED)
 				return (0);
 
 			skipfseg = 0;
@@ -1123,7 +1129,7 @@
 			 * processed.  The segment reservation is mapped
 			 * directly from /dev/null.
 			 */
-			if (nu_map((caddr_t)addr, phdr->p_memsz, PROT_NONE,
+			if (nu_map(lml, (caddr_t)addr, phdr->p_memsz, PROT_NONE,
 			    MAP_FIXED | MAP_PRIVATE) == MAP_FAILED)
 				return (0);
 
@@ -1135,7 +1141,7 @@
 			 * If this segment has no backing file then it defines a
 			 * nobits segment and is mapped directly from /dev/zero.
 			 */
-			if (dz_map((caddr_t)addr, phdr->p_memsz, mperm,
+			if (dz_map(lml, (caddr_t)addr, phdr->p_memsz, mperm,
 			    MAP_FIXED | MAP_PRIVATE) == MAP_FAILED)
 				return (0);
 
@@ -1176,7 +1182,7 @@
 				    (MAP_FIXED | MAP_PRIVATE), fd, foff) ==
 				    MAP_FAILED) {
 					int	err = errno;
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_SYS_MMAP), name,
 					    strerror(err));
 					return (0);
@@ -1219,7 +1225,8 @@
 					zero((caddr_t)foff, (long)zplen);
 
 					if ((zlen = (fend - (Off)zaddr)) > 0) {
-						if (dz_map(zaddr, zlen, mperm,
+						if (dz_map(lml, zaddr, zlen,
+						    mperm,
 						    MAP_FIXED | MAP_PRIVATE) ==
 						    MAP_FAILED)
 							return (0);
@@ -1261,8 +1268,9 @@
 			 * maddr is currently page aligned from the last segment
 			 * mapping.
 			 */
-			if (dz_map(maddr, padsize, PROT_NONE, (MAP_PRIVATE |
-			    MAP_FIXED | MAP_NORESERVE)) == MAP_FAILED)
+			if (dz_map(lml, maddr, padsize, PROT_NONE,
+			    (MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE)) ==
+			    MAP_FAILED)
 				return (0);
 		}
 		maddr += padsize;
@@ -1357,13 +1365,13 @@
 		Word	tracing = (LIST(clmp)->lm_flags &
 		    (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED));
 
-		if (tracing || dbg_mask) {
+		if (tracing || DBG_ENABLED) {
 			Bnd_desc **	bdpp;
 			Aliste		off;
 
 			FLAGS1(ilmp) |= FL1_RT_USED;
 
-			if ((tracing & LML_FLG_TRC_UNREF) || dbg_mask) {
+			if ((tracing & LML_FLG_TRC_UNREF) || DBG_ENABLED) {
 				for (ALIST_TRAVERSE(CALLERS(ilmp), off, bdpp)) {
 					Bnd_desc *	bdp = *bdpp;
 
@@ -1386,10 +1394,11 @@
 	filtees = (char *)STRTAB(ilmp) + DYN(ilmp)[ndx].d_un.d_val;
 	if (dip->di_info == 0) {
 		if (rtld_flags2 & RT_FL2_FLTCFG)
-			dip->di_info = elf_config_flt(PATHNAME(ilmp), filtees);
+			dip->di_info = elf_config_flt(lml, PATHNAME(ilmp),
+			    filtees);
 
 		if (dip->di_info == 0) {
-			DBG_CALL(Dbg_file_filter(NAME(ilmp), filtees, 0));
+			DBG_CALL(Dbg_file_filter(lml, NAME(ilmp), filtees, 0));
 			if ((lml->lm_flags &
 			    (LML_FLG_TRC_VERBOSE | LML_FLG_TRC_SEARCH)) &&
 			    ((FLAGS1(ilmp) & FL1_RT_LDDSTUB) == 0))
@@ -1478,7 +1487,7 @@
 			const char	*filtee = pnp->p_name;
 			int		audit = 0;
 
-			DBG_CALL(Dbg_file_filtee(NAME(ilmp), filtee, 0));
+			DBG_CALL(Dbg_file_filtee(lml, NAME(ilmp), filtee, 0));
 
 			ghp = 0;
 
@@ -1620,7 +1629,8 @@
 			 */
 			if (nlmp == 0) {
 				pnp->p_info = 0;
-				DBG_CALL(Dbg_file_filtee(0, filtee, audit));
+				DBG_CALL(Dbg_file_filtee(lml, 0, filtee,
+				    audit));
 
 				if (ghp)
 					(void) dlclose_core(ghp, ilmp);
@@ -1700,7 +1710,7 @@
 		 * If this object is tagged to terminate filtee processing we're
 		 * done.
 		 */
-		if (FLAGS1(ghp->gh_owner) & FL1_RT_ENDFILTE)
+		if (FLAGS1(ghp->gh_ownlmp) & FL1_RT_ENDFILTE)
 			break;
 	}
 
@@ -1835,10 +1845,8 @@
 	 * If we're only here to establish a symbols index, skip the diagnostic
 	 * used to trace a symbol search.
 	 */
-	if ((slp->sl_flags & LKUP_SYMNDX) == 0) {
-		DBG_CALL(Dbg_syms_lookup(name, NAME(ilmp),
-		    MSG_ORIG(MSG_STR_ELF)));
-	}
+	if ((slp->sl_flags & LKUP_SYMNDX) == 0)
+		DBG_CALL(Dbg_syms_lookup(ilmp, name, MSG_ORIG(MSG_STR_ELF)));
 
 	if (HASH(ilmp) == 0)
 		return ((Sym *)0);
@@ -2015,8 +2023,8 @@
 	Xword		rpath = 0;
 	Ehdr		*ehdr = (Ehdr *)addr;
 
-	DBG_CALL(Dbg_file_elf(pname, (ulong_t)ld, addr, msize, entry,
-	    get_linkmap_id(lml), lmco));
+	DBG_CALL(Dbg_file_elf(lml, pname, (ulong_t)ld, addr, msize, entry,
+	    lml->lm_lmidstr, lmco));
 
 	/*
 	 * Allocate space for the link-map and private elf information.  Once
@@ -2292,7 +2300,7 @@
 				    if ((lml->lm_flags & LML_FLG_STARTREL) == 0)
 					FLAGS(lmp) |= FLG_RT_INTRPOSE;
 				    else {
-					DBG_CALL(Dbg_util_intoolate(NAME(lmp)));
+					DBG_CALL(Dbg_util_intoolate(lmp));
 					if (lml->lm_flags & LML_FLG_TRC_ENABLE)
 					    (void) printf(
 						MSG_INTL(MSG_LDD_REL_ERR2),
@@ -2316,9 +2324,7 @@
 			case DT_SUNW_RTLDINF:
 				if ((lml->lm_info_lmp != 0) &&
 				    (lml->lm_info_lmp != lmp)) {
-					DBG_CALL(Dbg_unused_rtldinfo(
-						NAME(lmp),
-						NAME(lml->lm_info_lmp)));
+					DBG_CALL(Dbg_unused_rtldinfo(lmp));
 					break;
 				}
 				lml->lm_info_lmp = lmp;
@@ -2534,8 +2540,8 @@
 	else if (etype == ET_DYN)
 		fixed = 0;
 	else {
-		eprintf(ERR_ELF, MSG_INTL(MSG_GEN_BADTYPE), pname,
-		    conv_etype_str(etype));
+		eprintf(lml, ERR_ELF, MSG_INTL(MSG_GEN_BADTYPE), pname,
+		    conv_ehdr_type(etype));
 		return (0);
 	}
 
@@ -2546,7 +2552,7 @@
 	size = (size_t)((char *)ehdr->e_phoff +
 		(ehdr->e_phnum * ehdr->e_phentsize));
 	if (size > fmap->fm_fsize) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname);
 		return (0);
 	}
 	if (size > fmap->fm_msize) {
@@ -2554,7 +2560,7 @@
 		if ((fmap->fm_maddr = mmap(fmap->fm_maddr, size, PROT_READ,
 		    fmap->fm_mflags, fd, 0)) == MAP_FAILED) {
 			int	err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname,
 			    strerror(err));
 			return (0);
 		}
@@ -2582,8 +2588,8 @@
 				fph = pptr;
 			/* LINTED argument lph is initialized in first pass */
 			} else if (pptr->p_vaddr <= lph->p_vaddr) {
-				eprintf(ERR_ELF, MSG_INTL(MSG_GEN_INVPRGHDR),
-				    pname);
+				eprintf(lml, ERR_ELF,
+				    MSG_INTL(MSG_GEN_INVPRGHDR), pname);
 				return (0);
 			}
 
@@ -2621,7 +2627,7 @@
 	 * specified file and memory size.
 	 */
 	if ((fph == 0) || (lmph == 0) || (lfph == 0)) {
-		eprintf(ERR_ELF, MSG_INTL(MSG_GEN_NOLOADSEG), pname);
+		eprintf(lml, ERR_ELF, MSG_INTL(MSG_GEN_NOLOADSEG), pname);
 		return (0);
 	}
 
@@ -2631,7 +2637,7 @@
 	 * bus errors if we're given a truncated file).
 	 */
 	if (fmap->fm_fsize < ((size_t)lfph->p_offset + lfph->p_filesz)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname);
 		return (0);
 	}
 
@@ -2717,7 +2723,7 @@
 		/*
 		 * Map the file.
 		 */
-		if (!(faddr = elf_map_it(pname, memsize, ehdr, fph, lph,
+		if (!(faddr = elf_map_it(lml, pname, memsize, ehdr, fph, lph,
 		    &phdr, &paddr, &plen, fixed, fd, align, mmaps, &mmapcnt)))
 			return (0);
 	}
@@ -2785,7 +2791,7 @@
  * on the value of the argument.
  */
 int
-elf_set_prot(Rt_map * lmp, int permission)
+elf_set_prot(Rt_map *lmp, int permission)
 {
 	Mmap	*mmaps;
 
@@ -2796,7 +2802,7 @@
 	if (FLAGS(lmp) & FLG_RT_IMGALLOC)
 		return (1);
 
-	DBG_CALL(Dbg_file_prot(NAME(lmp), permission));
+	DBG_CALL(Dbg_file_prot(lmp, permission));
 
 	for (mmaps = MMAPS(lmp); mmaps->m_vaddr; mmaps++) {
 		if (mmaps->m_perm & PROT_WRITE)
@@ -2805,7 +2811,7 @@
 		if (mprotect(mmaps->m_vaddr, mmaps->m_msize,
 		    (mmaps->m_perm | permission)) == -1) {
 			int	err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MPROT),
+			eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_SYS_MPROT),
 			    NAME(lmp), strerror(err));
 			return (0);
 		}
@@ -2885,7 +2891,7 @@
 	if (lml->lm_flags & LML_FLG_TRC_WARN) {
 		if (rsym->st_size != dsym->st_size) {
 			(void) printf(MSG_INTL(MSG_LDD_CPY_SIZDIF),
-			    _conv_reloc_type_str(M_R_COPY), demangle(name),
+			    _conv_reloc_type(M_R_COPY), demangle(name),
 			    NAME(rlmp), EC_XWORD(rsym->st_size),
 			    NAME(dlmp), EC_XWORD(dsym->st_size));
 			if (rsym->st_size > dsym->st_size)
@@ -2898,12 +2904,13 @@
 
 		if (ELF_ST_VISIBILITY(dsym->st_other) == STV_PROTECTED) {
 			(void) printf(MSG_INTL(MSG_LDD_CPY_PROT),
-			    _conv_reloc_type_str(M_R_COPY), demangle(name),
+			    _conv_reloc_type(M_R_COPY), demangle(name),
 				NAME(dlmp));
 		}
 	}
 
-	DBG_CALL(Dbg_reloc_apply((Xword)radd, (Xword)rc.r_size));
+	DBG_CALL(Dbg_reloc_apply_val(lml, ELF_DBG_RTLD, (Xword)radd,
+	    (Xword)rc.r_size));
 	return (1);
 }
 
@@ -3132,16 +3139,17 @@
     ulong_t rsymndx)
 {
 	const char	*name = (char *)0;
+	Lm_list		*lml = LIST(lmp);
 	int		trace;
 
-	if ((LIST(lmp)->lm_flags & LML_FLG_TRC_ENABLE) &&
+	if ((lml->lm_flags & LML_FLG_TRC_ENABLE) &&
 	    (((rtld_flags & RT_FL_SILENCERR) == 0) ||
-	    (LIST(lmp)->lm_flags & LML_FLG_TRC_VERBOSE)))
+	    (lml->lm_flags & LML_FLG_TRC_VERBOSE)))
 		trace = 1;
 	else
 		trace = 0;
 
-	if ((trace == 0) && (dbg_mask == 0))
+	if ((trace == 0) && (DBG_ENABLED == 0))
 		return;
 
 	if (rsymndx) {
@@ -3158,12 +3166,11 @@
 	if (trace) {
 		const char *rstr;
 
-		rstr = _conv_reloc_type_str((uint_t)rtype);
+		rstr = _conv_reloc_type((uint_t)rtype);
 		(void) printf(MSG_INTL(MSG_LDD_REL_ERR1), rstr, name,
 		    EC_ADDR(roffset));
 		return;
 	}
 
-	Dbg_reloc_error(M_MACH, M_REL_SHT_TYPE, rel, name,
-		MSG_ORIG(MSG_REL_BADROFFSET));
+	Dbg_reloc_error(lml, ELF_DBG_RTLD, M_MACH, M_REL_SHT_TYPE, rel, name);
 }
--- a/usr/src/cmd/sgs/rtld/common/globals.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/globals.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	  All Rights Reserved
  *
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -34,6 +33,7 @@
 #include	<signal.h>
 #include	<dlfcn.h>
 #include	<synch.h>
+#include	<debug.h>
 #include	"_rtld.h"
 
 /*
@@ -136,7 +136,14 @@
 uint_t		env_info = 0;		/* information regarding environment */
 					/*	variables */
 int		killsig = SIGKILL;	/* signal sent on fatal exit */
-uint_t		dbg_mask;		/* debugging classes */
+
+/*
+ * Note, the debugging descriptor interposes on the default definition provided
+ * by liblddbg.  This is required as ld.so.1 must only have outstanding relative
+ * relocations.
+ */
+static Dbg_desc	_dbg_desc = {0, 0, 0};
+Dbg_desc	*dbg_desc = &_dbg_desc;	/* debugging descriptor */
 const char	*dbg_file = 0;		/* debugging directed to file */
 
 #pragma weak	environ = _environ	/* environ for PLT tracing - we */
--- a/usr/src/cmd/sgs/rtld/common/malloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/malloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -200,7 +199,7 @@
 		size_t		totpage = align(totsize, syspagsz);
 
 		/* LINTED */
-		if ((page = (struct page *)dz_map(0, totpage,
+		if ((page = (struct page *)dz_map(0, 0, totpage,
 		    PROT_READ | PROT_WRITE | PROT_EXEC,
 		    MAP_PRIVATE)) == (struct page *)-1)
 			return (0);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/rtld/common/mapfile-32-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,33 @@
+#
+# 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"
+#
+
+SUNWprivate_1.2 {
+	global:
+		do32_reloc;		# Required to support librtld.so
+		reloc32_table;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/rtld/common/mapfile-64-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,33 @@
+#
+# 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"
+#
+
+SUNWprivate_1.2 {
+	global:
+		do64_reloc;		# Required to support librtld.so
+		reloc64_table;
+};
--- a/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -24,6 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 # Note: This mapfile is used to place r_debug as the
 # very first data item inside of the run-time linker.
 # This is required for the ld.so.1 <--> rtld_db bootstraping
--- a/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc	Tue Mar 14 09:22:52 2006 -0800
@@ -1,15 +1,9 @@
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -24,6 +18,13 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 # Note: This mapfile is used to place r_debug as the
 # very first data item inside of the run-time linker.
 # This is required for the ld.so.1 <--> rtld_db bootstraping
--- a/usr/src/cmd/sgs/rtld/common/mapfile-vers	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/mapfile-vers	Tue Mar 14 09:22:52 2006 -0800
@@ -1,13 +1,9 @@
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
 #
 # 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.
@@ -22,6 +18,11 @@
 #
 # CDDL HEADER END
 #
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 # Generic interface definition for usr/src/cmd/sgs/rtld.
@@ -71,14 +72,12 @@
 		 rtld_db_postinit;
 		 r_debug;
 
-		 do_reloc;		# Required to support librtld.so
 		 elf_plt_write;
 		 is_so_loaded;
 		 lml_main;
 		 lookup_sym;
-		 reloc_table;
 
-		 dbg_mask;		# Required to support liblddbg.so 
+		 dbg_desc;		# Diagnostic support
 		 dbg_print;
 		 eprintf;		# Error message printing
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/sgs/rtld/common/move.c	Tue Mar 14 09:22:52 2006 -0800
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Object file dependent support for ELF objects.
+ */
+#include	"_synonyms.h"
+
+#include	<stdio.h>
+#include	<sys/procfs.h>
+#include	<sys/mman.h>
+#include	<dlfcn.h>
+#include	<debug.h>
+#include	<conv.h>
+#include	"_rtld.h"
+#include	"_audit.h"
+#include	"_elf.h"
+#include	"msg.h"
+
+/*
+ * Move data
+ */
+void
+move_data(Rt_map *lmp)
+{
+	Lm_list	*lml = LIST(lmp);
+	Move	*mv = MOVETAB(lmp);
+	Phdr	*pptr = SUNWBSS(lmp);
+	ulong_t	num, mvnum = MOVESZ(lmp) / MOVEENT(lmp);
+
+	DBG_CALL(Dbg_move_data(lmp));
+	for (num = 0; num < mvnum; num++, mv++) {
+		Addr	taddr;
+		Half 	rep, stride;
+		Sym	*sym;
+
+		/*
+		 * If the target address needs to be mapped in,
+		 * map it first.
+		 *	(You have to protect the code, thread safe)
+		 */
+		if (FLAGS(lmp) & FLG_RT_SUNWBSS) {
+			long	zlen;
+			Off	foff;
+			caddr_t	zaddr, eaddr;
+
+			foff = (Off) (pptr->p_vaddr + ADDR(lmp));
+			zaddr = (caddr_t)M_PROUND(foff);
+			eaddr = pptr->p_vaddr + ADDR(lmp) +
+			    (caddr_t)pptr->p_memsz;
+			zero((caddr_t)foff, (long)(zaddr - foff));
+			zlen = eaddr - zaddr;
+			if (zlen > 0) {
+				if (dz_map(lml, zaddr, zlen,
+				    (PROT_READ | PROT_WRITE),
+				    (MAP_FIXED | MAP_PRIVATE)) == MAP_FAILED)
+					return;
+			}
+
+			FLAGS(lmp) &= ~FLG_RT_SUNWBSS;
+		}
+
+		if ((sym = (Sym *)SYMTAB(lmp) + ELF_M_SYM(mv->m_info)) == 0)
+			continue;
+
+		stride = mv->m_stride + 1;
+		taddr = sym->st_value;
+		if (FLAGS(lmp) & FLG_RT_FIXED)
+			taddr = taddr + mv->m_poffset;
+		else
+			taddr = taddr + mv->m_poffset + ADDR(lmp);
+
+		DBG_CALL(Dbg_move_entry2(lml, mv, sym->st_name,
+		    (const char *)(sym->st_name + STRTAB(lmp))));
+
+		for (rep = 0; rep < mv->m_repeat; rep++) {
+			DBG_CALL(Dbg_move_expand(lml, mv, taddr));
+
+			switch (ELF_M_SIZE(mv->m_info)) {
+			case 1:
+				*((char *)taddr) = (char)mv->m_value;
+				taddr += stride;
+				break;
+			case 2:
+				/* LINTED */
+				*((Half *)taddr) = (Half)mv->m_value;
+				taddr += 2 * stride;
+				break;
+			case 4:
+				/* LINTED */
+				*((Word *)taddr) = (Word)mv->m_value;
+				taddr += 4 * stride;
+				break;
+			case 8:
+				/* LINTED */
+				*((unsigned long long *)taddr) = mv->m_value;
+				taddr += 8 * stride;
+				break;
+			default:
+				eprintf(lml, ERR_NONE, MSG_INTL(MSG_MOVE_ERR1));
+				break;
+			}
+		}
+	}
+}
--- a/usr/src/cmd/sgs/rtld/common/object.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/object.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -36,13 +36,16 @@
 #include	<libelf.h>
 #include	<string.h>
 #include	<dlfcn.h>
-#include	"libld.h"
+#include	<debug.h>
+#include	<libld.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
-#include	"debug.h"
+
+static Rt_map	*olmp = 0;
 
-static Rt_map *		olmp = 0;
+static Ehdr	dehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3,
+			    M_CLASS, M_DATA }, 0, M_MACH, EV_CURRENT };
 
 /*
  * Process a relocatable object.  The static object link map pointer is used as
@@ -61,12 +64,13 @@
 	 */
 	if ((ofl = (Ofl_desc *)calloc(sizeof (Ofl_desc), 1)) == 0)
 		return (0);
-	ofl->ofl_e_machine = M_MACH;
-	ofl->ofl_e_flags = 0;
-	ofl->ofl_libver = EV_CURRENT;
-	ofl->ofl_flags = (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP |
-		FLG_OF_MEMORY);
+
+	ofl->ofl_dehdr = &dehdr;
+
+	ofl->ofl_flags =
+	    (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP | FLG_OF_MEMORY);
 	ofl->ofl_flags1 = FLG_OF1_RELDYN | FLG_OF1_TEXTOFF;
+	ofl->ofl_lml = lml;
 
 	/*
 	 * As ent_setup() will effectively lazy load the necessary support
@@ -79,7 +83,7 @@
 	 * Obtain a generic set of entrance criteria (this is the first call to
 	 * libld.so, which will effectively lazyload it).
 	 */
-	if (ent_setup(ofl, syspagsz) == S_ERROR)
+	if (ld_ent_setup(ofl, syspagsz) == S_ERROR)
 		return (0);
 
 	/*
@@ -89,7 +93,7 @@
 	if ((olmp = (Rt_map *)calloc(sizeof (Rt_map), 1)) == 0)
 		return (0);
 
-	DBG_CALL(Dbg_file_elf(name, 0, 0, 0, 0, get_linkmap_id(lml), lmco));
+	DBG_CALL(Dbg_file_elf(lml, name, 0, 0, 0, 0, lml->lm_lmidstr, lmco));
 	FLAGS(olmp) |= FLG_RT_OBJECT;
 	olmp->rt_priv = (void *)ofl;
 
@@ -142,11 +146,10 @@
 	/*
 	 * Proceed to process the input file.
 	 */
-	DBG_CALL(Dbg_util_nl());
-	if (process_open(name, 0, fd, (Ofl_desc *)olmp->rt_priv,
+	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
+	if (ld_process_open(name, 0, fd, (Ofl_desc *)olmp->rt_priv,
 	    NULL, &rej) == (Ifl_desc *)S_ERROR)
 		return (0);
-
 	return (olmp);
 }
 
@@ -167,19 +170,19 @@
 	uint_t		phnum, mmapcnt;
 	Lm_cntl 	*lmc;
 
-	DBG_CALL(Dbg_util_nl());
+	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 
-	if (reloc_init(ofl) == S_ERROR)
+	if (ld_reloc_init(ofl) == S_ERROR)
 		return (0);
-	if (sym_validate(ofl) == S_ERROR)
+	if (ld_sym_validate(ofl) == S_ERROR)
 		return (0);
-	if (make_sections(ofl) == S_ERROR)
+	if (ld_make_sections(ofl) == S_ERROR)
 		return (0);
-	if (create_outfile(ofl) == S_ERROR)
+	if (ld_create_outfile(ofl) == S_ERROR)
 		return (0);
-	if ((etext = update_outfile(ofl)) == (Addr)S_ERROR)
+	if ((etext = ld_update_outfile(ofl)) == (Addr)S_ERROR)
 		return (0);
-	if (reloc_process(ofl) == S_ERROR)
+	if (ld_reloc_process(ofl) == S_ERROR)
 		return (0);
 
 	/*
@@ -192,7 +195,7 @@
 	/*
 	 * Allocate a mapping array to retain mapped segment information.
 	 */
-	ehdr = ofl->ofl_ehdr;
+	ehdr = ofl->ofl_nehdr;
 	phdr = ofl->ofl_phdr;
 	if ((mmaps = calloc(ehdr->e_phnum, sizeof (Mmap))) == 0)
 		return (0);
@@ -247,7 +250,7 @@
 	ORIGNAME(nlmp) = ORIGNAME(olmp);
 	DIRSZ(nlmp) = DIRSZ(olmp);
 
-	ofl_cleanup(ofl);
+	ld_ofl_cleanup(ofl);
 	free(olmp->rt_priv);
 	(void) memcpy(olmp, nlmp, sizeof (Rt_map));
 	free(nlmp);
--- a/usr/src/cmd/sgs/rtld/common/paths.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/paths.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -39,10 +38,10 @@
 #include	<fcntl.h>
 #include	<string.h>
 #include	<sys/systeminfo.h>
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"msg.h"
-#include	"conv.h"
-#include	"debug.h"
 
 /*
  * Given a search rule type, return a list of directories to search according
@@ -84,7 +83,7 @@
 			if (env_info & ENV_INF_PATHCFG)
 				mode |= LA_SER_CONFIG;
 
-			DBG_CALL(Dbg_libs_path(rpl_libpath, mode,
+			DBG_CALL(Dbg_libs_path(lml, rpl_libpath, mode,
 			    config->c_name));
 
 			/*
@@ -106,7 +105,7 @@
 				(void) printf(fmt, rpl_libpath, config->c_name);
 			}
 			if (rpl_libdirs && (rtld_flags & RT_FL_SECURE) &&
-			    (search || dbg_mask)) {
+			    (search || DBG_ENABLED)) {
 				free(rpl_libdirs);
 				rpl_libdirs = 0;
 			}
@@ -129,7 +128,7 @@
 		 * always call Dbg_libs_path().
 		 */
 		if (prm_libpath) {
-			DBG_CALL(Dbg_libs_path(prm_libpath,
+			DBG_CALL(Dbg_libs_path(lml, prm_libpath,
 			    (LA_SER_LIBPATH | LA_SER_CONFIG), config->c_name));
 
 			/*
@@ -144,7 +143,7 @@
 				(void) printf(MSG_INTL(MSG_LDD_PTH_LIBPATHC),
 				    prm_libpath, config->c_name);
 			if (prm_libdirs && (rtld_flags & RT_FL_SECURE) &&
-			    (search || dbg_mask)) {
+			    (search || DBG_ENABLED)) {
 				free(prm_libdirs);
 				prm_libdirs = 0;
 			}
@@ -167,7 +166,7 @@
 		 * Dbg_libs_path().
 		 */
 		if (RPATH(lmp)) {
-			DBG_CALL(Dbg_libs_path(RPATH(lmp), LA_SER_RUNPATH,
+			DBG_CALL(Dbg_libs_path(lml, RPATH(lmp), LA_SER_RUNPATH,
 			    NAME(lmp)));
 
 			/*
@@ -182,7 +181,7 @@
 				(void) printf(MSG_INTL(MSG_LDD_PTH_RPATH),
 				    RPATH(lmp), NAME(lmp));
 			if (RLIST(lmp) && (rtld_flags & RT_FL_SECURE) &&
-			    (search || dbg_mask)) {
+			    (search || DBG_ENABLED)) {
 				free(RLIST(lmp));
 				RLIST(lmp) = 0;
 			}
@@ -208,7 +207,7 @@
 		/*
 		 * For ldd(1) -s, indicate the default paths that'll be used.
 		 */
-		if (dirlist && (search || dbg_mask)) {
+		if (dirlist && (search || DBG_ENABLED)) {
 			Pnode *	pnp = dirlist;
 			int	num = 0;
 
@@ -224,7 +223,7 @@
 					    fmt = MSG_ORIG(MSG_LDD_FMT_PATH1);
 					(void) printf(fmt, pnp->p_name);
 				} else
-					DBG_CALL(Dbg_libs_path(pnp->p_name,
+					DBG_CALL(Dbg_libs_path(lml, pnp->p_name,
 					    pnp->p_orig, config->c_name));
 			}
 			if (search) {
@@ -284,13 +283,14 @@
  */
 uint_t
 expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit,
-    Rt_map * lmp)
+    Rt_map *lmp)
 {
 	char	_name[PATH_MAX];
 	char	*token = 0, *oname, *optr, *_optr, *nptr, * _list;
 	size_t	olen = 0, nlen = 0, _len;
 	int	isaflag = 0;
 	uint_t	flags = 0;
+	Lm_list	*lml = LIST(lmp);
 
 	optr = _optr = oname = *name;
 	nptr = _name;
@@ -323,8 +323,9 @@
 				(void) strncpy(nptr, _optr, _len);
 				nptr = nptr + _len;
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1),
-				    NAME(lmp), oname);
+				eprintf(lml, ERR_FATAL,
+				    MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp),
+				    oname);
 				return (0);
 			}
 		}
@@ -359,7 +360,7 @@
 					optr += MSG_TKN_ORIGIN_SIZE;
 					_flags |= PN_TKN_ORIGIN;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_ERR_EXPAND1),
 					    NAME(lmp), oname);
 					return (0);
@@ -397,7 +398,7 @@
 					optr += MSG_TKN_PLATFORM_SIZE;
 					_flags |= PN_TKN_PLATFORM;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_ERR_EXPAND1),
 					    NAME(lmp), oname);
 					return (0);
@@ -425,7 +426,7 @@
 					optr += MSG_TKN_OSNAME_SIZE;
 					_flags |= PN_TKN_OSNAME;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_ERR_EXPAND1),
 					    NAME(lmp), oname);
 					return (0);
@@ -453,7 +454,7 @@
 					optr += MSG_TKN_OSREL_SIZE;
 					_flags |= PN_TKN_OSREL;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_ERR_EXPAND1),
 					    NAME(lmp), oname);
 					return (0);
@@ -494,7 +495,7 @@
 					optr += MSG_TKN_ISALIST_SIZE;
 					_flags |= PN_TKN_ISALIST;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_ERR_EXPAND1),
 					    NAME(lmp), oname);
 					return (0);
@@ -576,8 +577,9 @@
 			if (_flags)
 				flags |= _flags;
 			else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND2),
-				    NAME(lmp), oname, token);
+				eprintf(lml, ERR_FATAL,
+				    MSG_INTL(MSG_ERR_EXPAND2), NAME(lmp),
+				    oname, token);
 				return (0);
 			}
 		}
@@ -590,7 +592,8 @@
 	 * the lead of a reserved token.
 	 */
 	if (nlen >= PATH_MAX) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp),
+		    oname);
 		return (0);
 	}
 
@@ -631,7 +634,7 @@
 			(void) strncpy(nptr, _optr, _len);
 			nptr = nptr + _len;
 		} else {
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1),
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1),
 			    NAME(lmp), oname);
 			return (0);
 		}
@@ -767,7 +770,8 @@
 				(void) printf(MSG_INTL(MSG_LDD_FIL_ILLEGAL),
 				    opath);
 		} else
-			eprintf(ERR_WARNING, MSG_INTL(MSG_SEC_ILLEGAL), opath);
+			eprintf(lml, ERR_WARNING, MSG_INTL(MSG_SEC_ILLEGAL),
+			    opath);
 
 		return (0);
 	}
@@ -789,13 +793,13 @@
 					opath);
 			}
 		} else
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath,
 			    strerror(EACCES));
 	} else {
 		/*
 		 * Search paths.
 		 */
-		DBG_CALL(Dbg_libs_ignore(opath));
+		DBG_CALL(Dbg_libs_ignore(lml, opath));
 		if ((lml->lm_flags & LML_FLG_TRC_SEARCH) &&
 		    ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0))
 			(void) printf(MSG_INTL(MSG_LDD_PTH_IGNORE), opath);
--- a/usr/src/cmd/sgs/rtld/common/remove.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/remove.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Remove objects.  Objects need removal from a process as part of:
@@ -57,11 +56,11 @@
 #include	<dlfcn.h>
 #include	<sys/debug.h>
 #include	<sys/avl.h>
-#include	"libc_int.h"
+#include	<libc_int.h>
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
-#include	"debug.h"
 #include	"msg.h"
 
 /*
@@ -131,7 +130,7 @@
 	 * satisfy any dlerror() usage.
 	 */
 	if (error)
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ATEXIT), error);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ATEXIT), error);
 
 	free(addr);
 	return (error);
@@ -184,6 +183,8 @@
 remove_lml(Lm_list *lml)
 {
 	if (lml && (lml->lm_head == 0)) {
+		if (lml->lm_lmidstr)
+			free(lml->lm_lmidstr);
 		if (lml->lm_alp)
 			free(lml->lm_alp);
 		if (lml->lm_lists)
@@ -243,7 +244,7 @@
 		lml->lm_peh_lmp = 0;
 	}
 
-	DBG_CALL(Dbg_file_delete(NAME(lmp)));
+	DBG_CALL(Dbg_file_delete(lmp));
 
 	/*
 	 * Unmap the object.
@@ -568,10 +569,10 @@
  * enced from the objects within the groups that are candidates for deletion.
  */
 static int
-gdp_collect(Alist ** ghalpp, Alist ** lmalpp, Grp_hdl * ghp1)
+gdp_collect(Alist **ghalpp, Alist **lmalpp, Grp_hdl *ghp1)
 {
 	Aliste		off;
-	Grp_desc *	gdp;
+	Grp_desc	*gdp;
 	int		action;
 
 	/*
@@ -764,7 +765,7 @@
 		for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) {
 			Rt_map	*lmp = gdp->gd_depend;
 
-			if (ghp->gh_owner == lmp)
+			if (ghp->gh_ownlmp == lmp)
 				(void) alist_delete(HANDLES(lmp), &ghp, 0);
 			(void) alist_delete(GROUPS(lmp), &ghp, 0);
 		}
@@ -837,7 +838,7 @@
  * final deletion of the orphaned handles.
  */
 int
-remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed)
+remove_hdl(Grp_hdl *ghp, Rt_map *clmp, int *removed)
 {
 	Rt_map *	lmp, ** lmpp;
 	int		rescan = 0;
@@ -1051,8 +1052,8 @@
 		 * If this handle is already an orphan, or if it's owner is
 		 * deletable there's no need to inspect its dependencies.
 		 */
-		if ((ghp->gh_owner == 0) ||
-		    (FLAGS(ghp->gh_owner) & FLG_RT_DELETE))
+		if ((ghp->gh_ownlmp == 0) ||
+		    (FLAGS(ghp->gh_ownlmp) & FLG_RT_DELETE))
 			continue;
 
 		/*
@@ -1068,7 +1069,7 @@
 			 * required there's no need to look at any other of the
 			 * handles dependencies.
 			 */
-			if ((lmp == ghp->gh_owner) &&
+			if ((lmp == ghp->gh_ownlmp) &&
 			    (gdp->gd_flags & GPD_REMOVE))
 				break;
 
@@ -1158,7 +1159,7 @@
 		 */
 		for (ALIST_TRAVERSE(ghalp, off1, ghpp)) {
 			Grp_hdl *	ghp = *ghpp;
-			Rt_map *	dlmp = ghp->gh_owner;
+			Rt_map *	dlmp = ghp->gh_ownlmp;
 
 			if (clmp && dlmp &&
 			    ((LIST(dlmp)->lm_flags & LML_FLG_NOAUDIT) == 0) &&
@@ -1278,9 +1279,9 @@
 			 * If this object is the owner of the handle break that
 			 * association in case the handle is retained.
 			 */
-			if (ghp->gh_owner == lmp) {
+			if (ghp->gh_ownlmp == lmp) {
 				(void) alist_delete(HANDLES(lmp), &ghp, 0);
-				ghp->gh_owner = 0;
+				ghp->gh_ownlmp = 0;
 			}
 
 			(void) alist_delete(GROUPS(lmp), &ghp, 0);
@@ -1319,7 +1320,7 @@
 			 */
 			(void) list_append(&hdl_list[HDLIST_ORP], ghp);
 
-			if (dbg_mask) {
+			if (DBG_ENABLED) {
 				DBG_CALL(Dbg_file_hdl_title(DBG_DEP_ORPHAN));
 				for (ALIST_TRAVERSE(ghp->gh_depends, off1, gdp))
 					DBG_CALL(Dbg_file_hdl_action(ghp,
@@ -1358,10 +1359,9 @@
 	 */
 	do {
 		List		list;
-		Listnode *	lnp;
-		Grp_hdl *	ghp, * oghp = 0;
-
-		DBG_CALL(Dbg_file_del_rescan());
+		Listnode	*lnp;
+		Grp_hdl		*ghp, *oghp = 0;
+		int		title = 0;
 
 		/*
 		 * Effectively clean the HDLIST_ORP list.  Any object that can't
@@ -1374,6 +1374,9 @@
 		for (LIST_TRAVERSE(&list, lnp, ghp)) {
 			int	_error, _remove;
 
+			if (title++ == 0)
+				DBG_CALL(Dbg_file_del_rescan(ghp->gh_ownlml));
+
 			if (oghp) {
 				list_delete(&list, oghp);
 				oghp = 0;
--- a/usr/src/cmd/sgs/rtld/common/rtld.msg	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/rtld.msg	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -365,11 +364,18 @@
 
 @ MSG_EMG_ENOMEM	"internal: Not enough space"
 
-@ MSG_DBG_FMT_DIAG	"%5.5d: "
-@ MSG_DBG_FMT_FILE	"%s.%5.5d"
-@ MSG_DBG_FMT_THREAD	"%5.5d: %d: "
+@ MSG_DBG_PID		"%5.5d: "
+@ MSG_DBG_UNDEF		"debug: "
+@ MSG_DBG_LMID		"%s: "
+@ MSG_DBG_THREAD	"%d: "
+@ MSG_DBG_FILE		"%s.%5.5d"
+
+@ MSG_LMID_BASE		"BASE"
+@ MSG_LMID_LDSO		"LDSO"
+@ MSG_LMID_ALT		"ALT"
+
+@ MSG_LMID_FMT		"%s%d"
+@ MSG_LMID_MAXED	"ALTMAXEDOUT"
 
 @ MSG_AUD_PLTENTER	"la_pltenter"
 @ MSG_AUD_SYMBIND	"la_symbind"
-
-@ MSG_REL_BADROFFSET	"<offset lies outside memory image; relocation discarded>"
--- a/usr/src/cmd/sgs/rtld/common/setup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/setup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -49,13 +48,13 @@
 #include	<dlfcn.h>
 #include	<sys/sysconfig.h>
 #include	<sys/auxv.h>
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"_a.out.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"conv.h"
 
 
 extern int	_end, _edata, _etext;
@@ -84,7 +83,7 @@
 	Word		lmflags = lml_main.lm_flags;
 	uint_t		flags;
 
-	DBG_CALL(Dbg_util_nl());
+	DBG_CALL(Dbg_util_nl(&lml_main, DBG_NL_STD));
 
 	if ((objs = strdup(str)) == 0)
 		return (0);
@@ -105,7 +104,7 @@
 		Pnode	*pnp;
 		Rt_map	*nlmp = 0;
 
-		DBG_CALL(Dbg_file_preload(ptr));
+		DBG_CALL(Dbg_file_preload(&lml_main, ptr));
 
 		/*
 		 * If this a secure application, then preload errors are
@@ -301,12 +300,16 @@
 	    AL_CNT_LMLISTS) == 0)
 		return (0);
 	lml_main.lm_flags |= LML_FLG_BASELM;
+	lml_main.lm_lmid = LM_ID_BASE;
+	lml_main.lm_lmidstr = (char *)MSG_ORIG(MSG_LMID_BASE);
 
 	if (alist_append(&lml_rtld.lm_lists, 0, sizeof (Lm_cntl),
 	    AL_CNT_LMLISTS) == 0)
 		return (0);
 	lml_rtld.lm_flags |= (LML_FLG_RTLDLM | LML_FLG_NOAUDIT |
 	    LML_FLG_HOLDLOCK);
+	lml_rtld.lm_lmid = LM_ID_LDSO;
+	lml_rtld.lm_lmidstr = (char *)MSG_ORIG(MSG_LMID_LDSO);
 
 	/*
 	 * Determine whether we have a secure executable.
@@ -379,7 +382,7 @@
 		 */
 		if (rtld_getopt(argv, &envp, &auxv, &(lml_main.lm_flags),
 		    &(lml_main.lm_tflags), (aoutdyn != 0)) == 1) {
-			eprintf(ERR_NONE, MSG_INTL(MSG_USG_BADOPT));
+			eprintf(&lml_main, ERR_NONE, MSG_INTL(MSG_USG_BADOPT));
 			return (0);
 		}
 		_environ = envp;
@@ -391,8 +394,8 @@
 
 		if ((fd = open(argvname, O_RDONLY)) == -1) {
 			int	err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), argvname,
-			    strerror(err));
+			eprintf(&lml_main, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			    argvname, strerror(err));
 			return (0);
 		}
 	}
@@ -410,8 +413,9 @@
 		 */
 		(void) fstat(fd, &status);
 		if ((ftp = are_u_this(&rej, fd, &status, argvname)) == 0) {
-			eprintf(ERR_FATAL, MSG_INTL(err_reject[rej.rej_type]),
-			    argvname, conv_reject_str(&rej));
+			eprintf(&lml_main, ERR_FATAL,
+			    MSG_INTL(err_reject[rej.rej_type]), argvname,
+			    conv_reject_desc(&rej));
 			return (0);
 		}
 
@@ -465,8 +469,9 @@
 
 			if (_brk_unlocked((void *)brkbase) == -1) {
 				int	err = errno;
-				eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_BRK),
-				    argvname, strerror(err));
+				eprintf(&lml_main, ERR_FATAL,
+				    MSG_INTL(MSG_SYS_BRK), argvname,
+				    strerror(err));
 			}
 		}
 
@@ -514,8 +519,8 @@
 			 */
 			lml_main.lm_tflags |= LML_TFLG_NODIRECT;
 #else
-			eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_REJ_UNKFILE),
-			    argvname);
+			eprintf(&lml_main, ERR_FATAL,
+			    MSG_INTL(MSG_ERR_REJ_UNKFILE), argvname);
 			return (0);
 #endif
 		} else if (phdr) {
@@ -694,13 +699,14 @@
 		ulong_t	mhwcap;
 
 		if ((mhwcap = (HWCAP(mlmp) & ~hwcap)) != 0) {
+			const char	*str = conv_cap_val_hw1(mhwcap, M_MACH);
+
 			if (lml_main.lm_flags & LML_FLG_TRC_ENABLE) {
 				(void) printf(MSG_INTL(MSG_LDD_GEN_HWCAP_1),
-				    NAME(mlmp),
-				    conv_hwcap_1_str(mhwcap, M_MACH));
+				    NAME(mlmp), str);
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_BADHWCAP_1),
-				    conv_hwcap_1_str(mhwcap, M_MACH));
+				eprintf(&lml_main, ERR_FATAL,
+				    MSG_INTL(MSG_GEN_BADHWCAP_1), str);
 				return (0);
 			}
 		}
@@ -803,34 +809,56 @@
 
 	/*
 	 * If debugging was requested initialize things now that any cache has
-	 * been established.
+	 * been established.  A user can specify LD_DEBUG=help to discover the
+	 * list of debugging tokens available without running the application.
+	 * However, don't allow this setting from a configuration file.
+	 *
+	 * Note, to prevent recursion issues caused by loading and binding the
+	 * debugging libraries themselves, a local debugging descriptor is
+	 * initialized.  Once the debugging setup has completed, this local
+	 * descriptor is copied to the global descriptor which effectively
+	 * enables diagnostic output.
 	 */
-	if (rpl_debug)
-		dbg_mask |= dbg_setup(rpl_debug);
-	if (prm_debug)
-		dbg_mask |= dbg_setup(prm_debug);
+	if (rpl_debug || prm_debug) {
+		Dbg_desc	_dbg_desc = {0, 0, 0};
+
+		if (rpl_debug) {
+			uintptr_t	ret;
+
+			if ((ret = dbg_setup(rpl_debug, &_dbg_desc)) == S_ERROR)
+				return (0);
+			if (ret == 0)
+				rtldexit(&lml_main, 0);
+		}
+		if (prm_debug)
+			(void) dbg_setup(prm_debug, &_dbg_desc);
+
+		*dbg_desc = _dbg_desc;
+	}
 
 	/*
 	 * Now that debugging is enabled generate any diagnostics from any
 	 * previous events.
 	 */
 	if (hwcap)
-		DBG_CALL(Dbg_cap_hw_1(hwcap, M_MACH));
+		DBG_CALL(Dbg_cap_val_hw1(&lml_main, hwcap, M_MACH));
 	if (features)
-		DBG_CALL(Dbg_file_config_dis(config->c_name, features));
+		DBG_CALL(Dbg_file_config_dis(&lml_main, config->c_name,
+		    features));
 
-	if (dbg_mask) {
-		DBG_CALL(Dbg_file_ldso(PATHNAME(rlmp), (ulong_t)DYN(rlmp),
-		    ADDR(rlmp), envp, auxv));
+	if (DBG_ENABLED) {
+		DBG_CALL(Dbg_file_ldso(rlmp, envp, auxv,
+		    LIST(rlmp)->lm_lmidstr, ALO_DATA));
 
 		if (FCT(mlmp) == &elf_fct) {
-			DBG_CALL(Dbg_file_elf(PATHNAME(mlmp),
+			DBG_CALL(Dbg_file_elf(&lml_main, PATHNAME(mlmp),
 			    (ulong_t)DYN(mlmp), ADDR(mlmp), MSIZE(mlmp),
-			    ENTRY(mlmp), get_linkmap_id(LIST(mlmp)), ALO_DATA));
+			    ENTRY(mlmp), LIST(mlmp)->lm_lmidstr, ALO_DATA));
 		} else {
-			DBG_CALL(Dbg_file_aout(PATHNAME(mlmp),
+			DBG_CALL(Dbg_file_aout(&lml_main, PATHNAME(mlmp),
 			    (ulong_t)AOUTDYN(mlmp), (ulong_t)ADDR(mlmp),
-			    (ulong_t)MSIZE(mlmp)));
+			    (ulong_t)MSIZE(mlmp), LIST(mlmp)->lm_lmidstr,
+			    ALO_DATA));
 		}
 	}
 
@@ -922,7 +950,7 @@
 	if ((rtld_flags & RT_FL_CONFGEN) == 0) {
 		Word	lmflags;
 
-		DBG_CALL(Dbg_file_nl());
+		DBG_CALL(Dbg_util_nl(&lml_main, DBG_NL_STD));
 
 		if (relocate_lmc(&lml_main, ALO_DATA, mlmp) == 0)
 			return (0);
@@ -996,7 +1024,7 @@
 
 	unused(&lml_main);
 
-	DBG_CALL(Dbg_util_call_main(NAME(mlmp)));
+	DBG_CALL(Dbg_util_call_main(mlmp));
 
 	leave(LIST(mlmp));
 
--- a/usr/src/cmd/sgs/rtld/common/sunwmove.c	Tue Mar 14 09:14:42 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * 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.
- *
- * 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 2004 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
- */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-/*
- * Object file dependent support for ELF objects.
- */
-#include	"_synonyms.h"
-
-#include	<stdio.h>
-#include	<sys/procfs.h>
-#include	<sys/mman.h>
-#include	<dlfcn.h>
-#include	"conv.h"
-#include	"_rtld.h"
-#include	"_audit.h"
-#include	"_elf.h"
-#include	"msg.h"
-#include	"debug.h"
-
-/*
- * Move data
- */
-void
-move_data(Rt_map * lmp)
-{
-	Move *		mv = MOVETAB(lmp);
-	Phdr *		pptr = SUNWBSS(lmp);
-	unsigned long	cnt1;
-	Half 		cnt2, stride;
-	Addr		taddr;
-
-	DBG_CALL(Dbg_move_data(NAME(lmp)));
-	for (cnt1 = 0; cnt1 < MOVESZ(lmp) / MOVEENT(lmp); cnt1++, mv++) {
-		Sym *	sym;
-
-		/*
-		 * If the target address needs to be mapped in,
-		 * map it first.
-		 *	(You have to protect the code, thread safe)
-		 */
-		if (FLAGS(lmp) & FLG_RT_SUNWBSS) {
-			long	zlen;
-			Off	foff;
-			caddr_t	zaddr, eaddr;
-
-			foff = (Off) (pptr->p_vaddr + ADDR(lmp));
-			zaddr = (caddr_t)M_PROUND(foff);
-			eaddr = pptr->p_vaddr + ADDR(lmp) +
-			    (caddr_t)pptr->p_memsz;
-			zero((caddr_t)foff, (long)(zaddr - foff));
-			zlen = eaddr - zaddr;
-			if (zlen > 0) {
-				if (dz_map(zaddr, zlen, PROT_READ | PROT_WRITE,
-				    MAP_FIXED | MAP_PRIVATE) == MAP_FAILED)
-					return;
-			}
-
-			FLAGS(lmp) &= ~FLG_RT_SUNWBSS;
-		}
-
-		if ((sym = (Sym *)SYMTAB(lmp) + ELF_M_SYM(mv->m_info)) == 0)
-			continue;
-
-		stride = mv->m_stride + 1;
-		taddr = sym->st_value;
-		if (FLAGS(lmp) & FLG_RT_FIXED)
-			taddr = taddr + mv->m_poffset;
-		else
-			taddr = taddr + mv->m_poffset + ADDR(lmp);
-
-		DBG_CALL(Dbg_move_mventry2(mv, sym->st_name,
-			(char *)(sym->st_name + STRTAB(lmp))));
-
-		for (cnt2 = 0; cnt2 < mv->m_repeat; cnt2++) {
-			DBG_CALL(Dbg_move_expanding(mv, taddr));
-			switch (ELF_M_SIZE(mv->m_info)) {
-			case 1:
-				*((char *)taddr) = (char)mv->m_value;
-				taddr += stride;
-				break;
-			case 2:
-				/* LINTED */
-				*((Half *)taddr) = (Half)mv->m_value;
-				taddr += 2 * stride;
-				break;
-			case 4:
-				/* LINTED */
-				*((Word *)taddr) = (Word)mv->m_value;
-				taddr += 4 * stride;
-				break;
-			case 8:
-				/* LINTED */
-				*((unsigned long long *)taddr) = mv->m_value;
-				taddr += 8 * stride;
-				break;
-			default:
-				eprintf(ERR_NONE, MSG_INTL(MSG_MOVE_ERR1));
-				break;
-			}
-		}
-	}
-}
--- a/usr/src/cmd/sgs/rtld/common/tls.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/tls.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -33,7 +33,6 @@
 #include <libc_int.h>
 #include <_rtld.h>
 #include <_elf.h>
-#include <conv.h>
 #include <msg.h>
 #include <debug.h>
 
@@ -187,7 +186,7 @@
 	tmi.tm_flags = 0;
 	tmi.tm_stattlsoffset = 0;
 
-	DBG_CALL(Dbg_tls_modactivity(&tmi, flag));
+	DBG_CALL(Dbg_tls_modactivity(LIST(lmp), &tmi, flag));
 	fptr(&tmi);
 
 	/*
@@ -222,17 +221,15 @@
 int
 tls_report_modules()
 {
-	Rt_map *	lmp;
-	uint_t		tlsmodcnt;
-	uint_t		tlsmodndx;
-	TLS_modinfo **	tlsmodlist;
-	TLS_modinfo *	tlsbuflist;
-	Phdr *		tlsphdr;
+	Rt_map		*lmp;
+	uint_t		tlsmodcnt, tlsmodndx;
+	TLS_modinfo	**tlsmodlist;
+	TLS_modinfo	*tlsbuflist;
+	Phdr		*tlsphdr;
 
 	tlsinitialized++;
 	/*
-	 * Scan through all objects to determine how many have TLS
-	 * storage.
+	 * Scan through all objects to determine how many have TLS storage.
 	 */
 	tlsmodcnt = 0;
 	for (lmp = lml_main.lm_head; lmp; lmp = (Rt_map *)NEXT(lmp)) {
@@ -245,11 +242,10 @@
 			continue;
 
 		/*
-		 * If a module has TLS - but the TLS interfaces
-		 * are not present (no libthread?). Then this is
-		 * a fatal condition.
+		 * If a module has TLS - but the TLS interfaces are not present
+		 * (no libthread?). Then this is a fatal condition.
 		 */
-		eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_TLS_NOTLS),
+		eprintf(&lml_main, ERR_FATAL, MSG_INTL(MSG_ERR_TLS_NOTLS),
 		    NAME(lmp));
 		return (0);
 	}
@@ -308,7 +304,8 @@
 		tlsmodndx++;
 	}
 
-	DBG_CALL(Dbg_tls_static_block((void *)tlsmodlist, tls_static_size));
+	DBG_CALL(Dbg_tls_static_block(&lml_main, (void *)tlsmodlist,
+	    tls_static_size));
 	fptr_tls_statmods(tlsmodlist, tls_static_size);
 
 	/*
--- a/usr/src/cmd/sgs/rtld/common/tsort.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/tsort.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -47,9 +47,9 @@
 #include	<locale.h>
 #include	<string.h>
 #include	<libintl.h>
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"msg.h"
-#include	"debug.h"
 
 /*
  * Structure for maintaining sorting state.
@@ -96,7 +96,8 @@
 	static int		cnt = 1;
 	int			ndx;
 	Rt_map			*lmp;
-	Word			lmflags = LIST(sort->s_lmp)->lm_flags;
+	Lm_list			*lml = LIST(sort->s_lmp);
+	Word			lmflags = lml->lm_flags;
 	Word			init, unref;
 
 	/*
@@ -158,7 +159,8 @@
 	 * be better traced (see trace_sort()), or analyzed for non-use.
 	 */
 	if (((init = (lmflags & LML_FLG_TRC_INIT)) == 0) &&
-	    ((unref = (lmflags & LML_FLG_TRC_UNREF)) == 0) && (dbg_mask == 0))
+	    ((unref = (lmflags & LML_FLG_TRC_UNREF)) == 0) &&
+	    (DBG_ENABLED == 0))
 		return (1);
 
 	if (init) {
@@ -168,7 +170,7 @@
 		}
 		(void) printf(tfmt, cnt);
 	}
-	DBG_CALL(Dbg_util_scc_title(flag & RT_SORT_REV));
+	DBG_CALL(Dbg_util_scc_title(lml, (flag & RT_SORT_REV)));
 
 	/*
 	 * Identify this cyclic group, and under ldd -i print the cycle in the
@@ -181,14 +183,14 @@
 
 			if (init)
 				(void) printf(ffmt, NAME(lmp));
-			DBG_CALL(Dbg_util_scc_entry(ndx, NAME(lmp)));
+			DBG_CALL(Dbg_util_scc_entry(lmp, ndx));
 		}
 		cnt++;
 
-	} else if (dbg_mask) {
+	} else if (DBG_ENABLED) {
 		for (ndx = sort->s_lndx - 1; ndx >= fndx; ndx--) {
 			lmp = sort->s_lmpa[ndx];
-			DBG_CALL(Dbg_util_scc_entry(ndx, NAME(lmp)));
+			DBG_CALL(Dbg_util_scc_entry(lmp, ndx));
 		}
 	}
 
@@ -196,7 +198,7 @@
 	 * If we're looking for unused dependencies determine if any of these
 	 * cyclic components are referenced from outside of the cycle.
 	 */
-	if (unref || dbg_mask) {
+	if (unref || DBG_ENABLED) {
 		Bnd_desc **	bdpp;
 
 		for (ndx = fndx; ndx < sort->s_lndx; ndx++) {
@@ -247,7 +249,7 @@
  * to sort_scc() to sort these elements.
  */
 static int
-visit(Lm_list *lml, Rt_map * lmp, Sort * sort, int flag)
+visit(Lm_list *lml, Rt_map * lmp, Sort *sort, int flag)
 {
 	Alist		*alpp = 0;
 	int		num = sort->s_lndx;
@@ -257,7 +259,7 @@
 	do {
 		tlmp = sort->s_stack[--(sort->s_sndx)];
 		SORTVAL(tlmp) = sort->s_num;
-		DBG_CALL(Dbg_util_collect(NAME(tlmp), sort->s_lndx, flag));
+		DBG_CALL(Dbg_util_collect(tlmp, sort->s_lndx, flag));
 		sort->s_lmpa[(sort->s_lndx)++] = tlmp;
 
 		if (flag & RT_SORT_REV) {
@@ -306,10 +308,10 @@
 }
 
 static int
-dep_visit(Rt_map *, uint_t, Rt_map *, Lm_list *, Sort *, int);
+dep_visit(Lm_list *, Rt_map *, uint_t, Rt_map *, Sort *, int);
 
 static int
-_dep_visit(int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Lm_list *lml,
+_dep_visit(Lm_list *lml, int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags,
     Sort *sort, int flag)
 {
 	int	_min;
@@ -369,7 +371,7 @@
 		/*
 		 * Inspect this new dependency.
 		 */
-		if ((_min = dep_visit(clmp, bflags, dlmp, lml,
+		if ((_min = dep_visit(lml, clmp, bflags, dlmp,
 		    sort, flag)) == -1)
 			return (-1);
 	}
@@ -381,8 +383,7 @@
 	 * along this dependency edge.
 	 */
 	if (_min < min) {
-		DBG_CALL(Dbg_util_edge_out(NAME(clmp), SORTVAL(clmp),
-		    NAME(sort->s_stack[_min])));
+		DBG_CALL(Dbg_util_edge_out(clmp, sort->s_stack[_min]));
 		return (_min);
 	} else
 		return (min);
@@ -392,7 +393,7 @@
  * Visit the dependencies of each object.
  */
 static int
-dep_visit(Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Lm_list *lml, Sort *sort,
+dep_visit(Lm_list *lml, Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Sort *sort,
     int flag)
 {
 	int 		min;
@@ -406,14 +407,14 @@
 	if (FLAGS(lmp) & FLG_RT_INITFRST)
 		sort->s_initfirst++;
 
-	DBG_CALL(Dbg_util_edge_in(clmp, cbflags, lmp, min, flag));
+	DBG_CALL(Dbg_util_edge_in(lml, clmp, cbflags, lmp, min, flag));
 
 	/*
 	 * Traverse both explicit and implicit dependencies.
 	 */
 	for (ALIST_TRAVERSE(DEPENDS(lmp), off, bdpp)) {
-		if ((min = _dep_visit(min, lmp, (*bdpp)->b_depend,
-		    (*bdpp)->b_flags, lml, sort, flag)) == -1)
+		if ((min = _dep_visit(lml, min, lmp, (*bdpp)->b_depend,
+		    (*bdpp)->b_flags, sort, flag)) == -1)
 			return (-1);
 	}
 
@@ -443,8 +444,8 @@
 
 					if (gdp->gd_depend == lmp)
 						continue;
-					if ((min = _dep_visit(min, lmp,
-					    gdp->gd_depend, BND_FILTER, lml,
+					if ((min = _dep_visit(lml, min, lmp,
+					    gdp->gd_depend, BND_FILTER,
 					    sort, flag)) == -1)
 						return (-1);
 				}
@@ -757,11 +758,11 @@
 	 * tsort() list if their .init has already been called.
 	 */
 	if (lml->lm_flags & LML_FLG_OBJREEVAL)
-		_lmp = LIST(lmp)->lm_head;
+		_lmp = lml->lm_head;
 	else
 		_lmp = lmp;
 
-	DBG_CALL(Dbg_file_bindings(_lmp, flag, lml->lm_flags));
+	DBG_CALL(Dbg_file_bindings(_lmp, flag));
 	lml->lm_flags &=
 	    ~(LML_FLG_OBJREEVAL | LML_FLG_OBJADDED | LML_FLG_OBJDELETED);
 
@@ -775,7 +776,7 @@
 			    FLG_RT_INITCLCT)) != FLG_RT_RELOCED)
 				continue;
 
-			if (dep_visit(0, 0, _lmp, lml, &sort, flag) == -1)
+			if (dep_visit(lml, 0, 0, _lmp, &sort, flag) == -1)
 				return ((Rt_map **)S_ERROR);
 
 		} else if (!(flag & RT_SORT_DELETE) ||
@@ -789,7 +790,7 @@
 			    (FLG_RT_INITCLCT)))
 				continue;
 
-			if (dep_visit(0, 0, _lmp, lml, &sort, flag) == -1)
+			if (dep_visit(lml, 0, 0, _lmp, &sort, flag) == -1)
 				return ((Rt_map **)S_ERROR);
 		}
 	}
@@ -864,6 +865,6 @@
 	 * The caller is responsible for freeing the sorted link-map list once
 	 * the associated .init/.fini's have been fired.
 	 */
-	DBG_CALL(Dbg_util_nl());
+	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 	return (sort.s_lmpa);
 }
--- a/usr/src/cmd/sgs/rtld/common/util.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/common/util.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -24,7 +23,7 @@
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -46,13 +45,12 @@
 #include	<dlfcn.h>
 #include	<unistd.h>
 #include	<stdlib.h>
-#include	<signal.h>
 #include	<sys/auxv.h>
+#include	<debug.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
-#include	"conv.h"
 #include	"msg.h"
-#include	"debug.h"
 
 static int ld_flags_env(const char *, Word *, Word *, uint_t, int);
 
@@ -71,10 +69,10 @@
  * Null function used as place where a debugger can set a breakpoint.
  */
 void
-rtld_db_dlactivity(void)
+rtld_db_dlactivity(Lm_list *lml)
 {
-	DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent,
-		r_debug.rtd_rdebug.r_state));
+	DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent,
+	    r_debug.rtd_rdebug.r_state));
 }
 
 /*
@@ -82,25 +80,23 @@
  * processing breakpoint.
  */
 void
-rtld_db_preinit(void)
+rtld_db_preinit(Lm_list *lml)
 {
-	DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent,
-		r_debug.rtd_rdebug.r_state));
+	DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent,
+	    r_debug.rtd_rdebug.r_state));
 }
 
-
 /*
  * Null function used as place where debugger can set a post .init
  * processing breakpoint.
  */
 void
-rtld_db_postinit(void)
+rtld_db_postinit(Lm_list *lml)
 {
-	DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent,
-		r_debug.rtd_rdebug.r_state));
+	DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent,
+	    r_debug.rtd_rdebug.r_state));
 }
 
-
 /*
  * Debugger Event Notification
  *
@@ -193,7 +189,7 @@
 	 */
 	r_debug.rtd_rdebug.r_state = state;
 	r_debug.rtd_rdebug.r_rdevent = event;
-	fptr();
+	fptr(lml);
 	r_debug.rtd_rdebug.r_rdevent = RD_NONE;
 }
 
@@ -513,7 +509,7 @@
 
 	if ((FLAGS(dlmp) & (FLG_RT_RELOCED | FLG_RT_INITCALL)) ==
 	    (FLG_RT_RELOCED | FLG_RT_INITCALL)) {
-		DBG_CALL(Dbg_util_no_init(NAME(dlmp)));
+		DBG_CALL(Dbg_util_no_init(dlmp));
 		return;
 	}
 
@@ -563,7 +559,7 @@
 	    ((tid = rt_thr_self()) != 0) && (THREADID(dlmp) != tid)) {
 		while ((FLAGS(dlmp) & FLG_RT_INITDONE) == 0) {
 			FLAGS1(dlmp) |= FL1_RT_INITWAIT;
-			DBG_CALL(Dbg_util_wait(what, NAME(clmp), NAME(dlmp)));
+			DBG_CALL(Dbg_util_wait(clmp, dlmp, what));
 			(void) rt_cond_wait(CONDVAR(dlmp), &rtldlock);
 		}
 	}
@@ -573,9 +569,9 @@
  * Execute .{preinit|init|fini}array sections
  */
 void
-call_array(Addr * array, uint_t arraysz, Rt_map * lmp, uint_t shtype)
+call_array(Addr *array, uint_t arraysz, Rt_map *lmp, Word shtype)
 {
-	int	start, stop, incr, i;
+	int	start, stop, incr, ndx;
 	uint_t	arraycnt = (uint_t)(arraysz / sizeof (Addr));
 
 	if (array == NULL)
@@ -597,13 +593,11 @@
 	/*
 	 * Call the .*array[] entries
 	 */
-	for (i = start; i != stop; i += incr) {
-		void (*	fptr)();
-
-		DBG_CALL(Dbg_util_call_array(NAME(lmp), (void *)array[i], i,
-		    shtype));
-
-		fptr = (void(*)())array[i];
+	for (ndx = start; ndx != stop; ndx += incr) {
+		void (*	fptr)() = (void(*)())array[ndx];
+
+		DBG_CALL(Dbg_util_call_array(lmp, (void *)fptr, ndx, shtype));
+
 		leave(LIST(lmp));
 		(*fptr)();
 		(void) enter();
@@ -685,7 +679,7 @@
 					continue;
 				is_dep_ready(bdp->b_depend, lmp, DBG_WAIT_INIT);
 			}
-			DBG_CALL(Dbg_util_call_init(NAME(lmp), flag));
+			DBG_CALL(Dbg_util_call_init(lmp, flag));
 		}
 
 		if (iptr) {
@@ -698,7 +692,7 @@
 		    SHT_INIT_ARRAY);
 
 		if (INITARRAY(lmp) || iptr)
-			DBG_CALL(Dbg_util_call_init(NAME(lmp), DBG_INIT_DONE));
+			DBG_CALL(Dbg_util_call_init(lmp, DBG_INIT_DONE));
 
 		/*
 		 * Set the initdone flag regardless of whether this object
@@ -714,7 +708,7 @@
 		 * Wake anyone up who might be waiting on this .init.
 		 */
 		if (FLAGS1(lmp) & FL1_RT_INITWAIT) {
-			DBG_CALL(Dbg_util_broadcast(NAME(lmp)));
+			DBG_CALL(Dbg_util_broadcast(lmp));
 			(void) rt_cond_broadcast(CONDVAR(lmp));
 			FLAGS1(lmp) &= ~FL1_RT_INITWAIT;
 		}
@@ -778,11 +772,11 @@
 				 * calling any .fini.
 				 */
 				is_dep_ready(lmp, lmp, DBG_WAIT_FINI);
-				DBG_CALL(Dbg_util_call_fini(NAME(lmp)));
+				DBG_CALL(Dbg_util_call_fini(lmp));
 			}
 
-			call_array(FINIARRAY(lmp), FINIARRAYSZ(lmp),
-				lmp, SHT_FINI_ARRAY);
+			call_array(FINIARRAY(lmp), FINIARRAYSZ(lmp), lmp,
+			    SHT_FINI_ARRAY);
 
 			if (fptr) {
 				leave(LIST(lmp));
@@ -828,8 +822,8 @@
 			}
 		}
 	}
-	DBG_CALL(Dbg_bind_plt_summary(M_MACH, pltcnt21d, pltcnt24d,
-		pltcntu32, pltcntu44, pltcntfull, pltcntfar));
+	DBG_CALL(Dbg_bind_plt_summary(lml, M_MACH, pltcnt21d, pltcnt24d,
+	    pltcntu32, pltcntu44, pltcntfull, pltcntfar));
 
 	free(tobj);
 }
@@ -912,8 +906,6 @@
 	lml->lm_flags |= LML_FLG_ATEXIT;
 	lmp = (Rt_map *)lml->lm_head;
 
-	dbg_mask = 0;
-
 	if (((tobj = tsort(lmp, lml->lm_obj, RT_SORT_FWD)) != 0) &&
 	    (tobj != (Rt_map **)S_ERROR))
 		call_fini(lml, tobj);
@@ -2694,9 +2686,9 @@
 
 static char	errbuf[ERRSIZE], *nextptr = errbuf, *prevptr = 0;
 
-/*PRINTFLIKE2*/
+/*PRINTFLIKE3*/
 void
-eprintf(Error error, const char *format, ...)
+eprintf(Lm_list *lml, Error error, const char *format, ...)
 {
 	va_list		args;
 	int		overflow = 0;
@@ -2805,7 +2797,7 @@
 		(void) dowrite(&prf);
 	}
 
-	DBG_CALL(Dbg_util_str(nextptr));
+	DBG_CALL(Dbg_util_str(lml, nextptr));
 	va_end(args);
 
 	/*
@@ -2828,7 +2820,7 @@
 				    MSG_STR_NL_SIZE);
 			}
 		}
-		DBG_CALL(Dbg_util_str(str));
+		DBG_CALL(Dbg_util_str(lml, str));
 
 		lock = 0;
 		nextptr = errbuf + ERRSIZE;
@@ -2944,7 +2936,7 @@
  *	 on the current OS.
  */
 Am_ret
-anon_map(caddr_t *addr, size_t len, int prot, int flags)
+anon_map(Lm_list *lml, caddr_t *addr, size_t len, int prot, int flags)
 {
 #if defined(MAP_ANON)
 	static int	noanon = 0;
@@ -2959,7 +2951,7 @@
 
 		if ((errno != EBADF) && (errno != EINVAL)) {
 			int	err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON),
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON),
 			    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 			return (AM_ERROR);
 		} else
@@ -2976,13 +2968,13 @@
  * behavior for older systems.)
  */
 caddr_t
-dz_map(caddr_t addr, size_t len, int prot, int flags)
+dz_map(Lm_list *lml, caddr_t addr, size_t len, int prot, int flags)
 {
 	caddr_t	va;
 	int	err;
 	Am_ret	amret;
 
-	amret = anon_map(&addr, len, prot, flags);
+	amret = anon_map(lml, &addr, len, prot, flags);
 
 	if (amret == AM_OK)
 		return (addr);
@@ -2995,7 +2987,7 @@
 		if ((dz_fd = open(MSG_ORIG(MSG_PTH_DEVZERO),
 		    O_RDONLY)) == FD_UNAVAIL) {
 			err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
 			    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 			return (MAP_FAILED);
 		}
@@ -3003,7 +2995,7 @@
 
 	if ((va = mmap(addr, len, prot, flags, dz_fd, 0)) == MAP_FAILED) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
 		    MSG_ORIG(MSG_PTH_DEVZERO), strerror(err));
 	}
 	return (va);
@@ -3012,7 +3004,7 @@
 static int	pr_fd = FD_UNAVAIL;
 
 int
-pr_open()
+pr_open(Lm_list *lml)
 {
 	char	proc[16];
 
@@ -3022,7 +3014,7 @@
 		if ((pr_fd = open(proc, O_RDONLY)) == FD_UNAVAIL) {
 			int	err = errno;
 
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc,
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc,
 			    strerror(err));
 		}
 	}
@@ -3032,7 +3024,7 @@
 static int	nu_fd = FD_UNAVAIL;
 
 caddr_t
-nu_map(caddr_t addr, size_t len, int prot, int flags)
+nu_map(Lm_list *lml, caddr_t addr, size_t len, int prot, int flags)
 {
 	caddr_t	va;
 	int	err;
@@ -3041,7 +3033,7 @@
 		if ((nu_fd = open(MSG_ORIG(MSG_PTH_DEVNULL),
 		    O_RDONLY)) == FD_UNAVAIL) {
 			err = errno;
-			eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN),
 			    MSG_ORIG(MSG_PTH_DEVNULL), strerror(err));
 			return (MAP_FAILED);
 		}
@@ -3050,7 +3042,7 @@
 	if ((va = (caddr_t)mmap(addr, len, prot, flags, nu_fd, 0)) ==
 	    MAP_FAILED) {
 		err = errno;
-		eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP),
 		    MSG_ORIG(MSG_PTH_DEVNULL), strerror(err));
 	}
 	return (va);
@@ -3092,7 +3084,7 @@
 	 */
 	tracing = lml->lm_flags & (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED);
 
-	if ((tracing == 0) && (dbg_mask == 0))
+	if ((tracing == 0) && (DBG_ENABLED == 0))
 		return;
 
 	/*
@@ -3107,7 +3099,7 @@
 		 * determine whether any of this objects callers haven't
 		 * referenced it.
 		 */
-		if ((tracing & LML_FLG_TRC_UNREF) || dbg_mask) {
+		if ((tracing & LML_FLG_TRC_UNREF) || DBG_ENABLED) {
 			Bnd_desc **	bdpp;
 			Aliste		off;
 
@@ -3126,15 +3118,15 @@
 					if (tracing & LML_FLG_TRC_UNREF)
 					    (void) printf(MSG_ORIG(MSG_STR_NL));
 					else
-					    DBG_CALL(Dbg_util_nl());
+					    DBG_CALL(Dbg_util_nl(lml,
+						DBG_NL_STD));
 				}
 
 				if (tracing & LML_FLG_TRC_UNREF)
 				    (void) printf(MSG_INTL(MSG_LDD_UNREF_FMT),
 					NAME(lmp), NAME(clmp));
 				else
-				    DBG_CALL(Dbg_unused_unref(NAME(lmp),
-					NAME(clmp)));
+				    DBG_CALL(Dbg_unused_unref(lmp, NAME(clmp)));
 			}
 		}
 
@@ -3149,26 +3141,25 @@
 			if (tracing)
 				(void) printf(MSG_ORIG(MSG_STR_NL));
 			else
-				DBG_CALL(Dbg_util_nl());
+				DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 		}
 		if (CYCGROUP(lmp)) {
 			if (tracing)
 				(void) printf(MSG_INTL(MSG_LDD_UNCYC_FMT),
 				    NAME(lmp), CYCGROUP(lmp));
 			else
-				DBG_CALL(Dbg_unused_file(NAME(lmp), 0,
+				DBG_CALL(Dbg_unused_file(lml, NAME(lmp), 0,
 				    CYCGROUP(lmp)));
 		} else {
 			if (tracing)
 				(void) printf(MSG_INTL(MSG_LDD_UNUSED_FMT),
 				    NAME(lmp));
 			else
-				DBG_CALL(Dbg_unused_file(NAME(lmp), 0, 0));
+				DBG_CALL(Dbg_unused_file(lml, NAME(lmp), 0, 0));
 		}
 	}
 
-	if (dbg_mask)
-		DBG_CALL(Dbg_util_nl());
+	DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD));
 }
 
 /*
@@ -3452,7 +3443,7 @@
 demangle(const char *name)
 {
 	if (rtld_flags & RT_FL_DEMANGLE)
-		return (conv_sym_dem(name));
+		return (conv_demangle_name(name));
 	else
 		return (name);
 }
--- a/usr/src/cmd/sgs/rtld/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,16 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
 
+BASEPLAT =	i386
+
 # Object lists are organized into primary (most frequently used code) and
 # secondary lists (less frequently used code, ie. profiling support).
 
@@ -33,7 +35,7 @@
 		analyze.o	elf.o		globals.o	malloc.o \
 		mutex.o		paths.o		setup.o		util.o \
 		dlfcns.o	config_elf.o	locale.o	tsort.o \
-		getcwd.o	remove.o	sunwmove.o	tls.o \
+		getcwd.o	remove.o	move.o		tls.o \
 		cap.o
 
 S_COMOBJS=	debug.o		audit.o		object.o
@@ -55,8 +57,6 @@
 CRTN=		pics/crtn.o
 CRTS=		$(CRTI)		$(CRTN)
 
-BASEPLAT=	i386
-
 # __GNUC is overridden in the environment when building with gcc
 __GNUC:sh=		echo \\043
 
@@ -68,7 +68,6 @@
 
 # Add any machine specific flags.
 
-CPPFLAGS +=	-I../../../../uts/$(PLAT)/krtld
 ADBGENCFLAGS +=	-erroff=%all
 ADBGENFLAGS +=	-milp32
 ADBSUB=		$(ADBSUB32)
@@ -76,6 +75,8 @@
 
 SGSMSGTARG +=	$(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSG32)
 
+MAPFILES +=	../common/mapfile-32-vers
+
 .KEEP_STATE:
 
 all:		$(RTLD)
@@ -88,8 +89,4 @@
 
 adbinstall:	adbmacros .WAIT $(ROOTADB)
 
-pics/%.o:       $(SRCBASE)/uts/$(PLAT)/krtld/%.c
-		$(COMPILE.c) -o $@ $<  $(WARNFLAGS)
-		$(POST_PROCESS_O)
-
 include		$(SRC)/cmd/sgs/rtld/Makefile.targ
--- a/usr/src/cmd/sgs/rtld/i386/_setup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/i386/_setup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,15 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ *	Copyright (c) 1988 AT&T
+ *	  All Rights Reserved
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-/*	Copyright (c) 1988 AT&T	*/
-/*	All Rights Reserved	*/
-
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
@@ -48,10 +48,10 @@
 #include	<sys/stat.h>
 #include	<link.h>
 #include	<dlfcn.h>
+#include	<debug.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"msg.h"
-#include	"debug.h"
 
 extern int	_end;
 extern int	_etext;
--- a/usr/src/cmd/sgs/rtld/i386/i386_elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/i386/i386_elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -42,13 +41,13 @@
 #include	<dlfcn.h>
 #include	<synch.h>
 #include	<string.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"reloc.h"
-#include	"conv.h"
 
 
 extern void	elf_rtbndr(Rt_map *, ulong_t, caddr_t);
@@ -117,7 +116,7 @@
 	 * library that is interested in this binding.
 	 */
 	dyn_plt = (uchar_t *)((uintptr_t)AUDINFO(rlmp)->ai_dynplts +
-		(pltndx * dyn_plt_ent_size));
+	    (pltndx * dyn_plt_ent_size));
 
 	/*
 	 * Have we initialized this dynamic plt entry yet?  If we haven't do it
@@ -126,8 +125,9 @@
 	 * we just set the plt to point to the new dyn_plt.
 	 */
 	if (*dyn_plt == 0) {
-		Sym *	symp;
+		Sym	*symp;
 		Word	symvalue;
+		Lm_list	*lml = LIST(rlmp);
 
 		(void) memcpy((void *)dyn_plt, dyn_plt_template,
 		    sizeof (dyn_plt_template));
@@ -141,7 +141,7 @@
 		symvalue = (Word)dyndata;
 		if (do_reloc(R_386_32, &dyn_plt[4], &symvalue,
 		    MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -156,7 +156,7 @@
 		symvalue = (ulong_t)(elf_plt_trace) - (ulong_t)(dyn_plt + 9);
 		if (do_reloc(R_386_PC32, &dyn_plt[9], &symvalue,
 		    MSG_ORIG(MSG_SYM_ELFPLTTRACE),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -194,14 +194,15 @@
 ulong_t
 elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from)
 {
-	Rt_map		*nlmp, * llmp;
+	Rt_map		*nlmp, *llmp;
 	ulong_t		addr, symval, rsymndx;
 	char		*name;
 	Rel		*rptr;
 	Sym		*sym, *nsym;
-	uint_t		binfo, sb_flags = 0;
+	uint_t		binfo, sb_flags = 0, dbg_class;
 	Slookup		sl;
-	int		entry, dbg_save, lmflags;
+	int		entry, lmflags;
+	Lm_list		*lml;
 
 	/*
 	 * For compatibility with libthread (TI_VERSION 1) we track the entry
@@ -211,9 +212,10 @@
 	 */
 	entry = enter();
 
-	if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
+	lml = LIST(lmp);
+	if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
+		dbg_class = dbg_desc->d_class;
+		dbg_desc->d_class = 0;
 	}
 
 	/*
@@ -222,10 +224,10 @@
 	 * over the .got entries or jumped to plt0 out of the blue.
 	 */
 	if (!lmp || ((reloff % sizeof (Rel)) != 0)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
-		    conv_reloc_386_type_str(R_386_JMP_SLOT),
-		    EC_ADDR(lmp), EC_XWORD(reloff), EC_ADDR(from));
-		rtldexit(LIST(lmp), 1);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
+		    conv_reloc_386_type(R_386_JMP_SLOT),
+		    EC_NATPTR(lmp), EC_XWORD(reloff), EC_NATPTR(from));
+		rtldexit(lml, 1);
 	}
 
 	/*
@@ -241,22 +243,22 @@
 	 * Determine the last link-map of this list, this'll be the starting
 	 * point for any tsort() processing.
 	 */
-	llmp = LIST(lmp)->lm_tail;
+	llmp = lml->lm_tail;
 
 	/*
 	 * Find definition for symbol.
 	 */
 	sl.sl_name = name;
 	sl.sl_cmap = lmp;
-	sl.sl_imap = LIST(lmp)->lm_head;
+	sl.sl_imap = lml->lm_head;
 	sl.sl_hash = 0;
 	sl.sl_rsymndx = rsymndx;
 	sl.sl_flags = LKUP_DEFT;
 
 	if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 		    demangle(name));
-		rtldexit(LIST(lmp), 1);
+		rtldexit(lml, 1);
 	}
 
 	symval = nsym->st_value;
@@ -268,10 +270,10 @@
 		 * Record that this new link map is now bound to the caller.
 		 */
 		if (bind_one(lmp, nlmp, BND_REFER) == 0)
-			rtldexit(LIST(lmp), 1);
+			rtldexit(lml, 1);
 	}
 
-	if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
+	if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
 		uint_t	symndx = (((uintptr_t)nsym -
 			(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
 		symval = audit_symbind(lmp, nlmp, nsym, symndx, symval,
@@ -282,7 +284,7 @@
 		addr = rptr->r_offset;
 		if (!(FLAGS(lmp) & FLG_RT_FIXED))
 			addr += ADDR(lmp);
-		if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) &
+		if (((lml->lm_tflags | FLAGS1(lmp)) &
 		    (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) &&
 		    AUDINFO(lmp)->ai_dynplts) {
 			int	fail = 0;
@@ -295,7 +297,7 @@
 			    nsym, symndx, pltndx, (caddr_t)symval, sb_flags,
 			    &fail);
 			if (fail)
-				rtldexit(LIST(lmp), 1);
+				rtldexit(lml, 1);
 		} else {
 			/*
 			 * Write standard PLT entry to jump directly
@@ -308,9 +310,9 @@
 	/*
 	 * Print binding information and rebuild PLT entry.
 	 */
-	DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp),
-	    (Xword)(reloff / sizeof (Rel)), PLT_T_FULL, NAME(nlmp),
-	    (caddr_t)symval, (caddr_t)nsym->st_value, name, binfo));
+	DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)),
+	    (Xword)(reloff / sizeof (Rel)), PLT_T_FULL, nlmp, (Addr)symval,
+	    nsym->st_value, name, binfo));
 
 	/*
 	 * Complete any processing for newly loaded objects.  Note we don't
@@ -342,11 +344,11 @@
 	 */
 	if (entry) {
 		is_dep_init(nlmp, lmp);
-		leave(LIST(lmp));
+		leave(lml);
 	}
 
 	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+		dbg_desc->d_class = dbg_class;
 
 	return (symval);
 }
@@ -535,10 +537,10 @@
 		}
 	}
 	if (!relbgn || (relbgn == relend)) {
-		DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE));
+		DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE));
 		return (1);
 	}
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START));
+	DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START));
 
 	/*
 	 * If we're processing a dynamic executable in lazy mode there is no
@@ -565,7 +567,7 @@
 		 * jump if we've been given a hint on the number of relocations.
 		 */
 		if ((rtype == R_386_RELATIVE) &&
-		    !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) {
+		    ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) {
 			/*
 			 * It's possible that the relative relocation block
 			 * has relocations against the text segment as well
@@ -696,9 +698,8 @@
 				    (rtype != R_386_COPY)) {
 					/* LINTED */
 					if (psymdef == 0) {
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					}
@@ -763,11 +764,13 @@
 					 * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND)
 					 */
 					if (symdef == 0) {
+					    Lm_list	*lml = LIST(lmp);
+
 					    if (bind != STB_WEAK) {
-						if (LIST(lmp)->lm_flags &
+						if (lml->lm_flags &
 						    LML_FLG_IGNRELERR) {
 						    continue;
-						} else if (LIST(lmp)->lm_flags &
+						} else if (lml->lm_flags &
 						    LML_FLG_TRC_WARN) {
 						    (void) printf(MSG_INTL(
 							MSG_LDD_SYM_NFOUND),
@@ -775,7 +778,7 @@
 							NAME(lmp));
 						    continue;
 						} else {
-						    eprintf(ERR_FATAL,
+						    eprintf(lml, ERR_FATAL,
 							MSG_INTL(MSG_REL_NOSYM),
 							NAME(lmp),
 							demangle(name));
@@ -786,9 +789,8 @@
 						psymndx = rsymndx;
 						psymdef = 0;
 
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					    }
@@ -892,7 +894,8 @@
 		/*
 		 * Call relocation routine to perform required relocation.
 		 */
-		DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL));
+		DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH,
+		    M_REL_SHT_TYPE, rel, NULL, name));
 
 		switch (rtype) {
 		case R_386_COPY:
@@ -921,7 +924,8 @@
 				 * Write standard PLT entry to jump directly
 				 * to newly bound function.
 				 */
-				DBG_CALL(Dbg_reloc_apply((Xword)roffset,
+				DBG_CALL(Dbg_reloc_apply_val(LIST(lmp),
+				    ELF_DBG_RTLD, (Xword)roffset,
 				    (Xword)value));
 				*(ulong_t *)roffset = value;
 			}
@@ -930,12 +934,12 @@
 			/*
 			 * Write the relocation out.
 			 */
-			if (do_reloc(rtype, (uchar_t *)roffset,
-			    (Word *)&value, name, NAME(lmp)) == 0)
+			if (do_reloc(rtype, (uchar_t *)roffset, (Word *)&value,
+			    name, NAME(lmp), LIST(lmp)) == 0)
 				ret = 0;
 
-			DBG_CALL(Dbg_reloc_apply((Xword)roffset,
-			    (Xword)value));
+			DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD,
+			    (Xword)roffset, (Xword)value));
 		}
 
 		if ((ret == 0) &&
@@ -943,10 +947,9 @@
 			break;
 
 		if (binfo) {
-			DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset,
-			    (caddr_t)(roffset - basebgn), (Xword)(-1),
-			    PLT_T_FULL, NAME(_lmp), (caddr_t)value,
-			    (caddr_t)symdef->st_value, name, binfo));
+			DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset,
+			    (Off)(roffset - basebgn), (Xword)(-1), PLT_T_FULL,
+			    _lmp, (Addr)value, symdef->st_value, name, binfo));
 		}
 	}
 
@@ -1030,7 +1033,8 @@
 	 */
 	rel.r_offset = (Addr)ref;
 	rel.r_info = (Word)R_386_COPY;
-	DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, &rel, name, 0));
+	DBG_CALL(Dbg_reloc_in(LIST(rlmp), ELF_DBG_RTLD, M_MACH, M_REL_SHT_TYPE,
+	    &rel, NULL, name));
 
 	return (elf_copy_reloc((char *)name, symref, rlmp, (void *)ref, symdef,
 	    _lmp, (void *)def));
@@ -1043,7 +1047,7 @@
 	    r_debug.rtd_rdebug.r_ldbase) &&
 	    !(strcmp(interp->i_name, MSG_ORIG(MSG_PTH_LIBC)))) {
 
-		DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, 0,
+		DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, 0,
 		    DBG_REL_START));
 
 		if (_elf_copy_reloc(MSG_ORIG(MSG_SYM_CTYPE), lmp,
@@ -1080,7 +1084,7 @@
  * ld.so.1.
  */
 const char *
-_conv_reloc_type_str(uint_t rel)
+_conv_reloc_type(uint_t rel)
 {
-	return (conv_reloc_386_type_str(rel));
+	return (conv_reloc_386_type(rel));
 }
--- a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -29,18 +29,14 @@
 LIBRARY=	rtld.a
 VERS=		.1
 
-
 COMOBJS=	rtld.o
 BLTOBJ=		msg.o
 
 OBJECTS= 	$(BLTOBJ)  $(COMOBJS)
 
-
 # include library definitions
 include 	$(SRC)/lib/Makefile.lib
-include		../../../Makefile.com
-
-SRCBASE=	../../../../..
+include		$(SRC)/cmd/sgs/Makefile.com
 
 SGSMSGALL=	rtld.msg
 
@@ -70,17 +66,14 @@
 
 # definitions for lint
 
-CFLAGS +=	
-CFLAGS64 +=
 CPPFLAGS +=	-I. -I../common -I../../common -I../../../include \
 		-I../../../include/$(MACH) \
-		-I$(SRCBASE)/lib/libc/inc \
-		-I$(SRCBASE)/uts/common/krtld \
-		-I$(SRCBASE)/uts/$(ARCH)/sys
+		-I$(SRC)/lib/libc/inc \
+		-I$(SRC)/uts/common/krtld \
+		-I$(SRC)/uts/$(ARCH)/sys
 
-CPPFLAGS64 +=
 DYNFLAGS +=	$(VERSREF) -M $(MAPFILE)
-LDLIBS +=	$(CONVLIBDIR) -lconv -lc
+LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
 
 ROOTMDBLIB=	$(ROOT)/usr/lib/mdb/proc
 ROOTMDBLIB64=	$(ROOTMDBLIB)/$(MACH64)
--- a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,13 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright 2001,2002 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
 
 $(DYNLIB):      $(MAPFILE)
 
@@ -40,8 +40,6 @@
 chkmsg:		$(LINTSRCS)
 		sh $(CHKMSG) $(CHKMSGFLAGS) $(LINTSRCS)
 
-lint:		$(LINTOUT32) $(SGSLINTOUT)
-		
 $(BLTDEFS) + \
 $(BLTDATA) + \
 $(BLTMESG):	$(SGSMSGALL)
--- a/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,27 +18,27 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include ../Makefile.com
+include		../Makefile.com
 
-CONVLIBDIR=	$(CONVLIBDIR64)
-MTARG=		amd64/
-CPPFLAGS += -D_ELF64
+CONVLIBDIR =	$(CONVLIBDIR64)
+MTARG =		amd64/
+CPPFLAGS +=	-D_ELF64
 
 .KEEP_STATE:
 
-all: $(BLTDEFS) .WAIT $(DYNLIB)
-install: all .WAIT $(ROOTMDBLIBS)
+all:		$(BLTDEFS) .WAIT $(DYNLIB)
 
+install:	all .WAIT $(ROOTMDBLIBS)
 
-include ../Makefile.targ
-include ../../../../../Makefile.master.64
+lint:		$(LINTOUT64) $(SGSLINTOUT)
 
+include		../Makefile.targ
+include		../../../Makefile.sub.64
--- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1122,8 +1122,8 @@
 	 * Determine the handles owner.  Note that an orphaned handle may no
 	 * longer contain its originating owner.
 	 */
-	if (gh.gh_owner) {
-		if ((str = Rtmap_Name((uintptr_t)gh.gh_owner)) == 0)
+	if (gh.gh_ownlmp) {
+		if ((str = Rtmap_Name((uintptr_t)gh.gh_ownlmp)) == 0)
 			return (DCMD_ERR);
 	} else
 		str = (char *)MSG_ORIG(MSG_STR_ORPHANED);
@@ -1399,7 +1399,7 @@
 	}
 
 	mdb_printf(MSG_ORIG(MSG_ELFDYN_TITLE), addr);
-	dynstr = conv_dyntag_str(dyn.d_tag, M_MACH);
+	dynstr = conv_dyn_tag(dyn.d_tag, M_MACH);
 	mdb_printf(MSG_ORIG(MSG_ELFDYN_LINE1), addr, dynstr, dyn.d_un.d_ptr);
 
 	mdb_set_dot(addr + sizeof (Dyn));
@@ -1437,19 +1437,19 @@
 	    (byte[EI_MAG2] ? byte[EI_MAG2] : '0'),
 	    (byte[EI_MAG3] ? byte[EI_MAG3] : '0'));
 	mdb_printf(MSG_ORIG(MSG_EHDR_LINE2),
-	    conv_eclass_str(ehdr.e_ident[EI_CLASS]),
-	    conv_edata_str(ehdr.e_ident[EI_DATA]));
+	    conv_ehdr_class(ehdr.e_ident[EI_CLASS]),
+	    conv_ehdr_data(ehdr.e_ident[EI_DATA]));
 
 	mdb_printf(MSG_ORIG(MSG_EHDR_LINE3),
-	    conv_emach_str(ehdr.e_machine), conv_ever_str(ehdr.e_version));
-	mdb_printf(MSG_ORIG(MSG_EHDR_LINE4), conv_etype_str(ehdr.e_type));
+	    conv_ehdr_mach(ehdr.e_machine), conv_ehdr_vers(ehdr.e_version));
+	mdb_printf(MSG_ORIG(MSG_EHDR_LINE4), conv_ehdr_type(ehdr.e_type));
 
 	/*
 	 * Line up the flags differently depending on wether we
 	 * received a numeric (e.g. "0x200") or text represent-
 	 * ation (e.g. "[ EF_SPARC_SUN_US1 ]").
 	 */
-	flgs = conv_eflags_str(ehdr.e_machine, ehdr.e_flags);
+	flgs = conv_ehdr_flags(ehdr.e_machine, ehdr.e_flags);
 	if (flgs[0] == '[')
 		mdb_printf(MSG_ORIG(MSG_EHDR_LINE5), flgs);
 	else
@@ -1490,13 +1490,11 @@
 
 	mdb_printf(MSG_ORIG(MSG_EPHDR_TITLE), addr);
 	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE1), phdr.p_vaddr,
-	    conv_phdrflg_str(phdr.p_flags));
+	    conv_phdr_flags(phdr.p_flags));
 	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE2), phdr.p_paddr,
-	    conv_phdrtyp_str(M_MACH, phdr.p_type));
-	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE3), phdr.p_filesz,
-	    phdr.p_memsz);
-	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE4), phdr.p_offset,
-	    phdr.p_align);
+	    conv_phdr_type(M_MACH, phdr.p_type));
+	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE3), phdr.p_filesz, phdr.p_memsz);
+	mdb_printf(MSG_ORIG(MSG_EPHDR_LINE4), phdr.p_offset, phdr.p_align);
 
 	mdb_set_dot(addr + sizeof (Phdr));
 
--- a/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,24 +18,24 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 2001 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-#
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include ../Makefile.com
+include		../Makefile.com
 
-CONVLIB=	-L../../../libconv/i386
-MTARG=
+MTARG =
 
 .KEEP_STATE:
 
-all: $(BLTDEFS) .WAIT $(DYNLIB)
-install: all .WAIT $(ROOTMDBLIBS)
+all:		$(BLTDEFS) .WAIT $(DYNLIB)
+
+install:	all .WAIT $(ROOTMDBLIBS)
 
-include ../Makefile.targ
+lint:		$(LINTOUT32) $(SGSLINTOUT)
 
+include		../Makefile.targ
--- a/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,23 +18,24 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
-# Copyright (c) 2001 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-#
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include ../Makefile.com
+include		../Makefile.com
 
-MTARG=
+MTARG =
 
 .KEEP_STATE:
 
-all: $(BLTDEFS) .WAIT $(DYNLIB)
-install: all .WAIT $(ROOTMDBLIBS)
+all:		$(BLTDEFS) .WAIT $(DYNLIB)
+
+install:	all .WAIT $(ROOTMDBLIBS)
 
-include ../Makefile.targ
+lint:		$(LINTOUT32) $(SGSLINTOUT)
 
+include		../Makefile.targ
--- a/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,27 +18,27 @@
 #
 # CDDL HEADER END
 #
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#
+# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
-include ../Makefile.com
+include		../Makefile.com
 
-CONVLIBDIR=	$(CONVLIBDIR64)
-MTARG=		sparcv9/
-CPPFLAGS += -D_ELF64
+CONVLIBDIR =	$(CONVLIBDIR64)
+MTARG =		sparcv9/
+CPPFLAGS +=	-D_ELF64
 
 .KEEP_STATE:
 
-all: $(BLTDEFS) .WAIT $(DYNLIB)
-install: all .WAIT $(ROOTMDBLIBS)
+all:		$(BLTDEFS) .WAIT $(DYNLIB)
 
+install:	all .WAIT $(ROOTMDBLIBS)
 
-include ../Makefile.targ
-include ../../../../../Makefile.master.64
+lint:		$(LINTOUT64) $(SGSLINTOUT)
 
+include		../Makefile.targ
+include		../../../Makefile.sub.64
--- a/usr/src/cmd/sgs/rtld/sparc/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparc/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,7 +33,7 @@
 		analyze.o	elf.o		globals.o	malloc.o \
 		mutex.o		paths.o		setup.o		util.o \
 		dlfcns.o	config_elf.o	locale.o	tsort.o \
-		getcwd.o	remove.o	sunwmove.o	tls.o \
+		getcwd.o	remove.o	move.o		tls.o \
 		cap.o
 
 S_COMOBJS=	debug.o		audit.o		object.o	cache_a.out.o \
@@ -58,7 +58,7 @@
 
 CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h
 
-BASEPLAT=	sparc
+BASEPLAT =	sparc
 
 # __GNUC is overridden in the environment when building with gcc
 __GNUC:sh=		echo \\043
@@ -80,6 +80,8 @@
 ADBSUB=		$(ADBSUB32)
 SONAME=		$(VAR_RTLD_SONAME)
 
+MAPFILES +=	../common/mapfile-32-vers
+
 SGSMSGTARG +=	$(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSG32)
 
 .KEEP_STATE:
--- a/usr/src/cmd/sgs/rtld/sparc/_setup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparc/_setup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -56,7 +55,6 @@
 #ifdef A_OUT
 #include	"_a.out.h"
 #endif /* A_OUT */
-#include	"debug.h"
 
 extern int	_end;
 extern int	_etext;
--- a/usr/src/cmd/sgs/rtld/sparc/common_sparc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparc/common_sparc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2000-2002 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -63,7 +63,7 @@
  * Test the compatiblity of two register symbols, 0 pass, >0 fail
  */
 static uintptr_t
-check_regsyms(Sym * sym1, const char * name1, Sym * sym2, const char * name2)
+check_regsyms(Sym *sym1, const char *name1, Sym *sym2, const char *name2)
 {
 	if ((sym1->st_name == 0) && (sym2->st_name == 0))
 		return (0);	/* scratches are always compatible */
@@ -119,7 +119,7 @@
 				(rsymndx * SYMENT(lmp)));
 
 		for (rp = reglist; rp; rp = rp->rl_next) {
-			const char *	str, * sym1, * sym2;
+			const char	*str, *sym1, *sym2;
 
 			if (rp->rl_sym == symdef) {
 				/*
@@ -135,7 +135,7 @@
 				continue;
 
 			if ((str = demangle(sym1)) != sym1) {
-				char *	_str = alloca(strlen(str) + 1);
+				char	*_str = alloca(strlen(str) + 1);
 				(void) strcpy(_str, str);
 				sym1 = (const char *)_str;
 			}
@@ -143,11 +143,12 @@
 
 			if (LIST(lmp)->lm_flags & LML_FLG_TRC_WARN) {
 				(void) printf(MSG_INTL(MSG_LDD_REG_SYMCONF),
-				    conv_sym_SPARC_value_str(symdef->st_value),
+				    conv_sym_SPARC_value(symdef->st_value),
 				    NAME(rp->rl_lmp), sym1, NAME(lmp), sym2);
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REG_SYMCONF),
-				    conv_sym_SPARC_value_str(symdef->st_value),
+				eprintf(LIST(lmp), ERR_FATAL,
+				    MSG_INTL(MSG_REG_SYMCONF),
+				    conv_sym_SPARC_value(symdef->st_value),
 				    NAME(rp->rl_lmp), sym1, NAME(lmp), sym2);
 				return (0);
 			}
--- a/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,14 +18,15 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ *	Copyright (c) 1988 AT&T
+ *	All Rights Reserved
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
-/*	Copyright (c) 1988 AT&T	*/
-/*	All Rights Reserved	*/
-
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
@@ -40,11 +40,11 @@
 #include	<sys/mman.h>
 #include	<synch.h>
 #include	<dlfcn.h>
+#include	<debug.h>
 #include	"_a.out.h"
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"msg.h"
-#include	"debug.h"
 
 extern void	iflush_range(caddr_t, size_t);
 
@@ -66,15 +66,16 @@
 ulong_t
 aout_bndr(caddr_t pc)
 {
-	Rt_map *	lmp, * nlmp, * llmp;
+	Rt_map		*lmp, *nlmp, *llmp;
 	struct relocation_info *rp;
 	struct nlist	*sp;
-	Sym *		sym;
+	Sym		*sym;
 	char		*name;
 	int 		rndx, entry;
 	ulong_t		symval;
 	Slookup		sl;
 	uint_t		binfo;
+	Lm_list		*lml;
 
 	/*
 	 * For compatibility with libthread (TI_VERSION 1) we track the entry
@@ -106,22 +107,23 @@
 	 * Determine the last link-map of this list, this'll be the starting
 	 * point for any tsort() processing.
 	 */
-	llmp = LIST(lmp)->lm_tail;
+	lml = LIST(lmp);
+	llmp = lml->lm_tail;
 
 	/*
 	 * Find definition for symbol.
 	 */
 	sl.sl_name = name;
 	sl.sl_cmap = lmp;
-	sl.sl_imap = LIST(lmp)->lm_head;
+	sl.sl_imap = lml->lm_head;
 	sl.sl_hash = 0;
 	sl.sl_rsymndx = 0;
 	sl.sl_flags = LKUP_DEFT;
 
 	if ((sym = aout_lookup_sym(&sl, &nlmp, &binfo)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 		    demangle(name));
-		rtldexit(LIST(lmp), 1);
+		rtldexit(lml, 1);
 	}
 
 	symval = sym->st_value;
@@ -133,16 +135,15 @@
 		 * Record that this new link map is now bound to the caller.
 		 */
 		if (bind_one(lmp, nlmp, BND_REFER) == 0)
-			rtldexit(LIST(lmp), 1);
+			rtldexit(lml, 1);
 	}
 
 	/*
 	 * Print binding information and rebuild PLT entry.
 	 */
-	DBG_CALL(Dbg_bind_global(NAME(lmp),
-	    (caddr_t)(ADDR(lmp) + rp->r_address), (caddr_t)rp->r_address,
-	    (Xword)(-1), PLT_T_NONE, NAME(nlmp), (caddr_t)symval,
-	    (caddr_t)sym->st_value, name, binfo));
+	DBG_CALL(Dbg_bind_global(lmp, (Addr)(ADDR(lmp) + rp->r_address),
+	    (Off)rp->r_address, (Xword)(-1), PLT_T_NONE, nlmp,
+	    (Addr)symval, sym->st_value, name, binfo));
 
 	if (!(rtld_flags & RT_FL_NOBIND))
 		aout_plt_write((caddr_t)(ADDR(lmp) + rp->r_address), symval);
@@ -169,7 +170,7 @@
 	 */
 	if (entry) {
 		is_dep_init(nlmp, lmp);
-		leave(LIST(lmp));
+		leave(lml);
 	}
 
 	return (symval);
@@ -220,8 +221,9 @@
 	Sym *		sym;		/* symbol definition */
 	int		textrel = 0, ret = 1;
 	Alist		*bound = 0;
+	Lm_list		*lml = LIST(lmp);
 
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), SHT_RELA, plt, DBG_REL_START));
+	DBG_CALL(Dbg_reloc_run(lmp, SHT_RELA, plt, DBG_REL_START));
 
 	/*
 	 * If we've been called upon to promote an RTLD_LAZY object to an
@@ -287,13 +289,13 @@
 			sl.sl_flags = (LKUP_DEFT | LKUP_ALLCNTLIST);
 
 			if ((sym = aout_lookup_sym(&sl, &_lmp, &binfo)) == 0) {
-				if (LIST(lmp)->lm_flags & LML_FLG_TRC_WARN) {
+				if (lml->lm_flags & LML_FLG_TRC_WARN) {
 					(void)
 					    printf(MSG_INTL(MSG_LDD_SYM_NFOUND),
 					    demangle(name), NAME(lmp));
 					continue;
 				} else {
-					eprintf(ERR_FATAL,
+					eprintf(lml, ERR_FATAL,
 					    MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 					    demangle(name));
 					ret = 0;
@@ -323,10 +325,9 @@
 			if (IS_PC_RELATIVE(rp->r_type))
 				value -= (long)ADDR(lmp);
 
-			DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)ra,
-			    (caddr_t)(ra - ADDR(lmp)), (Xword)(-1), PLT_T_NONE,
-			    NAME(_lmp), (caddr_t)value, (caddr_t)sym->st_value,
-			    name, binfo));
+			DBG_CALL(Dbg_bind_global(lmp, (Addr)ra,
+			    (Off)(ra - ADDR(lmp)), (Xword)(-1), PLT_T_NONE,
+			    _lmp, (Addr)value, sym->st_value, name, binfo));
 		}
 
 		/*
@@ -346,7 +347,7 @@
 		case RELOC_DISP8:
 			value += *ra & S_MASK(8);
 			if (!S_INRANGE(value, 8))
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
+			    eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
 				NAME(lmp), (name ? demangle(name) :
 				MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 8,
 				(uint_t)ra);
@@ -368,7 +369,7 @@
 		case RELOC_DISP16:
 			value += *ra & S_MASK(16);
 			if (!S_INRANGE(value, 16))
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
+			    eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
 				NAME(lmp), (name ? demangle(name) :
 				MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 16,
 				(uint_t)ra);
@@ -378,7 +379,7 @@
 		case RELOC_BASE22:
 			value += *ra & S_MASK(22);
 			if (!S_INRANGE(value, 22))
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
+			    eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
 				NAME(lmp), (name ? demangle(name) :
 				MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 22,
 				(uint_t)ra);
@@ -394,7 +395,7 @@
 			value += *ra & S_MASK(22);
 			value >>= 2;
 			if (!S_INRANGE(value, 22))
-			    eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
+			    eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW),
 				NAME(lmp), (name ? demangle(name) :
 				MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 22,
 				(uint_t)ra);
@@ -414,9 +415,9 @@
 			*(long *)ra = value;
 			break;
 		default:
-			eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), NAME(lmp),
-			    (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)),
-			    rp->r_type);
+			eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL),
+			    NAME(lmp), (name ? demangle(name) :
+			    MSG_INTL(MSG_STR_UNKNOWN)), rp->r_type);
 			ret = 0;
 			break;
 		}
--- a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,13 +18,13 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -42,13 +41,13 @@
 #include	<dlfcn.h>
 #include	<synch.h>
 #include	<string.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"reloc.h"
-#include	"conv.h"
 
 
 extern void	iflush_range(caddr_t, size_t);
@@ -244,8 +243,7 @@
     int *fail)
 {
 	extern ulong_t	elf_plt_trace();
-	uintptr_t	dyn_plt;
-	uintptr_t	*dyndata;
+	uintptr_t	dyn_plt, *dyndata;
 
 	/*
 	 * If both pltenter & pltexit have been disabled there
@@ -272,8 +270,9 @@
 	 * we just set the plt to point to the new dyn_plt.
 	 */
 	if (*(uint_t *)dyn_plt == 0) {
-		Sym *	symp;
+		Sym	*symp;
 		Xword	symvalue;
+		Lm_list	*lml = LIST(rlmp);
 
 		(void) memcpy((void *)dyn_plt, dyn_plt_template,
 		    sizeof (dyn_plt_template));
@@ -286,7 +285,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_HI22, (uchar_t *)(dyn_plt + 0x20),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -298,7 +297,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_LO10, (uchar_t *)(dyn_plt + 0x24),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -308,10 +307,10 @@
 		 *	call	elf_plt_trace
 		 */
 		symvalue = (Xword)((uintptr_t)&elf_plt_trace -
-			(dyn_plt + 0x28));
+		    (dyn_plt + 0x28));
 		if (do_reloc(R_SPARC_WDISP30, (uchar_t *)(dyn_plt + 0x28),
 		    &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -361,7 +360,9 @@
 	uint_t		binfo, sb_flags = 0;
 	Slookup		sl;
 	Pltbindtype	pbtype;
-	int		entry, dbg_save, lmflags;
+	int		entry, lmflags;
+	uint_t		dbg_class;
+	Lm_list		*lml = LIST(lmp);
 
 	/*
 	 * For compatibility with libthread (TI_VERSION 1) we track the entry
@@ -371,9 +372,9 @@
 	 */
 	entry = enter();
 
-	if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
+	if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
+		dbg_class = dbg_desc->d_class;
+		dbg_desc->d_class = 0;
 	}
 
 	/*
@@ -394,10 +395,10 @@
 	 * over the plt entries or jumped to plt0 out of the blue.
 	 */
 	if (!lmp || ((addr % M_PLT_ENTSIZE) != 0)) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
-		    conv_reloc_SPARC_type_str(R_SPARC_JMP_SLOT),
-		    EC_ADDR(lmp), EC_XWORD(pltoff), EC_ADDR(from));
-		rtldexit(LIST(lmp), 1);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
+		    conv_reloc_SPARC_type(R_SPARC_JMP_SLOT),
+		    EC_NATPTR(lmp), EC_XWORD(pltoff), EC_NATPTR(from));
+		rtldexit(lml, 1);
 	}
 	reloff = pltndx * sizeof (Rela);
 
@@ -414,22 +415,22 @@
 	 * Determine the last link-map of this list, this'll be the starting
 	 * point for any tsort() processing.
 	 */
-	llmp = LIST(lmp)->lm_tail;
+	llmp = lml->lm_tail;
 
 	/*
 	 * Find definition for symbol.
 	 */
 	sl.sl_name = name;
 	sl.sl_cmap = lmp;
-	sl.sl_imap = LIST(lmp)->lm_head;
+	sl.sl_imap = lml->lm_head;
 	sl.sl_hash = 0;
 	sl.sl_rsymndx = rsymndx;
 	sl.sl_flags = LKUP_DEFT;
 
 	if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 		    demangle(name));
-		rtldexit(LIST(lmp), 1);
+		rtldexit(lml, 1);
 	}
 
 	symval = nsym->st_value;
@@ -441,10 +442,10 @@
 		 * Record that this new link map is now bound to the caller.
 		 */
 		if (bind_one(lmp, nlmp, BND_REFER) == 0)
-			rtldexit(LIST(lmp), 1);
+			rtldexit(lml, 1);
 	}
 
-	if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
+	if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
 		ulong_t	symndx = (((uintptr_t)nsym -
 			(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
 
@@ -459,7 +460,7 @@
 
 	pbtype = PLT_T_NONE;
 	if (!(rtld_flags & RT_FL_NOBIND)) {
-		if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) &
+		if (((lml->lm_tflags | FLAGS1(lmp)) &
 		    (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) &&
 		    AUDINFO(lmp)->ai_dynplts) {
 			int	fail = 0;
@@ -470,7 +471,7 @@
 			    rptr, lmp, nlmp, nsym, symndx, pltndx,
 			    (caddr_t)symval, sb_flags, &fail);
 			if (fail)
-				rtldexit(LIST(lmp), 1);
+				rtldexit(lml, 1);
 		} else {
 			/*
 			 * Write standard PLT entry to jump directly
@@ -484,9 +485,8 @@
 	/*
 	 * Print binding information and rebuild PLT entry.
 	 */
-	DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp), pltndx,
-	    pbtype, NAME(nlmp), (caddr_t)symval, (caddr_t)nsym->st_value,
-	    name, binfo));
+	DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)),
+	    pltndx, pbtype, nlmp, (Addr)symval, nsym->st_value, name, binfo));
 
 	/*
 	 * Complete any processing for newly loaded objects.  Note we don't
@@ -518,11 +518,11 @@
 	 */
 	if (entry) {
 		is_dep_init(nlmp, lmp);
-		leave(LIST(lmp));
+		leave(lml);
 	}
 
 	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+		dbg_desc->d_class = dbg_class;
 
 	return (symval);
 }
@@ -619,7 +619,7 @@
 		}
 	}
 	if (!relbgn || (relbgn == relend)) {
-		DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE));
+		DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE));
 		return (1);
 	}
 
@@ -627,7 +627,7 @@
 	basebgn = ADDR(lmp);
 	emap = ADDR(lmp) + MSIZE(lmp);
 
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START));
+	DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START));
 
 	/*
 	 * If we're processing in lazy mode there is no need to scan the
@@ -652,7 +652,7 @@
 		 * jump if we've been given a hint on the number of relocations.
 		 */
 		if ((rtype == R_SPARC_RELATIVE) &&
-		    !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) {
+		    ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) {
 			/*
 			 * It's possible that the relative relocation block
 			 * has relocations against the text segment as well
@@ -778,9 +778,8 @@
 				    (rtype != R_SPARC_COPY)) {
 					/* LINTED */
 					if (psymdef == 0) {
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					}
@@ -843,11 +842,13 @@
 					 * may be unresolved.
 					 */
 					if (symdef == 0) {
+					    Lm_list	*lml = LIST(lmp);
+
 					    if (bind != STB_WEAK) {
-						if (LIST(lmp)->lm_flags &
+						if (lml->lm_flags &
 						    LML_FLG_IGNRELERR) {
 						    continue;
-						} else if (LIST(lmp)->lm_flags &
+						} else if (lml->lm_flags &
 						    LML_FLG_TRC_WARN) {
 						    (void) printf(MSG_INTL(
 							MSG_LDD_SYM_NFOUND),
@@ -855,7 +856,7 @@
 							NAME(lmp));
 						    continue;
 						} else {
-						    eprintf(ERR_FATAL,
+						    eprintf(lml, ERR_FATAL,
 							MSG_INTL(MSG_REL_NOSYM),
 							NAME(lmp),
 							demangle(name));
@@ -866,9 +867,8 @@
 						psymndx = rsymndx;
 						psymdef = 0;
 
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					    }
@@ -978,7 +978,8 @@
 		/*
 		 * Call relocation routine to perform required relocation.
 		 */
-		DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL));
+		DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH,
+		    M_REL_SHT_TYPE, rel, NULL, name));
 
 		switch (rtype) {
 		case R_SPARC_REGISTER:
@@ -1005,14 +1006,15 @@
 			} else if (roffset == STO_SPARC_REGISTER_G7) {
 				set_sparc_g7(value);
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADREG),
-				    NAME(lmp), EC_ADDR(roffset));
+				eprintf(LIST(lmp), ERR_FATAL,
+				    MSG_INTL(MSG_REL_BADREG), NAME(lmp),
+				    EC_ADDR(roffset));
 				ret = 0;
 				break;
 			}
 
-			DBG_CALL(Dbg_reloc_reg_apply((Xword)roffset,
-				(Xword)value));
+			DBG_CALL(Dbg_reloc_apply_reg(LIST(lmp), ELF_DBG_RTLD,
+			    M_MACH, (Xword)roffset, (Xword)value));
 			break;
 		case R_SPARC_COPY:
 			if (elf_copy_reloc(name, symref, lmp, (void *)roffset,
@@ -1046,7 +1048,8 @@
 				 * Write standard PLT entry to jump directly
 				 * to newly bound function.
 				 */
-				DBG_CALL(Dbg_reloc_apply((Xword)roffset,
+				DBG_CALL(Dbg_reloc_apply_val(LIST(lmp),
+				    ELF_DBG_RTLD, (Xword)roffset,
 				    (Xword)value));
 				pbtype = elf_plt_write((uintptr_t)vaddr,
 				    (uintptr_t)vaddr, (void *)rel, value,
@@ -1063,9 +1066,9 @@
 			if ((rtype == R_SPARC_GLOB_DAT) ||
 			    (rtype == R_SPARC_32)) {
 				if (roffset & 0x3) {
-					eprintf(ERR_FATAL,
+					eprintf(LIST(lmp), ERR_FATAL,
 					    MSG_INTL(MSG_REL_NONALIGN),
-					    conv_reloc_SPARC_type_str(rtype),
+					    conv_reloc_SPARC_type(rtype),
 					    NAME(lmp), demangle(name),
 					    EC_OFF(roffset));
 					ret = 0;
@@ -1073,7 +1076,8 @@
 					*(uint_t *)roffset += value;
 			} else {
 				if (do_reloc(rtype, (uchar_t *)roffset,
-				    (Xword *)&value, name, NAME(lmp)) == 0)
+				    (Xword *)&value, name,
+				    NAME(lmp), LIST(lmp)) == 0)
 					ret = 0;
 			}
 
@@ -1081,8 +1085,8 @@
 			 * The value now contains the 'bit-shifted' value that
 			 * was or'ed into memory (this was set by do_reloc()).
 			 */
-			DBG_CALL(Dbg_reloc_apply((Xword)roffset,
-			    (Xword)value));
+			DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD,
+			    (Xword)roffset, (Xword)value));
 
 			/*
 			 * If this relocation is against a text segment, make
@@ -1097,10 +1101,9 @@
 			break;
 
 		if (binfo) {
-			DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset,
-			    (caddr_t)(roffset - basebgn), pltndx, pbtype,
-			    NAME(_lmp), (caddr_t)value,
-			    (caddr_t)symdef->st_value, name, binfo));
+			DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset,
+			    (Off)(roffset - basebgn), pltndx, pbtype,
+			    _lmp, (Addr)value, symdef->st_value, name, binfo));
 		}
 	}
 
@@ -1114,7 +1117,7 @@
  * ld.so.1.
  */
 const char *
-_conv_reloc_type_str(uint_t rel)
+_conv_reloc_type(uint_t rel)
 {
-	return (conv_reloc_SPARC_type_str(rel));
+	return (conv_reloc_SPARC_type(rel));
 }
--- a/usr/src/cmd/sgs/rtld/sparcv9/Makefile	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparcv9/Makefile	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,7 +33,7 @@
 		analyze.o	elf.o		globals.o	malloc.o \
 		mutex.o		paths.o		setup.o		util.o \
 		dlfcns.o	config_elf.o	locale.o	tsort.o \
-		getcwd.o	remove.o	sunwmove.o	tls.o \
+		getcwd.o	remove.o	move.o		tls.o \
 		cap.o
 
 S_COMOBJS=	debug.o		audit.o		object.o
@@ -57,7 +57,7 @@
 
 CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h
 
-BASEPLAT=	sparc
+BASEPLAT =	sparc
 
 # __GNUC is overridden in the environment when building with gcc
 __GNUC:sh=		echo \\043
@@ -81,6 +81,8 @@
 LINTFLAGS64 +=	$(VAR_LINTFLAGS64)
 SONAME=		$(VAR_RTLD_V9_SONAME)
 
+MAPFILES +=	../common/mapfile-64-vers
+
 SGSMSGTARG +=	$(SGSMSGSPARC) $(SGSMSGSPARC64) $(SGSMSG64)
 
 LDLIB =		-L ../../libld/$(MACH64)
@@ -107,10 +109,5 @@
 		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SRCBASE)/uts/sparc/krtld/%.c
-		$(COMPILE.c) -o $@ $<  $(WARNFLAGS)
-		$(POST_PROCESS_O)
-
-
 include		$(SRC)/cmd/sgs/rtld/Makefile.targ
 include		../../Makefile.sub.64
--- a/usr/src/cmd/sgs/rtld/sparcv9/_setup.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparcv9/_setup.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,12 +18,12 @@
  *
  * CDDL HEADER END
  */
+
 /*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
  *
- *
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -51,7 +50,6 @@
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"msg.h"
-#include	"debug.h"
 
 extern int	_end;
 extern int	_etext;
--- a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,9 +18,10 @@
  *
  * CDDL HEADER END
  */
+
 /*
- *	Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
- *	Use is subject to license terms.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
@@ -38,13 +38,13 @@
 #include	<dlfcn.h>
 #include	<synch.h>
 #include	<string.h>
+#include	<debug.h>
+#include	<reloc.h>
+#include	<conv.h>
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
 #include	"msg.h"
-#include	"debug.h"
-#include	"reloc.h"
-#include	"conv.h"
 
 extern void	iflush_range(caddr_t, size_t);
 extern void	plt_upper_32(uintptr_t, uintptr_t);
@@ -300,8 +300,7 @@
     int *fail)
 {
 	extern ulong_t	elf_plt_trace();
-	Addr		dyn_plt;
-	Addr *		dyndata;
+	Addr		dyn_plt, *dyndata;
 
 	/*
 	 * If both pltenter & pltexit have been disabled there
@@ -319,7 +318,7 @@
 	 * library that is interested in this binding.
 	 */
 	dyn_plt = (Xword)AUDINFO(rlmp)->ai_dynplts +
-		(pltndx * dyn_plt_ent_size);
+	    (pltndx * dyn_plt_ent_size);
 
 	/*
 	 * Have we initialized this dynamic plt entry yet?  If we haven't do it
@@ -328,8 +327,9 @@
 	 * we just set the plt to point to the new dyn_plt.
 	 */
 	if (*(Word *)dyn_plt == 0) {
-		Sym *	symp;
+		Sym	*symp;
 		Xword	symvalue;
+		Lm_list	*lml = LIST(rlmp);
 
 		(void) memcpy((void *)dyn_plt, dyn_plt_template,
 		    sizeof (dyn_plt_template));
@@ -342,7 +342,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_HH22, (Byte *)(dyn_plt + 0x14),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -354,7 +354,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_HM10, (Byte *)(dyn_plt + 0x18),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -366,7 +366,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_LM22, (Byte *)(dyn_plt + 0x20),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -378,7 +378,7 @@
 		symvalue = (Xword)dyndata;
 		if (do_reloc(R_SPARC_LO10, (Byte *)(dyn_plt + 0x24),
 		    &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -388,10 +388,10 @@
 		 *	call	elf_plt_trace
 		 */
 		symvalue = (Xword)((Addr)&elf_plt_trace -
-			(Addr)(dyn_plt + 0x2c));
+		    (Addr)(dyn_plt + 0x2c));
 		if (do_reloc(R_SPARC_WDISP30, (Byte *)(dyn_plt + 0x2c),
 		    &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE),
-		    MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) {
+		    MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) {
 			*fail = 1;
 			return (0);
 		}
@@ -412,12 +412,11 @@
 		iflush_range((void *)dyn_plt, sizeof (dyn_plt_template));
 	}
 
-	(void) elf_plt_write((uintptr_t)addr, (uintptr_t)addr,
-		rptr, (uintptr_t)dyn_plt, pltndx);
+	(void) elf_plt_write((uintptr_t)addr, (uintptr_t)addr, rptr,
+	    (uintptr_t)dyn_plt, pltndx);
 	return ((caddr_t)dyn_plt);
 }
 
-
 /*
  * Function binding routine - invoked on the first call to a function through
  * the procedure linkage table;
@@ -437,7 +436,7 @@
 ulong_t
 elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from)
 {
-	Rt_map		*nlmp, * llmp;
+	Rt_map		*nlmp, *llmp;
 	Addr		addr, vaddr, reloff, symval;
 	char		*name;
 	Rela		*rptr;
@@ -447,7 +446,9 @@
 	ulong_t		rsymndx;
 	Slookup		sl;
 	Pltbindtype	pbtype;
-	int		entry, dbg_save, lmflags, farplt = 0;
+	int		entry, lmflags, farplt = 0;
+	uint_t		dbg_class;
+	Lm_list		*lml = LIST(lmp);
 
 	/*
 	 * For compatibility with libthread (TI_VERSION 1) we track the entry
@@ -457,9 +458,9 @@
 	 */
 	entry = enter();
 
-	if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) {
-		dbg_save = dbg_mask;
-		dbg_mask = 0;
+	if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) {
+		dbg_class = dbg_desc->d_class;
+		dbg_desc->d_class = 0;
 	}
 
 	/*
@@ -493,10 +494,10 @@
 	 */
 	if (!lmp || (!farplt && (addr % M_PLT_ENTSIZE) != 0) ||
 	    (farplt && (addr % M_PLT_INSSIZE))) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
-		    conv_reloc_SPARC_type_str(R_SPARC_JMP_SLOT),
-		    EC_ADDR(lmp), EC_XWORD(pltoff), EC_ADDR(from));
-		rtldexit(LIST(lmp), 1);
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF),
+		    conv_reloc_SPARC_type(R_SPARC_JMP_SLOT),
+		    EC_NATPTR(lmp), EC_XWORD(pltoff), EC_NATPTR(from));
+		rtldexit(lml, 1);
 	}
 	reloff = pltndx * sizeof (Rela);
 
@@ -513,21 +514,21 @@
 	 * Determine the last link-map of this list, this'll be the starting
 	 * point for any tsort() processing.
 	 */
-	llmp = LIST(lmp)->lm_tail;
+	llmp = lml->lm_tail;
 
 	/*
 	 * Find definition for symbol.
 	 */
 	sl.sl_name = name;
 	sl.sl_cmap = lmp;
-	sl.sl_imap = LIST(lmp)->lm_head;
+	sl.sl_imap = lml->lm_head;
 	sl.sl_hash = 0;
 	sl.sl_rsymndx = rsymndx;
 	sl.sl_flags = LKUP_DEFT;
 	if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) {
-		eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
+		eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp),
 		    demangle(name));
-		rtldexit(LIST(lmp), 1);
+		rtldexit(lml, 1);
 	}
 
 	symval = nsym->st_value;
@@ -539,10 +540,10 @@
 		 * Record that this new link map is now bound to the caller.
 		 */
 		if (bind_one(lmp, nlmp, BND_REFER) == 0)
-			rtldexit(LIST(lmp), 1);
+			rtldexit(lml, 1);
 	}
 
-	if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
+	if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) {
 		/* LINTED */
 		uint_t	symndx = (uint_t)(((uintptr_t)nsym -
 			(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
@@ -558,7 +559,7 @@
 
 	pbtype = PLT_T_NONE;
 	if (!(rtld_flags & RT_FL_NOBIND)) {
-		if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) &
+		if (((lml->lm_tflags | FLAGS1(lmp)) &
 		    (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) &&
 		    AUDINFO(lmp)->ai_dynplts) {
 			int	fail = 0;
@@ -570,7 +571,7 @@
 			    rptr, lmp, nlmp, nsym, symndx, pltndx,
 			    (caddr_t)symval, sb_flags, &fail);
 			if (fail)
-				rtldexit(LIST(lmp), 1);
+				rtldexit(lml, 1);
 		} else {
 			/*
 			 * Write standard PLT entry to jump directly
@@ -584,10 +585,9 @@
 	/*
 	 * Print binding information and rebuild PLT entry.
 	 */
-	DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp),
-	    (Xword)pltndx, pbtype, NAME(nlmp), (caddr_t)symval,
-	    (caddr_t)nsym->st_value, name, binfo));
-
+	DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)),
+	    (Xword)pltndx, pbtype, nlmp, (Addr)symval, nsym->st_value,
+	    name, binfo));
 
 	/*
 	 * Complete any processing for newly loaded objects.  Note we don't
@@ -623,7 +623,7 @@
 	}
 
 	if (lmflags & LML_FLG_RTLDLM)
-		dbg_mask = dbg_save;
+		dbg_desc->d_class = dbg_class;
 
 	return (symval);
 }
@@ -644,8 +644,8 @@
 	for (LIST_TRAVERSE(padlist, lnp, pip)) {
 		if (pip->pp_addr == value) {
 			*pltaddr = pip->pp_plt;
-			DBG_CALL(Dbg_pltpad_bindto64(NAME(lmp), sname,
-				(Addr)*pltaddr));
+			DBG_CALL(Dbg_bind_pltpad_from(lmp, (Addr)*pltaddr,
+			    sname));
 			return (1);
 		}
 		if (pip->pp_addr > value)
@@ -697,7 +697,7 @@
 	}
 
 	*pltaddr = plt;
-	DBG_CALL(Dbg_pltpad_boundto64(NAME(lmp), (Addr)*pltaddr, fname, sname));
+	DBG_CALL(Dbg_bind_pltpad_to(lmp, (Addr)*pltaddr, fname, sname));
 	return (1);
 }
 
@@ -816,7 +816,7 @@
 		}
 	}
 	if (!relbgn || (relbgn == relend)) {
-		DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE));
+		DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE));
 		return (1);
 	}
 
@@ -824,7 +824,7 @@
 	basebgn = ADDR(lmp);
 	emap = ADDR(lmp) + MSIZE(lmp);
 
-	DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START));
+	DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START));
 
 	/*
 	 * If we're processing in lazy mode there is no need to scan the
@@ -850,7 +850,7 @@
 		 * number of relocations.
 		 */
 		if ((rtype == R_SPARC_RELATIVE) &&
-		    !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) {
+		    ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) {
 			/*
 			 * It's possible that the relative relocation block
 			 * has relocations against the text segment as well
@@ -978,9 +978,8 @@
 				    (rtype != R_SPARC_COPY)) {
 					/* LINTED */
 					if (psymdef == 0) {
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					}
@@ -1044,11 +1043,13 @@
 					 * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND)
 					 */
 					if (symdef == 0) {
+					    Lm_list	*lml = LIST(lmp);
+
 					    if (bind != STB_WEAK) {
-						if (LIST(lmp)->lm_flags &
+						if (lml->lm_flags &
 						    LML_FLG_IGNRELERR) {
 						    continue;
-						} else if (LIST(lmp)->lm_flags &
+						} else if (lml->lm_flags &
 						    LML_FLG_TRC_WARN) {
 						    (void) printf(MSG_INTL(
 							MSG_LDD_SYM_NFOUND),
@@ -1056,7 +1057,7 @@
 							NAME(lmp));
 						    continue;
 						} else {
-						    eprintf(ERR_FATAL,
+						    eprintf(lml, ERR_FATAL,
 							MSG_INTL(MSG_REL_NOSYM),
 							NAME(lmp),
 							demangle(name));
@@ -1067,9 +1068,8 @@
 						psymndx = rsymndx;
 						psymdef = 0;
 
-						DBG_CALL(Dbg_bind_weak(
-						    NAME(lmp), (caddr_t)roffset,
-						    (caddr_t)
+						DBG_CALL(Dbg_bind_weak(lmp,
+						    (Addr)roffset, (Addr)
 						    (roffset - basebgn), name));
 						continue;
 					    }
@@ -1180,7 +1180,8 @@
 		/*
 		 * Call relocation routine to perform required relocation.
 		 */
-		DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL));
+		DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH,
+		    M_REL_SHT_TYPE, rel, NULL, name));
 
 		switch (rtype) {
 		case R_SPARC_REGISTER:
@@ -1207,14 +1208,15 @@
 			} else if (roffset == STO_SPARC_REGISTER_G7) {
 				set_sparc_g7(value);
 			} else {
-				eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADREG),
-				    NAME(lmp), EC_ADDR(roffset));
+				eprintf(LIST(lmp), ERR_FATAL,
+				    MSG_INTL(MSG_REL_BADREG), NAME(lmp),
+				    EC_ADDR(roffset));
 				ret = 0;
 				break;
 			}
 
-			DBG_CALL(Dbg_reloc_reg_apply((Xword)roffset,
-				(Xword)value));
+			DBG_CALL(Dbg_reloc_apply_reg(LIST(lmp), ELF_DBG_RTLD,
+			    M_MACH, (Xword)roffset, (Xword)value));
 			break;
 		case R_SPARC_COPY:
 			if (elf_copy_reloc(name, symref, lmp, (void *)roffset,
@@ -1249,8 +1251,9 @@
 				 * Write standard PLT entry to jump directly
 				 * to newly bound function.
 				 */
-				DBG_CALL(Dbg_reloc_apply(roffset,
-				    (ulong_t)value));
+				DBG_CALL(Dbg_reloc_apply_val(LIST(lmp),
+				    ELF_DBG_RTLD, (Xword)roffset,
+				    (Xword)value));
 				pbtype = elf_plt_write((uintptr_t)vaddr,
 				    (uintptr_t)vaddr, (void *)rel, value,
 				    pltndx);
@@ -1282,9 +1285,9 @@
 			if ((rtype == R_SPARC_GLOB_DAT) ||
 			    (rtype == R_SPARC_64)) {
 				if (roffset & 0x7) {
-					eprintf(ERR_FATAL,
+					eprintf(LIST(lmp), ERR_FATAL,
 					    MSG_INTL(MSG_REL_NONALIGN),
-					    conv_reloc_SPARC_type_str(rtype),
+					    conv_reloc_SPARC_type(rtype),
 					    NAME(lmp), demangle(name),
 					    EC_OFF(roffset));
 					ret = 0;
@@ -1292,7 +1295,8 @@
 					*(ulong_t *)roffset += value;
 			} else {
 				if (do_reloc(rtype, (uchar_t *)roffset,
-				    (Xword *)&value, name, NAME(lmp)) == 0)
+				    (Xword *)&value, name,
+				    NAME(lmp), LIST(lmp)) == 0)
 					ret = 0;
 			}
 
@@ -1300,8 +1304,8 @@
 			 * The value now contains the 'bit-shifted' value that
 			 * was or'ed into memory (this was set by do_reloc()).
 			 */
-			DBG_CALL(Dbg_reloc_apply((ulong_t)roffset,
-			    value));
+			DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD,
+			    (Xword)roffset, (Xword)value));
 
 			/*
 			 * If this relocation is against a text segment, make
@@ -1316,10 +1320,9 @@
 			break;
 
 		if (binfo) {
-			DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset,
-			    (caddr_t)(roffset - basebgn), pltndx, pbtype,
-			    NAME(_lmp), (caddr_t)value,
-			    (caddr_t)symdef->st_value, name, binfo));
+			DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset,
+			    (Off)(roffset - basebgn), pltndx, pbtype,
+			    _lmp, (Addr)value, symdef->st_value, name, binfo));
 		}
 	}
 
@@ -1352,7 +1355,7 @@
  * ld.so.1.
  */
 const char *
-_conv_reloc_type_str(uint_t rel)
+_conv_reloc_type(uint_t rel)
 {
-	return (conv_reloc_SPARC_type_str(rel));
+	return (conv_reloc_SPARC_type(rel));
 }
--- a/usr/src/cmd/sgs/tools/bld_lint.sh	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/bld_lint.sh	Tue Mar 14 09:22:52 2006 -0800
@@ -3,9 +3,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.
@@ -20,8 +19,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 1998,2002 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -31,19 +31,20 @@
 
 MACH=	`uname -p`
 
-if [ $MACH = "sparc" ]; \
+if [ $MACH = "sparc" ]
 then
 	MACH64="sparcv9"
+elif [ $MACH = "i386" ]
+then
+	MACH64="amd64"
 else
 	MACH64="unknown"
 fi
 
 LOG=lint.$MACH.log
 
-
 #
-# Keep the first run as a backup, so that
-# subsequent runs can diff against it.
+# Keep the first run as a backup, so that subsequent runs can diff against it.
 #
 if [ -f $LOG ]
 then
@@ -81,10 +82,8 @@
 	fi
 done
 
-
 #
-# If there is a backup log, diff the current
-# one against it.
+# If there is a backup log, diff the current one against it.
 #
 if [ -f $LOG.bak ]
 then
--- a/usr/src/cmd/sgs/tools/chkmsg.sh	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/chkmsg.sh	Tue Mar 14 09:22:52 2006 -0800
@@ -3,9 +3,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.
@@ -20,11 +19,12 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+# ident	"%Z%%M%	%I%	%E% SMI"
 
 TOOLDIR="${SRC}/cmd/sgs/tools/"
 
@@ -49,14 +49,15 @@
 fi
 
 #
-# Sort the MSG_INTL() and MSG_ORIG() entries.
+# Sort the MSG_INTL() and MSG_ORIG() entries.  Note, messages can come in _32
+# and _64 flavors - if so strip the suffix and uniquify the output.
 #
 if [ -s CATA_MSG_INTL_LIST ] ; then
-	sort CATA_MSG_INTL_LIST | uniq > _TMP
+	sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_INTL_LIST | sort | uniq > _TMP
 	mv _TMP CATA_MSG_INTL_LIST
 fi
 if [ -s CATA_MSG_ORIG_LIST ] ; then
-	sort CATA_MSG_ORIG_LIST | uniq > _TMP
+	sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_ORIG_LIST | sort | uniq > _TMP
 	mv _TMP CATA_MSG_ORIG_LIST
 fi
 
@@ -66,11 +67,11 @@
 nawk -f  ${TOOLDIR}/getmessage.awk	$*
 
 if [ -s MSG_INTL_LIST ] ; then
-	sort MSG_INTL_LIST | uniq > _TMP
+	sed -e "s/_32$//" -e "s/_64$//" MSG_INTL_LIST | sort | uniq > _TMP
 	mv _TMP MSG_INTL_LIST
 fi
 if [ -s MSG_ORIG_LIST ] ; then
-	sort MSG_ORIG_LIST | uniq > _TMP
+	sed -e "s/_32$//" -e "s/_64$//" MSG_ORIG_LIST | sort | uniq > _TMP
 	mv _TMP MSG_ORIG_LIST
 fi
 
--- a/usr/src/cmd/sgs/tools/common/alist.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/common/alist.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -28,7 +28,6 @@
 
 #include <sgs.h>
 #include <string.h>
-#include <stdlib.h>
 
 /*
  * Alist manipulation.  An Alist is a list of elements formed into an array.
--- a/usr/src/cmd/sgs/tools/common/leb128.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/common/leb128.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,17 +18,18 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <stdio.h>
 #include <dwarf.h>
 #include <sys/types.h>
 #include <sys/elf.h>
-#include <gelf.h>
 
 /*
  * Little Endian Base 128 (LEB128) numbers.
--- a/usr/src/cmd/sgs/tools/common/string_table.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/common/string_table.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,15 +18,15 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <string_table.h>
-#include <stdlib.h>
 #include <strings.h>
 #include <sgs.h>
 #include <stdio.h>
--- a/usr/src/cmd/sgs/tools/proto.sh	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/cmd/sgs/tools/proto.sh	Tue Mar 14 09:22:52 2006 -0800
@@ -3,9 +3,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.
@@ -20,8 +19,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -150,6 +150,7 @@
 	fi
 done
 
+SYSLIB=$CODEMGR_WS/proto/root_$MACH/lib
 USRLIB=$CODEMGR_WS/proto/root_$MACH/usr/lib
 
 if [ ! -h $USRLIB/ld.so.1 ]; then
@@ -162,24 +163,26 @@
 # In addition create some 64 symlinks so that dependencies referenced
 # from our test environment will map back to the appropriate libraries.
 #
-if [ $MACH = "sparc" ] ; then
-	if [ ! -h $USRLIB/64 ] ; then
-		rm -f $USRLIB/64
-		ln -s sparcv9 $USRLIB/64
-		echo "$USRLIB/64 -> $USRLIB/sparcv9"
-	fi
-	if [ ! -h $USRLIB/link_audit/64 ] ; then
-		rm -f $USRLIB/link_audit/64
-		ln -s sparcv9 $USRLIB/link_audit/64
-		echo "$USRLIB/link_audit/64 -> $USRLIB/link_audit/sparcv9"
-	fi
-	if [ ! -h $USRLIB/64/ld.so.1 ]; then
-		rm -f $USRLIB/64/ld.so.1
-		ln -s ../../lib/64/ld.so.1 $USRLIB/64/ld.so.1
-		echo "$USRLIB/64/ld.so.1 -> ../../../lib/64/ld.so.1"
-	fi
+if [ ! -h $SYSLIB/64 ] ; then
+	rm -f $SYSLIB/64
+	ln -s $MACH64 $SYSLIB/64
+	echo "$SYSLIB/64 -> $SYSLIB/$MACH64"
+fi
+if [ ! -h $USRLIB/64 ] ; then
+	rm -f $USRLIB/64
+	ln -s $MACH64 $USRLIB/64
+	echo "$USRLIB/64 -> $USRLIB/$MACH64"
 fi
-
+if [ ! -h $USRLIB/link_audit/64 ] ; then
+	rm -f $USRLIB/link_audit/64
+	ln -s $MACH64 $USRLIB/link_audit/64
+	echo "$USRLIB/link_audit/64 -> $USRLIB/link_audit/$MACH64"
+fi
+if [ ! -h $USRLIB/64/ld.so.1 ]; then
+	rm -f $USRLIB/64/ld.so.1
+	ln -s ../../../lib/64/ld.so.1 $USRLIB/64/ld.so.1
+	echo "$USRLIB/64/ld.so.1 -> ../../../lib/64/ld.so.1"
+fi
 
 #
 #
--- a/usr/src/pkgdefs/SUNWcsl/prototype_i386	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWcsl/prototype_i386	Tue Mar 14 09:22:52 2006 -0800
@@ -61,8 +61,6 @@
 s none usr/ccs/lib/amd64/libtermcap.so=../../../../lib/amd64/libcurses.so.1
 s none usr/ccs/lib/amd64/libl.so=../../../lib/amd64/libl.so.1
 s none usr/ccs/lib/amd64/liby.so=../../../lib/amd64/liby.so.1
-s none usr/ccs/lib/amd64/libld.so.2=../../../../lib/amd64/libld.so.2
-s none usr/ccs/lib/amd64/libld.so.3=../../../../lib/amd64/libld.so.3
 d none usr/lib/cfgadm/amd64 755 root bin
 f none usr/lib/cfgadm/amd64/scsi.so.1 755 root bin
 s none usr/lib/cfgadm/amd64/scsi.so=./scsi.so.1
--- a/usr/src/pkgdefs/SUNWcsl/prototype_sparc	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWcsl/prototype_sparc	Tue Mar 14 09:22:52 2006 -0800
@@ -56,8 +56,6 @@
 s none usr/ccs/lib/sparcv9/libtermcap.so=../../../../lib/sparcv9/libcurses.so.1
 s none usr/ccs/lib/sparcv9/libl.so=../../../lib/sparcv9/libl.so.1
 s none usr/ccs/lib/sparcv9/liby.so=../../../lib/sparcv9/liby.so.1
-s none usr/ccs/lib/sparcv9/libld.so.2=../../../../lib/sparcv9/libld.so.2
-s none usr/ccs/lib/sparcv9/libld.so.3=../../../../lib/sparcv9/libld.so.3
 d none usr/lib/cfgadm/sparcv9 755 root bin
 f none usr/lib/cfgadm/sparcv9/scsi.so.1 755 root bin
 s none usr/lib/cfgadm/sparcv9/scsi.so=./scsi.so.1
--- a/usr/src/pkgdefs/SUNWcslr/prototype_com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWcslr/prototype_com	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -94,8 +93,7 @@
 s none lib/libkstat.so=libkstat.so.1
 f none lib/libkstat.so.1 755 root bin
 f none lib/liblaadm.so.1 755 root bin
-f none lib/libld.so.2 755 root bin
-f none lib/libld.so.3 755 root bin
+f none lib/libld.so.4 755 root bin
 f none lib/liblddbg.so.4 755 root bin
 f none lib/libmacadm.so.1 755 root bin
 s none lib/libmd5.so=libmd5.so.1
--- a/usr/src/pkgdefs/SUNWcslr/prototype_i386	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWcslr/prototype_i386	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -92,8 +91,7 @@
 f none lib/amd64/libintl.so.1 755 root bin
 s none lib/amd64/libkstat.so=libkstat.so.1
 f none lib/amd64/libkstat.so.1 755 root bin
-f none lib/amd64/libld.so.2 755 root bin
-f none lib/amd64/libld.so.3 755 root bin
+f none lib/amd64/libld.so.4 755 root bin
 f none lib/amd64/liblddbg.so.4 755 root bin
 s none lib/amd64/libmd5.so=libmd5.so.1
 f none lib/amd64/libmd5.so.1 755 root bin
--- a/usr/src/pkgdefs/SUNWcslr/prototype_sparc	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWcslr/prototype_sparc	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -95,8 +94,7 @@
 f none lib/sparcv9/libintl.so.1 755 root bin
 s none lib/sparcv9/libkstat.so=libkstat.so.1
 f none lib/sparcv9/libkstat.so.1 755 root bin
-f none lib/sparcv9/libld.so.2 755 root bin
-f none lib/sparcv9/libld.so.3 755 root bin
+f none lib/sparcv9/libld.so.4 755 root bin
 f none lib/sparcv9/liblddbg.so.4 755 root bin
 s none lib/sparcv9/libmd5.so=libmd5.so.1
 f none lib/sparcv9/libmd5.so.1 755 root bin
--- a/usr/src/pkgdefs/SUNWtoo/prototype_com	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWtoo/prototype_com	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -64,7 +63,6 @@
 f none usr/ccs/bin/ld 755 root bin
 f none usr/ccs/bin/regcmp 555 root bin
 d none usr/ccs/lib 755 root bin
-s none usr/ccs/lib/libld.so.2=../../../lib/libld.so.2
 s none usr/ccs/lib/link_audit=../../lib/link_audit
 d none usr/lib 755 root bin
 d none usr/lib/ld 755 root bin
@@ -75,7 +73,6 @@
 f none usr/lib/ld/map.noexdata 444 root bin
 f none usr/lib/ld/map.pagealign 444 root bin
 f none usr/lib/lddstub 555 root bin
-s none usr/lib/libld.so.2=../../lib/libld.so.2
 f none usr/lib/libldstab.so.1 755 root bin
 d none usr/lib/link_audit 755 root bin
 s none usr/lib/link_audit/32=.
--- a/usr/src/pkgdefs/SUNWtoo/prototype_i386	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWtoo/prototype_i386	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -53,8 +52,6 @@
 f none usr/bin/i86/gcore 555 root bin
 f none usr/bin/i86/plimit 555 root bin
 f none usr/bin/i86/truss 555 root bin
-s none usr/lib/libld.so.3=../../lib/libld.so.3
-s none usr/ccs/lib/libld.so.3=../../../lib/libld.so.3
 d none usr/bin/amd64 755 root bin
 f none usr/bin/amd64/gcore 555 root bin
 f none usr/bin/amd64/plimit 555 root bin
@@ -72,7 +69,5 @@
 f none usr/lib/link_audit/amd64/truss.so.1 755 root bin
 f none usr/lib/link_audit/amd64/who.so.1 755 root bin
 d none usr/lib/amd64 755 root bin
-s none usr/lib/amd64/libld.so.2=../../../lib/amd64/libld.so.2
-s none usr/lib/amd64/libld.so.3=../../../lib/amd64/libld.so.3
 f none usr/lib/amd64/libldstab.so.1 755 root bin
 f none usr/lib/amd64/lddstub 555 root bin
--- a/usr/src/pkgdefs/SUNWtoo/prototype_sparc	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/pkgdefs/SUNWtoo/prototype_sparc	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -52,8 +51,6 @@
 d none usr/bin/sparcv7 755 root bin
 f none usr/bin/sparcv7/gcore 555 root bin
 f none usr/bin/sparcv7/truss 555 root bin
-s none usr/lib/libld.so.3=../../lib/libld.so.3
-s none usr/ccs/lib/libld.so.3=../../../lib/libld.so.3
 d none usr/bin/sparcv9 755 root bin
 f none usr/bin/sparcv9/gcore 555 root bin
 f none usr/bin/sparcv9/plimit 555 root bin
@@ -71,7 +68,5 @@
 f none usr/lib/link_audit/sparcv9/truss.so.1 755 root bin
 f none usr/lib/link_audit/sparcv9/who.so.1 755 root bin
 d none usr/lib/sparcv9 755 root bin
-s none usr/lib/sparcv9/libld.so.2=../../../lib/sparcv9/libld.so.2
-s none usr/lib/sparcv9/libld.so.3=../../../lib/sparcv9/libld.so.3
 f none usr/lib/sparcv9/libldstab.so.1 755 root bin
 f none usr/lib/sparcv9/lddstub 555 root bin
--- a/usr/src/tools/abi/etc/ABI_i386.db	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/tools/abi/etc/ABI_i386.db	Tue Mar 14 09:22:52 2006 -0800
@@ -5,9 +5,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.
@@ -15054,12 +15053,6 @@
 add_key_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 add_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-add_string usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-add_string usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-add_string lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 add_tnode lib/amd64/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_tnode lib/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_wch usr/xpg4/lib/libcurses.so.1 0 0 SUNW_1.2 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
@@ -17095,9 +17088,7 @@
 calloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1011111 0 0100000 0 0 0 0
 calloc usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0
 calloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
-calloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 calloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
-calloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
 calloc usr/lib/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0
 calloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
 calloc lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
@@ -18279,12 +18270,6 @@
 create_event_service usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_event_service usr/lib/amd64/librcm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 create_history_entry usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
-create_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-create_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-create_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 create_policy_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_policy_1 usr/lib/krb5/amd64/libkadm5clnt.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 create_principal_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
@@ -19011,14 +18996,9 @@
 dbg_mask lib/amd64/ld.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
 dbg_print etc/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
 dbg_print usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
-dbg_print usr/lib/libld.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0001111 0 0001010 0000101 0 0 0 0
 dbg_print usr/lib/libpicltree.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0000111 0 0000111 0 0 0 0 0
 dbg_print lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
 dbg_print lib/amd64/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 dbgstr2num usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 dbm_clearerr usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 0 0 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1011110 0 0100001 0 0 0 0
 dbm_clearerr usr/lib/krb5/libdb2.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
@@ -21167,12 +21147,6 @@
 endwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 endzoneent usr/lib/amd64/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 endzoneent usr/lib/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-ent_setup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-ent_setup usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-ent_setup lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 enumerate_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 env usr/lib/libipsecutil.so.1 1 40 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 environ etc/lib/ld.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
@@ -21601,12 +21575,6 @@
 filter lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 find_p11i_slot usr/lib/libike.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0
 find_word usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000111 0 0000111 0 0 0 0 0
-finish_libs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-finish_libs usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-finish_libs lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 finite usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 finite lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 finite usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -22307,9 +22275,7 @@
 free usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
 free usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0
 free usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
-free usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 free usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
-free usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
 free usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
 free lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
 free lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0
@@ -28097,12 +28063,6 @@
 ld_file usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ld_file64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ld_file64 usr/lib/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-ld_main usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-ld_main usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-ld_main lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ld_section usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0001111 0100000 0 0 0 0
 ld_section usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ld_section64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
@@ -28111,12 +28071,6 @@
 ld_start usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ld_start64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ld_start64 usr/lib/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-ld_support_loadso usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-ld_support_loadso lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ldapConfig usr/lib/libnisdb.so.2 1 60 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
 ldapDBTableMapping usr/lib/libnisdb.so.2 1 140 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
 ldapMappingList usr/lib/libnisdb.so.2 1 340 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
@@ -29013,8 +28967,6 @@
 lgrp_version usr/lib/amd64/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 lgrp_view usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0
 lgrp_view usr/lib/amd64/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
-libld_malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-libld_malloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
 libtecla_version usr/lib/amd64/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0
 libtecla_version usr/lib/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0
 line usr/lib/libplot.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
@@ -29060,12 +29012,6 @@
 list_append usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0
 list_append usr/lib/print/psm-lpsched.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0
 list_append_unique usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0
-list_appendc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-list_appendc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-list_appendc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 list_concatenate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0
 list_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1010000 0101111 0 0 0 0
 list_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
@@ -29079,27 +29025,9 @@
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
-list_insertc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-list_insertc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-list_insertc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 list_ints usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 list_iterate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0
 list_locate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0
-list_prependc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-list_prependc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-list_prependc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-list_where usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-list_where lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 listdev usr/lib/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 listdev lib/amd64/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 listdev lib/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
@@ -29374,12 +29302,6 @@
 make_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1010000 0101111 0 0 0 0
 make_key_sched usr/lib/gss/do/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0
 make_key_sched usr/lib/gss/gl/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0
-make_sections usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-make_sections usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-make_sections lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 makecontext usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 0 0 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1011110 0 0100001 0 0 0 0
 makecontext usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.3 0 0 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 1111111 1011111 0 0100000 0 0 0 0
 makecontext lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0
@@ -29417,9 +29339,7 @@
 malloc usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
 malloc usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0
 malloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
-malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 malloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
-malloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
 malloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
 malloc lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
 malloc lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0
@@ -32681,12 +32601,6 @@
 octet_to_hexascii lib/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 oextra usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0
 oextra usr/lib/amd64/lib4014.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-ofl_cleanup usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-ofl_cleanup lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ohix usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0
 ohix usr/lib/amd64/lib4014.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 ohiy usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0
@@ -32739,12 +32653,6 @@
 open_ldap_connection usr/lib/libldap.so.3 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0 0 1111111 1011110 0 0100001 0 0 0 0
 open_mnttab usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 open_mnttab lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-open_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-open_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-open_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 openat usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0
 openat lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0
 openat usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0
@@ -34145,12 +34053,6 @@
 proc_update_maps usr/lib/libproc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 0 0 0 0 0 0 0 0 0 0 1111111 1000000 0 0111111 0 0 0 0
 proc_walk lib/amd64/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 proc_walk lib/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-process_open usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-process_open usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-process_open lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 processor_bind usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 processor_bind lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 processor_bind usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -36415,18 +36317,6 @@
 rel_own_bydd usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 rel_own_bydd lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 relative_name usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
-reloc_init usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-reloc_init usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-reloc_init lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-reloc_process usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-reloc_process lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 reloc_table etc/lib/ld.so.1 1 48 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
 reloc_table usr/lib/ld.so.1 1 48 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0
 reloc_table lib/ld.so.1 1 48 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
@@ -37826,18 +37716,6 @@
 sctp_send usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sctp_sendmsg usr/lib/amd64/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sctp_sendmsg usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
-sdf_add usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sdf_add usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sdf_add lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sdf_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sdf_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 sdiv usr/lib/libmp.so.1 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0001111 0001110 0 0000001 0 0 0 0
 sdiv lib/libmp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sdssc_add_hosts usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
@@ -37927,12 +37805,6 @@
 se_tuple_name usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
 se_tuple_strings usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
 se_tuple_type usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
-sec_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sec_validate usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sec_validate lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 seconvert usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0
 seconvert lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 seconvert usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -39736,11 +39608,6 @@
 ssignal usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 ssignal usr/lib/libc/libc_hwcap2.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 ssignal lib/amd64/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
-st_new usr/lib/libld.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0001111 0 0001010 0000101 0 0 0 0
-st_new lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 stack_getbounds usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0
 stack_getbounds lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0
 stack_getbounds usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0
@@ -40394,24 +40261,6 @@
 swscanf usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0
 swscanf usr/lib/libc/libc_hwcap2.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0
 swscanf lib/amd64/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0
-sym_add_u usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sym_add_u usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sym_add_u lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sym_enter usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sym_enter lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sym_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sym_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 sym_ntop usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0
 sym_ntop lib/amd64/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
 sym_ntop lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
@@ -40421,12 +40270,6 @@
 sym_ston usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0
 sym_ston lib/amd64/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
 sym_ston lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
-sym_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-sym_validate usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-sym_validate lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 symlink usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 0 0 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1011110 0 0100001 0 0 0 0
 symlink usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0
 symlink lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0
@@ -42403,12 +42246,6 @@
 untouchwin usr/xpg4/lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.2 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 untouchwin lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 untouchwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
-update_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-update_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-update_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 update_panels usr/lib/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0
 update_panels usr/lib/amd64/libpanel.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 update_root_object usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
@@ -42688,30 +42525,6 @@
 verbosity lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 verr usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 verrx usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-vers_base usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-vers_base usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-vers_base lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-vers_check_defs usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-vers_check_defs lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-vers_desc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-vers_desc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0
-vers_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0
-vers_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
--- a/usr/src/tools/abi/etc/ABI_sparc.db	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/tools/abi/etc/ABI_sparc.db	Tue Mar 14 09:22:52 2006 -0800
@@ -5,9 +5,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.
@@ -17155,14 +17154,6 @@
 add_key_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 add_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-add_string usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-add_string usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-add_string usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-add_string usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-add_string lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-add_string lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 add_tnode lib/sparcv9/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_tnode lib/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 add_wch usr/xpg4/lib/sparcv9/libcurses.so.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
@@ -19841,16 +19832,12 @@
 calloc usr/lib/sparcv9/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 calloc usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0
 calloc usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-calloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-calloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 calloc usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 calloc usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0
 calloc usr/lib/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 calloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0
 calloc usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0
 calloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-calloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-calloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 calloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 calloc usr/lib/sparcv9/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0
 calloc usr/lib/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0
@@ -21227,14 +21214,6 @@
 create_event_service usr/lib/sparcv9/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_event_service usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_history_entry usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
-create_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-create_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-create_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-create_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-create_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-create_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 create_policy_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_policy_1 usr/lib/krb5/sparcv9/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
 create_principal_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0
@@ -22001,17 +21980,9 @@
 dbg_print etc/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 dbg_print usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 dbg_print usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
-dbg_print usr/lib/sparcv9/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-dbg_print usr/lib/sparcv9/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-dbg_print usr/lib/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-dbg_print usr/lib/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
 dbg_print usr/lib/libpicltree.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0001111 0 0001111 0 0 0 0 0
 dbg_print lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
 dbg_print lib/sparcv9/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-dbg_print lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 dbgstr2num usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 dbm_clearerr usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 SUNW_1.18 SUNW_1.1 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0
 dbm_clearerr usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 SUNW_1.18 SUNW_1.1 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0
@@ -24575,14 +24546,6 @@
 endwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 endzoneent usr/lib/sparcv9/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 endzoneent usr/lib/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-ent_setup usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ent_setup usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ent_setup usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ent_setup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ent_setup lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ent_setup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 enumerate_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 env usr/lib/libipsecutil.so.1 1 48 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 environ etc/lib/ld.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
@@ -24990,14 +24953,6 @@
 filter lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 find_p11i_slot usr/lib/libike.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0
 find_word usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000111 0 0000111 0 0 0 0 0
-finish_libs usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-finish_libs usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-finish_libs usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-finish_libs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-finish_libs lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-finish_libs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 finite usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 finite usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 finite lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -26080,8 +26035,6 @@
 free usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0
 free usr/lib/sparcv9/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 free usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-free usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-free usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 free usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 free usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0
 free usr/lib/libbsdmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
@@ -26090,8 +26043,6 @@
 free usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 free usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0
 free usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-free usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-free usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 free usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 free usr/lib/sparcv9/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
 free usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
@@ -33414,14 +33365,6 @@
 ld_file usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_file64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_file64 usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
-ld_main usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_main usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_main usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_main usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_main lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_main lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ld_section usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_section usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_section64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
@@ -33430,14 +33373,6 @@
 ld_start usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_start64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
 ld_start64 usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0
-ld_support_loadso usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_support_loadso usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_support_loadso usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_support_loadso usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ld_support_loadso lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ld_support_loadso lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ldapConfig usr/lib/libnisdb.so.2 1 60 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
 ldapDBTableMapping usr/lib/libnisdb.so.2 1 144 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
 ldapMappingList usr/lib/libnisdb.so.2 1 344 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
@@ -34474,10 +34409,6 @@
 lgrp_version usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0
 lgrp_view usr/lib/sparcv9/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0
 lgrp_view usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0
-libld_malloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-libld_malloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-libld_malloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-libld_malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 libtecla_version usr/lib/sparcv9/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0
 libtecla_version usr/lib/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0
 line usr/lib/sparcv9/libplot.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
@@ -34523,14 +34454,6 @@
 list_append usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0
 list_append usr/lib/print/psm-lpsched.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0
 list_append_unique usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0
-list_appendc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_appendc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_appendc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_appendc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_appendc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_appendc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 list_concatenate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0
 list_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1110000 0001111 0 0 0 0
 list_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
@@ -34544,33 +34467,9 @@
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
-list_insertc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_insertc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_insertc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_insertc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_insertc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_insertc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 list_ints usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 list_iterate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0
 list_locate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0
-list_prependc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_prependc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_prependc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_prependc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_prependc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_prependc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_where usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_where usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_where usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-list_where lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-list_where lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 listdev usr/lib/sparcv9/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 listdev usr/lib/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 listdev lib/sparcv9/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
@@ -34861,14 +34760,6 @@
 make_key_sched usr/lib/gss/do/sparcv9/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0
 make_key_sched usr/lib/gss/gl/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0
 make_key_sched usr/lib/gss/gl/sparcv9/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0
-make_sections usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-make_sections usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-make_sections usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-make_sections usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-make_sections lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-make_sections lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 makecontext usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 makecontext usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0
 makecontext usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 1111111 1111111 0 0 0 0 0 0
@@ -34903,8 +34794,6 @@
 malloc usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0
 malloc usr/lib/sparcv9/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 malloc usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-malloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-malloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 malloc usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 malloc usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0
 malloc usr/lib/libbsdmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
@@ -34913,8 +34802,6 @@
 malloc usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 malloc usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0
 malloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
-malloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
-malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0
 malloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 malloc usr/lib/sparcv9/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
 malloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0
@@ -38545,14 +38432,6 @@
 octet_to_hexascii lib/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 oextra usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0
 oextra usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0
-ofl_cleanup usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ofl_cleanup usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ofl_cleanup usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ofl_cleanup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-ofl_cleanup lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-ofl_cleanup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 ohix usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0
 ohix usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0
 ohiy usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0
@@ -38610,14 +38489,6 @@
 open_ldap_connection usr/lib/libldap.so.3 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0
 open_mnttab usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 open_mnttab lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-open_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-open_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-open_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-open_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-open_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-open_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 openat usr/lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0
 openat usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0
 openat lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0
@@ -40070,14 +39941,6 @@
 proc_update_maps usr/lib/libproc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0 0 0 0 0 0 0 0 1111111 1100000 0 0011111 0 0 0 0
 proc_walk lib/sparcv9/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 proc_walk lib/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-process_open usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-process_open usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-process_open usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-process_open usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-process_open lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-process_open lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 processor_bind usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 processor_bind usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 processor_bind lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -42694,22 +42557,6 @@
 rel_own_bydd usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
 rel_own_bydd lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 relative_name usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
-reloc_init usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_init usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_init usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_init usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_init lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_init lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_process usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_process usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_process usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-reloc_process lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-reloc_process lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 reloc_table etc/lib/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 reloc_table usr/lib/sparcv9/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
 reloc_table usr/lib/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0
@@ -44238,22 +44085,6 @@
 sctp_send usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sctp_sendmsg usr/lib/sparcv9/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sctp_sendmsg usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
-sdf_add usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_add usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_add usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_add usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_add lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_add lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sdf_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sdf_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 sdiv usr/lib/libmp.so.1 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0001111 0001110 0 0000001 0 0 0 0
 sdiv lib/libmp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 sdssc_add_hosts usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0
@@ -44360,14 +44191,6 @@
 se_tuple_strings usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
 se_tuple_type usr/lib/sparcv9/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
 se_tuple_type usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0
-sec_validate usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sec_validate usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sec_validate usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sec_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sec_validate lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sec_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 seconvert usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 seconvert usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 seconvert lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
@@ -46254,14 +46077,6 @@
 ssignal usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 ssignal lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
 ssignal lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0
-st_new usr/lib/sparcv9/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-st_new usr/lib/sparcv9/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-st_new usr/lib/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-st_new usr/lib/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0
-st_new lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-st_new lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 stack_getbounds usr/lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0
 stack_getbounds usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0
 stack_getbounds lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0
@@ -46939,30 +46754,6 @@
 swscanf usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.18 SUNW_1.18 SUNW_1.18 SUNW_1.20 SUNW_1.18 SUNW_1.21 SUNW_1.18 SUNW_1.21 SUNW_1.18 SUNW_1.21.2 SUNW_1.18 0 0 1111111 1111110 0 0000001 0 0 0 0
 swscanf lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0
 swscanf lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0
-sym_add_u usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_add_u usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_add_u usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_add_u usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_add_u lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_add_u lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_enter usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_enter usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_enter usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_enter lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_enter lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 sym_ntop usr/lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0
 sym_ntop usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0
 sym_ntop lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
@@ -46975,14 +46766,6 @@
 sym_ston usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0
 sym_ston lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
 sym_ston lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0
-sym_validate usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_validate usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_validate usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-sym_validate lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-sym_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 symlink usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0
 symlink usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0
 symlink usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0
@@ -49246,14 +49029,6 @@
 untouchwin usr/xpg4/lib/libcurses.so.2 0 0 0 0 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0011111 0011111 0 0 0 0 0 0
 untouchwin lib/sparcv9/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
 untouchwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0
-update_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-update_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-update_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-update_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-update_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-update_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 update_panels usr/lib/sparcv9/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 update_panels usr/lib/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0
 update_root_object usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0
@@ -49546,38 +49321,6 @@
 verbosity lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 verr usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
 verrx usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0
-vers_base usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_base usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_base usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_base usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_base lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_base lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_check_defs usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_check_defs usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_check_defs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_check_defs lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_check_defs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_desc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_desc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_desc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_desc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_desc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0
-vers_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
-vers_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
 version usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0
--- a/usr/src/tools/scripts/check_rtime.pl	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/tools/scripts/check_rtime.pl	Tue Mar 14 09:22:52 2006 -0800
@@ -127,8 +127,7 @@
 	librtld_db\.so\.1 |		#  "	"	"	"
 	libc_db\.so\.1 |		#  "	"	"	"
 	libldstab\.so\.1 |		# link-edit support libraries have
-	libld\.so\.3 |			# callback to the link-editors
-	libld\.so\.2 |			#  "	"	"	"
+	libld\.so\.[2-4] |			# callback to the link-editors
 	liblddbg\.so\.4 |		#  "	"	"	"
 	librtld\.so\.1 |		#  "	"	"	"
 	libnisdb\.so\.2 |		# C++
--- a/usr/src/uts/common/krtld/reloc.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/common/krtld/reloc.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -37,6 +36,7 @@
 #include <sys/kobj_impl.h>
 #else
 #include <machdep.h>
+#include <rtld.h>
 #include <conv.h>
 #endif /* _KERNEL */
 
@@ -81,7 +81,22 @@
 						/*    locally */
 
 /*
- * Macros for testing relocation table flags
+ * In user land, redefine the relocation table and relocation engine to be
+ * class specific if necessary.  This allows both engines to reside in the
+ * intel/amd version of libld.
+ */
+#if	!defined(_KERNEL)
+#if	defined(_ELF64)
+#define	do_reloc		do64_reloc
+#define	reloc_table		reloc64_table
+#else
+#define	do_reloc		do32_reloc
+#define	reloc_table		reloc32_table
+#endif
+#endif
+
+/*
+ * Relocation table and macros for testing relocation table flags.
  */
 extern	const Rel_entry		reloc_table[];
 
@@ -107,53 +122,38 @@
 					FLG_RE_ADDRELATIVE) != 0)
 #define	IS_REGISTER(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_REGISTER) != 0)
-#define	IS_FORMOFF(X)		((reloc_table[(X)].re_flags &\
+#define	IS_FORMOFF(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_FRMOFF) != 0)
-#define	IS_NOTSUP(X)		((reloc_table[(X)].re_flags &\
+#define	IS_NOTSUP(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_NOTSUP) != 0)
-#define	IS_SEG_RELATIVE(X)	((reloc_table[(X)].re_flags &\
+#define	IS_SEG_RELATIVE(X)	((reloc_table[(X)].re_flags & \
 					FLG_RE_SEGREL) != 0)
-#define	IS_EXTOFFSET(X)		((reloc_table[(X)].re_flags &\
+#define	IS_EXTOFFSET(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_EXTOFFSET) != 0)
-#define	IS_SEC_RELATIVE(X)	((reloc_table[(X)].re_flags &\
+#define	IS_SEC_RELATIVE(X)	((reloc_table[(X)].re_flags & \
 					FLG_RE_SECREL) != 0)
-#define	IS_TLS_INS(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS_INS(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_TLSINS) != 0)
-#define	IS_TLS_GD(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS_GD(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_TLSGD) != 0)
-#define	IS_TLS_LD(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS_LD(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_TLSLD) != 0)
-#define	IS_TLS_IE(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS_IE(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_TLSIE) != 0)
-#define	IS_TLS_LE(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS_LE(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_TLSLE) != 0)
-#define	IS_TLS(X)		((reloc_table[(X)].re_flags &\
+#define	IS_TLS(X)		((reloc_table[(X)].re_flags & \
 					(FLG_RE_TLSINS|FLG_RE_TLSGD| \
 					FLG_RE_TLSLD|FLG_RE_TLSIE| \
 					FLG_RE_TLSLE)) != 0)
-#define	IS_LOCALBND(X)		((reloc_table[(X)].re_flags &\
+#define	IS_LOCALBND(X)		((reloc_table[(X)].re_flags & \
 					FLG_RE_LOCLBND) != 0)
 
 /*
- * Functions.
+ * Relocation engine.
  */
 extern	int	do_reloc(uchar_t, uchar_t *, Xword *, const char *,
-		    const char *);
-
-/*
- * Provide a macro to select the appropriate convension routine for this
- * architecture.
- */
-#if defined(__amd64)
-#define	CONV_RELOC_TYPE		conv_reloc_amd64_type_str
-#elif defined(__i386)
-#define	CONV_RELOC_TYPE		conv_reloc_386_type_str
-#elif defined(__sparc)
-#define	CONV_RELOC_TYPE		conv_reloc_SPARC_type_str
-#else
-#error platform not defined!
-#endif
-
+		    const char *, void *);
 
 #if defined(_KERNEL)
 /*
@@ -182,49 +182,68 @@
 #define	MSG_REL_OFFSET		"offset 0x%llx"
 #define	MSG_REL_NOFIT		"value 0x%llx does not fit"
 
-extern const char	 *conv_reloc_386_type_str(uint_t);
-extern const char	 *conv_reloc_amd64_type_str(uint_t);
-extern const char	 *conv_reloc_SPARC_type_str(uint_t);
+/*
+ * Provide a macro to select the appropriate conversion routine for this
+ * architecture.
+ */
+#if defined(__amd64)
+
+extern const char	*conv_reloc_amd64_type(Word);
+#define	CONV_RELOC_TYPE	conv_reloc_amd64_type
+
+#elif defined(__i386)
+
+extern const char	*conv_reloc_386_type(Word);
+#define	CONV_RELOC_TYPE	conv_reloc_386_type
+
+#elif defined(__sparc)
+
+extern const char	*conv_reloc_SPARC_type(Word);
+#define	CONV_RELOC_TYPE	conv_reloc_SPARC_type
+
+#else
+#error platform not defined!
+#endif
 
 /*
- * Note:  Related to bug 4128755, dlerror() only keeps track of a single error
- * string, and therefore must have errors reported through a single eprintf()
- * call.  The kernel's _kobj_printf is somewhat more limited, and must receive
- * messages with only one arguement to the format string.  The following macros
- * are to straighted all this out because krtld and rtld share do_reloc().
+ * Note:  dlerror() only keeps track of a single error string, and therefore
+ * must have errors reported through a single eprintf() call.  The kernel's
+ * _kobj_printf is somewhat more limited, and must receive messages with only
+ * one argument to the format string.  The following macros account for these
+ * differences, as krtld and rtld share do_reloc().
  */
-#define	REL_ERR_UNIMPL(file, sym, rtype) \
+#define	REL_ERR_UNIMPL(lml, file, sym, rtype) \
 	_kobj_printf(ops, MSG_REL_PREFIL, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
 	_kobj_printf(ops, MSG_REL_UNIMPL, (int)(rtype))
 
-#define	REL_ERR_UNSUPSZ(file, sym, rtype, size) \
+#define	REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \
 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
 	_kobj_printf(ops, MSG_REL_UNSUPSZ, (int)(size))
 
-#define	REL_ERR_NONALIGN(file, sym, rtype, off) \
+#define	REL_ERR_NONALIGN(lml, file, sym, rtype, off) \
 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
 	_kobj_printf(ops, MSG_REL_NONALIGN, EC_OFF((off)))
 
-#define	REL_ERR_UNNOBITS(file, sym, rtype, nbits) \
+#define	REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \
 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
 	_kobj_printf(ops, MSG_REL_UNNOBITS, (nbits))
 
-#define	REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \
+#define	REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \
 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
 	_kobj_printf(ops, MSG_REL_VALUE, EC_XWORD((uvalue))); \
 	_kobj_printf(ops, MSG_REL_LOSEBITS, (int)(nbits)); \
-	_kobj_printf(ops, MSG_REL_OFFSET, EC_ADDR((off)))
+	_kobj_printf(ops, MSG_REL_OFFSET, EC_NATPTR((off)))
 
-#define	REL_ERR_NOFIT(file, sym, rtype, uvalue) \
+#define	REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \
 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
@@ -235,34 +254,34 @@
 
 extern	const char *demangle(const char *);
 
-#define	REL_ERR_UNIMPL(file, sym, rtype) \
-	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), (file), \
+#define	REL_ERR_UNIMPL(lml, file, sym, rtype) \
+	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(rtype)))
 
-#define	REL_ERR_UNSUPSZ(file, sym, rtype, size) \
-	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNSUPSZ), \
-	    CONV_RELOC_TYPE((rtype)), (file), \
+#define	REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \
+	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNSUPSZ), \
+	    conv_reloc_type(M_MACH, (rtype)), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(size)))
 
-#define	REL_ERR_NONALIGN(file, sym, rtype, off) \
-	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \
-	    CONV_RELOC_TYPE((rtype)), (file), \
+#define	REL_ERR_NONALIGN(lml, file, sym, rtype, off) \
+	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \
+	    conv_reloc_type(M_MACH, (rtype)), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), EC_OFF((off))))
 
-#define	REL_ERR_UNNOBITS(file, sym, rtype, nbits) \
-	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \
-	    CONV_RELOC_TYPE((rtype)), (file), \
+#define	REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \
+	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \
+	    conv_reloc_type(M_MACH, (rtype)), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (nbits)))
 
-#define	REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \
-	(eprintf(ERR_FATAL,  MSG_INTL(MSG_REL_LOSEBITS), \
-	    CONV_RELOC_TYPE((rtype)), (file), \
+#define	REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \
+	(eprintf(lml, ERR_FATAL,  MSG_INTL(MSG_REL_LOSEBITS), \
+	    conv_reloc_type(M_MACH, (rtype)), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
-	    EC_XWORD((uvalue)), (nbits), EC_ADDR((off))))
+	    EC_XWORD((uvalue)), (nbits), EC_NATPTR((off))))
 
-#define	REL_ERR_NOFIT(file, sym, rtype, uvalue) \
-	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \
-	    CONV_RELOC_TYPE((rtype)), (file), \
+#define	REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \
+	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \
+	    conv_reloc_type(M_MACH, (rtype)), (file), \
 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
 	    EC_XWORD((uvalue))))
 
--- a/usr/src/uts/intel/amd64/krtld/doreloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/amd64/krtld/doreloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -151,14 +150,14 @@
  *
  *	S	Represents the value of the symbol whose index resides
  *		in the relocation entry.
- *
  */
 
 #define	HIBITS	0xffffffff80000000ULL
 
+/* ARGSUSED5 */
 int
 do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
-    const char *file)
+    const char *file, void *lml)
 {
 	const Rel_entry	*rep;
 
@@ -199,7 +198,7 @@
 				 * To keep chkmsg() happy:
 				 *  MSG_INTL(MSG_REL_NOFIT)
 				 */
-				REL_ERR_NOFIT(file, sym, rtype, *value);
+				REL_ERR_NOFIT(lml, file, sym, rtype, *value);
 				return (0);
 			}
 		} else if ((rtype == R_AMD64_32S) || (rtype == R_AMD64_PC32) ||
@@ -215,7 +214,7 @@
 				 * To keep chkmsg() happy:
 				 *  MSG_INTL(MSG_REL_NOFIT)
 				 */
-				REL_ERR_NOFIT(file, sym, rtype, *value);
+				REL_ERR_NOFIT(lml, file, sym, rtype, *value);
 				return (0);
 			}
 		}
@@ -230,7 +229,7 @@
 		/*
 		 * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ)
 		 */
-		REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize);
+		REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize);
 		return (0);
 	}
 	return (1);
--- a/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -58,7 +57,7 @@
  * the relocation to it's full syntax.
  */
 const char *
-conv_reloc_amd64_type_str(uint_t type)
+conv_reloc_amd64_type(Word type)
 {
 	static char 	strbuf[32];
 	int		ndx = 31;
--- a/usr/src/uts/intel/amd64/krtld/kobj_reloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/amd64/krtld/kobj_reloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -181,7 +181,7 @@
 			symp = (Sym *)
 				(mp->symtbl+(stndx * mp->symhdr->sh_entsize));
 			_kobj_printf(ops, "krtld:\t%s",
-				conv_reloc_amd64_type_str(rtype));
+				conv_reloc_amd64_type(rtype));
 			_kobj_printf(ops, "\t0x%8llx", off);
 			_kobj_printf(ops, " 0x%8llx", addend);
 			_kobj_printf(ops, "  %s\n",
@@ -267,7 +267,7 @@
 
 		if (do_reloc(rtype, (unsigned char *)off, &value,
 		    (const char *)mp->strings + symref->st_name,
-		    mp->filename) == 0)
+		    mp->filename, 0) == 0)
 			err = 1;
 
 	} /* end of while loop */
--- a/usr/src/uts/intel/ia32/krtld/doreloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/ia32/krtld/doreloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -161,9 +160,10 @@
  * been performed before calling this function except for the addition of
  * the addresses in the instructions.
  */
+/* ARGSUSED5 */
 int
 do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
-    const char *file)
+    const char *file, void *lml)
 {
 	const Rel_entry	*rep;
 
@@ -186,7 +186,7 @@
 		/*
 		 * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ)
 		 */
-		REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize);
+		REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize);
 		return (0);
 	}
 	return (1);
--- a/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -61,7 +60,7 @@
  * the relocation to it's full syntax.
  */
 const char *
-conv_reloc_386_type_str(uint_t type)
+conv_reloc_386_type(Word type)
 {
 	static char 	strbuf[32];
 	int		ndx = 31;
--- a/usr/src/uts/intel/ia32/krtld/kobj_reloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/ia32/krtld/kobj_reloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -177,7 +177,7 @@
 			symp = (Sym *)
 				(mp->symtbl+(stndx * mp->symhdr->sh_entsize));
 			_kobj_printf(ops, "krtld:\t%s",
-				conv_reloc_386_type_str(rtype));
+				conv_reloc_386_type(rtype));
 			_kobj_printf(ops, "\t0x%8x", off);
 			_kobj_printf(ops, "  %s\n",
 			    (const char *)mp->strings + symp->st_name);
@@ -260,7 +260,7 @@
 
 		if (do_reloc(rtype, (unsigned char *)off, (Word *)&value,
 		    (const char *)mp->strings + symref->st_name,
-		    mp->filename) == 0)
+		    mp->filename, 0) == 0)
 			err = 1;
 
 	} /* end of while loop */
--- a/usr/src/uts/intel/sys/machelf.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/intel/sys/machelf.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -39,13 +39,15 @@
 #include <sys/elf_386.h>
 #endif
 #ifndef	_ASM
+#include <sys/types.h>
 #include <sys/elf.h>
 #include <sys/link.h>	/* for Elf*_Dyn */
 #endif	/* _ASM */
+
 /*
  * Make machine class dependent data types transparent to the common code
  */
-#if defined(_ELF64) && ! defined(_ELF32_COMPAT)
+#if defined(_ELF64) && !defined(_ELF32_COMPAT)
 
 #ifndef	_ASM
 typedef	Elf64_Xword	Xword;
@@ -56,7 +58,7 @@
 typedef	Elf64_Half	Half;
 typedef	Elf64_Addr	Addr;
 typedef	Elf64_Off	Off;
-typedef	unsigned char	Byte;
+typedef	uchar_t		Byte;
 #endif	/* _ASM */
 
 #if defined(_KERNEL)
@@ -93,14 +95,13 @@
  */
 typedef struct {
 	Word		re_flags;	/* relocation attributes */
-	unsigned char	re_fsize;	/* field size (in #bytes) */
-	unsigned char	re_sigbits;	/* # of significant bits */
+	uchar_t		re_fsize;	/* field size (in bytes) */
+	uchar_t		re_sigbits;	/* number of significant bits */
 } Rel_entry;
 
-#endif /* _ASM */
+#endif	/* _ASM */
 
-
-#else  /* _ILP32 */
+#else	/* _ILP32 */
 
 #ifndef	_ASM
 typedef	Elf32_Word	Xword;	/* Xword/Sxword are 32-bits in Elf32 */
@@ -111,7 +112,7 @@
 typedef	Elf32_Half	Half;
 typedef	Elf32_Addr	Addr;
 typedef	Elf32_Off	Off;
-typedef	unsigned char	Byte;
+typedef	uchar_t		Byte;
 #endif	/* _ASM */
 
 #if defined(_KERNEL)
@@ -128,9 +129,9 @@
 typedef	Elf32_Ehdr	Ehdr;
 typedef	Elf32_Shdr	Shdr;
 typedef	Elf32_Sym	Sym;
-typedef Elf32_Syminfo	Syminfo;
+typedef	Elf32_Syminfo	Syminfo;
+typedef	Elf32_Rela	Rela;
 typedef	Elf32_Rel	Rel;
-typedef	Elf32_Rela	Rela;
 typedef	Elf32_Nhdr	Nhdr;
 typedef	Elf32_Phdr	Phdr;
 typedef	Elf32_Dyn	Dyn;
@@ -147,42 +148,48 @@
  * Structure used to build the reloc_table[]
  */
 typedef struct {
-	unsigned int	re_flags;	/* relocation attributes */
-	unsigned char	re_fsize;	/* field size (in #bytes) */
+	uint_t		re_flags;	/* relocation attributes */
+	uchar_t		re_fsize;	/* field size (in bytes) */
 } Rel_entry;
 
-#endif /* _ASM */
-
+#endif	/* _ASM */
 
-#endif /* _ILP32 */
-
+#endif	/* _ILP32 */
 
 /*
- *  Elf `printf' type-cast macros.  These force arguements to
- *  be a fixed size so that Elf32 and Elf64 can share common
- *  format strings.
+ * Elf `printf' type-cast macros.  These force arguments to be a fixed size
+ * so that Elf32 and Elf64 can share common format strings.
  */
-#ifndef __lint
-#define	EC_ADDR(a)	((Elf64_Addr)(uintptr_t)(a))	/* "ull" */
-#define	EC_OFF(a)	((Elf64_Off)(a))	/* "ll"  */
-#define	EC_HALF(a)	((Elf64_Half)(a))	/* "d"   */
-#define	EC_WORD(a)	((Elf64_Word)(a))	/* "u"   */
-#define	EC_SWORD(a)	((Elf64_Sword)(a))	/* "d"   */
-#define	EC_XWORD(a)	((Elf64_Xword)(a))	/* "ull" */
-#define	EC_SXWORD(a)	((Elf64_Sxword)(a))	/* "ll"  */
-#define	EC_LWORD(a)	((Elf64_Lword)(a))	/* "ull" */
+#ifndef	__lint
+#define	EC_ADDR(a)	((Elf64_Addr)(a))		/* "ull" */
+#define	EC_OFF(a)	((Elf64_Off)(a))		/* "ull"  */
+#define	EC_HALF(a)	((Elf64_Half)(a))		/* "d"   */
+#define	EC_WORD(a)	((Elf64_Word)(a))		/* "u"   */
+#define	EC_SWORD(a)	((Elf64_Sword)(a))		/* "d"   */
+#define	EC_XWORD(a)	((Elf64_Xword)(a))		/* "ull" */
+#define	EC_SXWORD(a)	((Elf64_Sxword)(a))		/* "ll"  */
+#define	EC_LWORD(a)	((Elf64_Lword)(a))		/* "ull" */
+
+/*
+ * A native pointer is special.  Although it can be convenient to display
+ * these from a common format (ull), compilers may flag the cast of a pointer
+ * to an integer as illegal.  Casting these pointers to the native pointer
+ * size, suppresses any compiler errors.
+ */
+#define	EC_NATPTR(a)	((Elf64_Xword)(uintptr_t)(a))	/* "ull" */
 #else
-#define	EC_ADDR(a)	((unsigned long long)(a))
-#define	EC_OFF(a)	((long long)(a))
-#define	EC_HALF(a)	((Elf64_Half)(a))
-#define	EC_WORD(a)	((Elf64_Word)(a))
-#define	EC_SWORD(a)	((Elf64_Sword)(a))
-#define	EC_XWORD(a)	((unsigned long long)(a))
-#define	EC_SXWORD(a)	((long long)(a))
-#define	EC_LWORD(a)	((unsigned long long)(a))
+#define	EC_ADDR(a)	((u_longlong_t)(a))
+#define	EC_OFF(a)	((u_longlong_t)(a))
+#define	EC_HALF(a)	((ushort_t)(a))
+#define	EC_WORD(a)	((uint_t)(a))
+#define	EC_SWORD(a)	((int)(a))
+#define	EC_XWORD(a)	((u_longlong_t)(a))
+#define	EC_SXWORD(a)	((longlong_t)(a))
+#define	EC_LWORD(a)	((u_longlong_t)(a))
+
+#define	EC_NATPTR(a)	((u_longlong_t)(a))
 #endif
 
-
 #ifdef	__cplusplus
 }
 #endif
--- a/usr/src/uts/sparc/krtld/doreloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/sparc/krtld/doreloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -130,8 +129,8 @@
 				8, 0, 0},
 /* R_SPARC_PLT64 */	{0x0, FLG_RE_PLTREL | FLG_RE_VERIFY |
 				FLG_RE_ADDRELATIVE, 8, 0, 0},
-/* R_SPARC_HIX22 */	{(Xword)(-1LL), FLG_RE_NOTREL | FLG_RE_VERIFY,
-				4, 10, 22},	/* V9 - HaL */
+/* R_SPARC_HIX22 */	{(Xword)(-1LL), FLG_RE_VERIFY,
+				4, 10, 22},			/* V9 - HaL */
 /* R_SPARC_LOX10 */	{0x3ff, FLG_RE_SIGN, 4, 0, 13},		/* V9 - HaL */
 /* R_SPARC_H44 */	{0x0, FLG_RE_VERIFY, 4, 22, 22},	/* V9 */
 /* R_SPARC_M44 */	{0x3ff, FLG_RE_NOTREL, 4, 12, 10},	/* V9 */
@@ -183,8 +182,7 @@
 /* R_SPARC_GOTDATA_OP_LOX10 */	{ 0x3ff, FLG_RE_SIGN | FLG_RE_GOTOPINS |
 					FLG_RE_GOTADD, 4, 0, 13},
 /* R_SPARC_GOTDATA_OP */	{ 0x0, FLG_RE_GOTOPINS, 0, 0, 0},
-/* R_SPARC_H34 */	{0x0, FLG_RE_NOTREL | FLG_RE_VERIFY, 4,
-				12, 22} /* V9 */
+/* R_SPARC_H34 */	{0x0, FLG_RE_VERIFY, 4, 12, 22}		/* V9 */
 };
 
 
@@ -345,10 +343,10 @@
  * Upon successful completion of do_reloc() *value will be set to the
  * 'bit-shifted' value that will be or'ed into memory.
  */
-/* ARGSUSED3 */
+/* ARGSUSED5 */
 int
 do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
-    const char *file)
+    const char *file, void *lml)
 {
 	Xword			uvalue = 0;
 	Xword			basevalue, sigbit_mask, sigfit_mask;
@@ -374,7 +372,7 @@
 		sigfit_mask = sigbit_mask;
 
 	if (field_size == 0) {
-		REL_ERR_UNIMPL(file, sym, rtype);
+		REL_ERR_UNIMPL(lml, file, sym, rtype);
 		return (0);
 	}
 
@@ -397,7 +395,7 @@
 		if (((field_size == 2) && ((uintptr_t)off & 0x1)) ||
 		    ((field_size == 4) && ((uintptr_t)off & 0x3)) ||
 		    ((field_size == 8) && ((uintptr_t)off & 0x7))) {
-			REL_ERR_NONALIGN(file, sym, rtype, (uintptr_t)off);
+			REL_ERR_NONALIGN(lml, file, sym, rtype, (uintptr_t)off);
 			return (0);
 		}
 		switch (field_size) {
@@ -417,7 +415,8 @@
 			basevalue = (Xword)*((Xword *)off);
 			break;
 		default:
-			REL_ERR_UNNOBITS(file, sym, rtype, rep->re_fsize * 8);
+			REL_ERR_UNNOBITS(lml, file, sym, rtype,
+			    (rep->re_fsize * 8));
 			return (0);
 		}
 	}
@@ -460,7 +459,7 @@
 		 * jump to a non-4 byte aligned address.
 		 */
 		if ((bshift == 2) && (uvalue & 0x3)) {
-			REL_ERR_LOSEBITS(file, sym, rtype, uvalue, 2, off);
+			REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, 2, off);
 			return (0);
 		}
 
@@ -500,7 +499,7 @@
 		    (S_INRANGE((Sxword)uvalue, rep->re_sigbits - 1) == 0)) ||
 		    (!(re_flags & FLG_RE_SIGN) &&
 		    ((sigbit_mask & uvalue) != uvalue))) {
-			REL_ERR_NOFIT(file, sym, rtype, uvalue);
+			REL_ERR_NOFIT(lml, file, sym, rtype, uvalue);
 			return (0);
 		}
 	}
@@ -558,7 +557,7 @@
 			/*
 			 * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ)
 			 */
-			REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize);
+			REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize);
 			return (0);
 		}
 	}
--- a/usr/src/uts/sparc/krtld/kobj_convrelstr.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/sparc/krtld/kobj_convrelstr.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -85,7 +84,7 @@
  * the relocation to it's full syntax.
  */
 const char *
-conv_reloc_SPARC_type_str(uint_t type)
+conv_reloc_SPARC_type(Word type)
 {
 	static char 	strbuf[32];
 	int		ndx = 31;
--- a/usr/src/uts/sparc/krtld/kobj_reloc.c	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/sparc/krtld/kobj_reloc.c	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -230,7 +230,7 @@
 			symp = (Sym *)
 			    (mp->symtbl+(stndx * mp->symhdr->sh_entsize));
 			_kobj_printf(ops, "krtld:\t%s",
-			    conv_reloc_SPARC_type_str(rtype));
+			    conv_reloc_SPARC_type(rtype));
 			_kobj_printf(ops, "\t0x%8llx", off);
 			_kobj_printf(ops, " 0x%8llx", addend);
 			_kobj_printf(ops, "  %s\n",
@@ -326,7 +326,7 @@
 #endif
 		if (do_reloc(rtype, (unsigned char *)off, (Xword *)&value,
 		    (const char *)mp->strings + symref->st_name,
-		    mp->filename) == 0)
+		    mp->filename, 0) == 0)
 			err = 1;
 	} /* end of while loop */
 
--- a/usr/src/uts/sparc/sys/machelf.h	Tue Mar 14 09:14:42 2006 -0800
+++ b/usr/src/uts/sparc/sys/machelf.h	Tue Mar 14 09:22:52 2006 -0800
@@ -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,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -29,16 +29,17 @@
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
 #include <sys/elf_SPARC.h>
 #ifndef	_ASM
+#include <sys/types.h>
 #include <sys/elf.h>
 #include <sys/link.h>	/* for Elf*_Dyn */
 #endif	/* _ASM */
 
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
 /*
  * Make machine class dependent data types transparent to the common code
  */
@@ -53,7 +54,7 @@
 typedef	Elf64_Half	Half;
 typedef	Elf64_Addr	Addr;
 typedef	Elf64_Off	Off;
-typedef	unsigned char	Byte;
+typedef	uchar_t		Byte;
 #endif	/* _ASM */
 
 #if defined(_KERNEL)
@@ -87,7 +88,7 @@
 typedef	Elf64_Cap	Cap;
 #endif	/* _ASM */
 
-#else  /* _ILP32 */
+#else	/* _ILP32 */
 
 #ifndef	_ASM
 typedef	Elf32_Word	Xword;	/* Xword/Sxword are 32-bits in Elf32 */
@@ -98,7 +99,7 @@
 typedef	Elf32_Half	Half;
 typedef	Elf32_Addr	Addr;
 typedef	Elf32_Off	Off;
-typedef	unsigned char	Byte;
+typedef	uchar_t		Byte;
 #endif	/* _ASM */
 
 #if defined(_KERNEL)
@@ -132,36 +133,42 @@
 typedef	Elf32_Cap	Cap;
 #endif	/* _ASM */
 
-#endif /* _ILP32 */
-
-
+#endif	/* _ILP32 */
 
 /*
- *  Elf `printf' type-cast macros.  These force arguements to
- *  be a fixed size so that Elf32 and Elf64 can share common
- *  format strings.
+ * Elf `printf' type-cast macros.  These force arguments to be a fixed size
+ * so that Elf32 and Elf64 can share common format strings.
  */
 #ifndef	__lint
-#define	EC_ADDR(a)	((Elf64_Addr)(uintptr_t)(a))	/* "ull" */
-#define	EC_OFF(a)	((Elf64_Off)(a))	/* "ll"  */
-#define	EC_HALF(a)	((Elf64_Half)(a))	/* "d"   */
-#define	EC_WORD(a)	((Elf64_Word)(a))	/* "u"   */
-#define	EC_SWORD(a)	((Elf64_Sword)(a))	/* "d"   */
-#define	EC_XWORD(a)	((Elf64_Xword)(a))	/* "ull" */
-#define	EC_SXWORD(a)	((Elf64_Sxword)(a))	/* "ll"  */
-#define	EC_LWORD(a)	((Elf64_Lword)(a))	/* "ull" */
+#define	EC_ADDR(a)	((Elf64_Addr)(a))		/* "ull" */
+#define	EC_OFF(a)	((Elf64_Off)(a))		/* "ull"  */
+#define	EC_HALF(a)	((Elf64_Half)(a))		/* "d"   */
+#define	EC_WORD(a)	((Elf64_Word)(a))		/* "u"   */
+#define	EC_SWORD(a)	((Elf64_Sword)(a))		/* "d"   */
+#define	EC_XWORD(a)	((Elf64_Xword)(a))		/* "ull" */
+#define	EC_SXWORD(a)	((Elf64_Sxword)(a))		/* "ll"  */
+#define	EC_LWORD(a)	((Elf64_Lword)(a))		/* "ull" */
+
+/*
+ * A native pointer is special.  Although it can be convenient to display
+ * these from a common format (ull), compilers may flag the cast of a pointer
+ * to an integer as illegal.  Casting these pointers to the native pointer
+ * size, suppresses any compiler errors.
+ */
+#define	EC_NATPTR(a)	((Elf64_Xword)(uintptr_t)(a))	/* "ull" */
 #else
-#define	EC_ADDR(a)	((unsigned long long)(a))
-#define	EC_OFF(a)	((unsigned long long)(a))
-#define	EC_HALF(a)	((Elf64_Half)(a))
-#define	EC_WORD(a)	((Elf64_Word)(a))
-#define	EC_SWORD(a)	((Elf64_Sword)(a))
-#define	EC_XWORD(a)	((unsigned long long)(a))
-#define	EC_SXWORD(a)	((long long)(a))
-#define	EC_LWORD(a)	((unsigned long long)(a))
+#define	EC_ADDR(a)	((u_longlong_t)(a))
+#define	EC_OFF(a)	((u_longlong_t)(a))
+#define	EC_HALF(a)	((ushort_t)(a))
+#define	EC_WORD(a)	((uint_t)(a))
+#define	EC_SWORD(a)	((int)(a))
+#define	EC_XWORD(a)	((u_longlong_t)(a))
+#define	EC_SXWORD(a)	((longlong_t)(a))
+#define	EC_LWORD(a)	((u_longlong_t)(a))
+
+#define	EC_NATPTR(a)	((u_longlong_t)(a))
 #endif
 
-
 #ifndef	_ASM
 /*
  * Structure used to build the reloc_table[]
@@ -169,12 +176,12 @@
 typedef struct {
 	Xword		re_mask;	/* mask to apply to reloc */
 	Word		re_flags;	/* relocation attributes */
-	unsigned char	re_fsize;	/* field size (in # bytes) */
-	unsigned char	re_bshift;	/* # of bits to shift */
-	unsigned char	re_sigbits;	/* # of significant bits */
+	uchar_t		re_fsize;	/* field size (in bytes) */
+	uchar_t		re_bshift;	/* number of bits to shift */
+	uchar_t		re_sigbits;	/* number of significant bits */
 } Rel_entry;
 
-#endif
+#endif	/* _ASM */
 
 #ifdef	__cplusplus
 }