changeset 10792:809cb9af791e

6888489 Null environment variables are not overriding crle(1) replaceable environment variables.
author Rod Evans <Rod.Evans@Sun.COM>
date Wed, 14 Oct 2009 08:12:49 -0700
parents 944abfb5b345
children 34709091de6d
files usr/src/cmd/sgs/include/debug.h usr/src/cmd/sgs/include/libld.h usr/src/cmd/sgs/ld/common/ld.c usr/src/cmd/sgs/libld/common/_libld.h usr/src/cmd/sgs/libld/common/args.c usr/src/cmd/sgs/libld/common/files.c usr/src/cmd/sgs/libld/common/ldentry.c usr/src/cmd/sgs/libld/common/libld.msg usr/src/cmd/sgs/libld/common/libs.c usr/src/cmd/sgs/libld/common/machrel.amd.c usr/src/cmd/sgs/libld/common/machrel.intel.c usr/src/cmd/sgs/libld/common/machrel.sparc.c usr/src/cmd/sgs/libld/common/machsym.sparc.c usr/src/cmd/sgs/libld/common/machsym.sparc.h usr/src/cmd/sgs/libld/common/map.c usr/src/cmd/sgs/libld/common/outfile.c usr/src/cmd/sgs/libld/common/relocate.c usr/src/cmd/sgs/libld/common/resolve.c usr/src/cmd/sgs/libld/common/sections.c usr/src/cmd/sgs/libld/common/sunwmove.c usr/src/cmd/sgs/libld/common/syms.c usr/src/cmd/sgs/libld/common/unwind.c usr/src/cmd/sgs/libld/common/update.c usr/src/cmd/sgs/libld/common/version.c usr/src/cmd/sgs/liblddbg/common/_debug.h usr/src/cmd/sgs/liblddbg/common/liblddbg.msg usr/src/cmd/sgs/liblddbg/common/relocate.c usr/src/cmd/sgs/liblddbg/common/syms.c usr/src/cmd/sgs/moe/common/moe.c usr/src/cmd/sgs/packages/common/SUNWonld-README usr/src/cmd/sgs/rtld/Makefile.targ usr/src/cmd/sgs/rtld/common/util.c usr/src/cmd/sgs/rtld/sparcv9/Makefile usr/src/uts/common/sys/link.h
diffstat 34 files changed, 817 insertions(+), 792 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/sgs/include/debug.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/include/debug.h	Wed Oct 14 08:12:49 2009 -0700
@@ -944,6 +944,7 @@
 #define	ELF_DBG_ELFDUMP		1
 #define	ELF_DBG_RTLD		2
 #define	ELF_DBG_LD		3
+#define	ELF_DBG_LD_ACT		4
 
 /*
  * Define generic Elf_*() interfaces.
--- a/usr/src/cmd/sgs/include/libld.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/include/libld.h	Wed Oct 14 08:12:49 2009 -0700
@@ -200,8 +200,8 @@
 	Word		ofl_entrelscnt;	/* no of relocations entered */
 	Alist		*ofl_copyrels;	/* list of copy relocations */
 	APlist		*ofl_ordered;	/* list of shf_ordered sections */
-	APlist		*ofl_syminfsyms; /* list of interesting syms */
-					/*	for syminfo processing */
+	APlist		*ofl_symdtent;	/* list of syminfo symbols that need */
+					/*	to reference .dynamic entries */
 	APlist		*ofl_ismove;	/* list of .SUNW_move sections */
 	APlist		*ofl_ismoverel;	/* list of relocation input section */
 					/* targeting to expanded area */
@@ -318,7 +318,7 @@
 					/*	sloppy_comdat_reloc() */
 	APlist		*ofl_maptext;	/* mapfile added text sections */
 	APlist		*ofl_mapdata;	/* mapfile added data sections */
-	avl_tree_t	*ofl_wrap;	/* -z wrap symbols  */
+	avl_tree_t	*ofl_wrap;	/* -z wrap symbols */
 };
 
 #define	FLG_OF_DYNAMIC	0x00000001	/* generate dynamic output module */
@@ -331,7 +331,7 @@
 #define	FLG_OF_STRIP	0x00000080	/* strip output: -s */
 #define	FLG_OF_NOWARN	0x00000100	/* disable symbol warnings: -t */
 #define	FLG_OF_NOUNDEF	0x00000200	/* allow no undefined symbols: -zdefs */
-#define	FLG_OF_PURETXT	0x00000400	/* allow no text relocations: -ztext  */
+#define	FLG_OF_PURETXT	0x00000400	/* allow no text relocations: -ztext */
 #define	FLG_OF_GENMAP	0x00000800	/* generate a memory map: -m */
 #define	FLG_OF_DYNLIBS	0x00001000	/* dynamic input allowed: -Bdynamic */
 #define	FLG_OF_SYMBOLIC	0x00002000	/* bind global symbols: -Bsymbolic */
@@ -363,11 +363,11 @@
 #define	FLG_OF_NOCOMREL	0x000800000000	/* -z nocombreloc set */
 #define	FLG_OF_AUTOLCL	0x001000000000	/* automatically reduce unspecified */
 					/*	global symbols to locals */
-#define	FLG_OF_AUTOELM	0x002000000000	/* automatically eliminate  */
+#define	FLG_OF_AUTOELM	0x002000000000	/* automatically eliminate */
 					/*	unspecified global symbols */
 #define	FLG_OF_REDLSYM	0x004000000000	/* reduce local symbols */
 #define	FLG_OF_SECORDER	0x008000000000	/* section ordering is required */
-#define	FLG_OF_OSABI	0x010000000000	/* Tag object as ELFOSABI_SOLARIS */
+#define	FLG_OF_OSABI	0x010000000000	/* tag object as ELFOSABI_SOLARIS */
 
 /*
  * In the flags1 arena, establish any options that are applicable to archive
@@ -445,6 +445,42 @@
 	!((_ofl)->ofl_dtflags_1 & DF_1_NORELOC))
 
 /*
+ * Determine whether a static executable is being built.
+ */
+#define	OFL_IS_STATIC_EXEC(_ofl) (((_ofl)->ofl_flags & \
+	(FLG_OF_STATIC | FLG_OF_EXEC)) == (FLG_OF_STATIC | FLG_OF_EXEC))
+
+/*
+ * Determine whether a static object is being built.  This macro is used
+ * to select the appropriate string table, and symbol table that other
+ * sections need to reference.
+ */
+#define	OFL_IS_STATIC_OBJ(_ofl) ((_ofl)->ofl_flags & \
+	(FLG_OF_RELOBJ | FLG_OF_STATIC))
+
+/*
+ * Macros for counting symbol table entries.  These are used to size symbol
+ * tables and associated sections (.syminfo, SUNW_capinfo, .hash, etc.) and
+ * set required sh_info entries (the offset to the first global symbol).
+ */
+#define	SYMTAB_LOC_CNT(_ofl)		/* local .symtab entries */	\
+	(2 +				/*    NULL and STT_FILE */	\
+	(_ofl)->ofl_shdrcnt +		/*    section symbol */		\
+	(_ofl)->ofl_scopecnt +		/*    scoped symbols */		\
+	(_ofl)->ofl_locscnt)		/*    standard locals */
+#define	SYMTAB_ALL_CNT(_ofl)		/* all .symtab entries */	\
+	(SYMTAB_LOC_CNT(_ofl) +		/*    .symtab locals */		\
+	(_ofl)->ofl_globcnt)		/*    standard globals */
+
+#define	DYNSYM_LOC_CNT(_ofl)		/* local .dynsym entries */	\
+	(1 +				/*    NULL */			\
+	(_ofl)->ofl_dynshdrcnt +	/*    section symbols */	\
+	(_ofl)->ofl_lregsymcnt)		/*    local register symbols */
+#define	DYNSYM_ALL_CNT(_ofl)		/* all .dynsym entries */	\
+	(DYNSYM_LOC_CNT(_ofl) +		/*    .dynsym locals */		\
+	(_ofl)->ofl_globcnt)		/*    standard globals */
+
+/*
  * Define a move descriptor used within relocation structures.
  */
 typedef struct {
@@ -583,7 +619,7 @@
 					/*	flag */
 #define	FLG_IF_IGNORE	0x00000080	/* ignore unused dependencies */
 #define	FLG_IF_NODIRECT	0x00000100	/* object contains symbols that */
-					/*	cannot be directly bound to. */
+					/*	cannot be directly bound to */
 #define	FLG_IF_LAZYLD	0x00000200	/* bindings to this object should be */
 					/*	lazy loaded */
 #define	FLG_IF_GRPPRM	0x00000400	/* this dependency should have the */
@@ -793,6 +829,7 @@
 /*
  * Symbol descriptor.
  */
+typedef	Lword		sd_flag_t;
 struct sym_desc {
 	Alist		*sd_GOTndxs;	/* list of associated GOT entries */
 	Sym		*sd_sym;	/* pointer to symbol table entry */
@@ -806,8 +843,7 @@
 	Sym_aux		*sd_aux;	/* auxiliary global symbol info. */
 	Word		sd_symndx;	/* index in output symbol table */
 	Word		sd_shndx;	/* sect. index sym is associated w/ */
-	Word		sd_flags;	/* state flags */
-	Half		sd_flags1;	/* more symbol flags */
+	sd_flag_t	sd_flags;	/* state flags */
 	Half		sd_ref;		/* reference definition of symbol */
 };
 
@@ -821,7 +857,6 @@
 	APlist 		*sa_dfiles;	/* files where symbol is defined */
 	Sym		sa_sym;		/* copy of symtab entry */
 	const char	*sa_vfile;	/* first unavailable definition */
-	Ifl_desc	*sa_bindto;	/* symbol to bind to - for translator */
 	const char	*sa_rfile;	/* file with first symbol referenced */
 	Word		sa_hash;	/* the pure hash value of symbol */
 	Word		sa_PLTndx;	/* index into PLT for symbol */
@@ -840,7 +875,7 @@
 	avl_node_t	sav_node;	/* AVL node */
 	Word		sav_hash;	/* symbol hash value */
 	const char	*sav_name;	/* symbol name */
-	Sym_desc	*sav_symdesc;	/* SymDesc entry */
+	Sym_desc	*sav_sdp;	/* symbol descriptor */
 };
 
 /*
@@ -920,44 +955,41 @@
 #define	FLG_SY_DYNSORT	0x40000000	/* req. in dyn[sym|tls]sort section */
 #define	FLG_SY_NODYNSORT 0x80000000	/* excluded from dyn[sym_tls]sort sec */
 
-/*
- * Sym_desc.sd_flags1
- */
-#define	FLG_SY1_DEFAULT	0x00000001	/* global symbol, default */
-#define	FLG_SY1_SINGLE	0x00000002	/* global symbol, singleton defined */
-#define	FLG_SY1_PROTECT	0x00000004	/* global symbol, protected defined */
-#define	FLG_SY1_EXPORT	0x00000008	/* global symbol, exported defined */
+#define	FLG_SY_DEFAULT	0x0000100000000	/* global symbol, default */
+#define	FLG_SY_SINGLE	0x0000200000000	/* global symbol, singleton defined */
+#define	FLG_SY_PROTECT	0x0000400000000	/* global symbol, protected defined */
+#define	FLG_SY_EXPORT	0x0000800000000	/* global symbol, exported defined */
 
-#define	MSK_SY1_GLOBAL \
-	(FLG_SY1_DEFAULT | FLG_SY1_SINGLE | FLG_SY1_PROTECT | FLG_SY1_EXPORT)
+#define	MSK_SY_GLOBAL \
+	(FLG_SY_DEFAULT | FLG_SY_SINGLE | FLG_SY_PROTECT | FLG_SY_EXPORT)
 					/* this mask indicates that the */
 					/*    symbol has been explicitly */
 					/*    defined within a mapfile */
 					/*    definition, and is a candidate */
 					/*    for versioning */
 
-#define	FLG_SY1_HIDDEN	0x00000010	/* global symbol, reduce to local */
-#define	FLG_SY1_ELIM	0x00000020	/* global symbol, eliminate */
-#define	FLG_SY1_IGNORE	0x00000040	/* global symbol, ignored */
+#define	FLG_SY_HIDDEN	0x0001000000000	/* global symbol, reduce to local */
+#define	FLG_SY_ELIM	0x0002000000000	/* global symbol, eliminate */
+#define	FLG_SY_IGNORE	0x0004000000000	/* global symbol, ignored */
 
-#define	MSK_SY1_LOCAL	(FLG_SY1_HIDDEN | FLG_SY1_ELIM | FLG_SY1_IGNORE)
+#define	MSK_SY_LOCAL	(FLG_SY_HIDDEN | FLG_SY_ELIM | FLG_SY_IGNORE)
 					/* this mask allows all local state */
 					/*    flags to be removed when the */
 					/*    symbol is copy relocated */
 
-#define	FLG_SY1_EXPDEF	0x00000100	/* symbol visibility defined */
+#define	FLG_SY_EXPDEF	0x0008000000000	/* symbol visibility defined */
 					/*    explicitly */
 
-#define	MSK_SY1_NOAUTO	(FLG_SY1_SINGLE | FLG_SY1_EXPORT | FLG_SY1_EXPDEF)
+#define	MSK_SY_NOAUTO	(FLG_SY_SINGLE | FLG_SY_EXPORT | FLG_SY_EXPDEF)
 					/* this mask indicates that the */
-					/*    symbol is not a  candidate for */
+					/*    symbol is not a candidate for */
 					/*    auto-reduction/elimination */
 
-#define	FLG_SY1_MAPFILE 0x00000200	/* symbol attribute defined in a */
+#define	FLG_SY_MAPFILE	0x0010000000000	/* symbol attribute defined in a */
 					/*    mapfile */
-#define	FLG_SY1_DIR	0x00000400	/* global symbol, direct bindings */
-#define	FLG_SY1_NDIR	0x00000800	/* global symbol, nondirect bindings */
-#define	FLG_SY1_OVERLAP	0x00001000	/* Move entry overlap detected */
+#define	FLG_SY_DIR	0x0020000000000	/* global symbol, direct bindings */
+#define	FLG_SY_NDIR	0x0040000000000	/* global symbol, nondirect bindings */
+#define	FLG_SY_OVERLAP	0x0080000000000	/* move entry overlap detected */
 
 /*
  * Create a mask for (sym.st_other & visibility) since the gABI does not yet
--- a/usr/src/cmd/sgs/ld/common/ld.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/ld/common/ld.c	Wed Oct 14 08:12:49 2009 -0700
@@ -514,6 +514,15 @@
 		return (0);
 
 	/*
+	 * Get rid of any leading white space, and make sure the environment
+	 * string has size.
+	 */
+	while (isspace(*ld_options))
+		ld_options++;
+	if (*ld_options == '\0')
+		return (0);
+
+	/*
 	 * Prevent modification of actual environment strings.
 	 */
 	if ((ld_options = strdup(ld_options)) == NULL) {
@@ -523,15 +532,6 @@
 	}
 
 	/*
-	 * Get rid of any leading white space, and make sure the environment
-	 * string has size.
-	 */
-	while (isspace(*ld_options))
-		ld_options++;
-	if (*ld_options == '\0')
-		return (1);
-
-	/*
 	 * Determine the number of options provided.
 	 */
 	nargc = process_ldoptions(ld_options, NULL);
--- a/usr/src/cmd/sgs/libld/common/_libld.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/_libld.h	Wed Oct 14 08:12:49 2009 -0700
@@ -217,7 +217,7 @@
 	int		(* ms_mach_sym_typecheck)(Sym_desc *, Sym *,
 			    Ifl_desc *, Ofl_desc *);
 	const char	*(* ms_is_regsym)(Ofl_desc *, Ifl_desc *, Sym *,
-			    const char *, int, Word, const char *, Word *);
+			    const char *, int, Word, const char *, sd_flag_t *);
 	Sym_desc	*(* ms_reg_find)(Sym * sym, Ofl_desc * ofl);
 	int		(* ms_reg_enter)(Sym_desc *, Ofl_desc *);
 } Target_machsym;
@@ -805,13 +805,13 @@
 extern int		ld_sym_avl_comp(const void *, const void *);
 extern uintptr_t	ld_sym_copy(Sym_desc *);
 extern Sym_desc		*ld_sym_enter(const char *, Sym *, Word, Ifl_desc *,
-			    Ofl_desc *, Word, Word, Word, Half, avl_index_t *);
+			    Ofl_desc *, Word, Word, sd_flag_t, avl_index_t *);
 extern Sym_desc		*ld_sym_find(const char *, Word, avl_index_t *,
 			    Ofl_desc *);
 extern uintptr_t	ld_sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *);
 extern uintptr_t	ld_sym_process(Is_desc *, Ifl_desc *, Ofl_desc *);
 extern uintptr_t	ld_sym_resolve(Sym_desc *, Sym *, Ifl_desc *,
-			    Ofl_desc *, int, Word, Word);
+			    Ofl_desc *, int, Word, sd_flag_t);
 extern uintptr_t	ld_sym_spec(Ofl_desc *);
 
 extern Target		ld_targ;
--- a/usr/src/cmd/sgs/libld/common/args.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/args.c	Wed Oct 14 08:12:49 2009 -0700
@@ -107,7 +107,6 @@
 static Boolean	Blflag	= FALSE;
 static Boolean	Beflag	= FALSE;
 static Boolean	Bsflag	= FALSE;
-static Boolean	Btflag	= FALSE;
 static Boolean	Dflag	= FALSE;
 static Boolean	Gflag	= FALSE;
 static Boolean	Vflag	= FALSE;
@@ -476,12 +475,6 @@
 				    MSG_INTL(MSG_MARG_SONAME));
 				ofl->ofl_flags |= FLG_OF_FATAL;
 			}
