xref: /netbsd-src/external/gpl3/gdb/dist/include/elf/s390.h (revision e663ba6e3a60083e70de702e9d54bf486a57b6a7)
198b9484cSchristos /* 390 ELF support for BFD.
2*e663ba6eSchristos    Copyright (C) 2000-2024 Free Software Foundation, Inc.
398b9484cSchristos    Contributed by Carl B. Pedersen and Martin Schwidefsky.
498b9484cSchristos 
598b9484cSchristos    This file is part of BFD, the Binary File Descriptor library.
698b9484cSchristos 
798b9484cSchristos    This program is free software; you can redistribute it and/or modify
898b9484cSchristos    it under the terms of the GNU General Public License as published by
998b9484cSchristos    the Free Software Foundation; either version 3 of the License, or
1098b9484cSchristos    (at your option) any later version.
1198b9484cSchristos 
1298b9484cSchristos    This program is distributed in the hope that it will be useful,
1398b9484cSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1498b9484cSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1598b9484cSchristos    GNU General Public License for more details.
1698b9484cSchristos 
1798b9484cSchristos    You should have received a copy of the GNU General Public License
1898b9484cSchristos    along with this program; if not, write to the Free Software
1998b9484cSchristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
2098b9484cSchristos    02110-1301, USA.  */
2198b9484cSchristos 
2298b9484cSchristos #ifndef _ELF_390_H
2398b9484cSchristos #define _ELF_390_H
2498b9484cSchristos 
2598b9484cSchristos /* Processor specific flags for the ELF header e_flags field.  */
2698b9484cSchristos 
2798b9484cSchristos /* Symbol types.  */
2898b9484cSchristos 
2998b9484cSchristos #define STACK_REG		15		/* Global Stack reg */
3098b9484cSchristos #define BACKL_REG		14		/* Global Backlink reg */
3198b9484cSchristos #define BASE_REG		13		/* Global Base reg */
3298b9484cSchristos #define GOT_REG 		12		/* Holds addr of GOT */
3398b9484cSchristos 
3498b9484cSchristos #include "elf/reloc-macros.h"
3598b9484cSchristos 
3698b9484cSchristos /* Processor specific flags for the ELF header e_flags field.  */
3798b9484cSchristos 
3898b9484cSchristos #define EF_S390_HIGH_GPRS        0x00000001
3998b9484cSchristos 
404559860eSchristos /* Request 4k page table size.  */
414559860eSchristos #define PT_S390_PGSTE (PT_LOPROC + 0)
424559860eSchristos 
4398b9484cSchristos /* Relocation types.  */
4498b9484cSchristos 
4598b9484cSchristos START_RELOC_NUMBERS (elf_s390_reloc_type)
4698b9484cSchristos     RELOC_NUMBER (R_390_NONE, 0)	/* No reloc.  */
4798b9484cSchristos     RELOC_NUMBER (R_390_8, 1)		/* Direct 8 bit.  */
4898b9484cSchristos     RELOC_NUMBER (R_390_12, 2)		/* Direct 12 bit.  */
4998b9484cSchristos     RELOC_NUMBER (R_390_16, 3)		/* Direct 16 bit.  */
5098b9484cSchristos     RELOC_NUMBER (R_390_32, 4)		/* Direct 32 bit.  */
5198b9484cSchristos     RELOC_NUMBER (R_390_PC32, 5)	/* PC relative 32 bit.  */
5298b9484cSchristos     RELOC_NUMBER (R_390_GOT12, 6)	/* 12 bit GOT offset.  */
5398b9484cSchristos     RELOC_NUMBER (R_390_GOT32, 7)	/* 32 bit GOT offset.  */
5498b9484cSchristos     RELOC_NUMBER (R_390_PLT32, 8)	/* 32 bit PC relative PLT address.  */
5598b9484cSchristos     RELOC_NUMBER (R_390_COPY, 9)	/* Copy symbol at runtime.  */
5698b9484cSchristos     RELOC_NUMBER (R_390_GLOB_DAT, 10)	/* Create GOT entry.  */
5798b9484cSchristos     RELOC_NUMBER (R_390_JMP_SLOT, 11)	/* Create PLT entry.  */
5898b9484cSchristos     RELOC_NUMBER (R_390_RELATIVE, 12)	/* Adjust by program base.  */
5998b9484cSchristos     RELOC_NUMBER (R_390_GOTOFF32, 13)	/* 32 bit offset to GOT.  */
6098b9484cSchristos     RELOC_NUMBER (R_390_GOTPC, 14)	/* 32 bit PC relative offset to GOT.  */
6198b9484cSchristos     RELOC_NUMBER (R_390_GOT16, 15)	/* 16 bit GOT offset.  */
6298b9484cSchristos     RELOC_NUMBER (R_390_PC16, 16)	/* PC relative 16 bit.  */
6303467a24Schristos     RELOC_NUMBER (R_390_PC12DBL, 62)	/* PC relative 12 bit shifted by 1.  */
6403467a24Schristos     RELOC_NUMBER (R_390_PLT12DBL, 63)	/* 12 bit PC rel. PLT shifted by 1.  */
6598b9484cSchristos     RELOC_NUMBER (R_390_PC16DBL, 17)	/* PC relative 16 bit shifted by 1.  */
6698b9484cSchristos     RELOC_NUMBER (R_390_PLT16DBL, 18)	/* 16 bit PC rel. PLT shifted by 1.  */
6703467a24Schristos     RELOC_NUMBER (R_390_PC24DBL, 64)	/* PC relative 24 bit shifted by 1.  */
6803467a24Schristos     RELOC_NUMBER (R_390_PLT24DBL, 65)	/* 24 bit PC rel. PLT shifted by 1.  */
6998b9484cSchristos     RELOC_NUMBER (R_390_PC32DBL, 19)	/* PC relative 32 bit shifted by 1.  */
7098b9484cSchristos     RELOC_NUMBER (R_390_PLT32DBL, 20)	/* 32 bit PC rel. PLT shifted by 1.  */
7198b9484cSchristos     RELOC_NUMBER (R_390_GOTPCDBL, 21)	/* 32 bit PC rel. GOT shifted by 1.  */
7298b9484cSchristos     RELOC_NUMBER (R_390_64, 22)		/* Direct 64 bit.  */
7398b9484cSchristos     RELOC_NUMBER (R_390_PC64, 23)	/* PC relative 64 bit.  */
7498b9484cSchristos     RELOC_NUMBER (R_390_GOT64, 24)	/* 64 bit GOT offset.  */
7598b9484cSchristos     RELOC_NUMBER (R_390_PLT64, 25)	/* 64 bit PC relative PLT address.  */
7698b9484cSchristos     RELOC_NUMBER (R_390_GOTENT, 26)	/* 32 bit PC rel. to GOT entry >> 1. */
7798b9484cSchristos     RELOC_NUMBER (R_390_GOTOFF16, 27)   /* 16 bit offset to GOT. */
7898b9484cSchristos     RELOC_NUMBER (R_390_GOTOFF64, 28)   /* 64 bit offset to GOT. */
7998b9484cSchristos     RELOC_NUMBER (R_390_GOTPLT12, 29)   /* 12 bit offset to jump slot.  */
8098b9484cSchristos     RELOC_NUMBER (R_390_GOTPLT16, 30)   /* 16 bit offset to jump slot.  */
8198b9484cSchristos     RELOC_NUMBER (R_390_GOTPLT32, 31)   /* 32 bit offset to jump slot.  */
8298b9484cSchristos     RELOC_NUMBER (R_390_GOTPLT64, 32)   /* 64 bit offset to jump slot.  */
8398b9484cSchristos     RELOC_NUMBER (R_390_GOTPLTENT, 33)  /* 32 bit rel. offset to jump slot.  */
8498b9484cSchristos     RELOC_NUMBER (R_390_PLTOFF16, 34)   /* 16 bit offset from GOT to PLT. */
8598b9484cSchristos     RELOC_NUMBER (R_390_PLTOFF32, 35)   /* 32 bit offset from GOT to PLT. */
8698b9484cSchristos     RELOC_NUMBER (R_390_PLTOFF64, 36)   /* 16 bit offset from GOT to PLT. */
8798b9484cSchristos     RELOC_NUMBER (R_390_TLS_LOAD, 37)	/* Tag for load insn in TLS code. */
8898b9484cSchristos     RELOC_NUMBER (R_390_TLS_GDCALL, 38)	/* Tag for function call in general
8998b9484cSchristos 					   dynamic TLS code.  */
9098b9484cSchristos     RELOC_NUMBER (R_390_TLS_LDCALL, 39)	/* Tag for function call in local
9198b9484cSchristos 					   dynamic TLS code.  */
9298b9484cSchristos     RELOC_NUMBER (R_390_TLS_GD32, 40)	/* Direct 32 bit for general dynamic
9398b9484cSchristos 					   thread local data.  */
9498b9484cSchristos     RELOC_NUMBER (R_390_TLS_GD64, 41)	/* Direct 64 bit for general dynamic
9598b9484cSchristos 					   thread local data.  */
9698b9484cSchristos     RELOC_NUMBER (R_390_TLS_GOTIE12, 42)/* 12 bit GOT offset for static TLS
9798b9484cSchristos 					   block offset.  */
9898b9484cSchristos     RELOC_NUMBER (R_390_TLS_GOTIE32, 43)/* 32 bit GOT offset for static TLS
9998b9484cSchristos 					   block offset.  */
10098b9484cSchristos     RELOC_NUMBER (R_390_TLS_GOTIE64, 44)/* 64 bit GOT offset for static TLS
10198b9484cSchristos 					   block offset.  */
10298b9484cSchristos     RELOC_NUMBER (R_390_TLS_LDM32, 45)	/* Direct 32 bit for local dynamic
10398b9484cSchristos 					   thread local data in LD code.  */
10498b9484cSchristos     RELOC_NUMBER (R_390_TLS_LDM64, 46)	/* Direct 64 bit for local dynamic
10598b9484cSchristos 					   thread local data in LD code.  */
10698b9484cSchristos     RELOC_NUMBER (R_390_TLS_IE32, 47)	/* 32 bit address of GOT entry for
10798b9484cSchristos 					   negated static TLS block offset.  */
10898b9484cSchristos     RELOC_NUMBER (R_390_TLS_IE64, 48)	/* 64 bit address of GOT entry for
10998b9484cSchristos 					   negated static TLS block offset.  */
11098b9484cSchristos     RELOC_NUMBER (R_390_TLS_IEENT, 49)	/* 32 bit rel. offset to GOT entry for
11198b9484cSchristos 					   negated static TLS block offset.  */
11298b9484cSchristos     RELOC_NUMBER (R_390_TLS_LE32, 50)	/* 32 bit negated offset relative to
11398b9484cSchristos 					   static TLS block.  */
11498b9484cSchristos     RELOC_NUMBER (R_390_TLS_LE64, 51)	/* 64 bit negated offset relative to
11598b9484cSchristos 					   static TLS block.  */
11698b9484cSchristos     RELOC_NUMBER (R_390_TLS_LDO32, 52)	/* 32 bit offset relative to TLS
11798b9484cSchristos 					   block.  */
11898b9484cSchristos     RELOC_NUMBER (R_390_TLS_LDO64, 53)	/* 64 bit offset relative to TLS
11998b9484cSchristos 					   block.  */
12098b9484cSchristos     RELOC_NUMBER (R_390_TLS_DTPMOD, 54)	/* ID of module containing symbol.  */
12198b9484cSchristos     RELOC_NUMBER (R_390_TLS_DTPOFF, 55)	/* Offset in TLS block.  */
12298b9484cSchristos     RELOC_NUMBER (R_390_TLS_TPOFF, 56)	/* Negate offset in static TLS
12398b9484cSchristos 					   block.  */
12498b9484cSchristos     RELOC_NUMBER (R_390_20, 57)		/* Direct 20 bit.  */
12598b9484cSchristos     RELOC_NUMBER (R_390_GOT20, 58)	/* 20 bit GOT offset.  */
12698b9484cSchristos     RELOC_NUMBER (R_390_GOTPLT20, 59)	/* 20 bit offset to jump slot.  */
12798b9484cSchristos     RELOC_NUMBER (R_390_TLS_GOTIE20, 60)/* 20 bit GOT offset for statis TLS
12898b9484cSchristos 					   block offset.  */
129a2e2270fSchristos     RELOC_NUMBER (R_390_IRELATIVE, 61)  /* IFUNC relocation.  */
13098b9484cSchristos     /* These are GNU extensions to enable C++ vtable garbage collection.  */
13198b9484cSchristos     RELOC_NUMBER (R_390_GNU_VTINHERIT, 250)
13298b9484cSchristos     RELOC_NUMBER (R_390_GNU_VTENTRY, 251)
13398b9484cSchristos END_RELOC_NUMBERS (R_390_max)
13498b9484cSchristos 
135212397c6Schristos /* Object attribute tags.  */
136212397c6Schristos enum
137212397c6Schristos {
138212397c6Schristos   /* 0-3 are generic. */
139212397c6Schristos   /* 4 is reserved for the FP ABI. */
140212397c6Schristos 
141212397c6Schristos   /* Vector ABI:
142212397c6Schristos      0 = not affected by the vector ABI, or not tagged.
143212397c6Schristos      1 = software vector ABI being used
144212397c6Schristos      2 = hardware vector ABI being used.  */
145212397c6Schristos   Tag_GNU_S390_ABI_Vector = 8,
146212397c6Schristos };
147212397c6Schristos 
14898b9484cSchristos #endif /* _ELF_390_H */
149