diff options
author | Alan Modra <amodra@gmail.com> | 2004-05-22 01:56:31 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-05-22 01:56:31 +0000 |
commit | 753731eef094e983fab58faf7c7c5e8090de6e1b (patch) | |
tree | fbb781352bd805dad317c126df1f62b7f5188e2a | |
parent | a55491f7c4c7f716fcad92b8ad0acd4f757bc218 (diff) | |
download | gdb-753731eef094e983fab58faf7c7c5e8090de6e1b.zip gdb-753731eef094e983fab58faf7c7c5e8090de6e1b.tar.gz gdb-753731eef094e983fab58faf7c7c5e8090de6e1b.tar.bz2 |
* merge.c (_bfd_merged_section_offset): Remove "addend" param.
* libbfd-in.h (_bfd_merged_section_offset): Adjust prototype.
* libbfd.h: Regenerate.
* elf.c (_bfd_elf_rela_local_sym): Adjust call.
(_bfd_elf_rel_local_sym): Likewise.
* elflink.c (_bfd_elf_link_sec_merge_syms): Likewise.
(elf_link_input_bfd): Likewise.
* elf32-ppc.c (ppc_elf_relax_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
(elfNN_ia64_relocate_section): Likewise.
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/elf.c | 17 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 2 | ||||
-rw-r--r-- | bfd/elf64-alpha.c | 3 | ||||
-rw-r--r-- | bfd/elflink.c | 4 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 6 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 2 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/merge.c | 23 |
9 files changed, 45 insertions, 28 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 824a23c..e78e132 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2004-05-22 Alan Modra <amodra@bigpond.net.au> + + * merge.c (_bfd_merged_section_offset): Remove "addend" param. + * libbfd-in.h (_bfd_merged_section_offset): Adjust prototype. + * libbfd.h: Regenerate. + * elf.c (_bfd_elf_rela_local_sym): Adjust call. + (_bfd_elf_rel_local_sym): Likewise. + * elflink.c (_bfd_elf_link_sec_merge_syms): Likewise. + (elf_link_input_bfd): Likewise. + * elf32-ppc.c (ppc_elf_relax_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise. + (elfNN_ia64_relocate_section): Likewise. + 2004-05-21 Andy Chittenden <achittenden@bluearc.com> * hash.c (bfd_default_hash_table_size): New variable. @@ -7537,9 +7537,18 @@ _bfd_elf_rela_local_sym (bfd *abfd, rel->r_addend = _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, - sym->st_value + rel->r_addend, - 0); - sec = *psec; + sym->st_value + rel->r_addend); + if (sec != *psec) + { + /* If we have changed the section, and our original section is + marked with SEC_EXCLUDE, it means that the original + SEC_MERGE section has been completely subsumed in some + other SEC_MERGE section. In this case, we need to leave + some info around for --emit-relocs. */ + if ((sec->flags & SEC_EXCLUDE) != 0) + sec->kept_section = *psec; + sec = *psec; + } rel->r_addend -= relocation; rel->r_addend += sec->output_section->vma + sec->output_offset; } @@ -7559,7 +7568,7 @@ _bfd_elf_rel_local_sym (bfd *abfd, return _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, - sym->st_value + addend, 0); + sym->st_value + addend); } bfd_vma diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index bdd3450..980dcb9 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1811,7 +1811,7 @@ ppc_elf_relax_section (bfd *abfd, if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) toff = _bfd_merged_section_offset (abfd, &tsec, elf_section_data (tsec)->sec_info, - toff, 0); + toff); symaddr = tsec->output_section->vma + tsec->output_offset + toff; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 01c66b5..21785d5 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4381,8 +4381,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, _bfd_merged_section_offset (output_bfd, &msec, elf_section_data (sec)-> sec_info, - sym->st_value + ent->addend, - (bfd_vma) 0); + sym->st_value + ent->addend); ent->addend -= sym->st_value; ent->addend += msec->output_section->vma + msec->output_offset diff --git a/bfd/elflink.c b/bfd/elflink.c index cee5909..37540aa 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2362,7 +2362,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data) _bfd_merged_section_offset (output_bfd, &h->root.u.def.section, elf_section_data (sec)->sec_info, - h->root.u.def.value, 0); + h->root.u.def.value); } return TRUE; @@ -6392,7 +6392,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) isym->st_value = _bfd_merged_section_offset (output_bfd, &isec, elf_section_data (isec)->sec_info, - isym->st_value, 0); + isym->st_value); } else if (isym->st_shndx == SHN_ABS) isec = bfd_abs_section_ptr; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 20d9083..26b2e45 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -913,8 +913,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) toff = _bfd_merged_section_offset (abfd, &tsec, elf_section_data (tsec)->sec_info, - toff + irel->r_addend, - (bfd_vma) 0); + toff + irel->r_addend); else toff += irel->r_addend; @@ -3963,8 +3962,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, elf_section_data (msec)-> sec_info, sym->st_value - + dynent->addend, - (bfd_vma) 0); + + dynent->addend); dynent->addend -= sym->st_value; dynent->addend += msec->output_section->vma + msec->output_offset diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 6d3a335..956727d 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -538,7 +538,7 @@ extern bfd_boolean _bfd_write_merged_section /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - (bfd *, asection **, void *, bfd_vma, bfd_vma); + (bfd *, asection **, void *, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 86819ff..96776ca 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -543,7 +543,7 @@ extern bfd_boolean _bfd_write_merged_section /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - (bfd *, asection **, void *, bfd_vma, bfd_vma); + (bfd *, asection **, void *, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init diff --git a/bfd/merge.c b/bfd/merge.c index 89f45cd..3811523 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -780,7 +780,7 @@ _bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo) bfd_vma _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, - void *psecinfo, bfd_vma offset, bfd_vma addend) + void *psecinfo, bfd_vma offset) { struct sec_merge_sec_info *secinfo; struct sec_merge_hash_entry *entry; @@ -789,13 +789,13 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, secinfo = (struct sec_merge_sec_info *) psecinfo; - if (offset + addend >= sec->_raw_size) + if (offset >= sec->_raw_size) { - if (offset + addend > sec->_raw_size) + if (offset > sec->_raw_size) { (*_bfd_error_handler) - (_("%s: access beyond end of merged section (%ld + %ld)"), - bfd_get_filename (sec->owner), (long) offset, (long) addend); + (_("%s: access beyond end of merged section (%ld)"), + bfd_get_filename (sec->owner), (long) offset); } return (secinfo->first ? sec->_cooked_size : 0); } @@ -804,15 +804,14 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, { if (sec->entsize == 1) { - p = secinfo->contents + offset + addend - 1; + p = secinfo->contents + offset - 1; while (p >= secinfo->contents && *p) --p; ++p; } else { - p = secinfo->contents - + ((offset + addend) / sec->entsize) * sec->entsize; + p = secinfo->contents + (offset / sec->entsize) * sec->entsize; p -= sec->entsize; while (p >= secinfo->contents) { @@ -830,8 +829,7 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, } else { - p = secinfo->contents - + ((offset + addend) / sec->entsize) * sec->entsize; + p = secinfo->contents + (offset / sec->entsize) * sec->entsize; } entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE); if (!entry) @@ -845,9 +843,8 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, if (! secinfo->htab->first) abort (); entry = secinfo->htab->first; - p = secinfo->contents - + ((offset + addend) / sec->entsize + 1) * sec->entsize - - entry->len; + p = (secinfo->contents + (offset / sec->entsize + 1) * sec->entsize + - entry->len); } *psec = entry->secinfo->sec; |