xref: /netbsd-src/external/gpl3/binutils.old/dist/include/elf/arc.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* ARC ELF support for BFD.
2*e992f068Schristos    Copyright (C) 1995-2022 Free Software Foundation, Inc.
375fd0b74Schristos    Contributed by Doug Evans, (dje@cygnus.com)
475fd0b74Schristos 
575fd0b74Schristos    This file is part of BFD, the Binary File Descriptor library.
675fd0b74Schristos 
775fd0b74Schristos    This program is free software; you can redistribute it and/or modify
875fd0b74Schristos    it under the terms of the GNU General Public License as published by
975fd0b74Schristos    the Free Software Foundation; either version 3 of the License, or
1075fd0b74Schristos    (at your option) any later version.
1175fd0b74Schristos 
1275fd0b74Schristos    This program is distributed in the hope that it will be useful,
1375fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1475fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1575fd0b74Schristos    GNU General Public License for more details.
1675fd0b74Schristos 
1775fd0b74Schristos    You should have received a copy of the GNU General Public License
1875fd0b74Schristos    along with this program; if not, write to the Free Software
1975fd0b74Schristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
2075fd0b74Schristos    MA 02110-1301, USA.  */
2175fd0b74Schristos 
2275fd0b74Schristos /* This file holds definitions specific to the ARC ELF ABI.  */
2375fd0b74Schristos 
2475fd0b74Schristos #ifndef _ELF_ARC_H
2575fd0b74Schristos #define _ELF_ARC_H
2675fd0b74Schristos 
2775fd0b74Schristos #include "elf/reloc-macros.h"
2875fd0b74Schristos 
2975fd0b74Schristos /* Relocations.  */
3075fd0b74Schristos 
3175fd0b74Schristos #define ARC_RELOC_HOWTO(TYPE, VALUE, SIZE, BITSIZE, RELOC_FUNCTION, OVERFLOW, FORMULA) \
3275fd0b74Schristos   RELOC_NUMBER(R_##TYPE, VALUE)
3375fd0b74Schristos 
3475fd0b74Schristos START_RELOC_NUMBERS (elf_arc_reloc_type)
3575fd0b74Schristos #include "arc-reloc.def"
3675fd0b74Schristos END_RELOC_NUMBERS (R_ARC_max)
3775fd0b74Schristos 
3875fd0b74Schristos #undef ARC_RELOC_HOWTO
3975fd0b74Schristos 
4075fd0b74Schristos /* Processor specific flags for the ELF header e_flags field.  */
4175fd0b74Schristos 
4275fd0b74Schristos #define EF_ARC_MACH_MSK	 0x000000ff
4375fd0b74Schristos #define EF_ARC_OSABI_MSK 0x00000f00
4475fd0b74Schristos #define EF_ARC_ALL_MSK	 (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
4575fd0b74Schristos 
4675fd0b74Schristos /* Various CPU types.  These numbers are exposed in the ELF header flags
4775fd0b74Schristos    (e_flags field), and so must never change.  */
4875fd0b74Schristos #define E_ARC_MACH_ARC600	0x00000002
4975fd0b74Schristos #define E_ARC_MACH_ARC601	0x00000004
5075fd0b74Schristos #define E_ARC_MACH_ARC700	0x00000003
5175fd0b74Schristos #define EF_ARC_CPU_ARCV2EM      0x00000005
5275fd0b74Schristos #define EF_ARC_CPU_ARCV2HS      0x00000006
5375fd0b74Schristos 
5475fd0b74Schristos /* ARC Linux specific ABIs.  */
5575fd0b74Schristos #define E_ARC_OSABI_ORIG	0x00000000   /* MUST be 0 for back-compat.  */
5675fd0b74Schristos #define E_ARC_OSABI_V2		0x00000200
5775fd0b74Schristos #define E_ARC_OSABI_V3		0x00000300
58ede78133Schristos #define E_ARC_OSABI_V4		0x00000400
59ede78133Schristos #define E_ARC_OSABI_CURRENT	E_ARC_OSABI_V4
6075fd0b74Schristos /* Leave bits 0xf0 alone in case we ever have more than 16 cpu types.  */
6175fd0b74Schristos 
6275fd0b74Schristos /* File contains position independent code.  */
6375fd0b74Schristos 
6475fd0b74Schristos #define EF_ARC_PIC 0x00000100
6575fd0b74Schristos 
66ede78133Schristos /* Additional section types.  */
67ede78133Schristos #define SHT_ARC_ATTRIBUTES     0x70000001	/* Section holds attributes.  */
68ede78133Schristos 
69ede78133Schristos /* ARC ABI object attributes.  */
70ede78133Schristos enum {
71ede78133Schristos   /* 0-3 are generic.  */
72ede78133Schristos   Tag_ARC_PCS_config = 4,
73ede78133Schristos   Tag_ARC_CPU_base,
74ede78133Schristos   Tag_ARC_CPU_variation,
75ede78133Schristos   Tag_ARC_CPU_name,
76ede78133Schristos   Tag_ARC_ABI_rf16,
77ede78133Schristos   Tag_ARC_ABI_osver,
78ede78133Schristos   Tag_ARC_ABI_sda,
79ede78133Schristos   Tag_ARC_ABI_pic,
80ede78133Schristos   Tag_ARC_ABI_tls,
81ede78133Schristos   Tag_ARC_ABI_enumsize,
82ede78133Schristos   Tag_ARC_ABI_exceptions,
83ede78133Schristos   Tag_ARC_ABI_double_size,
84ede78133Schristos   Tag_ARC_ISA_config,
85ede78133Schristos   Tag_ARC_ISA_apex,
86012573ebSchristos   Tag_ARC_ISA_mpy_option,
87012573ebSchristos   Tag_ARC_ATR_version = 20
88ede78133Schristos };
89ede78133Schristos 
90ede78133Schristos /* Values for the Tag_ARC_cpu_base attribute.  */
91ede78133Schristos #define TAG_CPU_NONE	  0
92ede78133Schristos #define TAG_CPU_ARC6xx	  1
93ede78133Schristos #define TAG_CPU_ARC7xx	  2
94ede78133Schristos #define TAG_CPU_ARCEM	  3
95ede78133Schristos #define TAG_CPU_ARCHS	  4
96ede78133Schristos 
9775fd0b74Schristos #endif /* _ELF_ARC_H */
98