xref: /netbsd-src/external/gpl3/gdb/dist/include/elf/m68k.h (revision 02f41505626a9ceb584d30d0789203495760ac88)
198b9484cSchristos /* MC68k ELF support for BFD.
2*02f41505Schristos    Copyright (C) 1998-2024 Free Software Foundation, Inc.
398b9484cSchristos 
498b9484cSchristos    This file is part of BFD, the Binary File Descriptor library.
598b9484cSchristos 
698b9484cSchristos    This program is free software; you can redistribute it and/or modify
798b9484cSchristos    it under the terms of the GNU General Public License as published by
898b9484cSchristos    the Free Software Foundation; either version 3 of the License, or
998b9484cSchristos    (at your option) any later version.
1098b9484cSchristos 
1198b9484cSchristos    This program is distributed in the hope that it will be useful,
1298b9484cSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1398b9484cSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1498b9484cSchristos    GNU General Public License for more details.
1598b9484cSchristos 
1698b9484cSchristos    You should have received a copy of the GNU General Public License
1798b9484cSchristos    along with this program; if not, write to the Free Software Foundation,
1898b9484cSchristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1998b9484cSchristos 
2098b9484cSchristos #ifndef _ELF_M68K_H
2198b9484cSchristos #define _ELF_M68K_H
2298b9484cSchristos 
2398b9484cSchristos #include "elf/reloc-macros.h"
2498b9484cSchristos 
2598b9484cSchristos /* Relocation types.  */
2698b9484cSchristos START_RELOC_NUMBERS (elf_m68k_reloc_type)
2798b9484cSchristos   RELOC_NUMBER (R_68K_NONE, 0)		/* No reloc */
2898b9484cSchristos   RELOC_NUMBER (R_68K_32, 1)		/* Direct 32 bit  */
2998b9484cSchristos   RELOC_NUMBER (R_68K_16, 2)		/* Direct 16 bit  */
3098b9484cSchristos   RELOC_NUMBER (R_68K_8, 3)		/* Direct 8 bit  */
3198b9484cSchristos   RELOC_NUMBER (R_68K_PC32, 4)		/* PC relative 32 bit */
3298b9484cSchristos   RELOC_NUMBER (R_68K_PC16, 5)		/* PC relative 16 bit */
3398b9484cSchristos   RELOC_NUMBER (R_68K_PC8, 6)		/* PC relative 8 bit */
3498b9484cSchristos   RELOC_NUMBER (R_68K_GOT32, 7)		/* 32 bit PC relative GOT entry */
3598b9484cSchristos   RELOC_NUMBER (R_68K_GOT16, 8)		/* 16 bit PC relative GOT entry */
3698b9484cSchristos   RELOC_NUMBER (R_68K_GOT8, 9)		/* 8 bit PC relative GOT entry */
3798b9484cSchristos   RELOC_NUMBER (R_68K_GOT32O, 10)	/* 32 bit GOT offset */
3898b9484cSchristos   RELOC_NUMBER (R_68K_GOT16O, 11)	/* 16 bit GOT offset */
3998b9484cSchristos   RELOC_NUMBER (R_68K_GOT8O, 12)	/* 8 bit GOT offset */
4098b9484cSchristos   RELOC_NUMBER (R_68K_PLT32, 13)	/* 32 bit PC relative PLT address */
4198b9484cSchristos   RELOC_NUMBER (R_68K_PLT16, 14)	/* 16 bit PC relative PLT address */
4298b9484cSchristos   RELOC_NUMBER (R_68K_PLT8, 15)		/* 8 bit PC relative PLT address */
4398b9484cSchristos   RELOC_NUMBER (R_68K_PLT32O, 16)	/* 32 bit PLT offset */
4498b9484cSchristos   RELOC_NUMBER (R_68K_PLT16O, 17)	/* 16 bit PLT offset */
4598b9484cSchristos   RELOC_NUMBER (R_68K_PLT8O, 18)	/* 8 bit PLT offset */
4698b9484cSchristos   RELOC_NUMBER (R_68K_COPY, 19)		/* Copy symbol at runtime */
4798b9484cSchristos   RELOC_NUMBER (R_68K_GLOB_DAT, 20)	/* Create GOT entry */
4898b9484cSchristos   RELOC_NUMBER (R_68K_JMP_SLOT, 21)	/* Create PLT entry */
4998b9484cSchristos   RELOC_NUMBER (R_68K_RELATIVE, 22)	/* Adjust by program base */
5098b9484cSchristos   /* These are GNU extensions to enable C++ vtable garbage collection.  */
5198b9484cSchristos   RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23)
5298b9484cSchristos   RELOC_NUMBER (R_68K_GNU_VTENTRY, 24)
5398b9484cSchristos   /* TLS static relocations.  */
5498b9484cSchristos   RELOC_NUMBER (R_68K_TLS_GD32, 25)
5598b9484cSchristos   RELOC_NUMBER (R_68K_TLS_GD16, 26)
5698b9484cSchristos   RELOC_NUMBER (R_68K_TLS_GD8, 27)
5798b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDM32, 28)
5898b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDM16, 29)
5998b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDM8, 30)
6098b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDO32, 31)
6198b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDO16, 32)
6298b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LDO8, 33)
6398b9484cSchristos   RELOC_NUMBER (R_68K_TLS_IE32, 34)
6498b9484cSchristos   RELOC_NUMBER (R_68K_TLS_IE16, 35)
6598b9484cSchristos   RELOC_NUMBER (R_68K_TLS_IE8, 36)
6698b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LE32, 37)
6798b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LE16, 38)
6898b9484cSchristos   RELOC_NUMBER (R_68K_TLS_LE8, 39)
6998b9484cSchristos   RELOC_NUMBER (R_68K_TLS_DTPMOD32, 40)
7098b9484cSchristos   RELOC_NUMBER (R_68K_TLS_DTPREL32, 41)
7198b9484cSchristos   RELOC_NUMBER (R_68K_TLS_TPREL32, 42)
7298b9484cSchristos END_RELOC_NUMBERS (R_68K_max)
7398b9484cSchristos 
7498b9484cSchristos /* We use the top 24 bits to encode information about the
7598b9484cSchristos    architecture variant.  */
7698b9484cSchristos #define EF_M68K_CPU32    0x00810000
7798b9484cSchristos #define EF_M68K_M68000   0x01000000
7898b9484cSchristos #define EF_M68K_CFV4E    0x00008000
7998b9484cSchristos #define EF_M68K_FIDO     0x02000000
8098b9484cSchristos #define EF_M68K_ARCH_MASK						\
8198b9484cSchristos   (EF_M68K_M68000 | EF_M68K_CPU32 | EF_M68K_CFV4E | EF_M68K_FIDO)
8298b9484cSchristos 
8398b9484cSchristos /* We use the bottom 8 bits to encode information about the
8498b9484cSchristos    coldfire variant.  If we use any of these bits, the top 24 bits are
8598b9484cSchristos    either 0 or EF_M68K_CFV4E.  */
8698b9484cSchristos #define EF_M68K_CF_ISA_MASK	0x0F  /* Which ISA */
8798b9484cSchristos #define EF_M68K_CF_ISA_A_NODIV	0x01  /* ISA A except for div */
8898b9484cSchristos #define EF_M68K_CF_ISA_A	0x02
8998b9484cSchristos #define EF_M68K_CF_ISA_A_PLUS	0x03
9098b9484cSchristos #define EF_M68K_CF_ISA_B_NOUSP	0x04  /* ISA_B except for USP */
9198b9484cSchristos #define EF_M68K_CF_ISA_B	0x05
9298b9484cSchristos #define EF_M68K_CF_ISA_C	0x06
9398b9484cSchristos #define EF_M68K_CF_ISA_C_NODIV	0x07  /* ISA C except for div */
9498b9484cSchristos #define EF_M68K_CF_MAC_MASK	0x30
9598b9484cSchristos #define EF_M68K_CF_MAC		0x10  /* MAC */
9698b9484cSchristos #define EF_M68K_CF_EMAC		0x20  /* EMAC */
9798b9484cSchristos #define EF_M68K_CF_EMAC_B	0x30  /* EMAC_B */
9898b9484cSchristos #define EF_M68K_CF_FLOAT	0x40  /* Has float insns */
9998b9484cSchristos #define EF_M68K_CF_MASK		0xFF
10098b9484cSchristos 
1018dffb485Schristos /* GNU object attribute tags.  */
1028dffb485Schristos enum
1038dffb485Schristos {
1048dffb485Schristos   /* 0-3 are generic.  */
1058dffb485Schristos 
1068dffb485Schristos   /* FP ABI, low 2 bits:
1078dffb485Schristos      1 for double precision hard-float,
1088dffb485Schristos      2 for soft-float,
1098dffb485Schristos      0 for not tagged or not using any ABIs affected by the differences. */
1108dffb485Schristos   Tag_GNU_M68K_ABI_FP = 4,
1118dffb485Schristos };
1128dffb485Schristos 
11398b9484cSchristos #endif
114