changeset 11227:cd2ac59c39f2

6900241 ld should track SHT_GROUP sections by symbol name, not section name 6901773 Special handling of STT_SECTION group signature symbol for GNU objects 6901895 Failing asserts in ld update_osym() trying to build gcc 4.5 develpment head 6875758 Remove temporary workaround to ctfmerge from 6866605
author Ali Bahrami <Ali.Bahrami@Sun.COM>
date Wed, 02 Dec 2009 15:37:55 -0700
parents 320a31f24ec3
children c43ac3e928b8
files exception_lists/check_rtime usr/src/cmd/sgs/elfdump/common/elfdump.c usr/src/cmd/sgs/include/debug.h usr/src/cmd/sgs/include/libld.h usr/src/cmd/sgs/libld/common/_libld.h usr/src/cmd/sgs/libld/common/groups.c usr/src/cmd/sgs/libld/common/place.c usr/src/cmd/sgs/libld/common/sections.c usr/src/cmd/sgs/libld/common/syms.c usr/src/cmd/sgs/libld/common/update.c usr/src/cmd/sgs/libld/common/util.c usr/src/cmd/sgs/liblddbg/common/debug.c usr/src/cmd/sgs/liblddbg/common/llib-llddbg usr/src/cmd/sgs/liblddbg/common/sections.c usr/src/cmd/sgs/packages/common/SUNWonld-README usr/src/tools/ctf/cvt/Makefile.targ usr/src/tools/ctf/cvt/mapfile-vers
diffstat 17 files changed, 254 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/exception_lists/check_rtime	Wed Dec 02 10:57:52 2009 -0800
+++ b/exception_lists/check_rtime	Wed Dec 02 15:37:55 2009 -0700
@@ -1,4 +1,3 @@
-
 #
 # CDDL HEADER START
 #
@@ -108,9 +107,10 @@
 UNUSED_RPATH	/usr/platform/.*\ from\ .*/usr/lib/picl
 
 # Unused runpaths in non-OSNET objects we can't change
-UNUSED_RPATH	/usr/lib/mps/secv1.*\ from\ .*libnss3\.so
 UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libnss3\.so
-UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libnssutil3.so
+UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libnssutil3\.so
+UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libsmime3\.so
+UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libssl3\.so
 UNUSED_RPATH	/usr/sfw/lib.*\ from\ .*libdbus-1\.so\.3
 UNUSED_RPATH	/usr/sfw/lib.*\ from\ .*libdbus-glib-1\.so\.2
 UNUSED_RPATH	/usr/sfw/lib.*\ from\ .*libglib-2\.0\.so\.0
@@ -127,8 +127,6 @@
 UNUSED_RPATH	/usr/sfw/lib.*\ from\ .*libgcc_s\.so\.1
 UNUSED_RPATH	/usr/postgres/8.3/lib.*\ from\ .*libpq\.so\.5
 UNUSED_RPATH	/usr/sfw/lib.*\ from\ .*libpq\.so\.5
-UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libsmime3\.so
-UNUSED_RPATH	/usr/lib/mps.*\ from\ .*libssl3\.so
 
 # Unused runpaths for reasons not captured above
 UNUSED_RPATH	/usr/lib/smbsrv.*\ from\ .*libsmb\.so\.1 	# future needs
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c	Wed Dec 02 15:37:55 2009 -0700
@@ -3514,12 +3514,13 @@
 	Word	scnt;
 
 	for (scnt = 1; scnt < shnum; scnt++) {
-		Cache	*_cache = &cache[scnt];
-		Shdr	*shdr = _cache->c_shdr;
-		Word	*grpdata, gcnt, grpcnt, symnum, unknown;
-		Cache	*symsec, *strsec;
-		Sym	*syms, *sym;
-		char	flgstrbuf[MSG_GRP_COMDAT_SIZE + 10];
+		Cache		*_cache = &cache[scnt];
+		Shdr		*shdr = _cache->c_shdr;
+		Word		*grpdata, gcnt, grpcnt, symnum, unknown;
+		Cache		*symsec, *strsec;
+		Sym		*syms, *sym;
+		char		flgstrbuf[MSG_GRP_COMDAT_SIZE + 10];
+		const char	*grpnam;
 
 		if (shdr->sh_type != SHT_GROUP)
 			continue;
@@ -3568,9 +3569,25 @@
 		(void) strcat(flgstrbuf, MSG_ORIG(MSG_STR_CSQBRKT));
 		sym = (Sym *)(syms + shdr->sh_info);
 
+		/*
+		 * The GNU assembler can use section symbols as the signature
+		 * symbol as described by this comment in the gold linker
+		 * (found via google):
+		 *
+		 *	It seems that some versions of gas will create a
+		 *	section group associated with a section symbol, and
+		 *	then fail to give a name to the section symbol.  In
+		 *	such a case, use the name of the section.
+		 *
+		 * In order to support such objects, we do the same.
+		 */
+		grpnam = string(_cache, 0, strsec, file, sym->st_name);
+		if (((sym->st_name == 0) || (*grpnam == '\0')) &&
+		    (ELF_ST_TYPE(sym->st_info) == STT_SECTION))
+			grpnam = cache[sym->st_shndx].c_name;
+
 		dbg_print(0, MSG_INTL(MSG_GRP_SIGNATURE), flgstrbuf,
-		    demangle(string(_cache, 0, strsec, file, sym->st_name),
-		    flags));
+		    demangle(grpnam, flags));
 
 		for (gcnt = 1; gcnt < grpcnt; gcnt++) {
 			char		index[MAXNDXSIZE];
--- a/usr/src/cmd/sgs/include/debug.h	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/include/debug.h	Wed Dec 02 15:37:55 2009 -0700
@@ -831,7 +831,7 @@
 extern	void	Dbg_sec_genstr_compress(Lm_list *, const char *,
 		    Xword, Xword);
 extern	void	Dbg_sec_group(Lm_list *, Is_desc *, Group_desc *);
-extern	void	Dbg_sec_gnu_comdat(Lm_list *, Is_desc *, uint_t, uint_t);
+extern	void	Dbg_sec_gnu_comdat(Lm_list *, Is_desc *, Boolean, Boolean);
 extern	void	Dbg_sec_in(Lm_list *, Is_desc *);
 extern	void	Dbg_sec_order_error(Lm_list *, Ifl_desc *, Word, int);
 extern	void	Dbg_sec_order_list(Ofl_desc *, int);
--- a/usr/src/cmd/sgs/include/libld.h	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/include/libld.h	Wed Dec 02 15:37:55 2009 -0700
@@ -368,6 +368,8 @@
 #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_ADJOSCNT	0x020000000000	/* ajust ofl_shdrcnt to accommodate */
+					/*	discarded sections */
 
 /*
  * In the flags1 arena, establish any options that are applicable to archive
--- a/usr/src/cmd/sgs/libld/common/_libld.h	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/_libld.h	Wed Dec 02 15:37:55 2009 -0700
@@ -511,12 +511,24 @@
 	ld_swap_reloc_data(_ofl, _rel))
 
 /*
- * Define an AVL node for maintaining input section descriptors.  AVL trees of
+ * Define an AVL node for maintaining input section descriptors. AVL trees of
  * these descriptors are used to process group and COMDAT section.
+ *
+ * Pure COMDAT uses the input section name as the search key, while
+ * SHT_GROUP sections use the name of a special signature symbol. We
+ * support both by using the isd_name field to carry the name. An alternative
+ * design would be to use a separate type for each use, saving the cost
+ * of the unneeded pointer for pure COMDAT. We favor a single implementation
+ * because we believe that SHT_GROUP comdat will be more common going forward,
+ * particularly in the largest objects produced by C++ where SHT_GROUP is
+ * needed to manage the complex section relationships. In contrast, we think
+ * that pure COMDAT is both more rare, and used in smaller objects where the
+ * cost of an extra pointer per node is relatively unimportant.
  */
 typedef struct {
 	avl_node_t	isd_avl;	/* avl book-keeping (see SGSOFFSETOF) */
 	Is_desc		*isd_isp;	/* input section descriptor */
+	const char	*isd_name;	/* name used as search key */
 	uint_t		isd_hash;	/* input section name hash value */
 } Isd_node;
 
--- a/usr/src/cmd/sgs/libld/common/groups.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/groups.c	Wed Dec 02 15:37:55 2009 -0700
@@ -57,8 +57,14 @@
 		ofl->ofl_groups = avlt;
 	}
 
