This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Small fixes for x86-64
- To: binutils at sources dot redhat dot com
- Subject: Small fixes for x86-64
- From: Andreas Jaeger <aj at suse dot de>
- Date: 07 Jun 2001 15:28:45 +0200
- Cc: patches at x86-64 dot org
Here're a number of minor fixes for x86-64. I'll commit them after
some more testing,
Andreas
2001-06-07 Andreas Jaeger <aj@suse.de>
* elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Add an
assertion.
(elf64_x86_64_check_relocs): Fix VTENTRY relocation; set an
alignment of 8 for .rela sections; handle further relocations.
============================================================
Index: bfd/elf64-x86-64.c
--- bfd/elf64-x86-64.c 2001/06/01 11:52:11 1.18
+++ bfd/elf64-x86-64.c 2001/06/07 13:23:55
@@ -492,22 +492,33 @@
if (h == NULL)
continue;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
if (h->plt.refcount == -1)
- {
- h->plt.refcount = 1;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- }
+ h->plt.refcount = 1;
else
h->plt.refcount += 1;
break;
- case R_X86_64_64:
+ case R_X86_64_8:
+ case R_X86_64_16:
case R_X86_64_32:
+ case R_X86_64_64:
case R_X86_64_32S:
case R_X86_64_PC32:
if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ {
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ if (!info->shared)
+ {
+ /* We may need a .plt entry if the function this
+ reloc refers to is in a shared lib. */
+ if (h->plt.refcount == -1)
+ h->plt.refcount = 1;
+ else
+ h->plt.refcount += 1;
+ }
+ }
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
@@ -524,7 +535,9 @@
and symbol visibility changes render the symbol local. */
if (info->shared
&& (sec->flags & SEC_ALLOC) != 0
- && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32
+ && (((ELF64_R_TYPE (rel->r_info) != R_X86_64_PC8)
+ && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC16)
+ && (ELF64_R_TYPE (rel->r_info) != R_X86_64_PC32))
|| (h != NULL
&& (! info->symbolic
|| (h->elf_link_hash_flags
@@ -560,7 +573,7 @@
flags |= SEC_ALLOC | SEC_LOAD;
if (sreloc == NULL
|| ! bfd_set_section_flags (dynobj, sreloc, flags)
- || ! bfd_set_section_alignment (dynobj, sreloc, 2))
+ || ! bfd_set_section_alignment (dynobj, sreloc, 3))
return false;
}
}
@@ -573,7 +586,10 @@
that this function is only called if we are using an
elf64_x86_64 linker hash table, which means that h is
really a pointer to an elf64_x86_64_link_hash_entry. */
- if (h != NULL && ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32)
+ if (h != NULL
+ && ((ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8)
+ || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16)
+ || (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32)))
{
struct elf64_x86_64_link_hash_entry *eh;
struct elf64_x86_64_pcrel_relocs_copied *p;
@@ -611,7 +627,7 @@
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_X86_64_GNU_VTENTRY:
- if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return false;
break;
}
@@ -1725,6 +1741,7 @@
&& (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
+ BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
rela.r_addend = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj