198b9484cSchristos /* M32R ELF support for BFD. 2*02f41505Schristos Copyright (C) 1996-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_M32R_H 2198b9484cSchristos #define _ELF_M32R_H 2298b9484cSchristos 2398b9484cSchristos #include "elf/reloc-macros.h" 2498b9484cSchristos 2598b9484cSchristos /* Relocations. */ 2698b9484cSchristos START_RELOC_NUMBERS (elf_m32r_reloc_type) 2798b9484cSchristos RELOC_NUMBER (R_M32R_NONE, 0) 2898b9484cSchristos /* REL relocations */ 2998b9484cSchristos RELOC_NUMBER (R_M32R_16, 1) /* For backwards compatibility. */ 3098b9484cSchristos RELOC_NUMBER (R_M32R_32, 2) /* For backwards compatibility. */ 3198b9484cSchristos RELOC_NUMBER (R_M32R_24, 3) /* For backwards compatibility. */ 3298b9484cSchristos RELOC_NUMBER (R_M32R_10_PCREL, 4) /* For backwards compatibility. */ 3398b9484cSchristos RELOC_NUMBER (R_M32R_18_PCREL, 5) /* For backwards compatibility. */ 3498b9484cSchristos RELOC_NUMBER (R_M32R_26_PCREL, 6) /* For backwards compatibility. */ 3598b9484cSchristos RELOC_NUMBER (R_M32R_HI16_ULO, 7) /* For backwards compatibility. */ 3698b9484cSchristos RELOC_NUMBER (R_M32R_HI16_SLO, 8) /* For backwards compatibility. */ 3798b9484cSchristos RELOC_NUMBER (R_M32R_LO16, 9) /* For backwards compatibility. */ 3898b9484cSchristos RELOC_NUMBER (R_M32R_SDA16, 10) /* For backwards compatibility. */ 3998b9484cSchristos RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11)/* For backwards compatibility. */ 4098b9484cSchristos RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) /* For backwards compatibility. */ 4198b9484cSchristos 4298b9484cSchristos /* RELA relocations */ 4398b9484cSchristos RELOC_NUMBER (R_M32R_16_RELA, 33) 4498b9484cSchristos RELOC_NUMBER (R_M32R_32_RELA, 34) 4598b9484cSchristos RELOC_NUMBER (R_M32R_24_RELA, 35) 4698b9484cSchristos RELOC_NUMBER (R_M32R_10_PCREL_RELA, 36) 4798b9484cSchristos RELOC_NUMBER (R_M32R_18_PCREL_RELA, 37) 4898b9484cSchristos RELOC_NUMBER (R_M32R_26_PCREL_RELA, 38) 4998b9484cSchristos RELOC_NUMBER (R_M32R_HI16_ULO_RELA, 39) 5098b9484cSchristos RELOC_NUMBER (R_M32R_HI16_SLO_RELA, 40) 5198b9484cSchristos RELOC_NUMBER (R_M32R_LO16_RELA, 41) 5298b9484cSchristos RELOC_NUMBER (R_M32R_SDA16_RELA, 42) 5398b9484cSchristos RELOC_NUMBER (R_M32R_RELA_GNU_VTINHERIT, 43) 5498b9484cSchristos RELOC_NUMBER (R_M32R_RELA_GNU_VTENTRY, 44) 5598b9484cSchristos 5698b9484cSchristos RELOC_NUMBER (R_M32R_REL32, 45) 5798b9484cSchristos 5898b9484cSchristos RELOC_NUMBER (R_M32R_GOT24, 48) 5998b9484cSchristos RELOC_NUMBER (R_M32R_26_PLTREL, 49) 6098b9484cSchristos RELOC_NUMBER (R_M32R_COPY, 50) 6198b9484cSchristos RELOC_NUMBER (R_M32R_GLOB_DAT, 51) 6298b9484cSchristos RELOC_NUMBER (R_M32R_JMP_SLOT, 52) 6398b9484cSchristos RELOC_NUMBER (R_M32R_RELATIVE, 53) 6498b9484cSchristos RELOC_NUMBER (R_M32R_GOTOFF, 54) 6598b9484cSchristos RELOC_NUMBER (R_M32R_GOTPC24, 55) 6698b9484cSchristos RELOC_NUMBER (R_M32R_GOT16_HI_ULO, 56) 6798b9484cSchristos RELOC_NUMBER (R_M32R_GOT16_HI_SLO, 57) 6898b9484cSchristos RELOC_NUMBER (R_M32R_GOT16_LO, 58) 6998b9484cSchristos RELOC_NUMBER (R_M32R_GOTPC_HI_ULO, 59) 7098b9484cSchristos RELOC_NUMBER (R_M32R_GOTPC_HI_SLO, 60) 7198b9484cSchristos RELOC_NUMBER (R_M32R_GOTPC_LO, 61) 7298b9484cSchristos RELOC_NUMBER (R_M32R_GOTOFF_HI_ULO, 62) 7398b9484cSchristos RELOC_NUMBER (R_M32R_GOTOFF_HI_SLO, 63) 7498b9484cSchristos RELOC_NUMBER (R_M32R_GOTOFF_LO, 64) 7598b9484cSchristos 7698b9484cSchristos END_RELOC_NUMBERS (R_M32R_max) 7798b9484cSchristos 7898b9484cSchristos /* Processor specific section indices. These sections do not actually 7998b9484cSchristos exist. Symbols with a st_shndx field corresponding to one of these 8098b9484cSchristos values have a special meaning. */ 8198b9484cSchristos 8298b9484cSchristos /* Small common symbol. */ 8398b9484cSchristos #define SHN_M32R_SCOMMON SHN_LORESERVE 8498b9484cSchristos 8598b9484cSchristos /* Processor specific section flags. */ 8698b9484cSchristos 8798b9484cSchristos /* This section contains sufficient relocs to be relaxed. 8898b9484cSchristos When relaxing, even relocs of branch instructions the assembler could 8998b9484cSchristos complete must be present because relaxing may cause the branch target to 9098b9484cSchristos move. */ 9198b9484cSchristos #define SHF_M32R_CAN_RELAX 0x10000000 9298b9484cSchristos 9398b9484cSchristos /* Processor specific flags for the ELF header e_flags field. */ 9498b9484cSchristos 9598b9484cSchristos /* Two bit m32r architecture field. */ 9698b9484cSchristos #define EF_M32R_ARCH 0x30000000 9798b9484cSchristos 9898b9484cSchristos /* m32r code. */ 9998b9484cSchristos #define E_M32R_ARCH 0x00000000 10098b9484cSchristos /* m32rx code. */ 10198b9484cSchristos #define E_M32RX_ARCH 0x10000000 10298b9484cSchristos /* m32r2 code. */ 10398b9484cSchristos #define E_M32R2_ARCH 0x20000000 10498b9484cSchristos 10598b9484cSchristos /* 12 bit m32r new instructions field. */ 10698b9484cSchristos #define EF_M32R_INST 0x0FFF0000 10798b9484cSchristos /* Parallel instructions. */ 10898b9484cSchristos #define E_M32R_HAS_PARALLEL 0x00010000 10998b9484cSchristos /* Hidden instructions for m32rx: 11098b9484cSchristos jc, jnc, macwhi-a, macwlo-a, mulwhi-a, mulwlo-a, sth+, shb+, sat, pcmpbz, 11198b9484cSchristos sc, snc. */ 11298b9484cSchristos #define E_M32R_HAS_HIDDEN_INST 0x00020000 11398b9484cSchristos /* New bit instructions: 11498b9484cSchristos clrpsw, setpsw, bset, bclr, btst. */ 11598b9484cSchristos #define E_M32R_HAS_BIT_INST 0x00040000 11698b9484cSchristos /* Floating point instructions. */ 11798b9484cSchristos #define E_M32R_HAS_FLOAT_INST 0x00080000 11898b9484cSchristos 11998b9484cSchristos /* 4 bit m32r ignore to check field. */ 12098b9484cSchristos #define EF_M32R_IGNORE 0x0000000F 12198b9484cSchristos 12298b9484cSchristos #endif 123