diff options
author | Bob Wilson <bob.wilson@acm.org> | 2004-04-27 21:28:16 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@acm.org> | 2004-04-27 21:28:16 +0000 |
commit | 3ba3bc8c61e4a2da48d0db0d9d28ac2d679aa9b7 (patch) | |
tree | 7269e05305c9d441a051cb111623e97104ac9247 /bfd/elf32-xtensa.c | |
parent | a9c7fee1f4a4969ace9759b45c4c698bf0592916 (diff) | |
download | gdb-3ba3bc8c61e4a2da48d0db0d9d28ac2d679aa9b7.zip gdb-3ba3bc8c61e4a2da48d0db0d9d28ac2d679aa9b7.tar.gz gdb-3ba3bc8c61e4a2da48d0db0d9d28ac2d679aa9b7.tar.bz2 |
* elf32-xtensa.c (xtensa_read_table_entries): Use section _cooked_size
if set. Check reloc_done flag before applying relocations. Use
output addresses, both when applying relocations and when comparing
against the specified section.
(elf_xtensa_relocate_section): Use output address to check if dynamic
reloc is in a literal pool. Set section's reloc_done flag.
Diffstat (limited to 'bfd/elf32-xtensa.c')
-rw-r--r-- | bfd/elf32-xtensa.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index b7639b7..710a1a6 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -497,13 +497,15 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) int block_count; bfd_size_type num_records; Elf_Internal_Rela *internal_relocs; + bfd_vma section_addr; table_section_name = xtensa_get_property_section_name (section, sec_name); table_section = bfd_get_section_by_name (abfd, table_section_name); free (table_section_name); if (table_section != NULL) - table_size = bfd_get_section_size_before_reloc (table_section); + table_size = (table_section->_cooked_size + ? table_section->_cooked_size : table_section->_raw_size); if (table_size == 0) { @@ -517,10 +519,12 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) bfd_malloc (num_records * sizeof (property_table_entry)); block_count = 0; + section_addr = section->output_section->vma + section->output_offset; + /* If the file has not yet been relocated, process the relocations and sort out the table entries that apply to the specified section. */ internal_relocs = retrieve_internal_relocs (abfd, table_section, TRUE); - if (internal_relocs) + if (internal_relocs && !table_section->reloc_done) { unsigned i; @@ -539,7 +543,7 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) { bfd_vma sym_off = get_elf_r_symndx_offset (abfd, r_symndx); blocks[block_count].address = - (section->vma + sym_off + rel->r_addend + (section_addr + sym_off + rel->r_addend + bfd_get_32 (abfd, table_data + rel->r_offset)); blocks[block_count].size = bfd_get_32 (abfd, table_data + rel->r_offset + 4); @@ -549,16 +553,16 @@ xtensa_read_table_entries (abfd, section, table_p, sec_name) } else { - /* No relocations. Presumably the file has been relocated - and the addresses are already in the table. */ + /* The file has already been relocated and the addresses are + already in the table. */ bfd_vma off; for (off = 0; off < table_size; off += 8) { bfd_vma address = bfd_get_32 (abfd, table_data + off); - if (address >= section->vma - && address < ( section->vma + section->_raw_size)) + if (address >= section_addr + && address < ( section_addr + section->_raw_size)) { blocks[block_count].address = address; blocks[block_count].size = @@ -2044,8 +2048,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, and not in a literal pool. */ if ((input_section->flags & SEC_READONLY) != 0 && !elf_xtensa_in_literal_pool (lit_table, ltblsize, - input_section->vma - + rel->r_offset)) + outrel.r_offset)) { error_message = _("dynamic relocation in read-only section"); @@ -2145,6 +2148,8 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, if (lit_table) free (lit_table); + input_section->reloc_done = TRUE; + return TRUE; } |