-	isd.isd_hash = sgs_str_hash(gdp->gd_isc->is_name);
-	isd.isd_isp = gdp->gd_isc;
+	/*
+	 * An SHT_GROUP section is identified by the name of its signature
+	 * symbol rather than section name. Although the section names are
+	 * often unique, this is not required, and some compilers set it to
+	 * a generic name like ".group".
+	 */
+	isd.isd_name = gdp->gd_name;
+	isd.isd_hash = sgs_str_hash(isd.isd_name);
 
 	if ((isdp = avl_find(avlt, &isd, &where)) != NULL) {
 		gdp->gd_oisc = isdp->isd_isp;
@@ -71,8 +77,9 @@
 	if ((isdp = libld_calloc(sizeof (Isd_node), 1)) == NULL)
 		return (S_ERROR);
 
+	isdp->isd_name = isd.isd_name;
 	isdp->isd_hash = isd.isd_hash;
-	isdp->isd_isp = isd.isd_isp;
+	isdp->isd_isp = gdp->gd_isc;
 
 	avl_insert(avlt, isdp, where);
 	return (0);
@@ -123,6 +130,7 @@
 	const char	*str;
 	Group_desc	gd;
 	size_t		ndx;
+	int		gnu_stt_section;
 
 	/*
 	 * Confirm that the sh_link points to a valid section.
@@ -171,6 +179,23 @@
 	str += sym->st_name;
 
 	/*
+	 * The GNU assembler can use section symbols as the signature symbol
+	 * as described by this comment in the gold linker (found via google):
+	 *
+	 *	It seems that some versions of gas will create a section group
+	 *	associated with a section symbol, and then fail to give a name
+	 *	to the section symbol.  In such a case, use the name of the
+	 *	section.
+	 *
+	 * In order to support such objects, we do the same.
+	 */
+	gnu_stt_section = ((sym->st_name == 0) || (*str == '\0')) &&
+	    (ELF_ST_TYPE(sym->st_info) == STT_SECTION);
+	if (gnu_stt_section)
+		str = gisc->is_name;
+
+
+	/*
 	 * Generate a group descriptor.
 	 */
 	gd.gd_isc = gisc;
@@ -182,7 +207,7 @@
 	/*
 	 * If this group is a COMDAT group, validate the signature symbol.
 	 */
-	if ((gd.gd_data[0] & GRP_COMDAT) &&
+	if ((gd.gd_data[0] & GRP_COMDAT) && !gnu_stt_section &&
 	    ((ELF_ST_BIND(sym->st_info) == STB_LOCAL) ||
 	    (sym->st_shndx == SHN_UNDEF))) {
 		/* If section symbol, construct a printable name for it */
--- a/usr/src/cmd/sgs/libld/common/place.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/place.c	Wed Dec 02 15:37:55 2009 -0700
@@ -249,8 +249,12 @@
 		    SGSOFFSETOF(Isd_node, isd_avl));
 		osp->os_comdats = avlt;
 	}
-	isd.isd_hash = sgs_str_hash(isp->is_name);
-	isd.isd_isp = isp;
+
+	/*
+	 * A standard COMDAT section uses the section name as search key.
+	 */
+	isd.isd_name = isp->is_name;
+	isd.isd_hash = sgs_str_hash(isd.isd_name);
 
 	if ((isdp = avl_find(avlt, &isd, &where)) != NULL) {
 		isp->is_osdesc = osp;
@@ -283,6 +287,7 @@
 	if ((isdp = libld_calloc(sizeof (Isd_node), 1)) == NULL)
 		return (S_ERROR);
 
+	isdp->isd_name = isd.isd_name;
 	isdp->isd_hash = isd.isd_hash;
 	isdp->isd_isp = isp;
 
@@ -643,14 +648,14 @@
 
 		/*
 		 * Explicitly identify this section type as COMDAT.  Also,
-		 * enable lazy relocation processing, as this is typically a
-		 * requirement with .gnu.linkonce sections.
+		 * enable relaxed relocation processing, as this is typically
+		 * a requirement with .gnu.linkonce sections.
 		 */
 		isp->is_flags |= FLG_IS_COMDAT;
 		if ((ofl->ofl_flags1 & FLG_OF1_NRLXREL) == 0)
 			ofl->ofl_flags1 |= FLG_OF1_RLXREL;
-		Dbg_sec_gnu_comdat(ofl->ofl_lml, isp, 1,
-		    (ofl->ofl_flags1 & FLG_OF1_RLXREL));
+		Dbg_sec_gnu_comdat(ofl->ofl_lml, isp, TRUE,
+		    (ofl->ofl_flags1 & FLG_OF1_RLXREL) != 0);
 	}
 
 	/*
@@ -675,13 +680,12 @@
 		DBG_CALL(Dbg_sec_redirected(ofl->ofl_lml, isp, oname));
 
 		/*
-		 * Enable lazy relocation processing, as this is typically a
-		 * requirement with GNU COMDAT sections.
+		 * Enable relaxed relocation processing, as this is
+		 * typically a requirement with GNU COMDAT sections.
 		 */
 		if ((ofl->ofl_flags1 & FLG_OF1_NRLXREL) == 0) {
 			ofl->ofl_flags1 |= FLG_OF1_RLXREL;
-			Dbg_sec_gnu_comdat(ofl->ofl_lml, isp, 0,
-			    (ofl->ofl_flags1 & FLG_OF1_RLXREL));
+			Dbg_sec_gnu_comdat(ofl->ofl_lml, isp, FALSE, TRUE);
 		}
 	}
 
