summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs
diff options
context:
space:
mode:
authorAli Bahrami <Ali.Bahrami@Sun.COM>2009-12-02 15:37:55 -0700
committerAli Bahrami <Ali.Bahrami@Sun.COM>2009-12-02 15:37:55 -0700
commite64d0ff97a1fb57a6e93e6d31ea549511c90b318 (patch)
tree46899349d1219ce9756682d602f488882028fc34 /usr/src/cmd/sgs
parent83e866b93a359a0c6f6255b3cdff18f21a1d0d89 (diff)
downloadillumos-gate-e64d0ff97a1fb57a6e93e6d31ea549511c90b318.tar.gz
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
Diffstat (limited to 'usr/src/cmd/sgs')
-rw-r--r--usr/src/cmd/sgs/elfdump/common/elfdump.c33
-rw-r--r--usr/src/cmd/sgs/include/debug.h2
-rw-r--r--usr/src/cmd/sgs/include/libld.h2
-rw-r--r--usr/src/cmd/sgs/libld/common/_libld.h14
-rw-r--r--usr/src/cmd/sgs/libld/common/groups.c33
-rw-r--r--usr/src/cmd/sgs/libld/common/place.c32
-rw-r--r--usr/src/cmd/sgs/libld/common/sections.c154
-rw-r--r--usr/src/cmd/sgs/libld/common/syms.c42
-rw-r--r--usr/src/cmd/sgs/libld/common/update.c8
-rw-r--r--usr/src/cmd/sgs/libld/common/util.c6
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/debug.c30
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/llib-llddbg4
-rw-r--r--usr/src/cmd/sgs/liblddbg/common/sections.c2
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README17
14 files changed, 250 insertions, 129 deletions
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c
index a21d6a4b0a..68dca2a3bf 100644
--- a/usr/src/cmd/sgs/elfdump/common/elfdump.c
+++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c
@@ -3514,12 +3514,13 @@ group(Cache *cache, Word shnum, const char *file, uint_t flags)
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 @@ group(Cache *cache, Word shnum, const char *file, uint_t flags)
(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];
diff --git a/usr/src/cmd/sgs/include/debug.h b/usr/src/cmd/sgs/include/debug.h
index 3ac6d4da05..10a04df12a 100644
--- a/usr/src/cmd/sgs/include/debug.h
+++ b/usr/src/cmd/sgs/include/debug.h
@@ -831,7 +831,7 @@ extern void Dbg_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
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);
diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h
index bff983373a..e32d893ad6 100644
--- a/usr/src/cmd/sgs/include/libld.h
+++ b/usr/src/cmd/sgs/include/libld.h
@@ -368,6 +368,8 @@ struct ofl_desc {
#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
diff --git a/usr/src/cmd/sgs/libld/common/_libld.h b/usr/src/cmd/sgs/libld/common/_libld.h
index 90cb028cce..835eb28b61 100644
--- a/usr/src/cmd/sgs/libld/common/_libld.h
+++ b/usr/src/cmd/sgs/libld/common/_libld.h
@@ -511,12 +511,24 @@ typedef enum {
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;
diff --git a/usr/src/cmd/sgs/libld/common/groups.c b/usr/src/cmd/sgs/libld/common/groups.c
index df4dac641b..6d78c0f751 100644
--- a/usr/src/cmd/sgs/libld/common/groups.c
+++ b/usr/src/cmd/sgs/libld/common/groups.c
@@ -57,8 +57,14 @@ gpavl_loaded(Ofl_desc *ofl, Group_desc *gdp)
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 @@ gpavl_loaded(Ofl_desc *ofl, Group_desc *gdp)
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 @@ ld_group_process(Is_desc *gisc, Ofl_desc *ofl)
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 @@ ld_group_process(Is_desc *gisc, Ofl_desc *ofl)
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 @@ ld_group_process(Is_desc *gisc, Ofl_desc *ofl)
/*
* 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 */
diff --git a/usr/src/cmd/sgs/libld/common/place.c b/usr/src/cmd/sgs/libld/common/place.c
index 5905321674..b59f3deef2 100644
--- a/usr/src/cmd/sgs/libld/common/place.c
+++ b/usr/src/cmd/sgs/libld/common/place.c
@@ -249,8 +249,12 @@ add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
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 @@ add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
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 @@ ld_place_section(Ofl_desc *ofl, Is_desc *isp, int ident,
/*
* 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 @@ ld_place_section(Ofl_desc *ofl, Is_desc *isp, int ident,
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 @@ ld_place_section(Ofl_desc *ofl, Is_desc *isp, int ident,
/*
* 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);
diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c
index 11135444fc..5518e14502 100644
--- a/usr/src/cmd/sgs/libld/common/sections.c
+++ b/usr/src/cmd/sgs/libld/common/sections.c
@@ -162,6 +162,89 @@ ignore_sym(Ofl_desc *ofl, Ifl_desc *ifl, Sym_desc *sdp, int allow_ldynsym)
}
/*
+ * 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 @@ ignore_section_processing(Ofl_desc *ofl)
}
/*
- * 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 @@ ld_make_sections(Ofl_desc *ofl)
}
/*
+ * 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
diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c
index d7d36cb84b..938fa2a008 100644
--- a/usr/src/cmd/sgs/libld/common/syms.c
+++ b/usr/src/cmd/sgs/libld/common/syms.c
@@ -1091,9 +1091,11 @@ ld_sym_validate(Ofl_desc *ofl)
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 @@ ld_sym_validate(Ofl_desc *ofl)
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 @@ ld_sym_validate(Ofl_desc *ofl)
(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 @@ ld_sym_validate(Ofl_desc *ofl)
*/
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 @@ ld_sym_validate(Ofl_desc *ofl)
/*
* 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);
diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c
index a0b1fe0271..2c5cd62965 100644
--- a/usr/src/cmd/sgs/libld/common/update.c
+++ b/usr/src/cmd/sgs/libld/common/update.c
@@ -236,7 +236,7 @@ update_osym(Ofl_desc *ofl)
* 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 @@ update_osym(Ofl_desc *ofl)
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
diff --git a/usr/src/cmd/sgs/libld/common/util.c b/usr/src/cmd/sgs/libld/common/util.c
index c8529112a9..8c2b47ef16 100644
--- a/usr/src/cmd/sgs/libld/common/util.c
+++ b/usr/src/cmd/sgs/libld/common/util.c
@@ -656,7 +656,7 @@ ld_getopt(Lm_list *lml, int ndx, int argc, char **argv)
}
/*
- * 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 @@ isdavl_compare(const void *n1, const void *n2)
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)
diff --git a/usr/src/cmd/sgs/liblddbg/common/debug.c b/usr/src/cmd/sgs/liblddbg/common/debug.c
index 363c2ef8f2..372a79a26a 100644
--- a/usr/src/cmd/sgs/liblddbg/common/debug.c
+++ b/usr/src/cmd/sgs/liblddbg/common/debug.c
@@ -57,19 +57,19 @@ static DBG_options _Dbg_options[] = { /* Options accepted by both linkers */
{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 @@ static DBG_options _Dbg_options_ld[] = { /* ld only options */
{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},
};
/*
diff --git a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
index 3768c7c72d..266039b4de 100644
--- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
+++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg
@@ -301,8 +301,8 @@ void Dbg32_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
void Dbg64_sec_discarded(Lm_list *, Is_desc *, Is_desc *);
void Dbg32_sec_group(Lm_list *, Is_desc *, Group_desc *);
void Dbg64_sec_group(Lm_list *, Is_desc *, Group_desc *);
-void Dbg32_sec_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);
diff --git a/usr/src/cmd/sgs/liblddbg/common/sections.c b/usr/src/cmd/sgs/liblddbg/common/sections.c
index 3552e5e5e8..2d802682e0 100644
--- a/usr/src/cmd/sgs/liblddbg/common/sections.c
+++ b/usr/src/cmd/sgs/liblddbg/common/sections.c
@@ -469,7 +469,7 @@ Dbg_sec_redirected(Lm_list *lml, Is_desc *isp, const char *nname)
}
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;
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index 8429a39253..bdc960c04a 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1383,7 +1383,7 @@ Bugid Risk Synopsis
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 @@ Bugid Risk Synopsis
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 @@ Bugid Risk Synopsis
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