x86_64.h revision 1.1.1.6
1254721Semaste/* COFF information for AMD 64.
2254721Semaste   Copyright (C) 2006-2020 Free Software Foundation, Inc.
3254721Semaste
4254721Semaste   This file is part of BFD, the Binary File Descriptor library.
5254721Semaste
6254721Semaste   This program is free software; you can redistribute it and/or modify
7254721Semaste   it under the terms of the GNU General Public License as published by
8254721Semaste   the Free Software Foundation; either version 3 of the License, or
9254721Semaste   (at your option) any later version.
10254721Semaste
11254721Semaste   This program is distributed in the hope that it will be useful,
12254721Semaste   but WITHOUT ANY WARRANTY; without even the implied warranty of
13254721Semaste   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14254721Semaste   GNU General Public License for more details.
15258054Semaste
16254721Semaste   You should have received a copy of the GNU General Public License
17254721Semaste   along with this program; if not, write to the Free Software
18254721Semaste   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19254721Semaste   MA 02110-1301, USA.
20254721Semaste
21254721Semaste   Written by Kai Tietz, OneVision Software GmbH&CoKg.  */
22254721Semaste
23254721Semaste#define L_LNNO_SIZE 2
24254721Semaste#define INCLUDE_COMDAT_FIELDS_IN_AUXENT
25254721Semaste
26254721Semaste#include "coff/external.h"
27254721Semaste
28254721Semaste#define COFF_PAGE_SIZE	0x1000
29254721Semaste
30254721Semaste#define AMD64MAGIC	0x8664
31254721Semaste
32254721Semaste/* .NET DLLs XOR the Machine number (above) with an override to
33254721Semaste    indicate that the DLL contains OS-specific machine code rather
34254721Semaste    than just IL or bytecode. See
35254721Semaste    https://github.com/dotnet/coreclr/blob/6f7aa7967c607b8c667518314ab937c0d7547025/src/inc/pedecoder.h#L94-L107. */
36254721Semaste#define IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE   0x4644
37254721Semaste#define IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE 0xadc4
38254721Semaste#define IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE   0x7b79
39254721Semaste#define IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE  0x1993
40254721Semaste
41254721Semaste/* Used in some .NET DLLs that target a specific OS.  */
42254721Semaste#define AMD64_APPLE_MAGIC   (AMD64MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE)
43254721Semaste#define AMD64_FREEBSD_MAGIC (AMD64MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE)
44254721Semaste#define AMD64_LINUX_MAGIC   (AMD64MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE)
45254721Semaste#define AMD64_NETBSD_MAGIC  (AMD64MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE)
46254721Semaste
47254721Semaste#define AMD64BADMAG(x) (   ((x).f_magic != AMD64MAGIC) \
48254721Semaste                        && ((x).f_magic != AMD64_APPLE_MAGIC) \
49254721Semaste                        && ((x).f_magic != AMD64_FREEBSD_MAGIC) \
50254721Semaste                        && ((x).f_magic != AMD64_LINUX_MAGIC) \
51254721Semaste                        && ((x).f_magic != AMD64_NETBSD_MAGIC))
52254721Semaste
53254721Semaste#define IMAGE_NT_OPTIONAL_HDR64_MAGIC      0x20b
54254721Semaste
55254721Semaste#define OMAGIC          0404    /* Object files, eg as output.  */
56254721Semaste#define ZMAGIC          IMAGE_NT_OPTIONAL_HDR64_MAGIC    /* Demand load format, eg normal ld output 0x10b.  */
57254721Semaste#define STMAGIC		0401	/* Target shlib.  */
58254721Semaste#define SHMAGIC		0443	/* Host   shlib.  */
59254721Semaste
60254721Semaste/* Define some NT default values.  */
61254721Semaste/*  #define NT_IMAGE_BASE        0x400000 moved to internal.h.  */
62254721Semaste#define NT_SECTION_ALIGNMENT 0x1000
63254721Semaste#define NT_FILE_ALIGNMENT    0x200
64254721Semaste#define NT_DEF_RESERVE       0x100000
65254721Semaste#define NT_DEF_COMMIT        0x1000
66254721Semaste
67254721Semaste/* Relocation directives.  */
68254721Semaste
69254721Semastestruct external_reloc
70254721Semaste{
71254721Semaste  char r_vaddr[4];
72254721Semaste  char r_symndx[4];
73254721Semaste  char r_type[2];
74254721Semaste};
75254721Semaste
76254721Semaste#define RELOC struct external_reloc
77254721Semaste#define RELSZ 10
78254721Semaste