From: Martin Schwidefsky Date: Tue, 19 Feb 2002 18:22:16 +0000 (+0000) Subject: 2002-02-19 Martin Schwidefsky X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=befc3abbedec2335e0c1f8d43df9119d438f0d35;p=binutils-gdb.git 2002-02-19 Martin Schwidefsky * 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bfd0a077cdc..4e343e3aeab 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,19 @@ +2002-02-19 Martin Schwidefsky + + * 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. + 2002-02-19 Frank Ch. Eigler * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping. diff --git a/bfd/archures.c b/bfd/archures.c index 1caac7ff149..fb2ba9b79e2 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -259,8 +259,8 @@ DESCRIPTION .#define bfd_mach_avr5 5 . bfd_arch_cris, {* Axis CRIS *} . bfd_arch_s390, {* IBM s390 *} -.#define bfd_mach_s390_esa 0 -.#define bfd_mach_s390_esame 1 +.#define bfd_mach_s390_31 0 +.#define bfd_mach_s390_64 1 . bfd_arch_openrisc, {* OpenRISC *} . bfd_arch_mmix, {* Donald Knuth's educational processor. *} . bfd_arch_xstormy16, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 83677e9d492..a582806b8e7 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1638,8 +1638,8 @@ enum bfd_architecture #define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ bfd_arch_s390, /* IBM s390 */ -#define bfd_mach_s390_esa 0 -#define bfd_mach_s390_esame 1 +#define bfd_mach_s390_31 0 +#define bfd_mach_s390_64 1 bfd_arch_openrisc, /* OpenRISC */ bfd_arch_mmix, /* Donald Knuth's educational processor. */ bfd_arch_xstormy16, diff --git a/bfd/cpu-s390.c b/bfd/cpu-s390.c index 09ec78d6c80..d537e1257f9 100644 --- a/bfd/cpu-s390.c +++ b/bfd/cpu-s390.c @@ -23,15 +23,15 @@ #include "sysdep.h" #include "libbfd.h" -const bfd_arch_info_type bfd_s390_esame_arch = +const bfd_arch_info_type bfd_s390_64_arch = { 64, /* bits in a word */ 64, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esame, + bfd_mach_s390_64, "s390", - "s390:esame", + "s390:64-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, @@ -45,12 +45,12 @@ const bfd_arch_info_type bfd_s390_arch = 32, /* bits in an address */ 8, /* bits in a byte */ bfd_arch_s390, - bfd_mach_s390_esa, + bfd_mach_s390_31, "s390", - "s390:390", + "s390:31-bit", 3, /* section alignment power */ true, /* the default */ bfd_default_compatible, bfd_default_scan, - &bfd_s390_esame_arch + &bfd_s390_64_arch }; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 01ce47c3056..1f197b5a49c 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 diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index f296c3e9131..5be792881c5 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2325,7 +2325,7 @@ static boolean elf_s390_object_p (abfd) bfd *abfd; { - return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esame); + return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64); } /*