@@ -838,7 +842,15 @@
 	/*
 	 * We are adding a new output section.  Update the section header
 	 * count and associated string size.
+	 *
+	 * If the input section triggering this output section has been marked
+	 * for discard, and if no other non-discarded input section comes along
+	 * to join it, then we will over count. We cannot know if this will
+	 * happen or not until all input is seen. Set FLG_OF_AJDOSCNT to
+	 * trigger a final count readjustment.
 	 */
+	if (isp->is_flags & FLG_IS_DISCARD)
+		ofl->ofl_flags |= FLG_OF_ADJOSCNT;
 	ofl->ofl_shdrcnt++;
 	if (st_insert(ofl->ofl_shdrsttab, oname) == -1)
 		return ((Os_desc *)S_ERROR);
--- a/usr/src/cmd/sgs/libld/common/sections.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/sections.c	Wed Dec 02 15:37:55 2009 -0700
@@ -162,6 +162,89 @@
 }
 
 /*
+ * There are situations where we may count output sections (ofl_shdrcnt)
+ * that are subsequently eliminated from the output object. Whether or
+ * not this happens cannot be known until all input has been seen and
+ * section elimination code has run. However, the situations where this
+ * outcome is possible are known, and are flagged by setting FLG_OF_ADJOSCNT.
+ *
+ * If FLG_OF_ADJOSCNT is set, this routine makes a pass over the output
+ * sections. If an unused output section is encountered, we decrement
+ * ofl->ofl_shdrcnt and remove the section name from the .shstrtab string
+ * table (ofl->ofl_shdrsttab).
+ *
+ * This code must be kept in sync with the similar code
+ * found in outfile.c:ld_create_outfile().
+ */
+static void
+adjust_os_count(Ofl_desc *ofl)
+{
+	Sg_desc		*sgp;
+	Is_desc		*isp;
+	Os_desc		*osp;
+	Ifl_desc	*ifl;
+	Aliste		idx1;
+
+	if ((ofl->ofl_flags & FLG_OF_ADJOSCNT) == 0)
+		return;
+
+	/*
+	 * For each output section, look at the input sections to find at least
+	 * one input section that has not been eliminated. If none are found,
+	 * the -z ignore processing above has eliminated that output section.
+	 */
+	for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
+		Aliste	idx2;
+		Word	ptype = sgp->sg_phdr.p_type;
+
+		for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp)) {
+			Aliste	idx3;
+			int	keep = 0, os_isdescs_idx;
+
+			OS_ISDESCS_TRAVERSE(os_isdescs_idx, osp, idx3, isp) {
+				ifl = isp->is_file;
+
+				/* Input section is tagged for discard? */
+				if (isp->is_flags & FLG_IS_DISCARD)
+					continue;
+
+				/*
+				 * If the file is discarded, it will take
+				 * the section with it.
+				 */
+				if (ifl &&
+				    (((ifl->ifl_flags & FLG_IF_FILEREF) == 0) ||
+				    ((ptype == PT_LOAD) &&
+				    ((isp->is_flags & FLG_IS_SECTREF) == 0) &&
+				    (isp->is_shdr->sh_size > 0))) &&
+				    (ifl->ifl_flags & FLG_IF_IGNORE))
+					continue;
+
+				/*
+				 * We have found a kept input section,
+				 * so the output section will be created.
+				 */
+				keep = 1;
+				break;
+			}
+			/*
+			 * If no section of this name was kept, decrement
+			 * the count and remove the name from .shstrtab.
+			 */
+			if (keep == 0) {
+				/* LINTED - only used for assert() */
+				int err;
+
+				ofl->ofl_shdrcnt--;
+				err = st_delstring(ofl->ofl_shdrsttab,
+				    osp->os_name);
+				assert(err != -1);
+			}
+		}
+	}
+}
+
+/*
  * If -zignore has been in effect, scan all input files to determine if the
  * file, or sections from the file, have been referenced.  If not, the file or
  * some of the files sections can be discarded. If sections are to be
@@ -305,67 +388,10 @@
 	}
 
 	/*
-	 * The number of output sections may have decreased. We must make a
-	 * pass over the output sections, and if we detect this situation,
-	 * decrement ofl->ofl_shdrcnt and remove the section name from the
-	 * .shstrtab string table (ofl->ofl_shdrsttab).
-	 *
-	 * This code must be kept in sync with the similar code
-	 * found in outfile.c:ld_create_outfile().
-	 *
-	 * For each output section, look at the input sections to find at least
-	 * one input section that has not been eliminated. If none are found,
-	 * the -z ignore processing above has eliminated that output section.
+	 * As a result of our work here, the number of output sections may
+	 * have decreased. Trigger a call to adjust_os_count().
 	 */
