summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-07-05 19:18:11 +0000
committerUlrich Drepper <drepper@redhat.com>2006-07-05 19:18:11 +0000
commit7df97c777c3c8a688774882a1dd7d1701a127560 (patch)
tree0e6b1e585b153101d4763b7eec797787e49ee2df
parent4ba68f475d305b11e55c83994bad4824dad156d3 (diff)
downloadelfutils-7df97c777c3c8a688774882a1dd7d1701a127560.tar.gz
Correctly recognize discarded COMDATA symbols when constructing the
symbol table.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/i386_ld.c8
-rw-r--r--src/ldgeneric.c8
3 files changed, 12 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c08940c1..b75a7662 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
2006-07-05 Ulrich Drepper <drepper@redhat.com>
+ * ldgeneric.c (ld_generic_create_outfile): Correctly recognize
+ discarded COMDAT symbols.
+
* i386_ld.c (elf_i386_count_relocations): Lot of corrections.
(elf_i386_create_relocations): Likewise.
* ld.h (struct symbol): Add local and hidden bits.
@@ -13,8 +16,8 @@
Don't hide global, defined symbols in dynamic symbol table unless
requested. Synthetic symbols have no version information.
- * elflint.c: Add support for checking 64-bit SyV-stlye hash tables.
- * readelf.c: Add support for printing 64-bit SyV-stlye hash tables.
+ * elflint.c: Add support for checking 64-bit SysV-style hash tables.
+ * readelf.c: Add support for printing 64-bit SysV-style hash tables.
2006-07-04 Ulrich Drepper <drepper@redhat.com>
diff --git a/src/i386_ld.c b/src/i386_ld.c
index 33403eaf..60e45f3f 100644
--- a/src/i386_ld.c
+++ b/src/i386_ld.c
@@ -72,7 +72,7 @@ elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)),
Elf_Data *data;
/* Iterate over all the input sections. Appropriate data buffers in the
- output sections were already created. I get them iteratively, too. */
+ output sections were already created. */
runp = firstp;
data = NULL;
do
@@ -159,15 +159,13 @@ elf_i386_relocate_section (struct ld_state *statep __attribute__ ((unused)),
itself. */
if (XELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
- Elf32_Word toadd;
-
- /* We expect here on R_386_32 relocations. */
+ /* We expect here only R_386_32 relocations. */
assert (XELF_R_TYPE (rel->r_info) == R_386_32);
/* Avoid writing to the section memory if this is
effectively a no-op since it might save a
copy-on-write operation. */
- toadd = file->scninfo[xndx].offset;
+ Elf32_Word toadd = file->scninfo[xndx].offset;
if (toadd != 0)
add_4ubyte_unaligned (reltgtdata->d_buf + rel->r_offset,
toadd);
diff --git a/src/ldgeneric.c b/src/ldgeneric.c
index 36b9d6f0..6913d67e 100644
--- a/src/ldgeneric.c
+++ b/src/ldgeneric.c
@@ -3574,7 +3574,7 @@ fillin_special_symbol (struct symbol *symst, size_t scnidx, size_t nsym,
/* Traditionally: globally visible. */
sym->st_info = XELF_ST_INFO (symst->local ? STB_LOCAL : STB_GLOBAL,
symst->type);
- sym->st_other = symst->hidden ? STV_HIDDEN : 0;
+ sym->st_other = symst->hidden ? STV_HIDDEN : STV_DEFAULT;
/* Reference to the GOT or dynamic section. Since the GOT and
dynamic section are only created for executables and DSOs it
cannot be that the section index is too large. */
@@ -3731,7 +3731,7 @@ create_verneed_data (XElf_Off offset, Elf_Data *verneeddata,
For executables (shared or not) we have to create the program header,
additional sections like the .interp, eventually (in addition) create
a dynamic symbol table and a dynamic section. Also the relocations
-have to be processed differently. */
+ have to be processed differently. */
static int
ld_generic_create_outfile (struct ld_state *statep)
{
@@ -4599,6 +4599,7 @@ ld_generic_create_outfile (struct ld_state *statep)
file = ld_state.relfiles->next;
symdata = elf_getdata (elf_getscn (ld_state.outelf, ld_state.symscnidx),
NULL);
+
do
{
size_t maxcnt;
@@ -4785,7 +4786,7 @@ section index too large in dynamic symbol table"));
defp = file->symref[cnt];
/* Ignore symbols in discarded COMDAT group sections. */
- if (defp != NULL)
+ if (defp != NULL || cnt < file->nlocalsymbols)
{
/* Store the reference to the symbol record. The
sorting code will have to keep this array in the
@@ -4807,7 +4808,6 @@ section index too large in dynamic symbol table"));
nothing. */
assert (xndxdata == NULL || need_xndx);
-
/* Create the version related sections. */
if (ld_state.verneedscnidx != 0)
{