mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-09 10:00:39 +00:00
The files in gdb/elf are now grabbed from /usr/src/contrib/gdb/include/elf.
This also applies to the last 2 commits for aout and coff. Oops ! This is based on /usr/ports/devel/gdb. 2.2 candidate ?
This commit is contained in:
parent
86cf61adfa
commit
69a0423e5e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21745
|
@ -1,227 +0,0 @@
|
|||
/* ELF support for BFD.
|
||||
Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by Fred Fish @ Cygnus Support, from information published
|
||||
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
||||
Programming Support Tools".
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
/* This file is part of ELF support for BFD, and contains the portions
|
||||
that are common to both the internal and external representations.
|
||||
For example, ELFMAG0 is the byte 0x7F in both the internal (in-memory)
|
||||
and external (in-file) representations. */
|
||||
|
||||
|
||||
/* Fields in e_ident[] */
|
||||
|
||||
#define EI_MAG0 0 /* File identification byte 0 index */
|
||||
#define ELFMAG0 0x7F /* Magic number byte 0 */
|
||||
|
||||
#define EI_MAG1 1 /* File identification byte 1 index */
|
||||
#define ELFMAG1 'E' /* Magic number byte 1 */
|
||||
|
||||
#define EI_MAG2 2 /* File identification byte 2 index */
|
||||
#define ELFMAG2 'L' /* Magic number byte 2 */
|
||||
|
||||
#define EI_MAG3 3 /* File identification byte 3 index */
|
||||
#define ELFMAG3 'F' /* Magic number byte 3 */
|
||||
|
||||
#define EI_CLASS 4 /* File class */
|
||||
#define ELFCLASSNONE 0 /* Invalid class */
|
||||
#define ELFCLASS32 1 /* 32-bit objects */
|
||||
#define ELFCLASS64 2 /* 64-bit objects */
|
||||
|
||||
#define EI_DATA 5 /* Data encoding */
|
||||
#define ELFDATANONE 0 /* Invalid data encoding */
|
||||
#define ELFDATA2LSB 1 /* 2's complement, little endian */
|
||||
#define ELFDATA2MSB 2 /* 2's complement, big endian */
|
||||
|
||||
#define EI_VERSION 6 /* File version */
|
||||
|
||||
#define EI_PAD 7 /* Start of padding bytes */
|
||||
|
||||
|
||||
/* Values for e_type, which identifies the object file type */
|
||||
|
||||
#define ET_NONE 0 /* No file type */
|
||||
#define ET_REL 1 /* Relocatable file */
|
||||
#define ET_EXEC 2 /* Executable file */
|
||||
#define ET_DYN 3 /* Shared object file */
|
||||
#define ET_CORE 4 /* Core file */
|
||||
#define ET_LOPROC 0xFF00 /* Processor-specific */
|
||||
#define ET_HIPROC 0xFFFF /* Processor-specific */
|
||||
|
||||
/* Values for e_machine, which identifies the architecture */
|
||||
|
||||
#define EM_NONE 0 /* No machine */
|
||||
#define EM_M32 1 /* AT&T WE 32100 */
|
||||
#define EM_SPARC 2 /* SUN SPARC */
|
||||
#define EM_386 3 /* Intel 80386 */
|
||||
#define EM_68K 4 /* Motorola m68k family */
|
||||
#define EM_88K 5 /* Motorola m88k family */
|
||||
#define EM_860 7 /* Intel 80860 */
|
||||
#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
|
||||
|
||||
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
|
||||
|
||||
#define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */
|
||||
|
||||
#define EM_PARISC 15 /* HPPA */
|
||||
|
||||
/* If it is necessary to assign new unofficial EM_* values, please pick large
|
||||
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
|
||||
with official or non-GNU unofficial values. */
|
||||
|
||||
/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */
|
||||
#define EM_CYGNUS_POWERPC 0x9025
|
||||
|
||||
/* Values for e_version */
|
||||
|
||||
#define EV_NONE 0 /* Invalid ELF version */
|
||||
#define EV_CURRENT 1 /* Current version */
|
||||
|
||||
/* Values for program header, p_type field */
|
||||
|
||||
#define PT_NULL 0 /* Program header table entry unused */
|
||||
#define PT_LOAD 1 /* Loadable program segment */
|
||||
#define PT_DYNAMIC 2 /* Dynamic linking information */
|
||||
#define PT_INTERP 3 /* Program interpreter */
|
||||
#define PT_NOTE 4 /* Auxiliary information */
|
||||
#define PT_SHLIB 5 /* Reserved, unspecified semantics */
|
||||
#define PT_PHDR 6 /* Entry for header table itself */
|
||||
#define PT_LOPROC 0x70000000 /* Processor-specific */
|
||||
#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */
|
||||
|
||||
/* Program segment permissions, in program header p_flags field */
|
||||
|
||||
#define PF_X (1 << 0) /* Segment is executable */
|
||||
#define PF_W (1 << 1) /* Segment is writable */
|
||||
#define PF_R (1 << 2) /* Segment is readable */
|
||||
#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
|
||||
|
||||
/* Values for section header, sh_type field */
|
||||
|
||||
#define SHT_NULL 0 /* Section header table entry unused */
|
||||
#define SHT_PROGBITS 1 /* Program specific (private) data */
|
||||
#define SHT_SYMTAB 2 /* Link editing symbol table */
|
||||
#define SHT_STRTAB 3 /* A string table */
|
||||
#define SHT_RELA 4 /* Relocation entries with addends */
|
||||
#define SHT_HASH 5 /* A symbol hash table */
|
||||
#define SHT_DYNAMIC 6 /* Information for dynamic linking */
|
||||
#define SHT_NOTE 7 /* Information that marks file */
|
||||
#define SHT_NOBITS 8 /* Section occupies no space in file */
|
||||
#define SHT_REL 9 /* Relocation entries, no addends */
|
||||
#define SHT_SHLIB 10 /* Reserved, unspecified semantics */
|
||||
#define SHT_DYNSYM 11 /* Dynamic linking symbol table */
|
||||
#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */
|
||||
#define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */
|
||||
#define SHT_LOUSER 0x80000000 /* Application-specific semantics */
|
||||
#define SHT_HIUSER 0x8FFFFFFF /* Application-specific semantics */
|
||||
|
||||
/* Values for section header, sh_flags field */
|
||||
|
||||
#define SHF_WRITE (1 << 0) /* Writable data during execution */
|
||||
#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
|
||||
#define SHF_EXECINSTR (1 << 2) /* Executable machine instructions */
|
||||
#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */
|
||||
|
||||
/* Values of note segment descriptor types for core files. */
|
||||
|
||||
#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
|
||||
#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
|
||||
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
|
||||
|
||||
/* Values of note segment descriptor types for object files. */
|
||||
/* (Only for hppa right now. Should this be moved elsewhere?) */
|
||||
|
||||
#define NT_VERSION 1 /* Contains a version string. */
|
||||
|
||||
/* These three macros disassemble and assemble a symbol table st_info field,
|
||||
which contains the symbol binding and symbol type. The STB_ and STT_
|
||||
defines identify the binding and type. */
|
||||
|
||||
#define ELF_ST_BIND(val) (((unsigned int)(val)) >> 4)
|
||||
#define ELF_ST_TYPE(val) ((val) & 0xF)
|
||||
#define ELF_ST_INFO(bind,type) (((bind) << 4) + ((type) & 0xF))
|
||||
|
||||
#define STN_UNDEF 0 /* undefined symbol index */
|
||||
|
||||
#define STB_LOCAL 0 /* Symbol not visible outside obj */
|
||||
#define STB_GLOBAL 1 /* Symbol visible outside obj */
|
||||
#define STB_WEAK 2 /* Like globals, lower precedence */
|
||||
#define STB_LOPROC 13 /* Application-specific semantics */
|
||||
#define STB_HIPROC 15 /* Application-specific semantics */
|
||||
|
||||
#define STT_NOTYPE 0 /* Symbol type is unspecified */
|
||||
#define STT_OBJECT 1 /* Symbol is a data object */
|
||||
#define STT_FUNC 2 /* Symbol is a code object */
|
||||
#define STT_SECTION 3 /* Symbol associated with a section */
|
||||
#define STT_FILE 4 /* Symbol gives a file name */
|
||||
#define STT_LOPROC 13 /* Application-specific semantics */
|
||||
#define STT_HIPROC 15 /* Application-specific semantics */
|
||||
|
||||
/* Special section indices, which may show up in st_shndx fields, among
|
||||
other places. */
|
||||
|
||||
#define SHN_UNDEF 0 /* Undefined section reference */
|
||||
#define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */
|
||||
#define SHN_LOPROC 0xFF00 /* Begin range of appl-specific */
|
||||
#define SHN_HIPROC 0xFF1F /* End range of appl-specific */
|
||||
#define SHN_ABS 0xFFF1 /* Associated symbol is absolute */
|
||||
#define SHN_COMMON 0xFFF2 /* Associated symbol is in common */
|
||||
#define SHN_HIRESERVE 0xFFFF /* End range of reserved indices */
|
||||
|
||||
/* relocation info handling macros */
|
||||
|
||||
#define ELF32_R_SYM(i) ((i) >> 8)
|
||||
#define ELF32_R_TYPE(i) ((i) & 0xff)
|
||||
#define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff))
|
||||
|
||||
#define ELF64_R_SYM(i) ((i) >> 32)
|
||||
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
|
||||
#define ELF64_R_INFO(s,t) (((bfd_vma) (s) << 32) + (bfd_vma) (t))
|
||||
|
||||
/* Dynamic section tags */
|
||||
|
||||
#define DT_NULL 0
|
||||
#define DT_NEEDED 1
|
||||
#define DT_PLTRELSZ 2
|
||||
#define DT_PLTGOT 3
|
||||
#define DT_HASH 4
|
||||
#define DT_STRTAB 5
|
||||
#define DT_SYMTAB 6
|
||||
#define DT_RELA 7
|
||||
#define DT_RELASZ 8
|
||||
#define DT_RELAENT 9
|
||||
#define DT_STRSZ 10
|
||||
#define DT_SYMENT 11
|
||||
#define DT_INIT 12
|
||||
#define DT_FINI 13
|
||||
#define DT_SONAME 14
|
||||
#define DT_RPATH 15
|
||||
#define DT_SYMBOLIC 16
|
||||
#define DT_REL 17
|
||||
#define DT_RELSZ 18
|
||||
#define DT_RELENT 19
|
||||
#define DT_PLTREL 20
|
||||
#define DT_DEBUG 21
|
||||
#define DT_TEXTREL 22
|
||||
#define DT_JMPREL 23
|
||||
#define DT_LOPROC 0x70000000
|
||||
#define DT_HIPROC 0x7fffffff
|
|
@ -1,314 +0,0 @@
|
|||
/* Declarations and definitions of codes relating to the DWARF symbolic
|
||||
debugging information format.
|
||||
|
||||
Written by Ron Guilmette (rfg@ncd.com)
|
||||
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* This file is derived from the DWARF specification (a public document)
|
||||
Revision 1.0.1 (April 8, 1992) developed by the UNIX International
|
||||
Programming Languages Special Interest Group (UI/PLSIG) and distributed
|
||||
by UNIX International. Copies of this specification are available from
|
||||
UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
|
||||
*/
|
||||
|
||||
/* Tag names and codes. */
|
||||
|
||||
enum dwarf_tag {
|
||||
TAG_padding = 0x0000,
|
||||
TAG_array_type = 0x0001,
|
||||
TAG_class_type = 0x0002,
|
||||
TAG_entry_point = 0x0003,
|
||||
TAG_enumeration_type = 0x0004,
|
||||
TAG_formal_parameter = 0x0005,
|
||||
TAG_global_subroutine = 0x0006,
|
||||
TAG_global_variable = 0x0007,
|
||||
/* 0x0008 -- reserved */
|
||||
/* 0x0009 -- reserved */
|
||||
TAG_label = 0x000a,
|
||||
TAG_lexical_block = 0x000b,
|
||||
TAG_local_variable = 0x000c,
|
||||
TAG_member = 0x000d,
|
||||
/* 0x000e -- reserved */
|
||||
TAG_pointer_type = 0x000f,
|
||||
TAG_reference_type = 0x0010,
|
||||
TAG_compile_unit = 0x0011,
|
||||
TAG_string_type = 0x0012,
|
||||
TAG_structure_type = 0x0013,
|
||||
TAG_subroutine = 0x0014,
|
||||
TAG_subroutine_type = 0x0015,
|
||||
TAG_typedef = 0x0016,
|
||||
TAG_union_type = 0x0017,
|
||||
TAG_unspecified_parameters = 0x0018,
|
||||
TAG_variant = 0x0019,
|
||||
TAG_common_block = 0x001a,
|
||||
TAG_common_inclusion = 0x001b,
|
||||
TAG_inheritance = 0x001c,
|
||||
TAG_inlined_subroutine = 0x001d,
|
||||
TAG_module = 0x001e,
|
||||
TAG_ptr_to_member_type = 0x001f,
|
||||
TAG_set_type = 0x0020,
|
||||
TAG_subrange_type = 0x0021,
|
||||
TAG_with_stmt = 0x0022,
|
||||
|
||||
/* GNU extensions */
|
||||
|
||||
TAG_format_label = 0x8000, /* for FORTRAN 77 and Fortran 90 */
|
||||
TAG_namelist = 0x8001, /* For Fortran 90 */
|
||||
TAG_function_template = 0x8002, /* for C++ */
|
||||
TAG_class_template = 0x8003 /* for C++ */
|
||||
};
|
||||
|
||||
#define TAG_lo_user 0x8000 /* implementation-defined range start */
|
||||
#define TAG_hi_user 0xffff /* implementation-defined range end */
|
||||
#define TAG_source_file TAG_compile_unit /* for backward compatibility */
|
||||
|
||||
/* Form names and codes. */
|
||||
|
||||
enum dwarf_form {
|
||||
FORM_ADDR = 0x1,
|
||||
FORM_REF = 0x2,
|
||||
FORM_BLOCK2 = 0x3,
|
||||
FORM_BLOCK4 = 0x4,
|
||||
FORM_DATA2 = 0x5,
|
||||
FORM_DATA4 = 0x6,
|
||||
FORM_DATA8 = 0x7,
|
||||
FORM_STRING = 0x8
|
||||
};
|
||||
|
||||
/* Attribute names and codes. */
|
||||
|
||||
enum dwarf_attribute {
|
||||
AT_sibling = (0x0010|FORM_REF),
|
||||
AT_location = (0x0020|FORM_BLOCK2),
|
||||
AT_name = (0x0030|FORM_STRING),
|
||||
AT_fund_type = (0x0050|FORM_DATA2),
|
||||
AT_mod_fund_type = (0x0060|FORM_BLOCK2),
|
||||
AT_user_def_type = (0x0070|FORM_REF),
|
||||
AT_mod_u_d_type = (0x0080|FORM_BLOCK2),
|
||||
AT_ordering = (0x0090|FORM_DATA2),
|
||||
AT_subscr_data = (0x00a0|FORM_BLOCK2),
|
||||
AT_byte_size = (0x00b0|FORM_DATA4),
|
||||
AT_bit_offset = (0x00c0|FORM_DATA2),
|
||||
AT_bit_size = (0x00d0|FORM_DATA4),
|
||||
/* (0x00e0|FORM_xxxx) -- reserved */
|
||||
AT_element_list = (0x00f0|FORM_BLOCK4),
|
||||
AT_stmt_list = (0x0100|FORM_DATA4),
|
||||
AT_low_pc = (0x0110|FORM_ADDR),
|
||||
AT_high_pc = (0x0120|FORM_ADDR),
|
||||
AT_language = (0x0130|FORM_DATA4),
|
||||
AT_member = (0x0140|FORM_REF),
|
||||
AT_discr = (0x0150|FORM_REF),
|
||||
AT_discr_value = (0x0160|FORM_BLOCK2),
|
||||
/* (0x0170|FORM_xxxx) -- reserved */
|
||||
/* (0x0180|FORM_xxxx) -- reserved */
|
||||
AT_string_length = (0x0190|FORM_BLOCK2),
|
||||
AT_common_reference = (0x01a0|FORM_REF),
|
||||
AT_comp_dir = (0x01b0|FORM_STRING),
|
||||
AT_const_value_string = (0x01c0|FORM_STRING),
|
||||
AT_const_value_data2 = (0x01c0|FORM_DATA2),
|
||||
AT_const_value_data4 = (0x01c0|FORM_DATA4),
|
||||
AT_const_value_data8 = (0x01c0|FORM_DATA8),
|
||||
AT_const_value_block2 = (0x01c0|FORM_BLOCK2),
|
||||
AT_const_value_block4 = (0x01c0|FORM_BLOCK4),
|
||||
AT_containing_type = (0x01d0|FORM_REF),
|
||||
AT_default_value_addr = (0x01e0|FORM_ADDR),
|
||||
AT_default_value_data2 = (0x01e0|FORM_DATA2),
|
||||
AT_default_value_data4 = (0x01e0|FORM_DATA4),
|
||||
AT_default_value_data8 = (0x01e0|FORM_DATA8),
|
||||
AT_default_value_string = (0x01e0|FORM_STRING),
|
||||
AT_friends = (0x01f0|FORM_BLOCK2),
|
||||
AT_inline = (0x0200|FORM_STRING),
|
||||
AT_is_optional = (0x0210|FORM_STRING),
|
||||
AT_lower_bound_ref = (0x0220|FORM_REF),
|
||||
AT_lower_bound_data2 = (0x0220|FORM_DATA2),
|
||||
AT_lower_bound_data4 = (0x0220|FORM_DATA4),
|
||||
AT_lower_bound_data8 = (0x0220|FORM_DATA8),
|
||||
AT_private = (0x0240|FORM_STRING),
|
||||
AT_producer = (0x0250|FORM_STRING),
|
||||
AT_program = (0x0230|FORM_STRING),
|
||||
AT_protected = (0x0260|FORM_STRING),
|
||||
AT_prototyped = (0x0270|FORM_STRING),
|
||||
AT_public = (0x0280|FORM_STRING),
|
||||
AT_pure_virtual = (0x0290|FORM_STRING),
|
||||
AT_return_addr = (0x02a0|FORM_BLOCK2),
|
||||
AT_abstract_origin = (0x02b0|FORM_REF),
|
||||
AT_start_scope = (0x02c0|FORM_DATA4),
|
||||
AT_stride_size = (0x02e0|FORM_DATA4),
|
||||
AT_upper_bound_ref = (0x02f0|FORM_REF),
|
||||
AT_upper_bound_data2 = (0x02f0|FORM_DATA2),
|
||||
AT_upper_bound_data4 = (0x02f0|FORM_DATA4),
|
||||
AT_upper_bound_data8 = (0x02f0|FORM_DATA8),
|
||||
AT_virtual = (0x0300|FORM_STRING),
|
||||
|
||||
/* GNU extensions. */
|
||||
|
||||
AT_sf_names = (0x8000|FORM_DATA4),
|
||||
AT_src_info = (0x8010|FORM_DATA4),
|
||||
AT_mac_info = (0x8020|FORM_DATA4),
|
||||
AT_src_coords = (0x8030|FORM_DATA4),
|
||||
AT_body_begin = (0x8040|FORM_ADDR),
|
||||
AT_body_end = (0x8050|FORM_ADDR)
|
||||
};
|
||||
|
||||
#define AT_lo_user 0x8000 /* implementation-defined range start */
|
||||
#define AT_hi_user 0xffff /* implementation-defined range end */
|
||||
|
||||
/* Location atom names and codes. */
|
||||
|
||||
enum dwarf_location_atom {
|
||||
OP_REG = 0x01,
|
||||
OP_BASEREG = 0x02,
|
||||
OP_ADDR = 0x03,
|
||||
OP_CONST = 0x04,
|
||||
OP_DEREF2 = 0x05,
|
||||
OP_DEREF4 = 0x06,
|
||||
OP_ADD = 0x07
|
||||
};
|
||||
|
||||
#define OP_LO_USER 0x80 /* implementation-defined range start */
|
||||
#define OP_HI_USER 0xff /* implementation-defined range end */
|
||||
|
||||
/* Fundamental type names and codes. */
|
||||
|
||||
enum dwarf_fundamental_type {
|
||||
FT_char = 0x0001,
|
||||
FT_signed_char = 0x0002,
|
||||
FT_unsigned_char = 0x0003,
|
||||
FT_short = 0x0004,
|
||||
FT_signed_short = 0x0005,
|
||||
FT_unsigned_short = 0x0006,
|
||||
FT_integer = 0x0007,
|
||||
FT_signed_integer = 0x0008,
|
||||
FT_unsigned_integer = 0x0009,
|
||||
FT_long = 0x000a,
|
||||
FT_signed_long = 0x000b,
|
||||
FT_unsigned_long = 0x000c,
|
||||
FT_pointer = 0x000d, /* an alias for (void *) */
|
||||
FT_float = 0x000e,
|
||||
FT_dbl_prec_float = 0x000f,
|
||||
FT_ext_prec_float = 0x0010, /* breaks "classic" svr4 SDB */
|
||||
FT_complex = 0x0011, /* breaks "classic" svr4 SDB */
|
||||
FT_dbl_prec_complex = 0x0012, /* breaks "classic" svr4 SDB */
|
||||
/* 0x0013 -- reserved */
|
||||
FT_void = 0x0014,
|
||||
FT_boolean = 0x0015, /* breaks "classic" svr4 SDB */
|
||||
FT_ext_prec_complex = 0x0016, /* breaks "classic" svr4 SDB */
|
||||
FT_label = 0x0017,
|
||||
|
||||
/* GNU extensions
|
||||
The low order byte must indicate the size (in bytes) for the type.
|
||||
All of these types will probably break "classic" svr4 SDB */
|
||||
|
||||
FT_long_long = 0x8008,
|
||||
FT_signed_long_long = 0x8108,
|
||||
FT_unsigned_long_long = 0x8208,
|
||||
|
||||
FT_int8 = 0x9001,
|
||||
FT_signed_int8 = 0x9101,
|
||||
FT_unsigned_int8 = 0x9201,
|
||||
FT_int16 = 0x9302,
|
||||
FT_signed_int16 = 0x9402,
|
||||
FT_unsigned_int16 = 0x9502,
|
||||
FT_int32 = 0x9604,
|
||||
FT_signed_int32 = 0x9704,
|
||||
FT_unsigned_int32 = 0x9804,
|
||||
FT_int64 = 0x9908,
|
||||
FT_signed_int64 = 0x9a08,
|
||||
FT_unsigned_int64 = 0x9b08,
|
||||
|
||||
FT_real32 = 0xa004,
|
||||
FT_real64 = 0xa108,
|
||||
FT_real96 = 0xa20c,
|
||||
FT_real128 = 0xa310
|
||||
};
|
||||
|
||||
#define FT_lo_user 0x8000 /* implementation-defined range start */
|
||||
#define FT_hi_user 0xffff /* implementation defined range end */
|
||||
|
||||
/* Type modifier names and codes. */
|
||||
|
||||
enum dwarf_type_modifier {
|
||||
MOD_pointer_to = 0x01,
|
||||
MOD_reference_to = 0x02,
|
||||
MOD_const = 0x03,
|
||||
MOD_volatile = 0x04
|
||||
};
|
||||
|
||||
#define MOD_lo_user 0x80 /* implementation-defined range start */
|
||||
#define MOD_hi_user 0xff /* implementation-defined range end */
|
||||
|
||||
/* Array ordering names and codes. */
|
||||
|
||||
enum dwarf_array_dim_ordering {
|
||||
ORD_row_major = 0,
|
||||
ORD_col_major = 1
|
||||
};
|
||||
|
||||
/* Array subscript format names and codes. */
|
||||
|
||||
enum dwarf_subscr_data_formats {
|
||||
FMT_FT_C_C = 0x0,
|
||||
FMT_FT_C_X = 0x1,
|
||||
FMT_FT_X_C = 0x2,
|
||||
FMT_FT_X_X = 0x3,
|
||||
FMT_UT_C_C = 0x4,
|
||||
FMT_UT_C_X = 0x5,
|
||||
FMT_UT_X_C = 0x6,
|
||||
FMT_UT_X_X = 0x7,
|
||||
FMT_ET = 0x8
|
||||
};
|
||||
|
||||
/* Derived from above for ease of use. */
|
||||
|
||||
#define FMT_CODE(_FUNDAMENTAL_TYPE_P, _UB_CONST_P, _LB_CONST_P) \
|
||||
(((_FUNDAMENTAL_TYPE_P) ? 0 : 4) \
|
||||
| ((_UB_CONST_P) ? 0 : 2) \
|
||||
| ((_LB_CONST_P) ? 0 : 1))
|
||||
|
||||
/* Source language names and codes. */
|
||||
|
||||
enum dwarf_source_language {
|
||||
LANG_C89 = 0x00000001,
|
||||
LANG_C = 0x00000002,
|
||||
LANG_ADA83 = 0x00000003,
|
||||
LANG_C_PLUS_PLUS = 0x00000004,
|
||||
LANG_COBOL74 = 0x00000005,
|
||||
LANG_COBOL85 = 0x00000006,
|
||||
LANG_FORTRAN77 = 0x00000007,
|
||||
LANG_FORTRAN90 = 0x00000008,
|
||||
LANG_PASCAL83 = 0x00000009,
|
||||
LANG_MODULA2 = 0x0000000a,
|
||||
|
||||
/* GNU extensions */
|
||||
|
||||
LANG_CHILL = 0x00009af3 /* random value for GNU Chill */
|
||||
};
|
||||
|
||||
#define LANG_lo_user 0x00008000 /* implementation-defined range start */
|
||||
#define LANG_hi_user 0x0000ffff /* implementation-defined range end */
|
||||
|
||||
/* Names and codes for GNU "macinfo" extension. */
|
||||
|
||||
enum dwarf_macinfo_record_type {
|
||||
MACINFO_start = 's',
|
||||
MACINFO_resume = 'r',
|
||||
MACINFO_define = 'd',
|
||||
MACINFO_undef = 'u'
|
||||
};
|
|
@ -1,190 +0,0 @@
|
|||
/* ELF support for BFD.
|
||||
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
Written by Fred Fish @ Cygnus Support, from information published
|
||||
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
||||
Programming Support Tools".
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
/* This file is part of ELF support for BFD, and contains the portions
|
||||
that describe how ELF is represented externally by the BFD library.
|
||||
I.E. it describes the in-file representation of ELF. It requires
|
||||
the elf-common.h file which contains the portions that are common to
|
||||
both the internal and external representations. */
|
||||
|
||||
/* The 64-bit stuff is kind of random. Perhaps someone will publish a
|
||||
spec someday. */
|
||||
|
||||
/* ELF Header (32-bit implementations) */
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[16]; /* ELF "magic number" */
|
||||
unsigned char e_type[2]; /* Identifies object file type */
|
||||
unsigned char e_machine[2]; /* Specifies required architecture */
|
||||
unsigned char e_version[4]; /* Identifies object file version */
|
||||
unsigned char e_entry[4]; /* Entry point virtual address */
|
||||
unsigned char e_phoff[4]; /* Program header table file offset */
|
||||
unsigned char e_shoff[4]; /* Section header table file offset */
|
||||
unsigned char e_flags[4]; /* Processor-specific flags */
|
||||
unsigned char e_ehsize[2]; /* ELF header size in bytes */
|
||||
unsigned char e_phentsize[2]; /* Program header table entry size */
|
||||
unsigned char e_phnum[2]; /* Program header table entry count */
|
||||
unsigned char e_shentsize[2]; /* Section header table entry size */
|
||||
unsigned char e_shnum[2]; /* Section header table entry count */
|
||||
unsigned char e_shstrndx[2]; /* Section header string table index */
|
||||
} Elf32_External_Ehdr;
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[16]; /* ELF "magic number" */
|
||||
unsigned char e_type[2]; /* Identifies object file type */
|
||||
unsigned char e_machine[2]; /* Specifies required architecture */
|
||||
unsigned char e_version[4]; /* Identifies object file version */
|
||||
unsigned char e_entry[8]; /* Entry point virtual address */
|
||||
unsigned char e_phoff[8]; /* Program header table file offset */
|
||||
unsigned char e_shoff[8]; /* Section header table file offset */
|
||||
unsigned char e_flags[4]; /* Processor-specific flags */
|
||||
unsigned char e_ehsize[2]; /* ELF header size in bytes */
|
||||
unsigned char e_phentsize[2]; /* Program header table entry size */
|
||||
unsigned char e_phnum[2]; /* Program header table entry count */
|
||||
unsigned char e_shentsize[2]; /* Section header table entry size */
|
||||
unsigned char e_shnum[2]; /* Section header table entry count */
|
||||
unsigned char e_shstrndx[2]; /* Section header string table index */
|
||||
} Elf64_External_Ehdr;
|
||||
|
||||
/* Program header */
|
||||
|
||||
typedef struct {
|
||||
unsigned char p_type[4]; /* Identifies program segment type */
|
||||
unsigned char p_offset[4]; /* Segment file offset */
|
||||
unsigned char p_vaddr[4]; /* Segment virtual address */
|
||||
unsigned char p_paddr[4]; /* Segment physical address */
|
||||
unsigned char p_filesz[4]; /* Segment size in file */
|
||||
unsigned char p_memsz[4]; /* Segment size in memory */
|
||||
unsigned char p_flags[4]; /* Segment flags */
|
||||
unsigned char p_align[4]; /* Segment alignment, file & memory */
|
||||
} Elf32_External_Phdr;
|
||||
|
||||
typedef struct {
|
||||
unsigned char p_type[4]; /* Identifies program segment type */
|
||||
unsigned char p_flags[4]; /* Segment flags */
|
||||
unsigned char p_offset[8]; /* Segment file offset */
|
||||
unsigned char p_vaddr[8]; /* Segment virtual address */
|
||||
unsigned char p_paddr[8]; /* Segment physical address */
|
||||
unsigned char p_filesz[8]; /* Segment size in file */
|
||||
unsigned char p_memsz[8]; /* Segment size in memory */
|
||||
unsigned char p_align[8]; /* Segment alignment, file & memory */
|
||||
} Elf64_External_Phdr;
|
||||
|
||||
/* Section header */
|
||||
|
||||
typedef struct {
|
||||
unsigned char sh_name[4]; /* Section name, index in string tbl */
|
||||
unsigned char sh_type[4]; /* Type of section */
|
||||
unsigned char sh_flags[4]; /* Miscellaneous section attributes */
|
||||
unsigned char sh_addr[4]; /* Section virtual addr at execution */
|
||||
unsigned char sh_offset[4]; /* Section file offset */
|
||||
unsigned char sh_size[4]; /* Size of section in bytes */
|
||||
unsigned char sh_link[4]; /* Index of another section */
|
||||
unsigned char sh_info[4]; /* Additional section information */
|
||||
unsigned char sh_addralign[4]; /* Section alignment */
|
||||
unsigned char sh_entsize[4]; /* Entry size if section holds table */
|
||||
} Elf32_External_Shdr;
|
||||
|
||||
typedef struct {
|
||||
unsigned char sh_name[4]; /* Section name, index in string tbl */
|
||||
unsigned char sh_type[4]; /* Type of section */
|
||||
unsigned char sh_flags[8]; /* Miscellaneous section attributes */
|
||||
unsigned char sh_addr[8]; /* Section virtual addr at execution */
|
||||
unsigned char sh_offset[8]; /* Section file offset */
|
||||
unsigned char sh_size[8]; /* Size of section in bytes */
|
||||
unsigned char sh_link[4]; /* Index of another section */
|
||||
unsigned char sh_info[4]; /* Additional section information */
|
||||
unsigned char sh_addralign[8]; /* Section alignment */
|
||||
unsigned char sh_entsize[8]; /* Entry size if section holds table */
|
||||
} Elf64_External_Shdr;
|
||||
|
||||
/* Symbol table entry */
|
||||
|
||||
typedef struct {
|
||||
unsigned char st_name[4]; /* Symbol name, index in string tbl */
|
||||
unsigned char st_value[4]; /* Value of the symbol */
|
||||
unsigned char st_size[4]; /* Associated symbol size */
|
||||
unsigned char st_info[1]; /* Type and binding attributes */
|
||||
unsigned char st_other[1]; /* No defined meaning, 0 */
|
||||
unsigned char st_shndx[2]; /* Associated section index */
|
||||
} Elf32_External_Sym;
|
||||
|
||||
typedef struct {
|
||||
unsigned char st_name[4]; /* Symbol name, index in string tbl */
|
||||
unsigned char st_info[1]; /* Type and binding attributes */
|
||||
unsigned char st_other[1]; /* No defined meaning, 0 */
|
||||
unsigned char st_shndx[2]; /* Associated section index */
|
||||
unsigned char st_value[8]; /* Value of the symbol */
|
||||
unsigned char st_size[8]; /* Associated symbol size */
|
||||
} Elf64_External_Sym;
|
||||
|
||||
/* Note segments */
|
||||
|
||||
typedef struct {
|
||||
unsigned char namesz[4]; /* Size of entry's owner string */
|
||||
unsigned char descsz[4]; /* Size of the note descriptor */
|
||||
unsigned char type[4]; /* Interpretation of the descriptor */
|
||||
char name[1]; /* Start of the name+desc data */
|
||||
} Elf_External_Note;
|
||||
|
||||
/* Relocation Entries */
|
||||
typedef struct {
|
||||
unsigned char r_offset[4]; /* Location at which to apply the action */
|
||||
unsigned char r_info[4]; /* index and type of relocation */
|
||||
} Elf32_External_Rel;
|
||||
|
||||
typedef struct {
|
||||
unsigned char r_offset[4]; /* Location at which to apply the action */
|
||||
unsigned char r_info[4]; /* index and type of relocation */
|
||||
unsigned char r_addend[4]; /* Constant addend used to compute value */
|
||||
} Elf32_External_Rela;
|
||||
|
||||
typedef struct {
|
||||
unsigned char r_offset[8]; /* Location at which to apply the action */
|
||||
unsigned char r_info[8]; /* index and type of relocation */
|
||||
} Elf64_External_Rel;
|
||||
|
||||
typedef struct {
|
||||
unsigned char r_offset[8]; /* Location at which to apply the action */
|
||||
unsigned char r_info[8]; /* index and type of relocation */
|
||||
unsigned char r_addend[8]; /* Constant addend used to compute value */
|
||||
} Elf64_External_Rela;
|
||||
|
||||
/* dynamic section structure */
|
||||
|
||||
typedef struct {
|
||||
unsigned char d_tag[4]; /* entry tag value */
|
||||
union {
|
||||
unsigned char d_val[4];
|
||||
unsigned char d_ptr[4];
|
||||
} d_un;
|
||||
} Elf32_External_Dyn;
|
||||
|
||||
typedef struct {
|
||||
unsigned char d_tag[8]; /* entry tag value */
|
||||
union {
|
||||
unsigned char d_val[8];
|
||||
unsigned char d_ptr[8];
|
||||
} d_un;
|
||||
} Elf64_External_Dyn;
|
|
@ -1,174 +0,0 @@
|
|||
/* ELF support for BFD.
|
||||
Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
Written by Fred Fish @ Cygnus Support, from information published
|
||||
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
||||
Programming Support Tools".
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
/* This file is part of ELF support for BFD, and contains the portions
|
||||
that describe how ELF is represented internally in the BFD library.
|
||||
I.E. it describes the in-memory representation of ELF. It requires
|
||||
the elf-common.h file which contains the portions that are common to
|
||||
both the internal and external representations. */
|
||||
|
||||
|
||||
/* NOTE that these structures are not kept in the same order as they appear
|
||||
in the object file. In some cases they've been reordered for more optimal
|
||||
packing under various circumstances. */
|
||||
|
||||
/* ELF Header */
|
||||
|
||||
#define EI_NIDENT 16 /* Size of e_ident[] */
|
||||
|
||||
typedef struct elf_internal_ehdr {
|
||||
unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
|
||||
bfd_vma e_entry; /* Entry point virtual address */
|
||||
bfd_signed_vma e_phoff; /* Program header table file offset */
|
||||
bfd_signed_vma e_shoff; /* Section header table file offset */
|
||||
unsigned long e_version; /* Identifies object file version */
|
||||
unsigned long e_flags; /* Processor-specific flags */
|
||||
unsigned short e_type; /* Identifies object file type */
|
||||
unsigned short e_machine; /* Specifies required architecture */
|
||||
unsigned short e_ehsize; /* ELF header size in bytes */
|
||||
unsigned short e_phentsize; /* Program header table entry size */
|
||||
unsigned short e_phnum; /* Program header table entry count */
|
||||
unsigned short e_shentsize; /* Section header table entry size */
|
||||
unsigned short e_shnum; /* Section header table entry count */
|
||||
unsigned short e_shstrndx; /* Section header string table index */
|
||||
} Elf_Internal_Ehdr;
|
||||
|
||||
#define elf32_internal_ehdr elf_internal_ehdr
|
||||
#define Elf32_Internal_Ehdr Elf_Internal_Ehdr
|
||||
#define elf64_internal_ehdr elf_internal_ehdr
|
||||
#define Elf64_Internal_Ehdr Elf_Internal_Ehdr
|
||||
|
||||
/* Program header */
|
||||
|
||||
struct elf_internal_phdr {
|
||||
unsigned long p_type; /* Identifies program segment type */
|
||||
unsigned long p_flags; /* Segment flags */
|
||||
bfd_vma p_offset; /* Segment file offset */
|
||||
bfd_vma p_vaddr; /* Segment virtual address */
|
||||
bfd_vma p_paddr; /* Segment physical address */
|
||||
bfd_vma p_filesz; /* Segment size in file */
|
||||
bfd_vma p_memsz; /* Segment size in memory */
|
||||
bfd_vma p_align; /* Segment alignment, file & memory */
|
||||
};
|
||||
|
||||
typedef struct elf_internal_phdr Elf_Internal_Phdr;
|
||||
#define elf32_internal_phdr elf_internal_phdr
|
||||
#define Elf32_Internal_Phdr Elf_Internal_Phdr
|
||||
#define elf64_internal_phdr elf_internal_phdr
|
||||
#define Elf64_Internal_Phdr Elf_Internal_Phdr
|
||||
|
||||
/* Section header */
|
||||
|
||||
typedef struct elf_internal_shdr {
|
||||
unsigned int sh_name; /* Section name, index in string tbl */
|
||||
unsigned int sh_type; /* Type of section */
|
||||
bfd_vma sh_flags; /* Miscellaneous section attributes */
|
||||
bfd_vma sh_addr; /* Section virtual addr at execution */
|
||||
bfd_size_type sh_size; /* Size of section in bytes */
|
||||
bfd_size_type sh_entsize; /* Entry size if section holds table */
|
||||
unsigned long sh_link; /* Index of another section */
|
||||
unsigned long sh_info; /* Additional section information */
|
||||
file_ptr sh_offset; /* Section file offset */
|
||||
unsigned int sh_addralign; /* Section alignment */
|
||||
|
||||
/* The internal rep also has some cached info associated with it. */
|
||||
PTR rawdata; /* null if unused... */
|
||||
PTR contents; /* null if unused... */
|
||||
bfd_vma size; /* size of contents (0 if unused) */
|
||||
} Elf_Internal_Shdr;
|
||||
|
||||
#define elf32_internal_shdr elf_internal_shdr
|
||||
#define Elf32_Internal_Shdr Elf_Internal_Shdr
|
||||
#define elf64_internal_shdr elf_internal_shdr
|
||||
#define Elf64_Internal_Shdr Elf_Internal_Shdr
|
||||
|
||||
/* Symbol table entry */
|
||||
|
||||
struct elf_internal_sym {
|
||||
bfd_vma st_value; /* Value of the symbol */
|
||||
bfd_vma st_size; /* Associated symbol size */
|
||||
unsigned long st_name; /* Symbol name, index in string tbl */
|
||||
unsigned char st_info; /* Type and binding attributes */
|
||||
unsigned char st_other; /* No defined meaning, 0 */
|
||||
unsigned short st_shndx; /* Associated section index */
|
||||
};
|
||||
|
||||
typedef struct elf_internal_sym Elf_Internal_Sym;
|
||||
|
||||
#define elf32_internal_sym elf_internal_sym
|
||||
#define elf64_internal_sym elf_internal_sym
|
||||
#define Elf32_Internal_Sym Elf_Internal_Sym
|
||||
#define Elf64_Internal_Sym Elf_Internal_Sym
|
||||
|
||||
/* Note segments */
|
||||
|
||||
typedef struct elf_internal_note {
|
||||
unsigned long namesz; /* Size of entry's owner string */
|
||||
unsigned long descsz; /* Size of the note descriptor */
|
||||
unsigned long type; /* Interpretation of the descriptor */
|
||||
char name[1]; /* Start of the name+desc data */
|
||||
} Elf_Internal_Note;
|
||||
#define Elf32_Internal_Note Elf_Internal_Note
|
||||
#define elf32_internal_note elf_internal_note
|
||||
|
||||
/* Relocation Entries */
|
||||
|
||||
typedef struct elf_internal_rel {
|
||||
bfd_vma r_offset; /* Location at which to apply the action */
|
||||
/* This needs to support 64-bit values in elf64. */
|
||||
bfd_vma r_info; /* index and type of relocation */
|
||||
} Elf_Internal_Rel;
|
||||
|
||||
#define elf32_internal_rel elf_internal_rel
|
||||
#define Elf32_Internal_Rel Elf_Internal_Rel
|
||||
#define elf64_internal_rel elf_internal_rel
|
||||
#define Elf64_Internal_Rel Elf_Internal_Rel
|
||||
|
||||
typedef struct elf_internal_rela {
|
||||
bfd_vma r_offset; /* Location at which to apply the action */
|
||||
bfd_vma r_info; /* Index and Type of relocation */
|
||||
bfd_signed_vma r_addend; /* Constant addend used to compute value */
|
||||
} Elf_Internal_Rela;
|
||||
|
||||
#define elf32_internal_rela elf_internal_rela
|
||||
#define elf64_internal_rela elf_internal_rela
|
||||
#define Elf32_Internal_Rela Elf_Internal_Rela
|
||||
#define Elf64_Internal_Rela Elf_Internal_Rela
|
||||
|
||||
/* dynamic section structure */
|
||||
|
||||
typedef struct elf_internal_dyn {
|
||||
/* This needs to support 64-bit values in elf64. */
|
||||
bfd_vma d_tag; /* entry tag value */
|
||||
union {
|
||||
/* This needs to support 64-bit values in elf64. */
|
||||
bfd_vma d_val;
|
||||
bfd_vma d_ptr;
|
||||
} d_un;
|
||||
} Elf_Internal_Dyn;
|
||||
|
||||
#define elf32_internal_dyn elf_internal_dyn
|
||||
#define elf64_internal_dyn elf_internal_dyn
|
||||
#define Elf32_Internal_Dyn Elf_Internal_Dyn
|
||||
#define Elf64_Internal_Dyn Elf_Internal_Dyn
|
Loading…
Reference in a new issue