-			if (Btflag) {
-				eprintf(ofl->ofl_lml, ERR_FATAL,
-				    MSG_INTL(MSG_ARG_DY_INCOMP),
-				    MSG_ORIG(MSG_ARG_BTRANS));
-				ofl->ofl_flags |= FLG_OF_FATAL;
-			}
 		} else if (!rflag) {
 			/*
 			 * Shared library.
@@ -509,13 +502,6 @@
 				ofl->ofl_flags |= FLG_OF_SYMBOLIC;
 				ofl->ofl_dtflags |= DF_SYMBOLIC;
 			}
-
-			if (Btflag) {
-				ofl->ofl_dtflags_1 |=
-				    (DF_1_TRANS | DF_1_DIRECT);
-				ofl->ofl_flags |= FLG_OF_SYMINFO;
-			}
-
 		} else {
 			/*
 			 * Dynamic relocatable object.
@@ -1420,15 +1406,18 @@
 				ofl->ofl_flags |= FLG_OF_PROCRED;
 			else if (strcmp(optarg, MSG_ORIG(MSG_STR_LOCAL)) == 0)
 				Blflag = TRUE;
-			else if (strcmp(optarg,
-			    MSG_ORIG(MSG_ARG_TRANSLATOR)) == 0)
-				Btflag = TRUE;
 			else if (strcmp(optarg, MSG_ORIG(MSG_ARG_GROUP)) == 0)
 				Bgflag = TRUE;
 			else if (strcmp(optarg,
 			    MSG_ORIG(MSG_STR_ELIMINATE)) == 0)
 				Beflag = TRUE;
-			else if (strcmp(optarg, MSG_ORIG(MSG_STR_LD_DYNAMIC)) &&
+			else if (strcmp(optarg,
+			    MSG_ORIG(MSG_ARG_TRANSLATOR)) == 0) {
+				eprintf(ofl->ofl_lml, ERR_WARNING,
+				    MSG_INTL(MSG_ARG_UNSUPPORTED),
+				    MSG_ORIG(MSG_ARG_BTRANSLATOR));
+			} else if (strcmp(optarg,
+			    MSG_ORIG(MSG_STR_LD_DYNAMIC)) &&
 			    strcmp(optarg, MSG_ORIG(MSG_ARG_STATIC))) {
 				eprintf(ofl->ofl_lml, ERR_FATAL,
 				    MSG_INTL(MSG_ARG_ILLEGAL),
--- a/usr/src/cmd/sgs/libld/common/files.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/files.c	Wed Oct 14 08:12:49 2009 -0700
@@ -98,7 +98,7 @@
 		return (0);
 	}
 
-	if ((ifl = libld_calloc(1, sizeof (Ifl_desc))) == 0)
+	if ((ifl = libld_calloc(1, sizeof (Ifl_desc))) == NULL)
 		return ((Ifl_desc *)S_ERROR);
 	ifl->ifl_name = name;
 	ifl->ifl_ehdr = ehdr;
@@ -139,7 +139,7 @@
 	}
 
 	if ((ifl->ifl_isdesc = libld_calloc(ifl->ifl_shnum,
-	    sizeof (Is_desc *))) == 0)
+	    sizeof (Is_desc *))) == NULL)
 		return ((Ifl_desc *)S_ERROR);
 
 	/*
@@ -172,7 +172,7 @@
 	 * section elf_getdata() will still create a data buffer (the buffer
 	 * will be null and the size will reflect the actual memory size).
 	 */
-	if ((isp = libld_calloc(sizeof (Is_desc), 1)) == 0)
+	if ((isp = libld_calloc(sizeof (Is_desc), 1)) == NULL)
 		return (S_ERROR);
 	isp->is_shdr = shdr;
 	isp->is_file = ifl;
@@ -816,7 +816,7 @@
 	if (shdr->sh_link < ndx) {
 		Is_desc	*isp = ifl->ifl_isdesc[shdr->sh_link];
 
-		if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
+		if ((isp == NULL) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
 		    (isp->is_shdr->sh_type != SHT_DYNSYM))) {
 			eprintf(ofl->ofl_lml, ERR_FATAL,
 			    MSG_INTL(MSG_FIL_INVSHLINK), ifl->ifl_name,
@@ -838,7 +838,7 @@
 	if (isc->is_shdr->sh_link > isc->is_scnndx) {
 		Is_desc	*isp = ifl->ifl_isdesc[isc->is_shdr->sh_link];
 
-		if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
+		if ((isp == NULL) || ((isp->is_shdr->sh_type != SHT_SYMTAB) &&
 		    (isp->is_shdr->sh_type != SHT_DYNSYM))) {
 			eprintf(ofl->ofl_lml, ERR_FATAL,
 			    MSG_INTL(MSG_FIL_INVSHLINK), isc->is_file->ifl_name,
@@ -941,10 +941,10 @@
  *
  * This code is remarkably similar to expand() in rtld/common/paths.c.
  */
-static char		*platform = 0;
+static char		*platform = NULL;
 static size_t		platform_sz = 0;
-static Isa_desc		*isa = 0;
-static Uts_desc		*uts = 0;
+static Isa_desc		*isa = NULL;
+static Uts_desc		*uts = NULL;
 
 static char *
 expand(const char *parent, const char *name, char **next)
@@ -979,7 +979,7 @@
 			 * on $ORIGIN/lib2.so would be expanded to
 			 * foo/bar/lib2.so.
 			 */
-			if ((eptr = strrchr(parent, '/')) == 0) {
+			if ((eptr = strrchr(parent, '/')) == NULL) {
 				*nptr++ = '.';
 				nrem--;
 			} else {
@@ -1000,7 +1000,7 @@
 			/*
 			 * Establish the platform from sysconf - like uname -i.
 			 */
-			if ((platform == 0) && (platform_sz == 0)) {
+			if ((platform == NULL) && (platform_sz == 0)) {
 				char	info[SYS_NMLN];
 				long	size;
 
@@ -1012,7 +1012,7 @@
 				} else
 					platform_sz = 1;
 			}
-			if (platform != 0) {
+			if (platform) {
 				if (platform_sz >= nrem)
 					return ((char *)name);
 
@@ -1029,7 +1029,7 @@
 			/*
 			 * Establish the os name - like uname -s.
 			 */
-			if (uts == 0)
+			if (uts == NULL)
 				uts = conv_uts();
 
 			if (uts && uts->uts_osnamesz) {
@@ -1050,7 +1050,7 @@
 			/*
 			 * Establish the os release - like uname -r.
 			 */
-			if (uts == 0)
+			if (uts == NULL)
 				uts = conv_uts();
 
 			if (uts && uts->uts_osrelsz) {
@@ -1072,7 +1072,7 @@
 			 * Establish instruction sets from sysconf.  Note that
 			 * this is only meaningful from runpaths.
 			 */
-			if (isa == 0)
+			if (isa == NULL)
 				isa = conv_isalist();
 
 			if (isa && isa->isa_listsz &&
@@ -1103,7 +1103,7 @@
 				    isa->isa_listsz - opt->isa_namesz;
 				if (*next)
 					mlen += strlen(*next);
-				if ((_next = lptr = libld_malloc(mlen)) == 0)
+				if ((_next = lptr = libld_malloc(mlen)) == NULL)
 					return (0);
 
 				for (no = 1, opt++; no < isa->isa_optno;
@@ -1153,7 +1153,7 @@
 	*nptr = '\0';
 
 	if (expanded) {
-		if ((nptr = libld_malloc(strlen(_name) + 1)) == 0)
+		if ((nptr = libld_malloc(strlen(_name) + 1)) == NULL)
 			return ((char *)name);
 		(void) strcpy(nptr, _name);
 		return (nptr);
@@ -1274,7 +1274,7 @@
 			 * runpath which is exactly what ld.so.1 would do during
 			 * its dependency processing).
 			 */
-			if (rpath && (sdf->sdf_rpath == 0))
+			if (rpath && (sdf->sdf_rpath == NULL))
 				sdf->sdf_rpath = rpath;
 
 		} else if (dyn->d_tag == DT_FLAGS_1) {
@@ -1673,7 +1673,7 @@
 
 	DBG_CALL(Dbg_file_generic(ofl->ofl_lml, ifl));
 	ndx = 0;
-	vdfisp = vndisp = vsyisp = sifisp = capisp = 0;
+	vdfisp = vndisp = vsyisp = sifisp = capisp = NULL;
 	scn = NULL;
 	while (scn = elf_nextscn(elf, scn)) {
 		ndx++;
@@ -1943,7 +1943,7 @@
 	 * from this object. It may also update the dependency to USED and
 	 * supply an alternative SONAME.
 	 */
-	sdf = 0;
+	sdf = NULL;
 	if (column && (ifl->ifl_flags & FLG_IF_NEEDED)) {
 		const char	*base;
 
@@ -1999,7 +1999,7 @@
 	for (ndx = 0; ndx < ifl->ifl_shnum; ndx++) {
 		Is_desc	*isp;
 
-		if ((isp = ifl->ifl_isdesc[ndx]) == 0)
+		if ((isp = ifl->ifl_isdesc[ndx]) == NULL)
 			continue;
 		row = isp->is_shdr->sh_type;
 
@@ -2062,17 +2062,17 @@
  * Process the current input file.  There are basically three types of files
  * that come through here:
  *
- *  o	files explicitly defined on the command line (ie. foo.o or bar.so),
+ *  -	files explicitly defined on the command line (ie. foo.o or bar.so),
  *	in this case only the `name' field is valid.
  *
- *  o	libraries determined from the -l command line option (ie. -lbar),
+ *  -	libraries determined from the -l command line option (ie. -lbar),
  *	in this case the `soname' field contains the basename of the located
  *	file.
  *
  * Any shared object specified via the above two conventions must be recorded
  * as a needed dependency.
  *
- *  o	libraries specified as dependencies of those libraries already obtained
+ *  -	libraries specified as dependencies of those libraries already obtained
  *	via the command line (ie. bar.so has a DT_NEEDED entry of fred.so.1),
  *	in this case the `soname' field contains either a full pathname (if the
  *	needed entry contained a `/'), or the basename of the located file.
@@ -2136,7 +2136,7 @@
 		 * archive descriptor.
 		 */
 		adp = ld_ar_setup(name, elf, ofl);
-		if ((adp == 0) || (adp == (Ar_desc *)S_ERROR))
+		if ((adp == NULL) || (adp == (Ar_desc *)S_ERROR))
 			return ((Ifl_desc *)adp);
 		adp->ad_stdev = status.st_dev;
 		adp->ad_stino = status.st_ino;
@@ -2266,7 +2266,7 @@
 		 * file descriptor and continue processing.
 		 */
 		ifl = ifl_setup(name, ehdr, elf, flags, ofl, rej);
-		if ((ifl == 0) || (ifl == (Ifl_desc *)S_ERROR))
+		if ((ifl == NULL) || (ifl == (Ifl_desc *)S_ERROR))
 			return (ifl);
 		ifl->ifl_stdev = status.st_dev;
 		ifl->ifl_stino = status.st_ino;
@@ -2466,7 +2466,7 @@
 		Ifl_desc	*ifl;
 		char		*_path;
 
-		if ((_path = libld_malloc(strlen(path) + 1)) == 0)
+		if ((_path = libld_malloc(strlen(path) + 1)) == NULL)
 			return ((Ifl_desc *)S_ERROR);
 		(void) strcpy(_path, path);
 		ifl = ld_process_open(_path, &_path[dlen], &fd, ofl, 0, rej);
@@ -2482,11 +2482,11 @@
  * without adding them as explicit dependents of this program, in order to
  * complete our symbol definition process.  The search path rules are:
  *
- *  o	use any user supplied paths, i.e. LD_LIBRARY_PATH and -L, then
+ *  -	use any user supplied paths, i.e. LD_LIBRARY_PATH and -L, then
  *
- *  o	use any RPATH defined within the parent shared object, then
+ *  -	use any RPATH defined within the parent shared object, then
  *
- *  o	use the default directories, i.e. LIBPATH or -YP.
+ *  -	use the default directories, i.e. LIBPATH or -YP.
  */
 uintptr_t
 ld_finish_libs(Ofl_desc *ofl)
@@ -2600,7 +2600,7 @@
 			char	*rpath, *next;
 
 			rpath = libld_malloc(strlen(sdf->sdf_rpath) + 1);
-			if (rpath == 0)
+			if (rpath == NULL)
 				return (S_ERROR);
 			(void) strcpy(rpath, sdf->sdf_rpath);
 			DBG_CALL(Dbg_libs_path(ofl->ofl_lml, rpath,
--- a/usr/src/cmd/sgs/libld/common/ldentry.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/ldentry.c	Wed Oct 14 08:12:49 2009 -0700
@@ -140,7 +140,7 @@
 	 */
 	for (sav = avl_first(&ofl->ofl_symavl); sav;
 	    sav = AVL_NEXT(&ofl->ofl_symavl, sav)) {
-		Sym_desc	*sdp = sav->sav_symdesc;
+		Sym_desc	*sdp = sav->sav_sdp;
 		const char	*name = sdp->sd_name, *ducp, *adcp;
 		APlist		*dfiles;
 		Aliste		idx;
--- a/usr/src/cmd/sgs/libld/common/libld.msg	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/libld.msg	Wed Oct 14 08:12:49 2009 -0700
@@ -839,6 +839,7 @@
 @ MSG_ARG_NODEFLIB	"the default library search path has been suppressed, \
 			 but no runpaths have been specified via %s"
 @ MSG_ARG_NOENTRY	"entry point symbol `%s' is undefined"
+@ MSG_ARG_UNSUPPORTED	"option %s is no longer supported; ignored"
 
 @ MSG_ARG_FLAGS		"flags processing errors"
 @ MSG_ARG_FILES		"file processing errors. No output written to %s"
@@ -1007,7 +1008,7 @@
 			 after `-'"
 @ MSG_MAP_EXPVERS	"%s: %lld: expected a `;' or version reference \
 			 after `}'"
-@ MSG_MAP_MULTFILTEE	"%s: %lld: multiple filtee definitions unsupported"
+@ MSG_MAP_MULTFILTEE	"%s: %lld: multiple filtee definitions are unsupported"
 @ MSG_MAP_NOFILTER	"%s: %lld: filtee definition required"
 @ MSG_MAP_BADSF1	"%s: %lld: unknown software capabilities: 0x%llx; \
 			 ignored"
@@ -1133,7 +1134,7 @@
 @ MSG_ARG_BLOCAL	"-Blocal"
 @ MSG_ARG_BNODIRECT	"-Bnodirect"
 @ MSG_ARG_BSYMBOLIC	"-Bsymbolic"
-@ MSG_ARG_BTRANS	"-Btrans"
+@ MSG_ARG_BTRANSLATOR	"-Btranslator"
 @ MSG_ARG_C		"-c"
 @ MSG_ARG_D		"-d"
 @ MSG_ARG_DY		"-dy"
--- a/usr/src/cmd/sgs/libld/common/libs.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/libs.c	Wed Oct 14 08:12:49 2009 -0700
@@ -386,7 +386,7 @@
 			if ((allexrt == 0) && ((sdp = aup->au_syms) == NULL)) {
 				if ((sdp = ld_sym_find(arsym->as_name,
 				    /* LINTED */
-				    (Word)arsym->as_hash, 0, ofl)) == NULL) {
+				    (Word)arsym->as_hash, NULL, ofl)) == NULL) {
 					DBG_CALL(Dbg_syms_ar_entry(ofl->ofl_lml,
 					    ndx, arsym));
 					continue;
--- a/usr/src/cmd/sgs/libld/common/machrel.amd.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/machrel.amd.c	Wed Oct 14 08:12:49 2009 -0700
@@ -868,7 +868,7 @@
 				    arsp->rel_osdesc->os_outdata->d_buf;
 
 				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
-				    ELF_DBG_LD, M_MACH, SHT_RELA,
+				    ELF_DBG_LD_ACT, M_MACH, SHT_RELA,
 				    arsp->rel_rtype, R1addr, value,
 				    arsp->rel_sname, arsp->rel_osdesc));
 
@@ -986,7 +986,7 @@
 			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
 			    is_indata));
 
-			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD_ACT,
 			    M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr),
 			    value, arsp->rel_sname, arsp->rel_osdesc));
 			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
@@ -1063,8 +1063,7 @@
 	 * symbol in a static executable, it's best to disable them here
 	 * instead of through out the relocation code.
 	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
+	if (OFL_IS_STATIC_EXEC(ofl))
 		return (1);
 
 	/*
@@ -1407,7 +1406,7 @@
 		Sym_desc	*sdp;
 
 		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
+		    SYM_NOHASH, NULL, ofl)) != NULL) {
 			uchar_t	*genptr;
 
 			genptr = ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf +
--- a/usr/src/cmd/sgs/libld/common/machrel.intel.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/machrel.intel.c	Wed Oct 14 08:12:49 2009 -0700
@@ -957,7 +957,7 @@
 				    arsp->rel_osdesc->os_outdata->d_buf;
 
 				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
-				    ELF_DBG_LD, M_MACH, SHT_REL,
+				    ELF_DBG_LD_ACT, M_MACH, SHT_REL,
 				    arsp->rel_rtype, R1addr, value,
 				    arsp->rel_sname, arsp->rel_osdesc));
 
@@ -1065,7 +1065,7 @@
 			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
 			    is_indata));
 
-			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD_ACT,
 			    M_MACH, SHT_REL, arsp->rel_rtype, EC_NATPTR(addr),
 			    value, arsp->rel_sname, arsp->rel_osdesc));
 			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
@@ -1151,8 +1151,7 @@
 	 * symbol in a static executable, it's best to disable them here
 	 * instead of through out the relocation code.
 	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
+	if (OFL_IS_STATIC_EXEC(ofl))
 		return (1);
 
 	/*
@@ -1503,7 +1502,7 @@
 		Sym_desc	*sdp;
 
 		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
+		    SYM_NOHASH, NULL, ofl)) != NULL) {
 			uchar_t	*genptr;
 
 			genptr = ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf +
--- a/usr/src/cmd/sgs/libld/common/machrel.sparc.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/machrel.sparc.c	Wed Oct 14 08:12:49 2009 -0700
@@ -1269,7 +1269,7 @@
 				    arsp->rel_osdesc->os_outdata->d_buf;
 
 				DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml,
-				    ELF_DBG_LD, M_MACH, SHT_RELA,
+				    ELF_DBG_LD_ACT, M_MACH, SHT_RELA,
 				    arsp->rel_rtype, R1addr, value,
 				    arsp->rel_sname, arsp->rel_osdesc));
 
@@ -1368,8 +1368,7 @@
 			    (uintptr_t)_elf_getxoff(arsp->rel_isdesc->
 			    is_indata));
 
-			/*LINTED*/
-			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD,
+			DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD_ACT,
 			    M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr),
 			    value, arsp->rel_sname, arsp->rel_osdesc));
 			addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf;
@@ -1433,8 +1432,7 @@
 	 * symbol in a static executable, it's best to disable them here
 	 * instead of through out the relocation code.
 	 */
-	if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC))
+	if (OFL_IS_STATIC_EXEC(ofl))
 		return (1);
 
 	/*
@@ -2098,9 +2096,11 @@
 	 * Assign bias to GOT symbols.
 	 */
 	addr = -neggotoffset * M_GOT_ENTSIZE;
-	if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl))
+	if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH,
+	    NULL, ofl)) != NULL)
 		sdp->sd_sym->st_value = addr;
-	if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl))
+	if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH,
+	    NULL, ofl)) != NULL)
 		sdp->sd_sym->st_value = addr;
 
 	if (ofl->ofl_tlsldgotndx) {
@@ -2120,7 +2120,7 @@
 		Sym_desc	*sdp;
 
 		if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) {
+		    SYM_NOHASH, NULL, ofl)) != NULL) {
 			uchar_t	*genptr;
 
 			genptr = ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf +
--- a/usr/src/cmd/sgs/libld/common/machsym.sparc.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/machsym.sparc.c	Wed Oct 14 08:12:49 2009 -0700
@@ -20,11 +20,9 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #define	ELF_TARGET_SPARC
 
 #include	<stdio.h>
@@ -59,7 +57,7 @@
  */
 int
 ld_reg_check_sparc(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl,
-    Ofl_desc * ofl)
+    Ofl_desc *ofl)
 {
 	Sym		*osym = sdp->sd_sym;
 	const char	*oname = sdp->sd_name;
@@ -170,7 +168,7 @@
 
 const char *
 ld_is_regsym_sparc(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs,
-    int symndx, Word shndx, const char *symsecname, Word * flags)
+    int symndx, Word shndx, const char *symsecname, sd_flag_t *flags)
 {
 	const char	*name;
 
@@ -233,21 +231,23 @@
 }
 
 Sym_desc *
-ld_reg_find_sparc(Sym * sym, Ofl_desc * ofl)
+ld_reg_find_sparc(Sym *sym, Ofl_desc *ofl)
 {
-	if (ofl->ofl_regsyms == 0)
-		return (0);
+	if (ofl->ofl_regsyms == NULL)
+		return (NULL);
 
 	return (ofl->ofl_regsyms[sym->st_value]);
 }
 
 int
-ld_reg_enter_sparc(Sym_desc * sdp, Ofl_desc * ofl)
+ld_reg_enter_sparc(Sym_desc *sdp, Ofl_desc *ofl)
 {
-	if (ofl->ofl_regsyms == 0) {
+	if (ofl->ofl_regsyms == NULL) {
+
 		ofl->ofl_regsymsno = STO_SPARC_REGISTER_G7 + 1;
+
 		if ((ofl->ofl_regsyms = libld_calloc(sizeof (Sym_desc *),
-		    ofl->ofl_regsymsno)) == 0) {
+		    ofl->ofl_regsymsno)) == NULL) {
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			return (0);
 		}
--- a/usr/src/cmd/sgs/libld/common/machsym.sparc.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/machsym.sparc.h	Wed Oct 14 08:12:49 2009 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -31,8 +31,6 @@
 #ifndef	_MACHSYM_DOT_SPARC_DOT_H
 #define	_MACHSYM_DOT_SPARC_DOT_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -56,7 +54,7 @@
 #endif
 
 extern const char	*ld_is_regsym_sparc(Ofl_desc *, Ifl_desc *, Sym *,
-			    const char *, int, Word, const char *, Word *);
+			    const char *, int, Word, const char *, sd_flag_t *);
 extern int		ld_mach_sym_typecheck_sparc(Sym_desc *, Sym *,
 			    Ifl_desc *, Ofl_desc *);
 extern int		ld_reg_check_sparc(Sym_desc *, Sym *, const char *,
--- a/usr/src/cmd/sgs/libld/common/map.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/map.c	Wed Oct 14 08:12:49 2009 -0700
@@ -196,7 +196,7 @@
  *	#define AV_386_TSC 0x0002	 "    "    "   " 	TSC
  *
  * Or, the above two capabilities could be represented as V0x3.  Note, the
- * OVERRIDE flag is used to insure that only those values provided via this
+ * OVERRIDE flag is used to ensure that only those values provided via this
  * mapfile entry are recorded in the final image, ie. this overrides any
  * hardware capabilities that may be defined in the objects read as part of this
  * link-edit.  Specifying:
@@ -968,7 +968,7 @@
 
 /*
  * Obtain a pseudo input file descriptor to assign to a mapfile.  This is
- * required any time a symbol is generated.  First traverse the input file
+ * required any time a symbol is generated.  Traverse the input file
  * descriptors looking for a match.  As all mapfile processing occurs before
  * any real input file processing this list is going to be small and we don't
  * need to do any filename clash checking.
@@ -1054,7 +1054,7 @@
 		/* LINTED */
 		hval = (Word)elf_hash(name);
 		if ((sdp = ld_sym_enter(name, sym, hval, ifl, ofl, 0, SHN_ABS,
-		    (FLG_SY_SPECSEC | FLG_SY_GLOBREF), 0, &where)) ==
+		    (FLG_SY_SPECSEC | FLG_SY_GLOBREF), &where)) ==
 		    (Sym_desc *)S_ERROR)
 			return (S_ERROR);
 		sdp->sd_flags &= ~FLG_SY_CLEAN;
@@ -1380,8 +1380,7 @@
 		uchar_t 	type = STT_NOTYPE;
 		Addr		value = 0, size = 0;
 		char		*_name, *filtee = NULL;
-		Word		sym_flags = 0;
-		Half		sym_flags1 = 0;
+		sd_flag_t	sdflags = 0;
 		uint_t		filter = 0, novalue = 1, dftflag;
 		const char	*conflict;
 
@@ -1491,8 +1490,7 @@
 					    /* BEGIN CSTYLED */
 					    eprintf(ofl->ofl_lml, ERR_FATAL,
 						MSG_INTL(MSG_MAP_MULTFILTEE),
-						mapfile, EC_XWORD(Line_num),
-						_name);
+						mapfile, EC_XWORD(Line_num));
 					    errcnt++;
 					    continue;
 					    /* END CSTYLED */
@@ -1573,33 +1571,33 @@
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_FUNCTION)) == 0) {
 					shndx = SHN_ABS;
-					sym_flags |= FLG_SY_SPECSEC;
+					sdflags |= FLG_SY_SPECSEC;
 					type = STT_FUNC;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_DATA)) == 0) {
 					shndx = SHN_ABS;
-					sym_flags |= FLG_SY_SPECSEC;
+					sdflags |= FLG_SY_SPECSEC;
 					type = STT_OBJECT;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_COMMON)) == 0) {
 					shndx = SHN_COMMON;
-					sym_flags |= FLG_SY_SPECSEC;
+					sdflags |= FLG_SY_SPECSEC;
 					type = STT_OBJECT;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_PARENT)) == 0) {
-					sym_flags |= FLG_SY_PARENT;
+					sdflags |= FLG_SY_PARENT;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_EXTERN)) == 0) {
-					sym_flags |= FLG_SY_EXTERN;
+					sdflags |= FLG_SY_EXTERN;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_DIRECT)) == 0) {
-					sym_flags1 |= FLG_SY1_DIR;
+					sdflags |= FLG_SY_DIR;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_NODIRECT)) == 0) {
-					sym_flags1 |= FLG_SY1_NDIR;
+					sdflags |= FLG_SY_NDIR;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 					ofl->ofl_flags1 |=
 					    (FLG_OF1_NDIRECT | FLG_OF1_NGLBDIR);
@@ -1616,7 +1614,7 @@
 					}
 					/* END CSTYLED */
 					dftflag = filter = FLG_SY_STDFLTR;
