--- old/exception_lists/check_rtime	2019-07-14 19:11:50.231083091 +0000
+++ new/exception_lists/check_rtime	2019-07-14 19:11:50.250611957 +0000
@@ -251,3 +251,11 @@
 # one size fits all approach causes an object to be linked against an
 # unneeded library.
 UNREF_OBJ	lib/(libdevinfo|libcfgadm)\.so\.1; .*\ of\ .*SUNW,Netra-CP2300/lib/libprtdiag_psr\.so\.1
+
+#
+# the SUNWonld directory contains built versions of demos, built only to
+# ensure their correctness.
+#
+EXEC_STACK	^opt/SUNWonld
+EXEC_DATA	^opt/SUNWonld
+NODIRECT	^opt/SUNWonld
--- old/exception_lists/packaging	2019-07-14 19:11:50.779034321 +0000
+++ new/exception_lists/packaging	2019-07-14 19:11:50.796867444 +0000
@@ -858,3 +858,29 @@
 usr/lib/amd64/libjedec.so	i386
 usr/lib/sparcv9/libjedec.so	sparc
 usr/lib/libjedec.so
+
+#
+# the tools copy of the link-editor is not delivered
+#
+opt/onbld/bin/i386/ld			i386
+opt/onbld/bin/sparc/ld			sparc
+opt/onbld/bin/i386/sgsmsg		i386
+opt/onbld/bin/sparc/sgsmsg		sparc
+opt/onbld/lib/i386/libelf.so		i386
+opt/onbld/lib/i386/libelf.so.1		i386
+opt/onbld/lib/i386/libld.so		i386
+opt/onbld/lib/i386/libld.so.4		i386
+opt/onbld/lib/i386/liblddbg.so		i386
+opt/onbld/lib/i386/liblddbg.so.4	i386
+opt/onbld/lib/sparc/libelf.so		sparc
+opt/onbld/lib/sparc/libelf.so.1		sparc
+opt/onbld/lib/sparc/libld.so		sparc
+opt/onbld/lib/sparc/libld.so.4		sparc
+opt/onbld/lib/sparc/liblddbg.so		sparc
+opt/onbld/lib/sparc/liblddbg.so.4	sparc
+opt/onbld/man/man1onbld/sgsmsg.1onbld
+
+#
+# The built link-editor demos are not delivered
+#
+opt/SUNWonld/
--- old/usr/src/Makefile.master	2019-07-14 19:11:51.294076478 +0000
+++ new/usr/src/Makefile.master	2019-07-14 19:11:51.310865772 +0000
@@ -850,6 +850,7 @@
 CW_CC_COMPILERS=	$(PRIMARY_CC:%=--primary %) $(SHADOW_CCS:%=--shadow %)
 CW_CCC_COMPILERS=	$(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %)
 
+CW_LINKER=		--linker $(LD)
 
 # Till SS12u1 formally becomes the NV CBE, LINT is hard
 # coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
@@ -863,10 +864,10 @@
 #
 CW=			$(ONBLD_TOOLS)/bin/$(MACH)/cw
 
-BUILD_CC=		$(CW) $(CW_CC_COMPILERS) --
-BUILD_CCC=		$(CW) -C $(CW_CCC_COMPILERS) --
+BUILD_CC=		$(CW) $(CW_LINKER) $(CW_CC_COMPILERS) --
+BUILD_CCC=		$(CW) -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
 BUILD_CPP=		/usr/ccs/lib/cpp
-BUILD_LD=		/usr/ccs/bin/ld
+BUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH)/ld
 BUILD_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
 
 $(MACH)_CC=		$(BUILD_CC)
--- old/usr/src/cmd/sgs/Makefile	2019-07-14 19:11:51.770402997 +0000
+++ new/usr/src/cmd/sgs/Makefile	2019-07-14 19:11:51.785710231 +0000
@@ -115,7 +115,7 @@
 
 .PARALLEL:	$(SUBDIRS)
 
-all install:	native-add .WAIT $(SUBDIRS)
+all install:	$(SUBDIRS)
 
 include		$(SRC)/cmd/Makefile.targ
 
@@ -125,8 +125,7 @@
 
 _msg_gettext: $(MSGDOMAIN)/$(POFILE)
 
-# $(MACH)/sgsmsg must be built before we can descend into $(MSGDIR)
-_msg_sgsmsg: native-add .WAIT $(MSGDIR)
+_msg_sgsmsg: $(MSGDIR)
 
 $(MSGDOMAIN)/$(POFILE): \
 		$(MSGDOMAIN) $(POFILE)
@@ -149,39 +148,18 @@
 
 lint:
 
-delete \
-clean clobber:	native-clobber .WAIT $(SUBDIRS) $(MSGDIR)
+delete clean clobber: $(SUBDIRS) $(MSGDIR)
 
 $(SUBDIRS):	FRC
 		@ cd $@; pwd; $(MAKE) $(TARGET)
 
-
-# Integration of ld and ld.so.1 in some developement cycles requires that both
-# of these modules be built using the new ld.  This `native' target allows us
-# to build a local ld which will then be used to build the delivered version of
-# itself and ld.so.1.  Once this new functionality appears in the standard ld
-# this target can be disabled.
-
-native-add:	FRC
-		@ cd tools/$(MACH); pwd; $(MAKE) native
-		@ cd libconv/$(MACH); pwd; $(MAKE)
-		@ cd libelf/$(MACH); pwd; $(MAKE) native
-		@ cd liblddbg/$(MACH); pwd; $(MAKE) native
-		@ cd libldstab/$(MACH); pwd; $(MAKE) native
-		@ cd libld/$(MACH); pwd; $(MAKE) native
-		@ cd ld/$(MACH); pwd; $(MAKE) native
-
-native-clobber:
-		@ cd tools; pwd; $(MAKE) $(TARGET)
-		$(RM) -r proto/$(MACH)
-
 FRC:
 
 #
 # Cross-reference customization: ignore the directories named by XRPRUNE,
 # and tweak the file globs slightly.
 #
-XRPRUNE=	rtld.4.x packages abi
+XRPRUNE=	rtld.4.x abi
 XRADD=		*.msg mapfile*
 XRDEL=		Makefile* kobj_*
 
--- old/usr/src/cmd/sgs/Makefile.com	2019-07-14 19:11:52.241304346 +0000
+++ new/usr/src/cmd/sgs/Makefile.com	2019-07-14 19:11:52.257766105 +0000
@@ -31,8 +31,6 @@
 
 include		$(SRC)/cmd/sgs/Makefile.var
 
-SRCBASE =	../../../..
-
 i386_ARCH =	intel
 sparc_ARCH =	sparc
 
@@ -52,6 +50,8 @@
 CFLAGS +=	$(CCVERBOSE) $(DEBUG) $(XFFLAG)
 CFLAGS64 +=	$(CCVERBOSE) $(DEBUG) $(XFFLAG)
 
+NATIVE_CFLAGS +=	$(CCVERBOSE) $(DEBUG) $(XFFLAG)
+
 CERRWARN +=	-_gcc=-Wno-type-limits
 CERRWARN +=	-_gcc=-Wno-parentheses
 CERRWARN +=	-_gcc=-Wno-unused-value
@@ -63,7 +63,7 @@
 
 # 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$(SGSHOME)/include -I$(SGSHOME)/include/$(MACH) \
 		$(CPPFLAGS.master) -I$(ELFCAP)
 
 # PICS64 is unique to our environment
@@ -77,7 +77,7 @@
 # Establish the local tools, proto and package area.
 
 SGSHOME =	$(SRC)/cmd/sgs
-SGSPROTO =	$(SGSHOME)/proto/$(MACH)
+SGSCOMMON =	$(SGSHOME)/common
 SGSTOOLS =	$(SGSHOME)/tools
 SGSMSGID =	$(SGSHOME)/messages
 SGSMSGDIR =	$(SGSHOME)/messages/$(MACH)
@@ -85,12 +85,6 @@
 SGSRPATH =	/usr/lib
 SGSRPATH64 =	$(SGSRPATH)/$(MACH64)
 
-# Mimic the structure of an installed system.
-
-SGSLIBDIR =	$(SGSPROTO)/lib
-SGSPREFIX =	$(SGSPROTO)/usr
-SGSBINDIR =	$(SGSPREFIX)/bin
-
 #
 # Macros to be used to include link against libconv and include vernote.o
 #
@@ -117,33 +111,10 @@
 # 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
+SGSMSG =		$(ONBLD_TOOLS)/bin/$(MACH)/sgsmsg
 SGSMSG_PIGLATIN_NL =	perl $(SGSTOOLS)/common/sgsmsg_piglatin_nl.pl
-CHKMSG =		$(SGSTOOLS)/chkmsg.sh
+CHKMSG =		$(SGSHOME)/tools/chkmsg.sh
 
 SGSMSGVFLAG =
 SGSMSGFLAGS =	$(SGSMSGVFLAG) -i $(SGSMSGID)/sgs.ident
 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 = -R$(SGSLIBDIR) -L$(SGSLIBDIR) $(ZNOVERSION) \
-			$(HSONAME)
-
-# Comment out the following two lines to have the sgs built from the system
-# link-editor, rather than the local proto link-editor.
-CC_USE_PROTO =	-Yl,$(SGSBINDIR)
-LD_USE_PROTO =	$(SGSBINDIR)/
-
-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
--- old/usr/src/cmd/sgs/Makefile.targ	2019-07-14 19:11:52.609042055 +0000
+++ new/usr/src/cmd/sgs/Makefile.targ	2019-07-14 19:11:52.625563623 +0000
@@ -51,19 +51,4 @@
 $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS)
 	$(INS.liblinkccc64)
 
-#
-# For those that install into the SGSPROTO directory.
-#
-$(SGSPROTO):
-	$(INS.dir)
-
-$(SGSBINDIR): $(SGSPROTO)
-	$(INS.dir)
-
-$(SGSPREFIX): $(SGSPROTO)
-	$(INS.dir)
-
-$(SGSLIBDIR): $(SGSPREFIX)
-	$(INS.dir)
-
 FRC:
--- old/usr/src/cmd/sgs/Makefile.var	2019-07-14 19:11:53.053628990 +0000
+++ new/usr/src/cmd/sgs/Makefile.var	2019-07-14 19:11:53.071166839 +0000
@@ -69,8 +69,8 @@
 # files avl.c, avl.h and avl_impl.h until these files are back ported into
 # the system.
 #
-VAR_AVLDIR=		$(SRCBASE)/common/avl
-VAR_AVLINCDIR=		-I $(SRCBASE)/uts/common
+VAR_AVLDIR=		$(SRC)/common/avl
+VAR_AVLINCDIR=		-I $(SRC)/uts/common
 
 #
 # VAR_DTRDIR - directory to find dtrace_data.c in.
@@ -78,7 +78,7 @@
 # In Solaris 10 and earlier releases, dtrace_data.c was maintained as separate
 # files under sgs/rtld.  This file is now under usr/src/common/dtrace.
 #
-VAR_DTRDIR=             $(SRCBASE)/common/dtrace
+VAR_DTRDIR=             $(SRC)/common/dtrace
 
 #
 # VAR_SGSBINPROG
--- old/usr/src/cmd/sgs/ar/Makefile.com	2019-07-14 19:11:53.521128127 +0000
+++ new/usr/src/cmd/sgs/ar/Makefile.com	2019-07-14 19:11:53.538784317 +0000
@@ -47,7 +47,7 @@
 
 SMOFF += signed
 
-LDLIBS +=	-lelf $(CONVLIBDIR) $(CONV_LIB) -lsendfile
+LDLIBS +=	-lelf $(CONVLIBDIR) -lconv -lsendfile
 
 $(XPG4) :=	CPPFLAGS += -DXPG4
 
@@ -63,6 +63,6 @@
 
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n ar_msg
 
-SRCS=		$(COMOBJ:%.o=../common/%.c) $(BLTDATA:%.o=$(SGSTOOLS)/common/%.c)
+SRCS=		$(COMOBJ:%.o=../common/%.c) $(BLTDATA:%.o=$(SGSCOMMON)/%.c)
 
 CLEANFILES +=	$(BLTFILES)
--- old/usr/src/cmd/sgs/tools/common/alist.c	2019-07-14 19:11:53.988683900 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,465 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-#include <sgs.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/debug.h>
-
-/*
- * Alist manipulation.  An Alist is a list of elements formed into an array.
- * Traversal of the list is an array scan, which because of the locality of
- * each reference is probably more efficient than a link-list traversal.
- *
- * See alist.h for more background information about array lists.
- */
-
-/*
- * Insert a value into an array at a specified index:
- *
- *	alist_insert(): Insert an item into an Alist at the specified index
- *	alist_insert_by_offset(): Insert an item into an Alist at the
- *		specified offset relative to the list address.
- *	aplist_insert() Insert a pointer into an APlist at the specified index
- *
- * entry:
- *	Note: All the arguments for all three routines are listed here.
- *	The routine to which a given argument applies is given with
- *	each description.
- *
- *	llp [all] - Address of a pointer to an Alist/APlist. The pointer should
- *		be initialized to NULL before its first use.
- *	datap [alist_insert / aplist_insert] - Pointer to item data, or
- *		NULL. If non-null the data referenced is copied into the
- *		Alist item. Otherwise, the list item is zeroed, and
- *		further initialization is left to the caller.
- *	ptr [aplist_insert] - Pointer to be inserted.
- *	size [alist_insert / alist_insert_by_offset] - Size of an item
- *		in the array list, in bytes. As with any array, A given
- *		Alist can support any item size, but every item in that
- *		list must have the same size.
- *	init_arritems [all] - Initial allocation size: On the first insertion
- *		into the array list, room for init_arritems items is allocated.
- *	idx [alist_insert / aplist_insert] - Index at which to insert the
- *		new item. This index must lie within the existing list,
- *		or be the next index following.
- *	off [alist_insert_by_offset] - Offset at which  to insert the new
- *		item, based from the start of the Alist. The offset of
- *		the first item is ALIST_OFF_DATA.
- *
- * exit:
- *	The item is inserted at the specified position. This operation
- *	can cause memory for the list to be allocated, or reallocated,
- *	either of which will cause the value of the list pointer
- *	to change.
- *
- *	These routines can only fail if unable to allocate memory,
- *	in which case NULL is returned.
- *
- *	If a pointer list (aplist_insert), then the pointer
- *	is stored in the requested index. On success, the address
- *	of the pointer within the list is returned.
- *
- *	If the list contains arbitrary data (not aplist_insert): If datap
- *	is non-NULL, the data it references is copied into the item at
- *	the index. If datap is NULL, the specified item is zeroed.
- *	On success, a pointer to the inserted item is returned.
- *
- *	The  caller must not retain the returned pointer from this
- *	routine across calls to the list module. It is only safe to use
- *	it until the next call to this module for the given list.
- *
- */
-void *
-alist_insert(Alist **lpp, const void *datap, size_t size,
-    Aliste init_arritems, Aliste idx)
-{
-	Alist	*lp = *lpp;
-	char	*addr;
-
-	/* The size and initial array count need to be non-zero */
-	ASSERT(init_arritems != 0);
-	ASSERT(size != 0);
-
-	if (lp == NULL) {
-		Aliste bsize;
-
-		/*
-		 * First time here, allocate a new Alist.  Note that the
-		 * Alist al_desc[] entry is defined for 1 element,
-		 * but we actually allocate the number we need.
-		 */
-		bsize = size * init_arritems;
-		bsize = S_ROUND(bsize, sizeof (void *));
-		bsize = ALIST_OFF_DATA + bsize;
-		if ((lp = malloc((size_t)bsize)) == NULL)
-			return (NULL);
-		lp->al_arritems = init_arritems;
-		lp->al_nitems = 0;
-		lp->al_next = ALIST_OFF_DATA;
-		lp->al_size = size;
-		*lpp = lp;
-	} else {
-		/* We must get the same value for size every time */
-		ASSERT(size == lp->al_size);
-
-		if (lp->al_nitems >= lp->al_arritems) {
-			/*
-			 * The list is full: Increase the memory allocation
-			 * by doubling it.
-			 */
-			Aliste	bsize;
-
-			bsize = lp->al_size * lp->al_arritems * 2;
-			bsize = S_ROUND(bsize, sizeof (void *));
-			bsize = ALIST_OFF_DATA + bsize;
-			if ((lp = realloc((void *)lp, (size_t)bsize)) == 0)
-				return (NULL);
-			lp->al_arritems *= 2;
-			*lpp = lp;
-		}
-	}
-
-	/*
-	 * The caller is not supposed to use an index that
-	 * would introduce a "hole" in the array.
-	 */
-	ASSERT(idx <= lp->al_nitems);
-
-	addr = (idx * lp->al_size) + (char *)lp->al_data;
-
-	/*
-	 * An appended item is added to the next available array element.
-	 * An insert at any other spot requires that the data items that
-	 * exist at the point of insertion be shifted down to open a slot.
-	 */
-	if (idx < lp->al_nitems)
-		(void) memmove(addr + lp->al_size, addr,
-		    (lp->al_nitems - idx) * lp->al_size);
-
-	lp->al_nitems++;
-	lp->al_next += lp->al_size;
-	if (datap != NULL)
-		(void) memcpy(addr, datap, lp->al_size);
-	else
-		(void) memset(addr, 0, lp->al_size);
-	return (addr);
-}
-
-void *
-alist_insert_by_offset(Alist **lpp, const void *datap, size_t size,
-    Aliste init_arritems, Aliste off)
-{
-	Aliste idx;
-
-	if (*lpp == NULL) {
-		ASSERT(off == ALIST_OFF_DATA);
-		idx = 0;
-	} else {
-		idx = (off - ALIST_OFF_DATA) / (*lpp)->al_size;
-	}
-
-	return (alist_insert(lpp, datap, size, init_arritems, idx));
-}
-
-void *
-aplist_insert(APlist **lpp, const void *ptr, Aliste init_arritems, Aliste idx)
-{
-	APlist	*lp = *lpp;
-
-	/* The initial array count needs to be non-zero */
-	ASSERT(init_arritems != 0);
-
-	if (lp == NULL) {
-		Aliste bsize;
-
-		/*
-		 * First time here, allocate a new APlist.  Note that the
-		 * APlist apl_desc[] entry is defined for 1 element,
-		 * but we actually allocate the number we need.
-		 */
-		bsize = APLIST_OFF_DATA + (sizeof (void *) * init_arritems);
-		if ((lp = malloc((size_t)bsize)) == NULL)
-			return (NULL);
-		lp->apl_arritems = init_arritems;
-		lp->apl_nitems = 0;
-		*lpp = lp;
-	} else if (lp->apl_nitems >= lp->apl_arritems) {
-		/*
-		 * The list is full: Increase the memory allocation
-		 * by doubling it.
-		 */
-		Aliste	bsize;
-
-		bsize = APLIST_OFF_DATA +
-		    (2 * sizeof (void *) * lp->apl_arritems);
-		if ((lp = realloc((void *)lp, (size_t)bsize)) == 0)
-			return (NULL);
-		lp->apl_arritems *= 2;
-		*lpp = lp;
-	}
-
-	/*
-	 * The caller is not supposed to use an index that
-	 * would introduce a "hole" in the array.
-	 */
-	ASSERT(idx <= lp->apl_nitems);
-
-	/*
-	 * An appended item is added to the next available array element.
-	 * An insert at any other spot requires that the data items that
-	 * exist at the point of insertion be shifted down to open a slot.
-	 */
-	if (idx < lp->apl_nitems)
-		(void) memmove((char *)&lp->apl_data[idx + 1],
-		    (char *)&lp->apl_data[idx],
-		    (lp->apl_nitems - idx) * sizeof (void *));
-
-	lp->apl_nitems++;
-	lp->apl_data[idx] = (void *)ptr;
-	return (&lp->apl_data[idx]);
-}
-
-/*
- * Append a value to a list. These are convenience wrappers on top
- * of the insert operation. See the description of those routine above
- * for details.
- */
-void *
-alist_append(Alist **lpp, const void *datap, size_t size,
-    Aliste init_arritems)
-{
-	Aliste ndx = ((*lpp) == NULL) ? 0 : (*lpp)->al_nitems;
-
-	return (alist_insert(lpp, datap, size, init_arritems, ndx));
-}
-
-void *
-aplist_append(APlist **lpp, const void *ptr, Aliste init_arritems)
-{
-	Aliste ndx = ((*lpp) == NULL) ? 0 : (*lpp)->apl_nitems;
-
-	return (aplist_insert(lpp, ptr, init_arritems, ndx));
-}
-
-/*
- * Delete the item at a specified index/offset, and decrement the variable
- * containing the index:
- *
- *	alist_delete - Delete an item from an Alist at the specified
- *		index.
- *	alist_delete_by_offset - Delete an item from an Alist at the
- *		specified offset from the list pointer.
- *	aplist_delete - Delete a pointer from an APlist at the specified
- *		index.
- *
- * entry:
- *	alp - List to delete item from
- *	idxp - Address of variable containing the index of the
- *		item to delete.
- *	offp - Address of variable containing the offset of the
- *		item to delete.
- *
- * exit:
- *	The item at the position given by (*idxp) or (*offp), depending
- *	on the routine, is removed from the list. Then, the position
- *	variable (*idxp or *offp) is decremented by one item. This is done
- *	to facilitate use of this routine within a TRAVERSE loop.
- *
- * note:
- *	Deleting the last element in an array list is cheap, but
- *	deleting any other item causes a memory copy to occur to
- *	move the following items up. If you intend to traverse the
- *	entire list, deleting every item as you go, it will be cheaper
- *	to omit the delete within the traverse, and then call
- *	the reset function reset() afterwards.
- */
-void
-alist_delete(Alist *lp, Aliste *idxp)
-{
-	Aliste	idx = *idxp;
-
-
-	/* The list must be allocated and the index in range */
-	ASSERT(lp != NULL);
-	ASSERT(idx < lp->al_nitems);
-
-	/*
-	 * If the element to be removed is not the last entry of the array,
-	 * slide the following elements over the present element.
-	 */
-	if (idx < --lp->al_nitems) {
-		char *addr = (idx * lp->al_size) + (char *)lp->al_data;
-
-		(void) memmove(addr, addr + lp->al_size,
-		    (lp->al_nitems - idx) * lp->al_size);
-	}
-	lp->al_next -= lp->al_size;
-
-	/* Decrement the callers index variable */
-	(*idxp)--;
-}
-
-void
-alist_delete_by_offset(Alist *lp, Aliste *offp)
-{
-	Aliste idx;
-
-	ASSERT(lp != NULL);
-	idx = (*offp - ALIST_OFF_DATA) / lp->al_size;
-
-	alist_delete(lp, &idx);
-	*offp -= lp->al_size;
-}
-
-void
-aplist_delete(APlist *lp, Aliste *idxp)
-{
-	Aliste	idx = *idxp;
-
-
-	/* The list must be allocated and the index in range */
-	ASSERT(lp != NULL);
-	ASSERT(idx < lp->apl_nitems);
-
-	/*
-	 * If the element to be removed is not the last entry of the array,
-	 * slide the following elements over the present element.
-	 */
-	if (idx < --lp->apl_nitems)
-		(void) memmove(&lp->apl_data[idx], &lp->apl_data[idx + 1],
-		    (lp->apl_nitems - idx) * sizeof (void *));
-
-	/* Decrement the callers index variable */
-	(*idxp)--;
-}
-
-/*
- * Delete the pointer with a specified value from the APlist.
- *
- * entry:
- *	lp - Initialized APlist to delete item from
- *	ptr - Pointer to be deleted.
- *
- * exit:
- *	The list is searched for an item containing the given pointer,
- *	and if a match is found, that item is delted and True (1) returned.
- *	If no match is found, then False (0) is returned.
- *
- * note:
- *	See note for delete operation, above.
- */
-int
-aplist_delete_value(APlist *lp, const void *ptr)
-{
-	size_t	idx;
-
-	/*
-	 * If the pointer is found in the list, use aplist_delete to
-	 * remove it, and we're done.
-	 */
-	for (idx = 0; idx < lp->apl_nitems; idx++)
-		if (ptr == lp->apl_data[idx]) {
-			aplist_delete(lp, &idx);
-			return (1);
-		}
-
-	/* If we get here, the item was not in the list */
-	return (0);
-}
-
-/*
- * Search the APlist for an element with a given value, and
- * if not found, optionally append the element to the end of the list.
- *
- * entry:
- *	lpp, ptr - As per aplist_insert().
- *	init_arritems - As per aplist_insert() if a non-zero value.
- *		A value of zero is special, and is taken to indicate
- *		that no insert operation should be performed if
- *		the item is not found in the list.
- *
- * exit
- *	The given item is compared to every item in the given APlist.
- *	If it is found, ALE_EXISTS is returned.
- *
- *	If it is not found: If init_arr_items is False (0), then
- *	ALE_NOTFOUND is returned. If init_arr_items is True, then
- *	the item is appended to the list, and ALE_CREATE returned on success.
- *
- *	On failure, which can only occur due to memory allocation failure,
- *	ALE_ALLOCFAIL is returned.
- *
- * note:
- *	The test operation used by this routine is a linear
- *	O(N) operation, and is not efficient for more than a
- *	few items.
- */
-aplist_test_t
-aplist_test(APlist **lpp, const void *ptr, Aliste init_arritems)
-{
-	APlist	*lp = *lpp;
-	size_t	idx;
-
-	/* Is the pointer already in the list? */
-	if (lp != NULL)
-		for (idx = 0; idx < lp->apl_nitems; idx++)
-			if (ptr == lp->apl_data[idx])
-				return (ALE_EXISTS);
-
-	/* Is this a no-insert case? If so, report that the item is not found */
-	if (init_arritems == 0)
-		return (ALE_NOTFND);
-
-	/* Add it to the end of the list */
-	if (aplist_append(lpp, ptr, init_arritems) == NULL)
-		return (ALE_ALLOCFAIL);
-	return (ALE_CREATE);
-}
-
-/*
- * Reset the given list to its empty state. Any memory allocated by the
- * list is preserved, ready for reuse, but the list is set to its
- * empty state, equivalent to having called the delete operation for
- * every item.
- *
- * Note that no cleanup of the discarded items is done. The caller must
- * take care of any necessary cleanup before calling aplist_reset().
- */
-void
-alist_reset(Alist *lp)
-{
-	if (lp != NULL) {
-		lp->al_nitems = 0;
-		lp->al_next = ALIST_OFF_DATA;
-	}
-}
-
-void
-aplist_reset(APlist *lp)
-{
-	if (lp != NULL)
-		lp->apl_nitems = 0;
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/alist.c	2019-07-14 19:11:54.005390270 +0000
@@ -0,0 +1,465 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#include <sgs.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/debug.h>
+
+/*
+ * Alist manipulation.  An Alist is a list of elements formed into an array.
+ * Traversal of the list is an array scan, which because of the locality of
+ * each reference is probably more efficient than a link-list traversal.
+ *
+ * See alist.h for more background information about array lists.
+ */
+
+/*
+ * Insert a value into an array at a specified index:
+ *
+ *	alist_insert(): Insert an item into an Alist at the specified index
+ *	alist_insert_by_offset(): Insert an item into an Alist at the
+ *		specified offset relative to the list address.
+ *	aplist_insert() Insert a pointer into an APlist at the specified index
+ *
+ * entry:
+ *	Note: All the arguments for all three routines are listed here.
+ *	The routine to which a given argument applies is given with
+ *	each description.
+ *
+ *	llp [all] - Address of a pointer to an Alist/APlist. The pointer should
+ *		be initialized to NULL before its first use.
+ *	datap [alist_insert / aplist_insert] - Pointer to item data, or
+ *		NULL. If non-null the data referenced is copied into the
+ *		Alist item. Otherwise, the list item is zeroed, and
+ *		further initialization is left to the caller.
+ *	ptr [aplist_insert] - Pointer to be inserted.
+ *	size [alist_insert / alist_insert_by_offset] - Size of an item
+ *		in the array list, in bytes. As with any array, A given
+ *		Alist can support any item size, but every item in that
+ *		list must have the same size.
+ *	init_arritems [all] - Initial allocation size: On the first insertion
+ *		into the array list, room for init_arritems items is allocated.
+ *	idx [alist_insert / aplist_insert] - Index at which to insert the
+ *		new item. This index must lie within the existing list,
+ *		or be the next index following.
+ *	off [alist_insert_by_offset] - Offset at which  to insert the new
+ *		item, based from the start of the Alist. The offset of
+ *		the first item is ALIST_OFF_DATA.
+ *
+ * exit:
+ *	The item is inserted at the specified position. This operation
+ *	can cause memory for the list to be allocated, or reallocated,
+ *	either of which will cause the value of the list pointer
+ *	to change.
+ *
+ *	These routines can only fail if unable to allocate memory,
+ *	in which case NULL is returned.
+ *
+ *	If a pointer list (aplist_insert), then the pointer
+ *	is stored in the requested index. On success, the address
+ *	of the pointer within the list is returned.
+ *
+ *	If the list contains arbitrary data (not aplist_insert): If datap
+ *	is non-NULL, the data it references is copied into the item at
+ *	the index. If datap is NULL, the specified item is zeroed.
+ *	On success, a pointer to the inserted item is returned.
+ *
+ *	The  caller must not retain the returned pointer from this
+ *	routine across calls to the list module. It is only safe to use
+ *	it until the next call to this module for the given list.
+ *
+ */
+void *
+alist_insert(Alist **lpp, const void *datap, size_t size,
+    Aliste init_arritems, Aliste idx)
+{
+	Alist	*lp = *lpp;
+	char	*addr;
+
+	/* The size and initial array count need to be non-zero */
+	ASSERT(init_arritems != 0);
+	ASSERT(size != 0);
+
+	if (lp == NULL) {
+		Aliste bsize;
+
+		/*
+		 * First time here, allocate a new Alist.  Note that the
+		 * Alist al_desc[] entry is defined for 1 element,
+		 * but we actually allocate the number we need.
+		 */
+		bsize = size * init_arritems;
+		bsize = S_ROUND(bsize, sizeof (void *));
+		bsize = ALIST_OFF_DATA + bsize;
+		if ((lp = malloc((size_t)bsize)) == NULL)
+			return (NULL);
+		lp->al_arritems = init_arritems;
+		lp->al_nitems = 0;
+		lp->al_next = ALIST_OFF_DATA;
+		lp->al_size = size;
+		*lpp = lp;
+	} else {
+		/* We must get the same value for size every time */
+		ASSERT(size == lp->al_size);
+
+		if (lp->al_nitems >= lp->al_arritems) {
+			/*
+			 * The list is full: Increase the memory allocation
+			 * by doubling it.
+			 */
+			Aliste	bsize;
+
+			bsize = lp->al_size * lp->al_arritems * 2;
+			bsize = S_ROUND(bsize, sizeof (void *));
+			bsize = ALIST_OFF_DATA + bsize;
+			if ((lp = realloc((void *)lp, (size_t)bsize)) == 0)
+				return (NULL);
+			lp->al_arritems *= 2;
+			*lpp = lp;
+		}
+	}
+
+	/*
+	 * The caller is not supposed to use an index that
+	 * would introduce a "hole" in the array.
+	 */
+	ASSERT(idx <= lp->al_nitems);
+
+	addr = (idx * lp->al_size) + (char *)lp->al_data;
+
+	/*
+	 * An appended item is added to the next available array element.
+	 * An insert at any other spot requires that the data items that
+	 * exist at the point of insertion be shifted down to open a slot.
+	 */
+	if (idx < lp->al_nitems)
+		(void) memmove(addr + lp->al_size, addr,
+		    (lp->al_nitems - idx) * lp->al_size);
+
+	lp->al_nitems++;
+	lp->al_next += lp->al_size;
+	if (datap != NULL)
+		(void) memcpy(addr, datap, lp->al_size);
+	else
+		(void) memset(addr, 0, lp->al_size);
+	return (addr);
+}
+
+void *
+alist_insert_by_offset(Alist **lpp, const void *datap, size_t size,
+    Aliste init_arritems, Aliste off)
+{
+	Aliste idx;
+
+	if (*lpp == NULL) {
+		ASSERT(off == ALIST_OFF_DATA);
+		idx = 0;
+	} else {
+		idx = (off - ALIST_OFF_DATA) / (*lpp)->al_size;
+	}
+
+	return (alist_insert(lpp, datap, size, init_arritems, idx));
+}
+
+void *
+aplist_insert(APlist **lpp, const void *ptr, Aliste init_arritems, Aliste idx)
+{
+	APlist	*lp = *lpp;
+
+	/* The initial array count needs to be non-zero */
+	ASSERT(init_arritems != 0);
+
+	if (lp == NULL) {
+		Aliste bsize;
+
+		/*
+		 * First time here, allocate a new APlist.  Note that the
+		 * APlist apl_desc[] entry is defined for 1 element,
+		 * but we actually allocate the number we need.
+		 */
+		bsize = APLIST_OFF_DATA + (sizeof (void *) * init_arritems);
+		if ((lp = malloc((size_t)bsize)) == NULL)
+			return (NULL);
+		lp->apl_arritems = init_arritems;
+		lp->apl_nitems = 0;
+		*lpp = lp;
+	} else if (lp->apl_nitems >= lp->apl_arritems) {
+		/*
+		 * The list is full: Increase the memory allocation
+		 * by doubling it.
+		 */
+		Aliste	bsize;
+
+		bsize = APLIST_OFF_DATA +
+		    (2 * sizeof (void *) * lp->apl_arritems);
+		if ((lp = realloc((void *)lp, (size_t)bsize)) == 0)
+			return (NULL);
+		lp->apl_arritems *= 2;
+		*lpp = lp;
+	}
+
+	/*
+	 * The caller is not supposed to use an index that
+	 * would introduce a "hole" in the array.
+	 */
+	ASSERT(idx <= lp->apl_nitems);
+
+	/*
+	 * An appended item is added to the next available array element.
+	 * An insert at any other spot requires that the data items that
+	 * exist at the point of insertion be shifted down to open a slot.
+	 */
+	if (idx < lp->apl_nitems)
+		(void) memmove((char *)&lp->apl_data[idx + 1],
+		    (char *)&lp->apl_data[idx],
+		    (lp->apl_nitems - idx) * sizeof (void *));
+
+	lp->apl_nitems++;
+	lp->apl_data[idx] = (void *)ptr;
+	return (&lp->apl_data[idx]);
+}
+
+/*
+ * Append a value to a list. These are convenience wrappers on top
+ * of the insert operation. See the description of those routine above
+ * for details.
+ */
+void *
+alist_append(Alist **lpp, const void *datap, size_t size,
+    Aliste init_arritems)
+{
+	Aliste ndx = ((*lpp) == NULL) ? 0 : (*lpp)->al_nitems;
+
+	return (alist_insert(lpp, datap, size, init_arritems, ndx));
+}
+
+void *
+aplist_append(APlist **lpp, const void *ptr, Aliste init_arritems)
+{
+	Aliste ndx = ((*lpp) == NULL) ? 0 : (*lpp)->apl_nitems;
+
+	return (aplist_insert(lpp, ptr, init_arritems, ndx));
+}
+
+/*
+ * Delete the item at a specified index/offset, and decrement the variable
+ * containing the index:
+ *
+ *	alist_delete - Delete an item from an Alist at the specified
+ *		index.
+ *	alist_delete_by_offset - Delete an item from an Alist at the
+ *		specified offset from the list pointer.
+ *	aplist_delete - Delete a pointer from an APlist at the specified
+ *		index.
+ *
+ * entry:
+ *	alp - List to delete item from
+ *	idxp - Address of variable containing the index of the
+ *		item to delete.
+ *	offp - Address of variable containing the offset of the
+ *		item to delete.
+ *
+ * exit:
+ *	The item at the position given by (*idxp) or (*offp), depending
+ *	on the routine, is removed from the list. Then, the position
+ *	variable (*idxp or *offp) is decremented by one item. This is done
+ *	to facilitate use of this routine within a TRAVERSE loop.
+ *
+ * note:
+ *	Deleting the last element in an array list is cheap, but
+ *	deleting any other item causes a memory copy to occur to
+ *	move the following items up. If you intend to traverse the
+ *	entire list, deleting every item as you go, it will be cheaper
+ *	to omit the delete within the traverse, and then call
+ *	the reset function reset() afterwards.
+ */
+void
+alist_delete(Alist *lp, Aliste *idxp)
+{
+	Aliste	idx = *idxp;
+
+
+	/* The list must be allocated and the index in range */
+	ASSERT(lp != NULL);
+	ASSERT(idx < lp->al_nitems);
+
+	/*
+	 * If the element to be removed is not the last entry of the array,
+	 * slide the following elements over the present element.
+	 */
+	if (idx < --lp->al_nitems) {
+		char *addr = (idx * lp->al_size) + (char *)lp->al_data;
+
+		(void) memmove(addr, addr + lp->al_size,
+		    (lp->al_nitems - idx) * lp->al_size);
+	}
+	lp->al_next -= lp->al_size;
+
+	/* Decrement the callers index variable */
+	(*idxp)--;
+}
+
+void
+alist_delete_by_offset(Alist *lp, Aliste *offp)
+{
+	Aliste idx;
+
+	ASSERT(lp != NULL);
+	idx = (*offp - ALIST_OFF_DATA) / lp->al_size;
+
+	alist_delete(lp, &idx);
+	*offp -= lp->al_size;
+}
+
+void
+aplist_delete(APlist *lp, Aliste *idxp)
+{
+	Aliste	idx = *idxp;
+
+
+	/* The list must be allocated and the index in range */
+	ASSERT(lp != NULL);
+	ASSERT(idx < lp->apl_nitems);
+
+	/*
+	 * If the element to be removed is not the last entry of the array,
+	 * slide the following elements over the present element.
+	 */
+	if (idx < --lp->apl_nitems)
+		(void) memmove(&lp->apl_data[idx], &lp->apl_data[idx + 1],
+		    (lp->apl_nitems - idx) * sizeof (void *));
+
+	/* Decrement the callers index variable */
+	(*idxp)--;
+}
+
+/*
+ * Delete the pointer with a specified value from the APlist.
+ *
+ * entry:
+ *	lp - Initialized APlist to delete item from
+ *	ptr - Pointer to be deleted.
+ *
+ * exit:
+ *	The list is searched for an item containing the given pointer,
+ *	and if a match is found, that item is delted and True (1) returned.
+ *	If no match is found, then False (0) is returned.
+ *
+ * note:
+ *	See note for delete operation, above.
+ */
+int
+aplist_delete_value(APlist *lp, const void *ptr)
+{
+	size_t	idx;
+
+	/*
+	 * If the pointer is found in the list, use aplist_delete to
+	 * remove it, and we're done.
+	 */
+	for (idx = 0; idx < lp->apl_nitems; idx++)
+		if (ptr == lp->apl_data[idx]) {
+			aplist_delete(lp, &idx);
+			return (1);
+		}
+
+	/* If we get here, the item was not in the list */
+	return (0);
+}
+
+/*
+ * Search the APlist for an element with a given value, and
+ * if not found, optionally append the element to the end of the list.
+ *
+ * entry:
+ *	lpp, ptr - As per aplist_insert().
+ *	init_arritems - As per aplist_insert() if a non-zero value.
+ *		A value of zero is special, and is taken to indicate
+ *		that no insert operation should be performed if
+ *		the item is not found in the list.
+ *
+ * exit
+ *	The given item is compared to every item in the given APlist.
+ *	If it is found, ALE_EXISTS is returned.
+ *
+ *	If it is not found: If init_arr_items is False (0), then
+ *	ALE_NOTFOUND is returned. If init_arr_items is True, then
+ *	the item is appended to the list, and ALE_CREATE returned on success.
+ *
+ *	On failure, which can only occur due to memory allocation failure,
+ *	ALE_ALLOCFAIL is returned.
+ *
+ * note:
+ *	The test operation used by this routine is a linear
+ *	O(N) operation, and is not efficient for more than a
+ *	few items.
+ */
+aplist_test_t
+aplist_test(APlist **lpp, const void *ptr, Aliste init_arritems)
+{
+	APlist	*lp = *lpp;
+	size_t	idx;
+
+	/* Is the pointer already in the list? */
+	if (lp != NULL)
+		for (idx = 0; idx < lp->apl_nitems; idx++)
+			if (ptr == lp->apl_data[idx])
+				return (ALE_EXISTS);
+
+	/* Is this a no-insert case? If so, report that the item is not found */
+	if (init_arritems == 0)
+		return (ALE_NOTFND);
+
+	/* Add it to the end of the list */
+	if (aplist_append(lpp, ptr, init_arritems) == NULL)
+		return (ALE_ALLOCFAIL);
+	return (ALE_CREATE);
+}
+
+/*
+ * Reset the given list to its empty state. Any memory allocated by the
+ * list is preserved, ready for reuse, but the list is set to its
+ * empty state, equivalent to having called the delete operation for
+ * every item.
+ *
+ * Note that no cleanup of the discarded items is done. The caller must
+ * take care of any necessary cleanup before calling aplist_reset().
+ */
+void
+alist_reset(Alist *lp)
+{
+	if (lp != NULL) {
+		lp->al_nitems = 0;
+		lp->al_next = ALIST_OFF_DATA;
+	}
+}
+
+void
+aplist_reset(APlist *lp)
+{
+	if (lp != NULL)
+		lp->apl_nitems = 0;
+}
--- old/usr/src/cmd/sgs/tools/common/assfail.c	2019-07-14 19:11:54.220617441 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,43 +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 2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-/*
- * Provide assfail() for ASSERT() statements,
- * see <sys/debug.h> for further details.
- */
-int
-assfail(const char *a, const char *f, int l)
-{
-	(void) printf("assertion failed: %s, file: %s, line: %d\n",
-		a, f, l);
-	abort();
-	return (0);
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/assfail.c	2019-07-14 19:11:54.236767497 +0000
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of 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 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/*
+ * Provide assfail() for ASSERT() statements,
+ * see <sys/debug.h> for further details.
+ */
+int
+assfail(const char *a, const char *f, int l)
+{
+	(void) printf("assertion failed: %s, file: %s, line: %d\n",
+	    a, f, l);
+	abort();
+	return (0);
+}
--- old/usr/src/cmd/sgs/tools/common/findprime.c	2019-07-14 19:11:54.708652506 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,55 +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 2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <sys/types.h>
-
-/*
- * function that will find a prime'ish number.  Usefull for
- * hashbuckets and related things.
- */
-uint_t
-findprime(uint_t count)
-{
-	uint_t	h, f;
-
-	if (count <= 3)
-		return (3);
-
-
-	/*
-	 * Check to see if divisible by two, if so
-	 * increment.
-	 */
-	if ((count & 0x1) == 0)
-		count++;
-
-	for (h = count, f = 2; f * f <= h; f++)
-		if ((h % f) == 0)
-			h += f = 1;
-	return (h);
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/findprime.c	2019-07-14 19:11:54.725873170 +0000
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of 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 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/types.h>
+
+/*
+ * function that will find a prime'ish number.  Usefull for
+ * hashbuckets and related things.
+ */
+uint_t
+findprime(uint_t count)
+{
+	uint_t	h, f;
+
+	if (count <= 3)
+		return (3);
+
+
+	/*
+	 * Check to see if divisible by two, if so
+	 * increment.
+	 */
+	if ((count & 0x1) == 0)
+		count++;
+
+	for (h = count, f = 2; f * f <= h; f++)
+		if ((h % f) == 0)
+			h += f = 1;
+	return (h);
+}
--- old/usr/src/cmd/sgs/tools/common/leb128.c	2019-07-14 19:11:55.193790222 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,328 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <stdio.h>
-#include <dwarf.h>
-#include <sys/types.h>
-#include <sys/elf.h>
-
-/*
- * Little Endian Base 128 (LEB128) numbers.
- * ----------------------------------------
- *
- * LEB128 is a scheme for encoding integers densely that exploits the
- * assumption that most integers are small in magnitude. (This encoding
- * is equally suitable whether the target machine architecture represents
- * data in big-endian or little- endian
- *
- * Unsigned LEB128 numbers are encoded as follows: start at the low order
- * end of an unsigned integer and chop it into 7-bit chunks. Place each
- * chunk into the low order 7 bits of a byte. Typically, several of the
- * high order bytes will be zero; discard them. Emit the remaining bytes in
- * a stream, starting with the low order byte; set the high order bit on
- * each byte except the last emitted byte. The high bit of zero on the last
- * byte indicates to the decoder that it has encountered the last byte.
- * The integer zero is a special case, consisting of a single zero byte.
- *
- * Signed, 2s complement LEB128 numbers are encoded in a similar except
- * that the criterion for discarding high order bytes is not whether they
- * are zero, but whether they consist entirely of sign extension bits.
- * Consider the 32-bit integer -2. The three high level bytes of the number
- * are sign extension, thus LEB128 would represent it as a single byte
- * containing the low order 7 bits, with the high order bit cleared to
- * indicate the end of the byte stream.
- *
- * Note that there is nothing within the LEB128 representation that
- * indicates whether an encoded number is signed or unsigned. The decoder
- * must know what type of number to expect.
- *
- * DWARF Exception Header Encoding
- * -------------------------------
- *
- * The DWARF Exception Header Encoding is used to describe the type of data
- * used in the .eh_frame_hdr section. The upper 4 bits indicate how the
- * value is to be applied. The lower 4 bits indicate the format of the data.
- *
- * DWARF Exception Header value format
- *
- * Name		Value Meaning
- * DW_EH_PE_omit	    0xff No value is present.
- * DW_EH_PE_absptr	    0x00 Value is a void*
- * DW_EH_PE_uleb128	    0x01 Unsigned value is encoded using the
- *				 Little Endian Base 128 (LEB128)
- * DW_EH_PE_udata2	    0x02 A 2 bytes unsigned value.
- * DW_EH_PE_udata4	    0x03 A 4 bytes unsigned value.
- * DW_EH_PE_udata8	    0x04 An 8 bytes unsigned value.
- * DW_EH_PE_signed          0x08 bit on for all signed encodings
- * DW_EH_PE_sleb128	    0x09 Signed value is encoded using the
- *				 Little Endian Base 128 (LEB128)
- * DW_EH_PE_sdata2	    0x0A A 2 bytes signed value.
- * DW_EH_PE_sdata4	    0x0B A 4 bytes signed value.
- * DW_EH_PE_sdata8	    0x0C An 8 bytes signed value.
- *
- * DWARF Exception Header application
- *
- * Name	    Value Meaning
- * DW_EH_PE_absptr	   0x00 Value is used with no modification.
- * DW_EH_PE_pcrel	   0x10 Value is reletive to the location of itself
- * DW_EH_PE_textrel	   0x20
- * DW_EH_PE_datarel	   0x30 Value is reletive to the beginning of the
- *				eh_frame_hdr segment ( segment type
- *			        PT_GNU_EH_FRAME )
- * DW_EH_PE_funcrel        0x40
- * DW_EH_PE_aligned        0x50 value is an aligned void*
- * DW_EH_PE_indirect       0x80 bit to signal indirection after relocation
- * DW_EH_PE_omit	   0xff No value is present.
- *
- */
-
-dwarf_error_t
-uleb_extract(unsigned char *data, uint64_t *dotp, size_t len, uint64_t *ret)
-{
-	uint64_t	dot = *dotp;
-	uint64_t	res = 0;
-	int		more = 1;
-	int		shift = 0;
-	int		val;
-
-	data += dot;
-
-	while (more) {
-		if (dot > len)
-			return (DW_OVERFLOW);
-
-		/*
-		 * Pull off lower 7 bits
-		 */
-		val = (*data) & 0x7f;
-
-		/*
-		 * Add prepend value to head of number.
-		 */
-		res = res | (val << shift);
-
-		/*
-		 * Increment shift & dot pointer
-		 */
-		shift += 7;
-		dot++;
-
-		/*
-		 * Check to see if hi bit is set - if not, this
-		 * is the last byte.
-		 */
-		more = ((*data++) & 0x80) >> 7;
-	}
-	*dotp = dot;
-	*ret = res;
-	return (DW_SUCCESS);
-}
-
-dwarf_error_t
-sleb_extract(unsigned char *data, uint64_t *dotp, size_t len, int64_t *ret)
-{
-	uint64_t	dot = *dotp;
-	int64_t		res = 0;
-	int		more = 1;
-	int		shift = 0;
-	int		val;
-
-	data += dot;
-
-	while (more) {
-		if (dot > len)
-			return (DW_OVERFLOW);
-
-		/*
-		 * Pull off lower 7 bits
-		 */
-		val = (*data) & 0x7f;
-
-		/*
-		 * Add prepend value to head of number.
-		 */
-		res = res | (val << shift);
-
-		/*
-		 * Increment shift & dot pointer
-		 */
-		shift += 7;
-		dot++;
-
-		/*
-		 * Check to see if hi bit is set - if not, this
-		 * is the last byte.
-		 */
-		more = ((*data++) & 0x80) >> 7;
-	}
-	*dotp = dot;
-
-	/*
-	 * Make sure value is properly sign extended.
-	 */
-	res = (res << (64 - shift)) >> (64 - shift);
-	*ret = res;
-	return (DW_SUCCESS);
-}
-
-/*
- * Extract a DWARF encoded datum
- *
- * entry:
- *	data - Base of data buffer containing encoded bytes
- *	dotp - Address of variable containing index within data
- *		at which the desired datum starts.
- *	ehe_flags - DWARF encoding
- *	eident - ELF header e_ident[] array for object being processed
- *	frame_hdr - Boolean, true if we're extracting from .eh_frame_hdr
- *	sh_base - Base address of ELF section containing desired datum
- *	sh_offset - Offset relative to sh_base of desired datum.
- *	dbase - The base address to which DW_EH_PE_datarel is relative
- *		(if frame_hdr is false)
- */
-dwarf_error_t
-dwarf_ehe_extract(unsigned char *data, size_t len, uint64_t *dotp,
-    uint64_t *ret, uint_t ehe_flags, unsigned char *eident,
-    boolean_t frame_hdr, uint64_t sh_base, uint64_t sh_offset,
-    uint64_t dbase)
-{
-	uint64_t    dot = *dotp;
-	uint_t	    lsb;
-	uint_t	    wordsize;
-	uint_t	    fsize;
-	uint64_t    result;
-
-	if (eident[EI_DATA] == ELFDATA2LSB)
-		lsb = 1;
-	else
-		lsb = 0;
-
-	if (eident[EI_CLASS] == ELFCLASS64)
-		wordsize = 8;
-	else
-		wordsize = 4;
-
-	switch (ehe_flags & 0x0f) {
-	case DW_EH_PE_omit:
-		*ret = 0;
-		return (DW_SUCCESS);
-	case DW_EH_PE_absptr:
-		fsize = wordsize;
-		break;
-	case DW_EH_PE_udata8:
-	case DW_EH_PE_sdata8:
-		fsize = 8;
-		break;
-	case DW_EH_PE_udata4:
-	case DW_EH_PE_sdata4:
-		fsize = 4;
-		break;
-	case DW_EH_PE_udata2:
-	case DW_EH_PE_sdata2:
-		fsize = 2;
-		break;
-	case DW_EH_PE_uleb128:
-		return (uleb_extract(data, dotp, len, ret));
-	case DW_EH_PE_sleb128:
-		return (sleb_extract(data, dotp, len, (int64_t *)ret));
-	default:
-		*ret = 0;
-		return (DW_BAD_ENCODING);
-	}
-
-	if (lsb) {
-		/*
-		 * Extract unaligned LSB formated data
-		 */
-		uint_t	cnt;
-
-		result = 0;
-		for (cnt = 0; cnt < fsize;
-		    cnt++, dot++) {
-			uint64_t val;
-
-			if (dot > len)
-				return (DW_OVERFLOW);
-			val = data[dot];
-			result |= val << (cnt * 8);
-		}
-	} else {
-		/*
-		 * Extract unaligned MSB formated data
-		 */
-		uint_t	cnt;
-		result = 0;
-		for (cnt = 0; cnt < fsize;
-		    cnt++, dot++) {
-			uint64_t val;
-
-			if (dot > len)
-				return (DW_OVERFLOW);
-			val = data[dot];
-			result |= val << ((fsize - cnt - 1) * 8);
-		}
-	}
-	/*
-	 * perform sign extension
-	 */
-	if ((ehe_flags & DW_EH_PE_signed) &&
-	    (fsize < sizeof (uint64_t))) {
-		int64_t	sresult;
-		uint_t	bitshift;
-		sresult = result;
-		bitshift = (sizeof (uint64_t) - fsize) * 8;
-		sresult = (sresult << bitshift) >> bitshift;
-		result = sresult;
-	}
-
-	/*
-	 * If value is relative to a base address, adjust it
-	 */
-	switch (ehe_flags & 0xf0) {
-	case DW_EH_PE_pcrel:
-		result += sh_base + sh_offset;
-		break;
-
-	/*
-	 * datarel is relative to .eh_frame_hdr if within .eh_frame,
-	 * but GOT if not.
-	 */
-	case DW_EH_PE_datarel:
-		if (frame_hdr)
-			result += sh_base;
-		else
-			result += dbase;
-		break;
-	}
-
-	/* Truncate the result to its specified size */
-	result = (result << ((sizeof (uint64_t) - fsize) * 8)) >>
-	    ((sizeof (uint64_t) - fsize) * 8);
-
-	*dotp = dot;
-	*ret = result;
-	return (DW_SUCCESS);
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/leb128.c	2019-07-14 19:11:55.210896273 +0000
@@ -0,0 +1,328 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <dwarf.h>
+#include <sys/types.h>
+#include <sys/elf.h>
+
+/*
+ * Little Endian Base 128 (LEB128) numbers.
+ * ----------------------------------------
+ *
+ * LEB128 is a scheme for encoding integers densely that exploits the
+ * assumption that most integers are small in magnitude. (This encoding
+ * is equally suitable whether the target machine architecture represents
+ * data in big-endian or little- endian
+ *
+ * Unsigned LEB128 numbers are encoded as follows: start at the low order
+ * end of an unsigned integer and chop it into 7-bit chunks. Place each
+ * chunk into the low order 7 bits of a byte. Typically, several of the
+ * high order bytes will be zero; discard them. Emit the remaining bytes in
+ * a stream, starting with the low order byte; set the high order bit on
+ * each byte except the last emitted byte. The high bit of zero on the last
+ * byte indicates to the decoder that it has encountered the last byte.
+ * The integer zero is a special case, consisting of a single zero byte.
+ *
+ * Signed, 2s complement LEB128 numbers are encoded in a similar except
+ * that the criterion for discarding high order bytes is not whether they
+ * are zero, but whether they consist entirely of sign extension bits.
+ * Consider the 32-bit integer -2. The three high level bytes of the number
+ * are sign extension, thus LEB128 would represent it as a single byte
+ * containing the low order 7 bits, with the high order bit cleared to
+ * indicate the end of the byte stream.
+ *
+ * Note that there is nothing within the LEB128 representation that
+ * indicates whether an encoded number is signed or unsigned. The decoder
+ * must know what type of number to expect.
+ *
+ * DWARF Exception Header Encoding
+ * -------------------------------
+ *
+ * The DWARF Exception Header Encoding is used to describe the type of data
+ * used in the .eh_frame_hdr section. The upper 4 bits indicate how the
+ * value is to be applied. The lower 4 bits indicate the format of the data.
+ *
+ * DWARF Exception Header value format
+ *
+ * Name		Value Meaning
+ * DW_EH_PE_omit	    0xff No value is present.
+ * DW_EH_PE_absptr	    0x00 Value is a void*
+ * DW_EH_PE_uleb128	    0x01 Unsigned value is encoded using the
+ *				 Little Endian Base 128 (LEB128)
+ * DW_EH_PE_udata2	    0x02 A 2 bytes unsigned value.
+ * DW_EH_PE_udata4	    0x03 A 4 bytes unsigned value.
+ * DW_EH_PE_udata8	    0x04 An 8 bytes unsigned value.
+ * DW_EH_PE_signed          0x08 bit on for all signed encodings
+ * DW_EH_PE_sleb128	    0x09 Signed value is encoded using the
+ *				 Little Endian Base 128 (LEB128)
+ * DW_EH_PE_sdata2	    0x0A A 2 bytes signed value.
+ * DW_EH_PE_sdata4	    0x0B A 4 bytes signed value.
+ * DW_EH_PE_sdata8	    0x0C An 8 bytes signed value.
+ *
+ * DWARF Exception Header application
+ *
+ * Name	    Value Meaning
+ * DW_EH_PE_absptr	   0x00 Value is used with no modification.
+ * DW_EH_PE_pcrel	   0x10 Value is reletive to the location of itself
+ * DW_EH_PE_textrel	   0x20
+ * DW_EH_PE_datarel	   0x30 Value is reletive to the beginning of the
+ *				eh_frame_hdr segment ( segment type
+ *			        PT_GNU_EH_FRAME )
+ * DW_EH_PE_funcrel        0x40
+ * DW_EH_PE_aligned        0x50 value is an aligned void*
+ * DW_EH_PE_indirect       0x80 bit to signal indirection after relocation
+ * DW_EH_PE_omit	   0xff No value is present.
+ *
+ */
+
+dwarf_error_t
+uleb_extract(unsigned char *data, uint64_t *dotp, size_t len, uint64_t *ret)
+{
+	uint64_t	dot = *dotp;
+	uint64_t	res = 0;
+	int		more = 1;
+	int		shift = 0;
+	int		val;
+
+	data += dot;
+
+	while (more) {
+		if (dot > len)
+			return (DW_OVERFLOW);
+
+		/*
+		 * Pull off lower 7 bits
+		 */
+		val = (*data) & 0x7f;
+
+		/*
+		 * Add prepend value to head of number.
+		 */
+		res = res | (val << shift);
+
+		/*
+		 * Increment shift & dot pointer
+		 */
+		shift += 7;
+		dot++;
+
+		/*
+		 * Check to see if hi bit is set - if not, this
+		 * is the last byte.
+		 */
+		more = ((*data++) & 0x80) >> 7;
+	}
+	*dotp = dot;
+	*ret = res;
+	return (DW_SUCCESS);
+}
+
+dwarf_error_t
+sleb_extract(unsigned char *data, uint64_t *dotp, size_t len, int64_t *ret)
+{
+	uint64_t	dot = *dotp;
+	int64_t		res = 0;
+	int		more = 1;
+	int		shift = 0;
+	int		val;
+
+	data += dot;
+
+	while (more) {
+		if (dot > len)
+			return (DW_OVERFLOW);
+
+		/*
+		 * Pull off lower 7 bits
+		 */
+		val = (*data) & 0x7f;
+
+		/*
+		 * Add prepend value to head of number.
+		 */
+		res = res | (val << shift);
+
+		/*
+		 * Increment shift & dot pointer
+		 */
+		shift += 7;
+		dot++;
+
+		/*
+		 * Check to see if hi bit is set - if not, this
+		 * is the last byte.
+		 */
+		more = ((*data++) & 0x80) >> 7;
+	}
+	*dotp = dot;
+
+	/*
+	 * Make sure value is properly sign extended.
+	 */
+	res = (res << (64 - shift)) >> (64 - shift);
+	*ret = res;
+	return (DW_SUCCESS);
+}
+
+/*
+ * Extract a DWARF encoded datum
+ *
+ * entry:
+ *	data - Base of data buffer containing encoded bytes
+ *	dotp - Address of variable containing index within data
+ *		at which the desired datum starts.
+ *	ehe_flags - DWARF encoding
+ *	eident - ELF header e_ident[] array for object being processed
+ *	frame_hdr - Boolean, true if we're extracting from .eh_frame_hdr
+ *	sh_base - Base address of ELF section containing desired datum
+ *	sh_offset - Offset relative to sh_base of desired datum.
+ *	dbase - The base address to which DW_EH_PE_datarel is relative
+ *		(if frame_hdr is false)
+ */
+dwarf_error_t
+dwarf_ehe_extract(unsigned char *data, size_t len, uint64_t *dotp,
+    uint64_t *ret, uint_t ehe_flags, unsigned char *eident,
+    boolean_t frame_hdr, uint64_t sh_base, uint64_t sh_offset,
+    uint64_t dbase)
+{
+	uint64_t    dot = *dotp;
+	uint_t	    lsb;
+	uint_t	    wordsize;
+	uint_t	    fsize;
+	uint64_t    result;
+
+	if (eident[EI_DATA] == ELFDATA2LSB)
+		lsb = 1;
+	else
+		lsb = 0;
+
+	if (eident[EI_CLASS] == ELFCLASS64)
+		wordsize = 8;
+	else
+		wordsize = 4;
+
+	switch (ehe_flags & 0x0f) {
+	case DW_EH_PE_omit:
+		*ret = 0;
+		return (DW_SUCCESS);
+	case DW_EH_PE_absptr:
+		fsize = wordsize;
+		break;
+	case DW_EH_PE_udata8:
+	case DW_EH_PE_sdata8:
+		fsize = 8;
+		break;
+	case DW_EH_PE_udata4:
+	case DW_EH_PE_sdata4:
+		fsize = 4;
+		break;
+	case DW_EH_PE_udata2:
+	case DW_EH_PE_sdata2:
+		fsize = 2;
+		break;
+	case DW_EH_PE_uleb128:
+		return (uleb_extract(data, dotp, len, ret));
+	case DW_EH_PE_sleb128:
+		return (sleb_extract(data, dotp, len, (int64_t *)ret));
+	default:
+		*ret = 0;
+		return (DW_BAD_ENCODING);
+	}
+
+	if (lsb) {
+		/*
+		 * Extract unaligned LSB formated data
+		 */
+		uint_t	cnt;
+
+		result = 0;
+		for (cnt = 0; cnt < fsize;
+		    cnt++, dot++) {
+			uint64_t val;
+
+			if (dot > len)
+				return (DW_OVERFLOW);
+			val = data[dot];
+			result |= val << (cnt * 8);
+		}
+	} else {
+		/*
+		 * Extract unaligned MSB formated data
+		 */
+		uint_t	cnt;
+		result = 0;
+		for (cnt = 0; cnt < fsize;
+		    cnt++, dot++) {
+			uint64_t val;
+
+			if (dot > len)
+				return (DW_OVERFLOW);
+			val = data[dot];
+			result |= val << ((fsize - cnt - 1) * 8);
+		}
+	}
+	/*
+	 * perform sign extension
+	 */
+	if ((ehe_flags & DW_EH_PE_signed) &&
+	    (fsize < sizeof (uint64_t))) {
+		int64_t	sresult;
+		uint_t	bitshift;
+		sresult = result;
+		bitshift = (sizeof (uint64_t) - fsize) * 8;
+		sresult = (sresult << bitshift) >> bitshift;
+		result = sresult;
+	}
+
+	/*
+	 * If value is relative to a base address, adjust it
+	 */
+	switch (ehe_flags & 0xf0) {
+	case DW_EH_PE_pcrel:
+		result += sh_base + sh_offset;
+		break;
+
+	/*
+	 * datarel is relative to .eh_frame_hdr if within .eh_frame,
+	 * but GOT if not.
+	 */
+	case DW_EH_PE_datarel:
+		if (frame_hdr)
+			result += sh_base;
+		else
+			result += dbase;
+		break;
+	}
+
+	/* Truncate the result to its specified size */
+	result = (result << ((sizeof (uint64_t) - fsize) * 8)) >>
+	    ((sizeof (uint64_t) - fsize) * 8);
+
+	*dotp = dot;
+	*ret = result;
+	return (DW_SUCCESS);
+}
--- old/usr/src/cmd/sgs/tools/common/strhash.c	2019-07-14 19:11:55.415962506 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,47 +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 2003 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <sgs.h>
-
-/*
- * classic Bernstein k=33 hash function
- *
- * This routine is to be used for internal hashing of strings.  It's not
- * to be confused with elf_hash() which is the required ELF hashing
- * tool for ELF structures.
- */
-uint_t
-sgs_str_hash(const char *str)
-{
-	uint_t	hash = 5381;
-	int		c;
-
-	while ((c = *str++) != 0)
-		hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
-	return (hash);
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/strhash.c	2019-07-14 19:11:55.432549888 +0000
@@ -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 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sgs.h>
+
+/*
+ * classic Bernstein k=33 hash function
+ *
+ * This routine is to be used for internal hashing of strings.  It's not
+ * to be confused with elf_hash() which is the required ELF hashing
+ * tool for ELF structures.
+ */
+uint_t
+sgs_str_hash(const char *str)
+{
+	uint_t	hash = 5381;
+	int		c;
+
+	while ((c = *str++) != 0)
+		hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+	return (hash);
+}
--- old/usr/src/cmd/sgs/tools/common/string_table.c	2019-07-14 19:11:55.896728894 +0000
+++ /dev/null	2019-07-14 19:11:50.000000000 +0000
@@ -1,684 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <_string_table.h>
-#include <strings.h>
-#include <sgs.h>
-#include <stdio.h>
-
-/*
- * This file provides the interfaces to build a Str_tbl suitable for use by
- * either the sgsmsg message system, or a standard ELF string table (SHT_STRTAB)
- * as created by ld(1).
- *
- * There are two modes which can be used when constructing a string table:
- *
- *	st_new(0)
- *		standard string table - no compression.  This is the
- *		traditional, fast method.
- *
- *	st_new(FLG_STTAB_COMPRESS)
- *		builds a compressed string table which both eliminates
- *		duplicate strings, and permits strings with common suffixes
- *		(atexit vs. exit) to overlap in the table.  This provides space
- *		savings for many string tables.  Although more work than the
- *		traditional method, the algorithms used are designed to scale
- *		and keep any overhead at a minimum.
- *
- * These string tables are built with a common interface in a two-pass manner.
- * The first pass finds all of the strings required for the string-table and
- * calculates the size required for the final string table.
- *
- * The second pass allocates the string table, populates the strings into the
- * table and returns the offsets the strings have been assigned.
- *
- * The calling sequence to build and populate a string table is:
- *
- *		st_new();		// initialize strtab
- *
- *		st_insert(st1);		// first pass of strings ...
- *					// calculates size required for
- *					// string table
- *
- *		st_delstring(st?);	// remove string previously
- *					// inserted
- *		st_insert(stN);
- *
- *		st_getstrtab_sz();	// freezes strtab and computes
- *					// size of table.
- *
- *		st_setstrbuf();		// associates a final destination
- *					// for the string table
- *
- *		st_setstring(st1);	// populate the string table
- *		...			// offsets are based off of second
- *					// pass	through the string table
- *		st_setstring(stN);
- *
- *		st_destroy();		// tear down string table
- *					// structures.
- *
- * String Suffix Compression Algorithm:
- *
- *   Here's a quick high level overview of the Suffix String
- *   compression algorithm used.  First - the heart of the algorithm
- *   is a Hash table list which represents a dictionary of all unique
- *   strings inserted into the string table.  The hash function for
- *   this table is a standard string hash except that the hash starts
- *   at the last character in the string (&str[n - 1]) and works towards
- *   the first character in the function (&str[0]).  As we compute the
- *   HASH value for a given string, we also compute the hash values
- *   for all of the possible suffix strings for that string.
- *
- *   As we compute the hash - at each character see if the current
- *   suffix string for that hash is already present in the table.  If
- *   it is, and the string is a master string.  Then change that
- *   string to a suffix string of the new string being inserted.
- *
- *   When the final hash value is found (hash for str[0...n]), check
- *   to see if it is in the hash table - if so increment the reference
- *   count for the string.  If it is not yet in the table, insert a
- *   new hash table entry for a master string.
- *
- *   The above method will find all suffixes of a given string given
- *   that the strings are inserted from shortest to longest.  That is
- *   why this is a two phase method, we first collect all of the
- *   strings and store them based off of their length in an AVL tree.
- *   Once all of the strings have been submitted we then start the
- *   hash table build by traversing the AVL tree in order and
- *   inserting the strings from shortest to longest as described
- *   above.
- */
-
-/* LINTLIBRARY */
-
-static int
-avl_len_compare(const void *n1, const void *n2)
-{
-	size_t	len1, len2;
-
-	len1 = ((LenNode *)n1)->ln_strlen;
-	len2 = ((LenNode *)n2)->ln_strlen;
-
-	if (len1 == len2)
-		return (0);
-	if (len2 < len1)
-		return (1);
-	return (-1);
-}
-
-static int
-avl_str_compare(const void *n1, const void *n2)
-{
-	const char	*str1, *str2;
-	int		rc;
-
-	str1 = ((StrNode *)n1)->sn_str;
-	str2 = ((StrNode *)n2)->sn_str;
-
-	rc = strcmp(str1, str2);
-	if (rc > 0)
-		return (1);
-	if (rc < 0)
-		return (-1);
-	return (0);
-}
-
-/*
- * Return an initialized Str_tbl - returns NULL on failure.
- *
- * flags:
- *	FLG_STTAB_COMPRESS - build a compressed string table
- */
-Str_tbl *
-st_new(uint_t flags)
-{
-	Str_tbl	*stp;
-
-	if ((stp = calloc(sizeof (*stp), 1)) == NULL)
-		return (NULL);
-
-	/*
-	 * Start with a leading '\0' - it's tradition.
-	 */
-	stp->st_strsize = stp->st_fullstrsize = stp->st_nextoff = 1;
-
-	/*
-	 * Do we compress this string table?
-	 */
-	stp->st_flags = flags;
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
-		return (stp);
-
-	if ((stp->st_lentree = calloc(sizeof (*stp->st_lentree), 1)) == NULL)
-		return (NULL);
-
-	avl_create(stp->st_lentree, &avl_len_compare, sizeof (LenNode),
-	    SGSOFFSETOF(LenNode, ln_avlnode));
-
-	return (stp);
-}
-
-/*
- * Insert a new string into the Str_tbl.  There are two AVL trees used.
- *
- *  -	The first LenNode AVL tree maintains a tree of nodes based on string
- *	sizes.
- *  -	Each LenNode maintains a StrNode AVL tree for each string.  Large
- *	applications have been known to contribute thousands of strings of
- *	the same size.  Should strings need to be removed (-z ignore), then
- *	the string AVL tree makes this removal efficient and scalable.
- */
-int
-st_insert(Str_tbl *stp, const char *str)
-{
-	size_t		len;
-	StrNode		*snp, sn = { 0 };
-	LenNode		*lnp, ln = { 0 };
-	avl_index_t	where;
-
-	/*
-	 * String table can't have been cooked
-	 */
-	assert((stp->st_flags & FLG_STTAB_COOKED) == 0);
-
-	/*
-	 * Null strings always point to the head of the string
-	 * table - no reason to keep searching.
-	 */
-	if ((len = strlen(str)) == 0)
-		return (0);
-
-	stp->st_fullstrsize += len + 1;
-	stp->st_strcnt++;
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
-		return (0);
-
-	/*
-	 * From the controlling string table, determine which LenNode AVL node
-	 * provides for this string length.  If the node doesn't exist, insert
-	 * a new node to represent this string length.
-	 */
-	ln.ln_strlen = len;
-	if ((lnp = avl_find(stp->st_lentree, &ln, &where)) == NULL) {
-		if ((lnp = calloc(sizeof (*lnp), 1)) == NULL)
-			return (-1);
-		lnp->ln_strlen = len;
-		avl_insert(stp->st_lentree, lnp, where);
-
-		if ((lnp->ln_strtree = calloc(sizeof (*lnp->ln_strtree), 1)) ==
-		    NULL)
-			return (0);
-
-		avl_create(lnp->ln_strtree, &avl_str_compare, sizeof (StrNode),
-		    SGSOFFSETOF(StrNode, sn_avlnode));
-	}
-
-	/*
-	 * From the string length AVL node determine whether a StrNode AVL node
-	 * provides this string.  If the node doesn't exist, insert a new node
-	 * to represent this string.
-	 */
-	sn.sn_str = str;
-	if ((snp = avl_find(lnp->ln_strtree, &sn, &where)) == NULL) {
-		if ((snp = calloc(sizeof (*snp), 1)) == NULL)
-			return (-1);
-		snp->sn_str = str;
-		avl_insert(lnp->ln_strtree, snp, where);
-	}
-	snp->sn_refcnt++;
-
-	return (0);
-}
-
-/*
- * Remove a previously inserted string from the Str_tbl.
- */
-int
-st_delstring(Str_tbl *stp, const char *str)
-{
-	size_t		len;
-	LenNode		*lnp, ln = { 0 };
-	StrNode		*snp, sn = { 0 };
-
-	/*
-	 * String table can't have been cooked
-	 */
-	assert((stp->st_flags & FLG_STTAB_COOKED) == 0);
-
-	len = strlen(str);
-	stp->st_fullstrsize -= len + 1;
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
-		return (0);
-
-	/*
-	 * Determine which LenNode AVL node provides for this string length.
-	 */
-	ln.ln_strlen = len;
-	if ((lnp = avl_find(stp->st_lentree, &ln, 0)) != NULL) {
-		sn.sn_str = str;
-		if ((snp = avl_find(lnp->ln_strtree, &sn, 0)) != NULL) {
-			/*
-			 * Reduce the reference count, and if zero remove the
-			 * node.
-			 */
-			if (--snp->sn_refcnt == 0)
-				avl_remove(lnp->ln_strtree, snp);
-			return (0);
-		}
-	}
-
-	/*
-	 * No strings of this length, or no string itself - someone goofed.
-	 */
-	return (-1);
-}
-
-/*
- * Tear down a String_Table structure.
- */
-void
-st_destroy(Str_tbl *stp)
-{
-	Str_hash	*sthash, *psthash;
-	Str_master	*mstr, *pmstr;
-	uint_t		i;
-
-	/*
-	 * cleanup the master strings
-	 */
-	for (mstr = stp->st_mstrlist, pmstr = 0; mstr;
-	    mstr = mstr->sm_next) {
-		if (pmstr)
-			free(pmstr);
-		pmstr = mstr;
-	}
-	if (pmstr)
-		free(pmstr);
-
-	if (stp->st_hashbcks) {
-		for (i = 0; i < stp->st_hbckcnt; i++) {
-			for (sthash = stp->st_hashbcks[i], psthash = 0;
-			    sthash; sthash = sthash->hi_next) {
-				if (psthash)
-					free(psthash);
-				psthash = sthash;
-			}
-			if (psthash)
-				free(psthash);
-		}
-		free(stp->st_hashbcks);
-	}
-	free(stp);
-}
-
-
-/*
- * For a given string - copy it into the buffer associated with
- * the string table - and return the offset it has been assigned.
- *
- * If a value of '-1' is returned - the string was not found in
- * the Str_tbl.
- */
-int
-st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
-{
-	size_t		stlen;
-	uint_t		hashval;
-	Str_hash	*sthash;
-	Str_master	*mstr;
-	int		i;
-
-	/*
-	 * String table *must* have been previously cooked
-	 */
-	assert(stp->st_strbuf);
-
-	assert(stp->st_flags & FLG_STTAB_COOKED);
-	stlen = strlen(str);
-	/*
-	 * Null string always points to head of string table
-	 */
-	if (stlen == 0) {
-		*stoff = 0;
-		return (0);
-	}
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
-		size_t		_stoff;
-
-		stlen++;	/* count for trailing '\0' */
-		_stoff = stp->st_nextoff;
-		/*
-		 * Have we overflowed our assigned buffer?
-		 */
-		if ((_stoff + stlen) > stp->st_fullstrsize)
-			return (-1);
-		memcpy(stp->st_strbuf + _stoff, str, stlen);
-		*stoff = _stoff;
-		stp->st_nextoff += stlen;
-		return (0);
-	}
-
-	/*
-	 * Calculate reverse hash for string.
-	 */
-	hashval = HASHSEED;
-	for (i = stlen; i >= 0; i--) {
-		hashval = ((hashval << 5) + hashval) +
-		    str[i];			/* h = ((h * 33) + c) */
-	}
-
-	for (sthash = stp->st_hashbcks[hashval % stp->st_hbckcnt]; sthash;
-	    sthash = sthash->hi_next) {
-		const char	*hstr;
-
-		if (sthash->hi_hashval != hashval)
-			continue;
-
-		hstr = &sthash->hi_mstr->sm_str[sthash->hi_mstr->sm_strlen -
-		    sthash->hi_strlen];
-		if (strcmp(str, hstr) == 0)
-			break;
-	}
-
-	/*
-	 * Did we find the string?
-	 */
-	if (sthash == 0)
-		return (-1);
-
-	/*
-	 * Has this string been copied into the string table?
-	 */
-	mstr = sthash->hi_mstr;
-	if (mstr->sm_stroff == 0) {
-		size_t	mstrlen = mstr->sm_strlen + 1;
-
-		mstr->sm_stroff = stp->st_nextoff;
-
-		/*
-		 * Have we overflowed our assigned buffer?
-		 */
-		if ((mstr->sm_stroff + mstrlen) > stp->st_fullstrsize)
-			return (-1);
-
-		(void) memcpy(stp->st_strbuf + mstr->sm_stroff,
-		    mstr->sm_str, mstrlen);
-		stp->st_nextoff += mstrlen;
-	}
-
-	/*
-	 * Calculate offset of (sub)string.
-	 */
-	*stoff = mstr->sm_stroff + mstr->sm_strlen - sthash->hi_strlen;
-
-	return (0);
-}
-
-
-static int
-st_hash_insert(Str_tbl *stp, const char *str, size_t len)
-{
-	int		i;
-	uint_t		hashval = HASHSEED;
-	uint_t		bckcnt = stp->st_hbckcnt;
-	Str_hash	**hashbcks = stp->st_hashbcks;
-	Str_hash	*sthash;
-	Str_master	*mstr = 0;
-
-	/*
-	 * We use a classic 'Bernstein k=33' hash function.  But
-	 * instead of hashing from the start of the string to the
-	 * end, we do it in reverse.
-	 *
-	 * This way - we are essentially building all of the
-	 * suffix hashvalues as we go.  We can check to see if
-	 * any suffixes already exist in the tree as we generate
-	 * the hash.
-	 */
-	for (i = len; i >= 0; i--) {
-		hashval = ((hashval << 5) + hashval) +
-		    str[i];			/* h = ((h * 33) + c) */
-
-		for (sthash = hashbcks[hashval % bckcnt];
-		    sthash; sthash = sthash->hi_next) {
-			const char	*hstr;
-			Str_master	*_mstr;
-
-			if (sthash->hi_hashval != hashval)
-				continue;
-
-			_mstr = sthash->hi_mstr;
-			hstr = &_mstr->sm_str[_mstr->sm_strlen -
-			    sthash->hi_strlen];
-
-			if (strcmp(&str[i], hstr))
-				continue;
-
-			if (i == 0) {
-				/*
-				 * Entry already in table, increment refcnt and
-				 * get out.
-				 */
-				sthash->hi_refcnt++;
-				return (0);
-			} else {
-				/*
-				 * If this 'suffix' is presently a 'master
-				 * string, then take over it's record.
-				 */
-				if (sthash->hi_strlen == _mstr->sm_strlen) {
-					/*
-					 * we should only do this once.
-					 */
-					assert(mstr == 0);
-					mstr = _mstr;
-				}
-			}
-		}
-	}
-
-	/*
-	 * Do we need a new master string, or can we take over
-	 * one we already found in the table?
-	 */
-	if (mstr == 0) {
-		/*
-		 * allocate a new master string
-		 */
-		if ((mstr = calloc(sizeof (*mstr), 1)) == 0)
-			return (-1);
-		mstr->sm_next = stp->st_mstrlist;
-		stp->st_mstrlist = mstr;
-		stp->st_strsize += len + 1;
-	} else {
-		/*
-		 * We are taking over a existing master string, the string size
-		 * only increments by the difference between the current string
-		 * and the previous master.
-		 */
-		assert(len > mstr->sm_strlen);
-		stp->st_strsize += len - mstr->sm_strlen;
-	}
-
-	if ((sthash = calloc(sizeof (*sthash), 1)) == 0)
-		return (-1);
-
-	mstr->sm_hashval = sthash->hi_hashval = hashval;
-	mstr->sm_strlen = sthash->hi_strlen = len;
-	mstr->sm_str = str;
-	sthash->hi_refcnt = 1;
-	sthash->hi_mstr = mstr;
-
-	/*
-	 * Insert string element into head of hash list
-	 */
-	hashval = hashval % bckcnt;
-	sthash->hi_next = hashbcks[hashval];
-	hashbcks[hashval] = sthash;
-	return (0);
-}
-
-/*
- * Return amount of space required for the string table.
- */
-size_t
-st_getstrtab_sz(Str_tbl *stp)
-{
-	assert(stp->st_fullstrsize > 0);
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
-		stp->st_flags |= FLG_STTAB_COOKED;
-		return (stp->st_fullstrsize);
-	}
-
-	if ((stp->st_flags & FLG_STTAB_COOKED) == 0) {
-		LenNode		*lnp;
-		void		*cookie;
-
-		stp->st_flags |= FLG_STTAB_COOKED;
-		/*
-		 * allocate a hash table about the size of # of
-		 * strings input.
-		 */
-		stp->st_hbckcnt = findprime(stp->st_strcnt);
-		if ((stp->st_hashbcks = calloc(sizeof (*stp->st_hashbcks),
-		    stp->st_hbckcnt)) == NULL)
-			return (0);
-
-		/*
-		 * We now walk all of the strings in the list, from shortest to
-		 * longest, and insert them into the hashtable.
-		 */
-		if ((lnp = avl_first(stp->st_lentree)) == NULL) {
-			/*
-			 * Is it possible we have an empty string table, if so,
-			 * the table still contains '\0', so return the size.
-			 */
-			if (avl_numnodes(stp->st_lentree) == 0) {
-				assert(stp->st_strsize == 1);
-				return (stp->st_strsize);
-			}
-			return (0);
-		}
-
-		while (lnp) {
-			StrNode	*snp;
-
-			/*
-			 * Walk the string lists and insert them into the hash
-			 * list.  Once a string is inserted we no longer need
-			 * it's entry, so the string can be freed.
-			 */
-			for (snp = avl_first(lnp->ln_strtree); snp;
-			    snp = AVL_NEXT(lnp->ln_strtree, snp)) {
-				if (st_hash_insert(stp, snp->sn_str,
-				    lnp->ln_strlen) == -1)
-					return (0);
-			}
-
-			/*
-			 * Now that the strings have been copied, walk the
-			 * StrNode tree and free all the AVL nodes.  Note,
-			 * avl_destroy_nodes() beats avl_remove() as the
-			 * latter balances the nodes as they are removed.
-			 * We just want to tear the whole thing down fast.
-			 */
-			cookie = NULL;
-			while ((snp = avl_destroy_nodes(lnp->ln_strtree,
-			    &cookie)) != NULL)
-				free(snp);
-			avl_destroy(lnp->ln_strtree);
-			free(lnp->ln_strtree);
-			lnp->ln_strtree = NULL;
-
-			/*
-			 * Move on to the next LenNode.
-			 */
-			lnp = AVL_NEXT(stp->st_lentree, lnp);
-		}
-
-		/*
-		 * Now that all of the strings have been freed, walk the
-		 * LenNode tree and free all of the AVL nodes.  Note,
-		 * avl_destroy_nodes() beats avl_remove() as the latter
-		 * balances the nodes as they are removed. We just want to
-		 * tear the whole thing down fast.
-		 */
-		cookie = NULL;
-		while ((lnp = avl_destroy_nodes(stp->st_lentree,
-		    &cookie)) != NULL)
-			free(lnp);
-		avl_destroy(stp->st_lentree);
-		free(stp->st_lentree);
-		stp->st_lentree = 0;
-	}
-
-	assert(stp->st_strsize > 0);
-	assert(stp->st_fullstrsize >= stp->st_strsize);
-
-	return (stp->st_strsize);
-}
-
-/*
- * Associate a buffer with a string table.
- */
-const char *
-st_getstrbuf(Str_tbl *stp)
-{
-	return (stp->st_strbuf);
-}
-
-int
-st_setstrbuf(Str_tbl *stp, char *stbuf, size_t bufsize)
-{
-	assert(stp->st_flags & FLG_STTAB_COOKED);
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
-		if (bufsize < stp->st_fullstrsize)
-			return (-1);
-	} else {
-		if (bufsize < stp->st_strsize)
-			return (-1);
-	}
-
-	stp->st_strbuf = stbuf;
-#ifdef	DEBUG
-	/*
-	 * for debug builds - start with a stringtable filled in
-	 * with '0xff'.  This makes it very easy to spot unfilled
-	 * holes in the strtab.
-	 */
-	memset(stbuf, 0xff, bufsize);
-	stbuf[0] = '\0';
-#else
-	memset(stbuf, 0x0, bufsize);
-#endif
-	return (0);
-}
--- /dev/null	2019-07-14 19:11:50.000000000 +0000
+++ new/usr/src/cmd/sgs/common/string_table.c	2019-07-14 19:11:55.912225217 +0000
@@ -0,0 +1,684 @@
+/*
+ * 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 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <_string_table.h>
+#include <strings.h>
+#include <sgs.h>
+#include <stdio.h>
+
+/*
+ * This file provides the interfaces to build a Str_tbl suitable for use by
+ * either the sgsmsg message system, or a standard ELF string table (SHT_STRTAB)
+ * as created by ld(1).
+ *
+ * There are two modes which can be used when constructing a string table:
+ *
+ *	st_new(0)
+ *		standard string table - no compression.  This is the
+ *		traditional, fast method.
+ *
+ *	st_new(FLG_STTAB_COMPRESS)
+ *		builds a compressed string table which both eliminates
+ *		duplicate strings, and permits strings with common suffixes
+ *		(atexit vs. exit) to overlap in the table.  This provides space
+ *		savings for many string tables.  Although more work than the
+ *		traditional method, the algorithms used are designed to scale
+ *		and keep any overhead at a minimum.
+ *
+ * These string tables are built with a common interface in a two-pass manner.
+ * The first pass finds all of the strings required for the string-table and
+ * calculates the size required for the final string table.
+ *
+ * The second pass allocates the string table, populates the strings into the
+ * table and returns the offsets the strings have been assigned.
+ *
+ * The calling sequence to build and populate a string table is:
+ *
+ *		st_new();		// initialize strtab
+ *
+ *		st_insert(st1);		// first pass of strings ...
+ *					// calculates size required for
+ *					// string table
+ *
+ *		st_delstring(st?);	// remove string previously
+ *					// inserted
+ *		st_insert(stN);
+ *
+ *		st_getstrtab_sz();	// freezes strtab and computes
+ *					// size of table.
+ *
+ *		st_setstrbuf();		// associates a final destination
+ *					// for the string table
+ *
+ *		st_setstring(st1);	// populate the string table
+ *		...			// offsets are based off of second
+ *					// pass	through the string table
+ *		st_setstring(stN);
+ *
+ *		st_destroy();		// tear down string table
+ *					// structures.
+ *
+ * String Suffix Compression Algorithm:
+ *
+ *   Here's a quick high level overview of the Suffix String
+ *   compression algorithm used.  First - the heart of the algorithm
+ *   is a Hash table list which represents a dictionary of all unique
+ *   strings inserted into the string table.  The hash function for
+ *   this table is a standard string hash except that the hash starts
+ *   at the last character in the string (&str[n - 1]) and works towards
+ *   the first character in the function (&str[0]).  As we compute the
+ *   HASH value for a given string, we also compute the hash values
+ *   for all of the possible suffix strings for that string.
+ *
+ *   As we compute the hash - at each character see if the current
+ *   suffix string for that hash is already present in the table.  If
+ *   it is, and the string is a master string.  Then change that
+ *   string to a suffix string of the new string being inserted.
+ *
+ *   When the final hash value is found (hash for str[0...n]), check
+ *   to see if it is in the hash table - if so increment the reference
+ *   count for the string.  If it is not yet in the table, insert a
+ *   new hash table entry for a master string.
+ *
+ *   The above method will find all suffixes of a given string given
+ *   that the strings are inserted from shortest to longest.  That is
+ *   why this is a two phase method, we first collect all of the
+ *   strings and store them based off of their length in an AVL tree.
+ *   Once all of the strings have been submitted we then start the
+ *   hash table build by traversing the AVL tree in order and
+ *   inserting the strings from shortest to longest as described
+ *   above.
+ */
+
+/* LINTLIBRARY */
+
+static int
+avl_len_compare(const void *n1, const void *n2)
+{
+	size_t	len1, len2;
+
+	len1 = ((LenNode *)n1)->ln_strlen;
+	len2 = ((LenNode *)n2)->ln_strlen;
+
+	if (len1 == len2)
+		return (0);
+	if (len2 < len1)
+		return (1);
+	return (-1);
+}
+
+static int
+avl_str_compare(const void *n1, const void *n2)
+{
+	const char	*str1, *str2;
+	int		rc;
+
+	str1 = ((StrNode *)n1)->sn_str;
+	str2 = ((StrNode *)n2)->sn_str;
+
+	rc = strcmp(str1, str2);
+	if (rc > 0)
+		return (1);
+	if (rc < 0)
+		return (-1);
+	return (0);
+}
+
+/*
+ * Return an initialized Str_tbl - returns NULL on failure.
+ *
+ * flags:
+ *	FLG_STTAB_COMPRESS - build a compressed string table
+ */
+Str_tbl *
+st_new(uint_t flags)
+{
+	Str_tbl	*stp;
+
+	if ((stp = calloc(sizeof (*stp), 1)) == NULL)
+		return (NULL);
+
+	/*
+	 * Start with a leading '\0' - it's tradition.
+	 */
+	stp->st_strsize = stp->st_fullstrsize = stp->st_nextoff = 1;
+
+	/*
+	 * Do we compress this string table?
+	 */
+	stp->st_flags = flags;
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
+		return (stp);
+
+	if ((stp->st_lentree = calloc(sizeof (*stp->st_lentree), 1)) == NULL)
+		return (NULL);
+
+	avl_create(stp->st_lentree, &avl_len_compare, sizeof (LenNode),
+	    SGSOFFSETOF(LenNode, ln_avlnode));
+
+	return (stp);
+}
+
+/*
+ * Insert a new string into the Str_tbl.  There are two AVL trees used.
+ *
+ *  -	The first LenNode AVL tree maintains a tree of nodes based on string
+ *	sizes.
+ *  -	Each LenNode maintains a StrNode AVL tree for each string.  Large
+ *	applications have been known to contribute thousands of strings of
+ *	the same size.  Should strings need to be removed (-z ignore), then
+ *	the string AVL tree makes this removal efficient and scalable.
+ */
+int
+st_insert(Str_tbl *stp, const char *str)
+{
+	size_t		len;
+	StrNode		*snp, sn = { 0 };
+	LenNode		*lnp, ln = { 0 };
+	avl_index_t	where;
+
+	/*
+	 * String table can't have been cooked
+	 */
+	assert((stp->st_flags & FLG_STTAB_COOKED) == 0);
+
+	/*
+	 * Null strings always point to the head of the string
+	 * table - no reason to keep searching.
+	 */
+	if ((len = strlen(str)) == 0)
+		return (0);
+
+	stp->st_fullstrsize += len + 1;
+	stp->st_strcnt++;
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
+		return (0);
+
+	/*
+	 * From the controlling string table, determine which LenNode AVL node
+	 * provides for this string length.  If the node doesn't exist, insert
+	 * a new node to represent this string length.
+	 */
+	ln.ln_strlen = len;
+	if ((lnp = avl_find(stp->st_lentree, &ln, &where)) == NULL) {
+		if ((lnp = calloc(sizeof (*lnp), 1)) == NULL)
+			return (-1);
+		lnp->ln_strlen = len;
+		avl_insert(stp->st_lentree, lnp, where);
+
+		if ((lnp->ln_strtree = calloc(sizeof (*lnp->ln_strtree), 1)) ==
+		    NULL)
+			return (0);
+
+		avl_create(lnp->ln_strtree, &avl_str_compare, sizeof (StrNode),
+		    SGSOFFSETOF(StrNode, sn_avlnode));
+	}
+
+	/*
+	 * From the string length AVL node determine whether a StrNode AVL node
+	 * provides this string.  If the node doesn't exist, insert a new node
+	 * to represent this string.
+	 */
+	sn.sn_str = str;
+	if ((snp = avl_find(lnp->ln_strtree, &sn, &where)) == NULL) {
+		if ((snp = calloc(sizeof (*snp), 1)) == NULL)
+			return (-1);
+		snp->sn_str = str;
+		avl_insert(lnp->ln_strtree, snp, where);
+	}
+	snp->sn_refcnt++;
+
+	return (0);
+}
+
+/*
+ * Remove a previously inserted string from the Str_tbl.
+ */
+int
+st_delstring(Str_tbl *stp, const char *str)
+{
+	size_t		len;
+	LenNode		*lnp, ln = { 0 };
+	StrNode		*snp, sn = { 0 };
+
+	/*
+	 * String table can't have been cooked
+	 */
+	assert((stp->st_flags & FLG_STTAB_COOKED) == 0);
+
+	len = strlen(str);
+	stp->st_fullstrsize -= len + 1;
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)
+		return (0);
+
+	/*
+	 * Determine which LenNode AVL node provides for this string length.
+	 */
+	ln.ln_strlen = len;
+	if ((lnp = avl_find(stp->st_lentree, &ln, 0)) != NULL) {
+		sn.sn_str = str;
+		if ((snp = avl_find(lnp->ln_strtree, &sn, 0)) != NULL) {
+			/*
+			 * Reduce the reference count, and if zero remove the
+			 * node.
+			 */
+			if (--snp->sn_refcnt == 0)
+				avl_remove(lnp->ln_strtree, snp);
+			return (0);
+		}
+	}
+
+	/*
+	 * No strings of this length, or no string itself - someone goofed.
+	 */
+	return (-1);
+}
+
+/*
+ * Tear down a String_Table structure.
+ */
+void
+st_destroy(Str_tbl *stp)
+{
+	Str_hash	*sthash, *psthash;
+	Str_master	*mstr, *pmstr;
+	uint_t		i;
+
+	/*
+	 * cleanup the master strings
+	 */
+	for (mstr = stp->st_mstrlist, pmstr = 0; mstr;
+	    mstr = mstr->sm_next) {
+		if (pmstr)
+			free(pmstr);
+		pmstr = mstr;
+	}
+	if (pmstr)
+		free(pmstr);
+
+	if (stp->st_hashbcks) {
+		for (i = 0; i < stp->st_hbckcnt; i++) {
+			for (sthash = stp->st_hashbcks[i], psthash = 0;
+			    sthash; sthash = sthash->hi_next) {
+				if (psthash)
+					free(psthash);
+				psthash = sthash;
+			}
+			if (psthash)
+				free(psthash);
+		}
+		free(stp->st_hashbcks);
+	}
+	free(stp);
+}
+
+
+/*
+ * For a given string - copy it into the buffer associated with
+ * the string table - and return the offset it has been assigned.
+ *
+ * If a value of '-1' is returned - the string was not found in
+ * the Str_tbl.
+ */
+int
+st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
+{
+	size_t		stlen;
+	uint_t		hashval;
+	Str_hash	*sthash;
+	Str_master	*mstr;
+	int		i;
+
+	/*
+	 * String table *must* have been previously cooked
+	 */
+	assert(stp->st_strbuf);
+
+	assert(stp->st_flags & FLG_STTAB_COOKED);
+	stlen = strlen(str);
+	/*
+	 * Null string always points to head of string table
+	 */
+	if (stlen == 0) {
+		*stoff = 0;
+		return (0);
+	}
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
+		size_t		_stoff;
+
+		stlen++;	/* count for trailing '\0' */
+		_stoff = stp->st_nextoff;
+		/*
+		 * Have we overflowed our assigned buffer?
+		 */
+		if ((_stoff + stlen) > stp->st_fullstrsize)
+			return (-1);
+		memcpy(stp->st_strbuf + _stoff, str, stlen);
+		*stoff = _stoff;
+		stp->st_nextoff += stlen;
+		return (0);
+	}
+
+	/*
+	 * Calculate reverse hash for string.
+	 */
+	hashval = HASHSEED;
+	for (i = stlen; i >= 0; i--) {
+		hashval = ((hashval << 5) + hashval) +
+		    str[i];			/* h = ((h * 33) + c) */
+	}
+
+	for (sthash = stp->st_hashbcks[hashval % stp->st_hbckcnt]; sthash;
+	    sthash = sthash->hi_next) {
+		const char	*hstr;
+
+		if (sthash->hi_hashval != hashval)
+			continue;
+
+		hstr = &sthash->hi_mstr->sm_str[sthash->hi_mstr->sm_strlen -
+		    sthash->hi_strlen];
+		if (strcmp(str, hstr) == 0)
+			break;
+	}
+
+	/*
+	 * Did we find the string?
+	 */
+	if (sthash == 0)
+		return (-1);
+
+	/*
+	 * Has this string been copied into the string table?
+	 */
+	mstr = sthash->hi_mstr;
+	if (mstr->sm_stroff == 0) {
+		size_t	mstrlen = mstr->sm_strlen + 1;
+
+		mstr->sm_stroff = stp->st_nextoff;
+
+		/*
+		 * Have we overflowed our assigned buffer?
+		 */
+		if ((mstr->sm_stroff + mstrlen) > stp->st_fullstrsize)
+			return (-1);
+
+		(void) memcpy(stp->st_strbuf + mstr->sm_stroff,
+		    mstr->sm_str, mstrlen);
+		stp->st_nextoff += mstrlen;
+	}
+
+	/*
+	 * Calculate offset of (sub)string.
+	 */
+	*stoff = mstr->sm_stroff + mstr->sm_strlen - sthash->hi_strlen;
+
+	return (0);
+}
+
+
+static int
+st_hash_insert(Str_tbl *stp, const char *str, size_t len)
+{
+	int		i;
+	uint_t		hashval = HASHSEED;
+	uint_t		bckcnt = stp->st_hbckcnt;
+	Str_hash	**hashbcks = stp->st_hashbcks;
+	Str_hash	*sthash;
+	Str_master	*mstr = 0;
+
+	/*
+	 * We use a classic 'Bernstein k=33' hash function.  But
+	 * instead of hashing from the start of the string to the
+	 * end, we do it in reverse.
+	 *
+	 * This way - we are essentially building all of the
+	 * suffix hashvalues as we go.  We can check to see if
+	 * any suffixes already exist in the tree as we generate
+	 * the hash.
+	 */
+	for (i = len; i >= 0; i--) {
+		hashval = ((hashval << 5) + hashval) +
+		    str[i];			/* h = ((h * 33) + c) */
+
+		for (sthash = hashbcks[hashval % bckcnt];
+		    sthash; sthash = sthash->hi_next) {
+			const char	*hstr;
+			Str_master	*_mstr;
+
+			if (sthash->hi_hashval != hashval)
+				continue;
+
+			_mstr = sthash->hi_mstr;
+			hstr = &_mstr->sm_str[_mstr->sm_strlen -
+			    sthash->hi_strlen];
+
+			if (strcmp(&str[i], hstr))
+				continue;
+
+			if (i == 0) {
+				/*
+				 * Entry already in table, increment refcnt and
+				 * get out.
+				 */
+				sthash->hi_refcnt++;
+				return (0);
+			} else {
+				/*
+				 * If this 'suffix' is presently a 'master
+				 * string, then take over it's record.
+				 */
+				if (sthash->hi_strlen == _mstr->sm_strlen) {
+					/*
+					 * we should only do this once.
+					 */
+					assert(mstr == 0);
+					mstr = _mstr;
+				}
+			}
+		}
+	}
+
+	/*
+	 * Do we need a new master string, or can we take over
+	 * one we already found in the table?
+	 */
+	if (mstr == 0) {
+		/*
+		 * allocate a new master string
+		 */
+		if ((mstr = calloc(sizeof (*mstr), 1)) == 0)
+			return (-1);
+		mstr->sm_next = stp->st_mstrlist;
+		stp->st_mstrlist = mstr;
+		stp->st_strsize += len + 1;
+	} else {
+		/*
+		 * We are taking over a existing master string, the string size
+		 * only increments by the difference between the current string
+		 * and the previous master.
+		 */
+		assert(len > mstr->sm_strlen);
+		stp->st_strsize += len - mstr->sm_strlen;
+	}
+
+	if ((sthash = calloc(sizeof (*sthash), 1)) == 0)
+		return (-1);
+
+	mstr->sm_hashval = sthash->hi_hashval = hashval;
+	mstr->sm_strlen = sthash->hi_strlen = len;
+	mstr->sm_str = str;
+	sthash->hi_refcnt = 1;
+	sthash->hi_mstr = mstr;
+
+	/*
+	 * Insert string element into head of hash list
+	 */
+	hashval = hashval % bckcnt;
+	sthash->hi_next = hashbcks[hashval];
+	hashbcks[hashval] = sthash;
+	return (0);
+}
+
+/*
+ * Return amount of space required for the string table.
+ */
+size_t
+st_getstrtab_sz(Str_tbl *stp)
+{
+	assert(stp->st_fullstrsize > 0);
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
+		stp->st_flags |= FLG_STTAB_COOKED;
+		return (stp->st_fullstrsize);
+	}
+
+	if ((stp->st_flags & FLG_STTAB_COOKED) == 0) {
+		LenNode		*lnp;
+		void		*cookie;
+
+		stp->st_flags |= FLG_STTAB_COOKED;
+		/*
+		 * allocate a hash table about the size of # of
+		 * strings input.
+		 */
+		stp->st_hbckcnt = findprime(stp->st_strcnt);
+		if ((stp->st_hashbcks = calloc(sizeof (*stp->st_hashbcks),
+		    stp->st_hbckcnt)) == NULL)
+			return (0);
+
+		/*
+		 * We now walk all of the strings in the list, from shortest to
+		 * longest, and insert them into the hashtable.
+		 */
+		if ((lnp = avl_first(stp->st_lentree)) == NULL) {
+			/*
+			 * Is it possible we have an empty string table, if so,
+			 * the table still contains '\0', so return the size.
+			 */
+			if (avl_numnodes(stp->st_lentree) == 0) {
+				assert(stp->st_strsize == 1);
+				return (stp->st_strsize);
+			}
+			return (0);
+		}
+
+		while (lnp) {
+			StrNode	*snp;
+
+			/*
+			 * Walk the string lists and insert them into the hash
+			 * list.  Once a string is inserted we no longer need
+			 * it's entry, so the string can be freed.
+			 */
+			for (snp = avl_first(lnp->ln_strtree); snp;
+			    snp = AVL_NEXT(lnp->ln_strtree, snp)) {
+				if (st_hash_insert(stp, snp->sn_str,
+				    lnp->ln_strlen) == -1)
+					return (0);
+			}
+
+			/*
+			 * Now that the strings have been copied, walk the
+			 * StrNode tree and free all the AVL nodes.  Note,
+			 * avl_destroy_nodes() beats avl_remove() as the
+			 * latter balances the nodes as they are removed.
+			 * We just want to tear the whole thing down fast.
+			 */
+			cookie = NULL;
+			while ((snp = avl_destroy_nodes(lnp->ln_strtree,
+			    &cookie)) != NULL)
+				free(snp);
+			avl_destroy(lnp->ln_strtree);
+			free(lnp->ln_strtree);
+			lnp->ln_strtree = NULL;
+
+			/*
+			 * Move on to the next LenNode.
+			 */
+			lnp = AVL_NEXT(stp->st_lentree, lnp);
+		}
+
+		/*
+		 * Now that all of the strings have been freed, walk the
+		 * LenNode tree and free all of the AVL nodes.  Note,
+		 * avl_destroy_nodes() beats avl_remove() as the latter
+		 * balances the nodes as they are removed. We just want to
+		 * tear the whole thing down fast.
+		 */
+		cookie = NULL;
+		while ((lnp = avl_destroy_nodes(stp->st_lentree,
+		    &cookie)) != NULL)
+			free(lnp);
+		avl_destroy(stp->st_lentree);
+		free(stp->st_lentree);
+		stp->st_lentree = 0;
+	}
+
+	assert(stp->st_strsize > 0);
+	assert(stp->st_fullstrsize >= stp->st_strsize);
+
+	return (stp->st_strsize);
+}
+
+/*
+ * Associate a buffer with a string table.
+ */
+const char *
+st_getstrbuf(Str_tbl *stp)
+{
+	return (stp->st_strbuf);
+}
+
+int
+st_setstrbuf(Str_tbl *stp, char *stbuf, size_t bufsize)
+{
+	assert(stp->st_flags & FLG_STTAB_COOKED);
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
+		if (bufsize < stp->st_fullstrsize)
+			return (-1);
+	} else {
+		if (bufsize < stp->st_strsize)
+			return (-1);
+	}
+
+	stp->st_strbuf = stbuf;
+#ifdef	DEBUG
+	/*
+	 * for debug builds - start with a stringtable filled in
+	 * with '0xff'.  This makes it very easy to spot unfilled
+	 * holes in the strtab.
+	 */
+	memset(stbuf, 0xff, bufsize);
+	stbuf[0] = '\0';
+#else
+	memset(stbuf, 0x0, bufsize);
+#endif
+	return (0);
+}
--- old/usr/src/cmd/sgs/crle/Makefile.com	2019-07-14 19:11:56.120561849 +0000
+++ new/usr/src/cmd/sgs/crle/Makefile.com	2019-07-14 19:11:56.137082632 +0000
@@ -35,9 +35,9 @@
 COMOBJ=		config.o	crle.o		depend.o	dump.o \
 		inspect.o	hash.o		print.o		util.o
 BLTOBJ=		msg.o
-TOOLSOBJ=	alist.o
+SGSCOMMONOBJ=	alist.o
 
-OBJS=		$(BLTOBJ) $(COMOBJ) $(TOOLSOBJ)
+OBJS=		$(BLTOBJ) $(COMOBJ) $(SGSCOMMONOBJ)
 
 MAPFILE=	$(MAPFILE.NGB)
 MAPOPT=		$(MAPFILE:%=-M%)
@@ -45,13 +45,12 @@
 # not linted
 SMATCH=off
 
-CPPFLAGS +=	-I$(SRC)/common/sgsrtcid -I$(SRCBASE)/uts/$(ARCH)/sys \
+CPPFLAGS +=	-I$(SRC)/common/sgsrtcid -I$(SRC)/uts/$(ARCH)/sys \
 		-D__EXTENSIONS__
 LLDFLAGS =	'-R$$ORIGIN/../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../lib/$(MACH64)'
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPT) \
-			$(LLDFLAGS) $(ZNOLAZYLOAD)
-LDLIBS +=	-lelf $(CONVLIBDIR) $(CONV_LIB) $(DLLIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPT) $(LLDFLAGS) $(ZNOLAZYLOAD)
+LDLIBS +=	-lelf $(CONVLIBDIR) -lconv
 
 BLTDEFS=        msg.h
 BLTDATA=        msg.c
@@ -66,6 +65,6 @@
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n crle_msg
 
 SRCS=		$(COMOBJ:%.o=../common/%.c) $(BLTDATA) \
-		$(TOOLSOBJ:%.o=$(SGSTOOLS)/common/%.c)
+		$(COMMON:%.o=$(SGSCOMMON)/%.c)
 
 CLEANFILES +=	$(BLTFILES)
--- old/usr/src/cmd/sgs/crle/Makefile.targ	2019-07-14 19:11:56.572342828 +0000
+++ new/usr/src/cmd/sgs/crle/Makefile.targ	2019-07-14 19:11:56.588889408 +0000
@@ -28,7 +28,7 @@
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
-%.o:            $(SGSTOOLS)/common/%.c
+%.o:            $(SGSCOMMON)/%.c
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/dump/Makefile.com	2019-07-14 19:11:57.009691544 +0000
+++ new/usr/src/cmd/sgs/dump/Makefile.com	2019-07-14 19:11:57.025839984 +0000
@@ -48,4 +48,4 @@
 
 SMOFF += indenting
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
--- old/usr/src/cmd/sgs/elfdump/Makefile.com	2019-07-14 19:11:57.444088854 +0000
+++ new/usr/src/cmd/sgs/elfdump/Makefile.com	2019-07-14 19:11:57.460670012 +0000
@@ -39,23 +39,23 @@
 
 COMOBJ64 =	elfdump64.o fake_shdr64.o
 
-TOOLOBJ =	leb128.o
+SGSCOMMONOBJ =	leb128.o
 
 BLTOBJ =	msg.o
 
-OBJS=		$(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64) $(TOOLOBJ)
+OBJS=		$(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64) $(SGSCOMMONOBJ)
 
 MAPFILE=	$(MAPFILE.NGB)
 MAPOPT=		$(MAPFILE:%=-M%)
 
 CPPFLAGS=	-I. -I../common -I../../include -I../../include/$(MACH) \
-		-I$(SRCBASE)/lib/libc/inc -I$(SRCBASE)/uts/$(ARCH)/sys \
+		-I$(SRC)/lib/libc/inc -I$(SRC)/uts/$(ARCH)/sys \
 		$(CPPFLAGS.master) -I$(ELFCAP)
 LLDFLAGS =	$(VAR_ELFDUMP_LLDFLAGS)
 LLDFLAGS64 =	$(VAR_ELFDUMP_LLDFLAGS64)
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPT) $(LLDFLAGS)
-LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) $(LDDBG_LIB) \
-		    $(CONVLIBDIR) $(CONV_LIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPT) $(LLDFLAGS)
+LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \
+		    $(CONVLIBDIR) -lconv
 
 CERRWARN +=	-_gcc=-Wno-uninitialized
 
@@ -75,6 +75,6 @@
 
 SRCS =		$(COMOBJ:%.o=../common/%.c) \
 		$(COMOBJ32:%32.o=../common/%.c) \
-		$(TOOLOBJ:%.o=../../tools/common/%.c) $(BLTDATA)
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) $(BLTDATA)
 
 CLEANFILES +=	$(BLTFILES) gen_struct_layout
--- old/usr/src/cmd/sgs/elfdump/Makefile.targ	2019-07-14 19:11:57.921629598 +0000
+++ new/usr/src/cmd/sgs/elfdump/Makefile.targ	2019-07-14 19:11:57.938956743 +0000
@@ -39,7 +39,7 @@
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
-%.o:		$(SGSTOOLS)/common/%.c
+%.o:		$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/elfedit/Makefile.com	2019-07-14 19:11:58.393234466 +0000
+++ new/usr/src/cmd/sgs/elfedit/Makefile.com	2019-07-14 19:11:58.405968244 +0000
@@ -44,13 +44,13 @@
 MAPFILE=	../common/mapfile-vers
 
 CPPFLAGS=	-I. -I../common -I../../include -I../../include/$(MACH) \
-		-I$(SRCBASE)/lib/libc/inc -I$(SRCBASE)/uts/$(ARCH)/sys \
+		-I$(SRC)/lib/libc/inc -I$(SRC)/uts/$(ARCH)/sys \
 		$(CPPFLAGS.master) -I$(ELFCAP)
 LLDFLAGS =	$(VAR_ELFEDIT_LLDFLAGS)
 LLDFLAGS64 =	$(VAR_ELFEDIT_LLDFLAGS64)
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) -M$(MAPFILE) $(LLDFLAGS)
-LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) $(LDDBG_LIB) \
-		    $(CONVLIBDIR) $(CONV_LIB) -ltecla
+LDFLAGS +=	$(VERSREF) -M$(MAPFILE) $(LLDFLAGS)
+LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \
+		    $(CONVLIBDIR) -lconv -ltecla
 
 CERRWARN +=	-_gcc=-Wno-switch
 CERRWARN +=	-_gcc=-Wno-uninitialized
--- old/usr/src/cmd/sgs/elfedit/Makefile.targ	2019-07-14 19:11:58.859214982 +0000
+++ new/usr/src/cmd/sgs/elfedit/Makefile.targ	2019-07-14 19:11:58.875405790 +0000
@@ -36,7 +36,7 @@
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
-%.o:		$(SGSTOOLS)/common/%.c
+%.o:		$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/elfedit/modules/Makefile.com	2019-07-14 19:11:59.348483657 +0000
+++ new/usr/src/cmd/sgs/elfedit/modules/Makefile.com	2019-07-14 19:11:59.365171880 +0000
@@ -67,8 +67,8 @@
 SYM_PICS=	$(SYM_OBJ:%.o=$(PICDIR)/%.o)
 SYMINFO_PICS=	$(SYMINFO_OBJ:%.o=$(PICDIR)/%.o)
 
-LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) $(LDDBG_LIB) \
-		$(CONVLIBDIR) $(CONV_LIB) -lc
+LDLIBS +=	$(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \
+		$(CONVLIBDIR) -lconv -lc
 
 $(CAP_LIB):=		PICS = $(CAP_PICS)
 $(DYN_LIB):=		PICS = $(DYN_PICS)
@@ -92,10 +92,10 @@
 MAPFILES = ../common/mapfile-vers
 
 CPPFLAGS +=	-I../../../include -I../../../include/$(MACH) \
-		-I../$(SRCBASE)/lib/libc/inc  -D_REENTRANT
+		-I$(SRC)/lib/libc/inc  -D_REENTRANT
 LLDFLAGS =	'-R$$ORIGIN/../../../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../../../lib/$(MACH64)'
-LDFLAGS +=	$(CC_USE_PROTO) $(LLDFLAGS)
+LDFLAGS +=	$(LLDFLAGS)
 DYNFLAGS +=	$(VERSREF)
 
 CERRWARN +=	-_gcc=-Wno-switch
--- old/usr/src/cmd/sgs/elfedit/modules/Makefile.targ	2019-07-14 19:11:59.818676245 +0000
+++ new/usr/src/cmd/sgs/elfedit/modules/Makefile.targ	2019-07-14 19:11:59.835360215 +0000
@@ -101,10 +101,6 @@
 $(SGSMSGDIR)/elfedit_%: $(SGSMSG) ../common/%.msg
 		$(SGSMSG) $(SGSMSGFLAGS) -l -m $(SGSMSGDIR)/elfedit_$* $<
 
-$(SGSMSG):
-		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
-		@ pwd
-
 catalog:	$(SGSMSGDIR)/elfedit_cap \
 		$(SGSMSGDIR)/elfedit_dyn \
 		$(SGSMSGDIR)/elfedit_ehdr \
--- old/usr/src/cmd/sgs/elfwrap/Makefile.com	2019-07-14 19:12:00.281725570 +0000
+++ new/usr/src/cmd/sgs/elfwrap/Makefile.com	2019-07-14 19:12:00.299754829 +0000
@@ -40,12 +40,12 @@
 
 COMOBJ64 =	elfwrap64.o
 
-TOOLOBJS =	alist.o
+SGSCOMMONOBJ =	alist.o
 
 BLTOBJ =	msg.o
 
 OBJS=		$(BLTOBJ) $(COMOBJ) $(MACHOBJ) $(COMOBJ32) $(COMOBJ64) \
-		$(TOOLOBJS)
+		$(SGSCOMMONOBJ)
 
 MAPFILES =	$(MAPFILE.NGB)
 MAPOPTS =	$(MAPFILES:%=-M%)
@@ -53,8 +53,8 @@
 CPPFLAGS =	-I. -I../common -I../../include $(CPPFLAGS.master) -I$(ELFCAP)
 LLDFLAGS =
 LLDFLAGS64 =
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPTS) $(LLDFLAGS)
-LDLIBS +=	$(ELFLIBDIR) -lelf $(CONVLIBDIR) $(CONV_LIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPTS) $(LLDFLAGS)
+LDLIBS +=	$(ELFLIBDIR) -lelf $(CONVLIBDIR) -lconv
 
 CERRWARN +=	-_gcc=-Wno-uninitialized
 
@@ -71,6 +71,6 @@
 
 SRCS =		$(COMOBJ:%.o=../common/%.c) ../common/machine.c \
 		$(COMOBJ32:%32.o=../common/%.c) \
-		$(TOOLOBJ:%.o=../../tools/common/%.c) $(BLTDATA)
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) $(BLTDATA)
 
 CLEANFILES +=	$(BLTFILES)
--- old/usr/src/cmd/sgs/elfwrap/Makefile.targ	2019-07-14 19:12:00.780577465 +0000
+++ new/usr/src/cmd/sgs/elfwrap/Makefile.targ	2019-07-14 19:12:00.800214004 +0000
@@ -38,7 +38,7 @@
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
-%.o:		$(SGSTOOLS)/common/%.c
+%.o:		$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/gprof/Makefile.com	2019-07-14 19:12:01.287933193 +0000
+++ new/usr/src/cmd/sgs/gprof/Makefile.com	2019-07-14 19:12:01.302444082 +0000
@@ -43,7 +43,7 @@
 CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
 CFLAGS +=	$(CCVERBOSE)
 CSTD=	$(CSTD_GNU99)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 CERRWARN +=	-_gcc=-Wno-uninitialized
 
 # not linted
--- old/usr/src/cmd/sgs/include/conv.h	2019-07-14 19:12:01.736470243 +0000
+++ new/usr/src/cmd/sgs/include/conv.h	2019-07-14 19:12:01.753808703 +0000
@@ -42,10 +42,7 @@
 #include <libld.h>
 #include <sgs.h>
 #include <sgsmsg.h>
-
-#ifndef	NATIVE_BUILD
 #include <sys/secflags.h>
-#endif
 
 #ifdef	__cplusplus
 extern "C" {
@@ -331,14 +328,12 @@
 	char				buf[CONV_CNOTE_PROC_FLAG_BUFSIZE];
 } Conv_cnote_proc_flag_buf_t;
 
-#ifndef	NATIVE_BUILD
 /* conv_prsecflags() */
 #define	CONV_PRSECFLAGS_BUFSIZE		57
 typedef union {
 	Conv_inv_buf_t			inv_buf;
 	char				buf[CONV_PRSECFLAGS_BUFSIZE];
 } Conv_secflags_buf_t;
-#endif
 
 /* conv_cnote_sigset() */
 #define	CONV_CNOTE_SIGSET_BUFSIZE	639
@@ -592,7 +587,7 @@
 } conv_ds_type_t;
 
 #define	CONV_DS_COMMON_FIELDS \
-	conv_ds_type_t	ds_type;   	/* Type of data structure used */ \
+	conv_ds_type_t	ds_type;	/* Type of data structure used */ \
 	uint32_t	ds_baseval;	/* Value of first item */	\
 	uint32_t	ds_topval	/* Value of last item */
 
@@ -836,10 +831,8 @@
 			    Conv_inv_buf_t *);
 extern	const char	*conv_cnote_priv(int, Conv_fmt_flags_t,
 			    Conv_inv_buf_t *);
-#ifndef	NATIVE_BUILD
 extern	const char	*conv_prsecflags(secflagset_t, Conv_fmt_flags_t,
 			    Conv_secflags_buf_t *);
-#endif
 extern	const char	*conv_cnote_psetid(int, Conv_fmt_flags_t,
 			    Conv_inv_buf_t *);
 extern	const char	*conv_cnote_sa_flags(int, Conv_fmt_flags_t,
--- old/usr/src/cmd/sgs/ld/Makefile.com	2019-07-14 19:12:02.254667705 +0000
+++ new/usr/src/cmd/sgs/ld/Makefile.com	2019-07-14 19:12:02.272906869 +0000
@@ -36,33 +36,30 @@
 OBJS =		$(BLTOBJ) $(COMOBJS)
 .PARALLEL:	$(OBJS)
 
-MAPFILES =	../common/mapfile-intf $(MAPFILE.NGB)
+SRCDIR =	$(SGSHOME)/ld
+
+MAPFILES =	$(SRCDIR)/common/mapfile-intf $(MAPFILE.NGB)
 MAPOPTS =	$(MAPFILES:%=-M%)
 
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPTS) $(VAR_LD_LLDFLAGS)
-LDLIBS +=	$(LDLIBDIR) $(LD_LIB) $(ELFLIBDIR) -lelf \
-		    $(LDDBGLIBDIR) $(LDDBG_LIB) $(CONVLIBDIR) $(CONV_LIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPTS) $(VAR_LD_LLDFLAGS)
+LDLIBS +=	$(LDLIBDIR) -lld $(ELFLIBDIR) -lelf \
+		    $(LDDBGLIBDIR) -llddbg $(CONVLIBDIR) -lconv
 
 CERRWARN +=	-_gcc=-Wno-switch
 CERRWARN +=	-_gcc=-Wno-parentheses
 
-native :=	LDFLAGS = -R$(SGSLIBDIR) $(ZNOVERSION)
-native :=	LDLIBS = -L$(SGSLIBDIR) $(LD_LIB) -lelf $(CONVLIBDIR) \
-		    $(CONV_LIB)
-native :=	CPPFLAGS += -DNATIVE_BUILD
-
 BLTDEFS=	msg.h
 BLTDATA=	msg.c
 BLTMESG=	$(SGSMSGDIR)/ld
 
 BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM=	../common/ld.msg
+SGSMSGCOM=	$(SRCDIR)/common/ld.msg
 SGSMSGTARG=	$(SGSMSGCOM)
 SGSMSGALL=	$(SGSMSGCOM)
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n ld_msg
 
-SRCS=		$(MACHOBJS:%.o=%.c)  $(COMOBJS:%.o=../common/%.c)  $(BLTDATA)
+SRCS=		$(MACHOBJS:%.o=%.c)  $(COMOBJS:%.o=$(SRCDIR)/common/%.c)  $(BLTDATA)
 
 CLEANFILES +=	$(BLTFILES)
 
--- old/usr/src/cmd/sgs/ld/Makefile.targ	2019-07-14 19:12:02.655711903 +0000
+++ new/usr/src/cmd/sgs/ld/Makefile.targ	2019-07-14 19:12:02.671337323 +0000
@@ -29,10 +29,7 @@
 
 all:		$(PROG)
 
-package \
-install:	all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK)
-
-%.o:		../common/%.c
+%.o:		$(SRCDIR)/common/%.c
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
@@ -49,15 +46,6 @@
 include		$(SRC)/cmd/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSBINDIR)/$(PROG)
-
-$(SGSBINDIR)/$(PROG):	$(OBJS) $(SGSBINDIR)
-		$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
-		$(POST_PROCESS)
-
 # Derived source and header files (messaging).
 
 catalog:	$(BLTMESG)
--- old/usr/src/cmd/sgs/ld/amd64/Makefile	2019-07-14 19:12:03.138867880 +0000
+++ new/usr/src/cmd/sgs/ld/amd64/Makefile	2019-07-14 19:12:03.156837331 +0000
@@ -23,7 +23,6 @@
 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
 #
 
 include		../Makefile.com
@@ -33,12 +32,11 @@
 LDDBGLIBDIR =	$(LDDBGLIBDIR64)
 CONVLIBDIR =	$(CONVLIBDIR64)
 
-VAR_SGSBINPROG=	$(VAR_SGSBINPROG64)
-VAR_SGSCCSLINK=	$(VAR_SGSCCSLINK64)
-
 VAR_LD_LLDFLAGS = \
 		$(VAR_LD_LLDFLAGS64)
 
+package install:	all $(VAR_SGSBINPROG64) $(VAR_SGSCCSLINK64)
+
 .KEEP_STATE:
 
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/ld/i386/Makefile	2019-07-14 19:12:03.598492057 +0000
+++ new/usr/src/cmd/sgs/ld/i386/Makefile	2019-07-14 19:12:03.614405084 +0000
@@ -19,9 +19,6 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Copyright (c) 1996 by Sun Microsystems, Inc.
 # All rights reserved.
 
@@ -29,4 +26,6 @@
 
 .KEEP_STATE:
 
+package install:	all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK)
+
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/ld/sparc/Makefile	2019-07-14 19:12:04.081341383 +0000
+++ new/usr/src/cmd/sgs/ld/sparc/Makefile	2019-07-14 19:12:04.099571122 +0000
@@ -19,9 +19,6 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Copyright (c) 1996 by Sun Microsystems, Inc.
 # All rights reserved.
 
@@ -29,4 +26,6 @@
 
 .KEEP_STATE:
 
+package install:	all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK)
+
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/ld/sparcv9/Makefile	2019-07-14 19:12:04.571600380 +0000
+++ new/usr/src/cmd/sgs/ld/sparcv9/Makefile	2019-07-14 19:12:04.592261808 +0000
@@ -23,8 +23,6 @@
 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 include		../Makefile.com
 
@@ -33,13 +31,12 @@
 LDDBGLIBDIR =	$(LDDBGLIBDIR64)
 CONVLIBDIR =	$(CONVLIBDIR64)
 
-VAR_SGSBINPROG= $(VAR_SGSBINPROG64)
-VAR_SGSCCSLINK= $(VAR_SGSCCSLINK64)
-
 VAR_LD_LLDFLAGS = \
 		$(VAR_LD_LLDFLAGS64)
 
 .KEEP_STATE:
 
+package install:	all $(VAR_SGSBINPROG64) $(VAR_SGSCCSLINK64)
+
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- old/usr/src/cmd/sgs/ldd/Makefile.com	2019-07-14 19:12:05.048656924 +0000
+++ new/usr/src/cmd/sgs/ldd/Makefile.com	2019-07-14 19:12:05.066213315 +0000
@@ -34,20 +34,20 @@
 
 COMOBJ=		ldd.o
 BLTOBJ=		msg.o
-TOOLSOBJ=	alist.o
+SGSCOMMONOBJ=	alist.o
 
-OBJS=		$(BLTOBJ) $(COMOBJ) $(TOOLSOBJ)
+OBJS=		$(BLTOBJ) $(COMOBJ) $(SGSCOMMONOBJ)
 
 MAPFILE=	$(MAPFILE.NGB)
 MAPOPTS=	$(MAPFILE:%=-M%)
 
 CPPFLAGS +=	-I. -I../../include -I../../include/$(MACH) \
-		-I$(SRCBASE)/uts/$(ARCH)/sys \
+		-I$(SRC)/uts/$(ARCH)/sys \
 		$(CPPFLAGS.master)
 LLDFLAGS =	'-R$$ORIGIN/../../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../../lib/$(MACH64)'
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPTS) $(LLDFLAGS)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lelf $(DLLIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPTS) $(LLDFLAGS)
+LDLIBS +=	$(CONVLIBDIR) -lconv -lelf
 
 SMOFF += or_vs_and
 
@@ -63,6 +63,6 @@
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n ldd_msg
 
 SRCS=		$(COMOBJ:%.o=../common/%.c) $(BLTDATA) \
-		$(TOOLSOBJ:%.o=$(SGSTOOLS)/common/%.c)
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c)
 
 CLEANFILES +=	$(BLTFILES)
--- old/usr/src/cmd/sgs/ldd/Makefile.targ	2019-07-14 19:12:05.511808524 +0000
+++ new/usr/src/cmd/sgs/ldd/Makefile.targ	2019-07-14 19:12:05.528816976 +0000
@@ -26,7 +26,7 @@
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
-%.o:            $(SGSTOOLS)/common/%.c
+%.o:            $(SGSCOMMON)/%.c
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
@@ -49,7 +49,6 @@
 include		$(SRC)/cmd/sgs/Makefile.targ
 
 # Derived source and header files (messaging).
- 
 catalog:        $(BLTMESG)
 
 chkmsg:		$(SRCS)
--- old/usr/src/cmd/sgs/ldprof/Makefile.com	2019-07-14 19:12:05.993327115 +0000
+++ new/usr/src/cmd/sgs/ldprof/Makefile.com	2019-07-14 19:12:06.014101972 +0000
@@ -38,14 +38,13 @@
 
 MAPFILES =	../common/mapfile-vers
 
-DYNFLAGS +=	$(CC_USE_PROTO)
 CPPFLAGS=	-I. -I../common -I../../include \
 		-I../../rtld/common \
 		-I../../include/$(MACH) \
-		-I$(SRCBASE)/lib/libc/inc \
-		-I$(SRCBASE)/uts/common/krtld \
+		-I$(SRC)/lib/libc/inc \
+		-I$(SRC)/uts/common/krtld \
 		-I$(SRC)/common/sgsrtcid \
-		-I$(SRCBASE)/uts/$(ARCH)/sys \
+		-I$(SRC)/uts/$(ARCH)/sys \
 		$(CPPFLAGS.master) -I$(ELFCAP)
 CFLAGS +=	$(C_PICFLAGS)
 
--- old/usr/src/cmd/sgs/libconv/Makefile.com	2019-07-14 19:12:06.461208483 +0000
+++ new/usr/src/cmd/sgs/libconv/Makefile.com	2019-07-14 19:12:06.477406185 +0000
@@ -89,6 +89,8 @@
 include	$(SRC)/lib/Makefile.lib
 include	$(SRC)/cmd/sgs/Makefile.com
 
+SRCDIR =	$(SRC)/cmd/sgs/libconv
+
 CERRWARN	+= -_gcc=-Wno-type-limits
 CERRWARN	+= -_gcc=-Wno-switch
 
@@ -97,12 +99,12 @@
 
 CTFCONVERT_O=
 
-README_REVISION=../../packages/common/readme_revision
-ONLDREADME=	../../packages/common/SUNWonld-README
+README_REVISION= $(SGSHOME)/tools/readme_revision
+ONLDREADME=	 $(SGSHOME)/tools/SUNWonld-README
 
 PICS=		$(OBJECTS:%=pics/%)
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc -I$(ELFCAP) \
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc -I$(ELFCAP) \
 		-I$(SRC)/common/sgsrtcid
 
 ARFLAGS=	cr
--- old/usr/src/cmd/sgs/libconv/Makefile.targ	2019-07-14 19:12:06.921773462 +0000
+++ new/usr/src/cmd/sgs/libconv/Makefile.targ	2019-07-14 19:12:06.942881900 +0000
@@ -26,7 +26,7 @@
 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
 #
 
-pics/%.o:	../common/%.c
+pics/%.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
@@ -34,11 +34,11 @@
 		$(COMPILE.s) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%32.o:	../common/%.c
+pics/%32.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%64.o:	../common/%.c
+pics/%64.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
@@ -55,27 +55,23 @@
 #
 # We make this depend on Makefile.targ, because a change to Makefile.targ
 # can change the limit, in which case we want to force everything to rebuild.
-report_bufsize.h:	../Makefile.targ
-		perl ../../tools/libconv_mk_report_bufsize.pl 8000
+report_bufsize.h:	$(SRCDIR)/Makefile.targ
+		perl $(SRC)/cmd/sgs/tools/libconv_mk_report_bufsize.pl 8000
 
-../common/%.c ../common/%_machelf.c:	%_msg.h
+$(SRCDIR)/common/%.c $(SRCDIR)/common/%_machelf.c:	%_msg.h
 
-%_msg.h %_msg.c: $(SGSMSG) ../common/%.msg report_bufsize.h
+%_msg.h + %_msg.c: $(SGSMSG) $(SRCDIR)/common/%.msg report_bufsize.h
 		$(SGSMSG) $(SGSMSGFLAGS) -h $*_msg.h -d $*_msg.c \
 			-n sgs_msg_libconv_$* $<
 
-$(SGSMSG):	FRC
-		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
-		@ pwd
-
 vernote.s:	bld_vernote $(README_REVISION) $(ONLDREADME)
 		./bld_vernote \
 			-R `perl $(README_REVISION) $(ONLDREADME)` \
 			-r "$(RELEASE)" -o $@
 
-bld_vernote:	../common/bld_vernote.ksh
+bld_vernote:	$(SRCDIR)/common/bld_vernote.ksh
 		$(RM) -f $@
-		cp ../common/bld_vernote.ksh $@
+		cp $(SRCDIR)/common/bld_vernote.ksh $@
 		chmod a+x $@
 
 $(LIBRARY):	pics $$(PICS)
@@ -89,7 +85,7 @@
 catalog:
 
 pics:
-		-@mkdir -p $@
+		$(MKDIR) -p $@
 
 clobber:	clean
 		-$(RM) $(LIBRARY) $(CLOBBERFILES)
--- old/usr/src/cmd/sgs/libcrle/Makefile.com	2019-07-14 19:12:07.381525453 +0000
+++ new/usr/src/cmd/sgs/libcrle/Makefile.com	2019-07-14 19:12:07.397794117 +0000
@@ -42,8 +42,8 @@
 
 LDLIBS +=	$(ZRECORD) -lmapmalloc $(DLLIB) -lc
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc -I$(SRC)/common/sgsrtcid
-DYNFLAGS +=	$(VERSREF) $(CONVLIBDIR) -lconv $(CC_USE_PROTO)
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc -I$(SRC)/common/sgsrtcid
+DYNFLAGS +=	$(VERSREF) $(CONVLIBDIR) -lconv
 
 BLTDEFS=	msg.h
 BLTDATA=	msg.c
--- old/usr/src/cmd/sgs/libelf/Makefile.com	2019-07-14 19:12:07.845477264 +0000
+++ new/usr/src/cmd/sgs/libelf/Makefile.com	2019-07-14 19:12:07.862841536 +0000
@@ -52,20 +52,22 @@
 
 include $(SRC)/lib/Makefile.lib
 
+SRCDIR=	$(SRC)/cmd/sgs/libelf
+
 # Use the value of M4 set in Makefile.master via Makefile.lib
 
 DEMOFILES=	Makefile	00README	acom.c		dcom.c \
 		pcom.c		tpcom.c		dispsyms.c
-DEMOFILESRCDIR=	../demo
+DEMOFILESRCDIR=	$(SRCDIR)/demo
 ROOTDEMODIRBASE=$(ROOT)/usr/demo/ELF
 ROOTDEMODIRS=   $(ROOTDEMODIRBASE)
 
 include $(SRC)/cmd/sgs/Makefile.com
 
-MAPFILES =	../common/mapfile-vers
+MAPFILES =	$(SRCDIR)/common/mapfile-vers
 
 DYNFLAGS +=	$(VERSREF)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
+LDLIBS +=	$(CONVLIBDIR) -lconv -lc
 
 CERRWARN +=	-_gcc=-Wno-parentheses
 CERRWARN +=	-_gcc=-Wno-uninitialized
@@ -83,8 +85,8 @@
 
 BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM=	../common/libelf.msg
-SGSMSG32=	../common/libelf.32.msg
+SGSMSGCOM=	$(SRCDIR)/common/libelf.msg
+SGSMSG32=	$(SRCDIR)/common/libelf.32.msg
 SGSMSGTARG=	$(SGSMSGCOM)
 SGSMSGALL=	$(SGSMSGCOM) $(SGSMSG32)
 
@@ -92,7 +94,7 @@
 SGSMSGFLAGS2=	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libelf_msg
 
 BLTSRCS=	$(BLTOBJS:%.o=%.c)
-LIBSRCS=	$(COMOBJS:%.o=../common/%.c)  $(MISCOBJS:%.o=../misc/%.c) \
+LIBSRCS=	$(COMOBJS:%.o=$(SRCDIR)/common/%.c)  $(MISCOBJS:%.o=$(SRCDIR)/misc/%.c) \
 		$(MACHOBJS:%.o=%.c)  $(BLTSRCS)
 
 ROOTFS_DYNLIB=		$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
--- old/usr/src/cmd/sgs/libelf/Makefile.targ	2019-07-14 19:12:08.325428209 +0000
+++ new/usr/src/cmd/sgs/libelf/Makefile.targ	2019-07-14 19:12:08.340666658 +0000
@@ -30,25 +30,22 @@
 		$(POST_PROCESS_O)
 
 objs/%64.o \
-pics/%64.o:	../common/%.c
+pics/%64.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
 objs/%.o \
-pics/%.o:	../misc/%.c
+pics/%.o:	$(SRCDIR)/misc/%.c
 		$(COMPILE.c) -DELF -o $@ $<
 		$(POST_PROCESS_O)
 
 objs/%.o \
-pics/%.o:	../common/%.c
+pics/%.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 all:		$(BLTSRCS) .WAIT $(LIBS) $(LIBLINKS)
 
-install:	all .WAIT $(ROOTFS_LIBS) $(ROOTFS_LINKS) \
-		.WAIT $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
-
 delete:
 		$(RM) $(DYNLIB)
 
@@ -63,11 +60,11 @@
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
-xlate.c:	../common/xlate.m4
-		$(M4) < ../common/xlate.m4 > xlate.c
+xlate.c:	$(SRCDIR)/common/xlate.m4
+		$(M4) < $(SRCDIR)/common/xlate.m4 > xlate.c
 
-xlate64.c:	../common/xlate64.m4
-		$(M4) < ../common/xlate64.m4 > xlate64.c
+xlate64.c:	$(SRCDIR)/common/xlate64.m4
+		$(M4) < $(SRCDIR)/common/xlate64.m4 > xlate64.c
 
 
 objs/msg.o \
@@ -82,22 +79,8 @@
 objs/xlate.o \
 pics/xlate.o:	xlate.c
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSLIBDIR)/$(LIBLINKS)
-
 $(PICS):	pics
 
-$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
-		$(BUILD.SO)
-		$(POST_PROCESS_SO)
-
-$(SGSLIBDIR)/$(LIBLINKS): $(SGSLIBDIR)/$(DYNLIB)
-		-@$(RM) $(SGSLIBDIR)/$(LIBLINKS)
-		$(SYMLINK) $(DYNLIB) $(SGSLIBDIR)/$(LIBLINKS)
-
-
 # Derived source and header files (messaging).  Make sure that the sgsmsg
 # command is constructed - libelf might not be built with the whole sgs.
 
@@ -107,14 +90,10 @@
 		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
 
 $(BLTDEFS) + \
-$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
+$(BLTDATA):	$(SGSMSGTARG)
 		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
 
-$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
+$(BLTMESG):	$(SGSMSGALL) xlate.c xlate64.c
 		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
 
-$(SGSMSG):	FRC
-		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
-		@ pwd
-
 FRC:
--- old/usr/src/cmd/sgs/libelf/Makefile.targ.64	2019-07-14 19:12:08.788529202 +0000
+++ new/usr/src/cmd/sgs/libelf/Makefile.targ.64	2019-07-14 19:12:08.804920293 +0000
@@ -45,8 +45,6 @@
 
 all:		$(BLTSRCS) .WAIT $(LIBS) $(LIBLINKS)
 
-install:	all .WAIT $(ROOTFS_LIBS64) $(ROOTFS_LINKS64)
-
 delete:
 		$(RM) $(DYNLIB)
 
@@ -89,16 +87,12 @@
 		sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS)
 
 $(BLTDEFS) + \
-$(BLTDATA):	$(SGSMSG) $(SGSMSGTARG)
+$(BLTDATA):	$(SGSMSGTARG)
 		$(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
 
-$(BLTMESG):	$(SGSMSG) $(SGSMSGALL) xlate.c xlate64.c
+$(BLTMESG):	$(SGSMSGALL) xlate.c xlate64.c
 		$(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)
 
-$(SGSMSG):	FRC
-		@ cd $(SGSTOOLS)/$(MACH); pwd; $(MAKE) catalog
-		@ pwd
-
 #
 # 64-bit overrides
 #
--- old/usr/src/cmd/sgs/libelf/amd64/Makefile	2019-07-14 19:12:09.557143341 +0000
+++ new/usr/src/cmd/sgs/libelf/amd64/Makefile	2019-07-14 19:12:09.573979114 +0000
@@ -34,4 +34,6 @@
 
 .KEEP_STATE:
 
+install:	all .WAIT $(ROOTFS_LIBS64) $(ROOTFS_LINKS64)
+
 include		../Makefile.targ.64
--- old/usr/src/cmd/sgs/libelf/i386/Makefile	2019-07-14 19:12:10.022059849 +0000
+++ new/usr/src/cmd/sgs/libelf/i386/Makefile	2019-07-14 19:12:10.040201405 +0000
@@ -29,4 +29,7 @@
 
 .KEEP_STATE:
 
+install:	all .WAIT $(ROOTFS_LIBS) $(ROOTFS_LINKS) \
+		.WAIT $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
+
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/libelf/sparc/Makefile	2019-07-14 19:12:10.484097482 +0000
+++ new/usr/src/cmd/sgs/libelf/sparc/Makefile	2019-07-14 19:12:10.503298588 +0000
@@ -29,4 +29,7 @@
 
 .KEEP_STATE:
 
+install:	all .WAIT $(ROOTFS_LIBS) $(ROOTFS_LINKS) \
+		.WAIT $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)
+
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/libelf/sparcv9/Makefile	2019-07-14 19:12:10.974205516 +0000
+++ new/usr/src/cmd/sgs/libelf/sparcv9/Makefile	2019-07-14 19:12:10.994647984 +0000
@@ -34,4 +34,6 @@
 
 .KEEP_STATE:
 
+install:	all .WAIT $(ROOTFS_LIBS64) $(ROOTFS_LINKS64)
+
 include		../Makefile.targ.64
--- old/usr/src/cmd/sgs/libld/Makefile.com	2019-07-14 19:12:11.466245415 +0000
+++ new/usr/src/cmd/sgs/libld/Makefile.com	2019-07-14 19:12:11.484070916 +0000
@@ -47,7 +47,7 @@
 		sunwmove64.o	support64.o	syms64.o	update64.o \
 		unwind64.o	version64.o	wrap64.o
 
-TOOLOBJS =	alist.o		assfail.o	findprime.o	string_table.o \
+SGSCOMMONOBJ =	alist.o		assfail.o	findprime.o	string_table.o \
 		strhash.o
 AVLOBJ =	avl.o
 
@@ -60,13 +60,13 @@
 L_SPARC_MACHOBJS64 =	machrel.sparc64.o	machsym.sparc64.o
 
 # Target specific objects (i386/amd64)
-E_X86_TOOLOBJS =	leb128.o
+E_X86_COMMONOBJ =	leb128.o
 L_X86_MACHOBJS32 =	machrel.intel32.o
 L_X86_MACHOBJS64 =	machrel.amd64.o
 
 # All target specific objects rolled together
-E_TOOLOBJS =	$(E_SPARC_TOOLOBJS) \
-	$(E_X86_TOOLOBJS)
+E_COMMONOBJ =	$(E_SPARC_COMMONOBJ) \
+	$(E_X86_COMMONOBJ)
 L_MACHOBJS32 =	$(L_SPARC_MACHOBJS32) \
 	$(L_X86_MACHOBJS32)
 L_MACHOBJS64 =	$(L_SPARC_MACHOBJS64) \
@@ -79,12 +79,13 @@
 OBJECTS =	$(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \
 		$(L_MACHOBJS32) $(L_MACHOBJS64) \
 		$(COMOBJS) $(COMOBJS32) $(COMOBJS64) \
-		$(TOOLOBJS) $(E_TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ)
+		$(SGSCOMMONOBJ) $(E_COMMONOBJ) $(AVLOBJ) $(ELFCAPOBJ)
 
 include		$(SRC)/lib/Makefile.lib
 include		$(SRC)/cmd/sgs/Makefile.com
 
-SRCDIR =	../common
+SRCDIR =	$(SGSHOME)/libld
+MAPFILEDIR =	$(SRCDIR)/common
 
 CERRWARN += -_gcc=-Wno-unused-value
 CERRWARN += -_gcc=-Wno-parentheses
@@ -98,20 +99,18 @@
 
 # Location of the shared relocation engines maintained under usr/src/uts.
 #
-KRTLD_I386 = $(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld
-KRTLD_AMD64 = $(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld
-KRTLD_SPARC = $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
+KRTLD_I386 = $(SRC)/uts/$(VAR_PLAT_i386)/krtld
+KRTLD_AMD64 = $(SRC)/uts/$(VAR_PLAT_amd64)/krtld
+KRTLD_SPARC = $(SRC)/uts/$(VAR_PLAT_sparc)/krtld
 
 
-CPPFLAGS +=	-DUSE_LIBLD_MALLOC -I$(SRCBASE)/lib/libc/inc \
-		    -I$(SRCBASE)/uts/common/krtld -I$(SRCBASE)/uts/sparc \
+CPPFLAGS +=	-DUSE_LIBLD_MALLOC -I$(SRC)/lib/libc/inc \
+		    -I$(SRC)/uts/common/krtld -I$(SRC)/uts/sparc \
 		    $(VAR_LIBLD_CPPFLAGS)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(LDDBGLIBDIR) $(LDDBG_LIB) \
+LDLIBS +=	$(CONVLIBDIR) -lconv $(LDDBGLIBDIR) -llddbg \
 		    $(ELFLIBDIR) -lelf $(DLLIB) -lc
 
-DYNFLAGS +=	$(VERSREF) $(CC_USE_PROTO) '-R$$ORIGIN'
-
-native:=	DYNFLAGS	+= $(CONVLIBDIR)
+DYNFLAGS +=	$(VERSREF) '-R$$ORIGIN'
 
 BLTDEFS =	msg.h
 BLTDATA =	msg.c
@@ -123,26 +122,26 @@
 # However, we keep target specific messages in their own separate files for
 # organizational reasons.
 #
-SGSMSGCOM =	../common/libld.msg
-SGSMSGSPARC =	../common/libld.sparc.msg
-SGSMSGINTEL =	../common/libld.intel.msg
+SGSMSGCOM =	$(SRCDIR)/common/libld.msg
+SGSMSGSPARC =	$(SRCDIR)/common/libld.sparc.msg
+SGSMSGINTEL =	$(SRCDIR)/common/libld.intel.msg
 SGSMSGTARG =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
 SGSMSGALL =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
 
 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) \
+CHKSRCS =	$(SRC)/uts/common/krtld/reloc.h \
+		$(COMOBJS32:%32.o=$(SRCDIR)/common/%.c) \
+		$(L_MACHOBJS32:%32.o=$(SRCDIR)/common/%.c) \
+		$(L_MACHOBJS64:%64.o=$(SRCDIR)/common/%.c) \
 		$(KRTLD_I386)/doreloc.c \
 		$(KRTLD_AMD64)/doreloc.c \
 		$(KRTLD_SPARC)/doreloc.c
 
-LIBSRCS =	$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
-		$(E_TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
-		$(COMOBJS:%.o=../common/%.c) \
+LIBSRCS =	$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \
+		$(COMOBJS:%.o=$(SRCDIR)/common/%.c) \
 		$(AVLOBJS:%.o=$(VAR_AVLDIR)/%.c) \
 		$(BLTDATA)
 
--- old/usr/src/cmd/sgs/libld/Makefile.targ	2019-07-14 19:12:11.954711147 +0000
+++ new/usr/src/cmd/sgs/libld/Makefile.targ	2019-07-14 19:12:11.970703323 +0000
@@ -26,15 +26,15 @@
 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
 #
 
-pics/%.o:	../common/%.c
+pics/%.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%32.o:	../common/%.c
+pics/%32.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%64.o:	../common/%.c
+pics/%64.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ -D_ELF64 $<
 		$(POST_PROCESS_O)
 
@@ -46,7 +46,7 @@
 		$(COMPILE.c) -o $@ -D_ELF64 $<
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SGSTOOLS)/common/%.c
+pics/%.o:	$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
@@ -94,21 +94,8 @@
 delete:
 		$(RM) $(DYNLIB)
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSLIBDIR)/$(LIBLINKS)
-
 $(PICS):	pics
 
-$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
-		$(BUILD.SO)
-		$(POST_PROCESS_SO)
-
-$(SGSLIBDIR)/$(LIBLINKS): $(SGSLIBDIR)/$(DYNLIB)
-		@$(RM) $(SGSLIBDIR)/$(LIBLINKS)
-		$(SYMLINK) $(DYNLIB) $(SGSLIBDIR)/$(LIBLINKS)
-
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
--- old/usr/src/cmd/sgs/liblddbg/Makefile.com	2019-07-14 19:12:12.426560020 +0000
+++ new/usr/src/cmd/sgs/liblddbg/Makefile.com	2019-07-14 19:12:12.442976752 +0000
@@ -47,26 +47,24 @@
 
 BLTOBJ =	msg.o
 
-TOOLOBJ =	alist.o
+SGSCOMMONOBJ =	alist.o
 
-OBJECTS =	$(BLTOBJ) $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(TOOLOBJ)
+OBJECTS =	$(BLTOBJ) $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(SGSCOMMONOBJ)
 
 
 include		$(SRC)/lib/Makefile.lib
 include		$(SRC)/cmd/sgs/Makefile.com
 
-SRCDIR =	../common
+SRCDIR =	$(SGSHOME)/liblddbg
+MAPFILEDIR =	$(SRCDIR)/common
 
 CERRWARN +=	-_gcc=-Wno-unused-value
 CERRWARN +=	-_gcc=-Wno-uninitialized
 CERRWARN +=	-_gcc=-Wno-parentheses
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc
-DYNFLAGS +=	$(VERSREF) $(CC_USE_PROTO) '-R$$ORIGIN'
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
-
-native :=	DYNFLAGS	+= $(CONVLIBDIR)
-native :=	CPPFLAGS	+= -DNATIVE_BUILD
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc
+DYNFLAGS +=	$(VERSREF) '-R$$ORIGIN'
+LDLIBS +=	$(CONVLIBDIR) -lconv -lc
 
 BLTDEFS =	msg.h
 BLTDATA =	msg.c
@@ -74,15 +72,15 @@
 
 BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
 
-SGSMSGCOM =	../common/liblddbg.msg
+SGSMSGCOM =	$(SRCDIR)/common/liblddbg.msg
 SGSMSGALL =	$(SGSMSGCOM)
 SGSMSGTARG =	$(SGSMSGCOM)
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n liblddbg_msg
 
-CHKSRCS =	$(COMOBJS32:%32.o=../common/%.c)
+CHKSRCS =	$(COMOBJS32:%32.o=$(SRCDIR)/common/%.c)
 
-LIBSRCS =	$(COMOBJS:%.o=../common/%.c) \
-		$(TOOLOBJ:%.o=$(SGSTOOLS)/common/%.c) $(BLTDATA)
+LIBSRCS =	$(COMOBJS:%.o=$(SRCDIR)/common/%.c) \
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) $(BLTDATA)
 
 CLEANFILES +=	$(BLTFILES)
 CLOBBERFILES +=	$(DYNLIB) $(LIBLINKS)
--- old/usr/src/cmd/sgs/liblddbg/Makefile.targ	2019-07-14 19:12:12.887390889 +0000
+++ new/usr/src/cmd/sgs/liblddbg/Makefile.targ	2019-07-14 19:12:12.906757748 +0000
@@ -26,19 +26,19 @@
 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
 #
 
-pics/%.o:	../common/%.c
+pics/%.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SGSTOOLS)/common/%.c
+pics/%.o:	$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%32.o:	../common/%.c
+pics/%32.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%64.o:	../common/%.c
+pics/%64.o:	$(SRCDIR)/common/%.c
 		$(COMPILE.c) -D_ELF64 -o $@ $<
 		$(POST_PROCESS_O)
 
@@ -48,21 +48,8 @@
 delete:
 		$(RM) $(DYNLIB)
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSLIBDIR)/$(LIBLINKS)
-
 $(PICS):	pics
 
-$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
-		$(BUILD.SO)
-		$(POST_PROCESS_SO)
-
-$(SGSLIBDIR)/$(LIBLINKS): $(SGSLIBDIR)/$(DYNLIB)
-		-@$(RM) $(SGSLIBDIR)/$(LIBLINKS)
-		$(SYMLINK) $(DYNLIB) $(SGSLIBDIR)/$(LIBLINKS)
-
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
--- old/usr/src/cmd/sgs/libldmake/Makefile.com	2019-07-14 19:12:13.368638027 +0000
+++ new/usr/src/cmd/sgs/libldmake/Makefile.com	2019-07-14 19:12:13.381208577 +0000
@@ -38,8 +38,6 @@
 
 SRCDIR =	../common
 
-DYNFLAGS +=	$(CC_USE_PROTO)
-
 CFLAGS +=	$(C_PICFLAGS)
 CFLAGS64 +=	$(C_PICFLAGS64)
 
--- old/usr/src/cmd/sgs/libldstab/Makefile.com	2019-07-14 19:12:13.778857275 +0000
+++ new/usr/src/cmd/sgs/libldstab/Makefile.com	2019-07-14 19:12:13.795894727 +0000
@@ -38,12 +38,11 @@
 include		$(SRC)/cmd/sgs/Makefile.com
 
 SRCDIR =	../common
-SRCBASE=	../../../..
 
 CPPFLAGS +=	-I$(ELFCAP)
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc
-DYNFLAGS +=	$(VERSREF) $(CC_USE_PROTO)
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc
+DYNFLAGS +=	$(VERSREF)
 
 SRCS=		$(COMOBJS:%.o=../common/%.c)
 
--- old/usr/src/cmd/sgs/libldstab/Makefile.targ	2019-07-14 19:12:14.219021993 +0000
+++ new/usr/src/cmd/sgs/libldstab/Makefile.targ	2019-07-14 19:12:14.234702966 +0000
@@ -37,17 +37,8 @@
 delete:
 		-$(RM) $(DYNLIB)
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSLIBDIR)/$(DYNLIB)
-
 $(PICS):	pics
 
-$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
-		$(BUILD.SO)
-		$(POST_PROCESS_SO)
-
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
 
--- old/usr/src/cmd/sgs/librtld/Makefile.com	2019-07-14 19:12:14.667231969 +0000
+++ new/usr/src/cmd/sgs/librtld/Makefile.com	2019-07-14 19:12:14.682022614 +0000
@@ -41,11 +41,11 @@
 include		$(SRC)/cmd/sgs/Makefile.com
 
 SRCDIR =	../common
-CPPFLAGS +=	-I../../rtld/common -I$(SRCBASE)/lib/libc/inc \
-		-I$(SRCBASE)/uts/common/krtld -I$(SRC)/common/sgsrtcid \
-		-I$(SRCBASE)/uts/sparc
-DYNFLAGS +=	$(VERSREF) $(CC_USE_PROTO)  '-R$$ORIGIN'
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc
+CPPFLAGS +=	-I../../rtld/common -I$(SRC)/lib/libc/inc \
+		-I$(SRC)/uts/common/krtld -I$(SRC)/common/sgsrtcid \
+		-I$(SRC)/uts/sparc
+DYNFLAGS +=	$(VERSREF) '-R$$ORIGIN'
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc
 
 CERRWARN +=	-_gcc=-Wno-parentheses
 CERRWARN +=	-_gcc=-Wno-unused-value
--- old/usr/src/cmd/sgs/librtld/Makefile.targ	2019-07-14 19:12:15.096368569 +0000
+++ new/usr/src/cmd/sgs/librtld/Makefile.targ	2019-07-14 19:12:15.112397105 +0000
@@ -36,20 +36,8 @@
 delete:
 		$(RM) $(DYNLIB)
 
-# Special target for native builds (ie. when we need to build a version of ld
-# to build a version of ld :-).
-
-native:		$(SGSLIBDIR)/$(LIBLINKS)
-
 $(PICS):	pics
 
-$(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
-		$(BUILD.SO)
-		$(POST_PROCESS_SO)
-
-$(SGSLIBDIR)/$(LIBLINKS): $(SGSLIBDIR)/$(DYNLIB)
-		-@$(RM) $(SGSLIBDIR)/$(LIBLINKS)
-		$(SYMLINK) $(DYNLIB) $(SGSLIBDIR)/$(LIBLINKS)
 
 include		$(SRC)/lib/Makefile.targ
 include		$(SRC)/cmd/sgs/Makefile.targ
--- old/usr/src/cmd/sgs/librtld_db/Makefile.com	2019-07-14 19:12:15.541735841 +0000
+++ new/usr/src/cmd/sgs/librtld_db/Makefile.com	2019-07-14 19:12:15.557141905 +0000
@@ -36,9 +36,9 @@
 
 SRCDIR =	../common
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc
 DYNFLAGS +=	$(VERSREF)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
+LDLIBS +=	$(CONVLIBDIR) -lconv -lc
 
 CERRWARN +=	-_gcc=-Wno-uninitialized
 
--- old/usr/src/cmd/sgs/librtld_db/demo/Makefile	2019-07-14 19:12:16.023521315 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/Makefile	2019-07-14 19:12:16.041462795 +0000
@@ -23,6 +23,7 @@
 #
 
 include		$(SRC)/Makefile.master
+include		$(SRC)/cmd/sgs/Makefile.sub
 
 MACHDEMOFILES= \
 		i386/regs.c \
--- old/usr/src/cmd/sgs/librtld_db/demo/Makefile.targ	2019-07-14 19:12:16.524250296 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/Makefile.targ	2019-07-14 19:12:16.542070473 +0000
@@ -31,10 +31,17 @@
 		$(POST_PROCESS_O)
 
 # DEMO DELETE START
-$(ROOTONLDBIN)/%: %
+
+$(ROOTONLDBIN):
+		$(INS.dir)
+
+$(ROOTONLDBIN)/$(MACH64):
+		$(INS.dir)
+
+$(ROOTONLDBIN)/%: % $(ROOTONLDBIN)
 		$(INS.file)
 
-$(ROOTONLDBIN)/$(MACH64)/%: %
+$(ROOTONLDBIN)/$(MACH64)/%: % $(ROOTONLDBIN)/$(MACH64)
 		$(INS.file)
 # DEMO DELETE END
 
@@ -92,6 +99,10 @@
 clobber: clean FRC
 		$(RM) $(PROG)
 
+# DEMO DELETE START
+catalog check chkmsg:
+# DEMO DELETE END
+
 FRC:
 
 # DEMO DELETE START
--- old/usr/src/cmd/sgs/librtld_db/demo/amd64/Makefile	2019-07-14 19:12:16.988376514 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/amd64/Makefile	2019-07-14 19:12:17.004942832 +0000
@@ -48,6 +48,8 @@
 # DEMO DELETE START
 DEMOCFLAGS=
 
+catalog:
+
 install:	all $(ROOTONLDBINPROG64)
 # DEMO DELETE END
 
--- old/usr/src/cmd/sgs/librtld_db/demo/i386/Makefile	2019-07-14 19:12:17.442887534 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/i386/Makefile	2019-07-14 19:12:17.459426139 +0000
@@ -33,6 +33,8 @@
 test:		$(TESTS)
 
 # DEMO DELETE START
+catalog:
+
 install:	all $(ROOTONLDBINPROG)
 # DEMO DELETE END
 
--- old/usr/src/cmd/sgs/librtld_db/demo/sparc/Makefile	2019-07-14 19:12:17.897137490 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/sparc/Makefile	2019-07-14 19:12:17.914063445 +0000
@@ -33,6 +33,8 @@
 test:		$(TESTS)
 
 # DEMO DELETE START
+catalog:
+
 install:	all $(ROOTONLDBINPROG)
 # DEMO DELETE END
 
--- old/usr/src/cmd/sgs/librtld_db/demo/sparcv9/Makefile	2019-07-14 19:12:18.386180914 +0000
+++ new/usr/src/cmd/sgs/librtld_db/demo/sparcv9/Makefile	2019-07-14 19:12:18.403138637 +0000
@@ -48,6 +48,8 @@
 # DEMO DELETE START
 DEMOCFLAGS=
 
+catalog:
+
 install:	all $(ROOTONLDBINPROG64)
 # DEMO DELETE END
 
--- old/usr/src/cmd/sgs/link_audit/Makefile.com	2019-07-14 19:12:18.865550434 +0000
+++ new/usr/src/cmd/sgs/link_audit/Makefile.com	2019-07-14 19:12:18.886247923 +0000
@@ -62,7 +62,7 @@
 
 $(WHOPICS):=	SEMANTICCHK=
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB)
+LDLIBS +=	$(CONVLIBDIR) -lconv
 
 $(TRUSSLIB):=	PICS = $(TRUSSPICS)
 $(PERFLIB):=	PICS = $(PERFPICS)
@@ -91,7 +91,6 @@
 $(ROOTCCSLIB) :=	DIRMODE =	755
 
 CPPFLAGS +=	-D_REENTRANT
-LDFLAGS +=	$(CC_USE_PROTO)
 DYNFLAGS +=	$(VERSREF)
 
 CLEANFILES +=	$(OBJDIR)/* $(PICDIR)/*
--- old/usr/src/cmd/sgs/link_audit/Makefile.targ	2019-07-14 19:12:19.361264611 +0000
+++ new/usr/src/cmd/sgs/link_audit/Makefile.targ	2019-07-14 19:12:19.378502214 +0000
@@ -80,13 +80,13 @@
 $(ROOTCCSLIB64)/%: %
 		$(INS.file)
 
-$(ROOTONLDBIN)/%: %
+$(ROOTONLDBIN)/%: % $(ROOTONLDBIN)
 		$(INS.file)
 
-$(ROOTONLDLIB)/%: %
+$(ROOTONLDLIB)/%: % $(ROOTONLDLIB)
 		$(INS.file)
 
-$(ROOTONLDLIB64)/%: %
+$(ROOTONLDLIB64)/%: % $(ROOTONLDLIB64)
 		$(INS.file)
 
 $(ROOTCCSLIB):
@@ -95,4 +95,13 @@
 $(ROOTCCSLIB64):
 	$(INS.dir)
 
+$(ROOTONLDBIN):
+	$(INS.dir)
+
+$(ROOTONLDLIB):
+	$(INS.dir)
+
+$(ROOTONLDLIB64):
+	$(INS.dir)
+
 include		../../../../lib/Makefile.targ
--- old/usr/src/cmd/sgs/link_audit/amd64/Makefile	2019-07-14 19:12:19.856823761 +0000
+++ new/usr/src/cmd/sgs/link_audit/amd64/Makefile	2019-07-14 19:12:19.873696390 +0000
@@ -39,9 +39,7 @@
 all:		$(PICDIR) .WAIT $(CCSLIBS) $(CCSSCRIPTS) \
 		$(ONSCRIPTS) $(ONLIBS)
 
-install:	all $(ROOTCCSLIB64) .WAIT $(ROOTCCSLIBS64)
-
-package:	install .WAIT $(ROOTONLDLIBS64)
+install:	all $(ROOTCCSLIB64) .WAIT $(ROOTCCSLIBS64) .WAIT $(ROOTONLDLIBS64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- old/usr/src/cmd/sgs/link_audit/i386/Makefile	2019-07-14 19:12:20.336523159 +0000
+++ new/usr/src/cmd/sgs/link_audit/i386/Makefile	2019-07-14 19:12:20.353099777 +0000
@@ -36,8 +36,7 @@
 all:		$(OBJDIR) $(PICDIR) .WAIT $(CCSLIBS) $(CCSSCRIPTS) \
 		$(ONSCRIPTS) $(ONPROGS) $(ONLIBS)
 
-install:	all $(ROOTCCSLIB) .WAIT $(ROOTUSRBINS) $(ROOTCCSLIBS)
-
-package:	install .WAIT $(ROOTONLDLIBS) $(ROOTONLDBINPROG)
+install:	all $(ROOTCCSLIB) .WAIT $(ROOTUSRBINS) $(ROOTCCSLIBS) \
+		.WAIT $(ROOTONLDLIBS) $(ROOTONLDBINPROG)
 
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/link_audit/sparc/Makefile	2019-07-14 19:12:20.815597423 +0000
+++ new/usr/src/cmd/sgs/link_audit/sparc/Makefile	2019-07-14 19:12:20.831933211 +0000
@@ -36,8 +36,7 @@
 all:		$(OBJDIR) $(PICDIR) .WAIT $(CCSLIBS) $(CCSSCRIPTS) \
 		$(ONSCRIPTS) $(ONPROGS) $(ONLIBS)
 
-install:	all $(ROOTCCSLIB) .WAIT $(ROOTUSRBINS) $(ROOTCCSLIBS)
-
-package:	install .WAIT $(ROOTONLDLIBS) $(ROOTONLDBINPROG)
+install:	all $(ROOTCCSLIB) .WAIT $(ROOTUSRBINS) $(ROOTCCSLIBS) \
+		.WAIT $(ROOTONLDLIBS) $(ROOTONLDBINPROG)
 
 include		../Makefile.targ
--- old/usr/src/cmd/sgs/link_audit/sparcv9/Makefile	2019-07-14 19:12:21.275659292 +0000
+++ new/usr/src/cmd/sgs/link_audit/sparcv9/Makefile	2019-07-14 19:12:21.291888243 +0000
@@ -39,9 +39,8 @@
 all:		$(PICDIR) .WAIT $(CCSLIBS) $(CCSSCRIPTS) \
 		$(ONSCRIPTS) $(ONLIBS)
 
-install:	all $(ROOTCCSLIB64) .WAIT $(ROOTCCSLIBS64)
-
-package:	install .WAIT $(ROOTONLDLIBS64)
+install:	all $(ROOTCCSLIB64) .WAIT $(ROOTCCSLIBS64) \
+		.WAIT $(ROOTONLDLIBS64)
 
 include		../Makefile.targ
 include		../../Makefile.sub.64
--- old/usr/src/cmd/sgs/mcs/Makefile.com	2019-07-14 19:12:21.734594204 +0000
+++ new/usr/src/cmd/sgs/mcs/Makefile.com	2019-07-14 19:12:21.754469046 +0000
@@ -39,18 +39,18 @@
 
 COMOBJS =	main.o		file.o		utils.o		global.o \
 		message.o
-TOOLSOBJS =	alist.o
+SGSCOMMONOBJ =	alist.o
 
-OBJS =		$(COMOBJS) $(TOOLSOBJS)
+OBJS =		$(COMOBJS) $(SGSCOMMONOBJ)
 
 LLDFLAGS =	'-R$$ORIGIN/../../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../../lib/$(MACH64)'
 LDFLAGS +=	$(VERSREF) $(LLDFLAGS)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 
 CERRWARN +=	-_gcc=-Wno-uninitialized
 
 SRCS =		$(COMOBJS:%.o=../common/%.c) \
-		$(TOOLSOBJS:%.o=$(SGSTOOLS)/common/%.c)
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c)
 
 CLEANFILES +=	$(OBJS)
--- old/usr/src/cmd/sgs/mcs/Makefile.targ	2019-07-14 19:12:22.244333379 +0000
+++ new/usr/src/cmd/sgs/mcs/Makefile.targ	2019-07-14 19:12:22.261529082 +0000
@@ -33,7 +33,7 @@
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
-%.o:		$(SGSTOOLS)/common/%.c
+%.o:		$(SGSCOMMON)/%.c
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/moe/Makefile.com	2019-07-14 19:12:22.705298746 +0000
+++ new/usr/src/cmd/sgs/moe/Makefile.com	2019-07-14 19:12:22.721639127 +0000
@@ -39,8 +39,8 @@
 MAPFILE=	$(MAPFILE.NGB)
 MAPOPT=		$(MAPFILE:%=-M%)
 
-LDFLAGS +=	-Wl,$(VERSREF) $(CC_USE_PROTO) $(MAPOPT)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB)
+LDFLAGS +=	-Wl,$(VERSREF) $(MAPOPT)
+LDLIBS +=	$(CONVLIBDIR) -lconv
 
 BLTDEFS=	msg.h
 BLTDATA=	msg.c
--- old/usr/src/cmd/sgs/nm/amd64/Makefile	2019-07-14 19:12:23.185196516 +0000
+++ new/usr/src/cmd/sgs/nm/amd64/Makefile	2019-07-14 19:12:23.201773608 +0000
@@ -41,10 +41,10 @@
 
 LDFLAGS +=	'-R$$ORIGIN/../../../lib/$(MACH64)'
 INCLIST=	-I../../include -I../../include/i386 \
-		-I$(SRCBASE)/uts/$(ARCH)/sys
+		-I$(SRC)/uts/$(ARCH)/sys
 CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
 
-LDLIBS +=	$(CONVLIBDIR64) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR64) -lconv $(ELFLIBDIR) -lelf
 
 %.o:		../common/%.c
 		$(COMPILE.c) $<
--- old/usr/src/cmd/sgs/nm/i386/Makefile	2019-07-14 19:12:23.651610778 +0000
+++ new/usr/src/cmd/sgs/nm/i386/Makefile	2019-07-14 19:12:23.670792141 +0000
@@ -42,11 +42,11 @@
 
 LLDFLAGS =	'-R$$ORIGIN/../../lib'
 INCLIST=	-I../../include -I../../include/i386 \
-		-I$(SRCBASE)/uts/$(ARCH)/sys
+		-I$(SRC)/uts/$(ARCH)/sys
 DEFLIST=	-DTARGET=I386 -DI386=1 -D$(ARFORMAT) -DELF
 CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 objs.xpg4/%.o := CPPFLAGS += -DXPG4
 
 $(DEMOBJS):=	DEFLIST = -DELF_OBJ
--- old/usr/src/cmd/sgs/nm/sparc/Makefile	2019-07-14 19:12:24.150448625 +0000
+++ new/usr/src/cmd/sgs/nm/sparc/Makefile	2019-07-14 19:12:24.169662997 +0000
@@ -42,10 +42,10 @@
 
 LLDFLAGS=	'-R$$ORIGIN/../../lib'
 INCLIST=	-I../../include -I../../include/sparc \
-		-I$(SRCBASE)/uts/$(ARCH)/sys
+		-I$(SRC)/uts/$(ARCH)/sys
 DEFLIST=	-DTARGET=SPARC -DSPARC=1 -D$(ARFORMAT) -DELF
 CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master)  -I$(ELFCAP)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 objs.xpg4/%.o := CPPFLAGS += -DXPG4
 
 
--- old/usr/src/cmd/sgs/nm/sparcv9/Makefile	2019-07-14 19:12:24.622186683 +0000
+++ new/usr/src/cmd/sgs/nm/sparcv9/Makefile	2019-07-14 19:12:24.635771477 +0000
@@ -40,10 +40,10 @@
 
 LDFLAGS +=	'-R$$ORIGIN/../../../lib/$(MACH64)'
 INCLIST=	-I../../include -I../../include/sparc \
-		-I$(SRCBASE)/uts/$(ARCH)/sys
+		-I$(SRC)/uts/$(ARCH)/sys
 DEFLIST=	-DTARGET=SPARC -DSPARC=1 -D$(ARFORMAT) -DELF
 CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -I$(ELFCAP)
-LDLIBS +=	$(CONVLIBDIR64) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR64) -lconv $(ELFLIBDIR) -lelf
 
 
 %.o:		../common/%.c
--- old/usr/src/cmd/sgs/packages/Makefile	2019-07-14 19:12:25.100583766 +0000
+++ /dev/null	2019-07-14 19:12:25.000000000 +0000
@@ -1,154 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
-#
-
-include		$(SRC)/Makefile.master
-include		$(SRC)/cmd/sgs/Makefile.var
-
-BUILDLOG=	package_build.$(MACH).log
-
-MACHS:sh=	if [ "$MACH" = "sparc" ]; \
-		then echo "sparc sparcv9"; \
-		elif [ "$MACH" = "i386" ]; \
-		then echo "i386 amd64"; \
-		else echo "unknown"; \
-		fi
-
-RDBDIRS=	$(MACHS:%=../librtld_db/demo/%)
-LDMAKEDIRS=	$(MACHS:%=../libldmake/%)
-
-SUBDIRS1=	../libconv \
-		.WAIT \
-		../libdl \
-		.WAIT \
-		../libelf \
-		.WAIT \
-		../liblddbg \
-		../librtld_db \
-		.WAIT \
-		../librtld \
-		../libcrle
-
-SUBDIRS2 =	../rtld \
-		../rtld.4.x \
-		../libldstab \
-		../lari \
-		../ldprof \
-		../lddstub \
-		$(LDMAKEDIRS) \
-		../0@0 \
-		../tools \
-		$(RDBDIRS)
-
-#
-# Package dirs are directories which specifically
-# have a 'package' target.  This target is used to key
-# off of whether a system build is performed
-# or a SUNWonld build.
-#
-PKGDIRS=	../libcrle \
-		../libld \
-		../elfdump \
-		../elfedit \
-		../elfedit/modules \
-		../elfwrap \
-		../ar \
-		../crle \
-		../dump \
-		../lari \
-		../ld \
-		../ldd \
-		../ldprof \
-		../nm \
-		../mcs \
-		../moe \
-		../pvs
-
-$(SUBDIRS1) $(SUBDIRS2) :=	TARGET = install
-$(PKGDIRS) :=	TARGET = package
-
-../%:		FRC
-		@ cd $@; pwd; $(MAKE) $(TARGET)
-
-.KEEP_STATE_FILE: .make.state.$(MACH)
-.KEEP_STATE:
-.PARALLEL:	$(SUBDIRS1) $(PKGDIRS) $(SUBDIRS2)
-
-all clean clobber install: FRC
-		@ cd $(MACH); pwd; $(MAKE) $@
-
-#
-# invoke `package' to build this package from scratch.  It will
-# perform make install in the directories that contains components
-# that this package is dependent upon
-#
-package:	FRC
-	@/bin/time $(MAKE) package_build 2>&1 | tee $(BUILDLOG)
-	@ echo "===BUILD COMPLETED  checking for warnings...==="
-	@ grep -i "warning:" $(BUILDLOG) | grep -v PSTAMP | cat
-	@ echo "==================done========================="
-
-package_build:	package_dep .WAIT package_chkmsg .WAIT install
-
-package_chkmsg:	FRC
-		@ cd ..; pwd; $(MAKE) chkmsg
-
-package_dep:	package_dep_ .WAIT $(SUBDIRS1) .WAIT \
-	$(PKGDIRS) .WAIT $(SUBDIRS2)
-
-package_dep_:	FRC
-		@ cd ../tools; pwd; $(MAKE) proto && ./proto $(RELEASE)
-		@ cd $(SRC)/common/mapfiles/gen ; pwd; $(MAKE) install
-		@ cd $(SRC)/head; pwd; $(MAKE) \
-			$(ROOT)/usr/include/dlfcn.h \
-			$(ROOT)/usr/include/gelf.h \
-			$(ROOT)/usr/include/libelf.h \
-			$(ROOT)/usr/include/proc_service.h \
-			$(ROOT)/usr/include/rtld_db.h \
-			$(ROOT)/usr/include/link.h
-		@ cd $(SRC)/lib/libproc; pwd; $(MAKE) install_h
-		@ cd $(SRC)/uts/common/sys; pwd; $(MAKE) \
-			$(ROOT)/usr/include/sys/elf.h \
-			$(ROOT)/usr/include/sys/elf_386.h \
-			$(ROOT)/usr/include/sys/elf_SPARC.h \
-			$(ROOT)/usr/include/sys/elf_notes.h \
-			$(ROOT)/usr/include/sys/elf_amd64.h \
-			$(ROOT)/usr/include/sys/elftypes.h \
-			$(ROOT)/usr/include/sys/auxv.h \
-			$(ROOT)/usr/include/sys/auxv_SPARC.h \
-			$(ROOT)/usr/include/sys/auxv_386.h \
-			$(ROOT)/usr/include/sys/avl.h \
-			$(ROOT)/usr/include/sys/link.h \
-			$(ROOT)/usr/include/sys/machelf.h \
-			$(ROOT)/usr/include/sys/note.h \
-			$(ROOT)/usr/include/sys/systeminfo.h
-		@ cd ../tools/$(MACH); pwd; $(MAKE) sgsmsg piglatin
-		@ cd ..; pwd; $(MAKE) _msg_sgsmsg
-		@ cd ..; pwd; $(MAKE) native-add
-		@ cd ../libconv; pwd; $(MAKE) all
-		@ cd ../link_audit; pwd; $(MAKE) package
-		@ cd ../messages/$(MACH); pwd; $(MAKE) test
-
-FRC:
--- old/usr/src/cmd/sgs/packages/Makefile.targ	2019-07-14 19:12:25.286837955 +0000
+++ /dev/null	2019-07-14 19:12:25.000000000 +0000
@@ -1,51 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
-#
-
-pkginfo: ../common/pkginfo.tmpl awk_pkginfo
-	$(RM) $@; $(AWK) -f awk_pkginfo ../common/$@.tmpl > $@
-
-pkg: FRC
-	@ $(RM) -r $(PACKAGE)
-	pkgmk -f prototype_$(MACH) -d $(PKGARCHIVE) -r $(ROOT) \
-		-o $(PACKAGE) 2>&1 | egrep -v "$(SRC)|parametric paths may"
-	pkgtrans -o -s $(PKGARCHIVE) $(PACKAGE).tmp $(PACKAGE)
-	$(RM) -r $(PKGARCHIVE)/$(PACKAGE)
-	mv $(PKGARCHIVE)/$(PACKAGE).tmp $(PKGARCHIVE)/$(PACKAGE)
-
-$(DATAFILES): ../common/$$@
-	$(RM) $@; cp ../common/$@ $@
-
-awk_pkginfo:	../bld_awk_pkginfo ../common/readme_revision ../common/$(README)
-	../bld_awk_pkginfo \
-		-R `perl ../common/readme_revision -d ../common/$(README)` \
-		-m $(MACH) -r "$(RELEASE)" -o $@
-
-clean: FRC
-	$(RM) $(CLEANFILES)
-
-clobber: clean FRC
-	$(RM) -r $(CLOBBERFILES)
-
-FRC:
--- old/usr/src/cmd/sgs/packages/common/bld_awk_pkginfo.ksh	2019-07-14 19:12:25.466551788 +0000
+++ /dev/null	2019-07-14 19:12:25.000000000 +0000
@@ -1,119 +0,0 @@
-#!/usr/bin/ksh -p
-#
-# 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
-#
-#
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# Simple script which builds the awk_pkginfo awk script.  This awk script
-# is used to convert the pkginfo.tmpl files into pkginfo files
-# for the build.
-#
-
-
-usage()
-{
-   echo "usage: bld_awk_pkginfo -R <revision> -r <release> -m <mach> -o <awk_script>"
-}
-#
-# Awk strings
-#
-VERSION="VERSION\="
-PRODVERS="^PRODVERS\="
-ARCH='ARCH=\"ISA\"'
-
-
-#
-# parse command line
-#
-mach=""
-release=""
-awk_script=""
-revision=""
-
-while getopts DR:o:r:m: c
-do
-   case $c in
-   o)
-      awk_script=$OPTARG
-      ;;
-   m)
-      mach=$OPTARG
-      ;;
-   r)
-      release=$OPTARG
-      ;;
-   R)
-   	revision=$OPTARG
-	;;
-   \?)
-      usage
-      exit 1
-      ;;
-   esac
-done
-
-if [[ ( -z $release ) || ( -z $mach ) || ( -z $awk_script ) \
-    || ( -z $revision) ]]
-then
-   usage
-   exit 1
-fi
-
-if [[ -f $awk_script ]]
-then
-	rm -f $awk_script
-fi
-
-#
-# Build REV= field based on date
-#
-rev=$(date "+%y.%m.%d.%H.%M")
-
-#
-# Build PRODVERS string - same as in libconv/common/bld_vernote.ksh
-#
-prodver="${release}-${revision}"
-
-#
-# Build awk script which will process all the
-# pkginfo.tmpl files.
-#
-rm -f $awk_script
-cat << EOF > $awk_script
-/$VERSION/ {
-      sub(/\=[^=]*$/,"=$rev\"")
-      print
-      next
-   }
-/$PRODVERS/ { 
-      printf "PRODVERS=\"%s\"\n", "$prodver" 
-      next
-   }
-/$ARCH/ {
-      printf "ARCH=\"%s\"\n", "$mach"
-      next
-   }
-{ print }
-EOF
-
--- old/usr/src/cmd/sgs/packages/common/checkinstall	2019-07-14 19:12:25.667788174 +0000
+++ /dev/null	2019-07-14 19:12:25.000000000 +0000
@@ -1,60 +0,0 @@
-#
-# Copyright 2009 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 (the "License").
-# You may not use this file except in 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
-#
-
-# Installing the wrong architecture of runtime linker will immediately
-# brick the system. Catch this case and refuse to do it.
-if [ "$PKG_INSTALL_ROOT" = '' -o "$PKG_INSTALL_ROOT" = '/' ]; then
-    SYSARCH=`uname -p`
-    if [ "$SYSARCH" != "$ARCH" ]; then
-	echo "***"
-	echo "*** Cannot install $ARCH linker into root of $SYSARCH system."
-	echo "***"
-	exit 1
-    fi
-fi
-
-if [ -d $BASEDIR/$SGSBACKUPDIR ];
-then
-    echo "***"
-    echo "*** Previous version of SUNWonld already installed. Use"
-    echo "***     # pkgrm SUNWonld"
-    echo "*** to remove it before installing a newer version, or"
-    echo "*** use an admin file to force an overwrite."
-    echo "***"
-    exit 1
-fi
-
-# As of Nevada build snv_104, we require the mmapobj() system call.
-# Installing on a system that lacks it will break rtld and brick the system.
-elfdump -sN.dynsym /lib/libc.so.1 | grep mmapobj > /dev/null
-if [ $? != 0 ];
-then
-    echo "***"
-    echo "*** System lacks required mmapobj() system call"
-    echo "*** Nevada snv_104 or newer is required."
-    echo "***"
-    exit 1
-fi
-
-exit 0
--- old/usr/src/cmd/sgs/packages/common/copyright	2019-07-14 19:12:25.847430432 +0000
+++ /dev/null	2019-07-14 19:12:25.000000000 +0000
@@ -1,2 +0,0 @@
-Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-Use is subject to license terms.
--- old/usr/src/cmd/sgs/packages/common/depend	2019-07-14 19:12:26.032682369 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,46 +0,0 @@
-# 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.
-#
-# 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
-#
-#
-# This package information file defines software dependencies associated
-# with the pkg.  You can define three types of pkg dependencies with this file:
-#	 P indicates a prerequisite for installation
-#	 I indicates an incompatible package
-#	 R indicates a reverse dependency
-# <pkg.abbr> see pkginfo(4), PKG parameter
-# <name> see pkginfo(4), NAME parameter
-# <version> see pkginfo(4), VERSION parameter
-# <arch> see pkginfo(4), ARCH parameter
-# <type> <pkg.abbr> <name>
-# 	(<arch>)<version>
-# 	(<arch>)<version>
-# 	...
-# <type> <pkg.abbr> <name>
-# ...
-
-P SUNWcar	Core Architecture, (Root)
-P SUNWkvm	Core Architecture, (Kvm)
-P SUNWcsr	Core Solaris, (Root)
-P SUNWcsu	Core Solaris, (Usr)
-P SUNWcsd	Core Solaris Devices
--- old/usr/src/cmd/sgs/packages/common/postinstall	2019-07-14 19:12:26.216614458 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,173 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-
-ONLDCPIO=/tmp/SUNWonld.cpio.$$
-
-
-#
-# This script handles the installation of the new sgstools on
-# both Solaris10 systems (which libraries moved to '/lib') and
-# pre Solaris10 systems where libraries reside under '/usr/lib'.
-#
-# We test to deterine if '/lib' is a symlink (pre Solaris10) or a
-# directory (Solaris10 & later).  We key off of that for
-# everything below.
-#
-if [ -h ${BASEDIR}/lib ]
-then
-	LIBBASE=usr/lib
-	ETCLIST="etc/lib/ld.so.1 etc/lib/libdl.so.1"
-else
-	LIBBASE=lib
-fi
-export LIBBASE
-
-
-build_liblist ()
-{
-	#
-	# Build '/lib' file list for backing up
-	#
-	cd $BASEDIR/$SGSDIR/lib
-	find . \( -type f -o -type l \) -print | sed 's/^\.\///'g |
-	while read file
-	do
-		if [ \( -f $BASEDIR/$LIBBASE/$file \)  -o \
-		    \( -h $BASEDIR/$LIBBASE/$file \) ]; then
-			echo $LIBBASE/$file
-		fi
-	done
-}
-
-build_filelist()
-{
-	#
-	# Build rest of files
-	#
-	cd $BASEDIR/$SGSDIR
-	find usr \( -type f -o -type l \) -print | while read file
-	do
-		if [ \( -f $BASEDIR/$file \)  -o \
-		    \( -h $BASEDIR/$file \) ]; then
-			echo $file
-		fi
-	done
-}
-
-build_newitemsfile ()
-{
-	rm -f ${SGSBACKUPDIR}.newfiles
-
-	# Build a list of files/directories that this package is going
-	# add to the system that do not already exist.
-	cd $BASEDIR/$SGSDIR/lib
-	find . -depth -print | sed 's/^\.\///'g | while read file
-	do
-		# Built in /bin/sh test lacks -e
-		/usr/bin/test \! -e "$BASEDIR/$LIBBASE/$file"
-		if [ $? = 0 ]; then
-			echo $LIBBASE/$file >> ${SGSBACKUPDIR}.newfiles
-		fi
-	done
-
-	cd $BASEDIR/$SGSDIR
-	find usr -depth -print | while read file
-	do
-		/usr/bin/test \! -e "$BASEDIR/$file"
-		if [ $? = 0 ]; then
-			echo $file >> ${SGSBACKUPDIR}.newfiles
-		fi
-	done
-}
-
-# Generate a file containing the names of the files and directories
-# that are being added (as opposed to being replaced) to the system.
-# These items will need to be explicitly removed at uninstall.
-build_newitemsfile
-
-# Generate a file containing the names of the original files backed
-# up from the system. These items will be moved back at uninstall.
-LIBLIST=`build_liblist`
-FILELIST=`build_filelist`
-for file in $LIBLIST $FILELIST $ETCLIST
-do
-	echo $file
-done > ${SGSBACKUPDIR}.origfiles
-
-#
-# backup all existing SGStools.
-#
-echo "Backup up existing SGS tools to $SGSBACKUPDIR..."
-cd $BASEDIR
-cpio -pdm $BASEDIR/$SGSBACKUPDIR < ${SGSBACKUPDIR}.origfiles
-
-
-#
-# Overwrite SGSTOOLS onto existing system.  We use CPIO
-# because it unlinks a file and then creates a new one
-# instead of copying over an existing inode.  This is
-# required when updating libraries (and the run-time linker)
-# which are currently being used.
-#
-
-
-#
-# First '/lib' components
-#
-echo "Installing new SGSTOOLS from $BASEDIR/$SGSDIR"
-
-prev_bindnow=$LD_BIND_NOW
-LD_BIND_NOW=1
-export LD_BIND_NOW
-
-cd $BASEDIR/$SGSDIR/lib
-find . -depth -print | cpio -o -O $ONLDCPIO
-cd $BASEDIR/$LIBBASE
-cpio -imdu < $ONLDCPIO
-rm -f $ONLDCPIO
-
-#
-# Then everything else
-#
-cd $BASEDIR/$SGSDIR
-find usr -depth -print | cpio -o -O $ONLDCPIO
-cd $BASEDIR
-cpio -imdu < $ONLDCPIO
-rm -f $ONLDCPIO
-
-
-#
-# Populate '/etc/lib' directories on systems with the
-# run-time linker installed under '/usr/lib/ld.so.1'
-#
-if [ "${ETCLIST}x" != "x" ]; then
-	cp $BASEDIR/usr/lib/ld.so.1 $BASEDIR/etc/lib/ld.so.1.onld
-	cp $BASEDIR/usr/lib/libdl.so.1 $BASEDIR/etc/lib/libdl.so.1.onld
-	cd $BASEDIR/etc/lib
-	mv ld.so.1.onld ld.so.1
-	mv libdl.so.1.onld libdl.so.1
-fi
-
-LD_BIND_NOW=$prev_bindnow
--- old/usr/src/cmd/sgs/packages/common/prototype_com	2019-07-14 19:12:26.397112852 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,300 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This required package information file contains a list of package contents.
-# The 'pkgmk' command uses this file to identify the contents of a package
-# and their location on the development machine when building the package.
-# Can be created via a text editor or through use of the 'pkgproto' command.
-
-# packaging files
-i pkginfo
-i copyright
-i depend
-i checkinstall
-i postinstall
-i preremove
-#
-# source locations relative to the prototype file
-#
-# SUNWonld
-#
-d none var 755 root sys
-d none var/ld 755 root bin
-d none $SGSBACKUPDIR 755 root bin
-d none opt 755 root sys
-d none opt/SUNWonld 755 root sys
-d none $SGSDIR/ 755 root sys
-d none $SGSDIR/lib 755 root sys
-s none $SGSDIR/lib/32=.
-d none $SGSDIR/usr 755 root sys
-f none $SGSDIR/lib/ld.so.1=lib/ld.so.1 755 root bin
-f none $SGSDIR/lib/libdl.so.1=lib/libdl.so.1 755 root bin
-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.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
-f none $SGSDIR/lib/librtld_db.so.1=lib/librtld_db.so.1 755 root bin
-d none $SGSDIR/usr/bin 755 root bin
-f none $SGSDIR/usr/bin/ar=usr/bin/ar 555 root bin
-s none $SGSDIR/usr/ccs/bin/ar=../../bin/ar
-f none $SGSDIR/usr/xpg4/bin/ar=usr/xpg4/bin/ar 0555 root bin
-f none $SGSDIR/usr/bin/crle=usr/bin/crle 555 root bin
-f none $SGSDIR/usr/bin/ldd=usr/bin/ldd 555 root bin
-f none $SGSDIR/usr/bin/moe=usr/bin/moe 555 root bin
-f none $SGSDIR/usr/bin/pvs=usr/bin/pvs 555 root bin
-f none $SGSDIR/usr/bin/sotruss=usr/bin/sotruss 755 root bin
-f none $SGSDIR/usr/bin/whocalls=usr/bin/whocalls 755 root bin
-d none $SGSDIR/usr/ccs 755 root bin
-d none $SGSDIR/usr/ccs/bin 755 root bin
-f none $SGSDIR/usr/bin/dump=usr/bin/dump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/dump=../../bin/dump
-f none $SGSDIR/usr/bin/elfdump=usr/bin/elfdump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/elfdump=../../bin/elfdump
-f none $SGSDIR/usr/bin/elfedit=usr/bin/elfedit 0555 root bin
-f none $SGSDIR/usr/bin/elfwrap=usr/bin/elfwrap 0555 root bin
-f none $SGSDIR/usr/bin/lari=usr/bin/lari 0555 root bin
-s none $SGSDIR/usr/ccs/bin/lari=../../bin/lari
-f none $SGSDIR/usr/bin/ld=usr/bin/ld 755 root bin
-s none $SGSDIR/usr/ccs/bin/ld=../../bin/ld
-f none $SGSDIR/usr/bin/nm=usr/bin/nm 0555 root bin
-s none $SGSDIR/usr/ccs/bin/nm=../../bin/nm
-f none $SGSDIR/usr/bin/mcs=usr/bin/mcs 0555 root bin
-s none $SGSDIR/usr/ccs/bin/mcs=../../bin/mcs
-l none $SGSDIR/usr/bin/strip=./mcs
-s none $SGSDIR/usr/ccs/bin/strip=../../bin/strip
-d none $SGSDIR/usr/include 755 root bin
-f none $SGSDIR/usr/include/dlfcn.h=usr/include/dlfcn.h 644 root bin
-f none $SGSDIR/usr/include/libelf.h=usr/include/libelf.h 644 root bin
-f none $SGSDIR/usr/include/link.h=usr/include/link.h 644 root bin
-f none $SGSDIR/usr/include/gelf.h=usr/include/gelf.h 644 root bin
-f none $SGSDIR/usr/include/proc_service.h=usr/include/proc_service.h 644 root bin
-f none $SGSDIR/usr/include/rtld_db.h=usr/include/rtld_db.h 644 root bin
-d none $SGSDIR/usr/include/sys 755 root bin
-f none $SGSDIR/usr/include/sys/elf.h=usr/include/sys/elf.h 644 root bin
-f none $SGSDIR/usr/include/sys/elf_386.h=usr/include/sys/elf_386.h 644 root bin
-f none $SGSDIR/usr/include/sys/elf_amd64.h=usr/include/sys/elf_amd64.h 644 root bin
-f none $SGSDIR/usr/include/sys/elf_SPARC.h=usr/include/sys/elf_SPARC.h 644 root bin
-f none $SGSDIR/usr/include/sys/elftypes.h=usr/include/sys/elftypes.h 644 root bin
-f none $SGSDIR/usr/include/sys/machelf.h=usr/include/sys/machelf.h 644 root bin
-f none $SGSDIR/usr/include/sys/link.h=usr/include/sys/link.h 644 root bin
-d none $SGSDIR/usr/lib 755 root bin
-s none $SGSDIR/usr/lib/32=.
-f none $SGSDIR/usr/lib/0@0.so.1=usr/lib/0@0.so.1 755 root bin
-f none $SGSDIR/usr/lib/lddstub=usr/lib/lddstub 555 root bin
-f none $SGSDIR/usr/lib/libcrle.so.1=usr/lib/libcrle.so.1 755 root bin
-f none $SGSDIR/usr/lib/libldstab.so.1=usr/lib/libldstab.so.1 755 root bin
-d none $SGSDIR/usr/lib/elfedit 755 root bin
-s none $SGSDIR/usr/lib/elfedit/32=.
-f none $SGSDIR/usr/lib/elfedit/cap.so=usr/lib/elfedit/cap.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/dyn.so=usr/lib/elfedit/dyn.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/ehdr.so=usr/lib/elfedit/ehdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/phdr.so=usr/lib/elfedit/phdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/shdr.so=usr/lib/elfedit/shdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/str.so=usr/lib/elfedit/str.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sym.so=usr/lib/elfedit/sym.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/syminfo.so=usr/lib/elfedit/syminfo.so 755 root bin
-d none $SGSDIR/usr/lib/link_audit 755 root bin
-s none $SGSDIR/usr/lib/link_audit/32=.
-f none $SGSDIR/usr/lib/link_audit/ldprof.so.1=usr/lib/link_audit/ldprof.so.1 755 root bin
-f none $SGSDIR/usr/lib/link_audit/truss.so.1=usr/lib/link_audit/truss.so.1 755 root bin
-f none $SGSDIR/usr/lib/link_audit/who.so.1=usr/lib/link_audit/who.so.1 755 root bin
-d none $SGSDIR/usr/lib/mdb/ 755 root sys
-d none $SGSDIR/usr/lib/mdb/proc 755 root sys
-f none $SGSDIR/usr/lib/mdb/proc/ld.so=/usr/lib/mdb/proc/ld.so 555 root sys
-d none $SGSDIR/usr/lib/locale 755 root bin
-d none $SGSDIR/usr/lib/locale/piglatin 755 root bin
-d none $SGSDIR/usr/lib/locale/piglatin/LC_MESSAGES 755 root bin
-f none $SGSDIR/usr/lib/locale/piglatin/LC_MESSAGES/SUNW_OST_SGS.mo=/usr/lib/locale/piglatin/LC_MESSAGES/SUNW_OST_SGS.mo 444 root bin
-d none $SGSDIR/usr/lib/secure 755 root bin
-s none $SGSDIR/usr/lib/secure/32=.
-d none $SGSDIR/usr/xpg4 755 root bin
-d none $SGSDIR/usr/xpg4/bin 755 root bin
-f none $SGSDIR/usr/xpg4/bin/nm=usr/xpg4/bin/nm 0555 root bin
-d none $SGSDIR/usr/demo 755 root bin
-d none $SGSDIR/usr/demo/ELF 755 root bin
-f none $SGSDIR/usr/demo/ELF/Makefile=usr/demo/ELF/Makefile 644 root bin
-f none $SGSDIR/usr/demo/ELF/00README=usr/demo/ELF/00README 644 root bin
-f none $SGSDIR/usr/demo/ELF/acom.c=usr/demo/ELF/acom.c 644 root bin
-f none $SGSDIR/usr/demo/ELF/dcom.c=usr/demo/ELF/dcom.c 644 root bin
-f none $SGSDIR/usr/demo/ELF/dispsyms.c=usr/demo/ELF/dispsyms.c 644 root bin
-f none $SGSDIR/usr/demo/ELF/pcom.c=usr/demo/ELF/pcom.c 644 root bin
-f none $SGSDIR/usr/demo/ELF/tpcom.c=usr/demo/ELF/tpcom.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/00README=usr/demo/librtld_db/00README 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/Makefile.com=usr/demo/librtld_db/Makefile.com 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/Makefile.targ=usr/demo/librtld_db/Makefile.targ 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/amd64 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/amd64/Makefile=usr/demo/librtld_db/amd64/Makefile 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/amd64/rdb_mach.h=usr/demo/librtld_db/amd64/rdb_mach.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/amd64/regs.c=usr/demo/librtld_db/amd64/regs.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/common 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/bpt.c=usr/demo/librtld_db/common/bpt.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/callstack.c=usr/demo/librtld_db/common/callstack.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/dis.c=usr/demo/librtld_db/common/dis.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/disasm.c=usr/demo/librtld_db/common/disasm.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/disasm.h=usr/demo/librtld_db/common/disasm.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/globals.c=usr/demo/librtld_db/common/globals.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/gram.y=usr/demo/librtld_db/common/gram.y 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/help.c=usr/demo/librtld_db/common/help.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/lex.l=usr/demo/librtld_db/common/lex.l 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/main.c=usr/demo/librtld_db/common/main.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/maps.c=usr/demo/librtld_db/common/maps.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/ps.c=usr/demo/librtld_db/common/ps.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/rdb.h=usr/demo/librtld_db/common/rdb.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/rdb.man=usr/demo/librtld_db/common/rdb.man 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/syms.c=usr/demo/librtld_db/common/syms.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/common/utils.c=usr/demo/librtld_db/common/utils.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/i386 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/i386/Makefile=usr/demo/librtld_db/i386/Makefile 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/i386/m_utils.c=usr/demo/librtld_db/i386/m_utils.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/i386/rdb_mach.h=usr/demo/librtld_db/i386/rdb_mach.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/i386/regs.c=usr/demo/librtld_db/i386/regs.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/sparc 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparc/Makefile=usr/demo/librtld_db/sparc/Makefile 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparc/m_utils.c=usr/demo/librtld_db/sparc/m_utils.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparc/rdb_mach.h=usr/demo/librtld_db/sparc/rdb_mach.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparc/regs.c=usr/demo/librtld_db/sparc/regs.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/sparcv9 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparcv9/Makefile=usr/demo/librtld_db/sparcv9/Makefile 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparcv9/m_utils.c=usr/demo/librtld_db/sparcv9/m_utils.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparcv9/rdb_mach.h=usr/demo/librtld_db/sparcv9/rdb_mach.h 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/sparcv9/regs.c=usr/demo/librtld_db/sparcv9/regs.c 644 root bin
-d none $SGSDIR/usr/demo/librtld_db/tests 755 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/breaks=usr/demo/librtld_db/tests/breaks 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/loadmaps=usr/demo/librtld_db/tests/loadmaps 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/object_padding_maps=usr/demo/librtld_db/tests/object_padding_maps 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/plt_skip=usr/demo/librtld_db/tests/plt_skip 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/simp.c=usr/demo/librtld_db/tests/simp.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/steps=usr/demo/librtld_db/tests/steps 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/sub.c=usr/demo/librtld_db/tests/sub.c 644 root bin
-f none $SGSDIR/usr/demo/librtld_db/tests/test-sparc-regs=usr/demo/librtld_db/tests/test-sparc-regs 644 root bin
-d none $SGSDIR/usr/demo/link_audit 755 root bin
-f none $SGSDIR/usr/demo/link_audit/00README=usr/demo/link_audit/00README 644 root bin
-f none $SGSDIR/usr/demo/link_audit/Makefile=usr/demo/link_audit/Makefile 644 root bin
-d none $SGSDIR/usr/demo/link_audit/man 755 root bin
-f none $SGSDIR/usr/demo/link_audit/man/dumpbind.man=usr/demo/link_audit/man/dumpbind.man 644 root bin
-f none $SGSDIR/usr/demo/link_audit/man/perfcnt.man=usr/demo/link_audit/man/perfcnt.man 644 root bin
-f none $SGSDIR/usr/demo/link_audit/man/symbindrep.man=usr/demo/link_audit/man/symbindrep.man 644 root bin
-d none $SGSDIR/usr/demo/link_audit/src 755 root bin
-f none $SGSDIR/usr/demo/link_audit/src/bindings.c=usr/demo/link_audit/src/bindings.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/bindings.h=usr/demo/link_audit/src/bindings.h 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/dumpbind.c=usr/demo/link_audit/src/dumpbind.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/env.c=usr/demo/link_audit/src/env.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/env.h=usr/demo/link_audit/src/env.h 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/hash.c=usr/demo/link_audit/src/hash.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/hash.h=usr/demo/link_audit/src/hash.h 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/mach.h=usr/demo/link_audit/src/mach.h 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/perfcnt.c=usr/demo/link_audit/src/perfcnt.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/perfcnt.ksh=usr/demo/link_audit/src/perfcnt.ksh 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/sotruss.ksh=usr/demo/link_audit/src/sotruss.ksh 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/symbindrep.c=usr/demo/link_audit/src/symbindrep.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/symbindrep.ksh=usr/demo/link_audit/src/symbindrep.ksh 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/truss.c=usr/demo/link_audit/src/truss.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/who.c=usr/demo/link_audit/src/who.c 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/who.h=usr/demo/link_audit/src/who.h 644 root bin
-f none $SGSDIR/usr/demo/link_audit/src/whocalls.ksh=usr/demo/link_audit/src/whocalls.ksh 644 root bin
-f none opt/SUNWonld/SUNWonld-README 444 root bin
-d none opt/SUNWonld/bin 755 root bin
-f none opt/SUNWonld/bin/dumpbind 755 root bin
-f none opt/SUNWonld/bin/rdb 755 root bin
-f none opt/SUNWonld/bin/perfcnt 755 root bin
-f none opt/SUNWonld/bin/symbindrep 755 root bin
-d none opt/SUNWonld/lib 755 root bin
-s none opt/SUNWonld/lib/32=.
-f none opt/SUNWonld/lib/libldmake.so.1 755 root bin
-f none opt/SUNWonld/lib/bindings.so.1 755 root bin
-f none opt/SUNWonld/lib/symbindrep.so.1 755 root bin
-f none opt/SUNWonld/lib/perfcnt.so.1 755 root bin
-d none opt/SUNWonld/man 755 root bin
-d none opt/SUNWonld/man/man1l 755 root bin
-f none opt/SUNWonld/man/man1l/chkmsg.1l 444 root bin
-f none opt/SUNWonld/man/man1l/sgsmsg.1l 444 root bin
-
-
-#
-# The following commented items are for things that exist within
-# usr/src/cmd/sgs, but which are not normally considered to be
-# part of the SUNWonld package. It is possible to add these items
-# to a special-purpose SUNWonld by uncommenting the appropriate lines.
-#
-
-# /usr/share/lib/ccs is needed by: gprof, lex, yacc
-#d none $SGSDIR/usr/share 755 root bin
-#d none $SGSDIR/usr/share/lib 755 root bin
-#d none $SGSDIR/usr/share/lib/ccs 755 root bin
-
-#f none $SGSDIR/usr/bin/error=usr/bin/error 555 root bin
-#s none $SGSDIR/usr/ccs/bin/error=../../bin/error
-
-#f none $SGSDIR/usr/bin/gprof=usr/bin/gprof 555 root bin
-#s none $SGSDIR/usr/ccs/bin/gprof=../../bin/gprof
-#f none $SGSDIR/usr/share/lib/ccs/gprof.callg.blurb=usr/share/lib/ccs/gprof.callg.blurb 444 root bin
-#f none $SGSDIR/usr/share/lib/ccs/gprof.flat.blurb=usr/share/lib/ccs/gprof.flat.blurb 444 root bin
-
-#f none $SGSDIR/usr/bin/lex=usr/bin/lex 555 root bin
-#s none $SGSDIR/usr/ccs/bin/lex=../../bin/lex
-#f none $SGSDIR/usr/share/lib/ccs/nceucform=usr/share/lib/ccs/nceucform 644 root bin
-#f none $SGSDIR/usr/share/lib/ccs/ncform=usr/share/lib/ccs/ncform 644 root bin
-#f none $SGSDIR/usr/share/lib/ccs/nrform=usr/share/lib/ccs/nrform 644 root bin
-#f none $SGSDIR/usr/lib/libl.so.1=usr/lib/libl.so.1 755 root bin
-#s none $SGSDIR/usr/lib/libl.so=./libl.so.1
-#f none $SGSDIR/usr/lib/llib-ll.ln=usr/lib/llib-ll.ln 644 root bin
-#f none $SGSDIR/usr/lib/llib-ll=usr/lib/llib-ll 644 root bin
-
-#f none $SGSDIR/usr/bin/lorder=usr/bin/lorder 555 root bin
-#s none $SGSDIR/usr/ccs/bin/lorder=../../bin/lorder
-
-#f none $SGSDIR/usr/bin/m4=usr/bin/m4 555 root bin
-#s none $SGSDIR/usr/ccs/bin/m4=../../bin/m4
-#f none $SGSDIR/usr/xpg4/bin/m4=usr/xpg4/bin/m4 0555 root bin
-
-#f none $SGSDIR/usr/bin/prof=usr/bin/prof 555 root bin
-#s none $SGSDIR/usr/ccs/bin/prof=../../bin/prof
-
-#f none $SGSDIR/usr/bin/ranlib=usr/bin/ranlib 555 root bin
-#s none $SGSDIR/usr/ccs/bin/ranlib=../../bin/ranlib
-
-#f none $SGSDIR/usr/bin/size=usr/bin/size 555 root bin
-#s none $SGSDIR/usr/ccs/bin/size=../../bin/size
-
-#f none $SGSDIR/usr/bin/symorder=usr/bin/symorder 555 root bin
-#s none $SGSDIR/usr/ccs/bin/symorder=../../bin/symorder
-
-#f none $SGSDIR/usr/bin/tsort=usr/bin/tsort 555 root bin
-#s none $SGSDIR/usr/ccs/bin/tsort=../../bin/tsort
-
-#f none $SGSDIR/usr/bin/unifdef=usr/bin/unifdef 555 root bin
-#s none $SGSDIR/usr/ccs/bin/unifdef=../../bin/unifdef
-
-#f none $SGSDIR/usr/bin/yacc=usr/bin/yacc 555 root bin
-#s none $SGSDIR/usr/ccs/bin/yacc=../../bin/yacc
-#f none $SGSDIR/usr/share/lib/ccs/yaccpar=usr/share/lib/ccs/yaccpar 644 root bin
-#s none $SGSDIR/usr/ccs/bin/yaccpar=../../share/lib/ccs/yaccpar
-#f none $SGSDIR/usr/lib/liby.so.1=usr/lib/liby.so.1 755 root bin
-#s none $SGSDIR/usr/lib/liby.so=./liby.so.1
-#f none $SGSDIR/usr/lib/llib-ly.ln=usr/lib/llib-ly.ln 644 root bin
-#f none $SGSDIR/usr/lib/llib-ly=usr/lib/llib-ly 644 root bin
--- old/usr/src/cmd/sgs/packages/common/prototype_i386	2019-07-14 19:12:26.584545031 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,119 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This required package information file contains a list of package contents.
-# The 'pkgmk' command uses this file to identify the contents of a package
-# and their location on the development machine when building the package.
-# Can be created via a text editor or through use of the 'pkgproto' command.
-
-#!search <pathname pathname ...>	# where to find pkg objects
-#!include <filename>			# include another 'prototype' file
-#!default <mode> <owner> <group>	# default used if not specified on entry
-#!<param>=<value>			# puts parameter in pkg environment
-
-!include prototype_com
-
-d none $SGSDIR/lib/amd64=lib/amd64 755 root bin
-s none $SGSDIR/lib/64=amd64
-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.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/ar=usr/bin/amd64/ar 555 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/ar=../../bin/amd64/ar
-f none $SGSDIR/usr/bin/amd64/crle=usr/bin/amd64/crle 555 root bin
-f none $SGSDIR/usr/bin/amd64/ldd=usr/bin/amd64/ldd 555 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/bin/amd64/dump=usr/bin/amd64/dump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/dump=../../../bin/amd64/dump
-f none $SGSDIR/usr/bin/amd64/elfdump=usr/bin/amd64/elfdump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/elfdump=../../../bin/amd64/elfdump
-f none $SGSDIR/usr/bin/amd64/elfedit=usr/bin/amd64/elfedit 0555 root bin
-f none $SGSDIR/usr/bin/amd64/elfwrap=usr/bin/amd64/elfwrap 0555 root bin
-f none $SGSDIR/usr/bin/amd64/ld=usr/bin/amd64/ld 755 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/ld=../../../bin/amd64/ld
-f none $SGSDIR/usr/bin/amd64/nm=usr/bin/amd64/nm 0555 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/nm=../../../bin/amd64/nm
-f none $SGSDIR/usr/bin/amd64/mcs=usr/bin/amd64/mcs 0555 root bin
-s none $SGSDIR/usr/ccs/bin/amd64/mcs=../../../bin/amd64/mcs
-l none $SGSDIR/usr/bin/amd64/strip=./mcs
-s none $SGSDIR/usr/ccs/bin/amd64/strip=../../../bin/amd64/strip
-d none $SGSDIR/usr/lib/elfedit/amd64 755 root bin
-s none $SGSDIR/usr/lib/elfedit/64=amd64
-f none $SGSDIR/usr/lib/elfedit/amd64/cap.so=usr/lib/elfedit/amd64/cap.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/dyn.so=usr/lib/elfedit/amd64/dyn.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/ehdr.so=usr/lib/elfedit/amd64/ehdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/phdr.so=usr/lib/elfedit/amd64/phdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/shdr.so=usr/lib/elfedit/amd64/shdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/str.so=usr/lib/elfedit/amd64/str.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/sym.so=usr/lib/elfedit/amd64/sym.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/amd64/syminfo.so=usr/lib/elfedit/amd64/syminfo.so 755 root bin
-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
-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
-s none $SGSDIR/usr/lib/secure/64=amd64
-d none $SGSDIR/usr/lib/amd64 755 root bin
-s none $SGSDIR/usr/lib/64=amd64
-f none $SGSDIR/usr/lib/amd64/lddstub=usr/lib/amd64/lddstub 555 root bin
-f none $SGSDIR/usr/lib/amd64/libcrle.so.1=usr/lib/amd64/libcrle.so.1 755 root bin
-f none $SGSDIR/usr/lib/amd64/libldstab.so.1=usr/lib/amd64/libldstab.so.1 755 root bin
-d none opt/SUNWonld/bin/amd64 755 root bin
-f none opt/SUNWonld/bin/amd64/rdb 755 root bin
-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
-
-#
-# The following commented items are for things that exist within
-# usr/src/cmd/sgs, but which are not normally considered to be
-# part of the SUNWonld package. It is possible to add these items
-# to a special-purpose SUNWonld by uncommenting the appropriate lines.
-#
-#f none $SGSDIR/usr/lib/amd64/libl.so.1=usr/lib/amd64/libl.so.1 755 root bin
-#s none $SGSDIR/usr/lib/amd64/libl.so=./libl.so.1
-#f none $SGSDIR/usr/lib/amd64/llib-ll.ln=usr/lib/amd64/llib-ll.ln 644 root bin
-
-#f none $SGSDIR/usr/bin/amd64/size=usr/bin/amd64/size 555 root bin
-#s none $SGSDIR/usr/ccs/bin/amd64/size=../../../bin/amd64/size
-
-#f none $SGSDIR/usr/lib/amd64/liby.so.1=usr/lib/amd64/liby.so.1 755 root bin
-#s none $SGSDIR/usr/lib/amd64/liby.so=./liby.so.1
-#f none $SGSDIR/usr/lib/amd64/llib-ly.ln=usr/lib/amd64/llib-ly.ln 644 root bin
--- old/usr/src/cmd/sgs/packages/common/prototype_sparc	2019-07-14 19:12:26.784880973 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,120 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This required package information file contains a list of package contents.
-# The 'pkgmk' command uses this file to identify the contents of a package
-# and their location on the development machine when building the package.
-# Can be created via a text editor or through use of the 'pkgproto' command.
-
-#!search <pathname pathname ...>	# where to find pkg objects
-#!include <filename>			# include another 'prototype' file
-#!default <mode> <owner> <group>	# default used if not specified on entry
-#!<param>=<value>			# puts parameter in pkg environment
-
-!include prototype_com
-
-d none $SGSDIR/lib/sparcv9=lib/sparcv9 755 root bin
-s none $SGSDIR/lib/64=sparcv9
-f none $SGSDIR/lib/sparcv9/ld.so.1=lib/sparcv9/ld.so.1 755 root bin
-f none $SGSDIR/lib/sparcv9/libdl.so.1=lib/sparcv9/libdl.so.1 755 root bin
-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.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
-s none $SGSDIR/lib/sparcv9/librtld_db.so=librtld_db.so.1
-d none $SGSDIR/usr/bin/sparcv9 755 root bin
-f none $SGSDIR/usr/bin/sparcv9/ar=usr/bin/sparcv9/ar 555 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/ar=../../bin/sparcv9/ar
-f none $SGSDIR/usr/bin/sparcv9/crle=usr/bin/sparcv9/crle 555 root bin
-f none $SGSDIR/usr/bin/sparcv9/ldd=usr/bin/sparcv9/ldd 555 root bin
-f none $SGSDIR/usr/bin/sparcv9/moe=usr/bin/sparcv9/moe 555 root bin
-f none $SGSDIR/usr/bin/sparcv9/pvs=usr/bin/sparcv9/pvs 555 root bin
-d none $SGSDIR/usr/ccs/bin/sparcv9 755 root bin
-f none $SGSDIR/usr/bin/sparcv9/dump=usr/bin/sparcv9/dump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/dump=../../../bin/sparcv9/dump
-f none $SGSDIR/usr/bin/sparcv9/elfdump=usr/bin/sparcv9/elfdump 0555 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/elfdump=../../../bin/sparcv9/elfdump
-f none $SGSDIR/usr/bin/sparcv9/elfedit=usr/bin/sparcv9/elfedit 0555 root bin
-f none $SGSDIR/usr/bin/sparcv9/elfwrap=usr/bin/sparcv9/elfwrap 0555 root bin
-f none $SGSDIR/usr/bin/sparcv9/ld=usr/bin/sparcv9/ld 755 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/ld=../../../bin/sparcv9/ld
-f none $SGSDIR/usr/bin/sparcv9/nm=usr/bin/sparcv9/nm 0555 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/nm=../../../bin/sparcv9/nm 0555 root bin
-f none $SGSDIR/usr/bin/sparcv9/mcs=usr/bin/sparcv9/mcs 0555 root bin
-s none $SGSDIR/usr/ccs/bin/sparcv9/mcs=../../../bin/sparcv9/mcs 0555 root bin
-l none $SGSDIR/usr/bin/sparcv9/strip=./mcs
-s none $SGSDIR/usr/ccs/bin/sparcv9/strip=../../../bin/sparcv9/strip
-f none $SGSDIR/usr/lib/ld.so=usr/lib/ld.so 755 root bin
-d none $SGSDIR/usr/lib/elfedit/sparcv9 755 root bin
-s none $SGSDIR/usr/lib/elfedit/64=sparcv9
-f none $SGSDIR/usr/lib/elfedit/sparcv9/cap.so=usr/lib/elfedit/sparcv9/cap.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/dyn.so=usr/lib/elfedit/sparcv9/dyn.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/ehdr.so=usr/lib/elfedit/sparcv9/ehdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/phdr.so=usr/lib/elfedit/sparcv9/phdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/shdr.so=usr/lib/elfedit/sparcv9/shdr.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/str.so=usr/lib/elfedit/sparcv9/str.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/sym.so=usr/lib/elfedit/sparcv9/sym.so 755 root bin
-f none $SGSDIR/usr/lib/elfedit/sparcv9/syminfo.so=usr/lib/elfedit/sparcv9/syminfo.so 755 root bin
-d none $SGSDIR/usr/lib/link_audit/sparcv9 755 root bin
-s none $SGSDIR/usr/lib/link_audit/64=sparcv9
-f none $SGSDIR/usr/lib/link_audit/sparcv9/ldprof.so.1=usr/lib/link_audit/sparcv9/ldprof.so.1 755 root bin
-f none $SGSDIR/usr/lib/link_audit/sparcv9/truss.so.1=usr/lib/link_audit/sparcv9/truss.so.1 755 root bin
-f none $SGSDIR/usr/lib/link_audit/sparcv9/who.so.1=usr/lib/link_audit/sparcv9/who.so.1 755 root bin
-d none $SGSDIR/usr/lib/mdb/proc/sparcv9 755 root sys
-f none $SGSDIR/usr/lib/mdb/proc/sparcv9/ld.so=usr/lib/mdb/proc/sparcv9/ld.so 555 root sys
-d none $SGSDIR/usr/lib/secure/sparcv9 755 root bin
-s none $SGSDIR/usr/lib/secure/64=sparcv9
-d none $SGSDIR/usr/lib/sparcv9 755 root bin
-s none $SGSDIR/usr/lib/64=sparcv9
-f none $SGSDIR/usr/lib/sparcv9/lddstub=usr/lib/sparcv9/lddstub 555 root bin
-f none $SGSDIR/usr/lib/sparcv9/libcrle.so.1=usr/lib/sparcv9/libcrle.so.1 755 root bin
-f none $SGSDIR/usr/lib/sparcv9/libldstab.so.1=usr/lib/sparcv9/libldstab.so.1 755 root bin
-d none opt/SUNWonld/bin/sparcv9 755 root bin
-f none opt/SUNWonld/bin/sparcv9/rdb 755 root bin
-d none opt/SUNWonld/lib/sparcv9 755 root bin
-s none opt/SUNWonld/lib/64=sparcv9
-f none opt/SUNWonld/lib/sparcv9/libldmake.so.1 755 root bin
-f none opt/SUNWonld/lib/sparcv9/bindings.so.1 755 root bin
-f none opt/SUNWonld/lib/sparcv9/perfcnt.so.1 755 root bin
-f none opt/SUNWonld/lib/sparcv9/symbindrep.so.1 755 root bin
-
-#
-# The following commented items are for things that exist within
-# usr/src/cmd/sgs, but which are not normally considered to be
-# part of the SUNWonld package. It is possible to add these items
-# to a special-purpose SUNWonld by uncommenting the appropriate lines.
-#
-#f none $SGSDIR/usr/lib/sparcv9/libl.so.1=usr/lib/sparcv9/libl.so.1 755 root bin
-#s none $SGSDIR/usr/lib/sparcv9/libl.so=./libl.so.1
-#f none $SGSDIR/usr/lib/sparcv9/llib-ll.ln=usr/lib/sparcv9/llib-ll.ln 644 root bin
-
-#f none $SGSDIR/usr/bin/sparcv9/size=usr/bin/sparcv9/size 555 root bin
-#s none $SGSDIR/usr/ccs/bin/sparcv9/size=../../../bin/sparcv9/size
-
-#f none $SGSDIR/usr/lib/sparcv9/liby.so.1=usr/lib/sparcv9/liby.so.1 755 root bin
-#s none $SGSDIR/usr/lib/sparcv9/liby.so=./liby.so.1
-#f none $SGSDIR/usr/lib/sparcv9/llib-ly.ln=usr/lib/sparcv9/llib-ly.ln 644 root bin
--- old/usr/src/cmd/sgs/packages/sparc/Makefile	2019-07-14 19:12:26.964869371 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,36 +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) 1993 by Sun Microsystems, Inc.
-#
-
-
-include ../Makefile.com
-
-.KEEP_STATE:
-
-all: $(FILES)
-install: all $(ROOTREADME) .WAIT pkg
-
-include ../Makefile.targ
--- old/usr/src/cmd/sgs/prof/Makefile.com	2019-07-14 19:12:27.155077769 +0000
+++ new/usr/src/cmd/sgs/prof/Makefile.com	2019-07-14 19:12:27.172263486 +0000
@@ -48,7 +48,7 @@
 # not linted
 SMATCH=off
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 
 %.o:		../common/%.c
 		$(COMPILE.c) $<
--- old/usr/src/cmd/sgs/pvs/Makefile.com	2019-07-14 19:12:27.656569822 +0000
+++ new/usr/src/cmd/sgs/pvs/Makefile.com	2019-07-14 19:12:27.673530545 +0000
@@ -35,19 +35,19 @@
 COMOBJ=		pvs.o
 BLTOBJ=		msg.o
 
-TOOLOBJS =	alist.o
+SGSCOMMONOBJ =	alist.o
 
-OBJS=		$(BLTOBJ) $(COMOBJ) $(TOOLOBJS)
+OBJS=		$(BLTOBJ) $(COMOBJ) $(SGSCOMMONOBJ)
 
 MAPFILE=	$(MAPFILE.NGB)
 MAPOPTS=	$(MAPFILE:%=-M%)
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc
 LLDFLAGS =	'-R$$ORIGIN/../lib'
 LLDFLAGS64 =	'-R$$ORIGIN/../../lib/$(MACH64)'
-LDFLAGS +=	$(VERSREF) $(CC_USE_PROTO) $(MAPOPTS) $(LLDFLAGS)
-LDLIBS +=	$(LDDBGLIBDIR) $(LDDBG_LIB) $(ELFLIBDIR) -lelf \
-		    $(CONVLIBDIR) $(CONV_LIB)
+LDFLAGS +=	$(VERSREF) $(MAPOPTS) $(LLDFLAGS)
+LDLIBS +=	$(LDDBGLIBDIR) -llddbg $(ELFLIBDIR) -lelf \
+		    $(CONVLIBDIR) -lconv
 
 # not linted
 SMATCH=off
@@ -65,6 +65,6 @@
 SGSMSGFLAGS +=	-h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n pvs_msg
 
 SRCS=		$(COMOBJ:%.o=../common/%.c) $(BLTDATA) \
-		$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c)
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c)
 
 CLEANFILES +=	$(BLTFILES)
--- old/usr/src/cmd/sgs/pvs/Makefile.targ	2019-07-14 19:12:28.139427900 +0000
+++ new/usr/src/cmd/sgs/pvs/Makefile.targ	2019-07-14 19:12:28.159485639 +0000
@@ -29,7 +29,7 @@
 		$(COMPILE.c) $<
 		$(POST_PROCESS_O)
 
-%.o:		$(SGSTOOLS)/common/%.c
+%.o:		$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
--- old/usr/src/cmd/sgs/rtld/Makefile.com	2019-07-14 19:12:28.602163575 +0000
+++ new/usr/src/cmd/sgs/rtld/Makefile.com	2019-07-14 19:12:28.619784807 +0000
@@ -29,13 +29,13 @@
 
 AVLOBJ=		avl.o
 DTROBJ=		dtrace_data.o
-TOOLOBJS=	alist.o strhash.o
+SGSCOMMONOBJ=	alist.o strhash.o
 BLTOBJ=		msg.o
 ELFCAPOBJ=	elfcap.o
 OBJECTS=	$(BLTOBJ) \
 		$(AVLOBJ) \
 		$(DTROBJ) \
-		$(TOOLOBJS) \
+		$(SGSCOMMONOBJ) \
 		$(ELFCAPOBJ) \
 		$(P_ASOBJS)   $(P_COMOBJS)   $(P_MACHOBJS)   $(G_MACHOBJS)  \
 		$(S_ASOBJS)   $(S_COMOBJS)   $(S_MACHOBJS)   $(CP_MACHOBJS)
@@ -75,10 +75,10 @@
 
 FILEMODE =	755
 
-CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc \
-		-I$(SRCBASE)/uts/common/krtld \
-		-I$(SRCBASE)/uts/$(PLAT) \
-		-I$(SRCBASE)/uts/$(PLAT)/krtld \
+CPPFLAGS +=	-I$(SRC)/lib/libc/inc \
+		-I$(SRC)/uts/common/krtld \
+		-I$(SRC)/uts/$(PLAT) \
+		-I$(SRC)/uts/$(PLAT)/krtld \
 		-I$(SRC)/common/sgsrtcid \
 		-I$(ELFCAP) \
 		 $(CPPFEATUREMACROS)
@@ -101,11 +101,11 @@
 CPICLIB64 =	$(VAR_RTLD_CPICLIB64)
 CLIB =		-lc_pic
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) \
+LDLIBS +=	$(CONVLIBDIR) -lconv \
 		$(CPICLIB) $(CLIB) \
-		$(LDDBGLIBDIR) $(LDDBG_LIB) \
+		$(LDDBGLIBDIR) -llddbg \
 		$(RTLDLIB) -lrtld \
-		$(LDLIB) $(LD_LIB)
+		$(LDLIB) -lld
 
 DYNFLAGS +=	-i -e _rt_boot $(VERSREF) $(ZNODLOPEN) \
 		$(ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN'
@@ -138,9 +138,9 @@
 
 SRCS=		$(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \
 		$(DTROBJ:%.o=$(VAR_DTRDIR)/%.c) \
-		$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
+		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \
 		$(COMOBJS:%.o=../common/%.c)  $(MACHOBJS:%.o=%.c) $(BLTDATA) \
-		$(G_MACHOBJS:%.o=$(SRCBASE)/uts/$(PLAT)/krtld/%.c) \
+		$(G_MACHOBJS:%.o=$(SRC)/uts/$(PLAT)/krtld/%.c) \
 		$(CP_MACHOBJS:%.o=../$(MACH)/%.c) \
 		$(ASOBJS:%.o=%.s)
 
--- old/usr/src/cmd/sgs/rtld/Makefile.targ	2019-07-14 19:12:29.091101819 +0000
+++ new/usr/src/cmd/sgs/rtld/Makefile.targ	2019-07-14 19:12:29.108246076 +0000
@@ -58,11 +58,11 @@
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SGSTOOLS)/common/%.c
+pics/%.o:	$(SGSCOMMON)/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-pics/%.o:	$(SRCBASE)/uts/$(PLAT)/krtld/%.c
+pics/%.o:	$(SRC)/uts/$(PLAT)/krtld/%.c
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
@@ -71,7 +71,7 @@
 		$(POST_PROCESS_O)
 
 $(RTLD):	pics $(PICS) $(CRTS)
-		$(LD_USE_PROTO)ld -o $@ -dy -G $(DYNFLAGS) $(CRTI) $(PICS) \
+		$(LD) -o $@ -dy -G $(DYNFLAGS) $(CRTI) $(PICS) \
 		    $(LDLIBS) $(CRTN)
 		$(POST_PROCESS_SO)
 
--- old/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com	2019-07-14 19:12:29.565270573 +0000
+++ new/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com	2019-07-14 19:12:29.583832713 +0000
@@ -66,7 +66,7 @@
 		-I$(SRC)/uts/$(ARCH)/sys
 
 DYNFLAGS +=	$(VERSREF)
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) -lc
+LDLIBS +=	$(CONVLIBDIR) -lconv -lc
 
 ROOTMDBLIB=	$(ROOT)/usr/lib/mdb/proc
 ROOTMDBLIB64=	$(ROOTMDBLIB)/$(MACH64)
--- old/usr/src/cmd/sgs/rtld/sparc/Makefile	2019-07-14 19:12:30.052839026 +0000
+++ new/usr/src/cmd/sgs/rtld/sparc/Makefile	2019-07-14 19:12:30.071445538 +0000
@@ -53,7 +53,7 @@
 CRTN=		pics/crtn.o
 CRTS=		$(CRTI)		$(CRTN)
 
-CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h
+CHKSRCS=	$(SRC)/uts/common/krtld/reloc.h
 
 BASEPLAT =	sparc
 
--- old/usr/src/cmd/sgs/rtld/sparcv9/Makefile	2019-07-14 19:12:30.532317115 +0000
+++ new/usr/src/cmd/sgs/rtld/sparcv9/Makefile	2019-07-14 19:12:30.549761252 +0000
@@ -52,7 +52,7 @@
 CRTN=		pics/crtn.o
 CRTS=		$(CRTI)		$(CRTN)
 
-CHKSRCS=	$(SRCBASE)/uts/common/krtld/reloc.h
+CHKSRCS=	$(SRC)/uts/common/krtld/reloc.h
 
 BASEPLAT =	sparc
 
--- old/usr/src/cmd/sgs/size/Makefile.com	2019-07-14 19:12:31.040328501 +0000
+++ new/usr/src/cmd/sgs/size/Makefile.com	2019-07-14 19:12:31.057930953 +0000
@@ -44,6 +44,6 @@
 LLDFLAGS64 =	'$(LDPASS)-R$$ORIGIN/../../../lib/$(MACH64)'
 LDFLAGS +=	$(LLDFLAGS)
 
-LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf
+LDLIBS +=	$(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf
 
 CLEANFILES +=	$(OBJS)
--- old/usr/src/cmd/sgs/tools/Makefile	2019-07-14 19:12:31.523389128 +0000
+++ new/usr/src/cmd/sgs/tools/Makefile	2019-07-14 19:12:31.539658849 +0000
@@ -38,20 +38,7 @@
 
 include		$(SRC)/Makefile.master
 
-LSSRCS=		info.sh	\
-		proto.sh
-
-SRCS=		$(LSSRCS)
-
-LEXECS=		$(LSSRCS:%.sh=%)
-
-ROOTDIR =	$(ROOT)/opt/SUNWonld/bin
-ROOTPROGS =	$(GEXECS:%=$(ROOTDIR)/%)
-ROOTPROGS +=	$(PSRCS:%=$(ROOTDIR)/%)
-
-$(ROOTPROGS) :=	FILEMODE=755
-
-SUBDIRS=	$(MACH) man
+SUBDIRS=	$(MACH)
 
 all:=		TARGET= all
 install:=	TARGET= install
@@ -61,29 +48,11 @@
 
 .KEEP_STATE:
 
-all:		$(EXECS) $(SUBDIRS)
-
-install:	all $(ROOTPROGS) $(SUBDIRS)
-
-clean clobber:	$(SUBDIRS)
-		$(RM) $(RMFLAGS) $(EXECS)
+all install clean clobberall: $(SUBDIRS)
 
 delete:
 
-%:		%.ksh
-		$(RM) $@
-		cat $< > $@
-		chmod +x $@
-
 $(SUBDIRS):	FRC
 		@cd $@; pwd; $(MAKE) $(TARGET)
 
-$(ROOTDIR)/%:	%
-		$(INS.file)
-
-$(ROOTDIR)/%:	scoping/%
-		$(INS.file)
-
 FRC:
-
-execs:		$(EXECS)
--- old/usr/src/cmd/sgs/tools/Makefile.com	2019-07-14 19:12:32.015094208 +0000
+++ new/usr/src/cmd/sgs/tools/Makefile.com	2019-07-14 19:12:32.033819119 +0000
@@ -29,8 +29,10 @@
 #
 # Makefile to support tools used for linker development:
 #
-#  o	sgsmsg creates message headers/arrays/catalogs (a native tool).
+# chkmsg	- checks that sgsmsg is used correctly
+# piglatin	- generates phone message catalogs for testing
 #
+
 # Note, these tools are not part of the product.
 #
 # cmd/sgs/tools/Makefile.com
@@ -39,29 +41,12 @@
 
 include		$(SRC)/cmd/sgs/Makefile.com
 
-SGSPROTO=	../../proto/$(MACH)
-
-COMOBJS=
-
-NATOBJS=	piglatin.o
-
-OBJECTS=	$(COMOBJS)  $(NATOBJS)
-
-AVLOBJ=		avl.o
-TOOL_OBJS=	sgsmsg.o string_table.o findprime.o assfail.o
-SGSMSG_OBJS=	$(TOOL_OBJS) $(AVLOBJ)
-SGSMSG_SRCS=	$(TOOL_OBJS:%.o=../common/%.c) \
-		$(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c)
-
-$(SGSMSG_OBJS) := NATIVE_CFLAGS += -I../../include $(VAR_TOOLS_CPPFLAGS)
+OBJECTS=	piglatin.o
 
-PROGS=		$(COMOBJS:%.o=%)
-NATIVE=		$(NATOBJS:%.o=%) sgsmsg
-SRCS=		$(COMOBJS:%.o=../common/%.c)  $(NATOBJS:%.o=../common/%.c)
+NATIVE=		$(OBJECTS:%.o=%)
+SRCS=		$(OBJECTS:%.o=../common/%.c)
 
 CPPFLAGS +=	$(VAR_TOOLS_CPPFLAGS)
-LDFLAGS +=	$(CC_USE_PROTO)
-CLEANFILES +=	$(SGSMSG_OBJS)
 
 ROOTDIR=	$(ROOT)/opt/SUNWonld
 ROOTPROGS=	$(PROGS:%=$(ROOTDIR)/bin/%)
--- old/usr/src/cmd/sgs/tools/Makefile.targ	2019-07-14 19:12:32.490989116 +0000
+++ new/usr/src/cmd/sgs/tools/Makefile.targ	2019-07-14 19:12:32.507154548 +0000
@@ -33,21 +33,6 @@
 $(ROOTDIR)/lib/%:	%
 		$(INS.file)
 
-sgsmsg:		$(SGSMSG_OBJS)
-		$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) \
-			-o $@ $(SGSMSG_OBJS)
-
-sgsmsg.o:	../common/sgsmsg.c
-		$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) -c ../common/sgsmsg.c
-
-string_table.o:	../common/string_table.c
-		$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) -c \
-		    ../common/string_table.c
-
-avl.o:		$(VAR_AVLDIR)/avl.c
-		$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) -c \
-		    $(VAR_AVLDIR)/avl.c
-
 piglatin:	../common/piglatin.c
 		$(NATIVECC) $(NATIVE_CFLAGS) -o $@ ../common/piglatin.c
 
@@ -59,8 +44,6 @@
 		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
-catalog:	sgsmsg
-
 clobber:	clean
 		$(RM) $(PROGS) $(NATIVE) $(CLOBBERFILES)
 
--- old/usr/src/cmd/sgs/packages/common/SUNWonld-README	2019-07-14 19:12:32.953721905 +0000
+++ /dev/null	2019-07-14 19:12:26.000000000 +0000
@@ -1,1671 +0,0 @@
-#
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# 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
-#
-# Note: The contents of this file are used to determine the versioning
-#	information for the SGS toolset. The number of CRs listed in
-#	this file must grow monotonically, or the SGS version will
-#	move backwards, causing a great deal of confusion. As such,
-#	CRs must never be removed from this file. See
-#	libconv/common/bld_vernote.ksh, and bug#4519569 for more
-#	details on SGS versioning.
-#
---------------------------------------------------------------------------------
-SUNWonld - link-editors development package.
---------------------------------------------------------------------------------
-
-  The SUNWonld package is an internal development package containing the
-  link-editors and some related tools.  All components live in the OSNET
-  source base, but not all components are delivered as part of the normal
-  OSNET consolidation.  The intent of this package is to provide access
-  to new features/bugfixes before they become generally available.
-
-  General link-editor information can be found:
-
-    http://linkers.central/
-    http://linkers.sfbay/	(also known as linkers.eng)
-
-  Comments and Questions:
-
-    Contact Rod Evans, Ali Bahrami, and/or Seizo Sakurai.
-
-  Warnings:
-
-    The postremove script for this package employs /usr/sbin/static/mv,
-    and thus, besides the common core dependencies, this package also
-    has a dependency on the SUNWsutl package.
-
-  Patches:
-
-    If the patch has been made official, you'll find it in:
-
-	http://sunsolve.east/cgi/show.pl?target=patches/os-patches
-
-    If it hasn't been released, the patch will be in:
-
-	/net/sunsoftpatch/patches/temporary
-
-    Note, any patches logged here refer to the temporary ("T") name, as we
-    never know when they're made official, and although we try to keep all
-    patch information up-to-date the real status of any patch can be
-    determined from:
-
-	http://sunsoftpatch.eng
-
-    If it has been obsoleted, the patch will be in:
-
-        /net/on${RELEASE}-patch/on${RELEASE}/patches/${MACH}/obsolete
-
-
-  History:
-
-    Note, starting after Solaris 10, letter codes in parenthesis may
-    be found following the bug synopsis. Their meanings are as follows:
-
-	(D) A documentation change accompanies the implementation change.
-	(P) A packaging change accompanies the implementation change.
-
-    In all cases, see the implementation bug report for details.
-
-    The following bug fixes exist in the OSNET consolidation workspace
-    from which this package is created:
-
----------
-Solaris 8
----------
-Bugid   Risk Synopsis
-================================================================================
-4225937 i386 linker emits sparc specific warning messages
-4215164 shf_order flag handling broken by fix for 4194028.
-4215587 using ld and the -r option on solaris 7 with compiler option -xarch=v9
-	causes link errors.
-4234657 103627-08 breaks purify 4.2 (plt padding should not be enabled for
-	32-bit)
-4235241 dbx no longer gets dlclose notification.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-05  (never released)
-	Solaris/SunOS 5.7_x86		patch 106951-05  (never released)
-	Solaris/SunOS 5.6_sparc		patch 107733-02  (never released)
-	Solaris/SunOS 5.6_x86		patch 107734-02
---------------------------------------------------------------------------------
-4248290 inetd dumps core upon bootup - failure in dlclose() logic.
-4238071 dlopen() leaks while descriptors under low memory conditions
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-06
-	Solaris/SunOS 5.7_x86		patch 106951-06
-	Solaris/SunOS 5.6_sparc		patch 107733-03  (never released)
-	Solaris/SunOS 5.6_x86		patch 107734-03
---------------------------------------------------------------------------------
-4267980 INITFIRST flag of the shard object could be ignored.
---------------------------------------------------------------------------------
-All the above changes plus:
-    4238973 fix for 4121152 affects linking of Ada objects
-    4158744 patch 103627-02 causes core when RPATH has blank entry and
-	    dlopen/dlclose is used
-are incorporated in the following patches:
-	Solaris/SunOS 5.5.1_sparc	patch 103627-12  (never released)
-	Solaris/SunOS 5.5.1_x86		patch 103628-11
---------------------------------------------------------------------------------
-4256518 miscalculated calloc() during dlclose/tsorting can result in segv
-4254171 DT_SPARC_REGISTER has invalid value associated with it.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-07
-	Solaris/SunOS 5.7_x86		patch 106951-07
-	Solaris/SunOS 5.6_sparc		patch 107733-04  (never released)
-	Solaris/SunOS 5.6_x86		patch 107734-04
---------------------------------------------------------------------------------
-4293159 ld needs to combine sections with and without SHF_ORDERED flag(comdat)
-4292238 linking a library which has a static char ptr invokes mprotect() call
---------------------------------------------------------------------------------
-All the above changes except for:
-    4256518 miscalculated calloc() during dlclose/tsorting can result in segv
-    4254171 DT_SPARC_REGISTER has invalid value associated with it.
-plus:
-    4238973 fix for 4121152 affects linking of Ada objects
-    4158744 patch 103627-02 causes core when RPATH has blank entry and
-	    dlopen/dlclose is used
-are incorporated in the following patches:
-	Solaris/SunOS 5.5.1_sparc	patch 103627-13
-	Solaris/SunOS 5.5.1_x86		patch 103628-12
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-08
-	Solaris/SunOS 5.7_x86		patch 106951-08
-	Solaris/SunOS 5.6_sparc		patch 107733-05
-	Solaris/SunOS 5.6_x86		patch 107734-05
---------------------------------------------------------------------------------
-4295613 COMMON symbol resolution can be incorrect
---------------------------------------------------------------------------------
-All the above changes plus:
-    4238973 fix for 4121152 affects linking of Ada objects
-    4158744 patch 103627-02 causes core when RPATH has blank entry and
-	    dlopen/dlclose is used
-are incorporated in the following patches:
-	Solaris/SunOS 5.5.1_sparc	patch 103627-14
-	Solaris/SunOS 5.5.1_x86		patch 103628-13
---------------------------------------------------------------------------------
-All the above changes plus:
-    4351197 nfs performance problem by 103627-13
-are incorporated in the following patches:
-	Solaris/SunOS 5.5.1_sparc	patch 103627-15
-	Solaris/SunOS 5.5.1_x86		patch 103628-14
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-09
-	Solaris/SunOS 5.7_x86		patch 106951-09
-	Solaris/SunOS 5.6_sparc		patch 107733-06
-	Solaris/SunOS 5.6_x86		patch 107734-06
---------------------------------------------------------------------------------
-4158971 increase the default segment alignment for i386 to 64k
-4064994 Add an $ISALIST token to those understood by the dynamic linker
-xxxxxxx ia64 common code putback
-4239308 LD_DEBUG busted for sparc machines
-4239008 Support MAP_ANON
-4238494 link-auditing extensions required
-4232239 R_SPARC_LOX10 truncates field
-4231722 R_SPARC_UA* relocations are busted
-4235514 R_SPARC_OLO10 relocation fails
-4244025 sgsmsg update
-4239281 need to support SECREL relocations for ia64
-4253751 ia64 linker must support PT_IA_64_UNWIND tables
-4259254 dlmopen mistakenly closes fd 0 (stdin) under certain error conditions
-4260872 libelf hangs when libthread present
-4224569 linker core dumping when profiling specified
-4270937 need mechanism to suppress ld.so.1's use of a default search path.
-1050476 ld.so to permit configuration of search path
-4273654 filtee processing using $ISALIST could be optimized
-4271860 get MERCED cruft out of elf.h
-4248991 Dynamic loader (via PLT) corrupts register G4
-4275754 cannot mmap file: Resource temporarily unavailable
-4277689 The linker can not handle relocation against MOVE tabl
-4270766 atexit processing required on dlclose().
-4279229 Add a "release" token to those understood by the dynamic linker
-4215433 ld can bus error when insufficient disc space exists for output file
-4285571 Pssst, want some free disk space?  ld's miscalculating.
-4286236 ar gives confusing "bad format" error with a null .stab section
-4286838 ld.so.1 can't handle a no-bits segment
-4287364 ld.so.1 runtime configuration cleanup
-4289573 disable linking of ia64 binaries for Solaris8
-4293966 crle(1)'s default directories should be supplied
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 8 600 (1st Q-update - s28u1)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4309212 dlsym can't find symbol
-4311226 rejection of preloading in secure apps is inconsistent
-4312449 dlclose: invalid deletion of dependency can occur using RTLD_GLOBAL
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-01
-	Solaris/SunOS 5.8_x86		patch 109148-01
-	Solaris/SunOS 5.7_sparc		patch 106950-10
-	Solaris/SunOS 5.7_x86		patch 106951-10
-	Solaris/SunOS 5.6_sparc		patch 107733-07
-	Solaris/SunOS 5.6_x86		patch 107734-07
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 8 900 (2nd Q-update - s28u2)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4324775 non-PIC code & -zcombreloc don't mix very well...
-4327653 run-time linker should preload tables it will process (madvise)
-4324324 shared object code can be referenced before .init has fired
-4321634 .init firing of multiple INITFIRST objects can fail
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-03
-	Solaris/SunOS 5.8_x86		patch 109148-03
-	Solaris/SunOS 5.7_sparc		patch 106950-11
-	Solaris/SunOS 5.7_x86		patch 106951-11
-	Solaris/SunOS 5.6_sparc		patch 107733-08
-	Solaris/SunOS 5.6_x86		patch 107734-08
---------------------------------------------------------------------------------
-4338812 crle(1) omits entries in the directory cache
-4341496 RFE: provide a static version of /usr/bin/crle
-4340878 rtld should treat $ORIGIN like LD_LIBRARY_PATH in security issues
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-04
-	Solaris/SunOS 5.8_x86		patch 109148-04
-	Solaris/SunOS 5.7_sparc		patch 106950-12
-	Solaris/SunOS 5.7_x86		patch 106951-12
---------------------------------------------------------------------------------
-4349563 auxiliary filter error handling regression introduced in 4165487
-4355795 ldd -r now gives "displacement relocated" warnings
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.7_sparc		patch 106950-13
-	Solaris/SunOS 5.7_x86		patch 106951-13
-	Solaris/SunOS 5.6_sparc		patch 107733-09
-	Solaris/SunOS 5.6_x86		patch 107734-09
---------------------------------------------------------------------------------
-4210412 versioning a static executable causes ld to core dump
-4219652 Linker gives misleading error about not finding main (xarch=v9)
-4103449 ld command needs a command line flag to force 64-bits
-4187211 problem with RDISP32 linking in copy-relocated objects
-4287274 dladdr, dlinfo do not provide the full path name of a shared object
-4297563 dlclose still does not remove all objects.
-4250694 rtld_db needs a new auxvec entry
-4235315 new features for rtld_db (DT_CHECKSUM, dynamic linked .o files
-4303609 64bit libelf.so.1 does not properly implement elf_hash()
-4310901 su.static fails when OSNet build with lazy-loading
-4310324 elf_errno() causes Bus Error(coredump) in 64-bit multithreaded programs
-4306415 ld core dump
-4316531 BCP: possible failure with dlclose/_preexec_exit_handlers
-4313765 LD_BREADTH should be shot
-4318162 crle uses automatic strings in putenv.
-4255943 Description of -t option incomplete.
-4322528 sgs message test infrastucture needs improvement
-4239213 Want an API to obtain linker's search path
-4324134 use of extern mapfile directives can contribute unused symbols
-4322581 ELF data structures could be layed out more efficiently...
-4040628 Unnecessary section header symbols should be removed from .dynsym
-4300018 rtld: bindlock should be freed before calling call_fini()
-4336102 dlclose with non-deletable objects can mishandle dependencies
-4329785 mixing of SHT_SUNW_COMDAT & SHF_ORDERED causes ld to seg fault
-4334617 COPY relocations should be produces for references to .bss symbols
-4248250 relcoation of local ABS symbols incorrect
-4335801 For complimentary alignments eliminate ld: warning: symbol `ll'
-        has differing a
-4336980 ld.so.1 relative path processing revisited
-4243097 dlerror(3DL) is not affected by setlocale(3C).
-4344528 dump should remove -D and -l usage message
-xxxxxxx enable LD_ALTEXEC to access alternate link-editor
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-06
-	Solaris/SunOS 5.8_x86		patch 109148-06
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 8 101 (3rd Q-update - s28u3)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4346144 link-auditing: plt_tracing fails if LA_SYMB_NOPLTENTER given after
-        being bound
-4346001 The ld should support mapfile syntax to generate PT_SUNWSTACK segment
-4349137 rtld_db: A third fallback method for locating the linkmap
-4343417 dladdr interface information inadequate
-4343801 RFE: crle(1): provide option for updating configuration files
-4346615 ld.so.1 attempting to open a directory gives: No such device
-4352233 crle should not honor umask
-4352330 LD_PRELOAD cannot use absolute path for privileged program
-4357805 RFE: man page for ld(1) does not document all -z or -B options in
-	Solaris 8 9/00
-4358751 ld.so.1: LD_XXX environ variables and LD_FLAGS should be synchronized.
-4358862 link editors should reference "64" symlinks instead of sparcv9 (ia64).
-4356879 PLTs could use faster code sequences in some cases
-4367118 new fast baplt's fail when traversed twice in threaded application
-4366905 Need a way to determine path to a shared library
-4351197 nfs performance problem by 103627-13
-4367405 LD_LIBRARY_PATH_64 not being used
-4354500 SHF_ORDERED ordered scections does not properly sort sections
-4369068 ld(1)'s weak symbol processing is inefficient (slow and doesn't scale).
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-07
-	Solaris/SunOS 5.8_x86		patch 109148-07
-	Solaris/SunOS 5.7_sparc		patch 106950-14
-	Solaris/SunOS 5.7_x86		patch 106951-14
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 8 701 (5th Q-update - s28u5)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4368846 ld(1) fails to version some interfaces given in a mapfile
-4077245 dump core dump on null pointer.
-4372554 elfdump should demangle symbols (like nm, dump)
-4371114 dlclose may unmap a promiscuous object while it's still in use.
-4204447 elfdump should understand SHN_AFTER/SHN_BEGIN macro
-4377941 initialization of interposers may not occur
-4381116 ldd/ld.so.1 could aid in detecting unused dependencies
-4381783 dlopen/dlclose of a libCrun+libthread can dump core
-4385402 linker & run-time linker must support gABI ELF updates
-4394698 ld.so.1 does not process DF_SYMBOLIC - not gABI conforming
-4394212 the link editor quietly ignores missing support libraries
-4390308 ld.so.1 should provide more flexibility LD_PRELOAD'ing 32-bit/64-bit
-	objects
-4401232 crle(1) could provide better flexibility for alternatives
-4401815 fix misc nits in debugging output...
-4402861 cleanup /usr/demo/link_audit & /usr/tmp/librtld_db demo source code...
-4393044 elfdump should allow raw dumping of sections
-4413168 SHF_ORDERED bit causes linker to generate a separate section
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-08
-	Solaris/SunOS 5.8_x86		patch 109148-08
---------------------------------------------------------------------------------
-4452202 Typos in <sys/link.h>
-4452220 dump doesn't support RUNPATH
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-09
-	Solaris/SunOS 5.8_x86		patch 109148-09
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 8 1001 (6th Q-update - s28u6)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4421842 fixups in SHT_GROUP processing required...
-4450433 problem with liblddbg output on -Dsection,detail when
-        processing SHF_LINK_ORDER
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-10
-	Solaris/SunOS 5.8_x86		patch 109148-10
-	Solaris/SunOS 5.7_sparc		patch 106950-15
-	Solaris/SunOS 5.7_x86		patch 106951-15
---------------------------------------------------------------------------------
-4463473 pldd showing wrong output
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-11
-	Solaris/SunOS 5.8_x86		patch 109148-11
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 8 202 (7th Q-update - s28u7)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4488954 ld.so.1 reuses same buffer to send ummapping range to
-	_preexec_exit_handlers()
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-12
-	Solaris/SunOS 5.8_x86		patch 109148-12
---------------------------------------------------------------------------------
-
----------
-Solaris 9
----------
-Bugid   Risk Synopsis
-================================================================================
-4505289 incorrect handling of _START_ and _END_
-4506164 mcs does not recognize #linkbefore or #linkafter qualifiers
-4447560 strip is creating unexecutable files...
-4513842 library names not in ld.so string pool cause corefile bugs
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-13
-	Solaris/SunOS 5.8_x86		patch 109148-13
-	Solaris/SunOS 5.7_sparc		patch 106950-16
-	Solaris/SunOS 5.7_x86		patch 106951-16
---------------------------------------------------------------------------------
-4291384 ld -M with a mapfile does not properly align Fortran REAL*8 data
-4413322 SunOS 5.9 librtld_db doesn't show dlopened ".o" files anymore?
-4429371 librtld_db busted on ia32 with SC6.x compilers...
-4418274 elfdump dumps core on invalid input
-4432224 libelf xlate routines are out of date
-4433643 Memory leak using dlopen()/dlclose() in Solaris 8
-4446564 ldd/lddstub - core dump conditions
-4446115 translating SUNW_move sections is broken
-4450225 The rdb command can fall into an infinite loop
-4448531 Linker Causes Segmentation Fault
-4453241 Regression in 4291384 can result in empty symbol table.
-4453398 invalid runpath token can cause ld to spin.
-4460230 ld (for OS 5.8 and 5.9) loses error message
-4462245 ld.so.1 core dumps when executed directly...
-4455802 need more flexibility in establishing a support library for ld
-4467068 dyn_plt_entsize not properly initialized in ld.so.1
-4468779 elf_plt_trace_write() broken on i386 (link-auditing)
-4465871 -zld32 and -zld64 does not work the way it should
-4461890 bad shared object created with -zredlocsym
-4469400 ld.so.1: is_so_loaded isn't as efficient as we thought...
-4469566 lazy loading fallback can reference un-relocated objects
-4470493 libelf incorectly translates NOTE sections accross architectures...
-4469684 rtld leaks dl_handles and permits on dlopen/dlclose
-4475174 ld.so.1 prematurly reports the failure to load a object...
-4475514 ld.so.1 can core dump in memory allocation fails (no swap)
-4481851 Setting ld.so.1 environment variables globally would be useful
-4482035 setting LD_PROFILE & LD_AUDIT causes ping command to issue warnings
-	on 5.8
-4377735 segment reservations cause sbrk() to fail
-4491434 ld.so.1 can leak file-descriptors when loading same named objects
-4289232 some of warning/error/debugging messages from libld.so can be revised
-4462748 Linker Portion of TLS Support
-4496718 run-time linkers mutex_locks not working with ld_libc interface
-4497270 The -zredlocsym option should not eliminate partially initialized local
-	symbols
-4496963 dumping an object with crle(1) that uses $ORIGIN can loose its
-	dependencies
-4499413 Sun linker orders of magnitude slower than gnu linker
-4461760 lazy loading libXm and libXt can fail.
-4469031 The partial initialized (local) symbols for intel platform is not
-	working.
-4492883 Add link-editor option to multi-pass archives to resolve unsatisfied
-	symbols
-4503731 linker-related commands misspell "argument"
-4503768 whocalls(1) should output messages to stderr, not stdout
-4503748 whocalls(1) usage message and manpage could be improved
-4503625 nm should be taught about TLS symbols - that they aren't allowed that is
-4300120 segment address validation is too simplistic to handle segment
-	reservations
-4404547 krtld/reloc.h could have better error message, has typos
-4270931 R_SPARC_HIX22 relocation is not handled properly
-4485320 ld needs to support more the 32768 PLTs
-4516434 sotruss can not watch libc_psr.so.1
-4213100 sotruss could use more flexible pattern matching
-4503457 ld seg fault with comdat
-4510264 sections with SHF_TLS can come in different orders...
-4518079 link-editor support library unable to modify section header flags
-4515913 ld.so.1 can incorrectly decrement external reference counts on dlclose()
-4519569 ld -V does not return a interesting value...
-4524512 ld.so.1 should allow alternate termination signals
-4524767 elfdump dies on bogus sh_name fields...
-4524735 ld getopt processing of '-' changed
-4521931 subroutine in a shared object as LOCL instead of GLOB
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-14
-	Solaris/SunOS 5.8_x86		patch 109148-14
-	Solaris/SunOS 5.7_sparc		patch 106950-17
-	Solaris/SunOS 5.7_x86		patch 106951-17
---------------------------------------------------------------------------------
-4532729 tentative definition of TLS variable causes linker to dump core
-4526745 fixup ld error message about duplicate dependencies/needed names
-4522999 Solaris linker one order of magnitude slower than GNU linker
-4518966 dldump undoes existing relocations with no thought of alignment or size.
-4587441 Certain libraries have race conditions when setting error codes
-4523798 linker option to align bss to large pagesize alignments.
-4524008 ld can improperly set st_size of symbols named "_init" or "_fini"
-4619282 ld cannot link a program with the option -sb
-4620846 Perl Configure probing broken by ld changes
-4621122 multiple ld '-zinitarray=' on a commandline fails
---------------------------------------------------------------------------------
-	Solaris/SunOS 5.8_sparc		patch 109147-15
-	Solaris/SunOS 5.8_x86		patch 109148-15
-	Solaris/SunOS 5.7_sparc		patch 106950-18
-	Solaris/SunOS 5.7_x86		patch 106951-18
-	Solaris/SunOS 5.6_sparc		patch 107733-10
-	Solaris/SunOS 5.6_x86		patch 107734-10
---------------------------------------------------------------------------------
-All the above changes plus:
-	4616944 ar seg faults when order of object file is reversed.
-are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch 109147-16
-	Solaris/SunOS 5.8_x86		patch 109148-16
---------------------------------------------------------------------------------
-All the above changes plus:
-	4872634 Large LD_PRELOAD values can cause SEGV of process
-are incorporated in the following patches:
-	Solaris/SunOS 5.6_sparc		patch T107733-11
-	Solaris/SunOS 5.6_x86		patch T107734-11
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 9 1202 (2nd Q-update - s9u2)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4546416 add help messages to ld.so mdbmodule
-4526752 we should build and ship ld.so's mdb module
-4624658 update 386 TLS relocation values
-4622472 LA_SYMB_DLSYM not set for la_symbind() invocations
-4638070 ldd/ld.so.1 could aid in detecting unreferenced dependencies
-	PSARC/2002/096 Detecting unreferenced dependencies with ldd(1)
-4633860 Optimization for unused static global variables
-	PSARC/2002/113 ld -zignore - section elimination
-4642829 ld.so.1 mprotect()'s text segment for weak relocations (it shouldn't)
-4621479 'make' in $SRC/cmd/sgs/tools tries to install things in the proto area
-4529912 purge ia64 source from sgs
-4651709 dlopen(RTLD_NOLOAD) can disable lazy loading
-4655066 crle: -u with nonexistent config file doesn't work
-4654406 string tables created by the link-editor could be smaller...
-	PSARC/2002/160 ld -znocompstrtab - disable string-table compression
-4651493 RTLD_NOW can result in binding to an object prior to its init being run.
-4662575 linker displacement relocation checking introduces significant
-	linker overhead
-4533195 ld interposes on malloc()/free() preventing support library from freeing
-	memory
-4630224 crle get's confused about memory layout of objects...
-4664855 crle on application failed with ld.so.1 encountering mmap() returning
-	ENOMEM err
-4669582 latest dynamic linker causes libthread _init to get skipped
-4671493 ld.so.1 inconsistantly assigns PATHNAME() on primary objects
-4668517 compile with map.bssalign doesn't copy _iob to bss
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-01
-	Solaris/SunOS 5.8_sparc		patch T109147-17
-	Solaris/SunOS 5.8_x86		patch T109148-17
---------------------------------------------------------------------------------
-4701749 On Solaris 8 + 109147-16 ld crashes when building a dynamic library.
-4707808 The ldd command is broken in the latest 2.8 linker patch.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-02
-	Solaris/SunOS 5.8_sparc		patch T109147-18
-	Solaris/SunOS 5.8_x86		patch T109148-18
---------------------------------------------------------------------------------
-4696204 enable extended section indexes in relocatable objects
-	PSARC/2001/332 ELF gABI updates - round II
-	PSARC/2002/369 libelf interfaces to support ELF Extended Sections
-4706503 linkers need to cope with EF_SPARCV9_PSO/EF_SPARCV9_RMO
-4716929 updating of local register symbols in dynamic symtab busted...
-4710814 add "official" support for the "symbolic" keyword in linker map-file
-	PSARC/2002/439 linker mapfile visibility declarations
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-03
-	Solaris/SunOS 5.8_sparc		patch T109147-19
-	Solaris/SunOS 5.8_x86		patch T109148-19
-	Solaris/SunOS 5.7_sparc		patch T106950-19
-	Solaris/SunOS 5.7_x86		patch T106951-19
---------------------------------------------------------------------------------
-
------------------------------------
-Solaris 9 403 (3nd Q-update - s9u3)
------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4731174 strip(1) does not fixup SHT_GROUP data
-4733697 -zignore with gcc may exclude C++ exception sections
-4733317 R_SPARC_*_HIX22 calculations are wrong with 32bit LD building
-	ELF64 binaries
-4735165 fatal linker error when compiling C++ programs with -xlinkopt
-4736951 The mcs broken when the target file is an archive file
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.8_sparc		patch T109147-20
-	Solaris/SunOS 5.8_x86		patch T109148-20
-	Solaris/SunOS 5.7_sparc		patch T106950-20
-	Solaris/SunOS 5.7_x86		patch T106951-20
---------------------------------------------------------------------------------
-4739660 Threads deadlock in schedlock and dynamic linker lock.
-4653148 ld.so.1/libc should unregister its dlclose() exit handler via a fini.
-4743413 ld.so.1 doesn't terminate argv with NULL pointer when invoked directly
-4746231 linker core-dumps when SECTION relocations are made against discarded
-	sections
-4730433 ld.so.1 wastes time repeatedly opening dependencies
-4744337 missing RD_CONSISTENT event with dlmopen(LD_ID_NEWLM, ...)
-4670835 rd_load_objiter can ignore callback's return value
-4745932 strip utility doesn't strip out Dwarf2 debug section
-4754751 "strip" command doesn't remove comdat stab sections.
-4755674 Patch 109147-18 results in coredump.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-        Solaris/SunOS 5.9_sparc         patch T112963-04
-        Solaris/SunOS 5.7_sparc         patch T106950-21
-        Solaris/SunOS 5.7_x86           patch T106951-21
---------------------------------------------------------------------------------
-4772927 strip core dumps on an archive library
-4774727 direct-bindings can fail against copy-reloc symbols
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-        Solaris/SunOS 5.9_sparc         patch T112963-05
-        Solaris/SunOS 5.9_x86           patch T113986-01
-        Solaris/SunOS 5.8_sparc         patch T109147-21
-        Solaris/SunOS 5.8_x86           patch T109148-21
-        Solaris/SunOS 5.7_sparc         patch T106950-22
-        Solaris/SunOS 5.7_x86           patch T106951-22
---------------------------------------------------------------------------------
-
------------------------------------
-Solaris 9 803 (4th Q-update - s9u4)
------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4730110 ld.so.1 list implementation could scale better
-4728822 restrict the objects dlsym() searches.
-	PSARC/2002/478 New dlopen(3dl) flag - RTLD_FIRST
-4714146 crle: 64-bit secure pathname is incorrect.
-4504895 dlclose() does not remove all objects
-4698800 Wrong comments in /usr/lib/ld/sparcv9/map.*
-4745129 dldump is inconsistent with .dynamic processing errors.
-4753066 LD_SIGNAL isn't very useful in a threaded environment
-	PSARC/2002/569 New dlinfo(3dl) flag - RTLD_DI_SIGNAL
-4765536 crle: symbolic links can confuse alternative object configuration info
-4766815 ld -r of object the TLS data fails
-4770484 elfdump can not handle stripped archive file
-4770494 The ld command gives improper error message handling broken archive
-4775738 overwriting output relocation table when 'ld -zignore' is used
-4778247 elfdump -e of core files fails
-4779976 elfdump dies on bad relocation entries
-4787579 invalid SHT_GROUP entries can cause linker to seg fault
-4783869 dlclose: filter closure exhibits hang/failure - introduced with 4504895
-4778418 ld.so.1: there be nits out there
-4792461 Thread-Local Storage - x86 instruction sequence updates
-	PSARC/2002/746 Thread-Local Storage - x86 instruction sequence updates
-4461340 sgs: ugly build output while suppressing ia64 (64-bit) build on Intel
-4790194 dlopen(..., RTLD_GROUP) has an odd interaction with interposition
-4804328 auditing of threaded applications results in deadlock
-4806476 building relocatable objects with SHF_EXCLUDE loses relocation
-	information
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-06
-	Solaris/SunOS 5.9_x86		patch T113986-02
-	Solaris/SunOS 5.8_sparc		patch T109147-22
-	Solaris/SunOS 5.8_x86		patch T109148-22
---------------------------------------------------------------------------------
-4731183 compiler creates .tlsbss section instead of .tbss as documented
-4816378 TLS: a tls test case dumps core with C and C++ compilers
-4817314 TLS_GD relocations against local symbols do not reference symbol...
-4811951 non-default symbol visibility overriden by definition in shared object
-4802194 relocation error of mozilla built by K2 compiler
-4715815 ld should allow linking with no output file (or /dev/null)
-4793721 Need a way to null all code in ISV objects enabling ld performance
-	tuning
---------------------------------------------------------------------------------
-All the above changes plus:
-	4796237 RFE: link-editor became extremely slow with patch 109147-20 and
-		static libraries
-are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-07
-	Solaris/SunOS 5.9_x86		patch T113986-03
-	Solaris/SunOS 5.8_sparc		patch T109147-23
-	Solaris/SunOS 5.8_x86		patch T109148-23
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 9 1203 (5th Q-update - s9u5)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4830584 mmap for the padding region doesn't get freed after dlclose
-4831650 ld.so.1 can walk off the end of it's call_init() array...
-4831544 ldd using .so modules compiled with FD7 compiler caused a core dump
-4834784 Accessing members in a TLS structure causes a core dump in Oracle
-4824026 segv when -z combreloc is used with -xlinkopt
-4825296 typo in elfdump
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-08
-	Solaris/SunOS 5.9_x86		patch T113986-04
-	Solaris/SunOS 5.8_sparc		patch T109147-24
-	Solaris/SunOS 5.8_x86		patch T109148-24
---------------------------------------------------------------------------------
-4470917 Solaris Process Model Unification (link-editor components only)
-	PSARC/2002/117 Solaris Process Model Unification
-4744411 Bloomberg wants a faster linker.
-4811969 64-bit links can be much slower than 32-bit.
-4825065 ld(1) should ignore consecutive empty sections.
-4838226 unrelocated shared objects may be erroneously collected for init firing
-4830889 TLS: testcase coredumps with -xarch=v9 and -g
-4845764 filter removal can leave dangling filtee pointer
-4811093 apptrace -F libc date core dumps
-4826315 Link editors need to be pre- and post- Unified Process Model aware
-4868300 interposing on direct bindings can fail
-4872634 Large LD_PRELOAD values can cause SEGV of process
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-09
-	Solaris/SunOS 5.9_x86		patch T113986-05
-	Solaris/SunOS 5.8_sparc		patch T109147-25
-	Solaris/SunOS 5.8_x86		patch T109148-25
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 9 404 (6th Q-update - s9u6)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4870260 The elfdump command should produce more warning message on invalid move
-	entries.
-4865418 empty PT_TLS program headers cause problems in TLS enabled applications
-4825151 compiler core dumped with a -mt -xF=%all test
-4845829 The runtime linker fails to dlopen() long path name.
-4900684 shared libraries with more then 32768 plt's fail for sparc ELF64
-4906062 Makefiles under usr/src/cmd/sgs needs to be updated
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-10
-	Solaris/SunOS 5.9_x86		patch T113986-06
-	Solaris/SunOS 5.8_sparc		patch T109147-26
-	Solaris/SunOS 5.8_x86		patch T109148-26
-	Solaris/SunOS 5.7_sparc		patch T106950-24
-	Solaris/SunOS 5.7_x86		patch T106951-24
---------------------------------------------------------------------------------
-4900320 rtld library mapping could be faster
-4911775 implement GOTDATA proposal in ld
-	PSARC/2003/477 SPARC GOTDATA instruction sequences
-4904565 Functionality to ignore relocations against external symbols
-4764817 add section types SHT_DEBUG and SHT_DEBUGSTR
-	PSARC/2003/510 New ELF DEBUG and ANNOTATE sections
-4850703 enable per-symbol direct bindings
-4716275 Help required in the link analysis of runtime interfaces
-	PSARC/2003/519 Link-editors: Direct Binding Updates
-4904573 elfdump may hang when processing archive files
-4918310 direct binding from an executable can't be interposed on
-4918938 ld.so.1 has become SPARC32PLUS - breaks 4.x binary compatibility
-4911796 S1S8 C++: ld dump core when compiled and linked with xlinkopt=1.
-4889914 ld crashes with SEGV using -M mapfile under certain conditions
-4911936 exception are not catch from shared library with -zignore
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-11
-	Solaris/SunOS 5.9_x86		patch T113986-07
-	Solaris/SunOS 5.8_sparc		patch T109147-27
-	Solaris/SunOS 5.8_x86		patch T109148-27
-	Solaris/SunOS 5.7_sparc		patch T106950-25
-	Solaris/SunOS 5.7_x86		patch T106951-25
---------------------------------------------------------------------------------
-4946992 ld crashes due to huge number of sections (>65,000)
-4951840 mcs -c goes into a loop on executable program
-4939869 Need additional relocation types for abs34 code model
-	PSARC/2003/684 abs34 ELF relocations
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-12
-	Solaris/SunOS 5.9_x86		patch T113986-08
-	Solaris/SunOS 5.8_sparc		patch T109147-28
-	Solaris/SunOS 5.8_x86		patch T109148-28
---------------------------------------------------------------------------------
-
-------------------------------------
-Solaris 9 904 (7th Q-update - s9u7)
-------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-4912214 Having multiple of libc.so.1 in a link map causes malloc() to fail
-4526878 ld.so.1 should pass MAP_ALIGN flag to give kernel more flexibility
-4930997 sgs bld_vernote.ksh script needs to be hardend...
-4796286 ld.so.1: scenario for trouble?
-4930985 clean up cruft under usr/src/cmd/sgs/tools
-4933300 remove references to Ultra-1 in librtld_db demo
-4936305 string table compression is much too slow...
-4939626 SUNWonld internal package must be updated...
-4939565 per-symbol filtering required
-4948119 ld(1) -z loadfltr fails with per-symbol filtering
-4948427 ld.so.1 gives fatal error when multiple RTLDINFO objects are loaded
-4940894 ld core dumps using "-xldscope=symbolic
-4955373 per-symbol filtering refinements
-4878827 crle(1M) - display post-UPM search paths, and compensate for pre-UPM.
-4955802 /usr/ccs/bin/ld dumps core in process_reld()
-4964415 elfdump issues wrong relocation error message
-4966465 LD_NOAUXFLTR fails when object is both a standard and auxiliary filter
-4973865 the link-editor does not scale properly when linking objects with
-	lots of syms
-4975598 SHT_SUNW_ANNOTATE section relocation not resolved
-4974828 nss_files nss_compat r_mt tests randomly segfaulting
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-13
-	Solaris/SunOS 5.9_x86		patch T113986-09
---------------------------------------------------------------------------------
-4860508 link-editors should create/promote/verify hardware capabilities
-5002160 crle: reservation for dumped objects gets confused by mmaped object
-4967869 linking stripped library causes segv in linker
-5006657 link-editor doesn't always handle nodirect binding syminfo information
-4915901 no way to see ELF information
-5021773 ld.so.1 has trouble with objects having more than 2 segments.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-14
-	Solaris/SunOS 5.9_x86		patch T113986-10
-	Solaris/SunOS 5.8_sparc		patch T109147-29
-	Solaris/SunOS 5.8_x86		patch T109148-29
---------------------------------------------------------------------------------
-All the above changes plus:
-	6850124 dlopen reports "No such file or directory" in spite of ENOMEM
-		when mmap fails in anon_map()
-are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch TXXXXXX-XX
-	Solaris/SunOS 5.9_x86		patch TXXXXXX-XX
---------------------------------------------------------------------------------
-
-----------
-Solaris 10
-----------
-Bugid   Risk Synopsis
-================================================================================
-5044797 ld.so.1: secure directory testing is being skipped during filtee
-	processing
-4963676 Remove remaining static libraries
-5021541 unnecessary PT_SUNWBSS segment may be created
-5031495 elfdump complains about bad symbol entries in core files
-5012172 Need error when creating shared object with .o compiled
-	-xarch=v9 -xcode=abs44
-4994738 rd_plt_resolution() resolves ebx-relative PLT entries incorrectly
-5023493 ld -m output with patch 109147-25 missing .o information
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-15
-	Solaris/SunOS 5.9_x86		patch T113986-11
-	Solaris/SunOS 5.8_sparc		patch T109147-30
-	Solaris/SunOS 5.8_x86		patch T109148-30
---------------------------------------------------------------------------------
-5071614 109147-29 & -30 break the build of on28-patch on Solaris 8 2/04
-5029830 crle: provide for optional alternative dependencies.
-5034652 ld.so.1 should save, and print, more error messages
-5036561 ld.so.1 outputs non-fatal fatal message about auxiliary filter libraries
-5042713 4866170 broke ld.so's ::setenv
-5047082 ld can core dump on bad gcc objects
-5047612 ld.so.1: secure pathname verification is flawed with filter use
-5047235 elfdump can core dump printing PT_INTERP section
-4798376 nits in demo code
-5041446 gelf_update_*() functions inconsistently return NULL or 0
-5032364 M_ID_TLSBSS and M_ID_UNKNOWN have the same value
-4707030 Empty LD_PRELOAD_64 doesn't override LD_PRELOAD
-4968618 symbolic linkage causes core dump
-5062313 dladdr() can cause deadlock in MT apps.
-5056867 $ISALIST/$HWCAP expansion should be more flexible.
-4918303 0@0.so.1 should not use compiler-supplied crt*.o files
-5058415 whocalls cannot take more than 10 arguments
-5067518 The fix for 4918303 breaks the build if a new work space is used.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-16
-	Solaris/SunOS 5.9_x86		patch T113986-12
-	Solaris/SunOS 5.8_sparc		patch T109147-31
-	Solaris/SunOS 5.8_x86		patch T109148-31
---------------------------------------------------------------------------------
-5013759 *file* should report hardware/software capabilities (link-editor
-	components only)
-5063580 libldstab: file /tmp/posto..: .stab[.index|.sbfocus] found with no
-	matching stri
-5076838 elfdump(1) is built with a CTF section (the wrong one)
-5080344 Hardware capabilities are not enforced for a.out
-5079061 RTLD_DEFAULT can be expensive
-	PSARC/2004/747 New dlsym(3c) Handle - RTLD_PROBE
-5064973 allow normal relocs against TLS symbols for some sections
-5085792 LD_XXXX_64 should override LD_XXXX
-5096272 every executable or library has a .SUNW_dof section
-5094135 Bloomberg wants a faster ldd.
-5086352 libld.so.3 should be built with a .SUNW_ctf ELF section, ready for CR
-5098205 elfdump gives wrong section name for the global offset table
-5092414 Linker patch 109147-29 makes Broadvison One-To-One server v4.1
-	installation fail
-5080256 dump(1) doesn't list ELF hardware capabilities
-5097347 recursive read lock in gelf_getsym()
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-17
-	Solaris/SunOS 5.9_x86		patch T113986-13
-	Solaris/SunOS 5.8_sparc		patch T109147-32
-	Solaris/SunOS 5.8_x86		patch T109148-32
---------------------------------------------------------------------------------
-5106206 ld.so.1 fail to run a Solaris9 program that has libc linked with
-	-z lazyload
-5102601 ON should deliver a 64-bit operating system for Opteron systems
-	(link-editor components only)
-6173852 enable link_auditing technology for amd64
-6174599 linker does not create .eh_frame_hdr sections for eh_frame sections
-	with SHF_LINK_ORDER
-6175609 amd64 run-time linker has a corrupted note section
-6175843 amd64 rdb_demo files not installed
-6182293 ld.so.1 can repeatedly relocate object .plts (RTLD_NOW).
-6183645 ld core dumps when automounter fails
-6178667 ldd list unexpected (file not found) in x86 environment.
-6181928 Need new reloc types R_AMD64_GOTOFF64 and R_AMD64_GOTPC32
-6182884 AMD64: ld coredumps when building a shared library
-6173559 The ld may set incorrect value for sh_addralign under some conditions.
-5105601 ld.so.1 gets a little too enthusiastic with interposition
-6189384 ld.so.1 should accommodate a files dev/inode change (libc loopback mnt)
-6177838 AMD64: linker cannot resolve PLT for 32-bit a.out(s) on amd64-S2 kernel
-6190863 sparc disassembly code should be removed from rdb_demo
-6191488 unwind eh_frame_hdr needs corrected encoding value
-6192490 moe(1) returns /lib/libc.so.1 for optimal expansion of libc HWCAP
-	libraries
-6192164 AMD64: introduce dlamd64getunwind interface
-	PSARC/2004/747 libc::dlamd64getunwind()
-6195030 libdl has bad version name
-6195521 64-bit moe(1) missed the train
-6198358 AMD64: bad eh_frame_hdr data when C and C++ mixed in a.out
-6204123 ld.so.1: symbol lookup fails even after lazy loading fallback
-6207495 UNIX98/UNIX03 vsx namespace violation DYNL.hdr/misc/dlfcn/T.dlfcn
-	14 Failed
-6217285 ctfmerge crashed during full onnv build
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 106 (1st Q-update - s10u1)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6209350 Do not include signature section from dynamic dependency library into
-	relocatable object
-6212797 The binary compiled on SunOS4.x doesn't run on Solaris8 with Patch
-	109147-31
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-18
-	Solaris/SunOS 5.9_x86		patch T113986-14
-	Solaris/SunOS 5.8_sparc		patch T109147-33
-	Solaris/SunOS 5.8_x86		patch T109148-33
---------------------------------------------------------------------------------
-6219538 112963-17: linker patch causes binary to dump core
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-01
-	Solaris/SunOS 5.10_x86		patch T118345-01
-	Solaris/SunOS 5.9_sparc		patch T112963-19
-	Solaris/SunOS 5.9_x86		patch T113986-15
-	Solaris/SunOS 5.8_sparc		patch T109147-34
-	Solaris/SunOS 5.8_x86		patch T109148-34
---------------------------------------------------------------------------------
-6257177 incremental builds of usr/src/cmd/sgs can fail...
-6219651 AMD64: Linker does not issue error for out of range R_AMD64_PC32
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-02
-	Solaris/SunOS 5.10_x86		patch T118345-02
-	Solaris/SunOS 5.9_sparc		patch T112963-20
-	Solaris/SunOS 5.9_x86		patch T113986-16
-	Solaris/SunOS 5.8_sparc		patch T109147-35
-	Solaris/SunOS 5.8_x86		patch T109148-35
-NOTE: The fix for 6219651 is only applicable for 5.10_x86 platform.
---------------------------------------------------------------------------------
-5080443 lazy loading failure doesn't clean up after itself (D)
-6226206 ld.so.1 failure when processing single segment hwcap filtee
-6228472 ld.so.1: link-map control list stacking can loose objects
-6235000 random packages not getting installed in snv_09 and snv_10 -
-	rtld/common/malloc.c Assertion
-6219317 Large page support is needed for mapping executables, libraries and
-	files (link-editor components only)
-6244897 ld.so.1 can't run apps from commandline
-6251798 moe(1) returns an internal assertion failure message in some
-	circumstances
-6251722 ld fails silently with exit 1 status when -z ignore passed
-6254364 ld won't build libgenunix.so with absolute relocations
-6215444 ld.so.1 caches "not there" lazy libraries, foils svc.startd(1M)'s logic
-6222525 dlsym(3C) trusts caller(), which may return wrong results with tail call
-	optimization
-6241995 warnings in sgs should be fixed (link-editor components only)
-6258834 direct binding availability should be verified at runtime
-6260361 lari shouldn't count a.out non-zero undefined entries as interesting
-6260780 ldd doesn't recognize LD_NOAUXFLTR
-6266261 Add ld(1) -Bnodirect support (D)
-6261990 invalid e_flags error could be a little more friendly
-6261803 lari(1) should find more events uninteresting (D)
-6267352 libld_malloc provides inadequate alignment
-6268693 SHN_SUNW_IGNORE symbols should be allowed to be mulitiply defined
-6262789 Infosys wants a faster linker
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-03
-	Solaris/SunOS 5.10_x86		patch T118345-03
-	Solaris/SunOS 5.9_sparc		patch T112963-21
-	Solaris/SunOS 5.9_x86		patch T113986-17
-	Solaris/SunOS 5.8_sparc		patch T109147-36
-	Solaris/SunOS 5.8_x86		patch T109148-36
---------------------------------------------------------------------------------
-6283601 The usr/src/cmd/sgs/packages/common/copyright contains old information
-	legally problematic
-6276905 dlinfo gives inconsistent results (relative vs absolute linkname) (D)
-	PSARC/2005/357 dlinfo(3c) RTLD_DI_ARGSINFO
-6284941 excessive link times with many groups/sections
-6280467 dlclose() unmaps shared library before library's _fini() has finished
-6291547 ld.so mishandles LD_AUDIT causing security problems.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-04
-	Solaris/SunOS 5.10_x86		patch T118345-04
-	Solaris/SunOS 5.9_sparc		patch T112963-22
-	Solaris/SunOS 5.9_x86		patch T113986-18
-	Solaris/SunOS 5.8_sparc		patch T109147-37
-	Solaris/SunOS 5.8_x86		patch T109148-37
---------------------------------------------------------------------------------
-6295971 UNIX98/UNIX03 *vsx* DYNL.hdr/misc/dlfcn/T.dlfcn 14 fails, auxv.h syntax
-	error
-6299525 .init order failure when processing cycles
-6273855 gcc and sgs/crle don't get along
-6273864 gcc and sgs/libld don't get along
-6273875 gcc and sgs/rtld don't get along
-6272563 gcc and amd64/krtld/doreloc.c don't get along
-6290157 gcc and sgs/librtld_db/rdb_demo don't get along
-6301218 Matlab dumps core on startup when running on 112963-22 (D)
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-06
-	Solaris/SunOS 5.10_x86		patch T118345-08
-	Solaris/SunOS 5.9_sparc		patch T112963-23
-	Solaris/SunOS 5.9_x86		patch T113986-19
-	Solaris/SunOS 5.8_sparc		patch T109147-38
-	Solaris/SunOS 5.8_x86		patch T109148-38
---------------------------------------------------------------------------------
-6314115 Checkpoint refuses to start, crashes on start, after application of
-	linker patch 112963-22
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-24
-	Solaris/SunOS 5.9_x86		patch T113986-20
-	Solaris/SunOS 5.8_sparc		patch T109147-39
-	Solaris/SunOS 5.8_x86		patch T109148-39
---------------------------------------------------------------------------------
-6318306 a dlsym() from a filter should be redirected to an associated filtee
-6318401 mis-aligned TLS variable
-6324019 ld.so.1: malloc alignment is insufficient for new compilers
-6324589 psh coredumps on x86 machines on snv_23
-6236594 AMD64: Linker needs to handle the new .lbss section (D)
-	PSARC 2005/514 AMD64 - large section support
-6314743 Linker: incorrect resolution for R_AMD64_GOTPC32
-6311865 Linker: x86 medium model; invalid ELF program header
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-07
-	Solaris/SunOS 5.10_x86		patch T118345-12
---------------------------------------------------------------------------------
-6309061 link_audit should use __asm__ with gcc
-6310736 gcc and sgs/libld don't get along on SPARC
-6329796 Memory leak with iconv_open/iconv_close with patch 109147-33
-6332983 s9 linker patches 112963-24/113986-20 causing cluster machines not
-	to boot
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T117461-08
-	Solaris/SunOS 5.10_x86		patch T121208-02
-	Solaris/SunOS 5.9_sparc		patch T112963-25
-	Solaris/SunOS 5.9_x86		patch T113986-21
-	Solaris/SunOS 5.8_sparc		patch T109147-40
-	Solaris/SunOS 5.8_x86		patch T109148-40
---------------------------------------------------------------------------------
-6445311 The sparc S8/S9/S10 linker patches which include the fix for the
-	CR6222525 are hit by the CR6439613.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-26
-	Solaris/SunOS 5.8_sparc		patch T109147-41
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 807 (4th Q-update - s10u4)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6487273 ld.so.1 may open arbitrary locale files when relative path is built
-	from locale environment vars
-6487284 ld.so.1: buffer overflow in doprf() function
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T124922-01
-	Solaris/SunOS 5.10_x86		patch T124923-01
-	Solaris/SunOS 5.9_sparc		patch T112963-27
-	Solaris/SunOS 5.9_x86		patch T113986-22
-	Solaris/SunOS 5.8_sparc		patch T109147-42
-	Solaris/SunOS 5.8_x86		patch T109148-41
---------------------------------------------------------------------------------
-6477132 ld.so.1: memory leak when running set*id application
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T124922-02
-	Solaris/SunOS 5.10_x86		patch T124923-02
-	Solaris/SunOS 5.9_sparc		patch T112963-30
-	Solaris/SunOS 5.9_x86		patch T113986-24
---------------------------------------------------------------------------------
-6340814 ld.so.1 core dump with HWCAP relocatable object + updated statistics
-6307274 crle bug with LD_LIBRARY_PATH
-6317969 elfheader limited to 65535 segments (link-editor components only)
-6350027 ld.so.1 aborts with assertion failed on amd64
-6362044 ld(1) inconsistencies with LD_DEBUG=-Dunused and -zignore
-6362047 ld.so.1 dumps core when combining HWCAP and LD_PROFILE
-6304206 runtime linker may respect LANG and LC_MESSAGE more than LC_ALL
-6363495 Catchup required with Intel relocations
-6326497 ld.so not properly processing LD_LIBRARY_PATH ending in :
-6307146 mcs dumps core when appending null string to comment section
-6371877 LD_PROFILE_64 with gprof does not produce correct results on amd64
-6372082 ld -r erroneously creates .got section on i386
-6201866 amd64: linker symbol elimination is broken
-6372620 printstack() segfaults when called from static function (D)
-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) (D)
-6316708 LD_DEBUG should provide a means of identifying/isolating individual
-        link-map lists (P)
-6280209 elfdump cores on memory model 0x3
-6197234 elfdump and dump don't handle 64-bit symbols correctly
-6398893 Extended section processing needs some work
-6397256 ldd dumps core in elf_fix_name
-6327926 ld does not set etext symbol correctly for AMD64 medium model (D)
-6390410 64-bit LD_PROFILE can fail: relocation error when binding profile plt
-6382945 AMD64-GCC: dbx: internal error: dwarf reference attribute out of bounds
-6262333 init section of .so dlopened from audit interface not being called
-6409613 elf_outsync() should fsync()
-6426048 C++ exceptions broken in Nevada for amd64
-6429418 ld.so.1: need work-around for Nvidia drivers use of static TLS
-6429504 crle(1) shows wrong defaults for non-existent 64-bit config file
-6431835 data corruption on x64 in 64-bit mode while LD_PROFILE is in effect
-6423051 static TLS support within the link-editors needs a major face lift (D)
-6388946 attempting to dlopen a .o file mislabeled as .so fails
-6446740 allow mapfile symbol definitions to create backing storage (D)
-4986360 linker crash on exec of .so (as opposed to a.out) -- error preferred
-	instead
-6229145 ld: initarray/finiarray processing occurs after got size is determined
-6324924 the linker should warn if there's a .init section but not _init
-6424132 elfdump inserts extra whitespace in bitmap value display
-6449485 ld(1) creates misaligned TLS in binary compiled with -xpg
-6424550 Write to unallocated (wua) errors when libraries are built with
-	-z lazyload
-6464235 executing the 64-bit ld(1) should be easy (D)
-6465623 need a way of building unix without an interpreter
-6467925 ld: section deletion (-z ignore) requires improvement
-6357230 specfiles should be nuked (link-editor components only)
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T124922-03
-	Solaris/SunOS 5.10_x86		patch T124923-03
-
-These patches also include the framework changes for the following bug fixes.
-However, the associated feature has not been enabled in Solaris 10 or earlier
-releases:
-
-6174390 crle configuration files are inconsistent across platforms (D, P)
-6432984 ld(1) output file removal - change default behavior (D)
-	PSARC/2006/353 ld(1) output file removal - change default behavior
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 508 (5th Q-update - s10u5)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6561987 data vac_conflict faults on lipthread libthread libs in s10.
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T127111-01
-	Solaris/SunOS 5.10_x86		patch T127112-01
---------------------------------------------------------------------------------
-6501793 GOTOP relocation transition (optimization) fails with offsets > 2^32
-6532924 AMD64: Solaris 5.11 55b: SEGV after whocatches
-6551627 OGL: SIGSEGV when trying to use OpenGL pipeline with splash screen,
-	Solaris/Nvidia only
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T127111-04
-	Solaris/SunOS 5.10_x86		patch T127112-04
---------------------------------------------------------------------------------
-6479848 Enhancements to the linker support interface needed. (D)
-	PSARC/2006/595 link-editor support library interface - ld_open()
-6521608 assertion failure in runtime linker related to auditing
-6494228 pclose() error when an audit library calls popen() and the main target
-	is being run under ldd (D)
-6568745 segfault when using LD_DEBUG with bit_audit library when instrumenting
-	mozilla (D)
-	PSARC/2007/413 Add -zglobalaudit option to ld
-6602294 ps_pbrandname breaks apps linked directly against librtld_db
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T127111-07
-	Solaris/SunOS 5.10_x86		patch T127112-07
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 908 (6th Q-update - s10u6)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6672544 elf_rtbndr must support non-ABI aligned stacks on amd64
-6668050 First trip through PLT does not preserve args in xmm registers
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patch:
-	Solaris/SunOS 5.10_x86		patch T137138-01
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 409 (7th Q-update - s10u7)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6629404 ld with -z ignore doesn't scale
-6606203 link editor ought to allow creation of >2gb sized objects (P)
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T139574-01
-	Solaris/SunOS 5.10_x86		patch T139575-01
---------------------------------------------------------------------------------
-6746674 setuid applications do not find libraries any more because trusted
-	directories behavior changed (D)
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T139574-02
-	Solaris/SunOS 5.10_x86		patch T139575-02
---------------------------------------------------------------------------------
-6703683 Can't build VirtualBox on Build 88 or 89
-6737579 process_req_lib() in libld consumes file descriptors
-6685125 ld/elfdump do not handle ZERO terminator .eh_frame amd64 unwind entry
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T139574-03
-	Solaris/SunOS 5.10_x86		patch T139575-03
---------------------------------------------------------------------------------
-
--------------------------------------
-Solaris 10 1009 (8th Q-update - s10u8)
--------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6782597 32-bit ld.so.1 needs to accept objects with large inode number
-6805502 The addition of "inline" keywords to sgs code broke the lint
-	verification in S10
-6807864 ld.so.1 is susceptible to a fatal dlsym()/setlocale() race
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T141692-01
-	Solaris/SunOS 5.10_x86		patch T141693-01
-NOTE: The fix for 6805502 is only applicable to s10.
---------------------------------------------------------------------------------
-6826410 ld needs to sort sections using 32-bit sort keys
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T141771-01
-	Solaris/SunOS 5.10_x86		patch T141772-01
-NOTE: The fix for 6826410 is also available for s9 in the following patches:
-	Solaris/SunOS 5.9_sparc		patch T112963-33
-	Solaris/SunOS 5.9_x86		patch T113986-27
---------------------------------------------------------------------------------
-6568447 bcp is broken by 6551627
-6599700 librtld_db needs better plugin support
-6713830 mdb dumped core reading a gcore
-6756048 rd_loadobj_iter() should always invoke brand plugin callback
-6786744 32-bit dbx failed with unknown rtld_db.so error on snv_104
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T141444-06
-	Solaris/SunOS 5.10_x86		patch T141445-06
---------------------------------------------------------------------------------
-
---------------------------------------
-Solaris 10 1005 (9th Q-update - s10u9)
---------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6850124 dlopen reports "No such file or directory" in spite of ENOMEM
-	when mmap fails in anon_map()
-6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
-6684577 ld should propagate SHF_LINK_ORDER flag to ET_REL objects
-6524709 executables using /usr/lib/libc.so.1 as the ELF interpreter dump core
-	(link-editor components only)
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch T143895-01
-	Solaris/SunOS 5.10_x86		patch T143896-01
---------------------------------------------------------------------------------
-
-----------------------------------------
-Solaris 10 XXXX (10th Q-update - s10u10)
-----------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6478684 isainfo/cpuid reports pause instruction not supported on amd64
-	PSARC/2010/089 Removal of AV_386_PAUSE and AV_386_MON
---------------------------------------------------------------------------------
-All the above changes are incorporated in the following patches:
-	Solaris/SunOS 5.10_sparc	patch TXXXXXX-XX
-	Solaris/SunOS 5.10_x86		patch TXXXXXX-XX
---------------------------------------------------------------------------------
-
---------------------------------------------
-Solaris Nevada (OpenSolaris 2008.05, snv_86)
---------------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6409350 BrandZ project integration into Solaris (link-editor components only)
-6459189 UNIX03: *VSC* c99 compiler overwrites non-writable file
-6423746 add an option to relax the resolution of COMDAT relocs (D)
-4934427 runtime linker should load up static symbol names visible to
-	dladdr() (D)
-	PSARC 2006/526 SHT_SUNW_LDYNSYM - default local symbol addition
-6448719 sys/elf.h could be updated with additional machine and ABI types
-6336605 link-editors need to support R_*_SIZE relocations
-	PSARC/2006/558 R_*_SIZE relocation support
-6475375 symbol search optimization to reduce rescans
-6475497 elfdump(1) is misreporting sh_link
-6482058 lari(1) could be faster, and handle per-symbol filters better
-6482974 defining virtual address of text segment can result in an invalid data
-	segment
-6476734 crle(1m) "-l" as described fails system, crle cores trying to fix
-	/a/var/ld/ld.config in failsafe
-6487499 link_audit "make clobber" creates and populates proto area
-6488141 ld(1) should detect attempt to reference 0-length .bss section
-6496718 restricted visibility symbol references should trigger archive
-	extraction
-6515970 HWCAP processing doesn't clean up fmap structure - browser fails to
-	run java applet
-6494214 Refinements to symbolic binding, symbol declarations and
-	interposition (D)
-	PSARC/2006/714 ld(1) mapfile: symbol interpose definition
-6475344 DTrace needs ELF function and data symbols sorted by address (D)
-	PSARC/2007/026 ELF symbol sort sections
-6518480 ld -melf_i386 doesn't complain (D)
-6519951 bfu is just another word for exit today (RPATH -> RUNPATH conversion
-	bites us) (D)
-6521504 ld: hardware capabilities processing from relocatables objects needs
-	hardening.
-6518322 Some ELF utilities need updating for .SUNW_ldynsym section (D)
-	PSARC/2007/074 -L option for nm(1) to display SHT_SUNW_LDYNSYM symbols
-6523787 dlopen() handle gets mistakenly orphaned - results in access to freed
-	memory
-6531189 SEGV in dladdr()
-6527318 dlopen(name, RTLD_NOLOAD) returns handle for unloaded library
-6518359 extern mapfiles references to _init/_fini can create INIT/FINI
-	addresses of 0
-6533587 ld.so.1: init/fini processing needs to compensate for interposer
-	expectations
-6516118 Reserved space needed in ELF dynamic section and string table (D)
-	PSARC/2007/127 Reserved space for editing ELF dynamic sections
-6535688 elfdump could be more robust in the face of Purify (D)
-6516665 The link-editors should be more resilient against gcc's symbol
-	versioning
-6541004 hwcap filter processing can leak memory
-5108874 elfdump SEGVs on bad object file
-6547441 Uninitialized variable causes ld.so.1 to crash on object cleanup
-6341667 elfdump should check alignments of ELF header elements
-6387860 elfdump cores, when processing linux built ELF file
-6198202 mcs -d dumps core
-6246083 elfdump should allow section index specification
-	(numeric -N equivalent) (D)
-	PSARC/2007/247 Add -I option to elfdump
-6556563 elfdump section overlap checking is too slow for large files
-5006034 need ?E mapfile feature extension (D)
-6565476 rtld symbol version check prevents GNU ld binary from running
-6567670 ld(1) symbol size/section size verification uncovers Haskell
-	compiler inconsistency
-6530249 elfdump should handle ELF files with no section header table (D)
-	PSARC/2007/395 Add -P option to elfdump
-6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
-6577462 Additional improvements needed to handling of gcc's symbol versioning
-6583742 ELF string conversion library needs to lose static writable buffers
-6589819 ld generated reference to __tls_get_addr() fails when resolving to a
-	shared object reference
-6595139 various applications should export yy* global variables for libl
-	PSARC/2007/474 new ldd(1) -w option
-6597841 gelf_getdyn() reads one too many dynamic entries
-6603313 dlclose() can fail to unload objects after fix for 6573641
-6234471 need a way to edit ELF objects (D)
-	PSARC/2007/509 elfedit
-5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
-6473571 strip and mcs get confused and corrupt files when passed
-	non-ELF arguments
-6253589 mcs has problems handling multiple SHT_NOTE sections
-6610591 do_reloc() should not require unused arguments
-6602451 new symbol visibilities required: EXPORTED, SINGLETON and ELIMINATE (D)
-	PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and
-	ELIMINATE
-6570616 elfdump should display incorrectly aligned note section
-6614968 elfedit needs string table module (D)
-6620533 HWCAP filtering can leave uninitialized data behind - results in
-	"rejected: Invalid argument"
-6617855 nodirect tag can be ignored when other syminfo tags are available
-	(link-editor components only)
-6621066 Reduce need for new elfdump options with every section type (D)
-	PSARC/2007/620 elfdump -T, and simplified matching
-6627765 soffice failure after integration of 6603313 - dangling GROUP pointer.
-6319025 SUNWbtool packaging issues in Nevada and S10u1.
-6626135 elfedit capabilities str->value mapping should come from
-	usr/src/common/elfcap
-6642769 ld(1) -z combreloc should become default behavior (D)
-	PSARC/2008/006 make ld(1) -z combreloc become default behavior
-6634436 XFFLAG should be updated.  (link-editor components only)
-6492726 Merge SHF_MERGE|SHF_STRINGS input sections (D)
-4947191 OSNet should use direct bindings  (link-editor components only)
-6654381 lazy loading fall-back needs optimizing
-6658385 ld core dumps when building Xorg on nv_82
-6516808 ld.so.1's token expansion provides no escape for platforms that don't
-	report HWCAP
-6668534 Direct bindings can compromise function address comparisons from
-	executables
-6667661 Direct bindings can compromise executables with insufficient copy
-	relocation information
-6357282 ldd should recognize PARENT and EXTERN symbols (D)
-	PSARC/2008/148 new ldd(1) -p option
-6672394 ldd(1) unused dependency processing is tricked by relocations errors
---------------------------------------------------------------------------------
-
----------------------------------------------
-Solaris Nevada (OpenSolaris 2008.11, snv_101)
----------------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-6671255 link-editor should support cross linking (D)
-	PSARC/2008/179 cross link-editor
-6674666 elfedit dyn:posflag1 needs option to locate element via NEEDED item
-6675591 elfwrap - wrap data in an ELF file (D,P)
-	PSARC/2008/198 elfwrap - wrap data in an ELF file
-6678244 elfdump dynamic section sanity checking needs refinement
-6679212 sgs use of SCCS id for versioning is obstacle to mercurial migration
-6681761 lies, darn lies, and linker README files
-6509323 Need to disable the Multiple Files loading - same name, different
-	directories (or its stat() use)
-6686889 ld.so.1 regression - bad pointer created with 6509323 integration
-6695681 ldd(1) crashes when run from a chrooted environment
-6516212 usr/src/cmd/sgs/libelf warlock targets should be fixed or abandoned
-6678310 using LD_AUDIT, ld.so.1 calls shared library's .init before library is
-	fully relocated (link-editor components only)
-6699594 The ld command has a problem handling 'protected' mapfile keyword.
-6699131 elfdump should display core file notes (D)
-6702260 single threading .init/.fini sections breaks staroffice
-6703919 boot hangs intermittently on x86 with onnv daily.0430 and on
-6701798 ld can enter infinite loop processing bad mapfile
-6706401 direct binding copy relocation fallback is insufficient for ild
-	generated objects
-6705846 multithreaded C++ application seems to get deadlocked in the dynamic
-	linker code
-6686343 ldd(1) - unused search path diagnosis should be enabled
-6712292 ld.so.1 should fall back to an interposer for failed direct bindings
-6716350 usr/src/cmd/sgs should be linted by nightly builds
-6720509 usr/src/cmd/sgs/sgsdemangler should be removed
-6617475 gas creates erroneous FILE symbols [was: ld.so.1 is reported as
-	false positive by wsdiff]
-6724311 dldump() mishandles R_AMD64_JUMP_SLOT relocations
-6724774 elfdump -n doesn't print siginfo structure
-6728555 Fix for amd64 aw (6617475) breaks pure gcc builds
-6734598 ld(1) archive processing failure due to mismatched file descriptors (D)
-6735939 ld(1) discarded symbol relocations errors (Studio and GNU).
-6354160 Solaris linker includes more than one copy of code in binary when
-	linking gnu object code
-6744003 ld(1) could provide better argument processing diagnostics (D)
-	PSARC 2008/583 add gld options to ld(1)
-6749055 ld should generate GNU style VERSYM indexes for VERNEED records (D)
-	PSARC/2008/603 ELF objects to adopt GNU-style Versym indexes
-6752728 link-editor can enter UNDEF symbols in symbol sort sections
-6756472 AOUT search path pruning (D)
---------------------------------------------------------------------------------
-
----------------------------------------------
-Solaris Nevada (OpenSolaris 2009.06, snv_111)
----------------------------------------------
-Bugid   Risk Synopsis
-================================================================================
-
-6754965 introduce the SF1_SUNW_ADDR32 bit in software capabilities (D)
-	(link-editor components only)
-	PSARC/2008/622 32-bit Address Restriction Software Capabilities Flag
-6756953 customer requests that DT_CONFIG strings be honored for secure apps (D)
-6765299 ld --version-script option not compatible with GNU ld (D)
-6748160 problem with -zrescan (D)
-	PSARC/2008/651 New ld archive rescan options
-6763342 sloppy relocations need to get sloppier
-6736890 PT_SUNWBSS should be disabled (D)
-	PSARC/2008/715 PT_SUNWBSS removal
-6772661 ldd/lddstub/ld.so.1 dump core in current nightly while processing
-	libsoftcrypto_hwcap.so.1
-6765931 mcs generates unlink(NULL) system calls
-6775062 remove /usr/lib/libldstab.so (D)
-6782977 ld segfaults after support lib version error sends bad args to vprintf()
-6773695 ld -z nopartial can break non-pic objects
-6778453 RTLD_GROUP prevents use of application defined malloc
-6789925 64-bit applications with SF1_SUNW_ADDR32 require non-default starting
-	address
-6792906 ld -z nopartial fix breaks TLS
-6686372 ld.so.1 should use mmapobj(2)
-6726108 dlopen() performance could be improved.
-6792836 ld is slow when processing GNU linkonce sections
-6797468 ld.so.1: orphaned handles aren't processed correctly
-6798676 ld.so.1: enters infinite loop with realloc/defragmentation logic
-6237063 request extension to dl* family to provide segment bounds
-	information (D)
-	PSARC/2009/054 dlinfo(3c) - segment mapping retrieval
-6800388 shstrtab can be sized incorrectly when -z ignore is used
-6805009 ld.so.1: link map control list tear down leaves dangling pointer -
-	pfinstall does it again.
-6807050 GNU linkonce sections can create duplicate and incompatible
-	eh_frame FDE entries
---------------------------------------------------------------------------------
-
---------------
-Solaris Nevada
---------------
-Bugid   Risk Synopsis
-================================================================================
-6813909 generalize eh_frame support to non-amd64 platforms
-6801536 ld: mapfile processing oddities unveiled through mmapobj(2) observations
-6802452 libelf shouldn't use MS_SYNC
-6818012 nm tries to modify readonly segment and dumps core
-6821646 xVM dom0 doesn't boot on daily.0324 and beyond
-6822828 librtld_db can return RD_ERR before RD_NOMAPS, which compromises dbx
-	expectations.
-6821619 Solaris linkers need systematic approach to ELF OSABI (D)
-	PSARC/2009/196 ELF objects to set OSABI / elfdump -O option
-6827468 6801536 breaks 'ld -s' if there are weak/strong symbol pairs
-6715578 AOUT (BCP) symbol lookup can be compromised with lazy loading.
-6752883 ld.so.1 error message should be buffered (not sent to stderr).
-6577982 ld.so.1 calls getpid() before it should when any LD_* are set
-6831285 linker LD_DEBUG support needs improvements (D)
-6806791 filter builds could be optimized (link-editor components only)
-6823371 calloc() uses suboptimal memset() causing 15% regression in SpecCPU2006
-	gcc code (link-editor components only)
-6831308 ld.so.1: symbol rescanning does a little too much work
-6837777 ld ordered section code uses too much memory and works too hard
-6841199 Undo 10 year old workaround and use 64-bit ld on 32-bit objects
-6784790 ld should examine archives to determine output object class/machine (D)
-	PSARC/2009/305 ld -32 option
-6849998 remove undocumented mapfile $SPECVERS and $NEED options
-6851224 elf_getshnum() and elf_getshstrndx() incompatible with 2002 ELF gABI
-	agreement (D)
-	PSARC/2009/363 replace elf_getphnum, elf_getshnum, and elf_getshstrndx
-6853809 ld.so.1: rescan fallback optimization is invalid
-6854158 ld.so.1: interposition can be skipped because of incorrect
-	caller/destination validation
-6862967 rd_loadobj_iter() failing for core files
-6856173 streams core dumps when compiled in 64bit with a very large static
-	array size
-6834197 ld pukes when given an empty plate
-6516644 per-symbol filtering shouldn't be allowed in executables
-6878605 ld should accept '%' syntax when matching input SHT_PROGBITS sections
-6850768 ld option to autogenerate wrappers/interposers similar to GNU ld
-	--wrap (D)
-	PSARC/2009/493 ld -z wrap option
-6888489 Null environment variables are not overriding crle(1) replaceable
-	environment variables.
-6885456 Need to implement GNU-ld behavior in construction of .init/.fini
-	sections
-6900241 ld should track SHT_GROUP sections by symbol name, not section name
-6901773 Special handling of STT_SECTION group signature symbol for GNU objects
-6901895 Failing asserts in ld update_osym() trying to build gcc 4.5 develpment
-	head
-6909523 core dump when run "LD_DEBUG=help ls" in non-English locale
-6903688 mdb(1) can't resolve certain symbols in solaris10-branded processes
-	from the global zone
-6923449 elfdump misinterprets _init/_fini symbols in dynamic section test
-6914728 Add dl_iterate_phdr() function to ld.so.1 (D)
-	PSARC/2010/015 dl_iterate_phdr
-6916788 ld version 2 mapfile syntax (D)
-	PSARC/2009/688 Human readable and extensible ld mapfile syntax
-6929607 ld generates incorrect VERDEF entries for ET_REL output objects
-6924224 linker should ignore SUNW_dof when calculating the elf checksum
-6918143 symbol capabilities (D)
-	PSARC/2010/022 Linker-editors: Symbol Capabilities
-6910387 .tdata and .tbss separation invalidates TLS program header information
-6934123 elfdump -d coredumps on PA-RISC elf
-6931044 ld should not allow SHT_PROGBITS .eh_frame sections on amd64 (D)
-6931056 pvs -r output can include empty versions in output
-6938628 ld.so.1 should produce diagnostics for all dl*() entry points
-6938111 nm `No symbol table data' message goes to stdout
-6941727 ld relocation cache memory use is excessive
-6932220 ld -z allextract skips objects that lack global symbols
-6943772 Testing for a symbols existence with RTLD_PROBE is compromised by
-	RTLD_BIND_NOW
-	PSARC/2010/XXX Deferred symbol references
-6943432 dlsym(RTLD_PROBE) should only bind to symbol definitions
-6668759 an external method for determining whether an ELF dependency is optional
-6954032 Support library with ld_open and -z allextract in snv_139 do not mix
-6949596 wrong section alignment generated in joint compilation with shared
-	library
-6961755 ld.so.1's -e arguments should take precedence over environment
-	variables. (D)
-6748925 moe returns wrong hwcap library in some circumstances
-6916796 OSnet mapfiles should use version 2 link-editor syntax
-6964517 OSnet mapfiles should use version 2 link-editor syntax (2nd pass)
-6948720 SHT_INIT_ARRAY etc. section names don't follow ELF gABI (D)
-6962343 sgsmsg should use mkstemp() for temporary file creation
-6965723 libsoftcrypto symbol capabilities rely on compiler generated
-	capabilities - gcc failure (link-editor components only)
-6952219 ld support for archives larger than 2 GB (D, P)
-	PSARC/2010/224 Support for archives larger than 2 GB
-6956152 dlclose() from an auditor can be fatal. Preinit/activity events should
-	be more flexible. (D)
-6971440 moe can core dump while processing libc.
-6972234 sgs demo's could use some cleanup
-6935867 .dynamic could be readonly in sharable objects
-6975290 ld mishandles GOT relocation against local ABS symbol
-6972860 ld should provide user guidance to improve objects (D)
-	PSARC/2010/312 Link-editor guidance
---------------------------------------------------------------------------------
-
---------------
-Illumos
---------------
-Bugid   Risk Synopsis
-================================================================================
-
-308     ld may misalign sections only preceded by empty sections
-1301	ld crashes with '-z ignore' due to a null data descriptor
-1626	libld may accidentally return success while failing
-2413	%ymm* need to be preserved on way through PLT
-3210	ld should tolerate SHT_PROGBITS for .eh_frame sections on amd64
-3228	Want -zassert-deflib for ld
-3230	ld.so.1 should check default paths for DT_DEPAUDIT
-3260	linker is insufficiently careful with strtok
-3261	linker should ignore unknown hardware capabilities
-3265	link-editor builds bogus .eh_frame_hdr on ia32
-3453	GNU comdat redirection does exactly the wrong thing
-3439	discarded sections shouldn't end up on output lists
-3436	relocatable objects also need sloppy relocation
-3451	archive libraries with no symbols shouldn't require a string table
-3616	SHF_GROUP sections should not be discarded via other COMDAT mechanisms
-3709	need sloppy relocation for GNU .debug_macro
-3722	link-editor is over restrictive of R_AMD64_32 addends
-3926	multiple extern map file definitions corrupt symbol table entry
-3999	libld extended section handling is broken
-4003	dldump() can't deal with extended sections
-4227	ld --library-path is translated to -l-path, not -L
-4270	ld(1) argument error reporting is still pretty bad
-4383	libelf can't write extended sections when ELF_F_LAYOUT
-4959	completely discarded merged string sections will corrupt output objects
-4996	rtld _init race leads to incorrect symbol values
-5688	ELF tools need to be more careful with dwarf data
-6098	ld(1) should not require symbols which identify group sections be global
-6252	ld should merge function/data-sections in the same manner as GNU ld
-7323	ld(1) -zignore can erroneously discard init and fini arrays as unreferenced
-7594	ld -zaslr should accept Solaris-compatible values
-8616	ld has trouble parsing -z options specified with -Wl
-10267	ld and GCC disagree about i386 local dynamic TLS
-10471	ld(1) amd64 LD->LE TLS transition causes memory corruption
-10346	ld(1) should not reduce symbol visibility of COMDAT symbols when
-	producing relocatable objects
-10366	ld(1) should support GNU-style linker sets
-10581	ld(1) should know kernel modules are a thing
-11057	hidden undefined weak symbols should not leave relocations
-11067	debug statistics crash ld(1) when -z allextract
--- /dev/null	2019-07-14 19:12:26.000000000 +0000
+++ new/usr/src/cmd/sgs/tools/SUNWonld-README	2019-07-14 19:12:32.970973501 +0000
@@ -0,0 +1,1671 @@
+#
+# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+#
+# Note: The contents of this file are used to determine the versioning
+#	information for the SGS toolset. The number of CRs listed in
+#	this file must grow monotonically, or the SGS version will
+#	move backwards, causing a great deal of confusion. As such,
+#	CRs must never be removed from this file. See
+#	libconv/common/bld_vernote.ksh, and bug#4519569 for more
+#	details on SGS versioning.
+#
+--------------------------------------------------------------------------------
+SUNWonld - link-editors development package.
+--------------------------------------------------------------------------------
+
+  The SUNWonld package is an internal development package containing the
+  link-editors and some related tools.  All components live in the OSNET
+  source base, but not all components are delivered as part of the normal
+  OSNET consolidation.  The intent of this package is to provide access
+  to new features/bugfixes before they become generally available.
+
+  General link-editor information can be found:
+
+    http://linkers.central/
+    http://linkers.sfbay/	(also known as linkers.eng)
+
+  Comments and Questions:
+
+    Contact Rod Evans, Ali Bahrami, and/or Seizo Sakurai.
+
+  Warnings:
+
+    The postremove script for this package employs /usr/sbin/static/mv,
+    and thus, besides the common core dependencies, this package also
+    has a dependency on the SUNWsutl package.
+
+  Patches:
+
+    If the patch has been made official, you'll find it in:
+
+	http://sunsolve.east/cgi/show.pl?target=patches/os-patches
+
+    If it hasn't been released, the patch will be in:
+
+	/net/sunsoftpatch/patches/temporary
+
+    Note, any patches logged here refer to the temporary ("T") name, as we
+    never know when they're made official, and although we try to keep all
+    patch information up-to-date the real status of any patch can be
+    determined from:
+
+	http://sunsoftpatch.eng
+
+    If it has been obsoleted, the patch will be in:
+
+        /net/on${RELEASE}-patch/on${RELEASE}/patches/${MACH}/obsolete
+
+
+  History:
+
+    Note, starting after Solaris 10, letter codes in parenthesis may
+    be found following the bug synopsis. Their meanings are as follows:
+
+	(D) A documentation change accompanies the implementation change.
+	(P) A packaging change accompanies the implementation change.
+
+    In all cases, see the implementation bug report for details.
+
+    The following bug fixes exist in the OSNET consolidation workspace
+    from which this package is created:
+
+---------
+Solaris 8
+---------
+Bugid   Risk Synopsis
+================================================================================
+4225937 i386 linker emits sparc specific warning messages
+4215164 shf_order flag handling broken by fix for 4194028.
+4215587 using ld and the -r option on solaris 7 with compiler option -xarch=v9
+	causes link errors.
+4234657 103627-08 breaks purify 4.2 (plt padding should not be enabled for
+	32-bit)
+4235241 dbx no longer gets dlclose notification.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-05  (never released)
+	Solaris/SunOS 5.7_x86		patch 106951-05  (never released)
+	Solaris/SunOS 5.6_sparc		patch 107733-02  (never released)
+	Solaris/SunOS 5.6_x86		patch 107734-02
+--------------------------------------------------------------------------------
+4248290 inetd dumps core upon bootup - failure in dlclose() logic.
+4238071 dlopen() leaks while descriptors under low memory conditions
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-06
+	Solaris/SunOS 5.7_x86		patch 106951-06
+	Solaris/SunOS 5.6_sparc		patch 107733-03  (never released)
+	Solaris/SunOS 5.6_x86		patch 107734-03
+--------------------------------------------------------------------------------
+4267980 INITFIRST flag of the shard object could be ignored.
+--------------------------------------------------------------------------------
+All the above changes plus:
+    4238973 fix for 4121152 affects linking of Ada objects
+    4158744 patch 103627-02 causes core when RPATH has blank entry and
+	    dlopen/dlclose is used
+are incorporated in the following patches:
+	Solaris/SunOS 5.5.1_sparc	patch 103627-12  (never released)
+	Solaris/SunOS 5.5.1_x86		patch 103628-11
+--------------------------------------------------------------------------------
+4256518 miscalculated calloc() during dlclose/tsorting can result in segv
+4254171 DT_SPARC_REGISTER has invalid value associated with it.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-07
+	Solaris/SunOS 5.7_x86		patch 106951-07
+	Solaris/SunOS 5.6_sparc		patch 107733-04  (never released)
+	Solaris/SunOS 5.6_x86		patch 107734-04
+--------------------------------------------------------------------------------
+4293159 ld needs to combine sections with and without SHF_ORDERED flag(comdat)
+4292238 linking a library which has a static char ptr invokes mprotect() call
+--------------------------------------------------------------------------------
+All the above changes except for:
+    4256518 miscalculated calloc() during dlclose/tsorting can result in segv
+    4254171 DT_SPARC_REGISTER has invalid value associated with it.
+plus:
+    4238973 fix for 4121152 affects linking of Ada objects
+    4158744 patch 103627-02 causes core when RPATH has blank entry and
+	    dlopen/dlclose is used
+are incorporated in the following patches:
+	Solaris/SunOS 5.5.1_sparc	patch 103627-13
+	Solaris/SunOS 5.5.1_x86		patch 103628-12
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-08
+	Solaris/SunOS 5.7_x86		patch 106951-08
+	Solaris/SunOS 5.6_sparc		patch 107733-05
+	Solaris/SunOS 5.6_x86		patch 107734-05
+--------------------------------------------------------------------------------
+4295613 COMMON symbol resolution can be incorrect
+--------------------------------------------------------------------------------
+All the above changes plus:
+    4238973 fix for 4121152 affects linking of Ada objects
+    4158744 patch 103627-02 causes core when RPATH has blank entry and
+	    dlopen/dlclose is used
+are incorporated in the following patches:
+	Solaris/SunOS 5.5.1_sparc	patch 103627-14
+	Solaris/SunOS 5.5.1_x86		patch 103628-13
+--------------------------------------------------------------------------------
+All the above changes plus:
+    4351197 nfs performance problem by 103627-13
+are incorporated in the following patches:
+	Solaris/SunOS 5.5.1_sparc	patch 103627-15
+	Solaris/SunOS 5.5.1_x86		patch 103628-14
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-09
+	Solaris/SunOS 5.7_x86		patch 106951-09
+	Solaris/SunOS 5.6_sparc		patch 107733-06
+	Solaris/SunOS 5.6_x86		patch 107734-06
+--------------------------------------------------------------------------------
+4158971 increase the default segment alignment for i386 to 64k
+4064994 Add an $ISALIST token to those understood by the dynamic linker
+xxxxxxx ia64 common code putback
+4239308 LD_DEBUG busted for sparc machines
+4239008 Support MAP_ANON
+4238494 link-auditing extensions required
+4232239 R_SPARC_LOX10 truncates field
+4231722 R_SPARC_UA* relocations are busted
+4235514 R_SPARC_OLO10 relocation fails
+4244025 sgsmsg update
+4239281 need to support SECREL relocations for ia64
+4253751 ia64 linker must support PT_IA_64_UNWIND tables
+4259254 dlmopen mistakenly closes fd 0 (stdin) under certain error conditions
+4260872 libelf hangs when libthread present
+4224569 linker core dumping when profiling specified
+4270937 need mechanism to suppress ld.so.1's use of a default search path.
+1050476 ld.so to permit configuration of search path
+4273654 filtee processing using $ISALIST could be optimized
+4271860 get MERCED cruft out of elf.h
+4248991 Dynamic loader (via PLT) corrupts register G4
+4275754 cannot mmap file: Resource temporarily unavailable
+4277689 The linker can not handle relocation against MOVE tabl
+4270766 atexit processing required on dlclose().
+4279229 Add a "release" token to those understood by the dynamic linker
+4215433 ld can bus error when insufficient disc space exists for output file
+4285571 Pssst, want some free disk space?  ld's miscalculating.
+4286236 ar gives confusing "bad format" error with a null .stab section
+4286838 ld.so.1 can't handle a no-bits segment
+4287364 ld.so.1 runtime configuration cleanup
+4289573 disable linking of ia64 binaries for Solaris8
+4293966 crle(1)'s default directories should be supplied
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 8 600 (1st Q-update - s28u1)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4309212 dlsym can't find symbol
+4311226 rejection of preloading in secure apps is inconsistent
+4312449 dlclose: invalid deletion of dependency can occur using RTLD_GLOBAL
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-01
+	Solaris/SunOS 5.8_x86		patch 109148-01
+	Solaris/SunOS 5.7_sparc		patch 106950-10
+	Solaris/SunOS 5.7_x86		patch 106951-10
+	Solaris/SunOS 5.6_sparc		patch 107733-07
+	Solaris/SunOS 5.6_x86		patch 107734-07
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 8 900 (2nd Q-update - s28u2)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4324775 non-PIC code & -zcombreloc don't mix very well...
+4327653 run-time linker should preload tables it will process (madvise)
+4324324 shared object code can be referenced before .init has fired
+4321634 .init firing of multiple INITFIRST objects can fail
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-03
+	Solaris/SunOS 5.8_x86		patch 109148-03
+	Solaris/SunOS 5.7_sparc		patch 106950-11
+	Solaris/SunOS 5.7_x86		patch 106951-11
+	Solaris/SunOS 5.6_sparc		patch 107733-08
+	Solaris/SunOS 5.6_x86		patch 107734-08
+--------------------------------------------------------------------------------
+4338812 crle(1) omits entries in the directory cache
+4341496 RFE: provide a static version of /usr/bin/crle
+4340878 rtld should treat $ORIGIN like LD_LIBRARY_PATH in security issues
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-04
+	Solaris/SunOS 5.8_x86		patch 109148-04
+	Solaris/SunOS 5.7_sparc		patch 106950-12
+	Solaris/SunOS 5.7_x86		patch 106951-12
+--------------------------------------------------------------------------------
+4349563 auxiliary filter error handling regression introduced in 4165487
+4355795 ldd -r now gives "displacement relocated" warnings
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.7_sparc		patch 106950-13
+	Solaris/SunOS 5.7_x86		patch 106951-13
+	Solaris/SunOS 5.6_sparc		patch 107733-09
+	Solaris/SunOS 5.6_x86		patch 107734-09
+--------------------------------------------------------------------------------
+4210412 versioning a static executable causes ld to core dump
+4219652 Linker gives misleading error about not finding main (xarch=v9)
+4103449 ld command needs a command line flag to force 64-bits
+4187211 problem with RDISP32 linking in copy-relocated objects
+4287274 dladdr, dlinfo do not provide the full path name of a shared object
+4297563 dlclose still does not remove all objects.
+4250694 rtld_db needs a new auxvec entry
+4235315 new features for rtld_db (DT_CHECKSUM, dynamic linked .o files
+4303609 64bit libelf.so.1 does not properly implement elf_hash()
+4310901 su.static fails when OSNet build with lazy-loading
+4310324 elf_errno() causes Bus Error(coredump) in 64-bit multithreaded programs
+4306415 ld core dump
+4316531 BCP: possible failure with dlclose/_preexec_exit_handlers
+4313765 LD_BREADTH should be shot
+4318162 crle uses automatic strings in putenv.
+4255943 Description of -t option incomplete.
+4322528 sgs message test infrastucture needs improvement
+4239213 Want an API to obtain linker's search path
+4324134 use of extern mapfile directives can contribute unused symbols
+4322581 ELF data structures could be layed out more efficiently...
+4040628 Unnecessary section header symbols should be removed from .dynsym
+4300018 rtld: bindlock should be freed before calling call_fini()
+4336102 dlclose with non-deletable objects can mishandle dependencies
+4329785 mixing of SHT_SUNW_COMDAT & SHF_ORDERED causes ld to seg fault
+4334617 COPY relocations should be produces for references to .bss symbols
+4248250 relcoation of local ABS symbols incorrect
+4335801 For complimentary alignments eliminate ld: warning: symbol `ll'
+        has differing a
+4336980 ld.so.1 relative path processing revisited
+4243097 dlerror(3DL) is not affected by setlocale(3C).
+4344528 dump should remove -D and -l usage message
+xxxxxxx enable LD_ALTEXEC to access alternate link-editor
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-06
+	Solaris/SunOS 5.8_x86		patch 109148-06
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 8 101 (3rd Q-update - s28u3)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4346144 link-auditing: plt_tracing fails if LA_SYMB_NOPLTENTER given after
+        being bound
+4346001 The ld should support mapfile syntax to generate PT_SUNWSTACK segment
+4349137 rtld_db: A third fallback method for locating the linkmap
+4343417 dladdr interface information inadequate
+4343801 RFE: crle(1): provide option for updating configuration files
+4346615 ld.so.1 attempting to open a directory gives: No such device
+4352233 crle should not honor umask
+4352330 LD_PRELOAD cannot use absolute path for privileged program
+4357805 RFE: man page for ld(1) does not document all -z or -B options in
+	Solaris 8 9/00
+4358751 ld.so.1: LD_XXX environ variables and LD_FLAGS should be synchronized.
+4358862 link editors should reference "64" symlinks instead of sparcv9 (ia64).
+4356879 PLTs could use faster code sequences in some cases
+4367118 new fast baplt's fail when traversed twice in threaded application
+4366905 Need a way to determine path to a shared library
+4351197 nfs performance problem by 103627-13
+4367405 LD_LIBRARY_PATH_64 not being used
+4354500 SHF_ORDERED ordered scections does not properly sort sections
+4369068 ld(1)'s weak symbol processing is inefficient (slow and doesn't scale).
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-07
+	Solaris/SunOS 5.8_x86		patch 109148-07
+	Solaris/SunOS 5.7_sparc		patch 106950-14
+	Solaris/SunOS 5.7_x86		patch 106951-14
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 8 701 (5th Q-update - s28u5)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4368846 ld(1) fails to version some interfaces given in a mapfile
+4077245 dump core dump on null pointer.
+4372554 elfdump should demangle symbols (like nm, dump)
+4371114 dlclose may unmap a promiscuous object while it's still in use.
+4204447 elfdump should understand SHN_AFTER/SHN_BEGIN macro
+4377941 initialization of interposers may not occur
+4381116 ldd/ld.so.1 could aid in detecting unused dependencies
+4381783 dlopen/dlclose of a libCrun+libthread can dump core
+4385402 linker & run-time linker must support gABI ELF updates
+4394698 ld.so.1 does not process DF_SYMBOLIC - not gABI conforming
+4394212 the link editor quietly ignores missing support libraries
+4390308 ld.so.1 should provide more flexibility LD_PRELOAD'ing 32-bit/64-bit
+	objects
+4401232 crle(1) could provide better flexibility for alternatives
+4401815 fix misc nits in debugging output...
+4402861 cleanup /usr/demo/link_audit & /usr/tmp/librtld_db demo source code...
+4393044 elfdump should allow raw dumping of sections
+4413168 SHF_ORDERED bit causes linker to generate a separate section
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-08
+	Solaris/SunOS 5.8_x86		patch 109148-08
+--------------------------------------------------------------------------------
+4452202 Typos in <sys/link.h>
+4452220 dump doesn't support RUNPATH
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-09
+	Solaris/SunOS 5.8_x86		patch 109148-09
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 8 1001 (6th Q-update - s28u6)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4421842 fixups in SHT_GROUP processing required...
+4450433 problem with liblddbg output on -Dsection,detail when
+        processing SHF_LINK_ORDER
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-10
+	Solaris/SunOS 5.8_x86		patch 109148-10
+	Solaris/SunOS 5.7_sparc		patch 106950-15
+	Solaris/SunOS 5.7_x86		patch 106951-15
+--------------------------------------------------------------------------------
+4463473 pldd showing wrong output
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-11
+	Solaris/SunOS 5.8_x86		patch 109148-11
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 8 202 (7th Q-update - s28u7)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4488954 ld.so.1 reuses same buffer to send ummapping range to
+	_preexec_exit_handlers()
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-12
+	Solaris/SunOS 5.8_x86		patch 109148-12
+--------------------------------------------------------------------------------
+
+---------
+Solaris 9
+---------
+Bugid   Risk Synopsis
+================================================================================
+4505289 incorrect handling of _START_ and _END_
+4506164 mcs does not recognize #linkbefore or #linkafter qualifiers
+4447560 strip is creating unexecutable files...
+4513842 library names not in ld.so string pool cause corefile bugs
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-13
+	Solaris/SunOS 5.8_x86		patch 109148-13
+	Solaris/SunOS 5.7_sparc		patch 106950-16
+	Solaris/SunOS 5.7_x86		patch 106951-16
+--------------------------------------------------------------------------------
+4291384 ld -M with a mapfile does not properly align Fortran REAL*8 data
+4413322 SunOS 5.9 librtld_db doesn't show dlopened ".o" files anymore?
+4429371 librtld_db busted on ia32 with SC6.x compilers...
+4418274 elfdump dumps core on invalid input
+4432224 libelf xlate routines are out of date
+4433643 Memory leak using dlopen()/dlclose() in Solaris 8
+4446564 ldd/lddstub - core dump conditions
+4446115 translating SUNW_move sections is broken
+4450225 The rdb command can fall into an infinite loop
+4448531 Linker Causes Segmentation Fault
+4453241 Regression in 4291384 can result in empty symbol table.
+4453398 invalid runpath token can cause ld to spin.
+4460230 ld (for OS 5.8 and 5.9) loses error message
+4462245 ld.so.1 core dumps when executed directly...
+4455802 need more flexibility in establishing a support library for ld
+4467068 dyn_plt_entsize not properly initialized in ld.so.1
+4468779 elf_plt_trace_write() broken on i386 (link-auditing)
+4465871 -zld32 and -zld64 does not work the way it should
+4461890 bad shared object created with -zredlocsym
+4469400 ld.so.1: is_so_loaded isn't as efficient as we thought...
+4469566 lazy loading fallback can reference un-relocated objects
+4470493 libelf incorectly translates NOTE sections accross architectures...
+4469684 rtld leaks dl_handles and permits on dlopen/dlclose
+4475174 ld.so.1 prematurly reports the failure to load a object...
+4475514 ld.so.1 can core dump in memory allocation fails (no swap)
+4481851 Setting ld.so.1 environment variables globally would be useful
+4482035 setting LD_PROFILE & LD_AUDIT causes ping command to issue warnings
+	on 5.8
+4377735 segment reservations cause sbrk() to fail
+4491434 ld.so.1 can leak file-descriptors when loading same named objects
+4289232 some of warning/error/debugging messages from libld.so can be revised
+4462748 Linker Portion of TLS Support
+4496718 run-time linkers mutex_locks not working with ld_libc interface
+4497270 The -zredlocsym option should not eliminate partially initialized local
+	symbols
+4496963 dumping an object with crle(1) that uses $ORIGIN can loose its
+	dependencies
+4499413 Sun linker orders of magnitude slower than gnu linker
+4461760 lazy loading libXm and libXt can fail.
+4469031 The partial initialized (local) symbols for intel platform is not
+	working.
+4492883 Add link-editor option to multi-pass archives to resolve unsatisfied
+	symbols
+4503731 linker-related commands misspell "argument"
+4503768 whocalls(1) should output messages to stderr, not stdout
+4503748 whocalls(1) usage message and manpage could be improved
+4503625 nm should be taught about TLS symbols - that they aren't allowed that is
+4300120 segment address validation is too simplistic to handle segment
+	reservations
+4404547 krtld/reloc.h could have better error message, has typos
+4270931 R_SPARC_HIX22 relocation is not handled properly
+4485320 ld needs to support more the 32768 PLTs
+4516434 sotruss can not watch libc_psr.so.1
+4213100 sotruss could use more flexible pattern matching
+4503457 ld seg fault with comdat
+4510264 sections with SHF_TLS can come in different orders...
+4518079 link-editor support library unable to modify section header flags
+4515913 ld.so.1 can incorrectly decrement external reference counts on dlclose()
+4519569 ld -V does not return a interesting value...
+4524512 ld.so.1 should allow alternate termination signals
+4524767 elfdump dies on bogus sh_name fields...
+4524735 ld getopt processing of '-' changed
+4521931 subroutine in a shared object as LOCL instead of GLOB
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-14
+	Solaris/SunOS 5.8_x86		patch 109148-14
+	Solaris/SunOS 5.7_sparc		patch 106950-17
+	Solaris/SunOS 5.7_x86		patch 106951-17
+--------------------------------------------------------------------------------
+4532729 tentative definition of TLS variable causes linker to dump core
+4526745 fixup ld error message about duplicate dependencies/needed names
+4522999 Solaris linker one order of magnitude slower than GNU linker
+4518966 dldump undoes existing relocations with no thought of alignment or size.
+4587441 Certain libraries have race conditions when setting error codes
+4523798 linker option to align bss to large pagesize alignments.
+4524008 ld can improperly set st_size of symbols named "_init" or "_fini"
+4619282 ld cannot link a program with the option -sb
+4620846 Perl Configure probing broken by ld changes
+4621122 multiple ld '-zinitarray=' on a commandline fails
+--------------------------------------------------------------------------------
+	Solaris/SunOS 5.8_sparc		patch 109147-15
+	Solaris/SunOS 5.8_x86		patch 109148-15
+	Solaris/SunOS 5.7_sparc		patch 106950-18
+	Solaris/SunOS 5.7_x86		patch 106951-18
+	Solaris/SunOS 5.6_sparc		patch 107733-10
+	Solaris/SunOS 5.6_x86		patch 107734-10
+--------------------------------------------------------------------------------
+All the above changes plus:
+	4616944 ar seg faults when order of object file is reversed.
+are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch 109147-16
+	Solaris/SunOS 5.8_x86		patch 109148-16
+--------------------------------------------------------------------------------
+All the above changes plus:
+	4872634 Large LD_PRELOAD values can cause SEGV of process
+are incorporated in the following patches:
+	Solaris/SunOS 5.6_sparc		patch T107733-11
+	Solaris/SunOS 5.6_x86		patch T107734-11
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 9 1202 (2nd Q-update - s9u2)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4546416 add help messages to ld.so mdbmodule
+4526752 we should build and ship ld.so's mdb module
+4624658 update 386 TLS relocation values
+4622472 LA_SYMB_DLSYM not set for la_symbind() invocations
+4638070 ldd/ld.so.1 could aid in detecting unreferenced dependencies
+	PSARC/2002/096 Detecting unreferenced dependencies with ldd(1)
+4633860 Optimization for unused static global variables
+	PSARC/2002/113 ld -zignore - section elimination
+4642829 ld.so.1 mprotect()'s text segment for weak relocations (it shouldn't)
+4621479 'make' in $SRC/cmd/sgs/tools tries to install things in the proto area
+4529912 purge ia64 source from sgs
+4651709 dlopen(RTLD_NOLOAD) can disable lazy loading
+4655066 crle: -u with nonexistent config file doesn't work
+4654406 string tables created by the link-editor could be smaller...
+	PSARC/2002/160 ld -znocompstrtab - disable string-table compression
+4651493 RTLD_NOW can result in binding to an object prior to its init being run.
+4662575 linker displacement relocation checking introduces significant
+	linker overhead
+4533195 ld interposes on malloc()/free() preventing support library from freeing
+	memory
+4630224 crle get's confused about memory layout of objects...
+4664855 crle on application failed with ld.so.1 encountering mmap() returning
+	ENOMEM err
+4669582 latest dynamic linker causes libthread _init to get skipped
+4671493 ld.so.1 inconsistantly assigns PATHNAME() on primary objects
+4668517 compile with map.bssalign doesn't copy _iob to bss
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-01
+	Solaris/SunOS 5.8_sparc		patch T109147-17
+	Solaris/SunOS 5.8_x86		patch T109148-17
+--------------------------------------------------------------------------------
+4701749 On Solaris 8 + 109147-16 ld crashes when building a dynamic library.
+4707808 The ldd command is broken in the latest 2.8 linker patch.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-02
+	Solaris/SunOS 5.8_sparc		patch T109147-18
+	Solaris/SunOS 5.8_x86		patch T109148-18
+--------------------------------------------------------------------------------
+4696204 enable extended section indexes in relocatable objects
+	PSARC/2001/332 ELF gABI updates - round II
+	PSARC/2002/369 libelf interfaces to support ELF Extended Sections
+4706503 linkers need to cope with EF_SPARCV9_PSO/EF_SPARCV9_RMO
+4716929 updating of local register symbols in dynamic symtab busted...
+4710814 add "official" support for the "symbolic" keyword in linker map-file
+	PSARC/2002/439 linker mapfile visibility declarations
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-03
+	Solaris/SunOS 5.8_sparc		patch T109147-19
+	Solaris/SunOS 5.8_x86		patch T109148-19
+	Solaris/SunOS 5.7_sparc		patch T106950-19
+	Solaris/SunOS 5.7_x86		patch T106951-19
+--------------------------------------------------------------------------------
+
+-----------------------------------
+Solaris 9 403 (3nd Q-update - s9u3)
+-----------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4731174 strip(1) does not fixup SHT_GROUP data
+4733697 -zignore with gcc may exclude C++ exception sections
+4733317 R_SPARC_*_HIX22 calculations are wrong with 32bit LD building
+	ELF64 binaries
+4735165 fatal linker error when compiling C++ programs with -xlinkopt
+4736951 The mcs broken when the target file is an archive file
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.8_sparc		patch T109147-20
+	Solaris/SunOS 5.8_x86		patch T109148-20
+	Solaris/SunOS 5.7_sparc		patch T106950-20
+	Solaris/SunOS 5.7_x86		patch T106951-20
+--------------------------------------------------------------------------------
+4739660 Threads deadlock in schedlock and dynamic linker lock.
+4653148 ld.so.1/libc should unregister its dlclose() exit handler via a fini.
+4743413 ld.so.1 doesn't terminate argv with NULL pointer when invoked directly
+4746231 linker core-dumps when SECTION relocations are made against discarded
+	sections
+4730433 ld.so.1 wastes time repeatedly opening dependencies
+4744337 missing RD_CONSISTENT event with dlmopen(LD_ID_NEWLM, ...)
+4670835 rd_load_objiter can ignore callback's return value
+4745932 strip utility doesn't strip out Dwarf2 debug section
+4754751 "strip" command doesn't remove comdat stab sections.
+4755674 Patch 109147-18 results in coredump.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+        Solaris/SunOS 5.9_sparc         patch T112963-04
+        Solaris/SunOS 5.7_sparc         patch T106950-21
+        Solaris/SunOS 5.7_x86           patch T106951-21
+--------------------------------------------------------------------------------
+4772927 strip core dumps on an archive library
+4774727 direct-bindings can fail against copy-reloc symbols
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+        Solaris/SunOS 5.9_sparc         patch T112963-05
+        Solaris/SunOS 5.9_x86           patch T113986-01
+        Solaris/SunOS 5.8_sparc         patch T109147-21
+        Solaris/SunOS 5.8_x86           patch T109148-21
+        Solaris/SunOS 5.7_sparc         patch T106950-22
+        Solaris/SunOS 5.7_x86           patch T106951-22
+--------------------------------------------------------------------------------
+
+-----------------------------------
+Solaris 9 803 (4th Q-update - s9u4)
+-----------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4730110 ld.so.1 list implementation could scale better
+4728822 restrict the objects dlsym() searches.
+	PSARC/2002/478 New dlopen(3dl) flag - RTLD_FIRST
+4714146 crle: 64-bit secure pathname is incorrect.
+4504895 dlclose() does not remove all objects
+4698800 Wrong comments in /usr/lib/ld/sparcv9/map.*
+4745129 dldump is inconsistent with .dynamic processing errors.
+4753066 LD_SIGNAL isn't very useful in a threaded environment
+	PSARC/2002/569 New dlinfo(3dl) flag - RTLD_DI_SIGNAL
+4765536 crle: symbolic links can confuse alternative object configuration info
+4766815 ld -r of object the TLS data fails
+4770484 elfdump can not handle stripped archive file
+4770494 The ld command gives improper error message handling broken archive
+4775738 overwriting output relocation table when 'ld -zignore' is used
+4778247 elfdump -e of core files fails
+4779976 elfdump dies on bad relocation entries
+4787579 invalid SHT_GROUP entries can cause linker to seg fault
+4783869 dlclose: filter closure exhibits hang/failure - introduced with 4504895
+4778418 ld.so.1: there be nits out there
+4792461 Thread-Local Storage - x86 instruction sequence updates
+	PSARC/2002/746 Thread-Local Storage - x86 instruction sequence updates
+4461340 sgs: ugly build output while suppressing ia64 (64-bit) build on Intel
+4790194 dlopen(..., RTLD_GROUP) has an odd interaction with interposition
+4804328 auditing of threaded applications results in deadlock
+4806476 building relocatable objects with SHF_EXCLUDE loses relocation
+	information
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-06
+	Solaris/SunOS 5.9_x86		patch T113986-02
+	Solaris/SunOS 5.8_sparc		patch T109147-22
+	Solaris/SunOS 5.8_x86		patch T109148-22
+--------------------------------------------------------------------------------
+4731183 compiler creates .tlsbss section instead of .tbss as documented
+4816378 TLS: a tls test case dumps core with C and C++ compilers
+4817314 TLS_GD relocations against local symbols do not reference symbol...
+4811951 non-default symbol visibility overriden by definition in shared object
+4802194 relocation error of mozilla built by K2 compiler
+4715815 ld should allow linking with no output file (or /dev/null)
+4793721 Need a way to null all code in ISV objects enabling ld performance
+	tuning
+--------------------------------------------------------------------------------
+All the above changes plus:
+	4796237 RFE: link-editor became extremely slow with patch 109147-20 and
+		static libraries
+are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-07
+	Solaris/SunOS 5.9_x86		patch T113986-03
+	Solaris/SunOS 5.8_sparc		patch T109147-23
+	Solaris/SunOS 5.8_x86		patch T109148-23
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 9 1203 (5th Q-update - s9u5)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4830584 mmap for the padding region doesn't get freed after dlclose
+4831650 ld.so.1 can walk off the end of it's call_init() array...
+4831544 ldd using .so modules compiled with FD7 compiler caused a core dump
+4834784 Accessing members in a TLS structure causes a core dump in Oracle
+4824026 segv when -z combreloc is used with -xlinkopt
+4825296 typo in elfdump
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-08
+	Solaris/SunOS 5.9_x86		patch T113986-04
+	Solaris/SunOS 5.8_sparc		patch T109147-24
+	Solaris/SunOS 5.8_x86		patch T109148-24
+--------------------------------------------------------------------------------
+4470917 Solaris Process Model Unification (link-editor components only)
+	PSARC/2002/117 Solaris Process Model Unification
+4744411 Bloomberg wants a faster linker.
+4811969 64-bit links can be much slower than 32-bit.
+4825065 ld(1) should ignore consecutive empty sections.
+4838226 unrelocated shared objects may be erroneously collected for init firing
+4830889 TLS: testcase coredumps with -xarch=v9 and -g
+4845764 filter removal can leave dangling filtee pointer
+4811093 apptrace -F libc date core dumps
+4826315 Link editors need to be pre- and post- Unified Process Model aware
+4868300 interposing on direct bindings can fail
+4872634 Large LD_PRELOAD values can cause SEGV of process
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-09
+	Solaris/SunOS 5.9_x86		patch T113986-05
+	Solaris/SunOS 5.8_sparc		patch T109147-25
+	Solaris/SunOS 5.8_x86		patch T109148-25
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 9 404 (6th Q-update - s9u6)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4870260 The elfdump command should produce more warning message on invalid move
+	entries.
+4865418 empty PT_TLS program headers cause problems in TLS enabled applications
+4825151 compiler core dumped with a -mt -xF=%all test
+4845829 The runtime linker fails to dlopen() long path name.
+4900684 shared libraries with more then 32768 plt's fail for sparc ELF64
+4906062 Makefiles under usr/src/cmd/sgs needs to be updated
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-10
+	Solaris/SunOS 5.9_x86		patch T113986-06
+	Solaris/SunOS 5.8_sparc		patch T109147-26
+	Solaris/SunOS 5.8_x86		patch T109148-26
+	Solaris/SunOS 5.7_sparc		patch T106950-24
+	Solaris/SunOS 5.7_x86		patch T106951-24
+--------------------------------------------------------------------------------
+4900320 rtld library mapping could be faster
+4911775 implement GOTDATA proposal in ld
+	PSARC/2003/477 SPARC GOTDATA instruction sequences
+4904565 Functionality to ignore relocations against external symbols
+4764817 add section types SHT_DEBUG and SHT_DEBUGSTR
+	PSARC/2003/510 New ELF DEBUG and ANNOTATE sections
+4850703 enable per-symbol direct bindings
+4716275 Help required in the link analysis of runtime interfaces
+	PSARC/2003/519 Link-editors: Direct Binding Updates
+4904573 elfdump may hang when processing archive files
+4918310 direct binding from an executable can't be interposed on
+4918938 ld.so.1 has become SPARC32PLUS - breaks 4.x binary compatibility
+4911796 S1S8 C++: ld dump core when compiled and linked with xlinkopt=1.
+4889914 ld crashes with SEGV using -M mapfile under certain conditions
+4911936 exception are not catch from shared library with -zignore
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-11
+	Solaris/SunOS 5.9_x86		patch T113986-07
+	Solaris/SunOS 5.8_sparc		patch T109147-27
+	Solaris/SunOS 5.8_x86		patch T109148-27
+	Solaris/SunOS 5.7_sparc		patch T106950-25
+	Solaris/SunOS 5.7_x86		patch T106951-25
+--------------------------------------------------------------------------------
+4946992 ld crashes due to huge number of sections (>65,000)
+4951840 mcs -c goes into a loop on executable program
+4939869 Need additional relocation types for abs34 code model
+	PSARC/2003/684 abs34 ELF relocations
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-12
+	Solaris/SunOS 5.9_x86		patch T113986-08
+	Solaris/SunOS 5.8_sparc		patch T109147-28
+	Solaris/SunOS 5.8_x86		patch T109148-28
+--------------------------------------------------------------------------------
+
+------------------------------------
+Solaris 9 904 (7th Q-update - s9u7)
+------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+4912214 Having multiple of libc.so.1 in a link map causes malloc() to fail
+4526878 ld.so.1 should pass MAP_ALIGN flag to give kernel more flexibility
+4930997 sgs bld_vernote.ksh script needs to be hardend...
+4796286 ld.so.1: scenario for trouble?
+4930985 clean up cruft under usr/src/cmd/sgs/tools
+4933300 remove references to Ultra-1 in librtld_db demo
+4936305 string table compression is much too slow...
+4939626 SUNWonld internal package must be updated...
+4939565 per-symbol filtering required
+4948119 ld(1) -z loadfltr fails with per-symbol filtering
+4948427 ld.so.1 gives fatal error when multiple RTLDINFO objects are loaded
+4940894 ld core dumps using "-xldscope=symbolic
+4955373 per-symbol filtering refinements
+4878827 crle(1M) - display post-UPM search paths, and compensate for pre-UPM.
+4955802 /usr/ccs/bin/ld dumps core in process_reld()
+4964415 elfdump issues wrong relocation error message
+4966465 LD_NOAUXFLTR fails when object is both a standard and auxiliary filter
+4973865 the link-editor does not scale properly when linking objects with
+	lots of syms
+4975598 SHT_SUNW_ANNOTATE section relocation not resolved
+4974828 nss_files nss_compat r_mt tests randomly segfaulting
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-13
+	Solaris/SunOS 5.9_x86		patch T113986-09
+--------------------------------------------------------------------------------
+4860508 link-editors should create/promote/verify hardware capabilities
+5002160 crle: reservation for dumped objects gets confused by mmaped object
+4967869 linking stripped library causes segv in linker
+5006657 link-editor doesn't always handle nodirect binding syminfo information
+4915901 no way to see ELF information
+5021773 ld.so.1 has trouble with objects having more than 2 segments.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-14
+	Solaris/SunOS 5.9_x86		patch T113986-10
+	Solaris/SunOS 5.8_sparc		patch T109147-29
+	Solaris/SunOS 5.8_x86		patch T109148-29
+--------------------------------------------------------------------------------
+All the above changes plus:
+	6850124 dlopen reports "No such file or directory" in spite of ENOMEM
+		when mmap fails in anon_map()
+are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch TXXXXXX-XX
+	Solaris/SunOS 5.9_x86		patch TXXXXXX-XX
+--------------------------------------------------------------------------------
+
+----------
+Solaris 10
+----------
+Bugid   Risk Synopsis
+================================================================================
+5044797 ld.so.1: secure directory testing is being skipped during filtee
+	processing
+4963676 Remove remaining static libraries
+5021541 unnecessary PT_SUNWBSS segment may be created
+5031495 elfdump complains about bad symbol entries in core files
+5012172 Need error when creating shared object with .o compiled
+	-xarch=v9 -xcode=abs44
+4994738 rd_plt_resolution() resolves ebx-relative PLT entries incorrectly
+5023493 ld -m output with patch 109147-25 missing .o information
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-15
+	Solaris/SunOS 5.9_x86		patch T113986-11
+	Solaris/SunOS 5.8_sparc		patch T109147-30
+	Solaris/SunOS 5.8_x86		patch T109148-30
+--------------------------------------------------------------------------------
+5071614 109147-29 & -30 break the build of on28-patch on Solaris 8 2/04
+5029830 crle: provide for optional alternative dependencies.
+5034652 ld.so.1 should save, and print, more error messages
+5036561 ld.so.1 outputs non-fatal fatal message about auxiliary filter libraries
+5042713 4866170 broke ld.so's ::setenv
+5047082 ld can core dump on bad gcc objects
+5047612 ld.so.1: secure pathname verification is flawed with filter use
+5047235 elfdump can core dump printing PT_INTERP section
+4798376 nits in demo code
+5041446 gelf_update_*() functions inconsistently return NULL or 0
+5032364 M_ID_TLSBSS and M_ID_UNKNOWN have the same value
+4707030 Empty LD_PRELOAD_64 doesn't override LD_PRELOAD
+4968618 symbolic linkage causes core dump
+5062313 dladdr() can cause deadlock in MT apps.
+5056867 $ISALIST/$HWCAP expansion should be more flexible.
+4918303 0@0.so.1 should not use compiler-supplied crt*.o files
+5058415 whocalls cannot take more than 10 arguments
+5067518 The fix for 4918303 breaks the build if a new work space is used.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-16
+	Solaris/SunOS 5.9_x86		patch T113986-12
+	Solaris/SunOS 5.8_sparc		patch T109147-31
+	Solaris/SunOS 5.8_x86		patch T109148-31
+--------------------------------------------------------------------------------
+5013759 *file* should report hardware/software capabilities (link-editor
+	components only)
+5063580 libldstab: file /tmp/posto..: .stab[.index|.sbfocus] found with no
+	matching stri
+5076838 elfdump(1) is built with a CTF section (the wrong one)
+5080344 Hardware capabilities are not enforced for a.out
+5079061 RTLD_DEFAULT can be expensive
+	PSARC/2004/747 New dlsym(3c) Handle - RTLD_PROBE
+5064973 allow normal relocs against TLS symbols for some sections
+5085792 LD_XXXX_64 should override LD_XXXX
+5096272 every executable or library has a .SUNW_dof section
+5094135 Bloomberg wants a faster ldd.
+5086352 libld.so.3 should be built with a .SUNW_ctf ELF section, ready for CR
+5098205 elfdump gives wrong section name for the global offset table
+5092414 Linker patch 109147-29 makes Broadvison One-To-One server v4.1
+	installation fail
+5080256 dump(1) doesn't list ELF hardware capabilities
+5097347 recursive read lock in gelf_getsym()
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-17
+	Solaris/SunOS 5.9_x86		patch T113986-13
+	Solaris/SunOS 5.8_sparc		patch T109147-32
+	Solaris/SunOS 5.8_x86		patch T109148-32
+--------------------------------------------------------------------------------
+5106206 ld.so.1 fail to run a Solaris9 program that has libc linked with
+	-z lazyload
+5102601 ON should deliver a 64-bit operating system for Opteron systems
+	(link-editor components only)
+6173852 enable link_auditing technology for amd64
+6174599 linker does not create .eh_frame_hdr sections for eh_frame sections
+	with SHF_LINK_ORDER
+6175609 amd64 run-time linker has a corrupted note section
+6175843 amd64 rdb_demo files not installed
+6182293 ld.so.1 can repeatedly relocate object .plts (RTLD_NOW).
+6183645 ld core dumps when automounter fails
+6178667 ldd list unexpected (file not found) in x86 environment.
+6181928 Need new reloc types R_AMD64_GOTOFF64 and R_AMD64_GOTPC32
+6182884 AMD64: ld coredumps when building a shared library
+6173559 The ld may set incorrect value for sh_addralign under some conditions.
+5105601 ld.so.1 gets a little too enthusiastic with interposition
+6189384 ld.so.1 should accommodate a files dev/inode change (libc loopback mnt)
+6177838 AMD64: linker cannot resolve PLT for 32-bit a.out(s) on amd64-S2 kernel
+6190863 sparc disassembly code should be removed from rdb_demo
+6191488 unwind eh_frame_hdr needs corrected encoding value
+6192490 moe(1) returns /lib/libc.so.1 for optimal expansion of libc HWCAP
+	libraries
+6192164 AMD64: introduce dlamd64getunwind interface
+	PSARC/2004/747 libc::dlamd64getunwind()
+6195030 libdl has bad version name
+6195521 64-bit moe(1) missed the train
+6198358 AMD64: bad eh_frame_hdr data when C and C++ mixed in a.out
+6204123 ld.so.1: symbol lookup fails even after lazy loading fallback
+6207495 UNIX98/UNIX03 vsx namespace violation DYNL.hdr/misc/dlfcn/T.dlfcn
+	14 Failed
+6217285 ctfmerge crashed during full onnv build
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 106 (1st Q-update - s10u1)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6209350 Do not include signature section from dynamic dependency library into
+	relocatable object
+6212797 The binary compiled on SunOS4.x doesn't run on Solaris8 with Patch
+	109147-31
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-18
+	Solaris/SunOS 5.9_x86		patch T113986-14
+	Solaris/SunOS 5.8_sparc		patch T109147-33
+	Solaris/SunOS 5.8_x86		patch T109148-33
+--------------------------------------------------------------------------------
+6219538 112963-17: linker patch causes binary to dump core
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-01
+	Solaris/SunOS 5.10_x86		patch T118345-01
+	Solaris/SunOS 5.9_sparc		patch T112963-19
+	Solaris/SunOS 5.9_x86		patch T113986-15
+	Solaris/SunOS 5.8_sparc		patch T109147-34
+	Solaris/SunOS 5.8_x86		patch T109148-34
+--------------------------------------------------------------------------------
+6257177 incremental builds of usr/src/cmd/sgs can fail...
+6219651 AMD64: Linker does not issue error for out of range R_AMD64_PC32
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-02
+	Solaris/SunOS 5.10_x86		patch T118345-02
+	Solaris/SunOS 5.9_sparc		patch T112963-20
+	Solaris/SunOS 5.9_x86		patch T113986-16
+	Solaris/SunOS 5.8_sparc		patch T109147-35
+	Solaris/SunOS 5.8_x86		patch T109148-35
+NOTE: The fix for 6219651 is only applicable for 5.10_x86 platform.
+--------------------------------------------------------------------------------
+5080443 lazy loading failure doesn't clean up after itself (D)
+6226206 ld.so.1 failure when processing single segment hwcap filtee
+6228472 ld.so.1: link-map control list stacking can loose objects
+6235000 random packages not getting installed in snv_09 and snv_10 -
+	rtld/common/malloc.c Assertion
+6219317 Large page support is needed for mapping executables, libraries and
+	files (link-editor components only)
+6244897 ld.so.1 can't run apps from commandline
+6251798 moe(1) returns an internal assertion failure message in some
+	circumstances
+6251722 ld fails silently with exit 1 status when -z ignore passed
+6254364 ld won't build libgenunix.so with absolute relocations
+6215444 ld.so.1 caches "not there" lazy libraries, foils svc.startd(1M)'s logic
+6222525 dlsym(3C) trusts caller(), which may return wrong results with tail call
+	optimization
+6241995 warnings in sgs should be fixed (link-editor components only)
+6258834 direct binding availability should be verified at runtime
+6260361 lari shouldn't count a.out non-zero undefined entries as interesting
+6260780 ldd doesn't recognize LD_NOAUXFLTR
+6266261 Add ld(1) -Bnodirect support (D)
+6261990 invalid e_flags error could be a little more friendly
+6261803 lari(1) should find more events uninteresting (D)
+6267352 libld_malloc provides inadequate alignment
+6268693 SHN_SUNW_IGNORE symbols should be allowed to be mulitiply defined
+6262789 Infosys wants a faster linker
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-03
+	Solaris/SunOS 5.10_x86		patch T118345-03
+	Solaris/SunOS 5.9_sparc		patch T112963-21
+	Solaris/SunOS 5.9_x86		patch T113986-17
+	Solaris/SunOS 5.8_sparc		patch T109147-36
+	Solaris/SunOS 5.8_x86		patch T109148-36
+--------------------------------------------------------------------------------
+6283601 The usr/src/cmd/sgs/packages/common/copyright contains old information
+	legally problematic
+6276905 dlinfo gives inconsistent results (relative vs absolute linkname) (D)
+	PSARC/2005/357 dlinfo(3c) RTLD_DI_ARGSINFO
+6284941 excessive link times with many groups/sections
+6280467 dlclose() unmaps shared library before library's _fini() has finished
+6291547 ld.so mishandles LD_AUDIT causing security problems.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-04
+	Solaris/SunOS 5.10_x86		patch T118345-04
+	Solaris/SunOS 5.9_sparc		patch T112963-22
+	Solaris/SunOS 5.9_x86		patch T113986-18
+	Solaris/SunOS 5.8_sparc		patch T109147-37
+	Solaris/SunOS 5.8_x86		patch T109148-37
+--------------------------------------------------------------------------------
+6295971 UNIX98/UNIX03 *vsx* DYNL.hdr/misc/dlfcn/T.dlfcn 14 fails, auxv.h syntax
+	error
+6299525 .init order failure when processing cycles
+6273855 gcc and sgs/crle don't get along
+6273864 gcc and sgs/libld don't get along
+6273875 gcc and sgs/rtld don't get along
+6272563 gcc and amd64/krtld/doreloc.c don't get along
+6290157 gcc and sgs/librtld_db/rdb_demo don't get along
+6301218 Matlab dumps core on startup when running on 112963-22 (D)
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-06
+	Solaris/SunOS 5.10_x86		patch T118345-08
+	Solaris/SunOS 5.9_sparc		patch T112963-23
+	Solaris/SunOS 5.9_x86		patch T113986-19
+	Solaris/SunOS 5.8_sparc		patch T109147-38
+	Solaris/SunOS 5.8_x86		patch T109148-38
+--------------------------------------------------------------------------------
+6314115 Checkpoint refuses to start, crashes on start, after application of
+	linker patch 112963-22
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-24
+	Solaris/SunOS 5.9_x86		patch T113986-20
+	Solaris/SunOS 5.8_sparc		patch T109147-39
+	Solaris/SunOS 5.8_x86		patch T109148-39
+--------------------------------------------------------------------------------
+6318306 a dlsym() from a filter should be redirected to an associated filtee
+6318401 mis-aligned TLS variable
+6324019 ld.so.1: malloc alignment is insufficient for new compilers
+6324589 psh coredumps on x86 machines on snv_23
+6236594 AMD64: Linker needs to handle the new .lbss section (D)
+	PSARC 2005/514 AMD64 - large section support
+6314743 Linker: incorrect resolution for R_AMD64_GOTPC32
+6311865 Linker: x86 medium model; invalid ELF program header
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-07
+	Solaris/SunOS 5.10_x86		patch T118345-12
+--------------------------------------------------------------------------------
+6309061 link_audit should use __asm__ with gcc
+6310736 gcc and sgs/libld don't get along on SPARC
+6329796 Memory leak with iconv_open/iconv_close with patch 109147-33
+6332983 s9 linker patches 112963-24/113986-20 causing cluster machines not
+	to boot
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T117461-08
+	Solaris/SunOS 5.10_x86		patch T121208-02
+	Solaris/SunOS 5.9_sparc		patch T112963-25
+	Solaris/SunOS 5.9_x86		patch T113986-21
+	Solaris/SunOS 5.8_sparc		patch T109147-40
+	Solaris/SunOS 5.8_x86		patch T109148-40
+--------------------------------------------------------------------------------
+6445311 The sparc S8/S9/S10 linker patches which include the fix for the
+	CR6222525 are hit by the CR6439613.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-26
+	Solaris/SunOS 5.8_sparc		patch T109147-41
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 807 (4th Q-update - s10u4)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6487273 ld.so.1 may open arbitrary locale files when relative path is built
+	from locale environment vars
+6487284 ld.so.1: buffer overflow in doprf() function
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T124922-01
+	Solaris/SunOS 5.10_x86		patch T124923-01
+	Solaris/SunOS 5.9_sparc		patch T112963-27
+	Solaris/SunOS 5.9_x86		patch T113986-22
+	Solaris/SunOS 5.8_sparc		patch T109147-42
+	Solaris/SunOS 5.8_x86		patch T109148-41
+--------------------------------------------------------------------------------
+6477132 ld.so.1: memory leak when running set*id application
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T124922-02
+	Solaris/SunOS 5.10_x86		patch T124923-02
+	Solaris/SunOS 5.9_sparc		patch T112963-30
+	Solaris/SunOS 5.9_x86		patch T113986-24
+--------------------------------------------------------------------------------
+6340814 ld.so.1 core dump with HWCAP relocatable object + updated statistics
+6307274 crle bug with LD_LIBRARY_PATH
+6317969 elfheader limited to 65535 segments (link-editor components only)
+6350027 ld.so.1 aborts with assertion failed on amd64
+6362044 ld(1) inconsistencies with LD_DEBUG=-Dunused and -zignore
+6362047 ld.so.1 dumps core when combining HWCAP and LD_PROFILE
+6304206 runtime linker may respect LANG and LC_MESSAGE more than LC_ALL
+6363495 Catchup required with Intel relocations
+6326497 ld.so not properly processing LD_LIBRARY_PATH ending in :
+6307146 mcs dumps core when appending null string to comment section
+6371877 LD_PROFILE_64 with gprof does not produce correct results on amd64
+6372082 ld -r erroneously creates .got section on i386
+6201866 amd64: linker symbol elimination is broken
+6372620 printstack() segfaults when called from static function (D)
+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) (D)
+6316708 LD_DEBUG should provide a means of identifying/isolating individual
+        link-map lists (P)
+6280209 elfdump cores on memory model 0x3
+6197234 elfdump and dump don't handle 64-bit symbols correctly
+6398893 Extended section processing needs some work
+6397256 ldd dumps core in elf_fix_name
+6327926 ld does not set etext symbol correctly for AMD64 medium model (D)
+6390410 64-bit LD_PROFILE can fail: relocation error when binding profile plt
+6382945 AMD64-GCC: dbx: internal error: dwarf reference attribute out of bounds
+6262333 init section of .so dlopened from audit interface not being called
+6409613 elf_outsync() should fsync()
+6426048 C++ exceptions broken in Nevada for amd64
+6429418 ld.so.1: need work-around for Nvidia drivers use of static TLS
+6429504 crle(1) shows wrong defaults for non-existent 64-bit config file
+6431835 data corruption on x64 in 64-bit mode while LD_PROFILE is in effect
+6423051 static TLS support within the link-editors needs a major face lift (D)
+6388946 attempting to dlopen a .o file mislabeled as .so fails
+6446740 allow mapfile symbol definitions to create backing storage (D)
+4986360 linker crash on exec of .so (as opposed to a.out) -- error preferred
+	instead
+6229145 ld: initarray/finiarray processing occurs after got size is determined
+6324924 the linker should warn if there's a .init section but not _init
+6424132 elfdump inserts extra whitespace in bitmap value display
+6449485 ld(1) creates misaligned TLS in binary compiled with -xpg
+6424550 Write to unallocated (wua) errors when libraries are built with
+	-z lazyload
+6464235 executing the 64-bit ld(1) should be easy (D)
+6465623 need a way of building unix without an interpreter
+6467925 ld: section deletion (-z ignore) requires improvement
+6357230 specfiles should be nuked (link-editor components only)
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T124922-03
+	Solaris/SunOS 5.10_x86		patch T124923-03
+
+These patches also include the framework changes for the following bug fixes.
+However, the associated feature has not been enabled in Solaris 10 or earlier
+releases:
+
+6174390 crle configuration files are inconsistent across platforms (D, P)
+6432984 ld(1) output file removal - change default behavior (D)
+	PSARC/2006/353 ld(1) output file removal - change default behavior
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 508 (5th Q-update - s10u5)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6561987 data vac_conflict faults on lipthread libthread libs in s10.
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T127111-01
+	Solaris/SunOS 5.10_x86		patch T127112-01
+--------------------------------------------------------------------------------
+6501793 GOTOP relocation transition (optimization) fails with offsets > 2^32
+6532924 AMD64: Solaris 5.11 55b: SEGV after whocatches
+6551627 OGL: SIGSEGV when trying to use OpenGL pipeline with splash screen,
+	Solaris/Nvidia only
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T127111-04
+	Solaris/SunOS 5.10_x86		patch T127112-04
+--------------------------------------------------------------------------------
+6479848 Enhancements to the linker support interface needed. (D)
+	PSARC/2006/595 link-editor support library interface - ld_open()
+6521608 assertion failure in runtime linker related to auditing
+6494228 pclose() error when an audit library calls popen() and the main target
+	is being run under ldd (D)
+6568745 segfault when using LD_DEBUG with bit_audit library when instrumenting
+	mozilla (D)
+	PSARC/2007/413 Add -zglobalaudit option to ld
+6602294 ps_pbrandname breaks apps linked directly against librtld_db
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T127111-07
+	Solaris/SunOS 5.10_x86		patch T127112-07
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 908 (6th Q-update - s10u6)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6672544 elf_rtbndr must support non-ABI aligned stacks on amd64
+6668050 First trip through PLT does not preserve args in xmm registers
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patch:
+	Solaris/SunOS 5.10_x86		patch T137138-01
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 409 (7th Q-update - s10u7)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6629404 ld with -z ignore doesn't scale
+6606203 link editor ought to allow creation of >2gb sized objects (P)
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T139574-01
+	Solaris/SunOS 5.10_x86		patch T139575-01
+--------------------------------------------------------------------------------
+6746674 setuid applications do not find libraries any more because trusted
+	directories behavior changed (D)
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T139574-02
+	Solaris/SunOS 5.10_x86		patch T139575-02
+--------------------------------------------------------------------------------
+6703683 Can't build VirtualBox on Build 88 or 89
+6737579 process_req_lib() in libld consumes file descriptors
+6685125 ld/elfdump do not handle ZERO terminator .eh_frame amd64 unwind entry
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T139574-03
+	Solaris/SunOS 5.10_x86		patch T139575-03
+--------------------------------------------------------------------------------
+
+-------------------------------------
+Solaris 10 1009 (8th Q-update - s10u8)
+-------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6782597 32-bit ld.so.1 needs to accept objects with large inode number
+6805502 The addition of "inline" keywords to sgs code broke the lint
+	verification in S10
+6807864 ld.so.1 is susceptible to a fatal dlsym()/setlocale() race
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T141692-01
+	Solaris/SunOS 5.10_x86		patch T141693-01
+NOTE: The fix for 6805502 is only applicable to s10.
+--------------------------------------------------------------------------------
+6826410 ld needs to sort sections using 32-bit sort keys
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T141771-01
+	Solaris/SunOS 5.10_x86		patch T141772-01
+NOTE: The fix for 6826410 is also available for s9 in the following patches:
+	Solaris/SunOS 5.9_sparc		patch T112963-33
+	Solaris/SunOS 5.9_x86		patch T113986-27
+--------------------------------------------------------------------------------
+6568447 bcp is broken by 6551627
+6599700 librtld_db needs better plugin support
+6713830 mdb dumped core reading a gcore
+6756048 rd_loadobj_iter() should always invoke brand plugin callback
+6786744 32-bit dbx failed with unknown rtld_db.so error on snv_104
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T141444-06
+	Solaris/SunOS 5.10_x86		patch T141445-06
+--------------------------------------------------------------------------------
+
+--------------------------------------
+Solaris 10 1005 (9th Q-update - s10u9)
+--------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6850124 dlopen reports "No such file or directory" in spite of ENOMEM
+	when mmap fails in anon_map()
+6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
+6684577 ld should propagate SHF_LINK_ORDER flag to ET_REL objects
+6524709 executables using /usr/lib/libc.so.1 as the ELF interpreter dump core
+	(link-editor components only)
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch T143895-01
+	Solaris/SunOS 5.10_x86		patch T143896-01
+--------------------------------------------------------------------------------
+
+----------------------------------------
+Solaris 10 XXXX (10th Q-update - s10u10)
+----------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6478684 isainfo/cpuid reports pause instruction not supported on amd64
+	PSARC/2010/089 Removal of AV_386_PAUSE and AV_386_MON
+--------------------------------------------------------------------------------
+All the above changes are incorporated in the following patches:
+	Solaris/SunOS 5.10_sparc	patch TXXXXXX-XX
+	Solaris/SunOS 5.10_x86		patch TXXXXXX-XX
+--------------------------------------------------------------------------------
+
+--------------------------------------------
+Solaris Nevada (OpenSolaris 2008.05, snv_86)
+--------------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6409350 BrandZ project integration into Solaris (link-editor components only)
+6459189 UNIX03: *VSC* c99 compiler overwrites non-writable file
+6423746 add an option to relax the resolution of COMDAT relocs (D)
+4934427 runtime linker should load up static symbol names visible to
+	dladdr() (D)
+	PSARC 2006/526 SHT_SUNW_LDYNSYM - default local symbol addition
+6448719 sys/elf.h could be updated with additional machine and ABI types
+6336605 link-editors need to support R_*_SIZE relocations
+	PSARC/2006/558 R_*_SIZE relocation support
+6475375 symbol search optimization to reduce rescans
+6475497 elfdump(1) is misreporting sh_link
+6482058 lari(1) could be faster, and handle per-symbol filters better
+6482974 defining virtual address of text segment can result in an invalid data
+	segment
+6476734 crle(1m) "-l" as described fails system, crle cores trying to fix
+	/a/var/ld/ld.config in failsafe
+6487499 link_audit "make clobber" creates and populates proto area
+6488141 ld(1) should detect attempt to reference 0-length .bss section
+6496718 restricted visibility symbol references should trigger archive
+	extraction
+6515970 HWCAP processing doesn't clean up fmap structure - browser fails to
+	run java applet
+6494214 Refinements to symbolic binding, symbol declarations and
+	interposition (D)
+	PSARC/2006/714 ld(1) mapfile: symbol interpose definition
+6475344 DTrace needs ELF function and data symbols sorted by address (D)
+	PSARC/2007/026 ELF symbol sort sections
+6518480 ld -melf_i386 doesn't complain (D)
+6519951 bfu is just another word for exit today (RPATH -> RUNPATH conversion
+	bites us) (D)
+6521504 ld: hardware capabilities processing from relocatables objects needs
+	hardening.
+6518322 Some ELF utilities need updating for .SUNW_ldynsym section (D)
+	PSARC/2007/074 -L option for nm(1) to display SHT_SUNW_LDYNSYM symbols
+6523787 dlopen() handle gets mistakenly orphaned - results in access to freed
+	memory
+6531189 SEGV in dladdr()
+6527318 dlopen(name, RTLD_NOLOAD) returns handle for unloaded library
+6518359 extern mapfiles references to _init/_fini can create INIT/FINI
+	addresses of 0
+6533587 ld.so.1: init/fini processing needs to compensate for interposer
+	expectations
+6516118 Reserved space needed in ELF dynamic section and string table (D)
+	PSARC/2007/127 Reserved space for editing ELF dynamic sections
+6535688 elfdump could be more robust in the face of Purify (D)
+6516665 The link-editors should be more resilient against gcc's symbol
+	versioning
+6541004 hwcap filter processing can leak memory
+5108874 elfdump SEGVs on bad object file
+6547441 Uninitialized variable causes ld.so.1 to crash on object cleanup
+6341667 elfdump should check alignments of ELF header elements
+6387860 elfdump cores, when processing linux built ELF file
+6198202 mcs -d dumps core
+6246083 elfdump should allow section index specification
+	(numeric -N equivalent) (D)
+	PSARC/2007/247 Add -I option to elfdump
+6556563 elfdump section overlap checking is too slow for large files
+5006034 need ?E mapfile feature extension (D)
+6565476 rtld symbol version check prevents GNU ld binary from running
+6567670 ld(1) symbol size/section size verification uncovers Haskell
+	compiler inconsistency
+6530249 elfdump should handle ELF files with no section header table (D)
+	PSARC/2007/395 Add -P option to elfdump
+6573641 ld.so.1 does not maintain parent relationship to a dlopen() caller.
+6577462 Additional improvements needed to handling of gcc's symbol versioning
+6583742 ELF string conversion library needs to lose static writable buffers
+6589819 ld generated reference to __tls_get_addr() fails when resolving to a
+	shared object reference
+6595139 various applications should export yy* global variables for libl
+	PSARC/2007/474 new ldd(1) -w option
+6597841 gelf_getdyn() reads one too many dynamic entries
+6603313 dlclose() can fail to unload objects after fix for 6573641
+6234471 need a way to edit ELF objects (D)
+	PSARC/2007/509 elfedit
+5035454 mixing -Kpic and -KPIC may cause SIGSEGV with -xarch=v9
+6473571 strip and mcs get confused and corrupt files when passed
+	non-ELF arguments
+6253589 mcs has problems handling multiple SHT_NOTE sections
+6610591 do_reloc() should not require unused arguments
+6602451 new symbol visibilities required: EXPORTED, SINGLETON and ELIMINATE (D)
+	PSARC/2007/559 new symbol visibilities - EXPORTED, SINGLETON, and
+	ELIMINATE
+6570616 elfdump should display incorrectly aligned note section
+6614968 elfedit needs string table module (D)
+6620533 HWCAP filtering can leave uninitialized data behind - results in
+	"rejected: Invalid argument"
+6617855 nodirect tag can be ignored when other syminfo tags are available
+	(link-editor components only)
+6621066 Reduce need for new elfdump options with every section type (D)
+	PSARC/2007/620 elfdump -T, and simplified matching
+6627765 soffice failure after integration of 6603313 - dangling GROUP pointer.
+6319025 SUNWbtool packaging issues in Nevada and S10u1.
+6626135 elfedit capabilities str->value mapping should come from
+	usr/src/common/elfcap
+6642769 ld(1) -z combreloc should become default behavior (D)
+	PSARC/2008/006 make ld(1) -z combreloc become default behavior
+6634436 XFFLAG should be updated.  (link-editor components only)
+6492726 Merge SHF_MERGE|SHF_STRINGS input sections (D)
+4947191 OSNet should use direct bindings  (link-editor components only)
+6654381 lazy loading fall-back needs optimizing
+6658385 ld core dumps when building Xorg on nv_82
+6516808 ld.so.1's token expansion provides no escape for platforms that don't
+	report HWCAP
+6668534 Direct bindings can compromise function address comparisons from
+	executables
+6667661 Direct bindings can compromise executables with insufficient copy
+	relocation information
+6357282 ldd should recognize PARENT and EXTERN symbols (D)
+	PSARC/2008/148 new ldd(1) -p option
+6672394 ldd(1) unused dependency processing is tricked by relocations errors
+--------------------------------------------------------------------------------
+
+---------------------------------------------
+Solaris Nevada (OpenSolaris 2008.11, snv_101)
+---------------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+6671255 link-editor should support cross linking (D)
+	PSARC/2008/179 cross link-editor
+6674666 elfedit dyn:posflag1 needs option to locate element via NEEDED item
+6675591 elfwrap - wrap data in an ELF file (D,P)
+	PSARC/2008/198 elfwrap - wrap data in an ELF file
+6678244 elfdump dynamic section sanity checking needs refinement
+6679212 sgs use of SCCS id for versioning is obstacle to mercurial migration
+6681761 lies, darn lies, and linker README files
+6509323 Need to disable the Multiple Files loading - same name, different
+	directories (or its stat() use)
+6686889 ld.so.1 regression - bad pointer created with 6509323 integration
+6695681 ldd(1) crashes when run from a chrooted environment
+6516212 usr/src/cmd/sgs/libelf warlock targets should be fixed or abandoned
+6678310 using LD_AUDIT, ld.so.1 calls shared library's .init before library is
+	fully relocated (link-editor components only)
+6699594 The ld command has a problem handling 'protected' mapfile keyword.
+6699131 elfdump should display core file notes (D)
+6702260 single threading .init/.fini sections breaks staroffice
+6703919 boot hangs intermittently on x86 with onnv daily.0430 and on
+6701798 ld can enter infinite loop processing bad mapfile
+6706401 direct binding copy relocation fallback is insufficient for ild
+	generated objects
+6705846 multithreaded C++ application seems to get deadlocked in the dynamic
+	linker code
+6686343 ldd(1) - unused search path diagnosis should be enabled
+6712292 ld.so.1 should fall back to an interposer for failed direct bindings
+6716350 usr/src/cmd/sgs should be linted by nightly builds
+6720509 usr/src/cmd/sgs/sgsdemangler should be removed
+6617475 gas creates erroneous FILE symbols [was: ld.so.1 is reported as
+	false positive by wsdiff]
+6724311 dldump() mishandles R_AMD64_JUMP_SLOT relocations
+6724774 elfdump -n doesn't print siginfo structure
+6728555 Fix for amd64 aw (6617475) breaks pure gcc builds
+6734598 ld(1) archive processing failure due to mismatched file descriptors (D)
+6735939 ld(1) discarded symbol relocations errors (Studio and GNU).
+6354160 Solaris linker includes more than one copy of code in binary when
+	linking gnu object code
+6744003 ld(1) could provide better argument processing diagnostics (D)
+	PSARC 2008/583 add gld options to ld(1)
+6749055 ld should generate GNU style VERSYM indexes for VERNEED records (D)
+	PSARC/2008/603 ELF objects to adopt GNU-style Versym indexes
+6752728 link-editor can enter UNDEF symbols in symbol sort sections
+6756472 AOUT search path pruning (D)
+--------------------------------------------------------------------------------
+
+---------------------------------------------
+Solaris Nevada (OpenSolaris 2009.06, snv_111)
+---------------------------------------------
+Bugid   Risk Synopsis
+================================================================================
+
+6754965 introduce the SF1_SUNW_ADDR32 bit in software capabilities (D)
+	(link-editor components only)
+	PSARC/2008/622 32-bit Address Restriction Software Capabilities Flag
+6756953 customer requests that DT_CONFIG strings be honored for secure apps (D)
+6765299 ld --version-script option not compatible with GNU ld (D)
+6748160 problem with -zrescan (D)
+	PSARC/2008/651 New ld archive rescan options
+6763342 sloppy relocations need to get sloppier
+6736890 PT_SUNWBSS should be disabled (D)
+	PSARC/2008/715 PT_SUNWBSS removal
+6772661 ldd/lddstub/ld.so.1 dump core in current nightly while processing
+	libsoftcrypto_hwcap.so.1
+6765931 mcs generates unlink(NULL) system calls
+6775062 remove /usr/lib/libldstab.so (D)
+6782977 ld segfaults after support lib version error sends bad args to vprintf()
+6773695 ld -z nopartial can break non-pic objects
+6778453 RTLD_GROUP prevents use of application defined malloc
+6789925 64-bit applications with SF1_SUNW_ADDR32 require non-default starting
+	address
+6792906 ld -z nopartial fix breaks TLS
+6686372 ld.so.1 should use mmapobj(2)
+6726108 dlopen() performance could be improved.
+6792836 ld is slow when processing GNU linkonce sections
+6797468 ld.so.1: orphaned handles aren't processed correctly
+6798676 ld.so.1: enters infinite loop with realloc/defragmentation logic
+6237063 request extension to dl* family to provide segment bounds
+	information (D)
+	PSARC/2009/054 dlinfo(3c) - segment mapping retrieval
+6800388 shstrtab can be sized incorrectly when -z ignore is used
+6805009 ld.so.1: link map control list tear down leaves dangling pointer -
+	pfinstall does it again.
+6807050 GNU linkonce sections can create duplicate and incompatible
+	eh_frame FDE entries
+--------------------------------------------------------------------------------
+
+--------------
+Solaris Nevada
+--------------
+Bugid   Risk Synopsis
+================================================================================
+6813909 generalize eh_frame support to non-amd64 platforms
+6801536 ld: mapfile processing oddities unveiled through mmapobj(2) observations
+6802452 libelf shouldn't use MS_SYNC
+6818012 nm tries to modify readonly segment and dumps core
+6821646 xVM dom0 doesn't boot on daily.0324 and beyond
+6822828 librtld_db can return RD_ERR before RD_NOMAPS, which compromises dbx
+	expectations.
+6821619 Solaris linkers need systematic approach to ELF OSABI (D)
+	PSARC/2009/196 ELF objects to set OSABI / elfdump -O option
+6827468 6801536 breaks 'ld -s' if there are weak/strong symbol pairs
+6715578 AOUT (BCP) symbol lookup can be compromised with lazy loading.
+6752883 ld.so.1 error message should be buffered (not sent to stderr).
+6577982 ld.so.1 calls getpid() before it should when any LD_* are set
+6831285 linker LD_DEBUG support needs improvements (D)
+6806791 filter builds could be optimized (link-editor components only)
+6823371 calloc() uses suboptimal memset() causing 15% regression in SpecCPU2006
+	gcc code (link-editor components only)
+6831308 ld.so.1: symbol rescanning does a little too much work
+6837777 ld ordered section code uses too much memory and works too hard
+6841199 Undo 10 year old workaround and use 64-bit ld on 32-bit objects
+6784790 ld should examine archives to determine output object class/machine (D)
+	PSARC/2009/305 ld -32 option
+6849998 remove undocumented mapfile $SPECVERS and $NEED options
+6851224 elf_getshnum() and elf_getshstrndx() incompatible with 2002 ELF gABI
+	agreement (D)
+	PSARC/2009/363 replace elf_getphnum, elf_getshnum, and elf_getshstrndx
+6853809 ld.so.1: rescan fallback optimization is invalid
+6854158 ld.so.1: interposition can be skipped because of incorrect
+	caller/destination validation
+6862967 rd_loadobj_iter() failing for core files
+6856173 streams core dumps when compiled in 64bit with a very large static
+	array size
+6834197 ld pukes when given an empty plate
+6516644 per-symbol filtering shouldn't be allowed in executables
+6878605 ld should accept '%' syntax when matching input SHT_PROGBITS sections
+6850768 ld option to autogenerate wrappers/interposers similar to GNU ld
+	--wrap (D)
+	PSARC/2009/493 ld -z wrap option
+6888489 Null environment variables are not overriding crle(1) replaceable
+	environment variables.
+6885456 Need to implement GNU-ld behavior in construction of .init/.fini
+	sections
+6900241 ld should track SHT_GROUP sections by symbol name, not section name
+6901773 Special handling of STT_SECTION group signature symbol for GNU objects
+6901895 Failing asserts in ld update_osym() trying to build gcc 4.5 develpment
+	head
+6909523 core dump when run "LD_DEBUG=help ls" in non-English locale
+6903688 mdb(1) can't resolve certain symbols in solaris10-branded processes
+	from the global zone
+6923449 elfdump misinterprets _init/_fini symbols in dynamic section test
+6914728 Add dl_iterate_phdr() function to ld.so.1 (D)
+	PSARC/2010/015 dl_iterate_phdr
+6916788 ld version 2 mapfile syntax (D)
+	PSARC/2009/688 Human readable and extensible ld mapfile syntax
+6929607 ld generates incorrect VERDEF entries for ET_REL output objects
+6924224 linker should ignore SUNW_dof when calculating the elf checksum
+6918143 symbol capabilities (D)
+	PSARC/2010/022 Linker-editors: Symbol Capabilities
+6910387 .tdata and .tbss separation invalidates TLS program header information
+6934123 elfdump -d coredumps on PA-RISC elf
+6931044 ld should not allow SHT_PROGBITS .eh_frame sections on amd64 (D)
+6931056 pvs -r output can include empty versions in output
+6938628 ld.so.1 should produce diagnostics for all dl*() entry points
+6938111 nm `No symbol table data' message goes to stdout
+6941727 ld relocation cache memory use is excessive
+6932220 ld -z allextract skips objects that lack global symbols
+6943772 Testing for a symbols existence with RTLD_PROBE is compromised by
+	RTLD_BIND_NOW
+	PSARC/2010/XXX Deferred symbol references
+6943432 dlsym(RTLD_PROBE) should only bind to symbol definitions
+6668759 an external method for determining whether an ELF dependency is optional
+6954032 Support library with ld_open and -z allextract in snv_139 do not mix
+6949596 wrong section alignment generated in joint compilation with shared
+	library
+6961755 ld.so.1's -e arguments should take precedence over environment
+	variables. (D)
+6748925 moe returns wrong hwcap library in some circumstances
+6916796 OSnet mapfiles should use version 2 link-editor syntax
+6964517 OSnet mapfiles should use version 2 link-editor syntax (2nd pass)
+6948720 SHT_INIT_ARRAY etc. section names don't follow ELF gABI (D)
+6962343 sgsmsg should use mkstemp() for temporary file creation
+6965723 libsoftcrypto symbol capabilities rely on compiler generated
+	capabilities - gcc failure (link-editor components only)
+6952219 ld support for archives larger than 2 GB (D, P)
+	PSARC/2010/224 Support for archives larger than 2 GB
+6956152 dlclose() from an auditor can be fatal. Preinit/activity events should
+	be more flexible. (D)
+6971440 moe can core dump while processing libc.
+6972234 sgs demo's could use some cleanup
+6935867 .dynamic could be readonly in sharable objects
+6975290 ld mishandles GOT relocation against local ABS symbol
+6972860 ld should provide user guidance to improve objects (D)
+	PSARC/2010/312 Link-editor guidance
+--------------------------------------------------------------------------------
+
+--------------
+Illumos
+--------------
+Bugid   Risk Synopsis
+================================================================================
+
+308     ld may misalign sections only preceded by empty sections
+1301	ld crashes with '-z ignore' due to a null data descriptor
+1626	libld may accidentally return success while failing
+2413	%ymm* need to be preserved on way through PLT
+3210	ld should tolerate SHT_PROGBITS for .eh_frame sections on amd64
+3228	Want -zassert-deflib for ld
+3230	ld.so.1 should check default paths for DT_DEPAUDIT
+3260	linker is insufficiently careful with strtok
+3261	linker should ignore unknown hardware capabilities
+3265	link-editor builds bogus .eh_frame_hdr on ia32
+3453	GNU comdat redirection does exactly the wrong thing
+3439	discarded sections shouldn't end up on output lists
+3436	relocatable objects also need sloppy relocation
+3451	archive libraries with no symbols shouldn't require a string table
+3616	SHF_GROUP sections should not be discarded via other COMDAT mechanisms
+3709	need sloppy relocation for GNU .debug_macro
+3722	link-editor is over restrictive of R_AMD64_32 addends
+3926	multiple extern map file definitions corrupt symbol table entry
+3999	libld extended section handling is broken
+4003	dldump() can't deal with extended sections
+4227	ld --library-path is translated to -l-path, not -L
+4270	ld(1) argument error reporting is still pretty bad
+4383	libelf can't write extended sections when ELF_F_LAYOUT
+4959	completely discarded merged string sections will corrupt output objects
+4996	rtld _init race leads to incorrect symbol values
+5688	ELF tools need to be more careful with dwarf data
+6098	ld(1) should not require symbols which identify group sections be global
+6252	ld should merge function/data-sections in the same manner as GNU ld
+7323	ld(1) -zignore can erroneously discard init and fini arrays as unreferenced
+7594	ld -zaslr should accept Solaris-compatible values
+8616	ld has trouble parsing -z options specified with -Wl
+10267	ld and GCC disagree about i386 local dynamic TLS
+10471	ld(1) amd64 LD->LE TLS transition causes memory corruption
+10346	ld(1) should not reduce symbol visibility of COMDAT symbols when
+	producing relocatable objects
+10366	ld(1) should support GNU-style linker sets
+10581	ld(1) should know kernel modules are a thing
+11057	hidden undefined weak symbols should not leave relocations
+11067	debug statistics crash ld(1) when -z allextract
--- old/usr/src/cmd/sgs/tools/bld_lint.sh	2019-07-14 19:12:33.213649173 +0000
+++ /dev/null	2019-07-14 19:12:33.000000000 +0000
@@ -1,94 +0,0 @@
-#! /usr/bin/sh
-#
-# 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 2008 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-
-DASHES="============================================================"
-
-MACH=	`uname -p`
-
-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.
-#
-if [ -f $LOG ]
-then
-	if [ ! -f $LOG.bak ]
-	then
-		mv $LOG $LOG.bak
-	else
-		rm -f $LOG
-	fi
-fi
-
-#
-# Grab the lint.out from all of our directories.
-#
-for ii in $*
-do
-	if [ $ii = ".WAIT" ]
-	then
-		continue
-	fi
-
-	# Concatinate the lint.out to our log file.
-#	echo $ii/$MACH >> $LOG
-	echo $DASHES >> $LOG
-	cat $ii/$MACH/lint.out >> $LOG
-	echo "\n" >> $LOG
-
-	# If there is a 64-bit directory, tack that on as well.
-	if [ -f $ii/$MACH64/lint.out ]
-	then
-#		echo $ii/$MACH64 >> $LOG
-		echo $DASHES >> $LOG
-		cat $ii/$MACH64/lint.out >> $LOG
-		echo "\n" >> $LOG
-	fi
-done
-
-#
-# If there is a backup log, diff the current one against it.
-#
-if [ -f $LOG.bak ]
-then
-	echo "Running diff on log file..."
-	diff $LOG.bak $LOG
-fi
-
-exit 0
--- old/usr/src/cmd/sgs/tools/man/chkmsg.1l	2019-07-14 19:12:33.388157421 +0000
+++ /dev/null	2019-07-14 19:12:33.000000000 +0000
@@ -1,121 +0,0 @@
-.\" 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.
-.\"
-.\" 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
-.\"
-.if n .tr \--
-.TH chkmsg 1l "5 Apr 1997"
-.SH NAME
-chkmsg \- cross check messages 
-.SH SYNOPSIS
-.B chkmsg
-.BI [ -64 ]
-.BI file
-.BI source_files ...
-.SH AVAILABILITY
-Internal to the linker group
-.SH DESCRIPTION
-chkmsg  checks the message identifiers defined in the input file
-and the message identifyer used in the input source_files. The input
-file is the input file which is used by the sgsmsg command.
-.P
-The chkmsg command reads the input file and 
-generates two sets of message identifiers.
-The first set is
-the identifiers defined in between the _START_ and _END_ key words.
-These identifiers are intended to be referenced by MSG_INTL().
-This set is named as MSG_INTL_FROM_INPUT.
-.P
-The other set is
-the identifiers defined after the _END_ key words.
-These identifiers are intended to be referenced by MSG_ORIG().
-This set is named as MSG_ORIG_FROM_INPUT.
-.P
-The chkmsg command reads the specified input source_files and
-generates two sets of message identifiers. The first set is
-the message identifiers referenced by MSG_INTL() macro.
-This set is named as MSG_INTL_FROM_SRC.
-.P
-The other set is the message identifiers referenced by the
-MSG_ORIG() macro.
-This set is named as MSG_ORIG_FROM_SRC.
-.P
-The chkmsg command compares MSG_INTL_FROM_SRC and MSG_INTL_FROM_INPUT.
-If these two sets are different, the command gives the warning
-message and print the identifiers which are different.
-.P
-The chkmsg command compares MSG_ORIG_FROM_SRC and MSG_ORIG_FROM_INPUT.
-If these two sets are different, the command gives the warning
-message and print the identifiers which are different.
-.P
-The identifiers in MSG_INTL_FROM_SRC and MSG_ORIG_FROM_SRC are
-extracted from the source files only if they are
-directly passed to MSG_INTL() or MSG_ORIG(). Therefore, for example:
-.RS
-.nf
-.ft 3
-	char *msg;
-		|
-	msg = MSG_ERROR_01;
-		|
-	printf(MSG_INTL(msg));
-		|
-.fi
-.RE
-the identifyer MSG_ERROR_01 will not be included in MSG_INTL_FROM_SRC set.
-.P
-There are two key words which can be used in the input file 
-to control whether the identifier will be extracted into 
-MSG_{INTL,ORIG}_FROM_ORIG or not. If the identifyer are
-surrounded by _CHKMSG_SKIP_BEGIN_ {sparc,i386}
-and _CHKMSG_SKIP_END_ {sparc,i386}, then
-the identifiers will not be included in the output set.
-The architecture being checked should be specified after
-the key works.
-These key words should be specified in the comment lines.
-For example, the input file could contain:
-.RS
-.nf
-.ft 3
-	# _CHKMSG_SKIP_BEGIN_ sparc
-	@ MSG_ERROR_01	"This identifier is not defined."
-	# _CHKMSG_SKIP_END_ sparc
-.fi
-.RE
-.P
-It is assumed that the message identifier names are composed
-of only upper letters.
-.SH OPTIONS
-.TP 12
-.B \-64
-Use a 64-bit version of the machine type (i.e. sparc => sparcv9).
-Note that this option must be specified first on the command line.
-.SH "SEE ALSO"
-.BR gencat (1),
-.BR ld (1),
-.BR msgfmt (1),
-.BR catgets (3C),
-.BR gettext (3I).
-.BR sgsmsg (1l).
-.br
-.TZ LLM
-.if n .tr \-\-
--- /dev/null	2019-07-14 19:12:33.000000000 +0000
+++ new/usr/src/cmd/sgs/tools/chkmsg.1l	2019-07-14 19:12:33.404851150 +0000
@@ -0,0 +1,118 @@
+.\" 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
+.\"
+.if n .tr \--
+.TH chkmsg 1l "Apr 5, 1997"
+.SH NAME
+chkmsg \- cross check messages
+.SH SYNOPSIS
+.B chkmsg
+.BI [ -64 ]
+.BI file
+.BI source_files ...
+.SH AVAILABILITY
+Internal to the linker group
+.SH DESCRIPTION
+chkmsg  checks the message identifiers defined in the input file
+and the message identifyer used in the input source_files. The input
+file is the input file which is used by the sgsmsg command.
+.P
+The chkmsg command reads the input file and
+generates two sets of message identifiers.
+The first set is
+the identifiers defined in between the _START_ and _END_ key words.
+These identifiers are intended to be referenced by MSG_INTL().
+This set is named as MSG_INTL_FROM_INPUT.
+.P
+The other set is
+the identifiers defined after the _END_ key words.
+These identifiers are intended to be referenced by MSG_ORIG().
+This set is named as MSG_ORIG_FROM_INPUT.
+.P
+The chkmsg command reads the specified input source_files and
+generates two sets of message identifiers. The first set is
+the message identifiers referenced by MSG_INTL() macro.
+This set is named as MSG_INTL_FROM_SRC.
+.P
+The other set is the message identifiers referenced by the
+MSG_ORIG() macro.
+This set is named as MSG_ORIG_FROM_SRC.
+.P
+The chkmsg command compares MSG_INTL_FROM_SRC and MSG_INTL_FROM_INPUT.
+If these two sets are different, the command gives the warning
+message and print the identifiers which are different.
+.P
+The chkmsg command compares MSG_ORIG_FROM_SRC and MSG_ORIG_FROM_INPUT.
+If these two sets are different, the command gives the warning
+message and print the identifiers which are different.
+.P
+The identifiers in MSG_INTL_FROM_SRC and MSG_ORIG_FROM_SRC are
+extracted from the source files only if they are
+directly passed to MSG_INTL() or MSG_ORIG(). Therefore, for example:
+.RS
+.nf
+.ft 3
+	char *msg;
+		|
+	msg = MSG_ERROR_01;
+		|
+	printf(MSG_INTL(msg));
+		|
+.fi
+.RE
+the identifyer MSG_ERROR_01 will not be included in MSG_INTL_FROM_SRC set.
+.P
+There are two key words which can be used in the input file
+to control whether the identifier will be extracted into
+MSG_{INTL,ORIG}_FROM_ORIG or not. If the identifyer are
+surrounded by _CHKMSG_SKIP_BEGIN_ {sparc,i386}
+and _CHKMSG_SKIP_END_ {sparc,i386}, then
+the identifiers will not be included in the output set.
+The architecture being checked should be specified after
+the key works.
+These key words should be specified in the comment lines.
+For example, the input file could contain:
+.RS
+.nf
+.ft 3
+	# _CHKMSG_SKIP_BEGIN_ sparc
+	@ MSG_ERROR_01	"This identifier is not defined."
+	# _CHKMSG_SKIP_END_ sparc
+.fi
+.RE
+.P
+It is assumed that the message identifier names are composed
+of only upper letters.
+.SH OPTIONS
+.TP 12
+.B \-64
+Use a 64-bit version of the machine type (i.e. sparc => sparcv9).
+Note that this option must be specified first on the command line.
+.SH "SEE ALSO"
+.BR gencat (1),
+.BR ld (1),
+.BR msgfmt (1),
+.BR catgets (3C),
+.BR gettext (3C).
+.BR sgsmsg (1ONBLD).
+.if n .tr \-\-
--- old/usr/src/cmd/sgs/tools/chkmsg.sh	2019-07-14 19:12:34.165536490 +0000
+++ new/usr/src/cmd/sgs/tools/chkmsg.sh	2019-07-14 19:12:34.181744877 +0000
@@ -24,7 +24,6 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
 
 TOOLDIR="${SRC}/cmd/sgs/tools/"
 
--- old/usr/src/cmd/sgs/tools/i386/Makefile	2019-07-14 19:12:34.655190348 +0000
+++ new/usr/src/cmd/sgs/tools/i386/Makefile	2019-07-14 19:12:34.672466258 +0000
@@ -19,9 +19,6 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Copyright (c) 1996 by Sun Microsystems, Inc.
 # All rights reserved.
 
@@ -29,9 +26,7 @@
 
 .KEEP_STATE:
 
-all:		native $(PROGS) $(LIBS)
-
-native:		$(NATIVE)
+all:		$(NATIVE) $(PROGS) $(LIBS)
 
 install:	all $(ROOTPROGS) $(ROOTLIBS)
 
--- old/usr/src/cmd/sgs/tools/man/Makefile	2019-07-14 19:12:35.143239468 +0000
+++ /dev/null	2019-07-14 19:12:35.000000000 +0000
@@ -1,50 +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 2003 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
-#
-
-MAN1l=		chkmsg.1l \
-		sgsmsg.1l
-
-MANS=		$(MAN1l)
-
-include		../../../../Makefile.master
-
-ROOTDIR=	$(ROOT)/opt/SUNWonld/man
-ROOT1lMAN=	$(MAN1l:%=$(ROOTDIR)/man1l/%)
-
-ROOTMANS=	$(ROOT1lMAN)
-
-FILEMODE=	0444
-
-.KEEP_STATE:
-all:		$(MANS)
-
-install:	all $(ROOTMANS)
-
-$(ROOTDIR)/man1l/%:	%
-		$(INS.file)
-
-clobber clean:
--- old/usr/src/cmd/sgs/tools/proto.sh	2019-07-14 19:12:35.314840054 +0000
+++ /dev/null	2019-07-14 19:12:35.000000000 +0000
@@ -1,197 +0,0 @@
-#!/bin/sh
-#
-# 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 2007 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-# Generate a proto area suitable for the current architecture ($(MACH))
-# sufficient to support the sgs build.
-#
-# Currently, the following releases are supported:
-#	5.11, 5.10, and 5.9.
-#
-
-if [ "X$CODEMGR_WS" = "X" -o "X$MACH" = "X" ] ; then
-	echo "usage: CODEMGR_WS and MACH environment variables must be set"
-	exit 1
-fi
-
-RELEASE=$1
-
-if [ "X$RELEASE" = "X" ] ; then
-	echo "usage: proto release"
-	exit 1;
-fi
-
-IS_THIS_UNIFIED=1
-
-case $RELEASE in
-	"5.11") break;;
-	"5.10") break;;
-	"5.9") IS_THIS_UNIFIED=0;  break;;
-	*)
-	echo "usage: unsupported release $RELEASE specified"
-	exit 1;;
-esac
-
-dirs="	$CODEMGR_WS/proto \
-	$CODEMGR_WS/proto/root_$MACH \
-	$CODEMGR_WS/proto/root_$MACH/lib \
-	$CODEMGR_WS/proto/root_$MACH/usr \
-	$CODEMGR_WS/proto/root_$MACH/usr/demo \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/abi \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/link_audit \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/mdb \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/mdb/proc \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/pics \
-	$CODEMGR_WS/proto/root_$MACH/usr/4lib \
-	$CODEMGR_WS/proto/root_$MACH/usr/bin \
-	$CODEMGR_WS/proto/root_$MACH/usr/ccs \
-	$CODEMGR_WS/proto/root_$MACH/usr/ccs/bin \
-	$CODEMGR_WS/proto/root_$MACH/usr/include \
-	$CODEMGR_WS/proto/root_$MACH/usr/include/sys \
-	$CODEMGR_WS/proto/root_$MACH/usr/xpg4 \
-	$CODEMGR_WS/proto/root_$MACH/usr/xpg4/bin \
-	$CODEMGR_WS/proto/root_$MACH/etc \
-	$CODEMGR_WS/proto/root_$MACH/etc/lib \
-	$CODEMGR_WS/proto/root_$MACH/opt \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/bin \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/doc \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/lib \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man1 \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man1l \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3t \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3l \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/man/man3x"
-
-#
-# Add 64bit directories
-#
-MACH64=""
-if [ $MACH = "sparc" ]; then
-    MACH64="sparcv9";
-fi
-if [ $MACH = "i386" ]; then
-    MACH64="amd64";
-fi
-if [ "${MACH64}x" != x ]; then
-
-	dirs="$dirs \
-	$CODEMGR_WS/proto/root_$MACH/lib/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/bin/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/ccs/bin/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/abi/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/link_audit/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/mdb/proc/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/usr/lib/pics/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/bin/$MACH64 \
-	$CODEMGR_WS/proto/root_$MACH/opt/SUNWonld/lib/$MACH64 \
-	"
-fi
-
-for dir in `echo $dirs`
-do
-	if [ ! -d $dir ] ; then
-		echo $dir
-		mkdir $dir
-		chmod 777 $dir
-	fi
-done
-
-# We need a local copy of libc_pic.a (we should get this from the parent
-# workspace, but as we can't be sure how the proto area is constructed there
-# simply take it from a stashed copy on the linkers server. If
-# LINKERS_EXPORT is defined, we use it. Failing that, we fall over
-#  to linkers.central.
-if [ "$LINKERS_EXPORT" = "" ]; then
-    LINKERS_EXPORT=/net/linkers.central/export
-fi
-
-if [ $MACH = "sparc" ]; then
-	PLATS="sparc sparcv9"
-elif [ $MACH = "i386" ]; then
-	PLATS="i386 amd64"
-else
-	echo "Unknown Mach: $MACH - no libc_pic.a provided!"
-	PLATS=""
-fi
-
-for p in $PLATS
-do
-	SRCLIBCDIR=${SRC}/lib/libc/$p
-	if [ ! -d $SRCLIBCDIR ]; then
-		mkdir -p $SRCLIBCDIR
-	fi
-	if [ ! -f $SRCLIBCDIR/libc_pic.a ]; then
-		cp $LINKERS_EXPORT/big/libc_pic/$RELEASE/$p/libc_pic.a \
-			$SRCLIBCDIR
-	fi
-done
-
-SYSLIB=$CODEMGR_WS/proto/root_$MACH/lib
-USRLIB=$CODEMGR_WS/proto/root_$MACH/usr/lib
-
-if [ ! -h $USRLIB/ld.so.1 ]; then
-	rm -f $USRLIB/ld.so.1
-	ln -s ../../lib/ld.so.1 $USRLIB/ld.so.1
-	echo "$USRLIB/ld.so.1 -> ../../lib/ld.so.1"
-fi
-
-#
-# In addition create some 64 symlinks so that dependencies referenced
-# from our test environment will map back to the appropriate libraries.
-#
-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
-
-#
-#
-#
-if [ $IS_THIS_UNIFIED = 0 ] ; then
-	rm -fr $CODEMGR_WS/proto/root_$MACH/lib
-	ln -s $CODEMGR_WS/proto/root_$MACH/usr/lib $CODEMGR_WS/proto/root_$MACH/lib
-fi
--- old/usr/src/cmd/sgs/packages/common/readme_revision	2019-07-14 19:12:35.485147015 +0000
+++ /dev/null	2019-07-14 19:12:35.000000000 +0000
@@ -1,140 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright 2008 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 (the "License").
-# You may not use this file except in 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"
-
-
-#
-# Generate a revision number for the sgs linker components, based
-# on usr/src/cmd/sgs/packages/common/SUNWonld-README.
-#
-#	usage: readme_revision [-d] [readme-file]
-#
-# This revision number used to be the SCCS revision id for that file,
-# in the form 1.xxx (where xxx was the revision). There were two benefits:
-#
-#	(1) You could examine the sccs revision log to determine the CR
-#		of the putback that created the revision.
-#	(2) The revisions were monotonically increasing.
-#
-# In order to remove the hard wired dependence on sccs, this script generates
-# a replacement revision number, by returning the string '1.xxx', where
-# xxx is an integer giving the number of unique CR lines found in the file.
-# This means that the revision goes up by one for each CR we fix, which
-# makes intutive sense, and is similar to the way the SCCS revision worked.
-#
-# If this is a debug/development build (-d option), then we include
-# additional information at the end of the revision:
-#
-#	- Workspace name
-#	- user
-#	- CR # of last item in the readme file
-#	- date,
-#
-# This extra information is useful when we need to identify SUNWonld
-# linker packages in the field, and provides the information previously
-# supplied by (1) above.
-#
-
-use vars qw($script $usage $readme $cnt);
-use vars qw($debug $last_cr $wsname $date);
-
-# Use the basename of the name we're invoked under as the script name
-@_ = split /\//, $0;
-$script = $_[$#_];
-$usage = "usage: $script [-d] [readme-file]\n";
-
-$debug = 0;
-# Process the options
-while ((scalar(@ARGV) > 0) && ($_ = $ARGV[0],/^-/)) {
-  ARG: {
-	if (/^-d$/) {
-		$debug = 1;
-		last ARG;
-	}
-
-
-      # If it gets here, the option is unknown.
-      die $usage;
-  }
-    shift;
-}
-
-# Plain argument
-$cnt = scalar @ARGV;
-{
-	if ($cnt == 0) {
-		$readme = 'SUNWonld-README';
-		next;
-	}
-
-	if ($cnt == 1) {
-		$readme = $ARGV[0];
-		next;
-	}
-
-	die $usage;
-}
-
-
-open(FILE, $readme) || die "$script: Unable to open $readme\n";
-
-# At the date this script was put into service, the SCCS revision
-# of SUNWonld-README was 1.627, and SUNWonld-README had 588 unique
-# CRs. Revisions are supposed to always increase monotonically, so
-# we add 1000 to the number of unique CRs.
-#
-# This means that any linker with a version <1000 was built using
-# the SCCS revision, and any linker with version >=1000 was built
-# with this script.
-$cnt = 1000;
-
-while ($_ = <FILE>) {
-	chomp $_;
-
-	# If the line starts with a number, it is taken as a CR.
-	if ($_ =~ /^(\d+)\s/) {
-		$cnt++;
-		$last_cr = $1;
-	}
-}
-close FILE;
-
-# If this is a standard build, the revision # is all we want
-if ($debug == 0) {
-	print "1.$cnt\n";
-	exit 0;
-}
-
-# For debug mode, add diagnostic data
-# 
-($wsname = $ENV{'CODEMGR_WS'}) ne '' || ($wsname = 'unknown');
-@wsname = split /\//, $wsname;
-$wsname = $wsname[$#wsname];
-
-$date = `date +%m/%d/%y`;
-
-print "1.$cnt:$wsname-$ENV{USER}-$last_cr-$date\n";
-
-exit 0;
--- /dev/null	2019-07-14 19:12:35.000000000 +0000
+++ new/usr/src/cmd/sgs/tools/readme_revision	2019-07-14 19:12:35.501262809 +0000
@@ -0,0 +1,136 @@
+#!/usr/bin/perl -w
+#
+# Copyright 2008 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 (the "License").
+# You may not use this file except in 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
+#
+#
+# Generate a revision number for the sgs linker components, based
+# on usr/src/cmd/sgs/tools/SUNWonld-README.
+#
+#	usage: readme_revision [-d] [readme-file]
+#
+# This revision number used to be the SCCS revision id for that file,
+# in the form 1.xxx (where xxx was the revision). There were two benefits:
+#
+#	(1) You could examine the sccs revision log to determine the CR
+#		of the putback that created the revision.
+#	(2) The revisions were monotonically increasing.
+#
+# In order to remove the hard wired dependence on sccs, this script generates
+# a replacement revision number, by returning the string '1.xxx', where
+# xxx is an integer giving the number of unique CR lines found in the file.
+# This means that the revision goes up by one for each CR we fix, which
+# makes intutive sense, and is similar to the way the SCCS revision worked.
+#
+# If this is a debug/development build (-d option), then we include
+# additional information at the end of the revision:
+#
+#	- Workspace name
+#	- user
+#	- CR # of last item in the readme file
+#	- date,
+#
+# This extra information is useful when we need to identify SUNWonld
+# linker packages in the field, and provides the information previously
+# supplied by (1) above.
+#
+
+use vars qw($script $usage $readme $cnt);
+use vars qw($debug $last_cr $wsname $date);
+
+# Use the basename of the name we're invoked under as the script name
+@_ = split /\//, $0;
+$script = $_[$#_];
+$usage = "usage: $script [-d] [readme-file]\n";
+
+$debug = 0;
+# Process the options
+while ((scalar(@ARGV) > 0) && ($_ = $ARGV[0],/^-/)) {
+  ARG: {
+	if (/^-d$/) {
+		$debug = 1;
+		last ARG;
+	}
+
+
+      # If it gets here, the option is unknown.
+      die $usage;
+  }
+    shift;
+}
+
+# Plain argument
+$cnt = scalar @ARGV;
+{
+	if ($cnt == 0) {
+		$readme = 'SUNWonld-README';
+		next;
+	}
+
+	if ($cnt == 1) {
+		$readme = $ARGV[0];
+		next;
+	}
+
+	die $usage;
+}
+
+
+open(FILE, $readme) || die "$script: Unable to open $readme\n";
+
+# At the date this script was put into service, the SCCS revision
+# of SUNWonld-README was 1.627, and SUNWonld-README had 588 unique
+# CRs. Revisions are supposed to always increase monotonically, so
+# we add 1000 to the number of unique CRs.
+#
+# This means that any linker with a version <1000 was built using
+# the SCCS revision, and any linker with version >=1000 was built
+# with this script.
+$cnt = 1000;
+
+while ($_ = <FILE>) {
+	chomp $_;
+
+	# If the line starts with a number, it is taken as a CR.
+	if ($_ =~ /^(\d+)\s/) {
+		$cnt++;
+		$last_cr = $1;
+	}
+}
+close FILE;
+
+# If this is a standard build, the revision # is all we want
+if ($debug == 0) {
+	print "1.$cnt\n";
+	exit 0;
+}
+
+# For debug mode, add diagnostic data
+($wsname = $ENV{'CODEMGR_WS'}) ne '' || ($wsname = 'unknown');
+@wsname = split /\//, $wsname;
+$wsname = $wsname[$#wsname];
+
+$date = `date +%m/%d/%y`;
+
+print "1.$cnt:$wsname-$ENV{USER}-$last_cr-$date\n";
+
+exit 0;
--- old/usr/src/cmd/sgs/tools/sparc/Makefile	2019-07-14 19:12:35.996002760 +0000
+++ new/usr/src/cmd/sgs/tools/sparc/Makefile	2019-07-14 19:12:36.014934177 +0000
@@ -19,9 +19,6 @@
 #
 # CDDL HEADER END
 #
-#
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # Copyright (c) 1996 by Sun Microsystems, Inc.
 # All rights reserved.
 
@@ -29,9 +26,7 @@
 
 .KEEP_STATE:
 
-all:		native $(PROGS) $(LIBS)
-
-native:		$(NATIVE)
+all:		$(NATIVE) $(PROGS) $(LIBS)
 
 install:	all $(ROOTPROGS) $(ROOTLIBS)
 
--- old/usr/src/tools/Makefile	2019-07-14 19:12:36.473475893 +0000
+++ new/usr/src/tools/Makefile	2019-07-14 19:12:36.491133393 +0000
@@ -58,12 +58,19 @@
 	onbld \
 	protocmp \
 	protolist \
-	scripts
+	scripts \
+	sgs
 
 #
 #  special versions of commands for use only in build
 #
 UNSHIPPED_SUBDIRS = \
+	$(SGSMSG) \
+	$(SGSLIBCONV) \
+	$(SGSLIBELF) \
+	$(SGSLIBLDDBG) \
+	$(SGSLIBLD) \
+	$(SGSLD) \
 	localedef \
 	mandoc \
 	tic \
@@ -82,6 +89,8 @@
 	mbh_patch	\
 	btxld
 
+$(INTEL_BLD)sgs: aw
+
 LINTSUBDIRS= \
 	codereview \
 	ctf \
--- old/usr/src/tools/Makefile.tools	2019-07-14 19:12:36.932433081 +0000
+++ new/usr/src/tools/Makefile.tools	2019-07-14 19:12:36.948584142 +0000
@@ -55,6 +55,10 @@
 LDFLAGS=		$(MAPFILE.NES:%=-M%) $(MAPFILE.NED:%=-M%) \
 			    $(MAPFILE.PGA:%=-M%)
 
+# Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
+# the journey through LD_ALTEXEC unnecessarily.
+CW_LINKER=
+
 ROOTONBLDPROG=		$(PROG:%=$(ROOTONBLDBIN)/%)
 ROOTONBLDMACHPROG=	$(PROG:%=$(ROOTONBLDBINMACH)/%)
 ROOTONBLDSHFILES=	$(SHFILES:%=$(ROOTONBLDBIN)/%)
--- old/usr/src/tools/chk4ubin/Makefile	2019-07-14 19:12:37.401311067 +0000
+++ new/usr/src/tools/chk4ubin/Makefile	2019-07-14 19:12:37.417769370 +0000
@@ -28,6 +28,7 @@
 
 PROG	= chk4ubin
 
+DYNFLAGS += '-R$$ORIGIN/../../lib/$(MACH)'
 LDLIBS += -lelf
 
 LINTFLAGS += -ux
--- old/usr/src/tools/ctf/dwarf/Makefile.com	2019-07-14 19:12:37.850671933 +0000
+++ new/usr/src/tools/ctf/dwarf/Makefile.com	2019-07-14 19:12:37.866293605 +0000
@@ -68,7 +68,7 @@
 	pro_weaks.o
 
 include $(SRC)/lib/Makefile.lib
-
+include $(SRC)/tools/Makefile.tools
 
 FILEMODE =	0755
 SRCDIR =	$(SRC)/lib/libdwarf/common/
@@ -81,6 +81,7 @@
 # libdwarf not clean
 SMATCH=off
 
+DYNFLAGS += '-R$$ORIGIN/../../lib/$(MACH)'
 LDLIBS = -lelf -lc
 
 .KEEP_STATE:
--- old/usr/src/tools/cw/cw.1onbld	2019-07-14 19:12:38.317952088 +0000
+++ new/usr/src/tools/cw/cw.1onbld	2019-07-14 19:12:38.335762514 +0000
@@ -36,6 +36,7 @@
 .Op Fl -noecho
 .Fl -primary Ar compiler
 .Op Fl -shadow Ar compiler ...
+.Op Fl -linker Ar linker
 .Fl -
 .Ar compiler args ...
 .Sh DESCRIPTION
@@ -77,6 +78,11 @@
 .It Fl -shadow Ar compiler
 Specify a shadow compiler, which builds sources for the sake of checking code
 quality and compatibility, but has its output discarded.
+.It Fl -linker Ar linker
+Specify a link-editor to use in place of
+.Pa /usr/bin/ld .
+.Xr ld 1
+itself arranges for this to be executed by any subprocesses.
 .It Fl -noecho
 Do not echo the actual command line of any compilers invoked.
 .It Fl -versions
@@ -210,7 +216,8 @@
 .Sh SEE ALSO
 .Xr cc 1 ,
 .Xr CC 1 ,
-.Xr gcc 1
+.Xr gcc 1 ,
+.Xr ld 1
 .Sh BUGS
 The translations provided for gcc are not always exact and in some cases
 reflect local policy rather than actual equivalence.
--- old/usr/src/tools/cw/cw.c	2019-07-14 19:12:39.048956981 +0000
+++ new/usr/src/tools/cw/cw.c	2019-07-14 19:12:39.064536838 +0000
@@ -306,6 +306,7 @@
 typedef struct cw_ictx {
 	struct cw_ictx	*i_next;
 	cw_compiler_t	*i_compiler;
+	char		*i_linker;
 	struct aelist	*i_ae;
 	uint32_t	i_flags;
 	int		i_oldargc;
@@ -1209,14 +1210,6 @@
 			/* Just ignore -YS,... for now */
 			if (strncmp(arg, "S,", 2) == 0)
 				break;
-			if (strncmp(arg, "l,", 2) == 0) {
-				char *s = strdup(arg);
-				s[0] = '-';
-				s[1] = 'B';
-				newae(ctx->i_ae, s);
-				free(s);
-				break;
-			}
 			if (strncmp(arg, "I,", 2) == 0) {
 				char *s = strdup(arg);
 				s[0] = '-';
@@ -1468,6 +1461,9 @@
 		(void) fflush(stdout);
 	}
 
+	if (ctx->i_linker != NULL)
+		setenv("LD_ALTEXEC", ctx->i_linker, 1);
+
 	if (!(ctx->i_flags & CW_F_XLATE))
 		return;
 
@@ -1727,6 +1723,7 @@
 
 	static struct option longopts[] = {
 		{ "compiler", no_argument, NULL, 'c' },
+		{ "linker", required_argument, NULL, 'l' },
 		{ "noecho", no_argument, NULL, 'n' },
 		{ "primary", required_argument, NULL, 'p' },
 		{ "shadow", required_argument, NULL, 's' },
@@ -1746,6 +1743,10 @@
 		case 'C':
 			Cflg = B_TRUE;
 			break;
+		case 'l':
+			if ((main_ctx->i_linker = strdup(optarg)) == NULL)
+				nomem();
+			break;
 		case 'n':
 			nflg = B_TRUE;
 			break;
--- old/usr/src/tools/findunref/exception_list.open	2019-07-14 19:12:39.569829319 +0000
+++ new/usr/src/tools/findunref/exception_list.open	2019-07-14 19:12:39.581159557 +0000
@@ -143,7 +143,6 @@
 # Ignore internal packages, scripts, and tools that are intentionally not
 # built or used during a nightly.
 #
-./usr/src/cmd/sgs/packages
 ./usr/src/cmd/sgs/rtld.4.x
 ./usr/src/prototypes
 ./usr/src/cmd/pools/poold/com/sun/solaris/*/*/package.html
--- old/usr/src/tools/make/lib/makestate/Makefile.com	2019-07-14 19:12:40.034879368 +0000
+++ new/usr/src/tools/make/lib/makestate/Makefile.com	2019-07-14 19:12:40.052642650 +0000
@@ -18,6 +18,7 @@
 OBJECTS = ld_file.o lock.o
 
 include $(SRC)/lib/Makefile.lib
+include $(SRC)/tools/Makefile.tools
 include ../../../Makefile.com
 
 LIBS = $(DYNLIB)
--- old/usr/src/tools/make/lib/makestate/amd64/Makefile	2019-07-14 19:12:40.494333974 +0000
+++ new/usr/src/tools/make/lib/makestate/amd64/Makefile	2019-07-14 19:12:40.511818119 +0000
@@ -14,4 +14,7 @@
 include ../Makefile.com
 include $(SRC)/lib/Makefile.lib.64
 
+# Need to unset the alternate link-editor again, as Makefile.lib and
+# Makefile.tools don't interact well.
+
 install: all $(ROOTONBLDLIBMACH64)/libmakestate.so.1
--- /dev/null	2019-07-14 19:12:41.000000000 +0000
+++ new/usr/src/tools/sgs/Makefile	2019-07-14 19:12:40.992115987 +0000
@@ -0,0 +1,39 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+# Copyright 2019, Richard Lowe.
+
+SUBDIRS =		\
+	include		\
+	ld		\
+	libconv		\
+	libelf		\
+	libld		\
+	liblddbg	\
+	sgsmsg
+
+all :=		TARGET= install
+install :=	TARGET= install
+clean :=	TARGET= clean
+clobber :=	TARGET= clobber
+
+ld: sgsmsg include libconv libelf libld
+libconv: sgsmsg include
+libelf: sgsmsg include
+libld: sgsmsg libelf libconv liblddbg include
+liblddbg: sgsmsg libconv include
+
+all install clean clobber: $(SUBDIRS)
+
+$(SUBDIRS): FRC
+	@cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
--- /dev/null	2019-07-14 19:12:41.000000000 +0000
+++ new/usr/src/tools/sgs/Makefile.com	2019-07-14 19:12:41.226487382 +0000
@@ -0,0 +1,17 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+# Copyright 2019, Richard Lowe.
+
+include $(SRC)/cmd/sgs/Makefile.com
+
+NATIVE_CPPFLAGS = -I. -I$(SRCDIR) -I$(SRCDIR)/common -I$(SGSHOME)/include -I$(SGSHOME)/include/$(MACH) \
+		-I../include $(CPPFLAGS.native) -I$(ELFCAP) -DNATIVE_BUILD
--- /dev/null	2019-07-14 19:12:41.000000000 +0000
+++ new/usr/src/tools/sgs/include/Makefile	2019-07-14 19:12:41.455046264 +0000
@@ -0,0 +1,68 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+# Copyright 2019, Richard Lowe.
+
+include ../../../Makefile.master
+
+#
+# To build a proper 'tools' version of the link-editor is not possible, as
+# we'll always depend on the ELF-related headers from the workspace, not the
+# system.
+#
+# We pull in the minimum amount of headers using an explicit list of "ELF-y"
+# headers to populate this directory, which we then search while building.
+#
+# This may not be enough on all occasions, judgement must be used to decide
+# between providing extra headers, and wrapping problematic code in conditions
+# on NATIVE_BUILD for a period of time.
+#
+
+ROOTHDRS=	dlfcn.h \
+		gelf.h \
+		libelf.h \
+		proc_service.h \
+		rtld_db.h \
+		link.h
+
+SYSHDRS=	sys/elf.h \
+		sys/elf_386.h \
+		sys/elf_SPARC.h \
+		sys/elf_notes.h \
+		sys/elf_amd64.h \
+		sys/elftypes.h \
+		sys/auxv.h \
+		sys/auxv_SPARC.h \
+		sys/auxv_386.h \
+		sys/avl.h \
+		sys/link.h \
+		sys/machelf.h \
+		sys/note.h \
+		sys/systeminfo.h
+
+sys:
+	$(MKDIR) -p sys
+
+%: $(SRC)/head/%
+	$(INS.file)
+
+sys/%: sys $(SRC)/uts/common/sys/%
+	$(INS.file)
+
+all install: $(SYSHDRS) $(ROOTHDRS)
+
+clean:
+
+clobber: clean
+	$(RM) $(SYSHDRS) $(ROOTHDRS)
+
+
+
--- /dev/null	2019-07-14 19:12:41.000000000 +0000
+++ new/usr/src/tools/sgs/ld/Makefile	2019-07-14 19:12:41.690247763 +0000
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of 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) 1996 by Sun Microsystems, Inc.
+# All rights reserved.
+
+include		../Makefile.com
+include		../../Makefile.tools
+include		$(SGSHOME)/ld/Makefile.com
+
+LDLIBS = -L../libconv -L$(ROOTONBLDLIBMACH) -lld -lelf -lconv
+CPPFLAGS = $(NATIVE_CPPFLAGS)
+CFLAGS = $(NATIVE_CFLAGS)
+MAPFILES = $(SRCDIR)/common/mapfile-intf
+CW_LINKER =
+VAR_LD_LLDFLAGS=	'-R$$ORIGIN/../../lib/$(MACH)'
+VAR_LD_LLDFLAGS64 =	'-R$$ORIGIN/../../../lib/$(MACH64)'
+
+install: $(ROOTONBLDMACHPROG)
+
+.KEEP_STATE:
+
+include		$(SGSHOME)/ld/Makefile.targ
--- /dev/null	2019-07-14 19:12:41.000000000 +0000
+++ new/usr/src/tools/sgs/libconv/Makefile	2019-07-14 19:12:41.937877361 +0000
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+#
+
+include		../Makefile.com
+include		$(SGSHOME)/libconv/Makefile.com
+
+CPPFLAGS = $(NATIVE_CPPFLAGS) -I$(SRC)/lib/libc/inc -I$(ELFCAP) \
+	-I$(SRC)/common/sgsrtcid \
+	-I$(SRC)/lib/libdemangle/common
+CFLAGS = $(NATIVE_CFLAGS)
+CW_LINKER =
+
+.PARALLEL:	$(PICS)
+.KEEP_STATE:
+
+install all:	$(LIBRARY)
+
+include		$(SGSHOME)/libconv/Makefile.targ
+
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/libelf/Makefile	2019-07-14 19:12:42.187668298 +0000
@@ -0,0 +1,48 @@
+#
+# 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) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+include		../Makefile.com
+include		../../Makefile.tools
+include		$(SGSHOME)/libelf/Makefile.com
+
+CONVLIBDIR = -L../libconv
+CPPFLAGS = $(NATIVE_CPPFLAGS)
+CFLAGS = $(NATIVE_CFLAGS)
+SGSMSGTARG +=	$(SGSMSG32)
+CW_LINKER =
+
+.KEEP_STATE:
+
+install:	all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+		$(BUILD.SO)
+		$(POST_PROCESS_SO)
+
+$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
+		@$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+		$(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+include		$(SGSHOME)/libelf/Makefile.targ
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/libld/Makefile	2019-07-14 19:12:42.420581219 +0000
@@ -0,0 +1,56 @@
+#
+# 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 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#
+
+include		../Makefile.com
+include		../../Makefile.tools
+include		$(SGSHOME)/libld/Makefile.com
+
+.KEEP_STATE:
+
+CW_LINKER =
+
+CPPFLAGS = $(NATIVE_CPPFLAGS) -DUSE_LIBLD_MALLOC -I$(SRC)/lib/libc/inc \
+		    -I$(SRC)/uts/common/krtld -I$(SRC)/uts/sparc \
+		    $(VAR_LIBLD_CPPFLAGS)
+LDLIBS +=	-L$(ROOTONBLDLIBMACH) -L../libconv -lconv -llddbg -lelf -lc
+
+DYNFLAGS +=	$(VERSREF) '-R$$ORIGIN'
+CFLAGS = $(NATIVE_CFLAGS)
+
+all:		$(DYNLIB) $(LIBLINKS)
+
+install:	all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+		$(BUILD.SO)
+		$(POST_PROCESS_SO)
+
+$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
+		@$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+		$(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+include		$(SGSHOME)/libld/Makefile.targ
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/liblddbg/Makefile	2019-07-14 19:12:42.655815875 +0000
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+include		../Makefile.com
+include		../../Makefile.tools
+include		$(SGSHOME)/liblddbg/Makefile.com
+
+.KEEP_STATE:
+
+CPPFLAGS = $(NATIVE_CPPFLAGS) -I$(SRC)/lib/libc/inc
+CFLAGS = $(NATIVE_CFLAGS)
+DYNFLAGS += -L../libconv
+CW_LINKER=
+SGSMSGTARG +=	$(SGSMSG32)
+
+all:		$(DYNLIB) $(LIBLINKS)
+
+install:	all $(ROOTONBLDLIBMACH)/$(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+$(ROOTONBLDLIBMACH)/$(DYNLIB): $(PICS) $(ROOTONBLDLIBMACH)
+		$(BUILD.SO)
+		$(POST_PROCESS_SO)
+
+$(ROOTONBLDLIBMACH)/$(LIBLINKS): $(ROOTONBLDLIBMACH)/$(DYNLIB)
+		@$(RM) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+		$(SYMLINK) $(DYNLIB) $(ROOTONBLDLIBMACH)/$(LIBLINKS)
+
+include		$(SGSHOME)/liblddbg/Makefile.targ
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/sgsmsg/Makefile	2019-07-14 19:12:42.884455383 +0000
@@ -0,0 +1,75 @@
+#
+# 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) 2018, Joyent, Inc.
+# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+
+#
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Makefile to support tools used for linker development:
+#
+#  o	sgsmsg creates message headers/arrays/catalogs (a native tool).
+#
+# Note, these tools are not part of the product.
+#
+
+include		../Makefile.com
+include		../../Makefile.tools
+include		$(SRC)/cmd/Makefile.cmd
+
+
+PROG=	sgsmsg
+
+MAN1ONBLDFILES = sgsmsg.1onbld
+$(ROOTONBLDMAN1ONBLDFILES) := FILEMODE=	644
+
+OBJS= avl.o sgsmsg.o string_table.o findprime.o assfail.o
+
+FILEMODE=	0755
+
+CPPFLAGS = $(NATIVE_CPPFLAGS)
+CFLAGS = $(NATIVE_CFLAGS)
+CW_LINKER =
+
+# not linted
+SMATCH=off
+
+all: $(PROG)
+
+install: $(ROOTONBLDMACHPROG) $(ROOTONBLDMAN1ONBLDFILES)
+
+$(PROG): $(OBJS)
+	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
+
+%.o:	$(SGSCOMMON)/%.c
+	$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) $(CPPFLAGS) -c $<
+
+avl.o:	$(SRC)/common/avl/avl.c
+	$(NATIVECC) $(DEBUG) $(NATIVE_CFLAGS) $(CPPFLAGS) -c \
+	    $(SRC)/common/avl/avl.c
+
+clean:
+	$(RM) $(OBJS)
+
+include $(SRC)/cmd/Makefile.targ
--- old/usr/src/cmd/sgs/tools/man/sgsmsg.1l	2019-07-14 19:12:43.110838975 +0000
+++ /dev/null	2019-07-14 19:12:42.000000000 +0000
@@ -1,433 +0,0 @@
-.\" 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.
-.\"
-.\" 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
-.\"
-.if n .tr \--
-.TH sgsmsg 1l "2 Jun 1999"
-.SH NAME
-sgsmsg \- generate message strings for SGS subsystem.
-.SH SYNOPSIS
-.B sgsmsg
-[
-.B \-cl
-] [
-.BI \-d\0 "data"
-] [
-.BI \-h\0 "defs"
-] [
-.BI \-i\0 "ident"
-]
-.if n .ti +5n
-[
-.BI \-m\0 "messages"
-] [
-.BI \-n\0 "name"
-]
-.I file \.\.\.
-.SH AVAILABILITY
-SUNWonld
-.SH DESCRIPTION
-\f3sgsmsg\f1 generates several message files from an input string definition
-\f2file\f1.  \f3sgsmsg\f1 provides a flexible, centralized, mechanism
-of collecting character strings within a code group such as an executable or
-shared object.  All character strings are captured into a single data array
-within the \f2data\f1 file.
-The data array is similar to that produced by
-.BR xstr (1)),
-and helps reduce the relocation overhead incurred by string pointers.
-.LP
-Indexes into the data array are generated as
-definitions within the \f2defs\f1 file. The code group can reference each
-character string via predefined macros.
-.LP
-The character strings may also be translated into an internationalized
-format and captured in the
-\f2messages\f1 file.  By default these message strings are suitable for
-.BR gettext (3I)
-manipulation.  The \f3\-c\f1 option provides for these message strings to be
-translated into a form suitable for
-.BR catgets (3C)
-manipulation.
-.SH OPERANDS
-.LP
-One of more input \f2file\f1s contains a definition for each character
-string used by a particular code group.  The interpretation of a
-definition is determined by the first character of each line within
-the input \f2file\f1:
-.LP
-.PD 0
-.RS +4
-.IP \(bu 3
-Entries that begin with a \f3#\fI, \f3$\f1 or a newline are treated as
-comments and are copied (as is) to the \f2messages\f1 file.
-.IP \(bu 3
-Entries that begin with a \f3@\f1 are translated and will be written to
-one or more of the output files. Two translations are possible dependent upon
-whether one or more tokens follow the \f3@\f1 character.
-.RE
-.PD
-.sp
-.LP
-An \f4@\f1 character followed by a single token is interpreted as one of
-two reserved message output
-\f2indicators\f1, or a message \f2identifier\f1.  The reserved output
-indicator \f4_START_\f1 enables output to the \f2messages\f1 file (note that
-the occurrence of any \f4@\f1 token will also enable message output).
-The reserved output indicator \f4_END_\f1 disables output to the
-\f2messages\f1 file.  These two indicators provides a means of isolating
-only those character strings that require translation into the \f2messages\f1
-file.
-.LP
-Besides the reserved output indicators, an \f4@\f1 character followed by a
-single token is taken to be a
-message \f2identifier\f1. This identifier will be translated into a
-\f2domain\f1 name for
-.BR gettext (3I)
-output, or a \f2setid\f1 for
-.BR catgets (3C)
-output.  This translated value is determine by substituting the message
-\f2identifier\f1 token
-for the associated definition from in the \f2ident\f1 file. Note that
-a message \f2identifier\f1 is required for
-.BR catgets (3C)
-use but is optional for
-.BR gettext (3I).
-.LP
-An \f4@\f1 character followed by multiple tokens is taken to be a
-string \f2definition\f1 followed by a quoted character string. Character
-strings can be continued over multiple lines by ending the preceding
-line with a backslash - all initial whitespace on the continuation line will
-is ignored. Character strings can contain the escape sequences
-.B \en
-for newline,
-.B \et
-for tab,
-.B \ev
-for vertical tab,
-.B \eb
-for backspace,
-.B \er
-for carriage return,
-.B \ef
-for formfeed,
-.B \e\e
-for backslash, and
-\e"
-for double quote.
-.LP
-The character string is copied to the \f2data\f1 array
-and an index into this array is generated as the \f2definition\f1 within
-the string
-\f2defs\f1 file. The character string is also translated to the appropriate
-message format and written to the \f2messages\f1 file.
-.SH OPTIONS
-.TP 12
-.B \-c
-By default, strings generated in the \f2messages\f1 file are suitable for
-.BR msgfmt (1)
-processing, which provides for message extraction via
-.BR gettext (3I).
-This option causes the formatting of the message strings to be suitable for
-.BR gencat (1)
-processing, which provides for message extraction via
-.BR catgets (3C).
-.TP
-.BI \-d\0 data
-Specify a \f2data\f1 file is to be created.
-This file contains a single data array, by default named (\f2__name\f1[]),
-containing all the strings
-defined in the string definition \f2file\f1.
-.TP
-.BI \-h\0 defs
-Specify a \f2defs\f1 file is to be created.
-This file contains definitions for each character string contained in
-the data array within the \f2data\f1 file.  These definitions represent
-offsets in the data array for each string.  Reference to individual strings
-should use one of the two defined macros \f4MSG_INTL\f1 (which specifies
-a user defined message extraction function), or \f4MSG_ORIG\f1
-(which specifies a direct access to the \f2__name\f1[] array).
-.TP
-.BI \-i\0 ident
-Specify an \f2ident\f1 file from which to interpret a message identifier
-token.
-.TP
-.B \-l
-Indicate that the \f2data\f1 array be defined local (\f2static\f1).  This
-is useful for establishing individual string arrays on a per-object basis.
-.TP
-.BI \-m\0 messages
-Specify a \f2messages\f1 file is to be created. This
-contain message strings suitable for delivery to a localization group.
-.TP
-.BI \-n\0 name
-Specify an alternative interface \f2name\f1. This name is used to label
-the message data array (\f2__name\f1[]) and the user defined message
-extraction function (const char * \f2_name\f1(int)) which will interface
-with this array.
-.SH EXAMPLES
-The following examples provide a simplified guide to using the \f3sgsmsg\fP
-command, including sample input files and generated output files.
-.LP
-The following \f2ident\f1 file provides message \f2identifiers\f1 for
-the link-editor utilities
-.BR ld (1),
-.BR libld.so.2 ,
-and
-.BR liblddbg.so.3 .
-These identifiers are referenced from the input string definition files
-of the respective code groups:
-.if n .ta 1.8i 2.2i
-.if t .ta 1.6i 2.2i
-.RS
-.nf
-.ft 3
-
-% cat sgs.ident
-.ft 1
-.if t .sp 0.35
-.if n .sp
-# mesgid	setid	domain
-.if t .sp 0.35
-.if n .sp
-MSG_ID_LD	1	SUNW_OST_SGS
-MSG_ID_LIBLD	2	SUNW_OST_SGS
-MSG_ID_LIBLDDBG	3	SUNW_OST_SGS
-
-.fi
-.RE
-.if t .bp
-.LP
-The following string definition \f2file\f1 defines a small number of
-strings used by
-.BR libld.so.2 :
-.ta 2.2i
-.RS
-.nf
-.ft 3
-
-% cat libld.msg
-.ft 1
-.if t .sp 0.35
-.if n .sp
-# ident "%Z%%M% %I%    %E% SMI"
-.if t .sp 0.35
-.if n .sp
-@ _START_
-.if t .sp 0.35
-.if n .sp
-# Message file for cmd/sgs/libld.
-.if t .sp 0.35
-.if n .sp
-@ MSG_ID_LIBLD
-
-# System call messages
-.if t .sp 0.35
-.if n .sp
-@ MSG_SYS_OPEN	"file %s: cannot open file: %s"
-@ MSG_SYS_MMAP	"file %s: cannot mmap file: %s"
-
-# Symbol processing errors
-.if t .sp 0.35
-.if n .sp
-@ MSG_SYM_DIFFTYPE	"symbol `%s' has differing types:"
-@ MSG_SYM_DIFFATTR	"symbol `%s' has differing %s:\\n\\
-		\ \\t(file %s value=0x%x; file %s value=0x%x);"
-.if t .sp 0.35
-.if n .sp
-@ _END_
-
-# The following strings represent reserved names.  Reference to
-# these strings is via the MSG_ORIG() macro, and thus no
-# translations are required.
-.if t .sp 0.35
-.if n .sp
-@ MSG_STR_EMPTY	""
-@ MSG_PTH_DEVZERO	"/dev/zero"
-@ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
-
-.fi
-.RE
-.LP
-Using the above input files, the following string and message data files can be
-generated:
-.if t .ta 0.5i 2.2i
-.if n .ta 0.5i 0.8i 3.0i
-.RS
-.nf
-.ft 3
-
-% sgsmsg\ \ \-i sgs.ident\ \ \-m\ messages\ \ \-d\ msg.c\ \ \-h\ msg.h \\
-\ \ \ \ \-n\ libld_msg\ \ libld.msg
-% cat msg.c
-.ft 1
-.if t .sp 0.35
-.if n .sp
-const char __libld_msg[] = { 0x00,
-	0x66,  0x69,  0x6c,  0x65,  0x20,  0x25,  0x73,  0x3a,  \.\.\.\.
-	0x61,  0x6e,  0x6e,  0x6f,  0x74,  0x20,  0x6f,  0x70,  \.\.\.\.
-	\.\.\.\.
-	0x00
-};
-
-.if t .bp
-.ft 3
-% cat msg.h
-.ft 1
-.if t .sp 0.35
-.if n .sp
-extern	const char	__libld_msg[];
-.if t .sp 0.35
-.if n .sp
-#define	MSG_ORIG(x)	&__libld_msg[x]
-.if t .sp 0.35
-.if n .sp
-extern	const char *	_libld_msg(int);
-.if t .sp 0.35
-.if n .sp
-#define	MSG_INTL(x)	_libld_msg(x)
-.if t .sp 0.35
-.if n .sp
-#define	MSG_SYS_OPEN	1
-#define	MSG_SYS_MMAP	31
-#define	MSG_SYM_DIFFTYPE	61
-#define	MSG_SYM_DIFFATTR	94
-#define	MSG_STR_EMPTY	167
-#define	MSG_PTH_DEVZERO	168
-#define	MSG_SUNW_OST_SGS	178
-
-.ft 3
-% cat messages
-.ft 1
-.if t .sp 0.35
-.if n .sp
-# Message file for cmd/sgs/libld.
-.if t .sp 0.35
-.if n .sp
-domain  "SUNW_OST_SGS"
-.if t .sp 0.35
-.if n .sp
-# System call messages
-.if t .sp 0.35
-.if n .sp
-msgid	"file %s: cannot open file: %s"
-msgstr	""
-msgid	"file %s: cannot mmap file: %s"
-msgstr	""
-.if t .sp 0.35
-.if n .sp
-# Symbol processing errors
-.if t .sp 0.35
-.if n .sp
-msgid	"symbol `%s' has differing types:"
-msgstr	""
-msgid	"symbol `%s' has differing %s:\\n\\t(file %s value=0x%x; file %s value=0x%x);"
-msgstr  ""
-
-.fi
-.RE
-.LP
-References to the string data from the code group
-should use one of the two defined macros
-depending upon whether an original or localized string is required.
-For example, the simple
-.BR open (2)
-of a file would use the original string, however its associated
-error message should be localized:
-.if n .ta 0.75i
-.if t .ta 0.5i 2.2i
-.RS
-.nf
-.ft 3
-
-const char * file = MSG_ORIG(MSG_PTH_DEVZERO);
-.if t .sp 0.35
-.if n .sp
-if ((fd = open(file, O_RDWR, 0)) == -1) {
-	int err = errno;
-	(void) fprintf(stderr, MSG_INTL(MSG_SYS_OPEN), file,
-	    strerror(err));
-	return (1);
-}
-
-.fi
-.RE
-.if t .bp
-.LP
-The \f3MSG_INTL\f1 definition provides for a user defined message
-extraction function
-that allows the greatest flexibility in providing an objects localization.
-Normally this interface is quite simple.  For a code group that resides
-in a shared object the following interface can be provided by the user:
-.RS
-.nf
-.ft 3
-
-extern char * _dgettext(const char *, const char *);
-.if t .sp 0.35
-.if n .sp
-const char *
-_libld_msg(int mid)
-{
-	return (_dgettext(MSG_ORIG(MSG_SUNW_OST_SGS),
-	    MSG_ORIG(mid)));
-}
-
-.fi
-.RE
-.LP
-For a code group that resides in an executable the following interface,
-and initialization can be provided by the user:
-.RS
-.nf
-.ft 3
-
-#include <locale.h>
-
-int
-main(int argc, char ** argv)
-{
-	\&\.\.\.\.\.\.
-	(void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY));
-	(void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS));
-	\&\.\.\.\.\.\.
-}
-
-const char *
-_ld_msg(int mid)
-{
-	return (gettext(MSG_ORIG(mid)));
-}
-.sp
-.SH "EXIT STATUS"
-A non-zero error return indicates a processing error.
-.RE
-.PD
-.SH "SEE ALSO"
-.BR gencat (1),
-.BR ld (1),
-.BR msgfmt (1),
-.BR catgets (3C),
-.BR gettext (3I).
-.br
-.TZ LLM
-.if n .tr \-\-
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/sgsmsg/sgsmsg.1onbld	2019-07-14 19:12:43.127701559 +0000
@@ -0,0 +1,426 @@
+.\" 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
+.\"
+.if n .tr \--
+.TH sgsmsg 1ONBLD "Jun 2, 1999"
+.SH NAME
+sgsmsg \- generate message strings for SGS subsystem.
+.SH SYNOPSIS
+.B sgsmsg
+[
+.B \-cl
+] [
+.BI \-d\0 "data"
+] [
+.BI \-h\0 "defs"
+] [
+.BI \-i\0 "ident"
+]
+.if n .ti +5n
+[
+.BI \-m\0 "messages"
+] [
+.BI \-n\0 "name"
+]
+.I file \.\.\.
+.SH AVAILABILITY
+SUNWonld
+.SH DESCRIPTION
+\f3sgsmsg\f1 generates several message files from an input string definition
+\f2file\f1.  \f3sgsmsg\f1 provides a flexible, centralized, mechanism
+of collecting character strings within a code group such as an executable or
+shared object.  All character strings are captured into a single data array
+within the \f2data\f1 file.
+The data array is similar to that produced by
+.BR xstr (1)),
+and helps reduce the relocation overhead incurred by string pointers.
+.LP
+Indexes into the data array are generated as
+definitions within the \f2defs\f1 file. The code group can reference each
+character string via predefined macros.
+.LP
+The character strings may also be translated into an internationalized
+format and captured in the
+\f2messages\f1 file.  By default these message strings are suitable for
+.BR gettext (3I)
+manipulation.  The \f3\-c\f1 option provides for these message strings to be
+translated into a form suitable for
+.BR catgets (3C)
+manipulation.
+.SH OPERANDS
+One of more input \f2file\f1s contains a definition for each character
+string used by a particular code group.  The interpretation of a
+definition is determined by the first character of each line within
+the input \f2file\f1:
+.LP
+.PD 0
+.RS +4
+.IP \(bu 3
+Entries that begin with a \f3#\fI, \f3$\f1 or a newline are treated as
+comments and are copied (as is) to the \f2messages\f1 file.
+.IP \(bu 3
+Entries that begin with a \f3@\f1 are translated and will be written to
+one or more of the output files. Two translations are possible dependent upon
+whether one or more tokens follow the \f3@\f1 character.
+.RE
+.PD
+.sp
+.LP
+An \f4@\f1 character followed by a single token is interpreted as one of
+two reserved message output
+\f2indicators\f1, or a message \f2identifier\f1.  The reserved output
+indicator \f4_START_\f1 enables output to the \f2messages\f1 file (note that
+the occurrence of any \f4@\f1 token will also enable message output).
+The reserved output indicator \f4_END_\f1 disables output to the
+\f2messages\f1 file.  These two indicators provides a means of isolating
+only those character strings that require translation into the \f2messages\f1
+file.
+.LP
+Besides the reserved output indicators, an \f4@\f1 character followed by a
+single token is taken to be a
+message \f2identifier\f1. This identifier will be translated into a
+\f2domain\f1 name for
+.BR gettext (3I)
+output, or a \f2setid\f1 for
+.BR catgets (3C)
+output.  This translated value is determine by substituting the message
+\f2identifier\f1 token
+for the associated definition from in the \f2ident\f1 file. Note that
+a message \f2identifier\f1 is required for
+.BR catgets (3C)
+use but is optional for
+.BR gettext (3I).
+.LP
+An \f4@\f1 character followed by multiple tokens is taken to be a
+string \f2definition\f1 followed by a quoted character string. Character
+strings can be continued over multiple lines by ending the preceding
+line with a backslash - all initial whitespace on the continuation line will
+is ignored. Character strings can contain the escape sequences
+.B \en
+for newline,
+.B \et
+for tab,
+.B \ev
+for vertical tab,
+.B \eb
+for backspace,
+.B \er
+for carriage return,
+.B \ef
+for formfeed,
+.B \e\e
+for backslash, and
+\e"
+for double quote.
+.LP
+The character string is copied to the \f2data\f1 array
+and an index into this array is generated as the \f2definition\f1 within
+the string
+\f2defs\f1 file. The character string is also translated to the appropriate
+message format and written to the \f2messages\f1 file.
+.SH OPTIONS
+.TP 12
+.B \-c
+By default, strings generated in the \f2messages\f1 file are suitable for
+.BR msgfmt (1)
+processing, which provides for message extraction via
+.BR gettext (3I).
+This option causes the formatting of the message strings to be suitable for
+.BR gencat (1)
+processing, which provides for message extraction via
+.BR catgets (3C).
+.TP
+.BI \-d\0 data
+Specify a \f2data\f1 file is to be created.
+This file contains a single data array, by default named (\f2__name\f1[]),
+containing all the strings
+defined in the string definition \f2file\f1.
+.TP
+.BI \-h\0 defs
+Specify a \f2defs\f1 file is to be created.
+This file contains definitions for each character string contained in
+the data array within the \f2data\f1 file.  These definitions represent
+offsets in the data array for each string.  Reference to individual strings
+should use one of the two defined macros \f4MSG_INTL\f1 (which specifies
+a user defined message extraction function), or \f4MSG_ORIG\f1
+(which specifies a direct access to the \f2__name\f1[] array).
+.TP
+.BI \-i\0 ident
+Specify an \f2ident\f1 file from which to interpret a message identifier
+token.
+.TP
+.B \-l
+Indicate that the \f2data\f1 array be defined local (\f2static\f1).  This
+is useful for establishing individual string arrays on a per-object basis.
+.TP
+.BI \-m\0 messages
+Specify a \f2messages\f1 file is to be created. This
+contain message strings suitable for delivery to a localization group.
+.TP
+.BI \-n\0 name
+Specify an alternative interface \f2name\f1. This name is used to label
+the message data array (\f2__name\f1[]) and the user defined message
+extraction function (const char * \f2_name\f1(int)) which will interface
+with this array.
+.SH EXAMPLES
+The following examples provide a simplified guide to using the \f3sgsmsg\fP
+command, including sample input files and generated output files.
+.LP
+The following \f2ident\f1 file provides message \f2identifiers\f1 for
+the link-editor utilities
+.BR ld (1),
+.BR libld.so.2 ,
+and
+.BR liblddbg.so.3 .
+These identifiers are referenced from the input string definition files
+of the respective code groups:
+.if n .ta 1.8i 2.2i
+.if t .ta 1.6i 2.2i
+.RS
+.nf
+.ft 3
+
+% cat sgs.ident
+.ft 1
+.if t .sp 0.35
+.if n .sp
+# mesgid	setid	domain
+.if t .sp 0.35
+.if n .sp
+MSG_ID_LD	1	SUNW_OST_SGS
+MSG_ID_LIBLD	2	SUNW_OST_SGS
+MSG_ID_LIBLDDBG	3	SUNW_OST_SGS
+
+.fi
+.RE
+.if t .bp
+.LP
+The following string definition \f2file\f1 defines a small number of
+strings used by
+.BR libld.so.2 :
+.ta 2.2i
+.RS
+.nf
+.ft 3
+
+% cat libld.msg
+.ft 1
+.if t .sp 0.35
+.if n .sp
+@ _START_
+.if t .sp 0.35
+.if n .sp
+# Message file for cmd/sgs/libld.
+.if t .sp 0.35
+.if n .sp
+@ MSG_ID_LIBLD
+
+# System call messages
+.if t .sp 0.35
+.if n .sp
+@ MSG_SYS_OPEN	"file %s: cannot open file: %s"
+@ MSG_SYS_MMAP	"file %s: cannot mmap file: %s"
+
+# Symbol processing errors
+.if t .sp 0.35
+.if n .sp
+@ MSG_SYM_DIFFTYPE	"symbol `%s' has differing types:"
+@ MSG_SYM_DIFFATTR	"symbol `%s' has differing %s:\\n\\
+		\ \\t(file %s value=0x%x; file %s value=0x%x);"
+.if t .sp 0.35
+.if n .sp
+@ _END_
+
+# The following strings represent reserved names.  Reference to
+# these strings is via the MSG_ORIG() macro, and thus no
+# translations are required.
+.if t .sp 0.35
+.if n .sp
+@ MSG_STR_EMPTY	""
+@ MSG_PTH_DEVZERO	"/dev/zero"
+@ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
+
+.fi
+.RE
+.LP
+Using the above input files, the following string and message data files can be
+generated:
+.if t .ta 0.5i 2.2i
+.if n .ta 0.5i 0.8i 3.0i
+.RS
+.nf
+.ft 3
+
+% sgsmsg\ \ \-i sgs.ident\ \ \-m\ messages\ \ \-d\ msg.c\ \ \-h\ msg.h \\
+\ \ \ \ \-n\ libld_msg\ \ libld.msg
+% cat msg.c
+.ft 1
+.if t .sp 0.35
+.if n .sp
+const char __libld_msg[] = { 0x00,
+	0x66,  0x69,  0x6c,  0x65,  0x20,  0x25,  0x73,  0x3a,  \.\.\.\.
+	0x61,  0x6e,  0x6e,  0x6f,  0x74,  0x20,  0x6f,  0x70,  \.\.\.\.
+	\.\.\.\.
+	0x00
+};
+
+.if t .bp
+.ft 3
+% cat msg.h
+.ft 1
+.if t .sp 0.35
+.if n .sp
+extern	const char	__libld_msg[];
+.if t .sp 0.35
+.if n .sp
+#define	MSG_ORIG(x)	&__libld_msg[x]
+.if t .sp 0.35
+.if n .sp
+extern	const char *	_libld_msg(int);
+.if t .sp 0.35
+.if n .sp
+#define	MSG_INTL(x)	_libld_msg(x)
+.if t .sp 0.35
+.if n .sp
+#define	MSG_SYS_OPEN	1
+#define	MSG_SYS_MMAP	31
+#define	MSG_SYM_DIFFTYPE	61
+#define	MSG_SYM_DIFFATTR	94
+#define	MSG_STR_EMPTY	167
+#define	MSG_PTH_DEVZERO	168
+#define	MSG_SUNW_OST_SGS	178
+
+.ft 3
+% cat messages
+.ft 1
+.if t .sp 0.35
+.if n .sp
+# Message file for cmd/sgs/libld.
+.if t .sp 0.35
+.if n .sp
+domain  "SUNW_OST_SGS"
+.if t .sp 0.35
+.if n .sp
+# System call messages
+.if t .sp 0.35
+.if n .sp
+msgid	"file %s: cannot open file: %s"
+msgstr	""
+msgid	"file %s: cannot mmap file: %s"
+msgstr	""
+.if t .sp 0.35
+.if n .sp
+# Symbol processing errors
+.if t .sp 0.35
+.if n .sp
+msgid	"symbol `%s' has differing types:"
+msgstr	""
+msgid	"symbol `%s' has differing %s:\\n\\t(file %s value=0x%x; file %s value=0x%x);"
+msgstr  ""
+
+.fi
+.RE
+.LP
+References to the string data from the code group
+should use one of the two defined macros
+depending upon whether an original or localized string is required.
+For example, the simple
+.BR open (2)
+of a file would use the original string, however its associated
+error message should be localized:
+.if n .ta 0.75i
+.if t .ta 0.5i 2.2i
+.RS
+.nf
+.ft 3
+
+const char * file = MSG_ORIG(MSG_PTH_DEVZERO);
+.if t .sp 0.35
+.if n .sp
+if ((fd = open(file, O_RDWR, 0)) == -1) {
+	int err = errno;
+	(void) fprintf(stderr, MSG_INTL(MSG_SYS_OPEN), file,
+	    strerror(err));
+	return (1);
+}
+
+.fi
+.RE
+.if t .bp
+.LP
+The \f3MSG_INTL\f1 definition provides for a user defined message
+extraction function
+that allows the greatest flexibility in providing an objects localization.
+Normally this interface is quite simple.  For a code group that resides
+in a shared object the following interface can be provided by the user:
+.RS
+.nf
+.ft 3
+
+extern char * _dgettext(const char *, const char *);
+.if t .sp 0.35
+.if n .sp
+const char *
+_libld_msg(int mid)
+{
+	return (_dgettext(MSG_ORIG(MSG_SUNW_OST_SGS),
+	    MSG_ORIG(mid)));
+}
+
+.fi
+.RE
+.LP
+For a code group that resides in an executable the following interface,
+and initialization can be provided by the user:
+.RS
+.nf
+.ft 3
+
+#include <locale.h>
+
+int
+main(int argc, char ** argv)
+{
+	\&\.\.\.\.\.\.
+	(void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY));
+	(void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS));
+	\&\.\.\.\.\.\.
+}
+
+const char *
+_ld_msg(int mid)
+{
+	return (gettext(MSG_ORIG(mid)));
+}
+.RE
+.sp
+.SH "EXIT STATUS"
+A non-zero error return indicates a processing error.
+.PD
+.SH "SEE ALSO"
+.BR gencat (1),
+.BR ld (1),
+.BR msgfmt (1),
+.BR catgets (3C),
+.BR gettext (3C).
+.if n .tr \-\-
--- old/usr/src/cmd/sgs/tools/common/sgsmsg.c	2019-07-14 19:12:43.895024828 +0000
+++ /dev/null	2019-07-14 19:12:42.000000000 +0000
@@ -1,1237 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- * sgsmsg generates several message files from an input template file.  Messages
- * are constructed for use with gettext(3i) - the default - or catgets(3c).  The
- * files generate are:
- *
- * msg.h	a header file containing definitions for each message.  The -h
- *		option triggers the creation of these definitions and specifies
- *		the name to use.
- *
- * msg.c	a data array of message strings.  The msg.h definitions are
- *		offsets into this array.  The -d option triggers the creation of
- *		these definitions and specifies the name to use.
- *
- * messages	a message file suitable for catgets(3c) or gettext(3i) use.  The
- *		-m option triggers this output and specifies the filename to be
- *		used.
- *
- * The template file is processed based on the first character of each line:
- *
- * # or $	entries are copied (as is) to the message file (messages).
- *
- * @ token(s)	entries are translated.  Two translations are possible dependent
- *		on whether one or more tokens are supplied:
- *
- *		A single token is interpreted as one of two reserved message
- *		output indicators, or a message identifier.  The reserved output
- *		indicator _START_ enables output to the message file - Note that
- *		the occurance of any other @ token will also enable message
- *		output.  The reserved output indicator _END_ disables output to
- *		the message file.  The use of these two indicators provides for
- *		only those message strings that require translation to be output
- *		to the message file.
- *
- *		Besides the reserved output indicators, a single token is taken
- *		to be a message identifier which will be subsituted for a
- *		`setid' for catgets(3c) output, or a `domain' name for
- *		gettext(3i) output.  This value is determine by substituting the
- *		token for the associated definition found in the message
- *		identifier file (specified with the -i option).
- *
- *		Multiple tokens are taken to be a message definition followed by
- *		the associated message string.  The message string is copied to
- *		the data array being built in msg.c.  The index into this array
- *		becomes the `message' identifier created in the msg.h file.
- */
-
-#include	<fcntl.h>
-#include	<stdlib.h>
-#include	<stdio.h>
-#include	<unistd.h>
-#include	<limits.h>
-#include	<string.h>
-#include	<ctype.h>
-#include	<errno.h>
-#include	<sys/param.h>
-
-#include	<sgs.h>
-#include	<_string_table.h>
-
-/*
- * Define any error message strings.
- */
-static const char
-	* Errmsg_malt =	"sgsmsg: file %s: line %d: malformed input "
-			"at line\n",
-	* Errmsg_nmem =	"sgsmsg: memory allocation failed: %s\n",
-	* Errmsg_opne =	"sgsmsg: file %s: open failed: %s\n",
-	* Errmsg_wrte =	"sgsmsg: file %s: write failed: %s\n",
-	* Errmsg_read =	"sgsmsg: file %s: read failed %s\n",
-	* Errmsg_stnw =	"sgsmsg: st_new(): failed: %s\n",
-	* Errmsg_stin =	"sgsmsg: Str_tbl insert failed: %s\n",
-	* Errmsg_mnfn =	"sgsmsg: message not found in Str_tbl: %s\n",
-	* Errmsg_use  =	"usage: sgsmsg [-clv] [-d mesgdata] [-h mesgdefs] "
-			"[-m messages] [-n name] [-i mesgident] file ...\n";
-
-/*
- * Define all output filenames and associated descriptors.
- */
-static FILE	*fddefs, *fddata, *fdmsgs, *fdmids, *fddesc;
-static char	*fldefs, *fldata, *flmsgs, *flmids, *fldesc;
-static FILE	*fdlint;
-static char	fllint[MAXPATHLEN];
-
-static uint_t		vflag;	/* verbose flag */
-static Str_tbl		*stp;	/* string table */
-
-/*
- * Define any default strings.
- */
-static const char
-	*nmlint =	"/tmp/sgsmsg.lint",
-	*interface =	"sgs_msg",
-	*start =	"_START_",
-	*end =		"_END_";
-
-/*
- * Define any default flags and data items.
- */
-static int	cflag = 0, lflag = 0, prtmsgs = 0, line, ptr = 1, msgid = 0;
-static char	*mesgid = 0, *setid = 0, *domain = 0;
-
-typedef struct msg_string {
-	char			*ms_defn;
-	char			*ms_message;
-	struct msg_string	*ms_next;
-} msg_string;
-
-static msg_string	*msg_head;
-static msg_string	*msg_tail;
-
-/*
- * message_append() is responsible for both inserting strings into
- * the master Str_tbl as well as maintaining a list of the
- * DEFINITIONS associated with each string.
- *
- * The list of strings is traversed at the end once the full
- * Str_tbl has been constructed - and string offsets can be
- * assigned.
- */
-static void
-message_append(const char *defn, const char *message)
-{
-	msg_string	*msg;
-	if ((msg = calloc(sizeof (msg_string), 1)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		exit(1);
-	}
-
-	/*
-	 * Initialize the string table.
-	 */
-	if ((stp == 0) && ((stp = st_new(FLG_STNEW_COMPRESS)) == NULL)) {
-		(void) fprintf(stderr, Errmsg_stnw, strerror(errno));
-		exit(1);
-	}
-
-
-	if ((msg->ms_defn = strdup(defn)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		exit(1);
-	}
-	if ((msg->ms_message = strdup(message)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		exit(1);
-	}
-
-	if (st_insert(stp, msg->ms_message) == -1) {
-		(void) fprintf(stderr, Errmsg_stin,
-		    message);
-		exit(1);
-	}
-
-	if (msg_head == 0) {
-		msg_head = msg_tail = msg;
-		return;
-	}
-	msg_tail->ms_next = msg;
-	msg_tail = msg;
-}
-
-/*
- * Initialize a setid value.  Given a setid definition determine its numeric
- * value from the specified message identifier file (specified with the -i
- * option).  Return a pointer to the numeric string.
- */
-static int
-getmesgid(char *id)
-{
-	char	*buffer, *token, *_mesgid = 0, *_setid = 0, *_domain = 0;
-
-	/*
-	 * If we're being asked to interpret a message id but the user didn't
-	 * provide the required message identifier file (-i option) we're in
-	 * trouble.
-	 */
-	if (flmids == 0) {
-		(void) fprintf(stderr, "sgsmsg: file %s: line %d: mesgid %s: "
-		    "unable to process mesgid\n\t"
-		    "no message identifier file specified "
-		    "(see -i option)\n", fldesc, line, id);
-		return (1);
-	}
-
-	if ((buffer = malloc(LINE_MAX)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * Read the message identifier file and locate the required mesgid.
-	 */
-	rewind(fdmids);
-	while (fgets(buffer, LINE_MAX, fdmids) != NULL) {
-		if ((token = strstr(buffer, id)) == NULL)
-			continue;
-
-		/*
-		 * Establish individual strings for the mesgid, setid and domain
-		 * values.
-		 */
-		_mesgid = token;
-		while (!(isspace(*token)))
-			token++;
-		*token++ = 0;
-
-		while (isspace(*token))
-			token++;
-		_setid = token;
-		while (!(isspace(*token)))
-			token++;
-		*token++ = 0;
-
-		while (isspace(*token))
-			token++;
-		_domain = token;
-		while (!(isspace(*token)))
-			token++;
-		*token = 0;
-		break;
-	}
-
-	/*
-	 * Did we find a match?
-	 */
-	if ((_mesgid == 0) || (_setid == 0) || (_domain == 0)) {
-		(void) fprintf(stderr, "sgsmsg: file %s: line %d: mesgid %s: "
-		    "unable to process mesgid\n\t"
-		    "identifier does not exist in file %s\n",
-		    fldesc, line, id, flmids);
-		return (1);
-	}
-
-	/*
-	 * Have we been here before?
-	 */
-	if (mesgid) {
-		if (cflag == 1) {
-			/*
-			 * If we're being asked to process more than one mesgid
-			 * warn the user that only one mesgid can be used for
-			 * the catgets(3c) call.
-			 */
-			(void) fprintf(stderr, "sgsmsg: file %s: line %d: "
-			    "setid %s: warning: multiple mesgids "
-			    "encountered\n\t"
-			    "last setting used in messaging code\n",
-			    fldesc, line, id);
-		}
-	}
-
-	mesgid = _mesgid;
-	setid = _setid;
-	domain = _domain;
-
-	/*
-	 * Generate the message file output (insure output flag is enabled).
-	 */
-	if (prtmsgs != -1)
-		prtmsgs = 1;
-	if (fdmsgs && (prtmsgs == 1)) {
-		if (cflag == 1) {
-			if (fprintf(fdmsgs, "$quote \"\n$set %s\n",
-			    setid) < 0) {
-				(void) fprintf(stderr, Errmsg_wrte, flmsgs,
-				    strerror(errno));
-				return (1);
-			}
-		} else {
-			if (fprintf(fdmsgs, "domain\t\"%s\"\n", domain) < 0) {
-				(void) fprintf(stderr, Errmsg_wrte, flmsgs,
-				    strerror(errno));
-				return (1);
-			}
-		}
-	}
-
-	/*
-	 * For catgets(3c) output generate a setid definition in the message
-	 * definition file.
-	 */
-	if (fddefs && (cflag == 1) &&
-	    (fprintf(fddefs, "#define\t%s\t%s\n\n", mesgid, setid) < 0)) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	return (0);
-}
-
-/*
- * Dump contents of String Table to standard out
- */
-static void
-dump_stringtab(Str_tbl *stp)
-{
-	uint_t	cnt;
-
-	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
-		(void) printf("string table full size: %ld: uncompressed\n",
-		    stp->st_fullstrsize);
-		return;
-	}
-
-	(void) printf("string table full size: %ld compressed down to: %ld\n\n",
-	    stp->st_fullstrsize, stp->st_strsize);
-	(void) printf("string table compression information [%d buckets]:\n",
-	    stp->st_hbckcnt);
-
-	for (cnt = 0; cnt < stp->st_hbckcnt; cnt++) {
-		Str_hash	*sthash = stp->st_hashbcks[cnt];
-
-		if (sthash == 0)
-			continue;
-
-		(void) printf(" bucket: [%d]\n", cnt);
-
-		while (sthash) {
-			size_t	stroff = sthash->hi_mstr->sm_strlen -
-			    sthash->hi_strlen;
-
-			if (stroff == 0) {
-				(void) printf("  [%ld]: '%s'  <master>\n",
-				    sthash->hi_refcnt, sthash->hi_mstr->sm_str);
-			} else {
-				(void) printf("  [%ld]: '%s'  <suffix of: "
-				    "'%s'>\n", sthash->hi_refcnt,
-				    &sthash->hi_mstr->sm_str[stroff],
-				    sthash->hi_mstr->sm_str);
-			}
-			sthash = sthash->hi_next;
-		}
-	}
-}
-
-/*
- * Initialize the message definition header file stream.
- */
-static int
-init_defs(void)
-{
-	static char	guard[FILENAME_MAX + 6];
-	char		*optr;
-	const char	*iptr, *_ptr;
-
-	/*
-	 * Establish a header guard name using the files basename.
-	 */
-	for (iptr = 0, _ptr = fldefs; _ptr && (*_ptr != '\0'); _ptr++) {
-		if (*_ptr == '/')
-			iptr = _ptr + 1;
-	}
-	if (iptr == 0)
-		iptr = fldefs;
-
-	optr = guard;
-	for (*optr++ = '_'; iptr && (*iptr != '\0'); iptr++, optr++) {
-		if (*iptr == '.') {
-			*optr++ = '_';
-			*optr++ = 'D';
-			*optr++ = 'O';
-			*optr++ = 'T';
-			*optr = '_';
-		} else
-			*optr = toupper(*iptr);
-	}
-
-	if (fprintf(fddefs, "#ifndef\t%s\n#define\t%s\n\n", guard, guard) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "#include <sgsmsg.h>\t/* Msg typedef */\n\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "#ifndef\t__lint\n\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * The MSG_SGS_ARRAY_NAME macro supplies a generic way to
-	 * reference the string table regardless of its name.
-	 */
-	if (fprintf(fddefs, "#define\tMSG_SGS_LOCAL_ARRAY\t__%s\n\n",
-	    interface) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * If the associated data array is global define a prototype.
-	 * Define a macro to access the array elements.
-	 */
-	if (lflag == 0) {
-		if (fprintf(fddefs, "extern\tconst char\t__%s[];\n\n",
-		    interface) < 0) {
-			(void) fprintf(stderr, Errmsg_wrte, fldefs,
-			    strerror(errno));
-			return (1);
-		}
-	}
-	if (fprintf(fddefs,
-	    "#define\tMSG_ORIG_STRTAB(_x, _s)\t&_s[_x]\n\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-	if (fprintf(fddefs,
-	    "#define\tMSG_ORIG(x)\tMSG_ORIG_STRTAB(x, __%s)\n\n",
-	    interface) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * Generate a prototype to access the associated data array.
-	 */
-	if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
-	    interface) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-	if (fprintf(fddefs, "#define\tMSG_INTL(x)\t_%s(x)\n\n",
-	    interface) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	return (0);
-}
-
-
-/*
- * Finish the message definition header file.
- */
-static int
-fini_defs(void)
-{
-	if (fprintf(fddefs, "\n#else\t/* __lint */\n\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
-	    interface) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "#ifndef MSG_SGS_LOCAL_ARRAY\n"
-	    "#define\tMSG_SGS_LOCAL_ARRAY\t\"\"\n#endif\n\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (lflag == 0) {
-		if (fprintf(fddefs, "extern\tconst char\t__%s[];\n\n",
-		    interface) < 0) {
-			(void) fprintf(stderr, Errmsg_wrte, fldefs,
-			    strerror(errno));
-			return (1);
-		}
-	}
-
-	if (fprintf(fddefs,
-	    "#define MSG_ORIG_STRTAB(_x, _s)\t_x\n"
-	    "#define MSG_ORIG(x)\tx\n#define MSG_INTL(x)\tx\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * Provide a way to get the array and function declarations above
-	 * without also getting the actual messages. This is useful in
-	 * our lintsup.c files that include more than one message header.
-	 * lintsup doesn't need the actual messages, and this prevents
-	 * macro name collisions.
-	 */
-	if (fprintf(fddefs, "\n#ifndef LINTSUP_SUPPRESS_STRINGS\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	/*
-	 * Copy the temporary lint defs file into the new header.
-	 */
-	if (fdlint) {
-		long	size;
-		char	*buf;
-
-		size = ftell(fdlint);
-		(void) rewind(fdlint);
-
-		if ((buf = malloc(size)) == 0) {
-			(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-			return (1);
-		}
-		if (fread(buf, size, 1, fdlint) == 0) {
-			(void) fprintf(stderr, Errmsg_read, fllint,
-			    strerror(errno));
-			return (1);
-		}
-		if (fwrite(buf, size, 1, fddefs) == 0) {
-			(void) fprintf(stderr, Errmsg_wrte, fldefs,
-			    strerror(errno));
-			return (1);
-		}
-		(void) free(buf);
-	}
-
-	if (fprintf(fddefs, "\n#endif\t/* LINTSUP_SUPPRESS_STRINGS */\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "\n#endif\t/* __lint */\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	if (fprintf(fddefs, "\n#endif\n") < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
-		return (1);
-	}
-
-	return (0);
-}
-
-/*
- * The entire messaging file has been scanned - and all strings have been
- * inserted into the string_table.  We can now walk the message queue
- * and create the '#define <DEFN>' for each string - with the strings
- * assigned offset into the string_table.
- */
-static int
-output_defs(void)
-{
-	msg_string	*msg;
-	size_t		stbufsize;
-	char		*stbuf;
-
-	stbufsize = st_getstrtab_sz(stp);
-	if ((stbuf = malloc(stbufsize)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		exit(1);
-	}
-	(void) st_setstrbuf(stp, stbuf, stbufsize);
-	for (msg = msg_head; msg; msg = msg->ms_next) {
-		size_t	stoff;
-		if ((st_setstring(stp, msg->ms_message, &stoff)) == -1) {
-			(void) fprintf(stderr, Errmsg_mnfn, msg->ms_message);
-			return (1);
-		}
-		if (fprintf(fddefs, "\n#define\t%s\t%ld\n",
-		    msg->ms_defn, stoff) < 0) {
-			(void) fprintf(stderr, Errmsg_wrte,
-			    fldefs, strerror(errno));
-			return (1);
-		}
-		if (fddefs && fprintf(fddefs, "#define\t%s_SIZE\t%d\n",
-		    msg->ms_defn, strlen(msg->ms_message)) < 0) {
-			(void) fprintf(stderr, Errmsg_wrte,
-			    fldefs, strerror(errno));
-			return (1);
-		}
-	}
-	return (0);
-}
-
-
-/*
- * Finish off the data structure definition.
- */
-static int
-output_data(void)
-{
-	size_t		stbufsize;
-	size_t		ndx;
-	size_t		column = 1;
-	const char	*stbuf;
-	const char	*fmtstr;
-
-	stbufsize = st_getstrtab_sz(stp);
-	stbuf = st_getstrbuf(stp);
-
-	assert(stbuf);
-
-	/*
-	 * Determine from the local flag whether the data declaration should
-	 * be static.
-	 */
-	if (lflag)
-		fmtstr = (const char *)"static const";
-	else
-		fmtstr = (const char *)"const";
-
-	if (fprintf(fddata, "\n%s char __%s[%ld] __attribute__((unused)) = { ",
-	    fmtstr, interface, stbufsize) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldata, strerror(errno));
-		return (1);
-	}
-
-	for (ndx = 0; ndx < (stbufsize - 1); ndx++) {
-		if (column == 1) {
-			if (fddata && fprintf(fddata,
-			    "\n/* %4ld */ 0x%.2x,", ndx,
-			    (unsigned char)stbuf[ndx]) < 0) {
-				(void) fprintf(stderr, Errmsg_wrte,
-				    fldata, strerror(errno));
-				return (1);
-			}
-		} else {
-			if (fddata && fprintf(fddata, "  0x%.2x,",
-			    (unsigned char)stbuf[ndx]) < 0) {
-				(void) fprintf(stderr, Errmsg_wrte,
-				    fldata, strerror(errno));
-				return (1);
-			}
-		}
-
-		if (column++ == 10)
-			column = 1;
-	}
-
-	if (column == 1)
-		fmtstr = "\n\t0x%.2x };\n";
-	else
-		fmtstr = "  0x%.2x };\n";
-
-	if (fprintf(fddata, fmtstr, (unsigned char)stbuf[stbufsize - 1]) < 0) {
-		(void) fprintf(stderr, Errmsg_wrte, fldata, strerror(errno));
-		return (1);
-	}
-
-	return (0);
-}
-
-static int
-file()
-{
-	char	buffer[LINE_MAX], * token;
-	uint_t	bufsize;
-	char	*token_buffer;
-	int	escape = 0;
-	int	len = 0;
-
-	if ((token_buffer = malloc(LINE_MAX)) == 0) {
-		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
-		return (1);
-	}
-	bufsize = LINE_MAX;
-
-	line = 1;
-
-	while ((token = fgets(buffer, LINE_MAX, fddesc)) != NULL) {
-		char	defn[PATH_MAX], * _defn, * str;
-
-		switch (*token) {
-		case '#':
-		case '$':
-			if (escape) {
-				(void) fprintf(stderr, Errmsg_malt, fldesc,
-				    line);
-				return (1);
-			}
-
-			/*
-			 * If a msgid has been output a msgstr must follow
-			 * before we digest the new token.  A msgid is only set
-			 * if fdmsgs is in use.
-			 */
-			if (msgid) {
-				msgid = 0;
-				if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    flmsgs, strerror(errno));
-					return (1);
-				}
-			}
-
-			/*
-			 * Pass lines directly through to the output message
-			 * file.
-			 */
-			if (fdmsgs && (prtmsgs == 1)) {
-				char	comment;
-
-				if (cflag == 0)
-					comment = '#';
-				else
-					comment = '$';
-
-				if (fprintf(fdmsgs, "%c%s", comment,
-				    ++token) < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    flmsgs, strerror(errno));
-					return (1);
-				}
-			}
-			break;
-
-		case '@':
-			if (escape) {
-				(void) fprintf(stderr, Errmsg_malt, fldesc,
-				    line);
-				return (1);
-			}
-
-			/*
-			 * If a msgid has been output a msgstr must follow
-			 * before we digest the new token.
-			 */
-			if (msgid) {
-				msgid = 0;
-				if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    flmsgs, strerror(errno));
-					return (1);
-				}
-			}
-
-			/*
-			 * Determine whether we have one or more tokens.
-			 */
-			token++;
-			while (isspace(*token))		/* rid any whitespace */
-				token++;
-			_defn = token;			/* definition start */
-			while (!(isspace(*token)))
-				token++;
-			*token++ = 0;
-
-			while (isspace(*token))		/* rid any whitespace */
-				token++;
-
-			/*
-			 * Determine whether the single token is one of the
-			 * reserved message output delimiters otherwise
-			 * translate it as a message identifier.
-			 */
-			if (*token == 0) {
-				if (strcmp(_defn, start) == 0)
-					prtmsgs = 1;
-				else if (strcmp(_defn, end) == 0)
-					prtmsgs = -1;
-				else if (getmesgid(_defn) == 1)
-					return (1);
-				break;
-			}
-
-			/*
-			 * Multiple tokens are translated by taking the first
-			 * token as the message definition, and the rest of the
-			 * line as the message itself.  A message line ending
-			 * with an escape ('\') is expected to be continued on
-			 * the next line.
-			 */
-			if (prtmsgs != -1)
-				prtmsgs = 1;
-			if (fdmsgs && (prtmsgs == 1)) {
-				/*
-				 * For catgets(3c) make sure a message
-				 * identifier has been established (this is
-				 * normally a domain for gettext(3i), but for
-				 * sgsmsg use this could be argued as being
-				 * redundent).  Also make sure that the message
-				 * definitions haven't exceeeded the maximum
-				 * value allowed by gencat(1) before generating
-				 * any message file entries.
-				 */
-				if (cflag == 1) {
-					if (setid == 0) {
-						(void) fprintf(stderr, "file "
-						    "%s: no message identifier "
-						    "has been established\n",
-						    fldesc);
-						return (1);
-					}
-					if (ptr	> NL_MSGMAX) {
-						(void) fprintf(stderr, "file "
-						    "%s: message definition "
-						    "(%d) exceeds allowable "
-						    "limit (NL_MSGMAX)\n",
-						    fldesc, ptr);
-						return (1);
-					}
-				}
-
-				/*
-				 * For catgets(3c) write the definition and the
-				 * message string to the message file.  For
-				 * gettext(3i) write the message string as a
-				 * mesgid - indicate a mesgid has been output
-				 * so that a msgstr can follow.
-				 */
-				if (cflag == 1) {
-					if (fprintf(fdmsgs, "%d\t%s", ptr,
-					    token) < 0) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, flmsgs,
-						    strerror(errno));
-						return (1);
-					}
-				} else {
-					if (fprintf(fdmsgs, "msgid\t\"") < 0) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, flmsgs,
-						    strerror(errno));
-						return (1);
-					}
-					msgid = 1;
-				}
-			}
-
-			/*
-			 * The message itself is a quoted string as this makes
-			 * embedding spaces at the start (or the end) of the
-			 * string very easy.
-			 */
-			if (*token != '"') {
-				(void) fprintf(stderr, Errmsg_malt, fldesc,
-				    line);
-				return (1);
-			}
-
-			(void) strcpy(defn, _defn);
-
-			/*
-			 * Write the tag to the lint definitions.
-			 */
-			if (fdlint) {
-				if (fprintf(fdlint, "\n#define\t%s\t",
-				    _defn) < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    fllint, strerror(errno));
-					return (1);
-				}
-			}
-
-			len = 0;
-
-			/*
-			 * Write each character of the message string to the
-			 * data array.  Translate any escaped characters - use
-			 * the same specially recognized characters as defined
-			 * by gencat(1).
-			 */
-message:
-			if (*token == '"') {
-				if (fdlint &&
-				    (fprintf(fdlint, "%c", *token) < 0)) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    fllint, strerror(errno));
-					return (1);
-				}
-				token++;
-			}
-			while (*token) {
-				char	_token;
-
-				if ((*token == '\\') && (escape == 0)) {
-					escape = 1;
-					if (fdlint && (*(token + 1) != '\n') &&
-					    fprintf(fdlint, "%c", *token) < 0) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, fllint,
-						    strerror(errno));
-						return (1);
-					}
-					token++;
-					continue;
-				}
-				if (escape) {
-					if (*token == 'n')
-						_token = '\n';
-					else if (*token == 't')
-						_token = '\t';
-					else if (*token == 'v')
-						_token = '\v';
-					else if (*token == 'b')
-						_token = '\b';
-					else if (*token == 'f')
-						_token = '\f';
-					else if (*token == '\\')
-						_token = '\\';
-					else if (*token == '"')
-						_token = '"';
-					else if (*token == '\n')
-						break;
-					else
-						_token = *token;
-
-					if (fdmsgs && (prtmsgs == 1) &&
-					    (fprintf(fdmsgs, "\\") < 0)) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, flmsgs,
-						    strerror(errno));
-						return (1);
-					}
-				} else {
-					/*
-					 * If this is the trailing quote then
-					 * thats the last of the message string.
-					 * Eat up any remaining white space and
-					 * unless an escape character is found
-					 * terminate the data string with a 0.
-					 */
-					/* BEGIN CSTYLED */
-					if (*token == '"') {
-					    if (fdlint && (fprintf(fdlint,
-						"%c", *token) < 0)) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, fllint,
-						    strerror(errno));
-						return (1);
-					    }
-
-					    if (fdmsgs && (prtmsgs == 1) &&
-						(fprintf(fdmsgs, "%c",
-						*token) < 0)) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, flmsgs,
-						    strerror(errno));
-						return (1);
-					    }
-
-					    while (*++token) {
-						if (*token == '\n')
-							break;
-					    }
-					    _token = '\0';
-					} else
-					    _token = *token;
-					/* END CSTYLED */
-				}
-
-				if (fdmsgs && (prtmsgs == 1) &&
-				    (fprintf(fdmsgs, "%c", *token) < 0)) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    flmsgs, strerror(errno));
-					return (1);
-				}
-
-				if (fdlint && fprintf(fdlint,
-				    "%c", *token) < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    fllint, strerror(errno));
-					return (1);
-				}
-
-				if (len >= bufsize) {
-					bufsize += LINE_MAX;
-					if ((token_buffer = realloc(
-					    token_buffer, bufsize)) == 0) {
-						(void) fprintf(stderr,
-						    Errmsg_nmem,
-						    strerror(errno));
-						return (1);
-					}
-				}
-				token_buffer[len] = _token;
-				ptr++, token++, len++;
-				escape = 0;
-
-				if (_token == '\0')
-					break;
-			}
-
-			/*
-			 * After the complete message string has been processed
-			 * (including its continuation beyond one line), create
-			 * a string size definition.
-			 */
-			if (escape == 0) {
-				const char *form = "#define\t%s_SIZE\t%d\n";
-
-				token_buffer[len] = '\0';
-
-				message_append(defn, token_buffer);
-
-				if (fdlint && fprintf(fdlint, form, defn,
-				    (len - 1)) < 0) {
-					(void) fprintf(stderr, Errmsg_wrte,
-					    fllint, strerror(errno));
-					return (1);
-				}
-			}
-			break;
-
-		default:
-			/*
-			 * Empty lines are passed through to the message file.
-			 */
-			while (isspace(*token))
-				token++;
-
-			if (*token == 0) {
-				if (msgid || (fdmsgs && (prtmsgs == 1))) {
-					/*
-					 * If a msgid has been output a msgstr
-					 * must follow before we digest the new
-					 * token.
-					 */
-					if (msgid) {
-						msgid = 0;
-						str = "msgstr\t\"\"\n\n";
-					} else
-						str = "\n";
-
-					if (fprintf(fdmsgs, str) < 0) {
-						(void) fprintf(stderr,
-						    Errmsg_wrte, flmsgs,
-						    strerror(errno));
-						return (1);
-					}
-				}
-				break;
-			}
-
-			/*
-			 * If an escape is in effect then any tokens are taken
-			 * to be message continuations.
-			 */
-			if (escape) {
-				escape = 0;
-				goto message;
-			}
-
-			(void) fprintf(stderr, "file %s: line %d: invalid "
-			    "input does not start with #, $ or @\n", fldesc,
-			    line);
-			return (1);
-		}
-		line++;
-	}
-
-	free(token_buffer);
-
-	return (0);
-}
-
-int
-main(int argc, char ** argv)
-{
-	opterr = 0;
-	while ((line = getopt(argc, argv, "cd:h:lm:n:i:v")) != EOF) {
-		switch (line) {
-		case 'c':			/* catgets instead of gettext */
-			cflag = 1;
-			break;
-		case 'd':			/* new message data filename */
-			fldata = optarg;	/*	(msg.c is default) */
-			break;
-		case 'h':			/* new message defs filename */
-			fldefs = optarg;	/*	(msg.h is default) */
-			break;
-		case 'i':			/* input message ids from */
-			flmids = optarg;	/*	from this file */
-			break;
-		case 'l':			/* define message data arrays */
-			lflag = 1;		/*	to be local (static) */
-			break;
-		case 'm':			/* generate message database */
-			flmsgs = optarg;	/*	to this file */
-			break;
-		case 'n':			/* new data array and func */
-			interface = optarg;	/*	name (msg is default) */
-			break;
-		case 'v':
-			vflag = 1;		/* set verbose flag */
-			break;
-		case '?':
-			(void) fprintf(stderr, Errmsg_use, argv[0]);
-			exit(1);
-		default:
-			break;
-		}
-	}
-
-	/*
-	 * Validate the we have been given at least one input file.
-	 */
-	if ((argc - optind) < 1) {
-		(void) fprintf(stderr, Errmsg_use);
-		exit(1);
-	}
-
-	/*
-	 * Open all the required output files.
-	 */
-	if (fldefs) {
-		if ((fddefs = fopen(fldefs, "w+")) == NULL) {
-			(void) fprintf(stderr, Errmsg_opne, fldefs,
-			    strerror(errno));
-			return (1);
-		}
-	}
-	if (fldata) {
-		if (fldefs && (strcmp(fldefs, fldata) == 0))
-			fddata = fddefs;
-		else if ((fddata = fopen(fldata, "w+")) == NULL) {
-			(void) fprintf(stderr, Errmsg_opne, fldata,
-			    strerror(errno));
-			return (1);
-		}
-	}
-	if (fddefs && fddata) {
-		(void) sprintf(fllint, "%s.%d.XXXXXX", nmlint, (int)getpid());
-		if ((mkstemp(fllint) == -1) ||
-		    ((fdlint = fopen(fllint, "w+")) == NULL)) {
-			(void) fprintf(stderr, Errmsg_opne, fllint,
-			    strerror(errno));
-			return (1);
-		}
-	}
-	if (flmsgs) {
-		if ((fdmsgs = fopen(flmsgs, "w+")) == NULL) {
-			(void) fprintf(stderr, Errmsg_opne, flmsgs,
-			    strerror(errno));
-			return (1);
-		}
-	}
-	if (flmids) {
-		if ((fdmids = fopen(flmids, "r")) == NULL) {
-			(void) fprintf(stderr, Errmsg_opne, flmids,
-			    strerror(errno));
-			return (1);
-		}
-	}
-
-
-	/*
-	 * Initialize the message definition and message data streams.
-	 */
-	if (fddefs) {
-		if (init_defs())
-			return (1);
-	}
-
-	/*
-	 * Read the input message file, and for each line process accordingly.
-	 */
-	for (; optind < argc; optind++) {
-		int	err;
-
-		fldesc = argv[optind];
-
-		if ((fddesc = fopen(fldesc, "r")) == NULL) {
-			(void) fprintf(stderr, Errmsg_opne, fldesc,
-			    strerror(errno));
-			return (1);
-		}
-		err = file();
-		(void) fclose(fddesc);
-
-		if (err != 0)
-			return (1);
-	}
-
-	/*
-	 * If a msgid has been output a msgstr must follow before we end the
-	 * file.
-	 */
-	if (msgid) {
-		msgid = 0;
-		if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
-			(void) fprintf(stderr, Errmsg_wrte, flmsgs,
-			    strerror(errno));
-			return (1);
-		}
-	}
-
-	if (fdmids)
-		(void) fclose(fdmids);
-	if (fdmsgs)
-		(void) fclose(fdmsgs);
-
-	if (fddefs) {
-		if (output_defs())
-			return (1);
-	}
-
-	/*
-	 * Finish off any generated data and header file.
-	 */
-	if (fldata) {
-		if (output_data())
-			return (1);
-	}
-	if (fddefs) {
-		if (fini_defs())
-			return (1);
-	}
-
-	if (vflag)
-		dump_stringtab(stp);
-
-	/*
-	 * Close up everything and go home.
-	 */
-	if (fddata)
-		(void) fclose(fddata);
-	if (fddefs && (fddefs != fddata))
-		(void) fclose(fddefs);
-	if (fddefs && fddata) {
-		(void) fclose(fdlint);
-		(void) unlink(fllint);
-	}
-
-	if (stp)
-		st_destroy(stp);
-
-	return (0);
-}
--- /dev/null	2019-07-14 19:12:42.000000000 +0000
+++ new/usr/src/tools/sgs/sgsmsg/sgsmsg.c	2019-07-14 19:12:43.912365857 +0000
@@ -0,0 +1,1237 @@
+/*
+ * 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) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * sgsmsg generates several message files from an input template file.  Messages
+ * are constructed for use with gettext(3i) - the default - or catgets(3c).  The
+ * files generate are:
+ *
+ * msg.h	a header file containing definitions for each message.  The -h
+ *		option triggers the creation of these definitions and specifies
+ *		the name to use.
+ *
+ * msg.c	a data array of message strings.  The msg.h definitions are
+ *		offsets into this array.  The -d option triggers the creation of
+ *		these definitions and specifies the name to use.
+ *
+ * messages	a message file suitable for catgets(3c) or gettext(3i) use.  The
+ *		-m option triggers this output and specifies the filename to be
+ *		used.
+ *
+ * The template file is processed based on the first character of each line:
+ *
+ * # or $	entries are copied (as is) to the message file (messages).
+ *
+ * @ token(s)	entries are translated.  Two translations are possible dependent
+ *		on whether one or more tokens are supplied:
+ *
+ *		A single token is interpreted as one of two reserved message
+ *		output indicators, or a message identifier.  The reserved output
+ *		indicator _START_ enables output to the message file - Note that
+ *		the occurance of any other @ token will also enable message
+ *		output.  The reserved output indicator _END_ disables output to
+ *		the message file.  The use of these two indicators provides for
+ *		only those message strings that require translation to be output
+ *		to the message file.
+ *
+ *		Besides the reserved output indicators, a single token is taken
+ *		to be a message identifier which will be subsituted for a
+ *		`setid' for catgets(3c) output, or a `domain' name for
+ *		gettext(3i) output.  This value is determine by substituting the
+ *		token for the associated definition found in the message
+ *		identifier file (specified with the -i option).
+ *
+ *		Multiple tokens are taken to be a message definition followed by
+ *		the associated message string.  The message string is copied to
+ *		the data array being built in msg.c.  The index into this array
+ *		becomes the `message' identifier created in the msg.h file.
+ */
+
+#include	<fcntl.h>
+#include	<stdlib.h>
+#include	<stdio.h>
+#include	<unistd.h>
+#include	<limits.h>
+#include	<string.h>
+#include	<ctype.h>
+#include	<errno.h>
+#include	<sys/param.h>
+
+#include	<sgs.h>
+#include	<_string_table.h>
+
+/*
+ * Define any error message strings.
+ */
+static const char
+	* Errmsg_malt =	"sgsmsg: file %s: line %d: malformed input "
+			"at line\n",
+	* Errmsg_nmem =	"sgsmsg: memory allocation failed: %s\n",
+	* Errmsg_opne =	"sgsmsg: file %s: open failed: %s\n",
+	* Errmsg_wrte =	"sgsmsg: file %s: write failed: %s\n",
+	* Errmsg_read =	"sgsmsg: file %s: read failed %s\n",
+	* Errmsg_stnw =	"sgsmsg: st_new(): failed: %s\n",
+	* Errmsg_stin =	"sgsmsg: Str_tbl insert failed: %s\n",
+	* Errmsg_mnfn =	"sgsmsg: message not found in Str_tbl: %s\n",
+	* Errmsg_use  =	"usage: sgsmsg [-clv] [-d mesgdata] [-h mesgdefs] "
+			"[-m messages] [-n name] [-i mesgident] file ...\n";
+
+/*
+ * Define all output filenames and associated descriptors.
+ */
+static FILE	*fddefs, *fddata, *fdmsgs, *fdmids, *fddesc;
+static char	*fldefs, *fldata, *flmsgs, *flmids, *fldesc;
+static FILE	*fdlint;
+static char	fllint[MAXPATHLEN];
+
+static uint_t		vflag;	/* verbose flag */
+static Str_tbl		*stp;	/* string table */
+
+/*
+ * Define any default strings.
+ */
+static const char
+	*nmlint =	"/tmp/sgsmsg.lint",
+	*interface =	"sgs_msg",
+	*start =	"_START_",
+	*end =		"_END_";
+
+/*
+ * Define any default flags and data items.
+ */
+static int	cflag = 0, lflag = 0, prtmsgs = 0, line, ptr = 1, msgid = 0;
+static char	*mesgid = 0, *setid = 0, *domain = 0;
+
+typedef struct msg_string {
+	char			*ms_defn;
+	char			*ms_message;
+	struct msg_string	*ms_next;
+} msg_string;
+
+static msg_string	*msg_head;
+static msg_string	*msg_tail;
+
+/*
+ * message_append() is responsible for both inserting strings into
+ * the master Str_tbl as well as maintaining a list of the
+ * DEFINITIONS associated with each string.
+ *
+ * The list of strings is traversed at the end once the full
+ * Str_tbl has been constructed - and string offsets can be
+ * assigned.
+ */
+static void
+message_append(const char *defn, const char *message)
+{
+	msg_string	*msg;
+	if ((msg = calloc(sizeof (msg_string), 1)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		exit(1);
+	}
+
+	/*
+	 * Initialize the string table.
+	 */
+	if ((stp == 0) && ((stp = st_new(FLG_STNEW_COMPRESS)) == NULL)) {
+		(void) fprintf(stderr, Errmsg_stnw, strerror(errno));
+		exit(1);
+	}
+
+
+	if ((msg->ms_defn = strdup(defn)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		exit(1);
+	}
+	if ((msg->ms_message = strdup(message)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		exit(1);
+	}
+
+	if (st_insert(stp, msg->ms_message) == -1) {
+		(void) fprintf(stderr, Errmsg_stin,
+		    message);
+		exit(1);
+	}
+
+	if (msg_head == 0) {
+		msg_head = msg_tail = msg;
+		return;
+	}
+	msg_tail->ms_next = msg;
+	msg_tail = msg;
+}
+
+/*
+ * Initialize a setid value.  Given a setid definition determine its numeric
+ * value from the specified message identifier file (specified with the -i
+ * option).  Return a pointer to the numeric string.
+ */
+static int
+getmesgid(char *id)
+{
+	char	*buffer, *token, *_mesgid = 0, *_setid = 0, *_domain = 0;
+
+	/*
+	 * If we're being asked to interpret a message id but the user didn't
+	 * provide the required message identifier file (-i option) we're in
+	 * trouble.
+	 */
+	if (flmids == 0) {
+		(void) fprintf(stderr, "sgsmsg: file %s: line %d: mesgid %s: "
+		    "unable to process mesgid\n\t"
+		    "no message identifier file specified "
+		    "(see -i option)\n", fldesc, line, id);
+		return (1);
+	}
+
+	if ((buffer = malloc(LINE_MAX)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * Read the message identifier file and locate the required mesgid.
+	 */
+	rewind(fdmids);
+	while (fgets(buffer, LINE_MAX, fdmids) != NULL) {
+		if ((token = strstr(buffer, id)) == NULL)
+			continue;
+
+		/*
+		 * Establish individual strings for the mesgid, setid and domain
+		 * values.
+		 */
+		_mesgid = token;
+		while (!(isspace(*token)))
+			token++;
+		*token++ = 0;
+
+		while (isspace(*token))
+			token++;
+		_setid = token;
+		while (!(isspace(*token)))
+			token++;
+		*token++ = 0;
+
+		while (isspace(*token))
+			token++;
+		_domain = token;
+		while (!(isspace(*token)))
+			token++;
+		*token = 0;
+		break;
+	}
+
+	/*
+	 * Did we find a match?
+	 */
+	if ((_mesgid == 0) || (_setid == 0) || (_domain == 0)) {
+		(void) fprintf(stderr, "sgsmsg: file %s: line %d: mesgid %s: "
+		    "unable to process mesgid\n\t"
+		    "identifier does not exist in file %s\n",
+		    fldesc, line, id, flmids);
+		return (1);
+	}
+
+	/*
+	 * Have we been here before?
+	 */
+	if (mesgid) {
+		if (cflag == 1) {
+			/*
+			 * If we're being asked to process more than one mesgid
+			 * warn the user that only one mesgid can be used for
+			 * the catgets(3c) call.
+			 */
+			(void) fprintf(stderr, "sgsmsg: file %s: line %d: "
+			    "setid %s: warning: multiple mesgids "
+			    "encountered\n\t"
+			    "last setting used in messaging code\n",
+			    fldesc, line, id);
+		}
+	}
+
+	mesgid = _mesgid;
+	setid = _setid;
+	domain = _domain;
+
+	/*
+	 * Generate the message file output (insure output flag is enabled).
+	 */
+	if (prtmsgs != -1)
+		prtmsgs = 1;
+	if (fdmsgs && (prtmsgs == 1)) {
+		if (cflag == 1) {
+			if (fprintf(fdmsgs, "$quote \"\n$set %s\n",
+			    setid) < 0) {
+				(void) fprintf(stderr, Errmsg_wrte, flmsgs,
+				    strerror(errno));
+				return (1);
+			}
+		} else {
+			if (fprintf(fdmsgs, "domain\t\"%s\"\n", domain) < 0) {
+				(void) fprintf(stderr, Errmsg_wrte, flmsgs,
+				    strerror(errno));
+				return (1);
+			}
+		}
+	}
+
+	/*
+	 * For catgets(3c) output generate a setid definition in the message
+	 * definition file.
+	 */
+	if (fddefs && (cflag == 1) &&
+	    (fprintf(fddefs, "#define\t%s\t%s\n\n", mesgid, setid) < 0)) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	return (0);
+}
+
+/*
+ * Dump contents of String Table to standard out
+ */
+static void
+dump_stringtab(Str_tbl *stp)
+{
+	uint_t	cnt;
+
+	if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
+		(void) printf("string table full size: %ld: uncompressed\n",
+		    stp->st_fullstrsize);
+		return;
+	}
+
+	(void) printf("string table full size: %ld compressed down to: %ld\n\n",
+	    stp->st_fullstrsize, stp->st_strsize);
+	(void) printf("string table compression information [%d buckets]:\n",
+	    stp->st_hbckcnt);
+
+	for (cnt = 0; cnt < stp->st_hbckcnt; cnt++) {
+		Str_hash	*sthash = stp->st_hashbcks[cnt];
+
+		if (sthash == 0)
+			continue;
+
+		(void) printf(" bucket: [%d]\n", cnt);
+
+		while (sthash) {
+			size_t	stroff = sthash->hi_mstr->sm_strlen -
+			    sthash->hi_strlen;
+
+			if (stroff == 0) {
+				(void) printf("  [%ld]: '%s'  <master>\n",
+				    sthash->hi_refcnt, sthash->hi_mstr->sm_str);
+			} else {
+				(void) printf("  [%ld]: '%s'  <suffix of: "
+				    "'%s'>\n", sthash->hi_refcnt,
+				    &sthash->hi_mstr->sm_str[stroff],
+				    sthash->hi_mstr->sm_str);
+			}
+			sthash = sthash->hi_next;
+		}
+	}
+}
+
+/*
+ * Initialize the message definition header file stream.
+ */
+static int
+init_defs(void)
+{
+	static char	guard[FILENAME_MAX + 6];
+	char		*optr;
+	const char	*iptr, *_ptr;
+
+	/*
+	 * Establish a header guard name using the files basename.
+	 */
+	for (iptr = 0, _ptr = fldefs; _ptr && (*_ptr != '\0'); _ptr++) {
+		if (*_ptr == '/')
+			iptr = _ptr + 1;
+	}
+	if (iptr == 0)
+		iptr = fldefs;
+
+	optr = guard;
+	for (*optr++ = '_'; iptr && (*iptr != '\0'); iptr++, optr++) {
+		if (*iptr == '.') {
+			*optr++ = '_';
+			*optr++ = 'D';
+			*optr++ = 'O';
+			*optr++ = 'T';
+			*optr = '_';
+		} else
+			*optr = toupper(*iptr);
+	}
+
+	if (fprintf(fddefs, "#ifndef\t%s\n#define\t%s\n\n", guard, guard) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "#include <sgsmsg.h>\t/* Msg typedef */\n\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "#ifndef\t__lint\n\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * The MSG_SGS_ARRAY_NAME macro supplies a generic way to
+	 * reference the string table regardless of its name.
+	 */
+	if (fprintf(fddefs, "#define\tMSG_SGS_LOCAL_ARRAY\t__%s\n\n",
+	    interface) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * If the associated data array is global define a prototype.
+	 * Define a macro to access the array elements.
+	 */
+	if (lflag == 0) {
+		if (fprintf(fddefs, "extern\tconst char\t__%s[];\n\n",
+		    interface) < 0) {
+			(void) fprintf(stderr, Errmsg_wrte, fldefs,
+			    strerror(errno));
+			return (1);
+		}
+	}
+	if (fprintf(fddefs,
+	    "#define\tMSG_ORIG_STRTAB(_x, _s)\t&_s[_x]\n\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+	if (fprintf(fddefs,
+	    "#define\tMSG_ORIG(x)\tMSG_ORIG_STRTAB(x, __%s)\n\n",
+	    interface) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * Generate a prototype to access the associated data array.
+	 */
+	if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
+	    interface) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+	if (fprintf(fddefs, "#define\tMSG_INTL(x)\t_%s(x)\n\n",
+	    interface) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	return (0);
+}
+
+
+/*
+ * Finish the message definition header file.
+ */
+static int
+fini_defs(void)
+{
+	if (fprintf(fddefs, "\n#else\t/* __lint */\n\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "extern\tconst char *\t_%s(Msg);\n\n",
+	    interface) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "#ifndef MSG_SGS_LOCAL_ARRAY\n"
+	    "#define\tMSG_SGS_LOCAL_ARRAY\t\"\"\n#endif\n\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (lflag == 0) {
+		if (fprintf(fddefs, "extern\tconst char\t__%s[];\n\n",
+		    interface) < 0) {
+			(void) fprintf(stderr, Errmsg_wrte, fldefs,
+			    strerror(errno));
+			return (1);
+		}
+	}
+
+	if (fprintf(fddefs,
+	    "#define MSG_ORIG_STRTAB(_x, _s)\t_x\n"
+	    "#define MSG_ORIG(x)\tx\n#define MSG_INTL(x)\tx\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * Provide a way to get the array and function declarations above
+	 * without also getting the actual messages. This is useful in
+	 * our lintsup.c files that include more than one message header.
+	 * lintsup doesn't need the actual messages, and this prevents
+	 * macro name collisions.
+	 */
+	if (fprintf(fddefs, "\n#ifndef LINTSUP_SUPPRESS_STRINGS\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	/*
+	 * Copy the temporary lint defs file into the new header.
+	 */
+	if (fdlint) {
+		long	size;
+		char	*buf;
+
+		size = ftell(fdlint);
+		(void) rewind(fdlint);
+
+		if ((buf = malloc(size)) == 0) {
+			(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+			return (1);
+		}
+		if (fread(buf, size, 1, fdlint) == 0) {
+			(void) fprintf(stderr, Errmsg_read, fllint,
+			    strerror(errno));
+			return (1);
+		}
+		if (fwrite(buf, size, 1, fddefs) == 0) {
+			(void) fprintf(stderr, Errmsg_wrte, fldefs,
+			    strerror(errno));
+			return (1);
+		}
+		(void) free(buf);
+	}
+
+	if (fprintf(fddefs, "\n#endif\t/* LINTSUP_SUPPRESS_STRINGS */\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "\n#endif\t/* __lint */\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	if (fprintf(fddefs, "\n#endif\n") < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldefs, strerror(errno));
+		return (1);
+	}
+
+	return (0);
+}
+
+/*
+ * The entire messaging file has been scanned - and all strings have been
+ * inserted into the string_table.  We can now walk the message queue
+ * and create the '#define <DEFN>' for each string - with the strings
+ * assigned offset into the string_table.
+ */
+static int
+output_defs(void)
+{
+	msg_string	*msg;
+	size_t		stbufsize;
+	char		*stbuf;
+
+	stbufsize = st_getstrtab_sz(stp);
+	if ((stbuf = malloc(stbufsize)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		exit(1);
+	}
+	(void) st_setstrbuf(stp, stbuf, stbufsize);
+	for (msg = msg_head; msg; msg = msg->ms_next) {
+		size_t	stoff;
+		if ((st_setstring(stp, msg->ms_message, &stoff)) == -1) {
+			(void) fprintf(stderr, Errmsg_mnfn, msg->ms_message);
+			return (1);
+		}
+		if (fprintf(fddefs, "\n#define\t%s\t%ld\n",
+		    msg->ms_defn, stoff) < 0) {
+			(void) fprintf(stderr, Errmsg_wrte,
+			    fldefs, strerror(errno));
+			return (1);
+		}
+		if (fddefs && fprintf(fddefs, "#define\t%s_SIZE\t%d\n",
+		    msg->ms_defn, strlen(msg->ms_message)) < 0) {
+			(void) fprintf(stderr, Errmsg_wrte,
+			    fldefs, strerror(errno));
+			return (1);
+		}
+	}
+	return (0);
+}
+
+
+/*
+ * Finish off the data structure definition.
+ */
+static int
+output_data(void)
+{
+	size_t		stbufsize;
+	size_t		ndx;
+	size_t		column = 1;
+	const char	*stbuf;
+	const char	*fmtstr;
+
+	stbufsize = st_getstrtab_sz(stp);
+	stbuf = st_getstrbuf(stp);
+
+	assert(stbuf);
+
+	/*
+	 * Determine from the local flag whether the data declaration should
+	 * be static.
+	 */
+	if (lflag)
+		fmtstr = (const char *)"static const";
+	else
+		fmtstr = (const char *)"const";
+
+	if (fprintf(fddata, "\n%s char __%s[%ld] __attribute__((unused)) = { ",
+	    fmtstr, interface, stbufsize) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldata, strerror(errno));
+		return (1);
+	}
+
+	for (ndx = 0; ndx < (stbufsize - 1); ndx++) {
+		if (column == 1) {
+			if (fddata && fprintf(fddata,
+			    "\n/* %4ld */ 0x%.2x,", ndx,
+			    (unsigned char)stbuf[ndx]) < 0) {
+				(void) fprintf(stderr, Errmsg_wrte,
+				    fldata, strerror(errno));
+				return (1);
+			}
+		} else {
+			if (fddata && fprintf(fddata, "  0x%.2x,",
+			    (unsigned char)stbuf[ndx]) < 0) {
+				(void) fprintf(stderr, Errmsg_wrte,
+				    fldata, strerror(errno));
+				return (1);
+			}
+		}
+
+		if (column++ == 10)
+			column = 1;
+	}
+
+	if (column == 1)
+		fmtstr = "\n\t0x%.2x };\n";
+	else
+		fmtstr = "  0x%.2x };\n";
+
+	if (fprintf(fddata, fmtstr, (unsigned char)stbuf[stbufsize - 1]) < 0) {
+		(void) fprintf(stderr, Errmsg_wrte, fldata, strerror(errno));
+		return (1);
+	}
+
+	return (0);
+}
+
+static int
+file()
+{
+	char	buffer[LINE_MAX], * token;
+	uint_t	bufsize;
+	char	*token_buffer;
+	int	escape = 0;
+	int	len = 0;
+
+	if ((token_buffer = malloc(LINE_MAX)) == 0) {
+		(void) fprintf(stderr, Errmsg_nmem, strerror(errno));
+		return (1);
+	}
+	bufsize = LINE_MAX;
+
+	line = 1;
+
+	while ((token = fgets(buffer, LINE_MAX, fddesc)) != NULL) {
+		char	defn[PATH_MAX], * _defn, * str;
+
+		switch (*token) {
+		case '#':
+		case '$':
+			if (escape) {
+				(void) fprintf(stderr, Errmsg_malt, fldesc,
+				    line);
+				return (1);
+			}
+
+			/*
+			 * If a msgid has been output a msgstr must follow
+			 * before we digest the new token.  A msgid is only set
+			 * if fdmsgs is in use.
+			 */
+			if (msgid) {
+				msgid = 0;
+				if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    flmsgs, strerror(errno));
+					return (1);
+				}
+			}
+
+			/*
+			 * Pass lines directly through to the output message
+			 * file.
+			 */
+			if (fdmsgs && (prtmsgs == 1)) {
+				char	comment;
+
+				if (cflag == 0)
+					comment = '#';
+				else
+					comment = '$';
+
+				if (fprintf(fdmsgs, "%c%s", comment,
+				    ++token) < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    flmsgs, strerror(errno));
+					return (1);
+				}
+			}
+			break;
+
+		case '@':
+			if (escape) {
+				(void) fprintf(stderr, Errmsg_malt, fldesc,
+				    line);
+				return (1);
+			}
+
+			/*
+			 * If a msgid has been output a msgstr must follow
+			 * before we digest the new token.
+			 */
+			if (msgid) {
+				msgid = 0;
+				if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    flmsgs, strerror(errno));
+					return (1);
+				}
+			}
+
+			/*
+			 * Determine whether we have one or more tokens.
+			 */
+			token++;
+			while (isspace(*token))		/* rid any whitespace */
+				token++;
+			_defn = token;			/* definition start */
+			while (!(isspace(*token)))
+				token++;
+			*token++ = 0;
+
+			while (isspace(*token))		/* rid any whitespace */
+				token++;
+
+			/*
+			 * Determine whether the single token is one of the
+			 * reserved message output delimiters otherwise
+			 * translate it as a message identifier.
+			 */
+			if (*token == 0) {
+				if (strcmp(_defn, start) == 0)
+					prtmsgs = 1;
+				else if (strcmp(_defn, end) == 0)
+					prtmsgs = -1;
+				else if (getmesgid(_defn) == 1)
+					return (1);
+				break;
+			}
+
+			/*
+			 * Multiple tokens are translated by taking the first
+			 * token as the message definition, and the rest of the
+			 * line as the message itself.  A message line ending
+			 * with an escape ('\') is expected to be continued on
+			 * the next line.
+			 */
+			if (prtmsgs != -1)
+				prtmsgs = 1;
+			if (fdmsgs && (prtmsgs == 1)) {
+				/*
+				 * For catgets(3c) make sure a message
+				 * identifier has been established (this is
+				 * normally a domain for gettext(3i), but for
+				 * sgsmsg use this could be argued as being
+				 * redundent).  Also make sure that the message
+				 * definitions haven't exceeeded the maximum
+				 * value allowed by gencat(1) before generating
+				 * any message file entries.
+				 */
+				if (cflag == 1) {
+					if (setid == 0) {
+						(void) fprintf(stderr, "file "
+						    "%s: no message identifier "
+						    "has been established\n",
+						    fldesc);
+						return (1);
+					}
+					if (ptr	> NL_MSGMAX) {
+						(void) fprintf(stderr, "file "
+						    "%s: message definition "
+						    "(%d) exceeds allowable "
+						    "limit (NL_MSGMAX)\n",
+						    fldesc, ptr);
+						return (1);
+					}
+				}
+
+				/*
+				 * For catgets(3c) write the definition and the
+				 * message string to the message file.  For
+				 * gettext(3i) write the message string as a
+				 * mesgid - indicate a mesgid has been output
+				 * so that a msgstr can follow.
+				 */
+				if (cflag == 1) {
+					if (fprintf(fdmsgs, "%d\t%s", ptr,
+					    token) < 0) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, flmsgs,
+						    strerror(errno));
+						return (1);
+					}
+				} else {
+					if (fprintf(fdmsgs, "msgid\t\"") < 0) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, flmsgs,
+						    strerror(errno));
+						return (1);
+					}
+					msgid = 1;
+				}
+			}
+
+			/*
+			 * The message itself is a quoted string as this makes
+			 * embedding spaces at the start (or the end) of the
+			 * string very easy.
+			 */
+			if (*token != '"') {
+				(void) fprintf(stderr, Errmsg_malt, fldesc,
+				    line);
+				return (1);
+			}
+
+			(void) strcpy(defn, _defn);
+
+			/*
+			 * Write the tag to the lint definitions.
+			 */
+			if (fdlint) {
+				if (fprintf(fdlint, "\n#define\t%s\t",
+				    _defn) < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    fllint, strerror(errno));
+					return (1);
+				}
+			}
+
+			len = 0;
+
+			/*
+			 * Write each character of the message string to the
+			 * data array.  Translate any escaped characters - use
+			 * the same specially recognized characters as defined
+			 * by gencat(1).
+			 */
+message:
+			if (*token == '"') {
+				if (fdlint &&
+				    (fprintf(fdlint, "%c", *token) < 0)) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    fllint, strerror(errno));
+					return (1);
+				}
+				token++;
+			}
+			while (*token) {
+				char	_token;
+
+				if ((*token == '\\') && (escape == 0)) {
+					escape = 1;
+					if (fdlint && (*(token + 1) != '\n') &&
+					    fprintf(fdlint, "%c", *token) < 0) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, fllint,
+						    strerror(errno));
+						return (1);
+					}
+					token++;
+					continue;
+				}
+				if (escape) {
+					if (*token == 'n')
+						_token = '\n';
+					else if (*token == 't')
+						_token = '\t';
+					else if (*token == 'v')
+						_token = '\v';
+					else if (*token == 'b')
+						_token = '\b';
+					else if (*token == 'f')
+						_token = '\f';
+					else if (*token == '\\')
+						_token = '\\';
+					else if (*token == '"')
+						_token = '"';
+					else if (*token == '\n')
+						break;
+					else
+						_token = *token;
+
+					if (fdmsgs && (prtmsgs == 1) &&
+					    (fprintf(fdmsgs, "\\") < 0)) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, flmsgs,
+						    strerror(errno));
+						return (1);
+					}
+				} else {
+					/*
+					 * If this is the trailing quote then
+					 * thats the last of the message string.
+					 * Eat up any remaining white space and
+					 * unless an escape character is found
+					 * terminate the data string with a 0.
+					 */
+					/* BEGIN CSTYLED */
+					if (*token == '"') {
+					    if (fdlint && (fprintf(fdlint,
+						"%c", *token) < 0)) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, fllint,
+						    strerror(errno));
+						return (1);
+					    }
+
+					    if (fdmsgs && (prtmsgs == 1) &&
+						(fprintf(fdmsgs, "%c",
+						*token) < 0)) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, flmsgs,
+						    strerror(errno));
+						return (1);
+					    }
+
+					    while (*++token) {
+						if (*token == '\n')
+							break;
+					    }
+					    _token = '\0';
+					} else
+					    _token = *token;
+					/* END CSTYLED */
+				}
+
+				if (fdmsgs && (prtmsgs == 1) &&
+				    (fprintf(fdmsgs, "%c", *token) < 0)) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    flmsgs, strerror(errno));
+					return (1);
+				}
+
+				if (fdlint && fprintf(fdlint,
+				    "%c", *token) < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    fllint, strerror(errno));
+					return (1);
+				}
+
+				if (len >= bufsize) {
+					bufsize += LINE_MAX;
+					if ((token_buffer = realloc(
+					    token_buffer, bufsize)) == 0) {
+						(void) fprintf(stderr,
+						    Errmsg_nmem,
+						    strerror(errno));
+						return (1);
+					}
+				}
+				token_buffer[len] = _token;
+				ptr++, token++, len++;
+				escape = 0;
+
+				if (_token == '\0')
+					break;
+			}
+
+			/*
+			 * After the complete message string has been processed
+			 * (including its continuation beyond one line), create
+			 * a string size definition.
+			 */
+			if (escape == 0) {
+				const char *form = "#define\t%s_SIZE\t%d\n";
+
+				token_buffer[len] = '\0';
+
+				message_append(defn, token_buffer);
+
+				if (fdlint && fprintf(fdlint, form, defn,
+				    (len - 1)) < 0) {
+					(void) fprintf(stderr, Errmsg_wrte,
+					    fllint, strerror(errno));
+					return (1);
+				}
+			}
+			break;
+
+		default:
+			/*
+			 * Empty lines are passed through to the message file.
+			 */
+			while (isspace(*token))
+				token++;
+
+			if (*token == 0) {
+				if (msgid || (fdmsgs && (prtmsgs == 1))) {
+					/*
+					 * If a msgid has been output a msgstr
+					 * must follow before we digest the new
+					 * token.
+					 */
+					if (msgid) {
+						msgid = 0;
+						str = "msgstr\t\"\"\n\n";
+					} else
+						str = "\n";
+
+					if (fprintf(fdmsgs, str) < 0) {
+						(void) fprintf(stderr,
+						    Errmsg_wrte, flmsgs,
+						    strerror(errno));
+						return (1);
+					}
+				}
+				break;
+			}
+
+			/*
+			 * If an escape is in effect then any tokens are taken
+			 * to be message continuations.
+			 */
+			if (escape) {
+				escape = 0;
+				goto message;
+			}
+
+			(void) fprintf(stderr, "file %s: line %d: invalid "
+			    "input does not start with #, $ or @\n", fldesc,
+			    line);
+			return (1);
+		}
+		line++;
+	}
+
+	free(token_buffer);
+
+	return (0);
+}
+
+int
+main(int argc, char ** argv)
+{
+	opterr = 0;
+	while ((line = getopt(argc, argv, "cd:h:lm:n:i:v")) != EOF) {
+		switch (line) {
+		case 'c':			/* catgets instead of gettext */
+			cflag = 1;
+			break;
+		case 'd':			/* new message data filename */
+			fldata = optarg;	/*	(msg.c is default) */
+			break;
+		case 'h':			/* new message defs filename */
+			fldefs = optarg;	/*	(msg.h is default) */
+			break;
+		case 'i':			/* input message ids from */
+			flmids = optarg;	/*	from this file */
+			break;
+		case 'l':			/* define message data arrays */
+			lflag = 1;		/*	to be local (static) */
+			break;
+		case 'm':			/* generate message database */
+			flmsgs = optarg;	/*	to this file */
+			break;
+		case 'n':			/* new data array and func */
+			interface = optarg;	/*	name (msg is default) */
+			break;
+		case 'v':
+			vflag = 1;		/* set verbose flag */
+			break;
+		case '?':
+			(void) fprintf(stderr, Errmsg_use, argv[0]);
+			exit(1);
+		default:
+			break;
+		}
+	}
+
+	/*
+	 * Validate the we have been given at least one input file.
+	 */
+	if ((argc - optind) < 1) {
+		(void) fprintf(stderr, Errmsg_use);
+		exit(1);
+	}
+
+	/*
+	 * Open all the required output files.
+	 */
+	if (fldefs) {
+		if ((fddefs = fopen(fldefs, "w+")) == NULL) {
+			(void) fprintf(stderr, Errmsg_opne, fldefs,
+			    strerror(errno));
+			return (1);
+		}
+	}
+	if (fldata) {
+		if (fldefs && (strcmp(fldefs, fldata) == 0))
+			fddata = fddefs;
+		else if ((fddata = fopen(fldata, "w+")) == NULL) {
+			(void) fprintf(stderr, Errmsg_opne, fldata,
+			    strerror(errno));
+			return (1);
+		}
+	}
+	if (fddefs && fddata) {
+		(void) sprintf(fllint, "%s.%d.XXXXXX", nmlint, (int)getpid());
+		if ((mkstemp(fllint) == -1) ||
+		    ((fdlint = fopen(fllint, "w+")) == NULL)) {
+			(void) fprintf(stderr, Errmsg_opne, fllint,
+			    strerror(errno));
+			return (1);
+		}
+	}
+	if (flmsgs) {
+		if ((fdmsgs = fopen(flmsgs, "w+")) == NULL) {
+			(void) fprintf(stderr, Errmsg_opne, flmsgs,
+			    strerror(errno));
+			return (1);
+		}
+	}
+	if (flmids) {
+		if ((fdmids = fopen(flmids, "r")) == NULL) {
+			(void) fprintf(stderr, Errmsg_opne, flmids,
+			    strerror(errno));
+			return (1);
+		}
+	}
+
+
+	/*
+	 * Initialize the message definition and message data streams.
+	 */
+	if (fddefs) {
+		if (init_defs())
+			return (1);
+	}
+
+	/*
+	 * Read the input message file, and for each line process accordingly.
+	 */
+	for (; optind < argc; optind++) {
+		int	err;
+
+		fldesc = argv[optind];
+
+		if ((fddesc = fopen(fldesc, "r")) == NULL) {
+			(void) fprintf(stderr, Errmsg_opne, fldesc,
+			    strerror(errno));
+			return (1);
+		}
+		err = file();
+		(void) fclose(fddesc);
+
+		if (err != 0)
+			return (1);
+	}
+
+	/*
+	 * If a msgid has been output a msgstr must follow before we end the
+	 * file.
+	 */
+	if (msgid) {
+		msgid = 0;
+		if (fprintf(fdmsgs, "msgstr\t\"\"\n") < 0) {
+			(void) fprintf(stderr, Errmsg_wrte, flmsgs,
+			    strerror(errno));
+			return (1);
+		}
+	}
+
+	if (fdmids)
+		(void) fclose(fdmids);
+	if (fdmsgs)
+		(void) fclose(fdmsgs);
+
+	if (fddefs) {
+		if (output_defs())
+			return (1);
+	}
+
+	/*
+	 * Finish off any generated data and header file.
+	 */
+	if (fldata) {
+		if (output_data())
+			return (1);
+	}
+	if (fddefs) {
+		if (fini_defs())
+			return (1);
+	}
+
+	if (vflag)
+		dump_stringtab(stp);
+
+	/*
+	 * Close up everything and go home.
+	 */
+	if (fddata)
+		(void) fclose(fddata);
+	if (fddefs && (fddefs != fddata))
+		(void) fclose(fddefs);
+	if (fddefs && fddata) {
+		(void) fclose(fdlint);
+		(void) unlink(fllint);
+	}
+
+	if (stp)
+		st_destroy(stp);
+
+	return (0);
+}