-	for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
-		Aliste	idx2;
-		Word	ptype = sgp->sg_phdr.p_type;
-
-		for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp)) {
-			Aliste	idx3;
-			int	keep = 0, os_isdescs_idx;
-
-			OS_ISDESCS_TRAVERSE(os_isdescs_idx, osp, idx3, isp) {
-				ifl = isp->is_file;
-
-				/* Input section is tagged for discard? */
-				if (isp->is_flags & FLG_IS_DISCARD)
-					continue;
-
-				/*
-				 * If the file is discarded, it will take
-				 * the section with it.
-				 */
-				if (ifl &&
-				    (((ifl->ifl_flags & FLG_IF_FILEREF) == 0) ||
-				    ((ptype == PT_LOAD) &&
-				    ((isp->is_flags & FLG_IS_SECTREF) == 0) &&
-				    (isp->is_shdr->sh_size > 0))) &&
-				    (ifl->ifl_flags & FLG_IF_IGNORE))
-					continue;
-
-				/*
-				 * We have found a kept input section,
-				 * so the output section will be created.
-				 */
-				keep = 1;
-				break;
-			}
-			/*
-			 * If no section of this name was kept, decrement
-			 * the count and remove the name from .shstrtab.
-			 */
-			if (keep == 0) {
-				/* LINTED - only used for assert() */
-				int err;
-
-				ofl->ofl_shdrcnt--;
-				err = st_delstring(ofl->ofl_shdrsttab,
-				    osp->os_name);
-				assert(err != -1);
-			}
-		}
-	}
+	ofl->ofl_flags |= FLG_OF_ADJOSCNT;
 
 	return (1);
 }
