xref: /netbsd-src/external/gpl3/gdb.old/dist/libctf/elf.h (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
17d62b00eSchristos /* This file defines standard ELF types, structures, and macros.
2*6881a400Schristos    Copyright (C) 1995-2022 Free Software Foundation, Inc.
37d62b00eSchristos 
47d62b00eSchristos    This file is part of libctf.
57d62b00eSchristos 
67d62b00eSchristos    libctf is free software; you can redistribute it and/or modify it under
77d62b00eSchristos    the terms of the GNU General Public License as published by the Free
87d62b00eSchristos    Software Foundation; either version 3, or (at your option) any later
97d62b00eSchristos    version.
107d62b00eSchristos 
117d62b00eSchristos    This program is distributed in the hope that it will be useful, but
127d62b00eSchristos    WITHOUT ANY WARRANTY; without even the implied warranty of
137d62b00eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
147d62b00eSchristos    See the GNU General Public License for more details.
157d62b00eSchristos 
167d62b00eSchristos    You should have received a copy of the GNU General Public License
177d62b00eSchristos    along with this program; see the file COPYING.  If not see
187d62b00eSchristos    <http://www.gnu.org/licenses/>.  */
197d62b00eSchristos 
207d62b00eSchristos #ifndef _CTF_ELF_H
217d62b00eSchristos #define _CTF_ELF_H
227d62b00eSchristos 
237d62b00eSchristos #include "config.h"
247d62b00eSchristos #include "ansidecl.h"
257d62b00eSchristos #include <stdint.h>
267d62b00eSchristos #include "elf/common.h"
277d62b00eSchristos #include "elf/external.h"
287d62b00eSchristos 
297d62b00eSchristos typedef uint32_t Elf32_Word;
307d62b00eSchristos typedef uint32_t Elf64_Word;
317d62b00eSchristos typedef uint32_t Elf32_Addr;
327d62b00eSchristos typedef uint64_t Elf64_Addr;
337d62b00eSchristos typedef uint64_t Elf64_Xword;
347d62b00eSchristos typedef uint16_t Elf32_Section;
357d62b00eSchristos typedef uint16_t Elf64_Section;
367d62b00eSchristos 
377d62b00eSchristos #define SHN_EXTABS	0xFFF1		/* Associated symbol is absolute */
387d62b00eSchristos 
397d62b00eSchristos /* Symbol table entry.  */
407d62b00eSchristos 
417d62b00eSchristos typedef struct
427d62b00eSchristos {
437d62b00eSchristos   Elf32_Word	st_name;		/* Symbol name (string tbl index) */
447d62b00eSchristos   Elf32_Addr	st_value;		/* Symbol value */
457d62b00eSchristos   Elf32_Word	st_size;		/* Symbol size */
467d62b00eSchristos   unsigned char	st_info;		/* Symbol type and binding */
477d62b00eSchristos   unsigned char	st_other;		/* Symbol visibility */
487d62b00eSchristos   Elf32_Section	st_shndx;		/* Section index */
497d62b00eSchristos } Elf32_Sym;
507d62b00eSchristos 
517d62b00eSchristos typedef struct
527d62b00eSchristos {
537d62b00eSchristos   Elf64_Word	st_name;		/* Symbol name (string tbl index) */
547d62b00eSchristos   unsigned char	st_info;		/* Symbol type and binding */
557d62b00eSchristos   unsigned char st_other;		/* Symbol visibility */
567d62b00eSchristos   Elf64_Section	st_shndx;		/* Section index */
577d62b00eSchristos   Elf64_Addr	st_value;		/* Symbol value */
587d62b00eSchristos   Elf64_Xword	st_size;		/* Symbol size */
597d62b00eSchristos } Elf64_Sym;
607d62b00eSchristos 
617d62b00eSchristos #endif	/* _CTF_ELF_H */
62