aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-s390.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2002-02-19 18:22:16 +0000
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2002-02-19 18:22:16 +0000
commitbefc3abbedec2335e0c1f8d43df9119d438f0d35 (patch)
tree3898a202d09e6e00faaad83eb71bf73c0093c20b /bfd/elf32-s390.c
parent47221191f649cb69ac9b8296e102fa45fa59176c (diff)
downloadgdb-befc3abbedec2335e0c1f8d43df9119d438f0d35.zip
gdb-befc3abbedec2335e0c1f8d43df9119d438f0d35.tar.gz
gdb-befc3abbedec2335e0c1f8d43df9119d438f0d35.tar.bz2
2002-02-19 Martin Schwidefsky <schwidefsky@de.ibm.com>
* archures.c (bfd_mach_s390_esa): Rename to bfd_mach_s390_31. (bfd_mach_s390_esame): Rename to bfd_mach_s390_64. * bfd-in2.h: Regenerate. * cpu-s390.c (arch_info_struct): Use renamed architecture defines. Replace architecture name "s390" with "s390:31-bit" and "s390:esame" with "s390:64-bit". * elf32-s390.c (elf_howto_table): Add 32 bit pc relative relocations. (elf_s390_reloc_type_lookup): Likewise. (elf_s390_check_relocs): Likewise. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_object_p): Use renamed architecture define. * elf64-s390.c (elf_s390_object_p): Use renamed architecture define.
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r--bfd/elf32-s390.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 01ce47c..1f197b5 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -111,6 +111,10 @@ static reloc_howto_type elf_howto_table[] =
HOWTO(R_390_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16", false, 0,0x0000ffff, true),
HOWTO(R_390_PC16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC16DBL", false, 0,0x0000ffff, true),
HOWTO(R_390_PLT16DBL, 1, 1, 16, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT16DBL", false, 0,0x0000ffff, true),
+ HOWTO(R_390_PC32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PC32DBL", false, 0,0xffffffff, true),
+ HOWTO(R_390_PLT32DBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_PLT32DBL", false, 0,0xffffffff, true),
+ HOWTO(R_390_GOTPCDBL, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTPCDBL", false, 0,0xffffffff, true),
+ HOWTO(R_390_GOTENT, 1, 2, 32, true, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_390_GOTENT", false, 0,0xffffffff, true),
};
/* GNU extension to record C++ vtable hierarchy. */
@@ -166,6 +170,14 @@ elf_s390_reloc_type_lookup (abfd, code)
return &elf_howto_table[(int) R_390_PC16DBL];
case BFD_RELOC_390_PLT16DBL:
return &elf_howto_table[(int) R_390_PLT16DBL];
+ case BFD_RELOC_390_PC32DBL:
+ return &elf_howto_table[(int) R_390_PC32DBL];
+ case BFD_RELOC_390_PLT32DBL:
+ return &elf_howto_table[(int) R_390_PLT32DBL];
+ case BFD_RELOC_390_GOTPCDBL:
+ return &elf_howto_table[(int) R_390_GOTPCDBL];
+ case BFD_RELOC_390_GOTENT:
+ return &elf_howto_table[(int) R_390_GOTENT];
case BFD_RELOC_VTABLE_INHERIT:
return &elf32_s390_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
@@ -650,6 +662,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT32:
+ case R_390_GOTENT:
/* This symbol requires a global offset table entry. */
if (h != NULL)
{
@@ -679,6 +692,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
case R_390_GOTOFF:
case R_390_GOTPC:
+ case R_390_GOTPCDBL:
if (htab->sgot == NULL)
{
if (htab->elf.dynobj == NULL)
@@ -689,6 +703,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
break;
case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
case R_390_PLT32:
/* This symbol requires a procedure linkage table entry. We
actually build the entry in adjust_dynamic_symbol,
@@ -711,6 +726,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
+ case R_390_PC32DBL:
case R_390_PC32:
if (h != NULL && !info->shared)
{
@@ -752,6 +768,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
&& (sec->flags & SEC_ALLOC) != 0
&& ((ELF32_R_TYPE (rel->r_info) != R_390_PC16
&& ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL
+ && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
&& ELF32_R_TYPE (rel->r_info) != R_390_PC32)
|| (h != NULL
&& (! info->symbolic
@@ -854,6 +871,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
p->count += 1;
if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
|| ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
+ || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
|| ELF32_R_TYPE (rel->r_info) == R_390_PC32)
p->pc_count += 1;
}
@@ -954,6 +972,8 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
case R_390_GOT32:
case R_390_GOTOFF:
case R_390_GOTPC:
+ case R_390_GOTPCDBL:
+ case R_390_GOTENT:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
{
@@ -974,6 +994,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
+ case R_390_PC32DBL:
case R_390_PC32:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
@@ -994,6 +1015,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
{
if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
|| ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
+ || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
|| ELF32_R_TYPE (rel->r_info) == R_390_PC32)
p->pc_count -= 1;
p->count -= 1;
@@ -1005,6 +1027,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
break;
case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
case R_390_PLT32:
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
@@ -1716,6 +1739,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT32:
+ case R_390_GOTENT:
/* Relocation is to the entry for this symbol in the global
offset table. */
if (htab->sgot == NULL)
@@ -1803,6 +1827,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
abort ();
relocation = htab->sgot->output_offset + off;
+
+ /*
+ * For @GOTENT the relocation is against the offset between
+ * the instruction and the symbols entry in the GOT and not
+ * between the start of the GOT and the symbols entry. We
+ * add the vma of the GOT to get the correct value.
+ */
+ if (r_type == R_390_GOTENT)
+ relocation += htab->sgot->output_section->vma;
+
break;
case R_390_GOTOFF:
@@ -1818,12 +1852,14 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
break;
case R_390_GOTPC:
+ case R_390_GOTPCDBL:
/* Use global offset table as symbol value. */
relocation = htab->sgot->output_section->vma;
unresolved_reloc = false;
break;
case R_390_PLT16DBL:
+ case R_390_PLT32DBL:
case R_390_PLT32:
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
@@ -1853,6 +1889,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
+ case R_390_PC32DBL:
case R_390_PC32:
/* r_symndx will be zero only for relocs against symbols
from removed linkonce sections, or sections discarded by
@@ -1864,6 +1901,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
if ((info->shared
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
+ && r_type != R_390_PC32DBL
&& r_type != R_390_PC32)
|| (h != NULL
&& h->dynindx != -1
@@ -1909,6 +1947,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
&& h->dynindx != -1
&& (r_type == R_390_PC16
|| r_type == R_390_PC16DBL
+ || r_type == R_390_PC32DBL
|| r_type == R_390_PC32
|| !info->shared
|| !info->symbolic
@@ -2375,7 +2414,7 @@ static boolean
elf_s390_object_p (abfd)
bfd *abfd;
{
- return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esa);
+ return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
}
static boolean