-					sym_flags |= FLG_SY_STDFLTR;
+					sdflags |= FLG_SY_STDFLTR;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 					continue;
 				} else if (strcmp(Start_tok,
@@ -1632,7 +1630,7 @@
 					}
 					/* END CSTYLED */
 					dftflag = filter = FLG_SY_AUXFLTR;
-					sym_flags |= FLG_SY_AUXFLTR;
+					sdflags |= FLG_SY_AUXFLTR;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 					continue;
 				} else if (strcmp(Start_tok,
@@ -1646,19 +1644,19 @@
 					    break;
 					}
 					/* END CSTYLED */
-					sym_flags |= FLG_SY_INTPOSE;
+					sdflags |= FLG_SY_INTPOSE;
 					ofl->ofl_flags |= FLG_OF_SYMINFO;
 					ofl->ofl_dtflags_1 |= DF_1_SYMINTPOSE;
 					continue;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_DYNSORT)) == 0) {
-					sym_flags |= FLG_SY_DYNSORT;
-					sym_flags &= ~FLG_SY_NODYNSORT;
+					sdflags |= FLG_SY_DYNSORT;
+					sdflags &= ~FLG_SY_NODYNSORT;
 					continue;
 				} else if (strcmp(Start_tok,
 				    MSG_ORIG(MSG_MAP_NODYNSORT)) == 0) {
-					sym_flags &= ~FLG_SY_DYNSORT;
-					sym_flags |= FLG_SY_NODYNSORT;
+					sdflags &= ~FLG_SY_DYNSORT;
+					sdflags |= FLG_SY_NODYNSORT;
 					continue;
 				} else {
 					eprintf(ofl->ofl_lml, ERR_FATAL,
@@ -1716,8 +1714,7 @@
 				 * Make sure any parent or external declarations
 				 * fall back to references.
 				 */
-				if (sym_flags &
-				    (FLG_SY_PARENT | FLG_SY_EXTERN)) {
+				if (sdflags & (FLG_SY_PARENT | FLG_SY_EXTERN)) {
 					/*
 					 * Turn it into a reference by setting
 					 * the section index to UNDEF.
@@ -1744,8 +1741,8 @@
 				sym->st_size = size;
 				sym->st_info = ELF_ST_INFO(STB_GLOBAL, type);
 
-				if ((sdp = ld_sym_enter(_name, sym, hash, ifl,
-				    ofl, 0, shndx, sym_flags, sym_flags1,
+				if ((sdp = ld_sym_enter(_name, sym, hash,
+				    ifl, ofl, 0, shndx, sdflags,
 				    &where)) == (Sym_desc *)S_ERROR)
 					return (S_ERROR);
 
@@ -1802,11 +1799,11 @@
 					    conflict =
 						MSG_INTL(MSG_MAP_DIFF_SYMNDX);
 				} else {
-					sdp->sd_shndx = sym->st_shndx = shndx;
+					sym->st_shndx = sdp->sd_shndx = shndx;
 				}
 				/* END CSTYLED */
 
-				if ((sdp->sd_flags1 & MSK_SY1_GLOBAL) &&
+				if ((sdp->sd_flags & MSK_SY_GLOBAL) &&
 				    (sdp->sd_aux->sa_overndx !=
 				    VER_NDX_GLOBAL) &&
 				    (vdp->vd_ndx != VER_NDX_GLOBAL) &&
@@ -1870,7 +1867,7 @@
 				 * of update symbol processing.
 				 */
 				sdp->sd_flags &= ~FLG_SY_SPECSEC;
-				sym_flags &= ~FLG_SY_SPECSEC;
+				sdflags &= ~FLG_SY_SPECSEC;
 			}
 
 			/*
@@ -1886,11 +1883,11 @@
 				 * This symbol needs to be reduced to local.
 				 */
 				if (ofl->ofl_flags & FLG_OF_REDLSYM) {
-					sdp->sd_flags1 |=
-					    (FLG_SY1_HIDDEN | FLG_SY1_ELIM);
+					sdp->sd_flags |=
+					    (FLG_SY_HIDDEN | FLG_SY_ELIM);
 					sdp->sd_sym->st_other = STV_ELIMINATE;
 				} else {
-					sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+					sdp->sd_flags |= FLG_SY_HIDDEN;
 					sdp->sd_sym->st_other = STV_HIDDEN;
 				}
 			} else if (scope == FLG_SCOPE_ELIM) {
@@ -1900,8 +1897,7 @@
 				 * any necessary relocation processing prior
 				 * to the symbol being eliminated.
 				 */
-				sdp->sd_flags1 |=
-				    (FLG_SY1_HIDDEN | FLG_SY1_ELIM);
+				sdp->sd_flags |= (FLG_SY_HIDDEN | FLG_SY_ELIM);
 				sdp->sd_sym->st_other = STV_ELIMINATE;
 
 			} else {
@@ -1909,24 +1905,23 @@
 				 * This symbol is explicitly defined to remain
 				 * global.
 				 */
-				sdp->sd_flags |= sym_flags;
-				sdp->sd_flags1 |= sym_flags1;
+				sdp->sd_flags |= sdflags;
 
 				/*
 				 * Qualify any global scope.
 				 */
 				if (scope == FLG_SCOPE_SNGL) {
-					sdp->sd_flags1 |=
-					    (FLG_SY1_SINGLE | FLG_SY1_NDIR);
+					sdp->sd_flags |=
+					    (FLG_SY_SINGLE | FLG_SY_NDIR);
 					sdp->sd_sym->st_other = STV_SINGLETON;
 				} else if (scope == FLG_SCOPE_PROT) {
-					sdp->sd_flags1 |= FLG_SY1_PROTECT;
+					sdp->sd_flags |= FLG_SY_PROTECT;
 					sdp->sd_sym->st_other = STV_PROTECTED;
 				} else if (scope == FLG_SCOPE_EXPT) {
-					sdp->sd_flags1 |= FLG_SY1_EXPORT;
+					sdp->sd_flags |= FLG_SY_EXPORT;
 					sdp->sd_sym->st_other = STV_EXPORTED;
 				} else
-					sdp->sd_flags1 |= FLG_SY1_DEFAULT;
+					sdp->sd_flags |= FLG_SY_DEFAULT;
 
 				/*
 				 * Record the present version index for later
@@ -1947,29 +1942,28 @@
 			 * or resolved, to catch single instance, and
 			 * multi-instance definition inconsistencies.
 			 */
-			if ((sdp->sd_flags1 &
-			    (FLG_SY1_HIDDEN | FLG_SY1_ELIM)) &&
+			if ((sdp->sd_flags & (FLG_SY_HIDDEN | FLG_SY_ELIM)) &&
 			    ((scope != FLG_SCOPE_HIDD) &&
 			    (scope != FLG_SCOPE_ELIM))) {
 				conflict = MSG_INTL(MSG_MAP_DIFF_SYMLCL);
 
-			} else if (((sdp->sd_flags1 & FLG_SY1_SINGLE) ||
-			    (sdp->sd_flags1 & FLG_SY1_EXPORT)) &&
+			} else if ((sdp->sd_flags &
+			    (FLG_SY_SINGLE | FLG_SY_EXPORT)) &&
 			    ((scope != FLG_SCOPE_DFLT) &&
 			    (scope != FLG_SCOPE_EXPT) &&
 			    (scope != FLG_SCOPE_SNGL))) {
 				conflict = MSG_INTL(MSG_MAP_DIFF_SYMGLOB);
 
-			} else if ((sdp->sd_flags1 & FLG_SY1_PROTECT) &&
+			} else if ((sdp->sd_flags & FLG_SY_PROTECT) &&
 			    ((scope != FLG_SCOPE_DFLT) &&
 			    (scope != FLG_SCOPE_PROT))) {
 				conflict = MSG_INTL(MSG_MAP_DIFF_SYMPROT);
 
-			} else if ((sdp->sd_flags1 & FLG_SY1_NDIR) &&
+			} else if ((sdp->sd_flags & FLG_SY_NDIR) &&
 			    (scope == FLG_SCOPE_PROT)) {
 				conflict = MSG_INTL(MSG_MAP_DIFF_PROTNDIR);
 
-			} else if ((sdp->sd_flags1 & FLG_SY1_DIR) &&
+			} else if ((sdp->sd_flags & FLG_SY_DIR) &&
 			    (scope == FLG_SCOPE_SNGL)) {
 				conflict = MSG_INTL(MSG_MAP_DIFF_SNGLDIR);
 			}
@@ -1998,7 +1992,7 @@
 			 * Indicate that this symbol has been explicitly
 			 * contributed from a mapfile.
 			 */
-			sdp->sd_flags1 |= (FLG_SY1_MAPFILE | FLG_SY1_EXPDEF);
+			sdp->sd_flags |= (FLG_SY_MAPFILE | FLG_SY_EXPDEF);
 
 			/*
 			 * If we've encountered a symbol definition simulate
@@ -2469,10 +2463,9 @@
 		}
 
 		/*
-		 * If the second token is a '|' then we had better
-		 * of found a segment.  It is illegal to perform
-		 * section within segment ordering before the segment
-		 * has been declared.
+		 * If the second token is a '|' then we had better have found a
+		 * segment.  It is illegal to perform section within segment
+		 * ordering before the segment has been declared.
 		 */
 		if (tok == TK_PIPE) {
 			if (sgp1 == NULL) {
--- a/usr/src/cmd/sgs/libld/common/outfile.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/outfile.c	Wed Oct 14 08:12:49 2009 -0700
@@ -168,16 +168,17 @@
 
 /*
  * If we are creating a memory model we need to update the present memory image.
- * First we need to call elf_update(ELF_C_NULL) which will calculate the offsets
- * of each section and its associated data buffers.  From this information we
- * can then determine what padding is required.
+ * Use elf_update(ELF_C_NULL) to calculate the offset of each section and their
+ * associated data buffers.  From this information determine what padding is
+ * required.
+ *
  * Two actions are necessary to convert the present disc image into a memory
  * image:
  *
- *  o	Loadable segments must be padded so that the next segments virtual
+ *  -	Loadable segments must be padded so that the next segment virtual
  *	address and file offset are the same.
  *
- *  o	NOBITS sections must be converted into allocated, null filled sections.
+ *  -	NOBITS sections must be converted into allocated, null filled sections.
  */
 static uintptr_t
 pad_outfile(Ofl_desc *ofl)
@@ -348,19 +349,19 @@
  * Create the elf structures that allow the input data to be associated with the
  * new image:
  *
- *	o	define the new elf image using elf_begin(),
+ *  -	define the new elf image using elf_begin(),
  *
- *	o	obtain an elf header for the image,
+ *  -	obtain an elf header for the image,
  *
- *	o	traverse the input segments and create a program header array
- *		to define the required segments,
+ *  -	traverse the input segments and create a program header array to define
+ *	the required segments,
  *
- *	o 	traverse the output sections for each segment assigning a new
- *		section descriptor and section header for each,
+ *  -	traverse the output sections for each segment assigning a new section
+ *	descriptor and section header for each,
  *
- *	o	traverse the input sections associated with each output section
- *		and assign a new data descriptor to each (each output section
- *		becomes a linked list of input data buffers).
+ *  -	traverse the input sections associated with each output section and
+ *	assign a new data descriptor to each (each output section becomes a
+ *	linked list of input data buffers).
  */
 uintptr_t
 ld_create_outfile(Ofl_desc *ofl)
@@ -712,12 +713,11 @@
 	 * After all the basic input file processing, all data pointers are
 	 * referencing two types of memory:
 	 *
-	 *	o	allocated memory, ie. elf structures, internal link
-	 *		editor structures, and any new sections that have been
-	 *		created.
+	 *  -	allocated memory, ie. elf structures, internal link editor
+	 *	structures, and any new sections that have been created.
 	 *
-	 *	o	original input file mmap'ed memory, ie. the actual data
-	 *		sections of the input file images.
+	 *  -	original input file mmap'ed memory, ie. the actual data
+	 *	sections of the input file images.
 	 *
 	 * Up until now, the only memory modifications have been carried out on
 	 * the allocated memory.  Before carrying out any relocations, write the
--- a/usr/src/cmd/sgs/libld/common/relocate.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/relocate.c	Wed Oct 14 08:12:49 2009 -0700
@@ -151,8 +151,7 @@
 				continue;
 
 			/*
-			 * First, check if this symbol is reference symbol
-			 * for this relocation entry.
+			 * Determine if symbol is referenced from a relocation.
 			 */
 			rstndx = (Word) ELF_R_SYM(reloc->r_info);
 			rsdp = ifl->ifl_oldndx[rstndx];
@@ -175,7 +174,7 @@
 			}
 
 			/*
-			 * Then check if this relocation entry is relocating
+			 * Determine whether the relocation entry is relocating
 			 * this symbol.
 			 */
 			if ((sdp->sd_isc != trel) ||
@@ -283,11 +282,10 @@
 		 * either symbol.  Note, this test is very similar to the test
 		 * used in ld_sym_adjust_vis().
 		 */
-		if ((rlocal == TRUE) &&
-		    ((tsdp->sd_flags1 & FLG_SY1_HIDDEN) ||
+		if ((rlocal == TRUE) && ((tsdp->sd_flags & FLG_SY_HIDDEN) ||
 		    (ELF_ST_BIND(tsdp->sd_sym->st_info) != STB_GLOBAL) ||
 		    ((ofl->ofl_flags & (FLG_OF_AUTOLCL | FLG_OF_AUTOELM)) &&
-		    ((tsdp->sd_flags1 & MSK_SY1_NOAUTO) == 0))))
+		    ((tsdp->sd_flags & MSK_SY_NOAUTO) == 0))))
 			return (tsdp);
 
 		/*
@@ -717,10 +715,8 @@
 		 * If this symbol is binding to a LAZYLOADED object then
 		 * set the LAZYLD symbol flag.
 		 */
-		if ((sdp->sd_aux->sa_bindto &&
-		    (sdp->sd_aux->sa_bindto->ifl_flags & FLG_IF_LAZYLD)) ||
-		    (sdp->sd_file &&
-		    (sdp->sd_file->ifl_flags & FLG_IF_LAZYLD)))
+		if (sdp->sd_file &&
+		    (sdp->sd_file->ifl_flags & FLG_IF_LAZYLD))
 			sdp->sd_flags |= FLG_SY_LAZYLD;
 
 		rsp->rel_rtype = ld_targ.t_m.m_r_jmp_slot;
@@ -887,14 +883,14 @@
 		 * to carry out a number of checks against the symbols binding
 		 * that are triggered by the REF_DYN_NEED state.
 		 */
-		sdp->sd_flags |= FLG_SY_MVTOCOMM;
-		sdp->sd_flags1 |= (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF);
-		sdp->sd_flags1 &= ~MSK_SY1_LOCAL;
+		sdp->sd_flags |=
+		    (FLG_SY_MVTOCOMM | FLG_SY_DEFAULT | FLG_SY_EXPDEF);
+		sdp->sd_flags &= ~MSK_SY_LOCAL;
 		sdp->sd_sym->st_other &= ~MSK_SYM_VISIBILITY;
 		if (_sdp) {
-			_sdp->sd_flags |= FLG_SY_MVTOCOMM;
-			_sdp->sd_flags1 |= (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF);
-			_sdp->sd_flags1 &= ~MSK_SY1_LOCAL;
+			_sdp->sd_flags |= (FLG_SY_MVTOCOMM |
+			    FLG_SY_DEFAULT | FLG_SY_EXPDEF);
+			_sdp->sd_flags &= ~MSK_SY_LOCAL;
 			_sdp->sd_sym->st_other &= ~MSK_SYM_VISIBILITY;
 
 			/*
@@ -972,7 +968,7 @@
 /*
  * All relocations should have been handled by the other routines.  This
  * routine is here as a catch all, if we do enter it we've goofed - but
- * we'll try and to the best we can.
+ * we'll try and do the best we can.
  */
 static uintptr_t
 reloc_generic(Rel_desc *rsp, Ofl_desc *ofl)
@@ -1030,7 +1026,7 @@
 	 */
 	if (local && (((ofl->ofl_flags & FLG_OF_REDLSYM) &&
 	    (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL)) ||
-	    ((sdp->sd_flags1 & FLG_SY1_ELIM) &&
+	    ((sdp->sd_flags & FLG_SY_ELIM) &&
 	    (ofl->ofl_flags & FLG_OF_PROCRED)))) {
 		/*
 		 * But if this is PIC code, don't allow it for now.
@@ -1095,8 +1091,7 @@
 	/*
 	 * All TLS relocations are illegal in a static executable.
 	 */
-	if ((flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-	    (FLG_OF_STATIC | FLG_OF_EXEC)) {
+	if (OFL_IS_STATIC_EXEC(ofl)) {
 		eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT),
 		    conv_reloc_type(mach, rtype, 0, &inv_buf1), ifl->ifl_name,
 		    demangle(rsp->rel_sname));
@@ -1217,25 +1212,25 @@
 	 * Determine whether this symbol should be bound locally or not.
 	 * Symbols are bound locally if one of the following is true:
 	 *
-	 *  o	the symbol is of type STB_LOCAL.
+	 *  -	the symbol is of type STB_LOCAL.
 	 *
-	 *  o	the output image is not a relocatable object and the relocation
+	 *  -	the output image is not a relocatable object and the relocation
 	 *	is relative to the .got.
 	 *
-	 *  o	the section being relocated is of type SHT_SUNW_dof.  These
+	 *  -	the section being relocated is of type SHT_SUNW_dof.  These
 	 *	sections must be bound to the functions in the containing
 	 *	object and can not be interposed upon.
 	 *
-	 *  o	the symbol has been reduced (scoped to a local or symbolic) and
+	 *  -	the symbol has been reduced (scoped to a local or symbolic) and
 	 *	reductions are being processed.
 	 *
-	 *  o	the -Bsymbolic flag is in use when building a shared object,
+	 *  -	the -Bsymbolic flag is in use when building a shared object,
 	 *	and the symbol hasn't explicitly been defined as nodirect.
 	 *
-	 *  o	an executable (fixed address) is being created, and the symbol
+	 *  -	an executable (fixed address) is being created, and the symbol
 	 *	is defined in the executable.
 	 *
-	 *  o	the relocation is against a segment which will not be loaded
+	 *  -	the relocation is against a segment which will not be loaded
 	 *	into memory.  In this case, the relocation must be resolved
 	 *	now, as ld.so.1 can not process relocations against unmapped
 	 *	segments.
@@ -1250,8 +1245,7 @@
 		    reld->rel_isdesc->is_shdr->sh_type == SHT_SUNW_dof) {
 			local = TRUE;
 		} else if (!(flags & FLG_OF_RELOBJ) &&
-		    (IS_LOCALBND(rtype) ||
-		    IS_SEG_RELATIVE(rtype))) {
+		    (IS_LOCALBND(rtype) || IS_SEG_RELATIVE(rtype))) {
 			local = TRUE;
 		} else if (sdp->sd_ref == REF_REL_NEED) {
 			/*
@@ -1263,13 +1257,14 @@
 			 * explicit no-direct symbols should not be bound to
 			 * locally.
 			 */
-			if ((sdp->sd_flags1 &
-			    (FLG_SY1_HIDDEN | FLG_SY1_PROTECT)))
+			if ((sdp->sd_flags &
+			    (FLG_SY_HIDDEN | FLG_SY_PROTECT)))
 				local = TRUE;
 			else if ((flags & FLG_OF_EXEC) ||
 			    ((flags & FLG_OF_SYMBOLIC) &&
-			    ((sdp->sd_flags1 & FLG_SY1_NDIR) == 0)))
+			    ((sdp->sd_flags & FLG_SY_NDIR) == 0))) {
 				local = TRUE;
+			}
 		}
 	}
 
@@ -1355,7 +1350,7 @@
 	if (local)
 		return ((*ld_targ.t_mr.mr_reloc_local)(reld, ofl));
 
-	if ((IS_PLT(rtype)) && ((flags & FLG_OF_BFLAG) == 0))
+	if (IS_PLT(rtype) && ((flags & FLG_OF_BFLAG) == 0))
 		return (ld_reloc_plt(reld, ofl));
 
 	if ((sdp->sd_ref == REF_REL_NEED) ||
@@ -1674,7 +1669,7 @@
 		return (S_ERROR);
 	}
 
-	if (sdp->sd_flags1 & FLG_SY1_IGNORE)
+	if (sdp->sd_flags & FLG_SY_IGNORE)
 		return (1);
 
 	/*
@@ -1702,18 +1697,19 @@
 
 				/*
 				 * A matching symbol was not found. We will
-				 * ignore this relocation. First, we must
-				 * decide whether or not to issue a warning.
+				 * ignore this relocation.  Determine whether
+				 * or not to issue a warning.
 				 * Warnings are always issued under -z verbose,
 				 * but otherwise, we will follow the lead of
 				 * the GNU ld and suppress them for certain
 				 * cases:
-				 *	- It is a non-allocable debug section.
-				 *	  The GNU ld tests for these by name,
-				 *	  but we are willing to extend it to
-				 *	  any non-allocable section.
-				 *	- The target section is excluded from
-				 *	  sloppy relocations by policy.
+				 *
+				 *  -	It is a non-allocable debug section.
+				 *	The GNU ld tests for these by name,
+				 *	but we are willing to extend it to
+				 *	any non-allocable section.
+				 *  -	The target section is excluded from
+				 *	sloppy relocations by policy.
 				 */
 				if (((ofl->ofl_flags & FLG_OF_VERBOSE) != 0) ||
 				    ((is_shdr->sh_flags & SHF_ALLOC) &&
@@ -1732,7 +1728,7 @@
 				return (1);
 			}
 		} else if (reld->rel_sname == sdp->sd_name)
-			nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, 0, ofl);
+			nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, NULL, ofl);
 
 		if (nsdp == NULL) {
 			eprintf(ofl->ofl_lml, ERR_FATAL,
@@ -2103,8 +2099,8 @@
 	ofl->ofl_gotcnt = ld_targ.t_m.m_got_xnumber;
 
 	/*
-	 * First process all of the relocations against NON-writable
-	 * segments followed by relocations against the writeable segments.
+	 * Process all of the relocations against NON-writable segments
+	 * followed by relocations against the writable segments.
 	 *
 	 * This separation is so that when the writable segments are processed
 	 * we know whether or not a COPYRELOC will be produced for any symbols.
@@ -2160,9 +2156,10 @@
 	if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) &&
 	    ((ofl->ofl_flags & FLG_OF_BLDGOT) ||
 	    ((((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL),
-	    SYM_NOHASH, 0, ofl)) != 0) ||
+	    SYM_NOHASH, NULL, ofl)) != NULL) ||
 	    ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U),
-	    SYM_NOHASH, 0, ofl)) != 0)) && (sdp->sd_ref != REF_DYN_SEEN)))) {
+	    SYM_NOHASH, NULL, ofl)) != NULL)) &&
+	    (sdp->sd_ref != REF_DYN_SEEN)))) {
 		if (ld_make_got(ofl) == S_ERROR)
 			return (S_ERROR);
 
@@ -2341,7 +2338,7 @@
 	 * Determine the index of the symbol table that will be referenced by
 	 * the relocation entries.
 	 */
-	if ((flags & (FLG_OF_DYNAMIC|FLG_OF_RELOBJ)) == FLG_OF_DYNAMIC)
+	if (OFL_ALLOW_DYNSYM(ofl))
 		/* LINTED */
 		ndx = (Word)elf_ndxscn(ofl->ofl_osdynsym->os_scn);
 	else if (!(flags & FLG_OF_STRIP) || (flags & FLG_OF_RELOBJ))
@@ -2370,12 +2367,11 @@
 		Aliste	idx1;
 
 		/*
-		 * Process the relocation sections:
-		 *
-		 *  o	for each relocation section generated for the output
-		 *	image update its shdr information to reflect the
-		 *	symbol table it needs (sh_link) and the section to
-		 *	which the relocation must be applied (sh_info).
+		 * Process the relocation sections.  For each relocation
+		 * section generated for the output image update its shdr
+		 * information to reflect the symbol table it needs (sh_link)
+		 * and the section to which the relocation must be applied
+		 * (sh_info).
 		 */
 		for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
 			Os_desc *osp;
@@ -2636,9 +2632,9 @@
 
 /*
  * Partially Initialized Symbol Handling routines
- * For RELA architecture, the second argument is reld->rel_raddend.
- * For REL  architecure, the second argument is the value stored
- *	at the relocation target address.
+ * For RELA architecture, the second argument is reld->rel_raddend.  For REL
+ * architecure, the second argument is the value stored at the relocation
+ * target address.
  */
 Sym_desc *
 ld_am_I_partial(Rel_desc *reld, Xword val)
--- a/usr/src/cmd/sgs/libld/common/resolve.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/resolve.c	Wed Oct 14 08:12:49 2009 -0700
@@ -54,7 +54,7 @@
 /* ARGSUSED0 */
 static void
 sym_null(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 }
 
@@ -184,7 +184,7 @@
 	if ((wnvis == STV_EXPORTED) || (wnvis == STV_SINGLETON)) {
 		if ((wovis != STV_DEFAULT) && (wovis != STV_EXPORTED) &&
 		    (wovis != STV_SINGLETON)) {
-			if (sdp->sd_flags1 & FLG_SY1_MAPFILE) {
+			if (sdp->sd_flags & FLG_SY_MAPFILE) {
 				sym_visibility_diag(ERR_WARNING, sdp, osym,
 				    nsym, ifl, ofl);
 			} else {
@@ -197,7 +197,7 @@
 	if (wovis == STV_SINGLETON) {
 		if ((wnvis == STV_EXPORTED) || (wnvis == STV_DEFAULT))
 			return (STV_SINGLETON);
-		if (sdp->sd_flags1 & FLG_SY1_MAPFILE) {
+		if (sdp->sd_flags & FLG_SY_MAPFILE) {
 			sym_visibility_diag(ERR_WARNING, sdp, osym,
 			    nsym, ifl, ofl);
 		} else {
@@ -211,7 +211,7 @@
 			return (STV_SINGLETON);
 		if (wnvis == STV_DEFAULT)
 			return (STV_EXPORTED);
-		if (sdp->sd_flags1 & FLG_SY1_MAPFILE) {
+		if (sdp->sd_flags & FLG_SY_MAPFILE) {
 			sym_visibility_diag(ERR_WARNING, sdp, osym,
 			    nsym, ifl, ofl);
 		} else {
@@ -231,7 +231,7 @@
 	 */
 	if ((wnvis == STV_INTERNAL) || (wovis == STV_INTERNAL)) {
 		if ((wnvis == STV_INTERNAL) &&
-		    (sdp->sd_flags1 & FLG_SY1_MAPFILE)) {
+		    (sdp->sd_flags & FLG_SY_MAPFILE)) {
 			sym_visibility_diag(ERR_WARNING, sdp, osym, nsym,
 			    ifl, ofl);
 		}
@@ -239,7 +239,7 @@
 
 	} else if ((wnvis == STV_HIDDEN) || (wovis == STV_HIDDEN)) {
 		if ((wnvis == STV_HIDDEN) &&
-		    (sdp->sd_flags1 & FLG_SY1_MAPFILE)) {
+		    (sdp->sd_flags & FLG_SY_MAPFILE)) {
 			sym_visibility_diag(ERR_WARNING, sdp, osym, nsym,
 			    ifl, ofl);
 		}
@@ -266,7 +266,7 @@
 /*ARGSUSED4*/
 static void
 sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	uchar_t		otype = ELF_ST_TYPE(sdp->sd_sym->st_info);
 	uchar_t		ntype = ELF_ST_TYPE(nsym->st_info);
@@ -298,7 +298,7 @@
 /*ARGSUSED4*/
 static void
 sym_mach_check(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	/*
 	 * Perform any machine specific type checking.
@@ -314,11 +314,11 @@
 static void
 /* ARGSUSED4 */
 sym_promote(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Word	shndx = nsym->st_shndx;
 
-	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 
 	/*
 	 * If the old symbol is from a shared object and the new symbol is a
@@ -343,19 +343,11 @@
 		 * it is a global or weak reference (see build_osym(), where
 		 * REF_DYN_NEED definitions are returned back to undefines).
 		 */
-		if (((shndx == SHN_UNDEF) || ((nsymflags & FLG_SY_SPECSEC) &&
+		if (((shndx == SHN_UNDEF) || ((nsdflags & FLG_SY_SPECSEC) &&
 		    (shndx == SHN_COMMON))) &&
 		    (ELF_ST_BIND(nsym->st_info) == STB_GLOBAL))
 			sdp->sd_flags |= FLG_SY_GLOBREF;
 
-	} else if ((shndx != SHN_UNDEF) && (ofl->ofl_dtflags_1 & DF_1_TRANS) &&
-	    (sdp->sd_aux->sa_bindto == 0) && (sdp->sd_ref == REF_REL_NEED) &&
-	    (ifl->ifl_ehdr->e_type == ET_DYN)) {
-		/*
-		 * If building a translator then record the symbol
-		 * we would 'bindto' with direct bindings.
-		 */
-		sdp->sd_aux->sa_bindto = ifl;
 	}
 }
 
@@ -364,7 +356,7 @@
  */
 static void
 sym_override(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Sym	*osym = sdp->sd_sym;
 	Word	link;
@@ -381,7 +373,7 @@
 	    ((ifl->ifl_flags & FLG_IF_NEEDED) == 0))
 		return;
 
-	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 
 	/*
 	 * This symbol has already been compared to an SO definition,
@@ -398,7 +390,7 @@
 	*osym = *nsym;
 	sdp->sd_shndx = nshndx;
 	sdp->sd_flags &= ~FLG_SY_SPECSEC;
-	sdp->sd_flags |= (nsymflags & (FLG_SY_SPECSEC | FLG_SY_TENTSYM));
+	sdp->sd_flags |= (nsdflags & (FLG_SY_SPECSEC | FLG_SY_TENTSYM));
 
 	/*
 	 * If the new symbol has PROTECTED visibility, mark it.  If a PROTECTED
@@ -436,9 +428,9 @@
 			 * bound to, are tagged to prevent direct binding.
 			 */
 			if ((ofl->ofl_flags1 & FLG_OF1_ALNODIR) &&
-			    ((sdp->sd_flags1 &
-			    (FLG_SY1_PROTECT | FLG_SY1_DIR)) == 0))
-				sdp->sd_flags1 |= FLG_SY1_NDIR;
+			    ((sdp->sd_flags &
+			    (FLG_SY_PROTECT | FLG_SY_DIR)) == 0))
+				sdp->sd_flags |= FLG_SY_NDIR;
 		}
 
 		/*
@@ -447,7 +439,7 @@
 		 * REF_DYN_NEED definitions are returned back to undefines).
 		 */
 		if (((nsym->st_shndx == SHN_UNDEF) ||
-		    ((nsymflags & FLG_SY_SPECSEC) &&
+		    ((nsdflags & FLG_SY_SPECSEC) &&
 		    (nsym->st_shndx == SHN_COMMON))) &&
 		    (ELF_ST_BIND(nsym->st_info) == STB_GLOBAL))
 			sdp->sd_flags |= FLG_SY_GLOBREF;
@@ -501,7 +493,7 @@
 	/*
 	 * Update the input section descriptor to that of the new input file
 	 */
-	if (((nsymflags & FLG_SY_SPECSEC) == 0) &&
+	if (((nsdflags & FLG_SY_SPECSEC) == 0) &&
 	    (nsym->st_shndx != SHN_UNDEF)) {
 		if ((sdp->sd_isc = ifl->ifl_isdesc[nshndx]) == 0) {
 			eprintf(ofl->ofl_lml, ERR_FATAL,
@@ -517,7 +509,7 @@
  */
 static void
 sym_twoundefs(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Sym	*osym = sdp->sd_sym;
 	uchar_t	obind = ELF_ST_BIND(osym->st_info);
@@ -534,10 +526,10 @@
 	 */
 	if (((obind == STB_WEAK) && (nbind != STB_WEAK)) ||
 	    (obind == STT_NOTYPE) && (nbind != STT_NOTYPE)) {
-		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	}
-	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+	sym_typecheck(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 }
 
 /*
@@ -545,7 +537,7 @@
  */
 static void
 sym_tworeals(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Conv_inv_buf_t inv_buf1, inv_buf2;
 	Sym	*osym = sdp->sd_sym;
@@ -632,13 +624,13 @@
 		if (warn)
 			eprintf(ofl->ofl_lml, ERR_NONE,
 			    MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name);
-		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	} else {
 		if (warn)
 			eprintf(ofl->ofl_lml, ERR_NONE,
 			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
-		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	}
 }
@@ -648,7 +640,7 @@
  */
 static void
 sym_realtent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Conv_inv_buf_t inv_buf1, inv_buf2;
 	Sym	*osym = sdp->sd_sym;
@@ -682,7 +674,7 @@
 			eprintf(ofl->ofl_lml, ERR_WARNING,
 			    MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name));
 			sym_promote(sdp, nsym, ifl, ofl, ndx,
-			    nshndx, nsymflags);
+			    nshndx, nsdflags);
 		} else {
 			eprintf(ofl->ofl_lml, ERR_FATAL,
 			    MSG_INTL(MSG_SYM_MULDEF), demangle(sdp->sd_name));
@@ -703,14 +695,14 @@
 				return;
 			else {
 				sym_override(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 				return;
 			}
 		}
 		if ((nfile == ET_DYN) && (ntype == STT_FUNC)) {
 			if ((ntype != STB_WEAK) && (otype == STB_WEAK)) {
 				sym_override(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 				return;
 			} else
 				return;
@@ -719,7 +711,7 @@
 
 	if (sdp->sd_flags & FLG_SY_TENTSYM)
 		otent = TRUE;
-	if (nsymflags & FLG_SY_TENTSYM)
+	if (nsdflags & FLG_SY_TENTSYM)
 		ntent = TRUE;
 
 
@@ -798,7 +790,7 @@
 
 	if ((ofile == ET_DYN) && (nfile == ET_REL) && (ntent == TRUE) &&
 	    (nvis == STV_PROTECTED)) {
-		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	}
 
@@ -814,13 +806,13 @@
 		if (warn)
 			eprintf(ofl->ofl_lml, ERR_NONE,
 			    MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name);
-		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	} else {
 		if (warn)
 			eprintf(ofl->ofl_lml, ERR_NONE,
 			    MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name);
-		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+		sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 		return;
 	}
 }
@@ -830,7 +822,7 @@
  */
 static void
 sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl,
-    int ndx, Word nshndx, Word nsymflags)
+    int ndx, Word nshndx, sd_flag_t nsdflags)
 {
 	Sym	*osym = sdp->sd_sym;
 	uchar_t	obind = ELF_ST_BIND(osym->st_info);
@@ -859,7 +851,7 @@
 			 * Take the new symbol.
 			 */
 			sym_override(sdp, nsym, ifl, ofl, ndx, nshndx,
-			    nsymflags);
+			    nsdflags);
 			return;
 		}
 	}
@@ -876,13 +868,13 @@
 	if ((osym->st_value != nsym->st_value) &&
 	    ((sdp->sd_flags & FLG_SY_SPECSEC) &&
 	    (sdp->sd_sym->st_shndx == SHN_COMMON) &&
-	    (nsymflags & FLG_SY_SPECSEC) &&
+	    (nsdflags & FLG_SY_SPECSEC) &&
 #if	defined(_ELF64)
 	    (nsym->st_shndx == SHN_COMMON)) ||
 	    ((ld_targ.t_m.m_mach == EM_AMD64) &&
 	    (sdp->sd_flags & FLG_SY_SPECSEC) &&
 	    (sdp->sd_sym->st_shndx == SHN_X86_64_LCOMMON) &&
-	    (nsymflags & FLG_SY_SPECSEC) &&
+	    (nsdflags & FLG_SY_SPECSEC) &&
 	    (nsym->st_shndx == SHN_X86_64_LCOMMON))) {
 #else
 	    (nsym->st_shndx == SHN_COMMON))) {
@@ -986,7 +978,7 @@
 					emsg = MSG_INTL(MSG_SYM_DEFUPDATE);
 				}
 				sym_override(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 			} else {
 				file = sdp->sd_file->ifl_name;
 				if (osym->st_size < nsym->st_size) {
@@ -994,19 +986,19 @@
 					emsg = MSG_INTL(MSG_SYM_DEFUPDATE);
 				}
 				sym_promote(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 			}
 		} else if (obind != nbind) {
 			if ((obind == STB_WEAK) && (nbind != STB_WEAK)) {
 				sym_override(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 				file = ifl->ifl_name;
 			} else
 				file = sdp->sd_file->ifl_name;
 		} else {
 			if (osym->st_size < nsym->st_size) {
 				sym_override(sdp, nsym, ifl, ofl, ndx,
-				    nshndx, nsymflags);
+				    nshndx, nsdflags);
 				file = ifl->ifl_name;
 			} else
 				file = sdp->sd_file->ifl_name;
@@ -1033,10 +1025,10 @@
 		    (((obind == STB_WEAK) && (nbind != STB_WEAK)) &&
 		    (!((ofile != nfile) && (ofile == ET_REL)))))
 			sym_override(sdp, nsym, ifl, ofl, ndx,
-			    nshndx, nsymflags);
+			    nshndx, nsdflags);
 		else
 			sym_promote(sdp, nsym, ifl, ofl, ndx,
-			    nshndx, nsymflags);
+			    nshndx, nsdflags);
 	}
 
 	/*
@@ -1051,7 +1043,7 @@
  * procedure to be called (if any).
  */
 static void (*Action[REF_NUM * SYM_NUM * 2][SYM_NUM])(Sym_desc *,
-    Sym *, Ifl_desc *, Ofl_desc *, int, Word, Word) = {
+    Sym *, Ifl_desc *, Ofl_desc *, int, Word, sd_flag_t) = {
 
 /*				defined		undef		tent	*/
 /*				ET_REL		ET_REL		ET_REL	*/
@@ -1083,7 +1075,7 @@
 
 uintptr_t
 ld_sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx,
-    Word nshndx, Word nsymflags)
+    Word nshndx, sd_flag_t nsdflags)
 {
 	int		row, column;		/* State table coordinates */
 	Sym		*osym = sdp->sd_sym;
@@ -1131,16 +1123,16 @@
 	/*
 	 * Determine the new symbols definition (defines column in Action[]).
 	 */
-	if ((nsymflags & FLG_SY_SPECSEC) &&
+	if ((nsdflags & FLG_SY_SPECSEC) &&
 	    (nsym->st_shndx == SHN_COMMON)) {
 		column = SYM_TENTATIVE;
-		nsymflags |= FLG_SY_TENTSYM;
+		nsdflags |= FLG_SY_TENTSYM;
 #if	defined(_ELF64)
 	} else if ((ld_targ.t_m.m_mach == EM_AMD64) &&
-	    (nsymflags & FLG_SY_SPECSEC) &&
+	    (nsdflags & FLG_SY_SPECSEC) &&
 	    (nsym->st_shndx == SHN_X86_64_LCOMMON)) {
 		column = SYM_TENTATIVE;
-		nsymflags |= FLG_SY_TENTSYM;
+		nsdflags |= FLG_SY_TENTSYM;
 #endif
 	} else if ((nsym->st_shndx == SHN_UNDEF) ||
 	    (nsym->st_shndx == SHN_SUNW_IGNORE)) {
@@ -1153,11 +1145,11 @@
 		 * associated with a SHT_NOBITS section then this symbol
 		 * originated from a tentative symbol.
 		 */
-		if (((nsymflags & FLG_SY_SPECSEC) == 0) && (nfile == ET_DYN)) {
+		if (((nsdflags & FLG_SY_SPECSEC) == 0) && (nfile == ET_DYN)) {
 			isp = ifl->ifl_isdesc[nshndx];
 			if (isp && (isp->is_shdr->sh_type == SHT_NOBITS)) {
 				column = SYM_TENTATIVE;
-				nsymflags |= FLG_SY_TENTSYM;
+				nsdflags |= FLG_SY_TENTSYM;
 			}
 		}
 	}
@@ -1173,7 +1165,7 @@
 	 * multiple (interposed) definitions of a symbol (refer to ldmap_out()).
 	 */
 	if ((ofl->ofl_flags & FLG_OF_GENMAP) && (nsym->st_shndx != SHN_UNDEF) &&
-	    ((nsymflags & FLG_SY_SPECSEC) == 0))
+	    ((nsdflags & FLG_SY_SPECSEC) == 0))
 		if (aplist_append(&sdp->sd_aux->sa_dfiles, ifl->ifl_name,
 		    AL_CNT_SDP_DFILES) == NULL)
 			return (S_ERROR);
@@ -1181,7 +1173,7 @@
 	/*
 	 * Perform the required resolution.
 	 */
-	Action[row][column](sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags);
+	Action[row][column](sdp, nsym, ifl, ofl, ndx, nshndx, nsdflags);
 
 	/*
 	 * Apply any visibility requirements.  If a SINGLETON has been
@@ -1191,14 +1183,12 @@
 	 */
 	if ((oref == REF_REL_NEED) || (nfile == ET_REL)) {
 		if ((vis == STV_EXPORTED) || (vis == STV_SINGLETON)) {
-			sdp->sd_flags1 &= ~(FLG_SY1_PROTECT | FLG_SY1_ELIM |
-			    FLG_SY1_HIDDEN);
+			sdp->sd_flags &= ~MSK_SY_LOCAL;
 
 			if (vis == STV_EXPORTED)
-				sdp->sd_flags1 |= FLG_SY1_EXPORT;
+				sdp->sd_flags |= FLG_SY_EXPORT;
 			else {
-				sdp->sd_flags1 |=
-				    (FLG_SY1_NDIR | FLG_SY1_SINGLE);
+				sdp->sd_flags |= (FLG_SY_NDIR | FLG_SY_SINGLE);
 
 				if (sdp->sd_ref == REF_REL_NEED) {
 					ofl->ofl_flags1 |=
@@ -1206,11 +1196,11 @@
 				}
 			}
 		} else if (vis == STV_PROTECTED) {
-			sdp->sd_flags1 |= FLG_SY1_PROTECT;
+			sdp->sd_flags |= FLG_SY_PROTECT;
 		} else if ((vis == STV_INTERNAL) || (vis == STV_HIDDEN)) {
-			sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+			sdp->sd_flags |= FLG_SY_HIDDEN;
 		} else if (vis == STV_ELIMINATE) {
-			sdp->sd_flags1 |= (FLG_SY1_HIDDEN | FLG_SY1_ELIM);
+			sdp->sd_flags |= (FLG_SY_HIDDEN | FLG_SY_ELIM);
 		}
 
 		sdp->sd_sym->st_other =
--- a/usr/src/cmd/sgs/libld/common/sections.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/sections.c	Wed Oct 14 08:12:49 2009 -0700
@@ -89,7 +89,7 @@
 		/* Remove from sort section? */
 		DYNSORT_COUNT(sdp, sym, type, --);
 	}
-	sdp->sd_flags1 |= FLG_SY1_ELIM;
+	sdp->sd_flags |= FLG_SY_ELIM;
 }
 
 inline static void
@@ -129,7 +129,7 @@
 		 * Global symbols can only be eliminated when the interfaces of
 		 * an object have been defined via versioning/scoping.
 		 */
-		if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0)
+		if ((sdp->sd_flags & FLG_SY_HIDDEN) == 0)
 			return;
 
 		/*
@@ -242,8 +242,8 @@
 			 */
 			sdp = ifl->ifl_oldndx[num];
 			if ((sdp->sd_file != ifl) ||
-			    (sdp->sd_flags & (FLG_SY_ISDISC|FLG_SY_INVALID)) ||
-			    (sdp->sd_flags1 & FLG_SY1_ELIM))
+			    (sdp->sd_flags &
+			    (FLG_SY_ISDISC | FLG_SY_INVALID | FLG_SY_ELIM)))
 				continue;
 
 			/*
@@ -907,11 +907,20 @@
 	Ifl_desc	*ifl;
 	Sym_desc	*sdp;
 	size_t		size;
+	Str_tbl		*strtbl;
 	ofl_flag_t	flags = ofl->ofl_flags;
 	int		not_relobj = !(flags & FLG_OF_RELOBJ);
 	int		unused = 0;
 
 	/*
+	 * Select the required string table.
+	 */
+	if (OFL_IS_STATIC_OBJ(ofl))
+		strtbl = ofl->ofl_strtab;
+	else
+		strtbl = ofl->ofl_dynstrtab;
+
+	/*
 	 * Only a limited subset of DT_ entries apply to relocatable
 	 * objects. See the comment at the head of update_odynamic() in
 	 * update.c for details.
@@ -963,7 +972,7 @@
 		    not_relobj)
 			cnt++;
 
-		if (st_insert(ofl->ofl_dynstrtab, ifl->ifl_soname) == -1)
+		if (st_insert(strtbl, ifl->ifl_soname) == -1)
 			return (S_ERROR);
 		cnt++;
 
@@ -990,14 +999,14 @@
 		 * Reserve entries for _init() and _fini() section addresses.
 		 */
 		if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) &&
+		    SYM_NOHASH, NULL, ofl)) != NULL) &&
 		    (sdp->sd_ref == REF_REL_NEED) &&
 		    (sdp->sd_sym->st_shndx != SHN_UNDEF)) {
 			sdp->sd_flags |= FLG_SY_UPREQD;
 			cnt++;
 		}
 		if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U),
-		    SYM_NOHASH, 0, ofl)) != NULL) &&
+		    SYM_NOHASH, NULL, ofl)) != NULL) &&
 		    (sdp->sd_ref == REF_REL_NEED) &&
 		    (sdp->sd_sym->st_shndx != SHN_UNDEF)) {
 			sdp->sd_flags |= FLG_SY_UPREQD;
@@ -1010,14 +1019,12 @@
 		 */
 		if (ofl->ofl_soname) {
 			cnt++;
-			if (st_insert(ofl->ofl_dynstrtab, ofl->ofl_soname) ==
-			    -1)
+			if (st_insert(strtbl, ofl->ofl_soname) == -1)
 				return (S_ERROR);
 		}
 		if (ofl->ofl_filtees) {
 			cnt++;
-			if (st_insert(ofl->ofl_dynstrtab, ofl->ofl_filtees) ==
-			    -1)
+			if (st_insert(strtbl, ofl->ofl_filtees) == -1)
 				return (S_ERROR);
 
 			/*
@@ -1034,7 +1041,7 @@
 
 	if (ofl->ofl_rpath) {
 		cnt += 2;	/* DT_RPATH & DT_RUNPATH */
-		if (st_insert(ofl->ofl_dynstrtab, ofl->ofl_rpath) == -1)
+		if (st_insert(strtbl, ofl->ofl_rpath) == -1)
 			return (S_ERROR);
 
 		/*
@@ -1052,8 +1059,7 @@
 
 		if (ofl->ofl_config) {
 			cnt++;
-			if (st_insert(ofl->ofl_dynstrtab,
-			    ofl->ofl_config) == -1)
+			if (st_insert(strtbl, ofl->ofl_config) == -1)
 				return (S_ERROR);
 
 			/*
@@ -1067,13 +1073,12 @@
 		}
 		if (ofl->ofl_depaudit) {
 			cnt++;
-			if (st_insert(ofl->ofl_dynstrtab,
-			    ofl->ofl_depaudit) == -1)
+			if (st_insert(strtbl, ofl->ofl_depaudit) == -1)
 				return (S_ERROR);
 		}
 		if (ofl->ofl_audit) {
 			cnt++;
-			if (st_insert(ofl->ofl_dynstrtab, ofl->ofl_audit) == -1)
+			if (st_insert(strtbl, ofl->ofl_audit) == -1)
 				return (S_ERROR);
 		}
 
@@ -1456,10 +1461,9 @@
 	 *	i.	the initial nbucket and nchain entries (2)
 	 *	ii.	the number of buckets (calculated above)
 	 *	iii.	the number of chains (this is based on the number of
-	 *		symbols in the .dynsym array + NULL symbol).
+	 *		symbols in the .dynsym array).
 	 */
-	cnt = 2 + ofl->ofl_hashbkts + (ofl->ofl_dynshdrcnt +
-	    ofl->ofl_globcnt + ofl->ofl_lregsymcnt + 1);
+	cnt = 2 + ofl->ofl_hashbkts + DYNSYM_ALL_CNT(ofl);
 	size = cnt * shdr->sh_entsize;
 
 	/*
@@ -1499,9 +1503,8 @@
 	 * Place the section first since it will affect the local symbol
 	 * count.
 	 */
-	ofl->ofl_ossymtab =
-	    ld_place_section(ofl, isec, ld_targ.t_id.id_symtab, NULL);
-	if (ofl->ofl_ossymtab == (Os_desc *)S_ERROR)
+	if ((ofl->ofl_ossymtab = ld_place_section(ofl, isec,
+	    ld_targ.t_id.id_symtab, NULL)) == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
 	/*
@@ -1525,10 +1528,9 @@
 
 	/*
 	 * Calculated number of symbols, which need to be augmented by
-	 * the null first entry, the FILE symbol, and the .shstrtab entry.
+	 * the (yet to be created) .shstrtab entry.
 	 */
-	symcnt = (size_t)(3 + ofl->ofl_shdrcnt + ofl->ofl_scopecnt +
-	    ofl->ofl_locscnt + ofl->ofl_globcnt);
+	symcnt = (size_t)(1 + SYMTAB_ALL_CNT(ofl));
 	size = symcnt * shdr->sh_entsize;
 
 	/*
@@ -1612,10 +1614,7 @@
 	if (ofl->ofl_osdynsym == (Os_desc *)S_ERROR)
 		return (S_ERROR);
 
-	/*
-	 * One extra section header entry for the 'null' entry.
-	 */
-	cnt = 1 + ofl->ofl_dynshdrcnt + ofl->ofl_globcnt + ofl->ofl_lregsymcnt;
+	cnt = DYNSYM_ALL_CNT(ofl);
 	size = (size_t)cnt * shdr->sh_entsize;
 
 	/*
@@ -1843,7 +1842,7 @@
 			if ((sdp = ofl->ofl_regsyms[ndx]) == NULL)
 				continue;
 
-			if (((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0) &&
+			if (((sdp->sd_flags & FLG_SY_HIDDEN) == 0) &&
 			    (ELF_ST_BIND(sdp->sd_sym->st_info) != STB_LOCAL))
 				continue;
 
@@ -2046,6 +2045,7 @@
 	Elf_Data	*data;
 	Is_desc		*isec;
 	Ver_desc	*vdp;
+	Str_tbl		*strtab;
 
 	/*
 	 * Reserve a string table entry for the base version dependency (other
@@ -2054,13 +2054,13 @@
 	 */
 	vdp = (Ver_desc *)ofl->ofl_verdesc->apl_data[0];
 
-	if (ofl->ofl_flags & FLG_OF_DYNAMIC) {
-		if (st_insert(ofl->ofl_dynstrtab, vdp->vd_name) == -1)
-			return (S_ERROR);
-	} else {
-		if (st_insert(ofl->ofl_strtab, vdp->vd_name) == -1)
-			return (S_ERROR);
-	}
+	if (OFL_IS_STATIC_OBJ(ofl))
+		strtab = ofl->ofl_strtab;
+	else
+		strtab = ofl->ofl_dynstrtab;
+
+	if (st_insert(strtab, vdp->vd_name) == -1)
+		return (S_ERROR);
 
 	/*
 	 * verdef sections do not have a constant element size, so the
@@ -2585,6 +2585,23 @@
 	return (S_ERROR);
 }
 
+/*
+ * Update a data buffers size.  A number of sections have to be created, and
+ * the sections header contributes to the size of the eventual section.  Thus,
+ * a section may be created, and once all associated sections have been created,
+ * we return to establish the required section size.
+ */
+inline static void
+update_data_size(Os_desc *osp, ulong_t cnt)
+{
+	Is_desc		*isec = ld_os_first_isdesc(osp);
+	Elf_Data	*data = isec->is_indata;
+	Shdr		*shdr = osp->os_shdr;
+	size_t		size = cnt * shdr->sh_entsize;
+
+	shdr->sh_size = (Xword)size;
+	data->d_size = size;
+}
 
 /*
  * The following sections are built after all input file processing and symbol
@@ -2770,15 +2787,16 @@
 	if (flags & FLG_OF_DYNAMIC) {
 		if (make_dynamic(ofl) == S_ERROR)
 			return (S_ERROR);
-		if (make_dynstr(ofl) == S_ERROR)
-			return (S_ERROR);
+
 		/*
-		 * There is no use for .hash and .dynsym sections in a
-		 * relocatable object.
+		 * A number of sections aren't necessary within a relocatable
+		 * object, even if -dy has been used.
 		 */
 		if (!(flags & FLG_OF_RELOBJ)) {
 			if (make_hash(ofl) == S_ERROR)
 				return (S_ERROR);
+			if (make_dynstr(ofl) == S_ERROR)
+				return (S_ERROR);
 			if (make_dynsym(ofl) == S_ERROR)
 				return (S_ERROR);
 			if (ld_unwind_make_hdr(ofl) == S_ERROR)
@@ -2820,44 +2838,28 @@
 		return (S_ERROR);
 
 	/*
-	 * Now that we've created all of our sections adjust the size
-	 * of SHT_SUNW_versym & SHT_SUNW_syminfo which are dependent on
-	 * the symbol table sizes.
+	 * Now that we've created all output sections, adjust the size of the
+	 * SHT_SUNW_versym and SHT_SUNW_syminfo section, which are dependent on
+	 * the associated symbol table sizes.
 	 */
 	if (ofl->ofl_osversym || ofl->ofl_ossyminfo) {
-		Shdr		*shdr;
-		Is_desc		*isec;
-		Elf_Data	*data;
-		size_t		size;
 		ulong_t		cnt;
+		Is_desc		*isp;
 		Os_desc		*osp;
 
-		if (flags & (FLG_OF_RELOBJ | FLG_OF_STATIC)) {
+		if (OFL_IS_STATIC_OBJ(ofl))
 			osp = ofl->ofl_ossymtab;
-		} else {
+		else
 			osp = ofl->ofl_osdynsym;
-		}
-		isec = ld_os_first_isdesc(osp);
-		cnt = (isec->is_shdr->sh_size / isec->is_shdr->sh_entsize);
-
-		if (ofl->ofl_osversym) {
-			osp = ofl->ofl_osversym;
-			isec = ld_os_first_isdesc(osp);
-			data = isec->is_indata;
-			shdr = osp->os_shdr;
-			size = cnt * shdr->sh_entsize;
-			shdr->sh_size = (Xword)size;
-			data->d_size = size;
-		}
-		if (ofl->ofl_ossyminfo) {
-			osp = ofl->ofl_ossyminfo;
-			isec = ld_os_first_isdesc(osp);
-			data = isec->is_indata;
-			shdr = osp->os_shdr;
-			size = cnt * shdr->sh_entsize;
-			shdr->sh_size = (Xword)size;
-			data->d_size = size;
-		}
+
+		isp = ld_os_first_isdesc(osp);
+		cnt = (isp->is_shdr->sh_size / isp->is_shdr->sh_entsize);
+
+		if (ofl->ofl_osversym)
+			update_data_size(ofl->ofl_osversym, cnt);
+
+		if (ofl->ofl_ossyminfo)
+			update_data_size(ofl->ofl_ossyminfo, cnt);
 	}
 
 	return (1);
--- a/usr/src/cmd/sgs/libld/common/sunwmove.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/sunwmove.c	Wed Oct 14 08:12:49 2009 -0700
@@ -151,7 +151,7 @@
 			 * processing can be terminated once all move errors
 			 * are flushed out.
 			 */
-			sdp->sd_flags1 |= FLG_SY1_OVERLAP;
+			sdp->sd_flags |= FLG_SY_OVERLAP;
 			return (1);
 		}
 
@@ -302,7 +302,7 @@
 			if (append_move_desc(ofl, sdp, mvp, isp) == S_ERROR)
 				return (S_ERROR);
 
-			if (sdp->sd_flags1 & FLG_SY1_OVERLAP)
+			if (sdp->sd_flags & FLG_SY_OVERLAP)
 				errcnt++;
 
 			/*
@@ -335,8 +335,7 @@
 			 * The following two if statements checks the
 			 * if the move entry can be expanded or not.
 			 */
-			if (((ofl->ofl_flags & FLG_OF_STATIC) != 0) &&
-			    ((ofl->ofl_flags & FLG_OF_EXEC) != 0)) {
+			if (OFL_IS_STATIC_EXEC(ofl)) {
 				if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) {
 					errcnt++;
 					eprintf(ofl->ofl_lml, ERR_FATAL,
--- a/usr/src/cmd/sgs/libld/common/syms.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/syms.c	Wed Oct 14 08:12:49 2009 -0700
@@ -77,7 +77,7 @@
 inline static const char *
 string(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize,
     int symndx, Word shndx, Word symsecndx, const char *symsecname,
-    const char *strsecname, Word *flags)
+    const char *strsecname, sd_flag_t *flags)
 {
 	Word	name = sym->st_name;
 
@@ -250,8 +250,8 @@
 			if (ifl != sdp->sd_file)
 				continue;
 
-			sdp->sd_flags1 &= ~FLG_SY1_DIR;
-			sdp->sd_flags1 |= FLG_SY1_NDIR;
+			sdp->sd_flags &= ~FLG_SY_DIR;
+			sdp->sd_flags |= FLG_SY_NDIR;
 		}
 	}
 	return (0);
@@ -317,7 +317,7 @@
 	/*
 	 * Return symbol found.
 	 */
-	return (sav->sav_symdesc);
+	return (sav->sav_sdp);
 }
 
 /*
@@ -328,8 +328,7 @@
  */
 Sym_desc *
 ld_sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl,
-    Ofl_desc *ofl, Word ndx, Word shndx, Word sdflags, Half sdflags1,
-    avl_index_t *where)
+    Ofl_desc *ofl, Word ndx, Word shndx, sd_flag_t sdflags, avl_index_t *where)
 {
 	Sym_desc	*sdp;
 	Sym_aux		*sap;
@@ -354,13 +353,16 @@
 	 * Allocate a Sym Descriptor, Auxiliary Descriptor, and a Sym AVLNode -
 	 * contiguously.
 	 */
-	if ((savl = libld_calloc(sizeof (Sym_avlnode) + sizeof (Sym_desc) +
-	    sizeof (Sym_aux), 1)) == NULL)
+	if ((savl = libld_calloc(S_DROUND(sizeof (Sym_avlnode)) +
+	    S_DROUND(sizeof (Sym_desc)) +
+	    S_DROUND(sizeof (Sym_aux)), 1)) == NULL)
 		return ((Sym_desc *)S_ERROR);
-	sdp = (Sym_desc *)((uintptr_t)savl + sizeof (Sym_avlnode));
-	sap = (Sym_aux *)((uintptr_t)sdp + sizeof (Sym_desc));
+	sdp = (Sym_desc *)((uintptr_t)savl +
+	    S_DROUND(sizeof (Sym_avlnode)));
+	sap = (Sym_aux *)((uintptr_t)sdp +
+	    S_DROUND(sizeof (Sym_desc)));
 
-	savl->sav_symdesc = sdp;
+	savl->sav_sdp = sdp;
 	sdp->sd_file = ifl;
 	sdp->sd_aux = sap;
 	savl->sav_hash = sap->sa_hash = hash;
@@ -373,7 +375,6 @@
 	*nsym = *osym;
 	sdp->sd_shndx = shndx;
 	sdp->sd_flags |= sdflags;
-	sdp->sd_flags1 |= sdflags1;
 
 	if ((_name = libld_malloc(strlen(name) + 1)) == NULL)
 		return ((Sym_desc *)S_ERROR);
@@ -443,24 +444,24 @@
 	if ((etype == ET_NONE) || (etype == ET_REL)) {
 		switch (vis) {
 		case STV_DEFAULT:
-			sdp->sd_flags1 |= FLG_SY1_DEFAULT;
+			sdp->sd_flags |= FLG_SY_DEFAULT;
 			break;
 		case STV_INTERNAL:
 		case STV_HIDDEN:
-			sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+			sdp->sd_flags |= FLG_SY_HIDDEN;
 			break;
 		case STV_PROTECTED:
-			sdp->sd_flags1 |= FLG_SY1_PROTECT;
+			sdp->sd_flags |= FLG_SY_PROTECT;
 			break;
 		case STV_EXPORTED:
-			sdp->sd_flags1 |= FLG_SY1_EXPORT;
+			sdp->sd_flags |= FLG_SY_EXPORT;
 			break;
 		case STV_SINGLETON:
-			sdp->sd_flags1 |= (FLG_SY1_SINGLE | FLG_SY1_NDIR);
+			sdp->sd_flags |= (FLG_SY_SINGLE | FLG_SY_NDIR);
 			ofl->ofl_flags1 |= (FLG_OF1_NDIRECT | FLG_OF1_NGLBDIR);
 			break;
 		case STV_ELIMINATE:
-			sdp->sd_flags1 |= (FLG_SY1_HIDDEN | FLG_SY1_ELIM);
+			sdp->sd_flags |= (FLG_SY_HIDDEN | FLG_SY_ELIM);
 			break;
 		default:
 			assert(vis <= STV_ELIMINATE);
@@ -474,24 +475,16 @@
 		 * tagged to prevent direct binding.
 		 */
 		if ((ofl->ofl_flags1 & FLG_OF1_ALNODIR) &&
-		    ((sdp->sd_flags1 & (FLG_SY1_PROTECT | FLG_SY1_DIR)) == 0) &&
+		    ((sdp->sd_flags & (FLG_SY_PROTECT | FLG_SY_DIR)) == 0) &&
 		    (nsym->st_shndx != SHN_UNDEF)) {
-			sdp->sd_flags1 |= FLG_SY1_NDIR;
+			sdp->sd_flags |= FLG_SY_NDIR;
 		}
 	} else {
 		sdp->sd_ref = REF_DYN_SEEN;
 
 		/*
-		 * Record the binding file for this symbol in the sa_bindto
-		 * field.  If this symbol is ever overridden by a REF_REL_NEED
-		 * definition, sa_bindto is used when building a 'translator'.
-		 */
-		if (nsym->st_shndx != SHN_UNDEF)
-			sdp->sd_aux->sa_bindto = ifl;
-
-		/*
 		 * If this is a protected symbol, remember this.  Note, this
-		 * state is different from the FLG_SY1_PROTECT used to establish
+		 * state is different from the FLG_SY_PROTECT used to establish
 		 * a symbol definitions visibility.  This state is used to warn
 		 * against possible copy relocations against this referenced
 		 * symbol.
@@ -506,7 +499,7 @@
 		 * this symbol.
 		 */
 		if ((vis == STV_SINGLETON) && (nsym->st_shndx != SHN_UNDEF))
-			sdp->sd_flags1 |= (FLG_SY1_SINGLE | FLG_SY1_NDIR);
+			sdp->sd_flags |= (FLG_SY_SINGLE | FLG_SY_NDIR);
 
 		/*
 		 * If the new symbol is from a shared library and is associated
@@ -524,9 +517,8 @@
 	 */
 	if (nsym->st_shndx == SHN_SUNW_IGNORE) {
 		sdp->sd_shndx = shndx = SHN_UNDEF;
-		sdp->sd_flags |= FLG_SY_REDUCED;
-		sdp->sd_flags1 |=
-		    (FLG_SY1_HIDDEN | FLG_SY1_IGNORE | FLG_SY1_ELIM);
+		sdp->sd_flags |= (FLG_SY_REDUCED |
+		    FLG_SY_HIDDEN | FLG_SY_IGNORE | FLG_SY_ELIM);
 	}
 
 	/*
@@ -616,6 +608,7 @@
 	 */
 	if ((ifl == NULL) || ((ifl->ifl_flags & FLG_IF_MAPFILE) == 0))
 		DBG_CALL(Dbg_syms_entered(ofl, nsym, sdp));
+
 	return (sdp);
 }
 
@@ -628,8 +621,8 @@
  * issue a warning and leave the symbol as is.  If the non-underscore symbol
  * is referenced then turn it into a weak alias of the underscored symbol.
  *
- * The bits in flags_u are OR'd into the flags field of the symbol
- * for the underscored symbol.
+ * The bits in sdflags_u are OR'd into the flags field of the symbol for the
+ * underscored symbol.
  *
  * If this is a global symbol, and it hasn't explicitly been defined as being
  * directly bound to, indicate that it can't be directly bound to.
@@ -645,7 +638,7 @@
  */
 static uintptr_t
 sym_add_spec(const char *name, const char *uname, Word sdaux_id,
-    Word flags_u, Half flags1, Ofl_desc *ofl)
+    sd_flag_t sdflags_u, sd_flag_t sdflags, Ofl_desc *ofl)
 {
 	Sym_desc	*sdp;
 	Sym_desc 	*usdp;
@@ -665,7 +658,7 @@
 		    (usdp->sd_ref != REF_REL_NEED)) {
 			usdp->sd_ref = REF_REL_NEED;
 			usdp->sd_shndx = usdp->sd_sym->st_shndx = SHN_ABS;
-			usdp->sd_flags |= FLG_SY_SPECSEC | flags_u;
+			usdp->sd_flags |= FLG_SY_SPECSEC | sdflags_u;
 			usdp->sd_sym->st_info =
 			    ELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
 			usdp->sd_isc = NULL;
@@ -681,20 +674,20 @@
 			 * should be defined protected, whereas all other
 			 * special symbols are tagged as no-direct.
 			 */
-			if (((usdp->sd_flags1 & FLG_SY1_HIDDEN) == 0) &&
-			    (flags1 & FLG_SY1_DEFAULT)) {
+			if (((usdp->sd_flags & FLG_SY_HIDDEN) == 0) &&
+			    (sdflags & FLG_SY_DEFAULT)) {
 				usdp->sd_aux->sa_overndx = VER_NDX_GLOBAL;
 				if (sdaux_id == SDAUX_ID_GOT) {
-					usdp->sd_flags1 &= ~FLG_SY1_NDIR;
-					usdp->sd_flags1 |= FLG_SY1_PROTECT;
+					usdp->sd_flags &= ~FLG_SY_NDIR;
+					usdp->sd_flags |= FLG_SY_PROTECT;
 					usdp->sd_sym->st_other = STV_PROTECTED;
 				} else if (
-				    ((usdp->sd_flags1 & FLG_SY1_DIR) == 0) &&
+				    ((usdp->sd_flags & FLG_SY_DIR) == 0) &&
 				    ((ofl->ofl_flags & FLG_OF_SYMBOLIC) == 0)) {
-					usdp->sd_flags1 |= FLG_SY1_NDIR;
+					usdp->sd_flags |= FLG_SY_NDIR;
 				}
 			}
-			usdp->sd_flags1 |= flags1;
+			usdp->sd_flags |= sdflags;
 
 			/*
 			 * If the reference originated from a mapfile ensure
@@ -720,7 +713,7 @@
 		sym->st_value = 0;
 		DBG_CALL(Dbg_syms_created(ofl->ofl_lml, uname));
 		if ((usdp = ld_sym_enter(uname, sym, hash, (Ifl_desc *)NULL,
-		    ofl, 0, SHN_ABS, FLG_SY_SPECSEC | flags_u, 0, &where)) ==
+		    ofl, 0, SHN_ABS, (FLG_SY_SPECSEC | sdflags_u), &where)) ==
 		    (Sym_desc *)S_ERROR)
 			return (S_ERROR);
 		usdp->sd_ref = REF_REL_NEED;
@@ -730,13 +723,13 @@
 		usdp->sd_aux->sa_overndx = VER_NDX_GLOBAL;
 
 		if (sdaux_id == SDAUX_ID_GOT) {
-			usdp->sd_flags1 |= FLG_SY1_PROTECT;
+			usdp->sd_flags |= FLG_SY_PROTECT;
 			usdp->sd_sym->st_other = STV_PROTECTED;
-		} else if ((flags1 & FLG_SY1_DEFAULT) &&
+		} else if ((sdflags & FLG_SY_DEFAULT) &&
 		    ((ofl->ofl_flags & FLG_OF_SYMBOLIC) == 0)) {
-			usdp->sd_flags1 |= FLG_SY1_NDIR;
+			usdp->sd_flags |= FLG_SY_NDIR;
 		}
-		usdp->sd_flags1 |= flags1;
+		usdp->sd_flags |= sdflags;
 	}
 
 	if (name && (sdp = ld_sym_find(name, SYM_NOHASH, NULL, ofl)) &&
@@ -771,19 +764,19 @@
 		 * automatic scoping).  The GOT should be defined protected,
 		 * whereas all other special symbols are tagged as no-direct.
 		 */
-		if (((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0) &&
-		    (flags1 & FLG_SY1_DEFAULT)) {
+		if (((sdp->sd_flags & FLG_SY_HIDDEN) == 0) &&
+		    (sdflags & FLG_SY_DEFAULT)) {
 			sdp->sd_aux->sa_overndx = VER_NDX_GLOBAL;
 			if (sdaux_id == SDAUX_ID_GOT) {
-				sdp->sd_flags1 &= ~FLG_SY1_NDIR;
-				sdp->sd_flags1 |= FLG_SY1_PROTECT;
+				sdp->sd_flags &= ~FLG_SY_NDIR;
+				sdp->sd_flags |= FLG_SY_PROTECT;
 				sdp->sd_sym->st_other = STV_PROTECTED;
-			} else if (((sdp->sd_flags1 & FLG_SY1_DIR) == 0) &&
+			} else if (((sdp->sd_flags & FLG_SY_DIR) == 0) &&
 			    ((ofl->ofl_flags & FLG_OF_SYMBOLIC) == 0)) {
-				sdp->sd_flags1 |= FLG_SY1_NDIR;
+				sdp->sd_flags |= FLG_SY_NDIR;
 			}
 		}
-		sdp->sd_flags1 |= flags1;
+		sdp->sd_flags |= sdflags;
 
 		/*
 		 * If the reference originated from a mapfile ensure
@@ -898,22 +891,22 @@
 	DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml));
 
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_ETEXT), MSG_ORIG(MSG_SYM_ETEXT_U),
-	    SDAUX_ID_ETEXT, 0, (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+	    SDAUX_ID_ETEXT, 0, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 	    ofl) == S_ERROR)
 		return (S_ERROR);
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_EDATA), MSG_ORIG(MSG_SYM_EDATA_U),
-	    SDAUX_ID_EDATA, 0, (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+	    SDAUX_ID_EDATA, 0, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 	    ofl) == S_ERROR)
 		return (S_ERROR);
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_END), MSG_ORIG(MSG_SYM_END_U),
-	    SDAUX_ID_END, FLG_SY_DYNSORT, (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+	    SDAUX_ID_END, FLG_SY_DYNSORT, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 	    ofl) == S_ERROR)
 		return (S_ERROR);
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_L_END), MSG_ORIG(MSG_SYM_L_END_U),
-	    SDAUX_ID_END, 0, FLG_SY1_HIDDEN, ofl) == S_ERROR)
+	    SDAUX_ID_END, 0, FLG_SY_HIDDEN, ofl) == S_ERROR)
 		return (S_ERROR);
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_L_START), MSG_ORIG(MSG_SYM_L_START_U),
-	    SDAUX_ID_START, 0, FLG_SY1_HIDDEN, ofl) == S_ERROR)
+	    SDAUX_ID_START, 0, FLG_SY_HIDDEN, ofl) == S_ERROR)
 		return (S_ERROR);
 
 	/*
@@ -921,14 +914,14 @@
 	 * static executables (in which case its value will be 0).
 	 */
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_DYNAMIC), MSG_ORIG(MSG_SYM_DYNAMIC_U),
-	    SDAUX_ID_DYN, FLG_SY_DYNSORT, (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+	    SDAUX_ID_DYN, FLG_SY_DYNSORT, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 	    ofl) == S_ERROR)
 		return (S_ERROR);
 
 	if (OFL_ALLOW_DYNSYM(ofl))
 		if (sym_add_spec(MSG_ORIG(MSG_SYM_PLKTBL),
 		    MSG_ORIG(MSG_SYM_PLKTBL_U), SDAUX_ID_PLT,
-		    FLG_SY_DYNSORT, (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+		    FLG_SY_DYNSORT, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 		    ofl) == S_ERROR)
 			return (S_ERROR);
 
@@ -937,10 +930,10 @@
 	 * Make sure it gets assigned the appropriate special attributes.
 	 */
 	if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U),
-	    SYM_NOHASH, NULL, ofl)) != 0) && (sdp->sd_ref != REF_DYN_SEEN)) {
+	    SYM_NOHASH, NULL, ofl)) != NULL) && (sdp->sd_ref != REF_DYN_SEEN)) {
 		if (sym_add_spec(MSG_ORIG(MSG_SYM_GOFTBL),
 		    MSG_ORIG(MSG_SYM_GOFTBL_U), SDAUX_ID_GOT, FLG_SY_DYNSORT,
-		    (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF), ofl) == S_ERROR)
+		    (FLG_SY_DEFAULT | FLG_SY_EXPDEF), ofl) == S_ERROR)
 			return (S_ERROR);
 	}
 
