xref: /netbsd-src/external/gpl3/binutils.old/dist/include/elf/mep.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* Toshiba MeP ELF support for BFD.
2*e992f068Schristos    Copyright (C) 2001-2022 Free Software Foundation, Inc.
375fd0b74Schristos 
475fd0b74Schristos    This file is part of BFD, the Binary File Descriptor library.
575fd0b74Schristos 
675fd0b74Schristos    This program is free software; you can redistribute it and/or modify
775fd0b74Schristos    it under the terms of the GNU General Public License as published by
875fd0b74Schristos    the Free Software Foundation; either version 3 of the License, or
975fd0b74Schristos    (at your option) any later version.
1075fd0b74Schristos 
1175fd0b74Schristos    This program is distributed in the hope that it will be useful,
1275fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1375fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1475fd0b74Schristos    GNU General Public License for more details.
1575fd0b74Schristos 
1675fd0b74Schristos    You should have received a copy of the GNU General Public License
1775fd0b74Schristos    along with this program; if not, write to the Free Software Foundation,
1875fd0b74Schristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1975fd0b74Schristos 
2075fd0b74Schristos #ifndef _ELF_MEP_H
2175fd0b74Schristos #define _ELF_MEP_H
2275fd0b74Schristos 
2375fd0b74Schristos /* Bits in the sh_flags field of Elf32_Shdr:  */
2475fd0b74Schristos 
2575fd0b74Schristos #define SHF_MEP_VLIW		0x10000000	/* contains vliw code */
2675fd0b74Schristos 
2775fd0b74Schristos #include "elf/reloc-macros.h"
2875fd0b74Schristos 
2975fd0b74Schristos /* Note: The comments in this file are used by bfd/mep-relocs.pl to
3075fd0b74Schristos    build parts of bfd/elf32-mep.c.  */
3175fd0b74Schristos 
3275fd0b74Schristos /* Relocations.  */
3375fd0b74Schristos START_RELOC_NUMBERS (elf_mep_reloc_type)
3475fd0b74Schristos 
3575fd0b74Schristos   /* These two must appear first so that they are not processed by bfd/mep-relocs.pl.  */
3675fd0b74Schristos   RELOC_NUMBER (R_MEP_NONE, 0)
3775fd0b74Schristos   RELOC_NUMBER (R_RELC, 1)
3875fd0b74Schristos 
3975fd0b74Schristos   RELOC_NUMBER (R_MEP_8, 2)		/* 7654 3210                               U */
4075fd0b74Schristos   RELOC_NUMBER (R_MEP_16, 3)		/* fedc ba98 7654 3210                     U */
4175fd0b74Schristos   RELOC_NUMBER (R_MEP_32, 4)		/* vuts rqpo nmlk jihg fedc ba98 7654 3210 U */
4275fd0b74Schristos 
4375fd0b74Schristos   RELOC_NUMBER (R_MEP_PCREL8A2, 5)	/* ---- ---- 7654 321-                     S PC-REL */
4475fd0b74Schristos   RELOC_NUMBER (R_MEP_PCREL12A2, 6)	/* ---- ba98 7654 321-                     S PC-REL */
4575fd0b74Schristos   RELOC_NUMBER (R_MEP_PCREL17A2, 7)	/* ---- ---- ---- ---- gfed cba9 8765 4321 S PC-REL */
4675fd0b74Schristos   RELOC_NUMBER (R_MEP_PCREL24A2, 8)	/* ---- -765 4321 ---- nmlk jihg fedc ba98 S PC-REL */
4775fd0b74Schristos   RELOC_NUMBER (R_MEP_PCABS24A2, 9)	/* ---- -765 4321 ---- nmlk jihg fedc ba98 U */
4875fd0b74Schristos 
4975fd0b74Schristos   RELOC_NUMBER (R_MEP_LOW16, 10)	/* ---- ---- ---- ---- fedc ba98 7654 3210 U no-overflow */
5075fd0b74Schristos   RELOC_NUMBER (R_MEP_HI16U, 11)	/* ---- ---- ---- ---- vuts rqpo nmlk jihg U no-overflow */
5175fd0b74Schristos   RELOC_NUMBER (R_MEP_HI16S, 12)	/* ---- ---- ---- ---- vuts rqpo nmlk jihg S no-overflow */
5275fd0b74Schristos   RELOC_NUMBER (R_MEP_GPREL, 13)	/* ---- ---- ---- ---- fedc ba98 7654 3210 S GP-REL*/
5375fd0b74Schristos   RELOC_NUMBER (R_MEP_TPREL, 14)	/* ---- ---- ---- ---- fedc ba98 7654 3210 S TP-REL*/
5475fd0b74Schristos 
5575fd0b74Schristos   RELOC_NUMBER (R_MEP_TPREL7, 15)	/* ---- ---- -654 3210                     U TP-REL */
5675fd0b74Schristos   RELOC_NUMBER (R_MEP_TPREL7A2, 16)	/* ---- ---- -654 321-                     U TP-REL */
5775fd0b74Schristos   RELOC_NUMBER (R_MEP_TPREL7A4, 17)	/* ---- ---- -654 32--                     U TP-REL */
5875fd0b74Schristos 
5975fd0b74Schristos   RELOC_NUMBER (R_MEP_UIMM24, 18)	/* ---- ---- 7654 3210 nmlk jihg fedc ba98 U */
6075fd0b74Schristos   RELOC_NUMBER (R_MEP_ADDR24A4, 19)	/* ---- ---- 7654 32-- nmlk jihg fedc ba98 U */
6175fd0b74Schristos 
6275fd0b74Schristos   RELOC_NUMBER (R_MEP_GNU_VTINHERIT, 20) /* ---- ---- ---- ----                     U no-overflow */
6375fd0b74Schristos   RELOC_NUMBER (R_MEP_GNU_VTENTRY, 21)   /* ---- ---- ---- ----                     U no-overflow */
6475fd0b74Schristos 
6575fd0b74Schristos END_RELOC_NUMBERS(R_MEP_max)
6675fd0b74Schristos 
6775fd0b74Schristos #define	EF_MEP_CPU_MASK		0xff000000	/* specific cpu bits */
6875fd0b74Schristos #define EF_MEP_CPU_MEP          0x00000000	/* generic MEP */
6975fd0b74Schristos #define EF_MEP_CPU_C2   	0x01000000	/* MEP c2 */
7075fd0b74Schristos #define EF_MEP_CPU_C3   	0x02000000	/* MEP c3 */
7175fd0b74Schristos #define EF_MEP_CPU_C4   	0x04000000	/* MEP c4 */
7275fd0b74Schristos /* 5..7 are reseved */
7375fd0b74Schristos #define EF_MEP_CPU_C5   	0x08000000	/* MEP c5 */
7475fd0b74Schristos #define EF_MEP_CPU_H1   	0x10000000	/* MEP h1 */
7575fd0b74Schristos 
7675fd0b74Schristos #define EF_MEP_COP_MASK		0x00ff0000
7775fd0b74Schristos #define EF_MEP_COP_NONE		0x00000000
7875fd0b74Schristos #define EF_MEP_COP_AVC		0x00010000
7975fd0b74Schristos #define EF_MEP_COP_AVC2		0x00020000
8075fd0b74Schristos #define EF_MEP_COP_FMAX		0x00030000
8175fd0b74Schristos /* 4..5 are reserved.  */
8275fd0b74Schristos #define EF_MEP_COP_IVC2		0x00060000
8375fd0b74Schristos 
8475fd0b74Schristos #define EF_MEP_LIBRARY		0x00000100	/* Built as a library */
8575fd0b74Schristos 
8675fd0b74Schristos #define EF_MEP_INDEX_MASK       0x000000ff      /* Configuration index */
8775fd0b74Schristos 
8875fd0b74Schristos #define EF_MEP_ALL_FLAGS	0xffff01ff
8975fd0b74Schristos 
9075fd0b74Schristos #endif /* _ELF_MEP_H */
91