mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-01 14:31:54 +00:00
Initial revision
This commit is contained in:
parent
927edea6e7
commit
2d996e5dc9
61
bfd/hosts/amix.h
Normal file
61
bfd/hosts/amix.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* Not sure why this is needed -- Fred Fish put it in */
|
||||
#define USG
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#ifndef O_ACCMODE
|
||||
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
|
||||
#endif
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
|
||||
extern PROTO(int, abort,(void));
|
||||
extern PROTO(int, close,(int));
|
||||
extern PROTO(void, exit,(int));
|
||||
extern PROTO(int, fclose,(FILE*));
|
||||
extern PROTO(int, free,(PTR));
|
||||
extern PROTO(int, fseek,(FILE*, long, int));
|
||||
extern PROTO(int, getgid,());
|
||||
extern PROTO(int, getuid,());
|
||||
extern PROTO(PTR, malloc,(unsigned));
|
||||
extern PROTO(void, perror,(CONST char *));
|
||||
extern PROTO(int, qsort,(void *data,int els, int siz, int func()));
|
||||
extern PROTO(PTR, realloc, (PTR, unsigned));
|
||||
|
||||
extern char *getenv();
|
||||
extern int chmod();
|
||||
extern int fstat();
|
||||
extern int stat();
|
||||
extern int strtol();
|
||||
|
||||
extern char *ctime();
|
||||
extern int _flsbuf();
|
||||
extern int fclose();
|
||||
extern int utimes();
|
||||
extern int vfprintf();
|
||||
extern long atol();
|
||||
extern int fputc();
|
||||
extern int unlink();
|
||||
|
||||
/* EXACT TYPES */
|
||||
typedef char int8e_type;
|
||||
typedef unsigned char uint8e_type;
|
||||
typedef short int16e_type;
|
||||
typedef unsigned short uint16e_type;
|
||||
typedef int int32e_type;
|
||||
typedef unsigned int uint32e_type;
|
||||
|
||||
/* CORRECT SIZE OR GREATER */
|
||||
typedef char int8_type;
|
||||
typedef unsigned char uint8_type;
|
||||
typedef short int16_type;
|
||||
typedef unsigned short uint16_type;
|
||||
typedef int int32_type;
|
||||
typedef unsigned int uint32_type;
|
128
include/elf-common.h
Executable file
128
include/elf-common.h
Executable file
@ -0,0 +1,128 @@
|
||||
/* ELF support for BFD.
|
||||
Copyright (C) 1991 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 6 /* Intel 80860 */
|
||||
|
||||
/* 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 */
|
87
include/elf-external.h
Executable file
87
include/elf-external.h
Executable file
@ -0,0 +1,87 @@
|
||||
/* ELF support for BFD.
|
||||
Copyright (C) 1991 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. */
|
||||
|
||||
/* 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 */
|
||||
} Elf_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 */
|
||||
} Elf_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 */
|
||||
} Elf_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 */
|
||||
} Elf_External_Sym;
|
98
include/elf-internal.h
Executable file
98
include/elf-internal.h
Executable file
@ -0,0 +1,98 @@
|
||||
/* ELF support for BFD.
|
||||
Copyright (C) 1991 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. */
|
||||
|
||||
/* Types used by various structures, functions, etc. */
|
||||
|
||||
typedef unsigned long Elf_Addr; /* Unsigned program address */
|
||||
typedef unsigned long Elf_Off; /* Unsigned file offset */
|
||||
typedef long Elf_Sword; /* Signed large integer */
|
||||
typedef unsigned long Elf_Word; /* Unsigned large integer */
|
||||
typedef unsigned short Elf_Half; /* Unsigned medium integer */
|
||||
typedef unsigned char Elf_Char; /* Unsigned tiny integer */
|
||||
|
||||
/* ELF Header */
|
||||
|
||||
#define EI_NIDENT 16 /* Size of e_ident[] */
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
|
||||
Elf_Half e_type; /* Identifies object file type */
|
||||
Elf_Half e_machine; /* Specifies required architecture */
|
||||
Elf_Word e_version; /* Identifies object file version */
|
||||
Elf_Addr e_entry; /* Entry point virtual address */
|
||||
Elf_Off e_phoff; /* Program header table file offset */
|
||||
Elf_Off e_shoff; /* Section header table file offset */
|
||||
Elf_Word e_flags; /* Processor-specific flags */
|
||||
Elf_Half e_ehsize; /* ELF header size in bytes */
|
||||
Elf_Half e_phentsize; /* Program header table entry size */
|
||||
Elf_Half e_phnum; /* Program header table entry count */
|
||||
Elf_Half e_shentsize; /* Section header table entry size */
|
||||
Elf_Half e_shnum; /* Section header table entry count */
|
||||
Elf_Half e_shstrndx; /* Section header string table index */
|
||||
} Elf_Internal_Ehdr;
|
||||
|
||||
/* Program header */
|
||||
|
||||
typedef struct {
|
||||
Elf_Word p_type; /* Identifies program segment type */
|
||||
Elf_Off p_offset; /* Segment file offset */
|
||||
Elf_Addr p_vaddr; /* Segment virtual address */
|
||||
Elf_Addr p_paddr; /* Segment physical address */
|
||||
Elf_Word p_filesz; /* Segment size in file */
|
||||
Elf_Word p_memsz; /* Segment size in memory */
|
||||
Elf_Word p_flags; /* Segment flags */
|
||||
Elf_Word p_align; /* Segment alignment, file & memory */
|
||||
} Elf_Internal_Phdr;
|
||||
|
||||
/* Section header */
|
||||
|
||||
typedef struct {
|
||||
Elf_Word sh_name; /* Section name, index in string tbl */
|
||||
Elf_Word sh_type; /* Type of section */
|
||||
Elf_Word sh_flags; /* Miscellaneous section attributes */
|
||||
Elf_Addr sh_addr; /* Section virtual addr at execution */
|
||||
Elf_Off sh_offset; /* Section file offset */
|
||||
Elf_Word sh_size; /* Size of section in bytes */
|
||||
Elf_Word sh_link; /* Index of another section */
|
||||
Elf_Word sh_info; /* Additional section information */
|
||||
Elf_Word sh_addralign; /* Section alignment */
|
||||
Elf_Word sh_entsize; /* Entry size if section holds table */
|
||||
} Elf_Internal_Shdr;
|
||||
|
||||
/* Symbol table entry */
|
||||
|
||||
typedef struct {
|
||||
Elf_Word st_name; /* Symbol name, index in string tbl */
|
||||
Elf_Addr st_value; /* Value of the symbol */
|
||||
Elf_Word st_size; /* Associated symbol size */
|
||||
Elf_Char st_info; /* Type and binding attributes */
|
||||
Elf_Char st_other; /* No defined meaning, 0 */
|
||||
Elf_Half st_shndx; /* Associated section index */
|
||||
} Elf_Internal_Sym;
|
Loading…
x
Reference in New Issue
Block a user