diff options
author | Alan Modra <amodra@gmail.com> | 2001-11-21 14:58:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-11-21 14:58:26 +0000 |
commit | d7458677f4d277378d65c4ebdaf880f43e7fc15b (patch) | |
tree | 1d599e33cde21c70db6fcc9e7e9d1a1530232c27 /bfd | |
parent | add55e1f31f174c2eb0b596fbfd9396f4b416814 (diff) | |
download | gdb-d7458677f4d277378d65c4ebdaf880f43e7fc15b.zip gdb-d7458677f4d277378d65c4ebdaf880f43e7fc15b.tar.gz gdb-d7458677f4d277378d65c4ebdaf880f43e7fc15b.tar.bz2 |
* elfxx-ia64.c (elfNN_ia64_relocate_section): Test r_symndx rather
than sym_sec->output_section to detect relocs against discarded
sections.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 77 |
2 files changed, 45 insertions, 38 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5d7dae1..3353974 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2001-11-21 Alan Modra <amodra@bigpond.net.au> + + * elfxx-ia64.c (elfNN_ia64_relocate_section): Test r_symndx rather + than sym_sec->output_section to detect relocs against discarded + sections. + 2001-11-19 H.J. Lu <hjl@gnu.org> * elflink.h (elf_link_input_bfd): Assert r_symndx != 0 when diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 7f4a991..05ae668 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -3835,47 +3835,48 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_SEGREL32LSB: case R_IA64_SEGREL64MSB: case R_IA64_SEGREL64LSB: - { - struct elf_segment_map *m; - Elf_Internal_Phdr *p; - - /* Find the segment that contains the output_section. */ - for (m = elf_tdata (output_bfd)->segment_map, - p = elf_tdata (output_bfd)->phdr; - m != NULL; - m = m->next, p++) - { - int i; - for (i = m->count - 1; i >= 0; i--) - if (m->sections[i] == sym_sec->output_section) + if (r_symndx == 0) + { + /* If the input section was discarded from the output, then + do nothing. */ + r = bfd_reloc_ok; + } + else + { + struct elf_segment_map *m; + Elf_Internal_Phdr *p; + + /* Find the segment that contains the output_section. */ + for (m = elf_tdata (output_bfd)->segment_map, + p = elf_tdata (output_bfd)->phdr; + m != NULL; + m = m->next, p++) + { + int i; + for (i = m->count - 1; i >= 0; i--) + if (m->sections[i] == sym_sec->output_section) + break; + if (i >= 0) break; - if (i >= 0) - break; - } - - if (m == NULL) - { - /* If the input section was discarded from the output, then - do nothing. */ + } - if (bfd_is_abs_section (sym_sec->output_section)) - r = bfd_reloc_ok; - else + if (m == NULL) + { r = bfd_reloc_notsupported; - } - else - { - /* The VMA of the segment is the vaddr of the associated - program header. */ - if (value > p->p_vaddr) - value -= p->p_vaddr; - else - value = 0; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, - r_type); - } - break; - } + } + else + { + /* The VMA of the segment is the vaddr of the associated + program header. */ + if (value > p->p_vaddr) + value -= p->p_vaddr; + else + value = 0; + r = elfNN_ia64_install_value (output_bfd, hit_addr, value, + r_type); + } + break; + } case R_IA64_SECREL32MSB: case R_IA64_SECREL32LSB: |