@@ -2662,6 +2688,14 @@
 	}
 
 	/*
+	 * If we have detected a situation in which previously placed
+	 * output sections may have been discarded, perform the necessary
+	 * readjustment.
+	 */
+	if (ofl->ofl_flags & FLG_OF_ADJOSCNT)
+		adjust_os_count(ofl);
+
+	/*
 	 * Do any of the output sections contain input sections that
 	 * are candidates for string table merging? For each such case,
 	 * we create a replacement section, insert it, and discard the
--- a/usr/src/cmd/sgs/libld/common/syms.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/syms.c	Wed Dec 02 15:37:55 2009 -0700
@@ -1091,9 +1091,11 @@
 	ofl_flag_t	oflags = ofl->ofl_flags;
 	ofl_flag_t	undef = 0, needed = 0, verdesc = 0;
 	Xword		bssalign = 0, tlsalign = 0;
+	Boolean		need_bss, need_tlsbss;
 	Xword		bsssize = 0, tlssize = 0;
 #if	defined(_ELF64)
 	Xword		lbssalign = 0, lbsssize = 0;
+	Boolean		need_lbss;
 #endif
 	int		ret;
 	int		allow_ldynsym;
@@ -1102,6 +1104,19 @@
 	DBG_CALL(Dbg_basic_validate(ofl->ofl_lml));
 
 	/*
+	 * The need_XXX booleans are used to determine whether we need to
+	 * create each type of bss section. We used to create these sections
+	 * if the sum of the required sizes for each type were non-zero.
+	 * However, it is possible for a compiler to generate COMMON variables
+	 * of zero-length and this tricks that logic --- even zero-length
+	 * symbols need an output section.
+	 */
+	need_bss = need_tlsbss = FALSE;
+#if	defined(_ELF64)
+	need_lbss = FALSE;
+#endif
+
+	/*
 	 * If a symbol is undefined and this link-edit calls for no undefined
 	 * symbols to remain (this is the default case when generating an
 	 * executable but can be enforced for any object using -z defs), the
@@ -1431,19 +1446,19 @@
 		    (oflags & FLG_OF_PROCRED)))) {
 			if ((sdp->sd_move == NULL) ||
 			    ((sdp->sd_flags & FLG_SY_PAREXPN) == 0)) {
-				Xword * size, * align;
-
 				if (type != STT_TLS) {
-					size = &bsssize;
-					align = &bssalign;
+					need_bss = TRUE;
+					bsssize = (Xword)S_ROUND(bsssize,
+					    sym->st_value) + sym->st_size;
+					if (sym->st_value > bssalign)
+						bssalign = sym->st_value;
 				} else {
-					size = &tlssize;
-					align = &tlsalign;
+					need_tlsbss = TRUE;
+					tlssize = (Xword)S_ROUND(tlssize,
+					    sym->st_value) + sym->st_size;
+					if (sym->st_value > tlsalign)
+						tlsalign = sym->st_value;
 				}
-				*size = (Xword)S_ROUND(*size, sym->st_value) +
-				    sym->st_size;
-				if (sym->st_value > *align)
-					*align = sym->st_value;
 			}
 		}
 
@@ -1455,6 +1470,7 @@
 		 */
 		if ((ld_targ.t_m.m_mach == EM_AMD64) &&
 		    (sym->st_shndx == SHN_X86_64_LCOMMON)) {
+			need_lbss = TRUE;
 			lbsssize = (Xword)S_ROUND(lbsssize, sym->st_value) +
 			    sym->st_size;
 			if (sym->st_value > lbssalign)
@@ -1587,19 +1603,19 @@
 	/*
 	 * Generate the .bss section now that we know its size and alignment.
 	 */
-	if (bsssize) {
+	if (need_bss) {
 		if (ld_make_bss(ofl, bsssize, bssalign,
 		    ld_targ.t_id.id_bss) == S_ERROR)
 			return (S_ERROR);
 	}
-	if (tlssize) {
+	if (need_tlsbss) {
 		if (ld_make_bss(ofl, tlssize, tlsalign,
 		    ld_targ.t_id.id_tlsbss) == S_ERROR)
 			return (S_ERROR);
 	}
 #if	defined(_ELF64)
 	if ((ld_targ.t_m.m_mach == EM_AMD64) &&
-	    lbsssize && !(oflags & FLG_OF_RELOBJ)) {
+	    need_lbss && !(oflags & FLG_OF_RELOBJ)) {
 		if (ld_make_bss(ofl, lbsssize, lbssalign,
 		    ld_targ.t_id.id_lbss) == S_ERROR)
 			return (S_ERROR);
--- a/usr/src/cmd/sgs/libld/common/update.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/update.c	Wed Dec 02 15:37:55 2009 -0700
@@ -236,7 +236,7 @@
 	 * Initialize pointers to the symbol table entries and the symbol
 	 * table strings.  Skip the first symbol entry and the first string
 	 * table byte.  Note that if we are not generating any output symbol
-	 * tables we must still generate and update an internal copies so
+	 * tables we must still generate and update internal copies so
 	 * that the relocation phase has the correct information.
 	 */
 	if (!(flags & FLG_OF_STRIP) || (flags & FLG_OF_RELOBJ) ||
@@ -1827,11 +1827,9 @@
 		shdr->sh_info = symtab_gbl_bndx;
 		/* LINTED */
 		shdr->sh_link = (Word)elf_ndxscn(ofl->ofl_osstrtab->os_scn);
-		if (symshndx) {
-			shdr = ofl->ofl_ossymshndx->os_shdr;
-			shdr->sh_link =
+		if (symshndx)
+			ofl->ofl_ossymshndx->os_shdr->sh_link =
 			    (Word)elf_ndxscn(ofl->ofl_ossymtab->os_scn);
-		}
 
 		/*
 		 * Ensure that the expected number of symbols
--- a/usr/src/cmd/sgs/libld/common/util.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/libld/common/util.c	Wed Dec 02 15:37:55 2009 -0700
@@ -656,7 +656,7 @@
 }
 
 /*
- * A compare routine for Isd_node AVLT trees.
+ * A compare routine for Isd_node AVL trees.
  */
 int
 isdavl_compare(const void *n1, const void *n2)
@@ -673,8 +673,8 @@
 	if (hash1 < hash2)
 		return (-1);
 
-	st1 = ((Isd_node *)n1)->isd_isp->is_name;
-	st2 = ((Isd_node *)n2)->isd_isp->is_name;
+	st1 = ((Isd_node *)n1)->isd_name;
+	st2 = ((Isd_node *)n2)->isd_name;
 
 	rc = strcmp(st1, st2);
 	if (rc > 0)
--- a/usr/src/cmd/sgs/liblddbg/common/debug.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/debug.c	Wed Dec 02 15:37:55 2009 -0700
@@ -57,19 +57,19 @@
 	{MSG_ORIG(MSG_TOK_TTIME),	0,	DBG_E_TTIME},
 	{MSG_ORIG(MSG_TOK_DTIME),	0,	DBG_E_DTIME},
 
-	{MSG_ORIG(MSG_TOK_ALL),		DBG_C_ALL,	0},
-	{MSG_ORIG(MSG_TOK_BASIC),	DBG_C_BASIC,	0},
-	{MSG_ORIG(MSG_TOK_CAP),		DBG_C_CAP,	0},
-	{MSG_ORIG(MSG_TOK_DEMANGLE),	DBG_C_DEMANGLE,	0},
-	{MSG_ORIG(MSG_TOK_FILES),	DBG_C_FILES,	0},
-	{MSG_ORIG(MSG_TOK_LIBS),	DBG_C_LIBS,	0},
-	{MSG_ORIG(MSG_TOK_MOVE),	DBG_C_MOVE,	0},
-	{MSG_ORIG(MSG_TOK_RELOC),	DBG_C_RELOC,	0},
-	{MSG_ORIG(MSG_TOK_SYMBOLS),	DBG_C_SYMBOLS,	0},
-	{MSG_ORIG(MSG_TOK_TLS),		DBG_C_TLS,	0},
-	{MSG_ORIG(MSG_TOK_UNUSED),	DBG_C_UNUSED,	0},
-	{MSG_ORIG(MSG_TOK_VERSIONS),	DBG_C_VERSIONS,	0},
-	{NULL,				NULL},
+	{MSG_ORIG(MSG_TOK_ALL),		DBG_C_ALL & ~DBG_C_DEMANGLE,	0},
+	{MSG_ORIG(MSG_TOK_BASIC),	DBG_C_BASIC,			0},
+	{MSG_ORIG(MSG_TOK_CAP),		DBG_C_CAP,			0},
+	{MSG_ORIG(MSG_TOK_DEMANGLE),	DBG_C_DEMANGLE,			0},
+	{MSG_ORIG(MSG_TOK_FILES),	DBG_C_FILES,			0},
+	{MSG_ORIG(MSG_TOK_LIBS),	DBG_C_LIBS,			0},
+	{MSG_ORIG(MSG_TOK_MOVE),	DBG_C_MOVE,			0},
+	{MSG_ORIG(MSG_TOK_RELOC),	DBG_C_RELOC,			0},
+	{MSG_ORIG(MSG_TOK_SYMBOLS),	DBG_C_SYMBOLS,			0},
+	{MSG_ORIG(MSG_TOK_TLS),		DBG_C_TLS,			0},
+	{MSG_ORIG(MSG_TOK_UNUSED),	DBG_C_UNUSED,			0},
+	{MSG_ORIG(MSG_TOK_VERSIONS),	DBG_C_VERSIONS,			0},
+	{NULL,				0,				0},
 };
 
 static DBG_options _Dbg_options_ld[] = {	/* ld only options */
@@ -86,14 +86,14 @@
 	{MSG_ORIG(MSG_TOK_STATS),	DBG_C_STATS,	0},
 	{MSG_ORIG(MSG_TOK_STRTAB),	DBG_C_STRTAB,	0},
 	{MSG_ORIG(MSG_TOK_SUPPORT),	DBG_C_SUPPORT,	0},
-	{NULL,				NULL},
+	{NULL,				0,		0},
 };
 
 static DBG_options _Dbg_options_rtld[] = {	/* ld.so.1 only options */
 	{MSG_ORIG(MSG_TOK_AUDIT),	DBG_C_AUDITING,	0},
 	{MSG_ORIG(MSG_TOK_BINDINGS),	DBG_C_BINDINGS,	0},
 	{MSG_ORIG(MSG_TOK_INIT),	DBG_C_INIT,	0},
-	{NULL,				NULL},
+	{NULL,				0,		0},
 };
 
 /*
--- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg	Wed Dec 02 15:37:55 2009 -0700
@@ -301,8 +301,8 @@
 void	Dbg64_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
 void	Dbg32_sec_group(Lm_list *, Is_desc *, Group_desc *);
 void	Dbg64_sec_group(Lm_list *, Is_desc *, Group_desc *);
-void	Dbg32_sec_gnu_comdat(Lm_list *, Is_desc *, uint_t, uint_t);
-void	Dbg64_sec_gnu_comdat(Lm_list *, Is_desc *, uint_t, uint_t);
+void	Dbg32_sec_gnu_comdat(Lm_list *, Is_desc *, Boolean, Boolean);
+void	Dbg64_sec_gnu_comdat(Lm_list *, Is_desc *, Boolean, Boolean);
 void	Dbg32_sec_in(Lm_list *, Is_desc *);
 void	Dbg64_sec_in(Lm_list *, Is_desc *);
 void	Dbg32_sec_order_error(Lm_list *, Ifl_desc *, Elf32_Word, int);
--- a/usr/src/cmd/sgs/liblddbg/common/sections.c	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/liblddbg/common/sections.c	Wed Dec 02 15:37:55 2009 -0700
@@ -469,7 +469,7 @@
 }
 
 void
-Dbg_sec_gnu_comdat(Lm_list *lml, Is_desc *isp, uint_t comdat, uint_t relax)
+Dbg_sec_gnu_comdat(Lm_list *lml, Is_desc *isp, Boolean comdat, Boolean relax)
 {
 	dbg_isec_name_buf_t	buf;
 	char			*alloc_mem;
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README	Wed Dec 02 15:37:55 2009 -0700
@@ -1383,7 +1383,7 @@
 6642769 ld(1) -z combreloc should become default behavior (D)
 	PSARC/2008/006 make ld(1) -z combreloc become default behavior
 6634436 XFFLAG should be updated.  (link-editor components only)
-6492726 Merge SHF_MERGE|SHF_STRINGS input sections
+6492726 Merge SHF_MERGE|SHF_STRINGS input sections (D)
 4947191 OSNet should use direct bindings  (link-editor components only)
 6654381 lazy loading fall-back needs optimizing
 6658385 ld core dumps when building Xorg on nv_82
@@ -1502,25 +1502,25 @@
 6821646 xVM dom0 doesn't boot on daily.0324 and beyond
 6822828 librtld_db can return RD_ERR before RD_NOMAPS, which compromises dbx
 	expectations.
-6821619 Solaris linkers need systematic approach to ELF OSABI
+6821619 Solaris linkers need systematic approach to ELF OSABI (D)
 	PSARC/2009/196 ELF objects to set OSABI / elfdump -O option
 6827468 6801536 breaks 'ld -s' if there are weak/strong symbol pairs
 6715578 AOUT (BCP) symbol lookup can be compromised with lazy loading.
 6752883 ld.so.1 error message should be buffered (not sent to stderr).
 6577982 ld.so.1 calls getpid() before it should when any LD_* are set
 6826513 ldd gets confused by a crle(1) LD_PRELOAD setting
-6831285 linker LD_DEBUG support needs improvements
+6831285 linker LD_DEBUG support needs improvements (D)
 6806791 filter builds could be optimized (link-editor components only)
 6823371 calloc() uses suboptimal memset() causing 15% regression in SpecCPU2006
 	gcc code (link-editor components only)
 6831308 ld.so.1: symbol rescanning does a little too much work
 6837777 ld ordered section code uses too much memory and works too hard
 6841199 Undo 10 year old workaround and use 64-bit ld on 32-bit objects
-6784790 ld should examine archives to determine output object class/machine
+6784790 ld should examine archives to determine output object class/machine (D)
 	PSARC/2009/305 ld -32 option
 6849998 remove undocumented mapfile $SPECVERS and $NEED options
 6851224 elf_getshnum() and elf_getshstrndx() incompatible with 2002 ELF gABI
-	agreement
+	agreement (D)
 	PSARC/2009/363 replace elf_getphnum, elf_getshnum, and elf_getshstrndx
 6853809	ld.so.1: rescan fallback optimization is invalid
 6854158	ld.so.1: interposition can be skipped because of incorrect
@@ -1531,8 +1531,13 @@
 6834197 ld pukes when given an empty plate
 6516644 per-symbol filtering shouldn't be allowed in executables
 6878605 ld should accept '%' syntax when matching input SHT_PROGBITS sections
-6850768 ld option to autogenerate wrappers/interposers similar to GNU ld --wrap
+6850768 ld option to autogenerate wrappers/interposers similar to GNU ld
+	--wrap (D)
 	PSARC/2009/493 ld -z wrap option
 6888489 Null environment variables are not overriding crle(1) replaceable
 	environment variables.
 6885456 Need to implement GNU-ld behavior in construction of .init/.fini sections
+6900241 ld should track SHT_GROUP sections by symbol name, not section name
+6901773 Special handling of STT_SECTION group signature symbol for GNU objects
+6901895 Failing asserts in ld update_osym() trying to build gcc 4.5 develpment
+	head
--- a/usr/src/tools/ctf/cvt/Makefile.targ	Wed Dec 02 10:57:52 2009 -0800
+++ b/usr/src/tools/ctf/cvt/Makefile.targ	Wed Dec 02 15:37:55 2009 -0700
@@ -29,11 +29,8 @@
 	$(LINK.c) -o $@ $(CVTOBJS) $(LDLIBS)
 	$(POST_PROCESS)
 
-# Remove this after build snv_126
-CTFMERGE_VERSION=-M../mapfile-vers
-
 ctfmerge: $(MRGOBJS)
-	$(LINK.c) $(CTFMERGE_VERSION) -o $@ $(MRGOBJS) $(LDLIBS)
+	$(LINK.c) -o $@ $(MRGOBJS) $(LDLIBS)
 	$(POST_PROCESS)
 
 %.o: ../%.c
--- a/usr/src/tools/ctf/cvt/mapfile-vers	Wed Dec 02 10:57:52 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING:  STOP NOW.  DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-#	usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-# Work around the versioning fix resulting from
-#
-#	6869478 getpagesizes2 is assigned to wrong ELF version in libc
-#		in s10u8b3
-#
-# integrated into Nevada with
-#
-#	6866605 SUNWonbld ELF analysis tools need overhaul
-#
-# This mapfile can be safely removed after the close of snv_126
-#
-
-libc.so - $ADDVERS=SUNW_1.23;