From dfec422f08f6a55459da38a629502caeb4e2d115 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Thu, 16 Sep 1999 16:51:34 +0000 Subject: [PATCH 1/1] * elf-hppa.h (elf_hppa_relocate_section): Allow undefined symbols when building shared libraries. (elf_hppa_final_link_relocate): Correct handling of PCREL relocations against undefined symbols. --- bfd/ChangeLog | 7 +++++++ bfd/elf-hppa.h | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 25a8c4cabb..15ec069987 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +Thu Sep 16 10:48:17 1999 Jeffrey A Law (law@cygnus.com) + + * elf-hppa.h (elf_hppa_relocate_section): Allow undefined + symbols when building shared libraries. + (elf_hppa_final_link_relocate): Correct handling of PCREL + relocations against undefined symbols. + 1999-09-16 Nick Clifton * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Mark diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 6486e9d732..d0785b6812 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1004,7 +1004,6 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, { sym_sec = h->root.u.def.section; - /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */ dyn_name = get_dyn_name (input_bfd, h, rel, @@ -1032,6 +1031,26 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, else relocation = 0; } + /* Allow undefined symbols in shared libraries. */ + else if (info->shared && !info->symbolic && !info->no_undefined) + { + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ + dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, false, false); + + if (dyn_h == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + relocation = 0; + } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; else @@ -1150,8 +1169,9 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, /* If this is a call to a function defined in another dynamic library, then redirect the call to the local stub for this function. */ - if (sym_sec->output_section == NULL) - value = dyn_h->stub_offset; + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); /* Turn VALUE into a proper PC relative address. */ value -= (offset + input_section->output_offset @@ -1184,7 +1204,7 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, /* If this is a call to a function defined in another dynamic library, then redirect the call to the local stub for this function. */ - if (sym_sec->output_section == NULL) + if (sym_sec == NULL || sym_sec->output_section == NULL) value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + hppa_info->stub_sec->output_section->vma); @@ -1507,8 +1527,9 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, /* If this is a call to a function defined in another dynamic library, then redirect the call to the local stub for this function. */ - if (sym_sec->output_section == NULL) - value = dyn_h->stub_offset; + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); /* Turn VALUE into a proper PC relative address. */ value -= (offset + input_section->output_offset @@ -1525,8 +1546,10 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, /* If this is a call to a function defined in another dynamic library, then redirect the call to the local stub for this function. */ - if (sym_sec->output_section == NULL) - value = dyn_h->stub_offset; + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); + /* Turn VALUE into a proper PC relative address. */ value -= (offset + input_section->output_offset -- 2.34.1