diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2000-09-18 16:19:15 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2000-09-18 16:19:15 +0000 |
commit | 8a3975e63bce567cab8199a231b46b46043dda5a (patch) | |
tree | a26f3f87f7a0f5a1d2156e2e93e0f85566317103 /bfd | |
parent | e63286713f94c7bfb8496ceaf356e146a3ef04a1 (diff) | |
download | gdb-8a3975e63bce567cab8199a231b46b46043dda5a.zip gdb-8a3975e63bce567cab8199a231b46b46043dda5a.tar.gz gdb-8a3975e63bce567cab8199a231b46b46043dda5a.tar.bz2 |
* elf32-sh.c (sh_elf_relocate_section): Use
_bfd_final_link_relocate to apply the relocation against a section
symbol, when doing relocatable links.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-sh.c | 38 |
2 files changed, 25 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3289e9b..14896cc 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2000-09-18 Alexandre Oliva <aoliva@redhat.com> + + * elf32-sh.c (sh_elf_relocate_section): Use + _bfd_final_link_relocate to apply the relocation against a section + symbol, when doing relocatable links. + 2000-09-18 Alan Modra <alan@linuxcare.com.au> * elf32-hppa.c (elf32_hppa_stub_hash_entry): Rename input_section diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index a74d9e8..bd2b3ed 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2897,25 +2897,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - r_type = ELF32_R_TYPE (rel->r_info); /* Many of the relocs are only used for relaxing, and are @@ -2948,9 +2929,28 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + goto final_link_relocate; + + continue; + } } else { + /* Section symbol are never (?) placed in the hash table, so + we can just ignore hash relocations when creating a + relocateable object file. */ + if (info->relocateable) + continue; + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) |