aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-03-24 18:42:09 +0000
committerIan Lance Taylor <ian@airs.com>1997-03-24 18:42:09 +0000
commite91487242e0159cd1ded0a8a902a05a49c93f009 (patch)
tree4431ed27558c3bb3f4387fd6ca7a68c4238d0376
parent9ab49ef840e527eca0ef24cb68dffa6630bd1f46 (diff)
downloadgdb-e91487242e0159cd1ded0a8a902a05a49c93f009.zip
gdb-e91487242e0159cd1ded0a8a902a05a49c93f009.tar.gz
gdb-e91487242e0159cd1ded0a8a902a05a49c93f009.tar.bz2
* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Don't
count section symbols for sections that were created by the linker, or are not allocatable or not loadable. (elf32_sparc_finish_dynamic_sections): Output output section symbols for section for which we made space for them.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-sparc.c44
2 files changed, 37 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b8a6a79..9038875 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 24 13:41:00 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Don't
+ count section symbols for sections that were created by the
+ linker, or are not allocatable or not loadable.
+ (elf32_sparc_finish_dynamic_sections): Output output section
+ symbols for section for which we made space for them.
+
Fri Mar 21 13:08:26 1997 Ian Lance Taylor <ian@cygnus.com>
* elf32-sparc.c (elf32_sparc_size_dynamic_sections): If there is
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 1db5f3a..905b567 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -896,26 +896,34 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
}
/* If we are generating a shared library, we generate a section
- symbol for each output section. These are local symbols, which
- means that they must come first in the dynamic symbol table.
- That means we must increment the dynamic symbol index of every
- other dynamic symbol. */
+ symbol for each output section for which we might need to copy
+ relocs. These are local symbols, which means that they must come
+ first in the dynamic symbol table. That means we must increment
+ the dynamic symbol index of every other dynamic symbol. */
if (info->shared)
{
- int c, i;
+ int c;
- c = bfd_count_sections (output_bfd);
- elf_link_hash_traverse (elf_hash_table (info),
- elf32_sparc_adjust_dynindx,
- (PTR) &c);
- elf_hash_table (info)->dynsymcount += c;
-
- for (i = 1, s = output_bfd->sections; s != NULL; s = s->next, i++)
+ c = 0;
+ for (s = output_bfd->sections; s != NULL; s = s->next)
{
- elf_section_data (s)->dynindx = i;
+ if ((s->flags & SEC_LINKER_CREATED) != 0
+ || (s->flags & SEC_ALLOC) == 0
+ || (s->flags & SEC_LOAD) == 0)
+ continue;
+
+ elf_section_data (s)->dynindx = c + 1;
+
/* These symbols will have no names, so we don't need to
fiddle with dynstr_index. */
+
+ ++c;
}
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf32_sparc_adjust_dynindx,
+ (PTR) &c);
+ elf_hash_table (info)->dynsymcount += c;
}
return true;
@@ -1630,6 +1638,7 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
asection *sdynsym;
asection *s;
Elf_Internal_Sym sym;
+ int c;
/* Set up the section symbols for the output sections. */
@@ -1641,10 +1650,14 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
sym.st_other = 0;
+ c = 0;
for (s = output_bfd->sections; s != NULL; s = s->next)
{
int indx;
+ if (elf_section_data (s)->dynindx == 0)
+ continue;
+
sym.st_value = s->vma;
indx = elf_section_data (s)->this_idx;
@@ -1655,12 +1668,13 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
(PTR) (((Elf32_External_Sym *)
sdynsym->contents)
+ elf_section_data (s)->dynindx));
+
+ ++c;
}
/* Set the sh_info field of the output .dynsym section to the
index of the first global symbol. */
- elf_section_data (sdynsym->output_section)->this_hdr.sh_info =
- bfd_count_sections (output_bfd) + 1;
+ elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
}
return true;