xref: /netbsd-src/external/gpl3/binutils/dist/include/elf/arc.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
12a6b7db3Sskrll /* ARC ELF support for BFD.
2*cb63e24eSchristos    Copyright (C) 1995-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll    Contributed by Doug Evans, (dje@cygnus.com)
42a6b7db3Sskrll 
52a6b7db3Sskrll    This file is part of BFD, the Binary File Descriptor library.
62a6b7db3Sskrll 
72a6b7db3Sskrll    This program is free software; you can redistribute it and/or modify
82a6b7db3Sskrll    it under the terms of the GNU General Public License as published by
945548106Schristos    the Free Software Foundation; either version 3 of the License, or
102a6b7db3Sskrll    (at your option) any later version.
112a6b7db3Sskrll 
122a6b7db3Sskrll    This program is distributed in the hope that it will be useful,
132a6b7db3Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
142a6b7db3Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
152a6b7db3Sskrll    GNU General Public License for more details.
162a6b7db3Sskrll 
172a6b7db3Sskrll    You should have received a copy of the GNU General Public License
182a6b7db3Sskrll    along with this program; if not, write to the Free Software
1945548106Schristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
2045548106Schristos    MA 02110-1301, USA.  */
212a6b7db3Sskrll 
222a6b7db3Sskrll /* This file holds definitions specific to the ARC ELF ABI.  */
232a6b7db3Sskrll 
242a6b7db3Sskrll #ifndef _ELF_ARC_H
252a6b7db3Sskrll #define _ELF_ARC_H
262a6b7db3Sskrll 
272a6b7db3Sskrll #include "elf/reloc-macros.h"
282a6b7db3Sskrll 
292a6b7db3Sskrll /* Relocations.  */
302a6b7db3Sskrll 
319573673dSchristos #define ARC_RELOC_HOWTO(TYPE, VALUE, SIZE, BITSIZE, RELOC_FUNCTION, OVERFLOW, FORMULA) \
329573673dSchristos   RELOC_NUMBER(R_##TYPE, VALUE)
339573673dSchristos 
342a6b7db3Sskrll START_RELOC_NUMBERS (elf_arc_reloc_type)
359573673dSchristos #include "arc-reloc.def"
362a6b7db3Sskrll END_RELOC_NUMBERS (R_ARC_max)
372a6b7db3Sskrll 
389573673dSchristos #undef ARC_RELOC_HOWTO
399573673dSchristos 
402a6b7db3Sskrll /* Processor specific flags for the ELF header e_flags field.  */
412a6b7db3Sskrll 
429573673dSchristos #define EF_ARC_MACH_MSK	 0x000000ff
439573673dSchristos #define EF_ARC_OSABI_MSK 0x00000f00
449573673dSchristos #define EF_ARC_ALL_MSK	 (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
459573673dSchristos 
468cbf5cb7Schristos /* Various CPU types.  These numbers are exposed in the ELF header flags
478cbf5cb7Schristos    (e_flags field), and so must never change.  */
489573673dSchristos #define E_ARC_MACH_ARC600	0x00000002
499573673dSchristos #define E_ARC_MACH_ARC601	0x00000004
509573673dSchristos #define E_ARC_MACH_ARC700	0x00000003
519573673dSchristos #define EF_ARC_CPU_ARCV2EM      0x00000005
529573673dSchristos #define EF_ARC_CPU_ARCV2HS      0x00000006
539573673dSchristos 
549573673dSchristos /* ARC Linux specific ABIs.  */
559573673dSchristos #define E_ARC_OSABI_ORIG	0x00000000   /* MUST be 0 for back-compat.  */
569573673dSchristos #define E_ARC_OSABI_V2		0x00000200
579573673dSchristos #define E_ARC_OSABI_V3		0x00000300
58fc4f4269Schristos #define E_ARC_OSABI_V4		0x00000400
59fc4f4269Schristos #define E_ARC_OSABI_CURRENT	E_ARC_OSABI_V4
602a6b7db3Sskrll /* Leave bits 0xf0 alone in case we ever have more than 16 cpu types.  */
612a6b7db3Sskrll 
622a6b7db3Sskrll /* File contains position independent code.  */
632a6b7db3Sskrll 
642a6b7db3Sskrll #define EF_ARC_PIC 0x00000100
652a6b7db3Sskrll 
66fc4f4269Schristos /* Additional section types.  */
67fc4f4269Schristos #define SHT_ARC_ATTRIBUTES     0x70000001	/* Section holds attributes.  */
68fc4f4269Schristos 
69fc4f4269Schristos /* ARC ABI object attributes.  */
70fc4f4269Schristos enum {
71fc4f4269Schristos   /* 0-3 are generic.  */
72fc4f4269Schristos   Tag_ARC_PCS_config = 4,
73fc4f4269Schristos   Tag_ARC_CPU_base,
74fc4f4269Schristos   Tag_ARC_CPU_variation,
75fc4f4269Schristos   Tag_ARC_CPU_name,
76fc4f4269Schristos   Tag_ARC_ABI_rf16,
77fc4f4269Schristos   Tag_ARC_ABI_osver,
78fc4f4269Schristos   Tag_ARC_ABI_sda,
79fc4f4269Schristos   Tag_ARC_ABI_pic,
80fc4f4269Schristos   Tag_ARC_ABI_tls,
81fc4f4269Schristos   Tag_ARC_ABI_enumsize,
82fc4f4269Schristos   Tag_ARC_ABI_exceptions,
83fc4f4269Schristos   Tag_ARC_ABI_double_size,
84fc4f4269Schristos   Tag_ARC_ISA_config,
85fc4f4269Schristos   Tag_ARC_ISA_apex,
866f4ced0bSchristos   Tag_ARC_ISA_mpy_option,
876f4ced0bSchristos   Tag_ARC_ATR_version = 20
88fc4f4269Schristos };
89fc4f4269Schristos 
90fc4f4269Schristos /* Values for the Tag_ARC_cpu_base attribute.  */
91fc4f4269Schristos #define TAG_CPU_NONE	  0
92fc4f4269Schristos #define TAG_CPU_ARC6xx	  1
93fc4f4269Schristos #define TAG_CPU_ARC7xx	  2
94fc4f4269Schristos #define TAG_CPU_ARCEM	  3
95fc4f4269Schristos #define TAG_CPU_ARCHS	  4
96fc4f4269Schristos 
972a6b7db3Sskrll #endif /* _ELF_ARC_H */
98