* elf64-x86-64.c (elf64_x86_64_relocate_section): Fix linking of

shared libraries.
This commit is contained in:
Andreas Jaeger 2001-06-21 16:33:14 +00:00
parent a7c14aa534
commit f631948d0b
2 changed files with 14 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2001-06-20 Bo Thorsen <bo@suse.co.uk>
* elf64-x86-64.c (elf64_x86_64_relocate_section): Fix linking of
shared libraries.
2001-06-18 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2001-06-18 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* configure.host (mips64-*-linux): Reformat. * configure.host (mips64-*-linux): Reformat.
@ -24,7 +29,7 @@
elf_backend_emit_relocs and elf_backend_count_relocs. elf_backend_emit_relocs and elf_backend_count_relocs.
* elflink.h (elf_link_size_reloc_section): Make the hash table * elflink.h (elf_link_size_reloc_section): Make the hash table
big enough to hold the relocs counted by either reloc_count or big enough to hold the relocs counted by either reloc_count or
o->reloc_count. o->reloc_count.
(elf_bfd_final_link) emit_relocs: New boolean, set if relocs (elf_bfd_final_link) emit_relocs: New boolean, set if relocs
should be emitted, either because of a command line option should be emitted, either because of a command line option
stored in the info structure or because the target provides a stored in the info structure or because the target provides a
@ -72,7 +77,7 @@
* elf32-mips.c (mips_elf_link_hash_entry): Add a new field, * elf32-mips.c (mips_elf_link_hash_entry): Add a new field,
readonly_reloc, to record if a relocation in the .rel.dyn readonly_reloc, to record if a relocation in the .rel.dyn
section is against a read-only section. section is against a read-only section.
(mips_elf_link_hash_newfunc): Initialize the readonly_reloc (mips_elf_link_hash_newfunc): Initialize the readonly_reloc
field to false. field to false.
(_bfd_mips_elf_check_relocs): Record if there is a relocation (_bfd_mips_elf_check_relocs): Record if there is a relocation

View File

@ -1442,7 +1442,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_X86_64_PC8: case R_X86_64_PC8:
case R_X86_64_PC16: case R_X86_64_PC16:
case R_X86_64_PC32: case R_X86_64_PC32:
if (h == NULL) if (h == NULL || h->dynindx == -1
|| (info->symbolic
&& h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
break; break;
/* Fall through. */ /* Fall through. */
case R_X86_64_8: case R_X86_64_8:
@ -1451,15 +1453,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_X86_64_64: case R_X86_64_64:
/* FIXME: The ABI says the linker should make sure the value is /* FIXME: The ABI says the linker should make sure the value is
the same when it's zeroextended to 64 bit. */ the same when it's zeroextended to 64 bit. */
if (info->shared if (info->shared && (input_section->flags & SEC_ALLOC) != 0)
&& (input_section->flags & SEC_ALLOC) != 0
&& ((r_type != R_X86_64_PC8
&& r_type != R_X86_64_PC16
&& r_type != R_X86_64_PC32)
|| (! info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{ {
Elf_Internal_Rela outrel; Elf_Internal_Rela outrel;
boolean skip, relocate; boolean skip, relocate;
@ -1563,10 +1557,10 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_ASSERT (indx > 0); BFD_ASSERT (indx > 0);
} }
relocate = false; relocate = false;
outrel.r_info = ELF64_R_INFO (indx, r_type); outrel.r_info = ELF64_R_INFO (indx, r_type);
outrel.r_addend = relocation + rela->r_addend; outrel.r_addend = relocation + rela->r_addend;
} }
} }