diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-12-20 19:07:11 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-12-20 19:07:11 +0000 |
commit | 9b09a01580155d95dc2c0e0ac3ce0bb2eccc812e (patch) | |
tree | 82f9b80a915512d621cc15492d1d31a8a1a13132 /bfd/elf32-i386.c | |
parent | 972b240176d55ca7a8ef27904ed3efc1660e7742 (diff) | |
download | gdb-9b09a01580155d95dc2c0e0ac3ce0bb2eccc812e.zip gdb-9b09a01580155d95dc2c0e0ac3ce0bb2eccc812e.tar.gz gdb-9b09a01580155d95dc2c0e0ac3ce0bb2eccc812e.tar.bz2 |
* elf32-i386.c (elf_i386_relocate_section): Correct and expand the
list of cases for which relocation need not be computed.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 60c0f45..a80cf70 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -647,11 +647,13 @@ elf_i386_adjust_dynamic_symbol (info, h) if (s->_raw_size == 0) s->_raw_size += PLT_ENTRY_SIZE; - /* If we are not generating a shared library, or if the symbol - is not defined, set the symbol to this location in the .plt. - This is required to make function pointers compare as equal - between the normal executable and the shared library. */ - if (! info->shared || h->root.type != bfd_link_hash_defined) + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { h->root.u.def.section = s; h->root.u.def.value = s->_raw_size; @@ -1030,9 +1032,25 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (h->root.type == bfd_link_hash_defined) { sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); + if (r_type == R_386_GOTPC + || (r_type == R_386_PLT32 + && h->plt_offset != (bfd_vma) -1) + || (r_type == R_386_GOT32 + && elf_hash_table (info)->dynamic_sections_created) + || (info->shared + && (r_type == R_386_32 + || r_type == R_386_PC32) + && (input_section->flags & SEC_ALLOC) != 0)) + { + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + } + else + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); } else if (h->root.type == bfd_link_hash_weak) relocation = 0; |