[PATCH 03/19] PRU Binutils port
Dimitar Dimitrov
dimitar@dinux.eu
Mon Dec 5 20:43:00 GMT 2016
More information about the Binutils mailing list
Mon Dec 5 20:43:00 GMT 2016
- Previous message (by thread): [PATCH 19/19] ld: testsuite: Fix test for targets with elf_symbol_leading_char
- Next message (by thread): [PATCH 03/19] PRU Binutils port
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2016-10-24 Dimitar Dimitrov <dimitar@dinux.eu> * binutils/readelf.c: Add PRU ELF and relocations. * include/elf/common.h: Add PRU ELF. * include/elf/pru.h: New file. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu> --- binutils/readelf.c | 24 ++++++++++++++++++++ include/elf/common.h | 2 +- include/elf/pru.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 include/elf/pru.h diff --git a/binutils/readelf.c b/binutils/readelf.c index c5a628f..6d70a6b 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -137,6 +137,7 @@ #include "elf/pj.h" #include "elf/ppc.h" #include "elf/ppc64.h" +#include "elf/pru.h" #include "elf/rl78.h" #include "elf/rx.h" #include "elf/s390.h" @@ -776,6 +777,7 @@ guess_is_rela (unsigned int e_machine) case EM_OR1K: case EM_PPC64: case EM_PPC: + case EM_PRU: case EM_RISCV: case EM_RL78: case EM_RX: @@ -1483,6 +1485,10 @@ dump_relocations (FILE * file, case EM_ALTERA_NIOS2: rtype = elf_nios2_reloc_type (type); break; + + case EM_PRU: + rtype = elf_pru_reloc_type (type); + break; } if (rtype == NULL) @@ -2370,6 +2376,7 @@ get_machine_name (unsigned e_machine) case EM_CSR_KALIMBA: return "CSR Kalimba architecture family"; case EM_Z80: return "Zilog Z80"; case EM_AMDGPU: return "AMD GPU architecture"; + case EM_PRU: return "TI PRU I/O processor"; default: snprintf (buff, sizeof (buff), _("<unknown>: 0x%x"), e_machine); return buff; @@ -11664,6 +11671,18 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, break; } + case EM_PRU: + { + switch (reloc_type) + { + case 42: /* R_PRU_DIFF8. */ + case 43: /* R_PRU_DIFF16. */ + case 44: /* R_PRU_DIFF32. */ + /* Nothing to do - diff value already stored. */ + return TRUE; + } + } + case EM_RL78: { static bfd_vma saved_sym1 = 0; @@ -11834,6 +11853,8 @@ is_32bit_abs_reloc (unsigned int reloc_type) return reloc_type == 1; /* R_PPC64_ADDR32. */ case EM_PPC: return reloc_type == 1; /* R_PPC_ADDR32. */ + case EM_PRU: + return reloc_type == 47; /* R_PRU_BFD_RELOC_32. */ case EM_RISCV: return reloc_type == 1; /* R_RISCV_32. */ case EM_RL78: @@ -12116,6 +12137,8 @@ is_16bit_abs_reloc (unsigned int reloc_type) return reloc_type == 9; /* R_NIOS_16. */ case EM_OR1K: return reloc_type == 2; /* R_OR1K_16. */ + case EM_PRU: + return reloc_type == 48; /* R_PRU_BFD_RELOC_16. */ case EM_TI_C6000: return reloc_type == 2; /* R_C6000_ABS16. */ case EM_VISIUM: @@ -12162,6 +12185,7 @@ is_none_reloc (unsigned int reloc_type) case EM_PARISC: /* R_PARISC_NONE. */ case EM_PPC64: /* R_PPC64_NONE. */ case EM_PPC: /* R_PPC_NONE. */ + case EM_PRU: /* R_PRU_NONE. */ case EM_RISCV: /* R_RISCV_NONE. */ case EM_S390: /* R_390_NONE. */ case EM_S390_OLD: diff --git a/include/elf/common.h b/include/elf/common.h index da79613..d5673c5 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -248,7 +248,7 @@ #define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP family */ #define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP family */ #define EM_res143 143 /* Reserved */ -#define EM_res144 144 /* Reserved */ +#define EM_PRU 144 /* Texas Instruments PRUSS */ #define EM_res145 145 /* Reserved */ #define EM_res146 146 /* Reserved */ #define EM_res147 147 /* Reserved */ diff --git a/include/elf/pru.h b/include/elf/pru.h new file mode 100644 index 0000000..e814fe4 --- /dev/null +++ b/include/elf/pru.h @@ -0,0 +1,62 @@ +/* TI PRU ELF support for BFD. + Copyright (C) 2014-2016 Free Software Foundation, Inc. + Contributed by Dimitar Dimitrov <dimitar@dinux.eu> + + 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 TI PRU ELF ABI. Note + that most of this is not actually implemented by BFD. */ + +#ifndef _ELF_PRU_H +#define _ELF_PRU_H + +#include "elf/reloc-macros.h" + +START_RELOC_NUMBERS (elf_pru_reloc_type) + RELOC_NUMBER (R_PRU_NONE, 0) + + /* The ELF output from TI's CGT may be considered the standard + ELF format for PRU. But it is not documented. To avoid issues + with linking between TI and GNU object files, we use private + relocation numbers. For a small embedded target like PRU this + should not be a big deal. */ + RELOC_NUMBER (R_PRU_U8, 32) + RELOC_NUMBER (R_PRU_U16, 33) + RELOC_NUMBER (R_PRU_HI16, 34) + RELOC_NUMBER (R_PRU_HI16_RLZ, 35) + RELOC_NUMBER (R_PRU_LO16, 36) + RELOC_NUMBER (R_PRU_U16_PMEMIMM, 37) + RELOC_NUMBER (R_PRU_S10_PCREL, 38) + RELOC_NUMBER (R_PRU_U8_PCREL, 39) + RELOC_NUMBER (R_PRU_32_PMEM, 40) + RELOC_NUMBER (R_PRU_16_PMEM, 41) + RELOC_NUMBER (R_PRU_DIFF8, 42) + RELOC_NUMBER (R_PRU_DIFF16, 43) + RELOC_NUMBER (R_PRU_DIFF32, 44) + RELOC_NUMBER (R_PRU_DIFF16_PMEM, 45) + RELOC_NUMBER (R_PRU_DIFF32_PMEM, 46) + RELOC_NUMBER (R_PRU_BFD_RELOC_32, 47) + RELOC_NUMBER (R_PRU_BFD_RELOC_16, 48) + RELOC_NUMBER (R_PRU_BFD_RELOC_8, 49) + RELOC_NUMBER (R_PRU_ILLEGAL, 50) +END_RELOC_NUMBERS (R_PRU_maxext) + +/* Processor-specific section flags. */ + +#endif /* _ELF_PRU_H */ -- 2.10.2
- Previous message (by thread): [PATCH 19/19] ld: testsuite: Fix test for targets with elf_symbol_leading_char
- Next message (by thread): [PATCH 03/19] PRU Binutils port
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list