]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Correctly recognize discarded COMDATA symbols when constructing the
authorUlrich Drepper <drepper@redhat.com>
Wed, 5 Jul 2006 19:18:11 +0000 (19:18 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 5 Jul 2006 19:18:11 +0000 (19:18 +0000)
symbol table.

src/ChangeLog
src/i386_ld.c
src/ldgeneric.c

index c08940c18d96ab57159cb76bacbc85759efd9c60..b75a7662210caf2857c72a56ded3442a1d893314 100644 (file)
@@ -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>
 
index 33403eaf90e9da768860781aad07b1d93e32e1d3..60e45f3f3361de48e54ada8a27407903d5113213 100644 (file)
@@ -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);
index 36b9d6f030cc62b7d01537c4d898a4b775561b26..6913d67ecd7fa708c8ddc4f2f9bd8c4cbafcf268 100644 (file)
@@ -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)
     {