@@ -966,6 +959,10 @@
 		 * from any initial relocation processing that references this
 		 * symbol, or from the symbol validation processing.
 		 *
+		 * This routine is called either from any initial relocation
+		 * processing that references this symbol, or from the symbol
+		 * validation processing.
+		 *
 		 * A symbol is a candidate for auto-reduction/elimination if:
 		 *
 		 *  -	the symbol wasn't explicitly defined within a mapfile
@@ -981,14 +978,14 @@
 		 * necessary to print these symbols later.
 		 */
 		if ((oflags & (FLG_OF_AUTOLCL | FLG_OF_AUTOELM)) &&
-		    ((sdp->sd_flags1 & MSK_SY1_NOAUTO) == 0)) {
-			if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0) {
-				sdp->sd_flags |= FLG_SY_REDUCED;
-				sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+		    ((sdp->sd_flags & MSK_SY_NOAUTO) == 0)) {
+			if ((sdp->sd_flags & FLG_SY_HIDDEN) == 0) {
+				sdp->sd_flags |=
+				    (FLG_SY_REDUCED | FLG_SY_HIDDEN);
 			}
 
 			if (oflags & (FLG_OF_REDLSYM | FLG_OF_AUTOELM)) {
-				sdp->sd_flags1 |= FLG_SY1_ELIM;
+				sdp->sd_flags |= FLG_SY_ELIM;
 				sym->st_other = STV_ELIMINATE |
 				    (sym->st_other & ~MSK_SYM_VISIBILITY);
 			} else if (ELF_ST_VISIBILITY(sym->st_other) !=
@@ -1004,8 +1001,8 @@
 		 * attribute.
 		 */
 		if ((oflags & FLG_OF_SYMBOLIC) &&
-		    ((sdp->sd_flags1 & (FLG_SY1_HIDDEN | FLG_SY1_NDIR)) == 0)) {
-			sdp->sd_flags1 |= FLG_SY1_PROTECT;
+		    ((sdp->sd_flags & (FLG_SY_HIDDEN | FLG_SY_NDIR)) == 0)) {
+			sdp->sd_flags |= FLG_SY_PROTECT;
 			if (ELF_ST_VISIBILITY(sym->st_other) == STV_DEFAULT)
 				sym->st_other = STV_PROTECTED |
 				    (sym->st_other & ~MSK_SYM_VISIBILITY);
@@ -1176,7 +1173,7 @@
 		int		undeferr = 0;
 		uchar_t		vis;
 
-		sdp = sav->sav_symdesc;
+		sdp = sav->sav_sdp;
 
 		/*
 		 * If undefined symbols are allowed ignore any symbols that are
@@ -1255,8 +1252,7 @@
 		 */
 		if (((isp = sdp->sd_isc) != 0) && isp->is_shdr &&
 		    ((isp->is_shdr->sh_flags & SHF_ALLOC) == 0)) {
-			sdp->sd_flags |= FLG_SY_REDUCED;
-			sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+			sdp->sd_flags |= (FLG_SY_REDUCED | FLG_SY_HIDDEN);
 		}
 
 		/*
@@ -1265,7 +1261,7 @@
 		 * original index for validation, and propagation to the output
 		 * file.
 		 */
-		if (sdp->sd_flags1 & FLG_SY1_IGNORE)
+		if (sdp->sd_flags & FLG_SY_IGNORE)
 			sdp->sd_shndx = SHN_SUNW_IGNORE;
 
 		if (undef) {
@@ -1300,11 +1296,9 @@
 			    ((ELF_ST_BIND(sym->st_info) != STB_WEAK) &&
 			    ((sdp->sd_flags &
 			    (FLG_SY_PARENT | FLG_SY_EXTERN)) == 0)) ||
-			    (((sdp->sd_flags &
-			    (FLG_SY_MAPREF | FLG_SY_MAPUSED)) ==
-			    FLG_SY_MAPREF) &&
-			    ((sdp->sd_flags1 & (FLG_SY1_HIDDEN |
-			    FLG_SY1_PROTECT)) == 0)))) {
+			    ((sdp->sd_flags &
+			    (FLG_SY_MAPREF | FLG_SY_MAPUSED | FLG_SY_HIDDEN |
+			    FLG_SY_PROTECT)) == FLG_SY_MAPREF))) {
 				sym_undef_entry(ofl, sdp, UNDEF);
 				ofl->ofl_flags |= undef;
 				undeferr = 1;
@@ -1346,7 +1340,7 @@
 			 * Capture that we've bound to a symbol that doesn't
 			 * allow being directly bound to.
 			 */
-			if (sdp->sd_flags1 & FLG_SY1_NDIR)
+			if (sdp->sd_flags & FLG_SY_NDIR)
 				ofl->ofl_flags1 |= FLG_OF1_NGLBDIR;
 
 			if (sdp->sd_file->ifl_vercnt) {
@@ -1384,7 +1378,7 @@
 		 * a fatal error.
 		 */
 		if ((sdp->sd_ref == REF_DYN_NEED) &&
-		    (sdp->sd_flags1 & (FLG_SY1_HIDDEN | FLG_SY1_PROTECT))) {
+		    (sdp->sd_flags & (FLG_SY_HIDDEN | FLG_SY_PROTECT))) {
 			sym_undef_entry(ofl, sdp, BNDLOCAL);
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
@@ -1401,7 +1395,7 @@
 				if (sdp->sd_aux && sdp->sd_aux->sa_overndx)
 					sdp->sd_aux->sa_overndx = 0;
 			} else {
-				if ((!(sdp->sd_flags1 & FLG_SY1_HIDDEN)) &&
+				if ((!(sdp->sd_flags & FLG_SY_HIDDEN)) &&
 				    sdp->sd_aux &&
 				    (sdp->sd_aux->sa_overndx == 0)) {
 					sym_undef_entry(ofl, sdp, NOVERSION);
@@ -1433,7 +1427,7 @@
 		 */
 		if ((sym->st_shndx == SHN_COMMON) &&
 		    (((oflags & FLG_OF_RELOBJ) == 0) ||
-		    ((sdp->sd_flags1 & FLG_SY1_HIDDEN) &&
+		    ((sdp->sd_flags & FLG_SY_HIDDEN) &&
 		    (oflags & FLG_OF_PROCRED)))) {
 			if ((sdp->sd_move == NULL) ||
 			    ((sdp->sd_flags & FLG_SY_PAREXPN) == 0)) {
@@ -1482,14 +1476,14 @@
 		/*
 		 * Update the symbol count and the associated name string size.
 		 */
-		if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) &&
+		if ((sdp->sd_flags & FLG_SY_HIDDEN) &&
 		    (oflags & FLG_OF_PROCRED)) {
 			/*
 			 * If any reductions are being processed, keep a count
 			 * of eliminated symbols, and if the symbol is being
 			 * reduced to local, count it's size for the .symtab.
 			 */
-			if (sdp->sd_flags1 & FLG_SY1_ELIM) {
+			if (sdp->sd_flags & FLG_SY_ELIM) {
 				ofl->ofl_elimcnt++;
 			} else {
 				ofl->ofl_scopecnt++;
@@ -1511,14 +1505,13 @@
 			ofl->ofl_globcnt++;
 
 			/*
-			 * Check to see if this global variable should
-			 * go into a sort section. Sort sections require
-			 * a .SUNW_ldynsym section, so, don't check
-			 * unless a .SUNW_ldynsym is allowed.
+			 * Check to see if this global variable should go into
+			 * a sort section. Sort sections require a
+			 * .SUNW_ldynsym section, so, don't check unless a
+			 * .SUNW_ldynsym is allowed.
 			 */
-			if (allow_ldynsym) {
+			if (allow_ldynsym)
 				DYNSORT_COUNT(sdp, sym, type, ++);
-			}
 
 			/*
 			 * If global direct bindings are in effect, or this
@@ -1529,8 +1522,8 @@
 			 */
 			if (((ofl->ofl_dtflags_1 & DF_1_DIRECT) || (isp &&
 			    (isp->is_file->ifl_flags & FLG_IF_DIRECT))) &&
-			    ((sdp->sd_flags1 & FLG_SY1_NDIR) == 0))
-				sdp->sd_flags1 |= FLG_SY1_DIR;
+			    ((sdp->sd_flags & FLG_SY_NDIR) == 0))
+				sdp->sd_flags |= FLG_SY_DIR;
 
 			/*
 			 * Insert the symbol name.
@@ -1585,7 +1578,7 @@
 			if (sdp->sd_sym->st_name == 0)
 				sdp->sd_name = MSG_ORIG(MSG_STR_EMPTY);
 
-			if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) ||
+			if ((sdp->sd_flags & FLG_SY_HIDDEN) ||
 			    (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL))
 				ofl->ofl_lregsymcnt++;
 		}
@@ -1935,7 +1928,8 @@
 		int		last_file_ndx = 0;
 
 		for (sym++, ndx = 1; ndx < local; sym++, ndx++) {
-			Word		shndx, sdflags = FLG_SY_CLEAN;
+			sd_flag_t	sdflags = FLG_SY_CLEAN;
+			Word		shndx;
 			const char	*name;
 			Sym_desc	*rsdp;
 			int		shndx_bad = 0;
@@ -2023,6 +2017,7 @@
 			if (sdp == NULL) {
 				sdp = &(ifl->ifl_locs[ndx]);
 				sdp->sd_ref = REF_REL_NEED;
+				sdp->sd_symndx = ndx;
 			}
 			if (rsdp == NULL) {
 				sdp->sd_name = name;
@@ -2041,8 +2036,7 @@
 			 */
 			if (sym->st_shndx == SHN_SUNW_IGNORE) {
 				sdp->sd_shndx = shndx = SHN_UNDEF;
-				sdp->sd_flags1 |=
-				    (FLG_SY1_IGNORE | FLG_SY1_ELIM);
+				sdp->sd_flags |= (FLG_SY_IGNORE | FLG_SY_ELIM);
 			}
 
 			/*
@@ -2243,15 +2237,17 @@
 	/* LINTED */
 	for (ndx = (int)local; ndx < total; sym++, ndx++) {
 		const char	*name;
-		Word		shndx, sdflags = 0;
+		sd_flag_t	sdflags = 0;
+		Word		shndx;
 		int		shndx_bad = 0;
+		Sym		*nsym = sym;
 
 		/*
 		 * Determine and validate the associated section index.
 		 */
-		if (symshndx && (sym->st_shndx == SHN_XINDEX)) {
+		if (symshndx && (nsym->st_shndx == SHN_XINDEX)) {
 			shndx = symshndx[ndx];
-		} else if ((shndx = sym->st_shndx) >= SHN_LORESERVE) {
+		} else if ((shndx = nsym->st_shndx) >= SHN_LORESERVE) {
 			sdflags |= FLG_SY_SPECSEC;
 		} else if (shndx > ifl->ifl_ehdr->e_shnum) {
 			/* We need the name before we can issue error */
@@ -2261,7 +2257,7 @@
 		/*
 		 * Check if st_name has a valid value or not.
 		 */
-		if ((name = string(ofl, ifl, sym, strs, strsize, ndx, shndx,
+		if ((name = string(ofl, ifl, nsym, strs, strsize, ndx, shndx,
 		    symsecndx, symsecname, strsecname, &sdflags)) == NULL) {
 			ofl->ofl_flags |= FLG_OF_FATAL;
 			continue;
@@ -2276,7 +2272,7 @@
 			    MSG_INTL(MSG_SYM_INVSHNDX),
 			    demangle_symname(name, symsecname, ndx),
 			    ifl->ifl_name,
-			    conv_sym_shndx(osabi, mach, sym->st_shndx,
+			    conv_sym_shndx(osabi, mach, nsym->st_shndx,
 			    CONV_FMT_DECIMAL, &inv_buf));
 			continue;
 		}
@@ -2298,8 +2294,8 @@
 		 * to feel, but if nothing else, pollutes diagnostic relocation
 		 * output.
 		 */
-		if (name[0] && (etype == ET_DYN) && (sym->st_size == 0) &&
-		    (ELF_ST_TYPE(sym->st_info) == STT_OBJECT) &&
+		if (name[0] && (etype == ET_DYN) && (nsym->st_size == 0) &&
+		    (ELF_ST_TYPE(nsym->st_info) == STT_OBJECT) &&
 		    (name[0] == '_') && ((name[1] == 'e') ||
 		    (name[1] == 'D') || (name[1] == 'P')) &&
 		    ((strcmp(name, MSG_ORIG(MSG_SYM_ETEXT_U)) == 0) ||
@@ -2356,7 +2352,7 @@
 		/*
 		 * Determine and validate the symbols binding.
 		 */
-		bind = ELF_ST_BIND(sym->st_info);
+		bind = ELF_ST_BIND(nsym->st_info);
 		if ((bind != STB_GLOBAL) && (bind != STB_WEAK)) {
 			eprintf(ofl->ofl_lml, ERR_WARNING,
 			    MSG_INTL(MSG_SYM_NONGLOB),
@@ -2373,7 +2369,7 @@
 		 * discarded, then discard the symbol itself.
 		 */
 		if (((sdflags & FLG_SY_SPECSEC) == 0) &&
-		    (sym->st_shndx != SHN_UNDEF)) {
+		    (nsym->st_shndx != SHN_UNDEF)) {
 			Is_desc	*isp;
 
 			if (shndx >= ifl->ifl_shnum) {
@@ -2387,7 +2383,7 @@
 				    MSG_INTL(MSG_SYM_INVSHNDX),
 				    demangle_symname(name, symsecname, ndx),
 				    ifl->ifl_name,
-				    conv_sym_shndx(osabi, mach, sym->st_shndx,
+				    conv_sym_shndx(osabi, mach, nsym->st_shndx,
 				    CONV_FMT_DECIMAL, &inv_buf));
 				continue;
 			}
@@ -2404,7 +2400,7 @@
 				 * we can compensate.
 				 */
 				sdp->sd_name = name;
-				sdp->sd_sym = sym;
+				sdp->sd_sym = nsym;
 				sdp->sd_file = ifl;
 				sdp->sd_isc = isp;
 				sdp->sd_flags = FLG_SY_ISDISC;
@@ -2425,11 +2421,11 @@
 		hash = (Word)elf_hash((const char *)name);
 		if ((sdp = ld_sym_find(name, hash, &where, ofl)) == NULL) {
 			DBG_CALL(Dbg_syms_global(ofl->ofl_lml, ndx, name));
-			if ((sdp = ld_sym_enter(name, sym, hash, ifl, ofl, ndx,
-			    shndx, sdflags, 0, &where)) == (Sym_desc *)S_ERROR)
+			if ((sdp = ld_sym_enter(name, nsym, hash, ifl, ofl, ndx,
+			    shndx, sdflags, &where)) == (Sym_desc *)S_ERROR)
 				return (S_ERROR);
 
-		} else if (ld_sym_resolve(sdp, sym, ifl, ofl, ndx, shndx,
+		} else if (ld_sym_resolve(sdp, nsym, ifl, ofl, ndx, shndx,
 		    sdflags) == S_ERROR)
 			return (S_ERROR);
 
@@ -2437,7 +2433,7 @@
 		 * After we've compared a defined symbol in one shared
 		 * object, flag the symbol so we don't compare it again.
 		 */
-		if ((etype == ET_DYN) && (sym->st_shndx != SHN_UNDEF) &&
+		if ((etype == ET_DYN) && (nsym->st_shndx != SHN_UNDEF) &&
 		    ((sdp->sd_flags & FLG_SY_SOFOUND) == 0))
 			sdp->sd_flags |= FLG_SY_SOFOUND;
 
@@ -2577,7 +2573,7 @@
 			for (sndx = ndx + 1; sndx < (total - local); sndx++) {
 				Sym_desc	*ssdp = sort[sndx];
 				Sym		*ssym;
-				int		w_dynbits, s_dynbits;
+				sd_flag_t	w_dynbits, s_dynbits;
 
 				/*
 				 * Ignore any empty symbol descriptor, or the
@@ -2719,7 +2715,7 @@
 	if (sdp == NULL) {
 		DBG_CALL(Dbg_syms_global(ofl->ofl_lml, 0, name));
 		if ((sdp = ld_sym_enter(name, sym, hash, ifl, ofl, 0, SHN_UNDEF,
-		    0, 0, &where)) == (Sym_desc *)S_ERROR)
+		    0, &where)) == (Sym_desc *)S_ERROR)
 			return ((Sym_desc *)S_ERROR);
 	} else if (ld_sym_resolve(sdp, sym, ifl, ofl, 0,
 	    SHN_UNDEF, 0) == S_ERROR)
--- a/usr/src/cmd/sgs/libld/common/unwind.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/unwind.c	Wed Oct 14 08:12:49 2009 -0700
@@ -338,7 +338,7 @@
 	/*
 	 * Allocate and initialize the Elf_Data structure.
 	 */
-	if ((elfdata = libld_calloc(sizeof (Elf_Data), 1)) == 0)
+	if ((elfdata = libld_calloc(sizeof (Elf_Data), 1)) == NULL)
 		return (S_ERROR);
 	elfdata->d_type = ELF_T_BYTE;
 	elfdata->d_align = ld_targ.t_m.m_word_align;
@@ -347,7 +347,7 @@
 	/*
 	 * Allocate and initialize the Shdr structure.
 	 */
-	if ((shdr = libld_calloc(sizeof (Shdr), 1)) == 0)
+	if ((shdr = libld_calloc(sizeof (Shdr), 1)) == NULL)
 		return (S_ERROR);
 	shdr->sh_type = ld_targ.t_m.m_sht_unwind;
 	shdr->sh_flags = SHF_ALLOC;
@@ -357,7 +357,7 @@
 	/*
 	 * Allocate and initialize the Is_desc structure.
 	 */
-	if ((isp = libld_calloc(1, sizeof (Is_desc))) == 0)
+	if ((isp = libld_calloc(1, sizeof (Is_desc))) == NULL)
 		return (S_ERROR);
 	isp->is_name = MSG_ORIG(MSG_SCN_UNWINDHDR);
 	isp->is_shdr = shdr;
@@ -446,7 +446,7 @@
 	 */
 	size = 12 + (8 * fde_cnt);
 
-	if ((elfdata->d_buf = libld_calloc(size, 1)) == 0)
+	if ((elfdata->d_buf = libld_calloc(size, 1)) == NULL)
 		return (S_ERROR);
 	elfdata->d_size = size;
 	shdr->sh_size = (Xword)size;
--- a/usr/src/cmd/sgs/libld/common/update.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/update.c	Wed Oct 14 08:12:49 2009 -0700
@@ -191,22 +191,27 @@
 	int		start_set = 0;
 	Sym		_sym = {0}, *sym, *symtab = NULL;
 	Sym		*dynsym = NULL, *ldynsym = NULL;
-	Word		symtab_ndx = 0;	/* index into .symtab */
+	Word		symtab_ndx = 0;		/* index into .symtab */
 	Word		symtab_gbl_bndx;	/* .symtab ndx 1st global */
 	Word		ldynsym_ndx = 0;	/* index into .SUNW_ldynsym */
 	Word		dynsym_ndx = 0;		/* index into .dynsym */
-	Word		scopesym_ndx = 0; /* index into scoped symbols */
+	Word		scopesym_ndx = 0;	/* index into scoped symbols */
 	Word		scopesym_bndx = 0;	/* .symtab ndx 1st scoped sym */
-	Word		ldynscopesym_ndx = 0; /* index to ldynsym scoped syms */
-	Word		*dynsymsort = NULL; /* SUNW_dynsymsort index vector */
-	Word		*dyntlssort = NULL; /* SUNW_dyntlssort index vector */
+	Word		ldynscopesym_ndx = 0;	/* index to ldynsym scoped */
+						/*	symbols */
+	Word		*dynsymsort = NULL;	/* SUNW_dynsymsort index */
+						/*	vector */
+	Word		*dyntlssort = NULL;	/* SUNW_dyntlssort index */
+						/*	vector */
 	Word		dynsymsort_ndx;		/* index dynsymsort array */
 	Word		dyntlssort_ndx;		/* index dyntlssort array */
-	Word		*symndx;	/* Symbol index (for relocation use) */
+	Word		*symndx;		/* symbol index (for */
+						/*	relocation use) */
 	Word		*symshndx = NULL;	/* .symtab_shndx table */
 	Word		*dynshndx = NULL;	/* .dynsym_shndx table */
 	Word		*ldynshndx = NULL;	/* .SUNW_ldynsym_shndx table */
-	Word		ldynsym_cnt = NULL; /* # of items in .SUNW_ldynsym */
+	Word		ldynsym_cnt = NULL;	/* number of items in */
+						/*	.SUNW_ldynsym */
 	Str_tbl		*shstrtab;
 	Str_tbl		*strtab;
 	Str_tbl		*dynstr;
@@ -217,7 +222,6 @@
 	Wk_desc		*wkp;
 	Alist		*weak = NULL;
 	ofl_flag_t	flags = ofl->ofl_flags;
-	Word		dtflags_1 = ofl->ofl_dtflags_1;
 	Versym		*versym;
 	Gottable	*gottable;	/* used for display got debugging */
 					/*	information */
@@ -281,8 +285,7 @@
 		hashbkt = &hashtab[2];
 		hashchain = &hashtab[2 + ofl->ofl_hashbkts];
 		hashtab[0] = ofl->ofl_hashbkts;
-		hashtab[1] = ofl->ofl_dynshdrcnt + ofl->ofl_globcnt +
-		    ofl->ofl_lregsymcnt + 1;
+		hashtab[1] = DYNSYM_ALL_CNT(ofl);
 		if (ofl->ofl_osdynshndx)
 			dynshndx =
 			    (Word *)ofl->ofl_osdynshndx->os_outdata->d_buf;
@@ -482,7 +485,7 @@
 			if ((rsdp = ofl->ofl_regsyms[ndx]) == NULL)
 				continue;
 
-			if (((rsdp->sd_flags1 & FLG_SY1_HIDDEN) == 0) &&
+			if (((rsdp->sd_flags & FLG_SY_HIDDEN) == 0) &&
 			    (ELF_ST_BIND(rsdp->sd_sym->st_info) != STB_LOCAL))
 				continue;
 
@@ -597,8 +600,6 @@
 		}
 	}
 
-	DBG_CALL(Dbg_syms_up_title(ofl->ofl_lml));
-
 	/*
 	 * Initialize the scoped symbol table entry point.  This is for all
 	 * the global symbols that have been scoped to locals and will be
@@ -629,15 +630,7 @@
 	 * assigning a new virtual address or displacement (value).
 	 */
 	for (APLIST_TRAVERSE(ofl->ofl_objs, idx1, ifl)) {
-		Xword	lndx, local;
-
-		/*
-		 * Check that we have local symbols to process.  If the user
-		 * has indicated scoping then scan the global symbols also
-		 * looking for entries from this file to reduce to locals.
-		 */
-		if ((local = ifl->ifl_locscnt) == 0)
-			continue;
+		Xword	lndx, local = ifl->ifl_locscnt;
 
 		for (lndx = 1; lndx < local; lndx++) {
 			Gotndx		*gnp;
@@ -812,7 +805,7 @@
 				/* LINTED */
 				sym->st_value +=
 				    (Off)_elf_getxoff(isc->is_indata);
-				if (!(flags & FLG_OF_RELOBJ)) {
+				if ((flags & FLG_OF_RELOBJ) == 0) {
 					sym->st_value += osp->os_shdr->sh_addr;
 					/*
 					 * TLS symbols are relative to
@@ -867,11 +860,11 @@
 	 * by crti.o then they are used to represent the total concatenation of
 	 * the `.init' and `.fini' sections.
 	 *
-	 * First, determine whether any .init or .fini sections exist.  If these
-	 * sections exist when a dynamic object is being built, but no `_init'
-	 * or `_fini' symbols are found, then the user is probably building this
-	 * object directly from ld(1) rather than using a compiler driver that
-	 * provides the symbols via crt's.
+	 * Determine whether any .init or .fini sections exist.  If these
+	 * sections exist and a dynamic object is being built, but no `_init'
+	 * or `_fini' symbols are found, then the user is probably building
+	 * this object directly from ld(1) rather than using a compiler driver
+	 * that provides the symbols via crt's.
 	 *
 	 * If the .init or .fini section exist, and their associated symbols,
 	 * determine the size of the sections and updated the symbols value
@@ -948,6 +941,8 @@
 	scndx = 0;
 	ssndx = ofl->ofl_scopecnt + ofl->ofl_elimcnt;
 
+	DBG_CALL(Dbg_syms_up_title(ofl->ofl_lml));
+
 	/*
 	 * Traverse the internal symbol table updating global symbol information
 	 * and allocating common.
@@ -958,7 +953,7 @@
 		int	local;
 		int	restore;
 
-		sdp = sav->sav_symdesc;
+		sdp = sav->sav_sdp;
 
 		/*
 		 * Ignore any symbols that have been marked as invalid during
@@ -977,8 +972,7 @@
 		if (sdp->sd_ref == REF_DYN_SEEN)
 			continue;
 
-		if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) &&
-		    (flags & FLG_OF_PROCRED))
+		if ((sdp->sd_flags & FLG_SY_HIDDEN) && (flags & FLG_OF_PROCRED))
 			local = 1;
 		else
 			local = 0;
@@ -1144,15 +1138,15 @@
 		 * of the .symtab.  Retain the appropriate index for use in
 		 * version symbol indexing and relocation.
 		 */
-		if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) &&
+		if ((sdp->sd_flags & FLG_SY_HIDDEN) &&
 		    (flags & FLG_OF_PROCRED)) {
 			local = 1;
-			if (!(sdp->sd_flags1 & FLG_SY1_ELIM) && !dynsym)
+			if (!(sdp->sd_flags & FLG_SY_ELIM) && !dynsym)
 				sdp->sd_symndx = scopesym_ndx;
 			else
 				sdp->sd_symndx = 0;
 
-			if (sdp->sd_flags1 & FLG_SY1_ELIM) {
+			if (sdp->sd_flags & FLG_SY_ELIM) {
 				enter_in_symtab = 0;
 			} else if (ldynsym && sdp->sd_sym->st_name &&
 			    ldynsym_symtype[
@@ -1183,12 +1177,12 @@
 			if (sdp->sd_flags & FLG_SY_MVTOCOMM) {
 				vndx = VER_NDX_GLOBAL;
 			} else if (sdp->sd_ref == REF_REL_NEED) {
-				Half	symflags1 = sdp->sd_flags1;
+				sd_flag_t	sdflags = sdp->sd_flags;
 
 				vndx = sap->sa_overndx;
 				if ((vndx == 0) &&
 				    (sdp->sd_sym->st_shndx != SHN_UNDEF)) {
-					if (symflags1 & FLG_SY1_HIDDEN)
+					if (sdflags & FLG_SY_HIDDEN)
 						vndx = VER_NDX_LOCAL;
 					else
 						vndx = VER_NDX_GLOBAL;
@@ -1211,7 +1205,7 @@
 		if (sdp->sd_symndx && syminfo &&
 		    !(sdp->sd_flags & FLG_SY_NOTAVAIL)) {
 			int	ndx = sdp->sd_symndx;
-			APlist 	**alpp = &(ofl->ofl_syminfsyms);
+			APlist	**alpp = &(ofl->ofl_symdtent);
 
 			if (sdp->sd_flags & FLG_SY_MVTOCOMM)
 				/*
@@ -1256,7 +1250,7 @@
 				 *  -	All symbol references are required to
 				 *	use direct bindings via -Bdirect.
 				 */
-				if (sdp->sd_flags1 & FLG_SY1_DIR)
+				if (sdp->sd_flags & FLG_SY_DIR)
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_DIRECTBIND;
 
@@ -1279,7 +1273,7 @@
 				 */
 				syminfo[ndx].si_flags |= SYMINFO_FLG_DIRECT;
 				syminfo[ndx].si_boundto = SYMINFO_BT_PARENT;
-				if (sdp->sd_flags1 & FLG_SY1_DIR)
+				if (sdp->sd_flags & FLG_SY_DIR)
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_DIRECTBIND;
 
@@ -1290,7 +1284,7 @@
 				 * prevent external direct bindings.
 				 */
 				syminfo[ndx].si_flags |= SYMINFO_FLG_FILTER;
-				if (sdp->sd_flags1 & FLG_SY1_NDIR)
+				if (sdp->sd_flags & FLG_SY_NDIR)
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_NOEXTDIRECT;
 
@@ -1303,21 +1297,24 @@
 				 * prevent external direct bindings.
 				 */
 				syminfo[ndx].si_flags |= SYMINFO_FLG_AUXILIARY;
-				if (sdp->sd_flags1 & FLG_SY1_NDIR)
+				if (sdp->sd_flags & FLG_SY_NDIR)
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_NOEXTDIRECT;
 
 			} else if ((sdp->sd_ref == REF_REL_NEED) &&
 			    (sdp->sd_sym->st_shndx != SHN_UNDEF)) {
-
 				/*
 				 * This definition exists within the object
-				 * being created.  Flag whether it is necessary
-				 * to prevent external direct bindings.
+				 * being created.  Provide a default boundto
+				 * definition, which may be overridden later.
 				 */
-				if (sdp->sd_flags1 & FLG_SY1_NDIR) {
-					syminfo[ndx].si_boundto =
-					    SYMINFO_BT_NONE;
+				syminfo[ndx].si_boundto = SYMINFO_BT_NONE;
+
+				/*
+				 * Indicate whether it is necessary to prevent
+				 * external direct bindings.
+				 */
+				if (sdp->sd_flags & FLG_SY_NDIR) {
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_NOEXTDIRECT;
 				}
@@ -1332,40 +1329,24 @@
 				}
 
 				/*
-				 * If external bindings are allowed, or this is
-				 * a translator symbol, indicate the binding,
-				 * and a direct binding if necessary.
+				 * If external bindings are allowed, indicate
+				 * the binding, and a direct binding if
+				 * necessary.
 				 */
-				if (((sdp->sd_flags1 & FLG_SY1_NDIR) == 0) ||
-				    ((dtflags_1 & DF_1_TRANS) && sdp->sd_aux &&
-				    sdp->sd_aux->sa_bindto)) {
-
+				if ((sdp->sd_flags & FLG_SY_NDIR) == 0) {
 					syminfo[ndx].si_flags |=
 					    SYMINFO_FLG_DIRECT;
 
-					if (sdp->sd_flags1 & FLG_SY1_DIR)
+					if (sdp->sd_flags & FLG_SY_DIR)
 						syminfo[ndx].si_flags |=
 						    SYMINFO_FLG_DIRECTBIND;
 
 					/*
-					 * If this is a translator, the symbols
-					 * boundto element will indicate the
-					 * dependency to which it should resolve
-					 * rather than itself.  Save this info
-					 * for updating after the .dynamic
-					 * section has been created.
+					 * Provide a default boundto definition,
+					 * which may be overridden later.
 					 */
-					if ((dtflags_1 & DF_1_TRANS) &&
-					    sdp->sd_aux &&
-					    sdp->sd_aux->sa_bindto) {
-						if (aplist_append(alpp, sdp,
-						    AL_CNT_OFL_SYMINFOSYMS) ==
-						    NULL)
-							return (0);
-					} else {
-						syminfo[ndx].si_boundto =
-						    SYMINFO_BT_SELF;
-					}
+					syminfo[ndx].si_boundto =
+					    SYMINFO_BT_SELF;
 				}
 			}
 		}
@@ -1535,8 +1516,7 @@
 			 * indication of the presence or absence of certain
 			 * functionality).
 			 */
-			if (((flags & (FLG_OF_STATIC | FLG_OF_EXEC)) ==
-			    (FLG_OF_STATIC | FLG_OF_EXEC)) &&
+			if (OFL_IS_STATIC_EXEC(ofl) &&
 			    (ELF_ST_BIND(sym->st_info) == STB_WEAK)) {
 				sdp->sd_flags |= FLG_SY_SPECSEC;
 				sdp->sd_shndx = sectndx = SHN_ABS;
@@ -1795,7 +1775,7 @@
 		 * be local, otherwise if it's from a shared object then we need
 		 * to maintain the binding of the original reference.
 		 */
-		if (sdp->sd_flags1 & FLG_SY1_HIDDEN) {
+		if (sdp->sd_flags & FLG_SY_HIDDEN) {
 			if (flags & FLG_OF_PROCRED)
 				bind = STB_LOCAL;
 			else
@@ -1863,14 +1843,13 @@
 		 *		(correct number of globals entered)
 		 */
 		assert((scopesym_bndx + ofl->ofl_scopecnt) == scopesym_ndx);
-		assert(shdr->sh_info == (ofl->ofl_shdrcnt +
-		    ofl->ofl_locscnt + ofl->ofl_scopecnt + 2));
+		assert(shdr->sh_info == SYMTAB_LOC_CNT(ofl));
 		assert((shdr->sh_info + ofl->ofl_globcnt) == symtab_ndx);
 	}
 	if (dynsym) {
 		Shdr	*shdr = ofl->ofl_osdynsym->os_shdr;
 
-		shdr->sh_info = 1 + ofl->ofl_dynshdrcnt + ofl->ofl_lregsymcnt;
+		shdr->sh_info = DYNSYM_LOC_CNT(ofl);
 		/* LINTED */
 		shdr->sh_link = (Word)elf_ndxscn(ofl->ofl_osdynstr->os_scn);
 
@@ -1980,31 +1959,35 @@
 	Shdr		*shdr;
 	Dyn		*_dyn = (Dyn *)ofl->ofl_osdynamic->os_outdata->d_buf;
 	Dyn		*dyn;
-	Str_tbl		*dynstr;
+	Os_desc		*symosp, *strosp;
+	Str_tbl		*strtbl;
 	size_t		stoff;
 	ofl_flag_t	flags = ofl->ofl_flags;
 	int		not_relobj = !(flags & FLG_OF_RELOBJ);
 	Word		cnt;
 
 	/*
-	 * A relocatable object with a dynamic section is possible, though
-	 * rare. One use for this feature is to produce drivers
-	 * for the kernel, loaded by krtld.
-	 *
-	 * Only a limited subset of DT_ entries apply to relocatable
-	 * objects:
+	 * Relocatable objects can be built with -r and -dy to trigger the
+	 * creation of a .dynamic section.  This model is used to create kernel
+	 * device drivers.  The .dynamic section provides a subset of userland
+	 * .dynamic entries, typically entries such as DT_NEEDED and DT_RUNPATH.
 	 *
-	 *	DT_NEEDED
-	 *	DT_RUNPATH/DT_RPATH
-	 *	DT_FLAGS
-	 *	DT_FLAGS1
-	 *	DT_SUNW_STRPAD
-	 *	DT_LDMACH
+	 * Within a dynamic object, any .dynamic string references are to the
+	 * .dynstr table.  Within a relocatable object, these strings can reside
+	 * within the .strtab.
 	 */
-	dynstr = ofl->ofl_dynstrtab;
-	ofl->ofl_osdynamic->os_shdr->sh_link =
-	    /* LINTED */
-	    (Word)elf_ndxscn(ofl->ofl_osdynstr->os_scn);
+	if (OFL_IS_STATIC_OBJ(ofl)) {
+		symosp = ofl->ofl_ossymtab;
+		strosp = ofl->ofl_osstrtab;
+		strtbl = ofl->ofl_strtab;
+	} else {
+		symosp = ofl->ofl_osdynsym;
+		strosp = ofl->ofl_osdynstr;
+		strtbl = ofl->ofl_dynstrtab;
+	}
+
+	/* LINTED */
+	ofl->ofl_osdynamic->os_shdr->sh_link = (Word)elf_ndxscn(strosp->os_scn);
 
 	dyn = _dyn;
 
@@ -2031,7 +2014,7 @@
 		else
 			continue;
 
-		(void) st_setstring(dynstr, ifl->ifl_soname, &stoff);
+		(void) st_setstring(strtbl, ifl->ifl_soname, &stoff);
 		dyn->d_un.d_val = stoff;
 		/* LINTED */
 		ifl->ifl_neededndx = (Half)(((uintptr_t)dyn - (uintptr_t)_dyn) /
@@ -2049,7 +2032,7 @@
 				else
 					dyn->d_tag = DT_SUNW_FILTER;
 
-				(void) st_setstring(dynstr, dftp->dft_str,
+				(void) st_setstring(strtbl, dftp->dft_str,
 				    &stoff);
 				dyn->d_un.d_val = stoff;
 				dftp->dft_ndx = (Half)(((uintptr_t)dyn -
@@ -2075,7 +2058,7 @@
 		}
 		if (ofl->ofl_soname) {
 			dyn->d_tag = DT_SONAME;
-			(void) st_setstring(dynstr, ofl->ofl_soname, &stoff);
+			(void) st_setstring(strtbl, ofl->ofl_soname, &stoff);
 			dyn->d_un.d_val = stoff;
 			dyn++;
 		}
@@ -2085,14 +2068,14 @@
 			} else {
 				dyn->d_tag = DT_FILTER;
 			}
-			(void) st_setstring(dynstr, ofl->ofl_filtees, &stoff);
+			(void) st_setstring(strtbl, ofl->ofl_filtees, &stoff);
 			dyn->d_un.d_val = stoff;
 			dyn++;
 		}
 	}
 
 	if (ofl->ofl_rpath) {
-		(void) st_setstring(dynstr, ofl->ofl_rpath, &stoff);
+		(void) st_setstring(strtbl, ofl->ofl_rpath, &stoff);
 		dyn->d_tag = DT_RUNPATH;
 		dyn->d_un.d_val = stoff;
 		dyn++;
@@ -2106,19 +2089,19 @@
 
 		if (ofl->ofl_config) {
 			dyn->d_tag = DT_CONFIG;
-			(void) st_setstring(dynstr, ofl->ofl_config, &stoff);
+			(void) st_setstring(strtbl, ofl->ofl_config, &stoff);
 			dyn->d_un.d_val = stoff;
 			dyn++;
 		}
 		if (ofl->ofl_depaudit) {
 			dyn->d_tag = DT_DEPAUDIT;
-			(void) st_setstring(dynstr, ofl->ofl_depaudit, &stoff);
+			(void) st_setstring(strtbl, ofl->ofl_depaudit, &stoff);
 			dyn->d_un.d_val = stoff;
 			dyn++;
 		}
 		if (ofl->ofl_audit) {
 			dyn->d_tag = DT_AUDIT;
-			(void) st_setstring(dynstr, ofl->ofl_audit, &stoff);
+			(void) st_setstring(strtbl, ofl->ofl_audit, &stoff);
 			dyn->d_un.d_val = stoff;
 			dyn++;
 		}
@@ -2127,7 +2110,7 @@
 		dyn->d_un.d_ptr = ofl->ofl_oshash->os_shdr->sh_addr;
 		dyn++;
 
-		shdr = ofl->ofl_osdynstr->os_shdr;
+		shdr = strosp->os_shdr;
 		dyn->d_tag = DT_STRTAB;
 		dyn->d_un.d_ptr = shdr->sh_addr;
 		dyn++;
@@ -2136,7 +2119,11 @@
 		dyn->d_un.d_ptr = shdr->sh_size;
 		dyn++;
 
-		shdr = ofl->ofl_osdynsym->os_shdr;
+		/*
+		 * Note, the shdr is set and used in the ofl->ofl_osldynsym case
+		 * that follows.
+		 */
+		shdr = symosp->os_shdr;
 		dyn->d_tag = DT_SYMTAB;
 		dyn->d_un.d_ptr = shdr->sh_addr;
 		dyn++;
@@ -2146,6 +2133,8 @@
 		dyn++;
 
 		if (ofl->ofl_osldynsym) {
+			Shdr	*lshdr = ofl->ofl_osldynsym->os_shdr;
+
 			/*
 			 * We have arranged for the .SUNW_ldynsym data to be
 			 * immediately in front of the .dynsym data.
@@ -2155,7 +2144,6 @@
 			 * provide for DT_SUNW_SYMTAB, which is why we
 			 * add the lengths together.
 			 */
-			Shdr *lshdr = ofl->ofl_osldynsym->os_shdr;
 			dyn->d_tag = DT_SUNW_SYMTAB;
 			dyn->d_un.d_ptr = lshdr->sh_addr;
 			dyn++;
@@ -2172,26 +2160,26 @@
 		}
 
 		if (ofl->ofl_osdynsymsort) {
+			shdr = ofl->ofl_osdynsymsort->os_shdr;
+
 			dyn->d_tag = DT_SUNW_SYMSORT;
-			dyn->d_un.d_ptr =
-			    ofl->ofl_osdynsymsort->os_shdr->sh_addr;
+			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
 
 			dyn->d_tag = DT_SUNW_SYMSORTSZ;
-			dyn->d_un.d_val =
-			    ofl->ofl_osdynsymsort->os_shdr->sh_size;
+			dyn->d_un.d_val = shdr->sh_size;
 			dyn++;
 		}
 
 		if (ofl->ofl_osdyntlssort) {
+			shdr = ofl->ofl_osdyntlssort->os_shdr;
+
 			dyn->d_tag = DT_SUNW_TLSSORT;
-			dyn->d_un.d_ptr =
-			    ofl->ofl_osdyntlssort->os_shdr->sh_addr;
+			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
 
 			dyn->d_tag = DT_SUNW_TLSSORTSZ;
-			dyn->d_un.d_val =
-			    ofl->ofl_osdyntlssort->os_shdr->sh_size;
+			dyn->d_un.d_val = shdr->sh_size;
 			dyn++;
 		}
 
@@ -2239,6 +2227,7 @@
 		if ((flags & (FLG_OF_VERDEF | FLG_OF_NOVERSEC)) ==
 		    FLG_OF_VERDEF) {
 			shdr = ofl->ofl_osverdef->os_shdr;
+
 			dyn->d_tag = DT_VERDEF;
 			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
@@ -2249,6 +2238,7 @@
 		if ((flags & (FLG_OF_VERNEED | FLG_OF_NOVERSEC)) ==
 		    FLG_OF_VERNEED) {
 			shdr = ofl->ofl_osverneed->os_shdr;
+
 			dyn->d_tag = DT_VERNEED;
 			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
@@ -2309,7 +2299,7 @@
 		}
 
 		if (ofl->ofl_pltcnt) {
-			shdr =  ofl->ofl_osplt->os_relosdesc->os_shdr;
+			shdr = ofl->ofl_osplt->os_relosdesc->os_shdr;
 
 			dyn->d_tag = DT_PLTRELSZ;
 			dyn->d_un.d_ptr = shdr->sh_size;
@@ -2322,7 +2312,7 @@
 			dyn++;
 		}
 		if (ofl->ofl_pltpad) {
-			shdr =  ofl->ofl_osplt->os_shdr;
+			shdr = ofl->ofl_osplt->os_shdr;
 
 			dyn->d_tag = DT_PLTPAD;
 			if (ofl->ofl_pltcnt) {
@@ -2338,14 +2328,16 @@
 			dyn++;
 		}
 		if (ofl->ofl_relocsz) {
+			shdr = ofl->ofl_osrelhead->os_shdr;
+
 			dyn->d_tag = ld_targ.t_m.m_rel_dt_type;
-			dyn->d_un.d_ptr = ofl->ofl_osrelhead->os_shdr->sh_addr;
+			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
 			dyn->d_tag = ld_targ.t_m.m_rel_dt_size;
 			dyn->d_un.d_ptr = ofl->ofl_relocsz;
 			dyn++;
 			dyn->d_tag = ld_targ.t_m.m_rel_dt_ent;
-			if (ofl->ofl_osrelhead->os_shdr->sh_type == SHT_REL)
+			if (shdr->sh_type == SHT_REL)
 				dyn->d_un.d_ptr = sizeof (Rel);
 			else
 				dyn->d_un.d_ptr = sizeof (Rela);
@@ -2353,6 +2345,7 @@
 		}
 		if (ofl->ofl_ossyminfo) {
 			shdr = ofl->ofl_ossyminfo->os_shdr;
+
 			dyn->d_tag = DT_SYMINFO;
 			dyn->d_un.d_ptr = shdr->sh_addr;
 			dyn++;
@@ -2364,17 +2357,16 @@
 			dyn++;
 		}
 		if (ofl->ofl_osmove) {
-			Os_desc	*osp;
+			shdr = ofl->ofl_osmove->os_shdr;
 
 			dyn->d_tag = DT_MOVEENT;
-			osp = ofl->ofl_osmove;
-			dyn->d_un.d_val = osp->os_shdr->sh_entsize;
+			dyn->d_un.d_val = shdr->sh_entsize;
 			dyn++;
 			dyn->d_tag = DT_MOVESZ;
-			dyn->d_un.d_val = osp->os_shdr->sh_size;
+			dyn->d_un.d_val = shdr->sh_size;
 			dyn++;
 			dyn->d_tag = DT_MOVETAB;
-			dyn->d_un.d_val = osp->os_shdr->sh_addr;
+			dyn->d_un.d_val = shdr->sh_addr;
 			dyn++;
 		}
 		if (ofl->ofl_regsymcnt) {
@@ -2466,9 +2458,9 @@
 	}
 
 	/*
-	 * Ensure that we wrote the right number of entries. If not,
-	 * we either miscounted in make_dynamic(), or we did something wrong
-	 * in this function.
+	 * Ensure that we wrote the right number of entries. If not, we either
+	 * miscounted in make_dynamic(), or we did something wrong in this
+	 * function.
 	 */
 	assert((ofl->ofl_osdynamic->os_shdr->sh_size /
 	    ofl->ofl_osdynamic->os_shdr->sh_entsize) ==
@@ -2488,6 +2480,18 @@
 	Verdef		*vdf, *_vdf;
 	int		num = 0;
 	Os_desc		*strosp;
+	Str_tbl		*strtbl;
+
+	/*
+	 * Determine which string table to use.
+	 */
+	if (OFL_IS_STATIC_OBJ(ofl)) {
+		strtbl = ofl->ofl_strtab;
+		strosp = ofl->ofl_osstrtab;
+	} else {
+		strtbl = ofl->ofl_dynstrtab;
+		strosp = ofl->ofl_osdynstr;
+	}
 
 	/*
 	 * Traverse the version descriptors and update the version structures
@@ -2506,17 +2510,9 @@
 			 * version name (there is no corresponding symbol for
 			 * this).
 			 */
-			if (!(ofl->ofl_flags & FLG_OF_DYNAMIC)) {
-				(void) st_setstring(ofl->ofl_strtab,
-				    name, &stoff);
-				/* LINTED */
-				vdp->vd_name = (const char *)stoff;
-			} else {
-				(void) st_setstring(ofl->ofl_dynstrtab,
-				    name, &stoff);
-				/* LINTED */
-				vdp->vd_name = (const char *)stoff;
-			}
+			(void) st_setstring(strtbl, name, &stoff);
+			/* LINTED */
+			vdp->vd_name = (const char *)stoff;
 		} else {
 			sdp = ld_sym_find(vdp->vd_name, vdp->vd_hash, 0, ofl);
 			/* LINTED */
@@ -2590,12 +2586,6 @@
 	 * table (the actual contents of the version symbol table are filled
 	 * in during symbol update).
 	 */
-	if ((ofl->ofl_flags & FLG_OF_RELOBJ) ||
-	    (ofl->ofl_flags & FLG_OF_STATIC)) {
-		strosp = ofl->ofl_osstrtab;
-	} else {
-		strosp = ofl->ofl_osdynstr;
-	}
 	/* LINTED */
 	ofl->ofl_osverdef->os_shdr->sh_link = (Word)elf_ndxscn(strosp->os_scn);
 
@@ -2611,28 +2601,23 @@
 /*
  * Finish the version symbol index section
  */
-static int
+static void
 update_oversym(Ofl_desc *ofl)
 {
-	Os_desc		*symosp;
+	Os_desc		*osp;
 
 	/*
-	 * Record the string table association with the version definition
-	 * section, and the symbol table associated with the version symbol
-	 * table (the actual contents of the version symbol table are filled
-	 * in during symbol update).
+	 * Record the symbol table associated with the version symbol table.
+	 * The contents of the version symbol table are filled in during
+	 * symbol update.
 	 */
-	if ((ofl->ofl_flags & FLG_OF_RELOBJ) ||
-	    (ofl->ofl_flags & FLG_OF_STATIC)) {
-		symosp = ofl->ofl_ossymtab;
-	} else {
-		symosp = ofl->ofl_osdynsym;
-	}
+	if (OFL_IS_STATIC_OBJ(ofl))
+		osp = ofl->ofl_ossymtab;
+	else
+		osp = ofl->ofl_osdynsym;
 
 	/* LINTED */
-	ofl->ofl_osversym->os_shdr->sh_link = (Word)elf_ndxscn(symosp->os_scn);
-
-	return (1);
+	ofl->ofl_osversym->os_shdr->sh_link = (Word)elf_ndxscn(osp->os_scn);
 }
 
 /*
@@ -2644,13 +2629,24 @@
 	Aliste		idx1;
 	Ifl_desc	*ifl;
 	Verneed		*vnd, *_vnd;
-	Str_tbl		*dynstr;
+	Os_desc		*strosp;
+	Str_tbl		*strtbl;
 	Word		num = 0;
 
-	dynstr = ofl->ofl_dynstrtab;
 	_vnd = vnd = (Verneed *)ofl->ofl_osverneed->os_outdata->d_buf;
 
 	/*
+	 * Determine which string table is appropriate.
+	 */
+	if (OFL_IS_STATIC_OBJ(ofl)) {
+		strosp = ofl->ofl_osstrtab;
+		strtbl = ofl->ofl_strtab;
+	} else {
+		strosp = ofl->ofl_osdynstr;
+		strtbl = ofl->ofl_dynstrtab;
+	}
+
+	/*
 	 * Traverse the shared object list looking for dependencies that have
 	 * versions defined within them.
 	 */
@@ -2665,7 +2661,7 @@
 
 		vnd->vn_version = VER_NEED_CURRENT;
 
-		(void) st_setstring(dynstr, ifl->ifl_soname, &stoff);
+		(void) st_setstring(strtbl, ifl->ifl_soname, &stoff);
 		vnd->vn_file = stoff;
 
 		_vnap = vnap = (Vernaux *)(vnd + 1);
@@ -2678,7 +2674,7 @@
 			Ver_index	*vip = &ifl->ifl_verndx[_cnt];
 
 			if (vip->vi_flags & FLG_VER_REFER) {
-				(void) st_setstring(dynstr, vip->vi_name,
+				(void) st_setstring(strtbl, vip->vi_name,
 				    &stoff);
 				vnap->vna_name = stoff;
 
@@ -2735,19 +2731,16 @@
 	_vnd->vn_next = 0;
 
 	/*
-	 * Record association on string table section and use the
-	 * `info' field to indicate the number of entries in this
-	 * section.
+	 * Use sh_link to record the associated string table section, and
+	 * sh_info to indicate the number of entries contained in the section.
 	 */
-	ofl->ofl_osverneed->os_shdr->sh_link =
-	    /* LINTED */
-	    (Word)elf_ndxscn(ofl->ofl_osdynstr->os_scn);
+	/* LINTED */
+	ofl->ofl_osverneed->os_shdr->sh_link = (Word)elf_ndxscn(strosp->os_scn);
 	ofl->ofl_osverneed->os_shdr->sh_info = num;
 
 	return (1);
 }
 
-
 /*
  * Update syminfo section.
  */
@@ -2780,15 +2773,8 @@
 	/*
 	 * Update any references with the index into the dynamic table.
 	 */
-	for (APLIST_TRAVERSE(ofl->ofl_syminfsyms, idx, sdp)) {
-		Ifl_desc	*ifl;
-
-		if (sdp->sd_aux && sdp->sd_aux->sa_bindto)
-			ifl = sdp->sd_aux->sa_bindto;
-		else
-			ifl = sdp->sd_file;
-		sip[sdp->sd_symndx].si_boundto = ifl->ifl_neededndx;
-	}
+	for (APLIST_TRAVERSE(ofl->ofl_symdtent, idx, sdp))
+		sip[sdp->sd_symndx].si_boundto = sdp->sd_file->ifl_neededndx;
 
 	/*
 	 * Update any filtee references with the index into the dynamic table.
@@ -3733,7 +3719,7 @@
 	 * If we have a PT_SUNWDTRACE phdr, update it now with the address of
 	 * the symbol.  It's only now been updated via update_sym().
 	 */
-	if (dtracesgp && ofl->ofl_dtracesym) {
+	if (dtracesgp) {
 		Phdr		*aphdr, *phdr = &(dtracesgp->sg_phdr);
 		Sym_desc	*sdp = ofl->ofl_dtracesym;
 
@@ -3755,7 +3741,7 @@
 	 * If we have a PT_SUNWCAP phdr, update it now from the associated
 	 * section information.
 	 */
-	if (capsgp && ofl->ofl_oscap) {
+	if (capsgp) {
 		Phdr	*phdr = &(capsgp->sg_phdr);
 		Shdr	*shdr = ofl->ofl_oscap->os_shdr;
 
@@ -3793,20 +3779,20 @@
 		if ((flags & FLG_OF_VERNEED) &&
 		    (update_overneed(ofl) == S_ERROR))
 			return (S_ERROR);
-		if ((flags & (FLG_OF_VERNEED | FLG_OF_VERDEF)) &&
-		    (update_oversym(ofl) == S_ERROR))
-			return (S_ERROR);
+		if (flags & (FLG_OF_VERNEED | FLG_OF_VERDEF))
+			update_oversym(ofl);
 	}
 	if (flags & FLG_OF_DYNAMIC) {
 		if (update_odynamic(ofl) == S_ERROR)
 			return (S_ERROR);
-		if (ofl->ofl_ossyminfo)
-			if (update_osyminfo(ofl) == S_ERROR)
-				return (S_ERROR);
+	}
+	if (ofl->ofl_ossyminfo) {
+		if (update_osyminfo(ofl) == S_ERROR)
+			return (S_ERROR);
 	}
 
 	/*
-	 * Sanity test: First and last data byte of a string table
+	 * Sanity test: the first and last data byte of a string table
 	 * must be NULL.
 	 */
 	assert((ofl->ofl_osshstrtab == NULL) ||
--- a/usr/src/cmd/sgs/libld/common/version.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/libld/common/version.c	Wed Oct 14 08:12:49 2009 -0700
@@ -183,6 +183,7 @@
 	for (APLIST_TRAVERSE(ofl->ofl_verdesc, idx1, vdp))
 		if ((is_cyclic = vers_visit_children(ofl, vdp, 0)) == S_ERROR)
 			return (S_ERROR);
+
 	if (is_cyclic)
 		ofl->ofl_flags |= FLG_OF_FATAL;
 
@@ -191,7 +192,7 @@
 		Sym		*sym;
 		Sym_desc	*sdp;
 		const char	*name = vdp->vd_name;
-		unsigned char	bind;
+		uchar_t		bind;
 		Ver_desc	*_vdp;
 		avl_index_t	where;
 		Aliste		idx2;
@@ -260,9 +261,8 @@
 				sdp->sd_sym->st_info =
 				    ELF_ST_INFO(bind, STT_OBJECT);
 				sdp->sd_ref = REF_REL_NEED;
-				sdp->sd_flags |= FLG_SY_SPECSEC;
-				sdp->sd_flags1 |=
-				    (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF);
+				sdp->sd_flags |= (FLG_SY_SPECSEC |
+				    FLG_SY_DEFAULT | FLG_SY_EXPDEF);
 				sdp->sd_aux->sa_overndx = vdp->vd_ndx;
 
 				/*
@@ -291,8 +291,8 @@
 			DBG_CALL(Dbg_ver_symbol(ofl->ofl_lml, name));
 
 			if ((sdp = ld_sym_enter(name, sym, vdp->vd_hash,
-			    vdp->vd_file, ofl, 0, SHN_ABS, FLG_SY_SPECSEC,
-			    (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF),
+			    vdp->vd_file, ofl, 0, SHN_ABS,
+			    (FLG_SY_SPECSEC | FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 			    &where)) == (Sym_desc *)S_ERROR)
 				return (S_ERROR);
 
@@ -903,20 +903,18 @@
 	 */
 	vndx = ifl->ifl_versym[ndx];
 	if (vndx == 0) {
-		sdp->sd_flags |= FLG_SY_REDUCED;
-		sdp->sd_flags1 |= FLG_SY1_HIDDEN;
+		sdp->sd_flags |= (FLG_SY_REDUCED | FLG_SY_HIDDEN);
 		return;
 	}
 
 	if (vndx == VER_NDX_ELIMINATE) {
-		sdp->sd_flags |= FLG_SY_REDUCED;
-		sdp->sd_flags1 |= (FLG_SY1_HIDDEN | FLG_SY1_ELIM);
+		sdp->sd_flags |= (FLG_SY_REDUCED | FLG_SY_HIDDEN | FLG_SY_ELIM);
 		return;
 	}
 
 	if (vndx == VER_NDX_GLOBAL) {
-		if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0)
-			sdp->sd_flags1 |= (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF);
+		if ((sdp->sd_flags & FLG_SY_HIDDEN) == 0)
+			sdp->sd_flags |= (FLG_SY_DEFAULT | FLG_SY_EXPDEF);
 		if (sdp->sd_aux->sa_overndx <= VER_NDX_GLOBAL)
 			sdp->sd_aux->sa_overndx = VER_NDX_GLOBAL;
 		return;
@@ -933,8 +931,8 @@
 		return;
 	}
 
-	if ((sdp->sd_flags1 & FLG_SY1_HIDDEN) == 0)
-		sdp->sd_flags1 |= (FLG_SY1_DEFAULT | FLG_SY1_EXPDEF);
+	if ((sdp->sd_flags & FLG_SY_HIDDEN) == 0)
+		sdp->sd_flags |= (FLG_SY_DEFAULT | FLG_SY_EXPDEF);
 
 	/*
 	 * Promote the symbols version index to the appropriate output version
--- a/usr/src/cmd/sgs/liblddbg/common/_debug.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/liblddbg/common/_debug.h	Wed Oct 14 08:12:49 2009 -0700
@@ -130,14 +130,16 @@
 #define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_64
 #define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_64
 #define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_64
-#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_64
 #define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_64
 #define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_64
+#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_64
+#define	MSG_REL_LDSV_ENTRY	MSG_REL_LDSV_ENTRY_64
 #define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_64
 #define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_64
-#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_64
 #define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_64
 #define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_64
+#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_64
+#define	MSG_REL_LDLV_ENTRY	MSG_REL_LDLV_ENTRY_64
 
 #define	MSG_SHD_ADDR		MSG_SHD_ADDR_64
 #define	MSG_SHD_SIZE		MSG_SHD_SIZE_64
@@ -185,14 +187,16 @@
 #define	MSG_REL_RTN_ENTRY	MSG_REL_RTN_ENTRY_32
 #define	MSG_REL_LDSA_TITLE	MSG_REL_LDSA_TITLE_32
 #define	MSG_REL_LDSN_TITLE	MSG_REL_LDSN_TITLE_32
-#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_32
 #define	MSG_REL_LDSA_ENTRY	MSG_REL_LDSA_ENTRY_32
 #define	MSG_REL_LDSN_ENTRY	MSG_REL_LDSN_ENTRY_32
+#define	MSG_REL_LDSV_TITLE	MSG_REL_LDSV_TITLE_32
+#define	MSG_REL_LDSV_ENTRY	MSG_REL_LDSV_ENTRY_32
 #define	MSG_REL_LDLA_TITLE	MSG_REL_LDLA_TITLE_32
 #define	MSG_REL_LDLN_TITLE	MSG_REL_LDLN_TITLE_32
-#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_32
 #define	MSG_REL_LDLA_ENTRY	MSG_REL_LDLA_ENTRY_32
 #define	MSG_REL_LDLN_ENTRY	MSG_REL_LDLN_ENTRY_32
+#define	MSG_REL_LDLV_TITLE	MSG_REL_LDLV_TITLE_32
+#define	MSG_REL_LDLV_ENTRY	MSG_REL_LDLV_ENTRY_32
 
 #define	MSG_SHD_ADDR		MSG_SHD_ADDR_32
 #define	MSG_SHD_SIZE		MSG_SHD_SIZE_32
--- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg	Wed Oct 14 08:12:49 2009 -0700
@@ -1118,7 +1118,6 @@
 @ MSG_CAP_HWFILTR_2	"dir=%s;  no hardware capability objects found"
 
 
-
 @ MSG_ELF_HEADER	"ELF Header"
 
 # Capabilities entries.
@@ -1292,10 +1291,11 @@
 			 offset     addend  section        symbol"
 @ MSG_REL_LDSN_TITLE_32	"         type                       \
 			 offset             section        symbol"
+@ MSG_REL_LDSA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %-14.14s %s  %s"
+@ MSG_REL_LDSN_ENTRY_32	" %5s %-24s %#10llx             %-14.14s %s  %s"
+
 @ MSG_REL_LDSV_TITLE_32	"         type                       \
 			 offset      value  section        symbol"
-@ MSG_REL_LDSA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %-14.14s %s  %s"
-@ MSG_REL_LDSN_ENTRY_32	" %5s %-24s %#10llx             %-14.14s %s  %s"
 
 # TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
 # provide for a series of one or more 32-bit relocation table entries, using
@@ -1305,11 +1305,11 @@
 			 offset     addend  section / symbol"
 @ MSG_REL_LDLN_TITLE_32	"         type                       \
 			 offset             section / symbol"
-@ MSG_REL_LDLV_TITLE_32	"         type                       \
-			 offset      value  section / symbol"
 @ MSG_REL_LDLA_ENTRY_32	" %5s %-24s %#10llx %#10llx  %-14s %s  %s"
 @ MSG_REL_LDLN_ENTRY_32	" %5s %-24s %#10llx             %-14s %s  %s"
 
+@ MSG_REL_LDLV_TITLE_32	"         type                       \
+			 offset      value  section / symbol"
 
 # TRANSLATION_NOTE - the following strings are used by elfdump(1).  These
 # strings provide for a series of one or more 64-bit relocation table entries,
@@ -1356,10 +1356,11 @@
 			 offset             addend  section        symbol"
 @ MSG_REL_LDSN_TITLE_64	"         type                               \
 			 offset                     section        symbol"
+@ MSG_REL_LDSA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14.14s %s  %s"
+@ MSG_REL_LDSN_ENTRY_64	" %5s %-24s %#18llx                     %-14.14s %s  %s"
+
 @ MSG_REL_LDSV_TITLE_64	"         type                               \
 			 offset              value  section        symbol"
-@ MSG_REL_LDSA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14.14s %s  %s"
-@ MSG_REL_LDSN_ENTRY_64	" %5s %-24s %#18llx                     %-14.14s %s  %s"
 
 # TRANSLATION_NOTE - the following strings are used by ld(1).  These strings
 # provide for a series of one or more 64-bit relocation table entries, using
@@ -1369,10 +1370,11 @@
 			 offset             addend  section / symbol"
 @ MSG_REL_LDLN_TITLE_64	"         type                               \
 			 offset                     section / symbol"
+@ MSG_REL_LDLA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14s %s  %s"
+@ MSG_REL_LDLN_ENTRY_64	" %5s %-24s %#18llx                     %-14s %s  %s"
+
 @ MSG_REL_LDLV_TITLE_64	"         type                               \
 			 offset              value  section / symbol"
-@ MSG_REL_LDLA_ENTRY_64	" %5s %-24s %#18llx %#18llx  %-14s %s  %s"
-@ MSG_REL_LDLN_ENTRY_64	" %5s %-24s %#18llx                     %-14s %s  %s"
 
 @ _END_
 
--- a/usr/src/cmd/sgs/liblddbg/common/relocate.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/liblddbg/common/relocate.c	Wed Oct 14 08:12:49 2009 -0700
@@ -205,7 +205,7 @@
 
 	Dbg_util_nl(lml, DBG_NL_STD);
 	dbg_print(lml, MSG_INTL(MSG_REL_ACTIVE));
-	Elf_reloc_title(lml, ELF_DBG_LD, 0);
+	Elf_reloc_title(lml, ELF_DBG_LD_ACT, 0);
 }
 
 void
@@ -530,13 +530,6 @@
 		return;
 	}
 	if (caller == ELF_DBG_LD) {
-		if (type == 0) {
-			if (DBG_NOTLONG())
-				dbg_print(lml, MSG_INTL(MSG_REL_LDSV_TITLE));
-			else
-				dbg_print(lml, MSG_INTL(MSG_REL_LDLV_TITLE));
-			return;
-		}
 		if (type == SHT_RELA) {
 			if (DBG_NOTLONG())
 				dbg_print(lml, MSG_INTL(MSG_REL_LDSA_TITLE));
@@ -548,6 +541,14 @@
 			else
 				dbg_print(lml, MSG_INTL(MSG_REL_LDLN_TITLE));
 		}
+		return;
+	}
+	if (caller == ELF_DBG_LD_ACT) {
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_INTL(MSG_REL_LDSV_TITLE));
+		else
+			dbg_print(lml, MSG_INTL(MSG_REL_LDLV_TITLE));
+		return;
 	}
 }
 
@@ -611,6 +612,41 @@
 				    prestr, typestr, EC_OFF(off), secname,
 				    symname, poststr);
 		}
+		return;
+	}
+	if (caller == ELF_DBG_LD_ACT) {
+		longlong_t	value = EC_SXWORD(add);
+
+		/*
+		 * The following diagnostics are used to create active
+		 * relocation output.  A "value" field is specified in the
+		 * same column as a RELA addend.
+		 *
+		 * We have to work around an issue caused by the use of a
+		 * common format string to handle both the 32-bit and 64-bit
+		 * cases.  'add' is a signed value.  In the ELFCLASS32 case
+		 * where add is a 32-bit value, the EC_SXWORD() macro widens
+		 * it to a 64-bit signed value, which will cause sign extension
+		 * in the upper 32-bits.  As we are displaying the value in hex,
+		 * this causes our 32-bit value to be displayed with 16 hex
+		 * digits instead of 8, as would be appropriate for ELFCLASS32.
+		 *
+		 * The solution is to mask off the unwanted bits before
+		 * formatting the value.  The use of 'longlong_t' instead of
+		 * Elf64_Sxword (used by the EC_SXWORD macro) is for the
+		 * benefit of lint.
+		 */
+#if	!defined(_ELF64)
+		value &= 0xffffffff;
+#endif
+		if (DBG_NOTLONG())
+			dbg_print(lml, MSG_INTL(MSG_REL_LDSA_ENTRY),
+			    prestr, typestr, EC_OFF(off),
+			    value, secname, symname, poststr);
+		else
+			dbg_print(lml, MSG_INTL(MSG_REL_LDLA_ENTRY),
+			    prestr, typestr, EC_OFF(off),
+			    value, secname, symname, poststr);
 	}
 }
 
--- a/usr/src/cmd/sgs/liblddbg/common/syms.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/liblddbg/common/syms.c	Wed Oct 14 08:12:49 2009 -0700
@@ -495,7 +495,7 @@
 		dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING));
 	}
 
-	if ((sdp->sd_flags1 & FLG_SY1_ELIM) && isfromglobal)
+	if ((sdp->sd_flags & FLG_SY_ELIM) && isfromglobal)
 		dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING),
 		    Dbg_demangle_name(sdp->sd_name));
 	else if (isfromglobal)
--- a/usr/src/cmd/sgs/moe/common/moe.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/moe/common/moe.c	Wed Oct 14 08:12:49 2009 -0700
@@ -20,10 +20,9 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <dlfcn.h>
 #include <link.h>
@@ -95,7 +94,6 @@
 static int
 openlib(const char *prog, const char *name, int class, int silent, int verbose)
 {
-	Link_map	*lmp;
 	void		*handle;
 	const char	*modestr;
 
@@ -128,15 +126,18 @@
 			(void) fflush(stderr);
 		return (1);
 	}
-	if (dlinfo(handle, RTLD_DI_LINKMAP, &lmp) == -1) {
-		if (verbose)
-			(void) fprintf(stderr, MSG_ORIG(MSG_FMT_VERBOSE), prog,
-			    modestr, trim_msg(dlerror()));
-			(void) fflush(stderr);
-		return (1);
-	}
+	if (silent == 0) {
+		Link_map	*lmp;
 
-	if (silent == 0) {
+		if (dlinfo(handle, RTLD_DI_LINKMAP, &lmp) == -1) {
+			if (verbose)
+				(void) fprintf(stderr,
+				    MSG_ORIG(MSG_FMT_VERBOSE), prog, modestr,
+				    trim_msg(dlerror()));
+				(void) fflush(stderr);
+			return (1);
+		}
+
 		if (verbose)
 			(void) printf(MSG_ORIG(MSG_FMT_VERBOSE), prog, modestr,
 			    lmp->l_name);
@@ -215,14 +216,15 @@
 #if	!defined(_LP64)
 	if (mode != ONLY64) {
 #endif
-		if (openlib(prog, argv[optind], class, silent, verbose) != 0)
+		if (openlib(prog, argv[optind], class, silent, verbose) != 0) {
 			if (mode)
 				error++;
+		}
 #if	!defined(_LP64)
 	}
 #endif
 	if (mode == ONLY32)
-		return (0);
+		return (error);
 
 	/*
 	 * Re-exec ourselves to process any 64-bit expansion.
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README	Wed Oct 14 08:12:49 2009 -0700
@@ -1533,3 +1533,5 @@
 6878605 ld should accept '%' syntax when matching input SHT_PROGBITS sections
 6850768 ld option to autogenerate wrappers/interposers similar to GNU ld --wrap
 	PSARC/2009/493 ld -z wrap option
+6888489 Null environment variables are not overriding crle(1) replaceable
+	environment variables.
--- a/usr/src/cmd/sgs/rtld/Makefile.targ	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/rtld/Makefile.targ	Wed Oct 14 08:12:49 2009 -0700
@@ -38,27 +38,27 @@
 		$(POST_PROCESS_O)
 
 pics/%.o:	%.c
-		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 pics/%.o:	../common/%.c
-		$(COMPILE.c) -o $@ $<  $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 pics/%.o:	$(VAR_AVLDIR)/%.c
-		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 pics/%.o:	$(VAR_DTRDIR)/%.c
-		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 pics/%.o:	$(SGSTOOLS)/common/%.c
-		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 pics/%.o:	$(SRCBASE)/uts/$(PLAT)/krtld/%.c
-		$(COMPILE.c) -o $@ $<  $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 $(RTLD):	pics $(PICS) $(CRTS)
--- a/usr/src/cmd/sgs/rtld/common/util.c	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/rtld/common/util.c	Wed Oct 14 08:12:49 2009 -0700
@@ -1492,7 +1492,7 @@
 #define	SEL_ACT_STR		0x0400	/* setting string value */
 #define	SEL_ACT_LML		0x0800	/* setting lml_flags */
 #define	SEL_ACT_LMLT		0x1000	/* setting lml_tflags */
-#define	SEL_ACT_SPEC_1		0x2000	/* For FLG_{FLAGS, LIBPATH} */
+#define	SEL_ACT_SPEC_1		0x2000	/* for FLG_{FLAGS, LIBPATH} */
 #define	SEL_ACT_SPEC_2		0x4000	/* need special handling */
 
 /*
@@ -1892,23 +1892,19 @@
 		return;
 
 	/*
-	 * If the variable is already processed with ISA specific variable,
-	 * no further processing needed.
+	 * If the variable is already processed with and ISA specific variable,
+	 * no further processing is needed.
 	 */
 	if (((select & SEL_REPLACE) && (rplisa & variable)) ||
 	    ((select & SEL_PERMANT) && (prmisa & variable)))
 		return;
 
 	/*
-	 * Now mark the appropriate variables.
-	 * If the replaceable variable is already set, then the
-	 * process environment variable must be set. Any replaceable
-	 * variable specified in a configuration file can be ignored.
+	 * Mark the appropriate variables.
 	 */
 	if (env_flags & ENV_TYP_ISA) {
 		/*
-		 * This is an ISA setting. We do the setting even if s2 is
-		 * NULL.  If s2 is NULL, we might need to undo the setting.
+		 * This is an ISA setting.
 		 */
 		if (select & SEL_REPLACE) {
 			if (rplisa & variable)
@@ -1917,7 +1913,7 @@
 		} else {
 			prmisa |= variable;
 		}
-	} else if (s2) {
+	} else {
 		/*
 		 * This is a non-ISA setting.
 		 */
@@ -1927,11 +1923,7 @@
 			rplgen |= variable;
 		} else
 			prmgen |= variable;
-	} else
-		/*
-		 * This is a non-ISA setting which can be ignored.
-		 */
-		return;
+	}
 
 	/*
 	 * Now perform the setting.
@@ -1946,9 +1938,9 @@
 			rtld_flags2 |= val;
 		else
 			rtld_flags2 &= ~val;
-	} else if (select & SEL_ACT_STR)
+	} else if (select & SEL_ACT_STR) {
 		*str = s2;
-	else if (select & SEL_ACT_LML) {
+	} else if (select & SEL_ACT_LML) {
 		if (s2)
 			*lmflags |= val;
 		else
@@ -1979,21 +1971,24 @@
 	} else if (select & SEL_ACT_SPEC_2) {
 		/*
 		 * variables can be: ENV_FLG_
-		 * 	AUDIT_ARGS, BINDING, CONCURRENCY, CONFGEN,
-		 *	LOADFLTR, PROFILE, SIGNAL, TRACE_OBJS
+		 * 	AUDIT_ARGS, BINDING, CONFGEN, LOADFLTR, PROFILE,
+		 *	SIGNAL, TRACE_OBJS
 		 */
-		if (variable == ENV_FLG_AUDIT_ARGS) {
+		switch (variable) {
+		case ENV_FLG_AUDIT_ARGS:
 			if (s2) {
 				audit_argcnt = atoi(s2);
 				audit_argcnt += audit_argcnt % 2;
 			} else
 				audit_argcnt = 0;
-		} else if (variable == ENV_FLG_BINDINGS) {
+			break;
+		case ENV_FLG_BINDINGS:
 			if (s2)
 				rpl_debug = MSG_ORIG(MSG_TKN_BINDINGS);
 			else
 				rpl_debug = NULL;
-		} else if (variable == ENV_FLG_CONFGEN) {
+			break;
+		case ENV_FLG_CONFGEN:
 			if (s2) {
 				rtld_flags |= RT_FL_CONFGEN;
 				*lmflags |= LML_FLG_IGNRELERR;
@@ -2001,7 +1996,8 @@
 				rtld_flags &= ~RT_FL_CONFGEN;
 				*lmflags &= ~LML_FLG_IGNRELERR;
 			}
-		} else if (variable == ENV_FLG_LOADFLTR) {
+			break;
+		case ENV_FLG_LOADFLTR:
 			if (s2) {
 				*lmtflags |= LML_TFLG_LOADFLTR;
 				if (*s2 == '2')
@@ -2010,7 +2006,8 @@
 				*lmtflags &= ~LML_TFLG_LOADFLTR;
 				rtld_flags &= ~RT_FL_WARNFLTR;
 			}
-		} else if (variable == ENV_FLG_PROFILE) {
+			break;
+		case ENV_FLG_PROFILE:
 			profile_name = s2;
 			if (s2) {
 				if (strcmp(s2, MSG_ORIG(MSG_FIL_RTLD)) == 0) {
@@ -2035,9 +2032,11 @@
 				/* END CSTYLED */
 			} else
 				profile_lib = NULL;
-		} else if (variable == ENV_FLG_SIGNAL) {
+			break;
+		case ENV_FLG_SIGNAL:
 			killsig = s2 ? atoi(s2) : SIGKILL;
-		} else if (variable == ENV_FLG_TRACE_OBJS) {
+			break;
+		case ENV_FLG_TRACE_OBJS:
 			if (s2) {
 				*lmflags |= LML_FLG_TRC_ENABLE;
 				if (*s2 == '2')
@@ -2045,6 +2044,7 @@
 			} else
 				*lmflags &=
 				    ~(LML_FLG_TRC_ENABLE | LML_FLG_TRC_LDDSTUB);
+			break;
 		}
 	}
 }
--- a/usr/src/cmd/sgs/rtld/sparcv9/Makefile	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/cmd/sgs/rtld/sparcv9/Makefile	Wed Oct 14 08:12:49 2009 -0700
@@ -102,7 +102,7 @@
 adbinstall:	adbmacros .WAIT $(ROOTADB64)
 
 pics/%.o:	../sparc/%.c
-		$(COMPILE.c) -o $@ $< $(WARNFLAGS)
+		$(COMPILE.c) -o $@ $<
 		$(POST_PROCESS_O)
 
 include		$(SRC)/cmd/sgs/rtld/Makefile.targ
--- a/usr/src/uts/common/sys/link.h	Wed Oct 14 11:25:23 2009 +0100
+++ b/usr/src/uts/common/sys/link.h	Wed Oct 14 08:12:49 2009 -0700
@@ -269,7 +269,7 @@
 #define	DF_1_NOOPEN	0x00000040	/* set RTLD_NOOPEN for this object */
 #define	DF_1_ORIGIN	0x00000080	/* ORIGIN processing required */
 #define	DF_1_DIRECT	0x00000100	/* direct binding enabled */
-#define	DF_1_TRANS	0x00000200
+#define	DF_1_TRANS	0x00000200	/* unused historical name */
 #define	DF_1_INTERPOSE	0x00000400	/* object is an interposer */
 #define	DF_1_NODEFLIB	0x00000800	/* ignore default library search path */
 #define	DF_1_NODUMP	0x00001000	/* object can't be dldump(3x)'ed */