aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-09-20 11:35:11 +0000
committerNick Clifton <nickc@redhat.com>2006-09-20 11:35:11 +0000
commit99ad839030c1177eb409a99320fa7e60226f0db3 (patch)
tree31841958e04c69ceb1aeafcf7cdef5e721d23829 /include
parenta8bbe5b03e6b16a41a69e570061e34014d30431a (diff)
downloadgdb-99ad839030c1177eb409a99320fa7e60226f0db3.zip
gdb-99ad839030c1177eb409a99320fa7e60226f0db3.tar.gz
gdb-99ad839030c1177eb409a99320fa7e60226f0db3.tar.bz2
Add x86_64-mingw64 target
Diffstat (limited to 'include')
-rw-r--r--include/coff/ChangeLog12
-rw-r--r--include/coff/external.h18
-rw-r--r--include/coff/internal.h21
-rw-r--r--include/coff/pe.h14
-rw-r--r--include/coff/x86_64.h54
5 files changed, 114 insertions, 5 deletions
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index f41c115..499d478 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,15 @@
+2006-09-20 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * external.h: Add proper external_aouthdr64 structure (without
+ data_start member).
+ (AOUTHDRSZ64): Set according structure size.
+ (AOUTHDR64): As typedef of external_aouthdr64 structure.
+ * internal.h: Add relocation identifiers for coff.
+ * pe.h: Add define IMAGE_FILE_MACHINE_AMD64 the coff signature.
+ (PEPAOUTHDR): Adjust structure to have proper size (using AOUTHDR64).
+ (PEPAOUTSZ): Calculated size of 240.
+ * x86_64.h: Coff information for x86_64 (AMD64).
+
2006-02-05 Arnold Metselaar <arnold.metselaar@planet.nl>
* internal.h: Add relocation number R_IMM24 for Z80.
diff --git a/include/coff/external.h b/include/coff/external.h
index 9e760bd..e38fb1b 100644
--- a/include/coff/external.h
+++ b/include/coff/external.h
@@ -1,6 +1,6 @@
/* external.h -- External COFF structures
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2006 Free Software Foundation, Inc.
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
@@ -55,7 +55,21 @@ AOUTHDR;
#define AOUTHDRSZ 28
#define AOUTSZ 28
-#endif
+
+typedef struct external_aouthdr64
+{
+ char magic[2]; /* Type of file. */
+ char vstamp[2]; /* Version stamp. */
+ char tsize[4]; /* Text size in bytes, padded to FW bdry*/
+ char dsize[4]; /* Initialized data " ". */
+ char bsize[4]; /* Uninitialized data " ". */
+ char entry[4]; /* Entry pt. */
+ char text_start[4]; /* Base of text used for this file. */
+}
+AOUTHDR64;
+#define AOUTHDRSZ64 24
+
+#endif /* not DO_NOT_DEFINE_AOUTHDR */
#ifndef DO_NOT_DEFINE_SCNHDR
/********************** SECTION HEADER **********************/
diff --git a/include/coff/internal.h b/include/coff/internal.h
index ed0918a..71336ff 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -1,7 +1,7 @@
/* Internal format of COFF object file data structures, for GNU BFD.
This file is part of BFD, the Binary File Descriptor library.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004. 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004. 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -604,6 +604,25 @@ struct internal_reloc
unsigned long r_offset; /* Used by Alpha ECOFF, SPARC, others */
};
+/* X86-64 relocations. */
+#define R_AMD64_ABS 0 /* Reference is absolute, no relocation is necessary. */
+#define R_AMD64_DIR64 1 /* 64-bit address (VA). */
+#define R_AMD64_DIR32 2 /* 32-bit address (VA) R_DIR32. */
+#define R_AMD64_IMAGEBASE 3 /* 32-bit absolute ref w/o base R_IMAGEBASE. */
+#define R_AMD64_PCRLONG 4 /* 32-bit relative address from byte following reloc R_PCRLONG. */
+#define R_AMD64_PCRLONG_1 5 /* 32-bit relative address from byte distance 1 from reloc. */
+#define R_AMD64_PCRLONG_2 6 /* 32-bit relative address from byte distance 2 from reloc. */
+#define R_AMD64_PCRLONG_3 7 /* 32-bit relative address from byte distance 3 from reloc. */
+#define R_AMD64_PCRLONG_4 8 /* 32-bit relative address from byte distance 4 from reloc. */
+#define R_AMD64_PCRLONG_5 9 /* 32-bit relative address from byte distance 5 from reloc. */
+#define R_AMD64_SECTION 10 /* Section index. */
+#define R_AMD64_SECREL 11 /* 32 bit offset from base of section containing target R_SECREL. */
+#define R_AMD64_SECREL7 12 /* 7 bit unsigned offset from base of section containing target. */
+#define R_AMD64_TOKEN 13 /* 32 bit metadata token. */
+#define R_AMD64_PCRQUAD 14 /* Pseude PC64 relocation - Note: not specified by MS/AMD but need for gas pc-relative 64bit wide relocation generated by ELF. */
+
+/* i386 Relocations. */
+
#define R_DIR16 1
#define R_REL24 5
#define R_DIR32 6
diff --git a/include/coff/pe.h b/include/coff/pe.h
index 643cea4..ac53a17 100644
--- a/include/coff/pe.h
+++ b/include/coff/pe.h
@@ -1,6 +1,6 @@
/* pe.h - PE COFF header information
- Copyright 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -119,6 +119,7 @@
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
#define IMAGE_FILE_MACHINE_TRICORE 0x0520
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
+#define IMAGE_FILE_MACHINE_AMD64 0x8664
#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
@@ -259,6 +260,7 @@ typedef struct
/* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars. */
} PEAOUTHDR;
+
#undef AOUTSZ
#define AOUTSZ (AOUTHDRSZ + 196)
@@ -267,8 +269,11 @@ typedef struct
of just 4 bytes long. */
typedef struct
{
+#ifdef AOUTHDRSZ64
+ AOUTHDR64 standard;
+#else
AOUTHDR standard;
-
+#endif
/* NT extra fields; see internal.h for descriptions. */
char ImageBase[8];
char SectionAlignment[4];
@@ -294,7 +299,12 @@ typedef struct
/* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars. */
} PEPAOUTHDR;
+
+#ifdef AOUTHDRSZ64
+#define PEPAOUTSZ (AOUTHDRSZ64 + 196 + 5 * 4) /* = 240 */
+#else
#define PEPAOUTSZ 240
+#endif
#undef E_FILNMLEN
#define E_FILNMLEN 18 /* # characters in a file name. */
diff --git a/include/coff/x86_64.h b/include/coff/x86_64.h
new file mode 100644
index 0000000..b58dd2f
--- /dev/null
+++ b/include/coff/x86_64.h
@@ -0,0 +1,54 @@
+/* COFF information for AMD 64.
+ Copyright 2006 Free Software Foundation, Inc.
+
+ 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Written by Kai Tietz, OneVision Software GmbH&CoKg. */
+
+#define L_LNNO_SIZE 2
+#define INCLUDE_COMDAT_FIELDS_IN_AUXENT
+
+#include "coff/external.h"
+
+#define AMD64MAGIC 0x8664
+
+#define AMD64BADMAG(x) ((x).f_magic != AMD64MAGIC)
+#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+
+#define OMAGIC 0404 /* Object files, eg as output. */
+#define ZMAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC /* Demand load format, eg normal ld output 0x10b. */
+#define STMAGIC 0401 /* Target shlib. */
+#define SHMAGIC 0443 /* Host shlib. */
+
+/* Define some NT default values. */
+/* #define NT_IMAGE_BASE 0x400000 moved to internal.h. */
+#define NT_SECTION_ALIGNMENT 0x1000
+#define NT_FILE_ALIGNMENT 0x200
+#define NT_DEF_RESERVE 0x100000
+#define NT_DEF_COMMIT 0x1000
+
+/* Relocation directives. */
+
+struct external_reloc
+{
+ char r_vaddr[4];
+ char r_symndx[4];
+ char r_type[2];
+};
+
+#define RELOC struct external_reloc
+#define RELSZ 10