| 1 |
/* coff information for Intel 386/486. |
| 2 |
|
| 3 |
Copyright (C) 2001-2025 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation; either version 3 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with this program; if not, write to the Free Software |
| 17 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 18 |
MA 02110-1301, USA. */ |
| 19 |
|
| 20 |
#include "coff/x86.h" |
| 21 |
|
| 22 |
/* Bits for f_flags: |
| 23 |
F_RELFLG Relocation info stripped from file |
| 24 |
F_EXEC File is executable (no unresolved external references) |
| 25 |
F_LNNO Line numbers stripped from file |
| 26 |
F_LSYMS Local symbols stripped from file |
| 27 |
F_AR32WR File has byte ordering of an AR32WR machine (e.g. vax). */ |
| 28 |
|
| 29 |
#define F_RELFLG (0x0001) |
| 30 |
#define F_EXEC (0x0002) |
| 31 |
#define F_LNNO (0x0004) |
| 32 |
#define F_LSYMS (0x0008) |
| 33 |
|
| 34 |
#define I386MAGIC 0x14c |
| 35 |
#define I386PTXMAGIC 0x154 |
| 36 |
#define I386AIXMAGIC 0x175 |
| 37 |
|
| 38 |
/* This is Lynx's all-platform magic number for executables. */ |
| 39 |
|
| 40 |
#define LYNXCOFFMAGIC 0415 |
| 41 |
|
| 42 |
/* Used in some .NET DLLs that target a specific OS. */ |
| 43 |
#define I386_APPLE_MAGIC (I386MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE) |
| 44 |
#define I386_FREEBSD_MAGIC (I386MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE) |
| 45 |
#define I386_LINUX_MAGIC (I386MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE) |
| 46 |
#define I386_NETBSD_MAGIC (I386MAGIC ^ IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE) |
| 47 |
|
| 48 |
#define I386BADMAG(x) ( ((x).f_magic != I386MAGIC) \ |
| 49 |
&& (x).f_magic != I386_APPLE_MAGIC \ |
| 50 |
&& (x).f_magic != I386_FREEBSD_MAGIC \ |
| 51 |
&& (x).f_magic != I386_LINUX_MAGIC \ |
| 52 |
&& (x).f_magic != I386_NETBSD_MAGIC \ |
| 53 |
&& (x).f_magic != I386AIXMAGIC \ |
| 54 |
&& (x).f_magic != I386PTXMAGIC \ |
| 55 |
&& (x).f_magic != LYNXCOFFMAGIC) |
| 56 |
|
| 57 |
#define OMAGIC 0404 /* Object files, eg as output. */ |
| 58 |
#define ZMAGIC 0413 /* Demand load format, eg normal ld output. */ |
| 59 |
#define STMAGIC 0401 /* Target shlib. */ |
| 60 |
#define SHMAGIC 0443 /* Host shlib. */ |
| 61 |
|
| 62 |
/* i386 Relocations. */ |
| 63 |
|
| 64 |
#define R_DIR32 6 |
| 65 |
#define R_IMAGEBASE 7 |
| 66 |
#define R_SECTION 10 |
| 67 |
#define R_SECREL32 11 |
| 68 |
#define R_RELBYTE 15 |
| 69 |
#define R_RELWORD 16 |
| 70 |
#define R_RELLONG 17 |
| 71 |
#define R_PCRBYTE 18 |
| 72 |
#define R_PCRWORD 19 |
| 73 |
#define R_PCRLONG 20 |