* 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-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.
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;
}
return _bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
- sym->st_value + addend, 0);
+ sym->st_value + addend);
}
bfd_vma
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;
_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
_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;
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;
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;
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
/* 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
/* 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
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;
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);
}
{
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)
{
}
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)
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;