From f954747f10467071b0acde07ee5f5e268ab606a6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 17 Apr 2018 09:00:57 +0930 Subject: [PATCH] Reinstate readelf decoding of i860, i960 and i370 relocs include/ * elf/i370.h: Revert removal. * elf/i860.h: Likewise. * elf/i960.h: Likewise. binutils * readelf.c: Revert 2018-04-16 and 2018-04-11 changes. --- binutils/ChangeLog | 4 +++ binutils/readelf.c | 23 ++++++++++++++++ include/ChangeLog | 6 +++++ include/elf/i370.h | 61 ++++++++++++++++++++++++++++++++++++++++++ include/elf/i860.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++ include/elf/i960.h | 37 ++++++++++++++++++++++++++ 6 files changed, 197 insertions(+) create mode 100644 include/elf/i370.h create mode 100644 include/elf/i860.h create mode 100644 include/elf/i960.h diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b69d0a7ff80..1b63c7d0184 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2018-04-17 Alan Modra + + * readelf.c: Revert 2018-04-16 and 2018-04-11 changes. + 2018-04-16 Alan Modra * readelf.c (get_machine_name): Correct typo. diff --git a/binutils/readelf.c b/binutils/readelf.c index 1e80e817d47..cf395dbe2d6 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -108,6 +108,9 @@ #include "elf/h8.h" #include "elf/hppa.h" #include "elf/i386.h" +#include "elf/i370.h" +#include "elf/i860.h" +#include "elf/i960.h" #include "elf/ia64.h" #include "elf/ip2k.h" #include "elf/lm32.h" @@ -762,6 +765,7 @@ guess_is_rela (unsigned int e_machine) /* Targets that use REL relocations. */ case EM_386: case EM_IAMCU: + case EM_960: case EM_ARM: case EM_D10V: case EM_CYGNUS_D10V: @@ -775,6 +779,7 @@ guess_is_rela (unsigned int e_machine) /* Targets that use RELA relocations. */ case EM_68K: + case EM_860: case EM_AARCH64: case EM_ADAPTEVA_EPIPHANY: case EM_ALPHA: @@ -1270,6 +1275,10 @@ dump_relocations (Filedata * filedata, rtype = elf_m68k_reloc_type (type); break; + case EM_960: + rtype = elf_i960_reloc_type (type); + break; + case EM_AVR: case EM_AVR_OLD: rtype = elf_avr_reloc_type (type); @@ -1419,12 +1428,20 @@ dump_relocations (Filedata * filedata, rtype = elf_cris_reloc_type (type); break; + case EM_860: + rtype = elf_i860_reloc_type (type); + break; + case EM_X86_64: case EM_L1OM: case EM_K1OM: rtype = elf_x86_64_reloc_type (type); break; + case EM_S370: + rtype = i370_reloc_type (type); + break; + case EM_S390_OLD: case EM_S390: rtype = elf_s390_reloc_type (type); @@ -12178,6 +12195,10 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 1; /* R_386_32. */ case EM_68K: return reloc_type == 1; /* R_68K_32. */ + case EM_860: + return reloc_type == 1; /* R_860_32. */ + case EM_960: + return reloc_type == 2; /* R_960_32. */ case EM_AARCH64: return (reloc_type == 258 || reloc_type == 1); /* R_AARCH64_ABS32 || R_AARCH64_P32_ABS32 */ @@ -12293,6 +12314,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 1; /* R_RL78_DIR32. */ case EM_RX: return reloc_type == 1; /* R_RX_DIR32. */ + case EM_S370: + return reloc_type == 1; /* R_I370_ADDR31. */ case EM_S390_OLD: case EM_S390: return reloc_type == 4; /* R_S390_32. */ diff --git a/include/ChangeLog b/include/ChangeLog index 814793c105e..2c8d52681ed 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2018-04-17 Alan Modra + + * elf/i370.h: Revert removal. + * elf/i860.h: Likewise. + * elf/i960.h: Likewise. + 2018-04-16 Alan Modra * coff/sparc.h: Delete. diff --git a/include/elf/i370.h b/include/elf/i370.h new file mode 100644 index 00000000000..61382e38493 --- /dev/null +++ b/include/elf/i370.h @@ -0,0 +1,61 @@ +/* i370 ELF support for BFD. + Copyright (C) 2000-2018 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* This file holds definitions specific to the i370 ELF ABI. Note + that most of this is not actually implemented by BFD. */ + +#ifndef _ELF_I370_H +#define _ELF_I370_H + +#include "elf/reloc-macros.h" + +/* Processor specific section headers, sh_type field */ + +#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \ + entries in this section \ + based on the address \ + specified in the associated \ + symbol table entry. */ + +#define EF_I370_RELOCATABLE 0x00010000 /* i370 -mrelocatable flag */ +#define EF_I370_RELOCATABLE_LIB 0x00008000 /* i370 -mrelocatable-lib flag */ + +/* i370 relocations + Note that there is really just one relocation that we currently + support (and only one that we seem to need, at the moment), and + that is the 31-bit address relocation. Note that the 370/390 + only supports a 31-bit (2GB) address space. */ + +START_RELOC_NUMBERS (i370_reloc_type) + RELOC_NUMBER (R_I370_NONE, 0) + RELOC_NUMBER (R_I370_ADDR31, 1) + RELOC_NUMBER (R_I370_ADDR32, 2) + RELOC_NUMBER (R_I370_ADDR16, 3) + RELOC_NUMBER (R_I370_REL31, 4) + RELOC_NUMBER (R_I370_REL32, 5) + RELOC_NUMBER (R_I370_ADDR12, 6) + RELOC_NUMBER (R_I370_REL12, 7) + RELOC_NUMBER (R_I370_ADDR8, 8) + RELOC_NUMBER (R_I370_REL8, 9) + RELOC_NUMBER (R_I370_COPY, 10) + RELOC_NUMBER (R_I370_RELATIVE, 11) +END_RELOC_NUMBERS (R_I370_max) + +#endif /* _ELF_I370_H */ diff --git a/include/elf/i860.h b/include/elf/i860.h new file mode 100644 index 00000000000..ec47b41053a --- /dev/null +++ b/include/elf/i860.h @@ -0,0 +1,66 @@ +/* i860 ELF support for BFD. + Copyright (C) 2000-2018 Free Software Foundation, Inc. + + Contributed by Jason Eckhardt . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _ELF_I860_H +#define _ELF_I860_H + +/* Note: i860 ELF is defined to use only RELA relocations. */ + +#include "elf/reloc-macros.h" + +START_RELOC_NUMBERS (elf_i860_reloc_type) + RELOC_NUMBER (R_860_NONE, 0x00) /* No reloc */ + RELOC_NUMBER (R_860_32, 0x01) /* S+A */ + RELOC_NUMBER (R_860_COPY, 0x02) /* No calculation */ + RELOC_NUMBER (R_860_GLOB_DAT, 0x03) /* S, Create GOT entry */ + RELOC_NUMBER (R_860_JUMP_SLOT, 0x04) /* S+A, Create PLT entry */ + RELOC_NUMBER (R_860_RELATIVE, 0x05) /* B+A, Adj by program base */ + RELOC_NUMBER (R_860_PC26, 0x30) /* (S+A-P) >> 2 */ + RELOC_NUMBER (R_860_PLT26, 0x31) /* (L+A-P) >> 2 */ + RELOC_NUMBER (R_860_PC16, 0x32) /* (S+A-P) >> 2 */ + RELOC_NUMBER (R_860_LOW0, 0x40) /* S+A */ + RELOC_NUMBER (R_860_SPLIT0, 0x42) /* S+A */ + RELOC_NUMBER (R_860_LOW1, 0x44) /* S+A */ + RELOC_NUMBER (R_860_SPLIT1, 0x46) /* S+A */ + RELOC_NUMBER (R_860_LOW2, 0x48) /* S+A */ + RELOC_NUMBER (R_860_SPLIT2, 0x4A) /* S+A */ + RELOC_NUMBER (R_860_LOW3, 0x4C) /* S+A */ + RELOC_NUMBER (R_860_LOGOT0, 0x50) /* G */ + RELOC_NUMBER (R_860_SPGOT0, 0x52) /* G */ + RELOC_NUMBER (R_860_LOGOT1, 0x54) /* G */ + RELOC_NUMBER (R_860_SPGOT1, 0x56) /* G */ + RELOC_NUMBER (R_860_LOGOTOFF0, 0x60) /* O */ + RELOC_NUMBER (R_860_SPGOTOFF0, 0x62) /* O */ + RELOC_NUMBER (R_860_LOGOTOFF1, 0x64) /* O */ + RELOC_NUMBER (R_860_SPGOTOFF1, 0x66) /* O */ + RELOC_NUMBER (R_860_LOGOTOFF2, 0x68) /* O */ + RELOC_NUMBER (R_860_LOGOTOFF3, 0x6C) /* O */ + RELOC_NUMBER (R_860_LOPC, 0x70) /* (S+A-P) >> 2 */ + RELOC_NUMBER (R_860_HIGHADJ, 0x80) /* hiadj(S+A) */ + RELOC_NUMBER (R_860_HAGOT, 0x90) /* hiadj(G) */ + RELOC_NUMBER (R_860_HAGOTOFF, 0xA0) /* hiadj(O) */ + RELOC_NUMBER (R_860_HAPC, 0xB0) /* hiadj((S+A-P) >> 2) */ + RELOC_NUMBER (R_860_HIGH, 0xC0) /* (S+A) >> 16 */ + RELOC_NUMBER (R_860_HIGOT, 0xD0) /* G >> 16 */ + RELOC_NUMBER (R_860_HIGOTOFF, 0xE0) /* O */ +END_RELOC_NUMBERS (R_860_max) + +#endif diff --git a/include/elf/i960.h b/include/elf/i960.h new file mode 100644 index 00000000000..1b9a5870847 --- /dev/null +++ b/include/elf/i960.h @@ -0,0 +1,37 @@ +/* Intel 960 ELF support for BFD. + Copyright (C) 1999-2018 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _ELF_I960_H +#define _ELF_I960_H + +#include "elf/reloc-macros.h" + + +START_RELOC_NUMBERS (elf_i960_reloc_type) + RELOC_NUMBER (R_960_NONE, 0) + RELOC_NUMBER (R_960_12, 1) + RELOC_NUMBER (R_960_32, 2) + RELOC_NUMBER (R_960_IP24, 3) + RELOC_NUMBER (R_960_SUB, 4) + RELOC_NUMBER (R_960_OPTCALL, 5) + RELOC_NUMBER (R_960_OPTCALLX, 6) + RELOC_NUMBER (R_960_OPTCALLXA, 7) +END_RELOC_NUMBERS (R_960_max) + +#endif /* _ELF_I960_H */ -- 2.30.2