133965Sjdp/* Internal format of COFF object file data structures, for GNU BFD.
278828Sobrien   This file is part of BFD, the Binary File Descriptor library.
378828Sobrien
4213274Srpaulo   Copyright 1999, 2000, 2001, 2002, 2003, 2004. 2005, 2006, 2007, 2009
5213274Srpaulo   Free Software Foundation, Inc.
633965Sjdp
778828Sobrien   This program is free software; you can redistribute it and/or modify
878828Sobrien   it under the terms of the GNU General Public License as published by
978828Sobrien   the Free Software Foundation; either version 2 of the License, or
1078828Sobrien   (at your option) any later version.
1178828Sobrien
1278828Sobrien   This program is distributed in the hope that it will be useful,
1378828Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1478828Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1578828Sobrien   GNU General Public License for more details.
1678828Sobrien
1778828Sobrien   You should have received a copy of the GNU General Public License
1878828Sobrien   along with this program; if not, write to the Free Software
19213274Srpaulo   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2078828Sobrien
2133965Sjdp#ifndef GNU_COFF_INTERNAL_H
2233965Sjdp#define GNU_COFF_INTERNAL_H 1
2333965Sjdp
2433965Sjdp/* First, make "signed char" work, even on old compilers. */
2533965Sjdp#ifndef signed
2633965Sjdp#ifndef __STDC__
2733965Sjdp#define	signed			/**/
2833965Sjdp#endif
2933965Sjdp#endif
3033965Sjdp
3133965Sjdp/********************** FILE HEADER **********************/
3233965Sjdp
3333965Sjdp/* extra stuff in a PE header. */
3433965Sjdp
3533965Sjdpstruct internal_extra_pe_filehdr
3633965Sjdp{
3733965Sjdp  /* DOS header data follows for PE stuff */
3833965Sjdp  unsigned short e_magic;	/* Magic number, 0x5a4d */
3933965Sjdp  unsigned short e_cblp;	/* Bytes on last page of file, 0x90 */
4033965Sjdp  unsigned short e_cp;		/* Pages in file, 0x3 */
4133965Sjdp  unsigned short e_crlc;	/* Relocations, 0x0 */
4233965Sjdp  unsigned short e_cparhdr;	/* Size of header in paragraphs, 0x4 */
4333965Sjdp  unsigned short e_minalloc;	/* Minimum extra paragraphs needed, 0x0 */
4433965Sjdp  unsigned short e_maxalloc;	/* Maximum extra paragraphs needed, 0xFFFF */
4533965Sjdp  unsigned short e_ss;		/* Initial (relative) SS value, 0x0 */
4633965Sjdp  unsigned short e_sp;		/* Initial SP value, 0xb8 */
4733965Sjdp  unsigned short e_csum;	/* Checksum, 0x0 */
4833965Sjdp  unsigned short e_ip;		/* Initial IP value, 0x0 */
4933965Sjdp  unsigned short e_cs;		/* Initial (relative) CS value, 0x0 */
5033965Sjdp  unsigned short e_lfarlc;	/* File address of relocation table, 0x40 */
5133965Sjdp  unsigned short e_ovno;	/* Overlay number, 0x0 */
5233965Sjdp  unsigned short e_res[4];	/* Reserved words, all 0x0 */
5333965Sjdp  unsigned short e_oemid;	/* OEM identifier (for e_oeminfo), 0x0 */
5433965Sjdp  unsigned short e_oeminfo;	/* OEM information; e_oemid specific, 0x0 */
5533965Sjdp  unsigned short e_res2[10];	/* Reserved words, all 0x0 */
5633965Sjdp  bfd_vma  e_lfanew;		/* File address of new exe header, 0x80 */
5733965Sjdp  unsigned long dos_message[16]; /* text which always follows dos header */
5833965Sjdp  bfd_vma  nt_signature;   	/* required NT signature, 0x4550 */
5933965Sjdp};
6033965Sjdp
61213274Srpaulo#define GO32_STUBSIZE 2048
62213274Srpaulo
6333965Sjdpstruct internal_filehdr
6433965Sjdp{
6533965Sjdp  struct internal_extra_pe_filehdr pe;
6633965Sjdp
67213274Srpaulo  /* coff-stgo32 EXE stub header before BFD tdata has been allocated.
68213274Srpaulo     Its data is kept in INTERNAL_FILEHDR.GO32STUB afterwards.
69213274Srpaulo
70213274Srpaulo     F_GO32STUB is set iff go32stub contains a valid data.  Artifical headers
71213274Srpaulo     created in BFD have no pre-set go32stub.  */
72213274Srpaulo  char go32stub[GO32_STUBSIZE];
73213274Srpaulo
7489857Sobrien  /* Standard coff internal info.  */
7533965Sjdp  unsigned short f_magic;	/* magic number			*/
7633965Sjdp  unsigned short f_nscns;	/* number of sections		*/
7733965Sjdp  long f_timdat;		/* time & date stamp		*/
7833965Sjdp  bfd_vma f_symptr;		/* file pointer to symtab	*/
7933965Sjdp  long f_nsyms;			/* number of symtab entries	*/
8033965Sjdp  unsigned short f_opthdr;	/* sizeof(optional hdr)		*/
8133965Sjdp  unsigned short f_flags;	/* flags			*/
8277298Sobrien  unsigned short f_target_id;	/* (TI COFF specific)		*/
8333965Sjdp};
8433965Sjdp
8533965Sjdp
8633965Sjdp/* Bits for f_flags:
8789857Sobrien 	F_RELFLG	relocation info stripped from file
8889857Sobrien 	F_EXEC		file is executable (no unresolved external references)
8989857Sobrien 	F_LNNO		line numbers stripped from file
9089857Sobrien 	F_LSYMS		local symbols stripped from file
9189857Sobrien 	F_AR16WR	file is 16-bit little-endian
9289857Sobrien 	F_AR32WR	file is 32-bit little-endian
9389857Sobrien 	F_AR32W		file is 32-bit big-endian
9489857Sobrien 	F_DYNLOAD	rs/6000 aix: dynamically loadable w/imports & exports
9589857Sobrien 	F_SHROBJ	rs/6000 aix: file is a shared object
96213274Srpaulo	F_DLL           PE format DLL
97213274Srpaulo	F_GO32STUB      Field go32stub contains valid data.  */
9833965Sjdp
9933965Sjdp#define	F_RELFLG	(0x0001)
10033965Sjdp#define	F_EXEC		(0x0002)
10133965Sjdp#define	F_LNNO		(0x0004)
10233965Sjdp#define	F_LSYMS		(0x0008)
10333965Sjdp#define	F_AR16WR	(0x0080)
10433965Sjdp#define	F_AR32WR	(0x0100)
10533965Sjdp#define	F_AR32W     	(0x0200)
10633965Sjdp#define	F_DYNLOAD	(0x1000)
10733965Sjdp#define	F_SHROBJ	(0x2000)
10833965Sjdp#define F_DLL           (0x2000)
109213274Srpaulo#define F_GO32STUB      (0x4000)
11033965Sjdp
11189857Sobrien/* Extra structure which is used in the optional header.  */
11233965Sjdptypedef struct _IMAGE_DATA_DIRECTORY
11333965Sjdp{
11433965Sjdp  bfd_vma VirtualAddress;
11533965Sjdp  long    Size;
11633965Sjdp}  IMAGE_DATA_DIRECTORY;
117213274Srpaulo#define PE_EXPORT_TABLE			0
118213274Srpaulo#define PE_IMPORT_TABLE			1
119213274Srpaulo#define PE_RESOURCE_TABLE		2
120213274Srpaulo#define PE_EXCEPTION_TABLE		3
121213274Srpaulo#define PE_CERTIFICATE_TABLE		4
122213274Srpaulo#define PE_BASE_RELOCATION_TABLE	5
123213274Srpaulo#define PE_DEBUG_DATA			6
124213274Srpaulo#define PE_ARCHITECTURE			7
125213274Srpaulo#define PE_GLOBAL_PTR			8
126213274Srpaulo#define PE_TLS_TABLE			9
127213274Srpaulo#define PE_LOAD_CONFIG_TABLE		10
128213274Srpaulo#define PE_BOUND_IMPORT_TABLE		11
129213274Srpaulo#define PE_IMPORT_ADDRESS_TABLE		12
130213274Srpaulo#define PE_DELAY_IMPORT_DESCRIPTOR	13
131213274Srpaulo#define PE_CLR_RUNTIME_HEADER		14
132213274Srpaulo/* DataDirectory[15] is currently reserved, so no define. */
13333965Sjdp#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES  16
13433965Sjdp
13560484Sobrien/* Default image base for NT.  */
13633965Sjdp#define NT_EXE_IMAGE_BASE 0x400000
13733965Sjdp#define NT_DLL_IMAGE_BASE 0x10000000
13833965Sjdp
13960484Sobrien/* Default image base for BeOS. */
14060484Sobrien#define BEOS_EXE_IMAGE_BASE 0x80000000
14160484Sobrien#define BEOS_DLL_IMAGE_BASE 0x10000000
14260484Sobrien
14333965Sjdp/* Extra stuff in a PE aouthdr */
14433965Sjdp
14533965Sjdp#define PE_DEF_SECTION_ALIGNMENT 0x1000
14677298Sobrien#ifndef PE_DEF_FILE_ALIGNMENT
14777298Sobrien# define PE_DEF_FILE_ALIGNMENT 0x200
14877298Sobrien#endif
14933965Sjdp
15033965Sjdpstruct internal_extra_pe_aouthdr
15133965Sjdp{
152213274Srpaulo  /* FIXME: The following entries are in AOUTHDR.  But they aren't
153213274Srpaulo     available internally in bfd.  We add them here so that objdump
154213274Srpaulo     can dump them.  */
155213274Srpaulo  /* The state of the image file  */
156213274Srpaulo  short Magic;
157213274Srpaulo  /* Linker major version number */
158213274Srpaulo  char MajorLinkerVersion;
159213274Srpaulo  /* Linker minor version number  */
160213274Srpaulo  char MinorLinkerVersion;
161213274Srpaulo  /* Total size of all code sections  */
162213274Srpaulo  long SizeOfCode;
163213274Srpaulo  /* Total size of all initialized data sections  */
164213274Srpaulo  long SizeOfInitializedData;
165213274Srpaulo  /* Total size of all uninitialized data sections  */
166213274Srpaulo  long SizeOfUninitializedData;
167213274Srpaulo  /* Address of entry point relative to image base.  */
168213274Srpaulo  bfd_vma AddressOfEntryPoint;
169213274Srpaulo  /* Address of the first code section relative to image base.  */
170213274Srpaulo  bfd_vma BaseOfCode;
171213274Srpaulo  /* Address of the first data section relative to image base.  */
172213274Srpaulo  bfd_vma BaseOfData;
173213274Srpaulo
17433965Sjdp  /* PE stuff  */
17533965Sjdp  bfd_vma ImageBase;		/* address of specific location in memory that
17633965Sjdp				   file is located, NT default 0x10000 */
17733965Sjdp
17833965Sjdp  bfd_vma SectionAlignment;	/* section alignment default 0x1000 */
17933965Sjdp  bfd_vma FileAlignment;	/* file alignment default 0x200 */
18033965Sjdp  short   MajorOperatingSystemVersion; /* minimum version of the operating */
18133965Sjdp  short   MinorOperatingSystemVersion; /* system req'd for exe, default to 1*/
18233965Sjdp  short   MajorImageVersion;	/* user defineable field to store version of */
18333965Sjdp  short   MinorImageVersion;	/* exe or dll being created, default to 0 */
18433965Sjdp  short   MajorSubsystemVersion; /* minimum subsystem version required to */
18533965Sjdp  short   MinorSubsystemVersion; /* run exe; default to 3.1 */
18633965Sjdp  long    Reserved1;		/* seems to be 0 */
18733965Sjdp  long    SizeOfImage;		/* size of memory to allocate for prog */
18833965Sjdp  long    SizeOfHeaders;	/* size of PE header and section table */
18933965Sjdp  long    CheckSum;		/* set to 0 */
19033965Sjdp  short   Subsystem;
19133965Sjdp
19233965Sjdp  /* type of subsystem exe uses for user interface,
19333965Sjdp     possible values:
19433965Sjdp     1 - NATIVE   Doesn't require a subsystem
19533965Sjdp     2 - WINDOWS_GUI runs in Windows GUI subsystem
19633965Sjdp     3 - WINDOWS_CUI runs in Windows char sub. (console app)
19733965Sjdp     5 - OS2_CUI runs in OS/2 character subsystem
19833965Sjdp     7 - POSIX_CUI runs in Posix character subsystem */
199213274Srpaulo  unsigned short DllCharacteristics; /* flags for DLL init  */
20033965Sjdp  bfd_vma SizeOfStackReserve;	/* amount of memory to reserve  */
20133965Sjdp  bfd_vma SizeOfStackCommit;	/* amount of memory initially committed for
20233965Sjdp				   initial thread's stack, default is 0x1000 */
20333965Sjdp  bfd_vma SizeOfHeapReserve;	/* amount of virtual memory to reserve and */
20433965Sjdp  bfd_vma SizeOfHeapCommit;	/* commit, don't know what to defaut it to */
20533965Sjdp  long    LoaderFlags;		/* can probably set to 0 */
20633965Sjdp  long    NumberOfRvaAndSizes;	/* number of entries in next entry, 16 */
20733965Sjdp  IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
20833965Sjdp};
20933965Sjdp
21033965Sjdp/********************** AOUT "OPTIONAL HEADER" **********************/
21133965Sjdpstruct internal_aouthdr
21233965Sjdp{
21333965Sjdp  short magic;			/* type of file				*/
21433965Sjdp  short vstamp;			/* version stamp			*/
21533965Sjdp  bfd_vma tsize;		/* text size in bytes, padded to FW bdry*/
21633965Sjdp  bfd_vma dsize;		/* initialized data "  "		*/
21733965Sjdp  bfd_vma bsize;		/* uninitialized data "   "		*/
21833965Sjdp  bfd_vma entry;		/* entry pt.				*/
21933965Sjdp  bfd_vma text_start;		/* base of text used for this file */
22033965Sjdp  bfd_vma data_start;		/* base of data used for this file */
22133965Sjdp
22233965Sjdp  /* i960 stuff */
22333965Sjdp  unsigned long tagentries;	/* number of tag entries to follow */
22433965Sjdp
22533965Sjdp  /* RS/6000 stuff */
22689857Sobrien  bfd_vma o_toc;		/* address of TOC			*/
22733965Sjdp  short o_snentry;		/* section number for entry point */
22833965Sjdp  short o_sntext;		/* section number for text	*/
22933965Sjdp  short o_sndata;		/* section number for data	*/
23033965Sjdp  short o_sntoc;		/* section number for toc	*/
23133965Sjdp  short o_snloader;		/* section number for loader section */
23233965Sjdp  short o_snbss;		/* section number for bss	*/
23333965Sjdp  short o_algntext;		/* max alignment for text	*/
23433965Sjdp  short o_algndata;		/* max alignment for data	*/
23533965Sjdp  short o_modtype;		/* Module type field, 1R,RE,RO	*/
23633965Sjdp  short o_cputype;		/* Encoded CPU type		*/
23789857Sobrien  bfd_vma o_maxstack;	/* max stack size allowed.	*/
23889857Sobrien  bfd_vma o_maxdata;	/* max data size allowed.	*/
23933965Sjdp
24033965Sjdp  /* ECOFF stuff */
24133965Sjdp  bfd_vma bss_start;		/* Base of bss section.		*/
24233965Sjdp  bfd_vma gp_value;		/* GP register value.		*/
24333965Sjdp  unsigned long gprmask;	/* General registers used.	*/
24433965Sjdp  unsigned long cprmask[4];	/* Coprocessor registers used.	*/
24533965Sjdp  unsigned long fprmask;	/* Floating pointer registers used.  */
24633965Sjdp
24733965Sjdp  /* Apollo stuff */
24833965Sjdp  long o_inlib;			/* inlib data */
24933965Sjdp  long o_sri;			/* Static Resource Information */
25033965Sjdp  long vid[2];			/* Version id */
25133965Sjdp
25233965Sjdp  struct internal_extra_pe_aouthdr pe;
25333965Sjdp};
25433965Sjdp
25533965Sjdp/********************** STORAGE CLASSES **********************/
25633965Sjdp
25733965Sjdp/* This used to be defined as -1, but now n_sclass is unsigned.  */
25833965Sjdp#define C_EFCN		0xff	/* physical end of function	*/
25933965Sjdp#define C_NULL		0
26033965Sjdp#define C_AUTO		1	/* automatic variable		*/
26133965Sjdp#define C_EXT		2	/* external symbol		*/
26233965Sjdp#define C_STAT		3	/* static			*/
26333965Sjdp#define C_REG		4	/* register variable		*/
26433965Sjdp#define C_EXTDEF	5	/* external definition		*/
26533965Sjdp#define C_LABEL		6	/* label			*/
26633965Sjdp#define C_ULABEL	7	/* undefined label		*/
26733965Sjdp#define C_MOS		8	/* member of structure		*/
26833965Sjdp#define C_ARG		9	/* function argument		*/
26933965Sjdp#define C_STRTAG	10	/* structure tag		*/
27033965Sjdp#define C_MOU		11	/* member of union		*/
27133965Sjdp#define C_UNTAG		12	/* union tag			*/
27233965Sjdp#define C_TPDEF		13	/* type definition		*/
27333965Sjdp#define C_USTATIC	14	/* undefined static		*/
27433965Sjdp#define C_ENTAG		15	/* enumeration tag		*/
27533965Sjdp#define C_MOE		16	/* member of enumeration	*/
27633965Sjdp#define C_REGPARM	17	/* register parameter		*/
27733965Sjdp#define C_FIELD		18	/* bit field			*/
27833965Sjdp#define C_AUTOARG	19	/* auto argument		*/
27933965Sjdp#define C_LASTENT	20	/* dummy entry (end of block)	*/
28033965Sjdp#define C_BLOCK		100	/* ".bb" or ".eb"		*/
28133965Sjdp#define C_FCN		101	/* ".bf" or ".ef"		*/
28233965Sjdp#define C_EOS		102	/* end of structure		*/
28333965Sjdp#define C_FILE		103	/* file name			*/
28433965Sjdp#define C_LINE		104	/* line # reformatted as symbol table entry */
28533965Sjdp#define C_ALIAS	 	105	/* duplicate tag		*/
28633965Sjdp#define C_HIDDEN	106	/* ext symbol in dmert public lib */
287130561Sobrien#define C_WEAKEXT	127	/* weak symbol -- GNU extension.  */
28838889Sjdp
28977298Sobrien/* New storage classes for TI COFF */
29060484Sobrien#define C_UEXT		19	/* Tentative external definition */
29160484Sobrien#define C_STATLAB	20	/* Static load time label */
29260484Sobrien#define C_EXTLAB	21	/* External load time label */
29360484Sobrien#define C_SYSTEM	23	/* System Wide variable */
29460484Sobrien
29533965Sjdp/* New storage classes for WINDOWS_NT   */
29633965Sjdp#define C_SECTION       104     /* section name */
29733965Sjdp#define C_NT_WEAK	105	/* weak external */
29833965Sjdp
29933965Sjdp /* New storage classes for 80960 */
30033965Sjdp
30133965Sjdp/* C_LEAFPROC is obsolete.  Use C_LEAFEXT or C_LEAFSTAT */
30233965Sjdp#define C_LEAFPROC	108	/* Leaf procedure, "call" via BAL */
30333965Sjdp
30433965Sjdp#define C_SCALL		107	/* Procedure reachable via system call */
30533965Sjdp#define C_LEAFEXT       108	/* External leaf */
30633965Sjdp#define C_LEAFSTAT      113	/* Static leaf */
30733965Sjdp#define C_OPTVAR	109	/* Optimized variable		*/
30833965Sjdp#define C_DEFINE	110	/* Preprocessor #define		*/
30933965Sjdp#define C_PRAGMA	111	/* Advice to compiler or linker	*/
31033965Sjdp#define C_SEGMENT	112	/* 80960 segment name		*/
31133965Sjdp
31233965Sjdp  /* Storage classes for m88k */
31333965Sjdp#define C_SHADOW        107     /* shadow symbol                */
31433965Sjdp#define C_VERSION       108     /* coff version symbol          */
31533965Sjdp
31633965Sjdp /* New storage classes for RS/6000 */
31733965Sjdp#define C_HIDEXT        107	/* Un-named external symbol */
31833965Sjdp#define C_BINCL         108	/* Marks beginning of include file */
31933965Sjdp#define C_EINCL         109	/* Marks ending of include file */
320213274Srpaulo#define C_AIX_WEAKEXT   111	/* AIX definition of C_WEAKEXT.  */
32133965Sjdp
322213274Srpaulo#if defined _AIX52 || defined AIX_WEAK_SUPPORT
323213274Srpaulo#undef C_WEAKEXT
324213274Srpaulo#define C_WEAKEXT       C_AIX_WEAKEXT
325213274Srpaulo#endif
326213274Srpaulo
32733965Sjdp /* storage classes for stab symbols for RS/6000 */
32833965Sjdp#define C_GSYM          (0x80)
32933965Sjdp#define C_LSYM          (0x81)
33033965Sjdp#define C_PSYM          (0x82)
33133965Sjdp#define C_RSYM          (0x83)
33233965Sjdp#define C_RPSYM         (0x84)
33333965Sjdp#define C_STSYM         (0x85)
33433965Sjdp#define C_TCSYM         (0x86)
33533965Sjdp#define C_BCOMM         (0x87)
33633965Sjdp#define C_ECOML         (0x88)
33733965Sjdp#define C_ECOMM         (0x89)
33833965Sjdp#define C_DECL          (0x8c)
33933965Sjdp#define C_ENTRY         (0x8d)
34033965Sjdp#define C_FUN           (0x8e)
34133965Sjdp#define C_BSTAT         (0x8f)
34233965Sjdp#define C_ESTAT         (0x90)
34333965Sjdp
34438889Sjdp/* Storage classes for Thumb symbols */
34560484Sobrien#define C_THUMBEXT      (128 + C_EXT)		/* 130 */
34660484Sobrien#define C_THUMBSTAT     (128 + C_STAT)		/* 131 */
34760484Sobrien#define C_THUMBLABEL    (128 + C_LABEL)		/* 134 */
34860484Sobrien#define C_THUMBEXTFUNC  (C_THUMBEXT  + 20)	/* 150 */
34960484Sobrien#define C_THUMBSTATFUNC (C_THUMBSTAT + 20)	/* 151 */
35038889Sjdp
351213274Srpaulo/* True if XCOFF symbols of class CLASS have auxillary csect information.  */
352213274Srpaulo#define CSECT_SYM_P(CLASS) \
353213274Srpaulo  ((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT || (CLASS) == C_HIDEXT)
354213274Srpaulo
35533965Sjdp/********************** SECTION HEADER **********************/
35633965Sjdp
35733965Sjdp#define SCNNMLEN (8)
35833965Sjdp
35933965Sjdpstruct internal_scnhdr
36033965Sjdp{
36133965Sjdp  char s_name[SCNNMLEN];	/* section name			*/
36233965Sjdp
36333965Sjdp  /* Physical address, aliased s_nlib.
36433965Sjdp     In the pei format, this field is the virtual section size
36533965Sjdp     (the size of the section after being loaded int memory),
36633965Sjdp     NOT the physical address.  */
36733965Sjdp  bfd_vma s_paddr;
36833965Sjdp
36933965Sjdp  bfd_vma s_vaddr;		/* virtual address		*/
37033965Sjdp  bfd_vma s_size;		/* section size			*/
37133965Sjdp  bfd_vma s_scnptr;		/* file ptr to raw data for section */
37233965Sjdp  bfd_vma s_relptr;		/* file ptr to relocation	*/
37333965Sjdp  bfd_vma s_lnnoptr;		/* file ptr to line numbers	*/
37433965Sjdp  unsigned long s_nreloc;	/* number of relocation entries	*/
37533965Sjdp  unsigned long s_nlnno;	/* number of line number entries*/
37633965Sjdp  long s_flags;			/* flags			*/
37733965Sjdp  long s_align;			/* used on I960			*/
37877298Sobrien  unsigned char s_page;         /* TI COFF load page            */
37933965Sjdp};
38033965Sjdp
38189857Sobrien/* s_flags "type".  */
38233965Sjdp#define STYP_REG	 (0x0000)	/* "regular": allocated, relocated, loaded */
38333965Sjdp#define STYP_DSECT	 (0x0001)	/* "dummy":  relocated only*/
38433965Sjdp#define STYP_NOLOAD	 (0x0002)	/* "noload": allocated, relocated, not loaded */
38533965Sjdp#define STYP_GROUP	 (0x0004)	/* "grouped": formed of input sections */
38633965Sjdp#define STYP_PAD	 (0x0008)	/* "padding": not allocated, not relocated, loaded */
38733965Sjdp#define STYP_COPY	 (0x0010)	/* "copy": for decision function used by field update;  not allocated, not relocated,
38833965Sjdp									     loaded; reloc & lineno entries processed normally */
38933965Sjdp#define STYP_TEXT	 (0x0020)	/* section contains text only */
39033965Sjdp#define S_SHRSEG	 (0x0020)	/* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
39133965Sjdp									     will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
39233965Sjdp									     update all process invocations. */
39333965Sjdp#define STYP_DATA	 (0x0040)	/* section contains data only */
39433965Sjdp#define STYP_BSS	 (0x0080)	/* section contains bss only */
39533965Sjdp#define S_NEWFCN	 (0x0100)	/* In a minimal file or an update file, a new function (as compared with a replaced function) */
39633965Sjdp#define STYP_INFO	 (0x0200)	/* comment: not allocated not relocated, not loaded */
39733965Sjdp#define STYP_OVER	 (0x0400)	/* overlay: relocated not allocated or loaded */
39833965Sjdp#define STYP_LIB	 (0x0800)	/* for .lib: same as INFO */
39933965Sjdp#define STYP_MERGE	 (0x2000)	/* merge section -- combines with text, data or bss sections only */
40089857Sobrien#define STYP_REVERSE_PAD (0x4000)	/* section will be padded with no-op instructions
40189857Sobrien					   wherever padding is necessary and there is a
40289857Sobrien					   word of contiguous bytes beginning on a word
40389857Sobrien					   boundary. */
40433965Sjdp
40533965Sjdp#define STYP_LIT	0x8020	/* Literal data (like STYP_TEXT) */
40633965Sjdp
40733965Sjdp
40833965Sjdp/********************** LINE NUMBERS **********************/
40933965Sjdp
41033965Sjdp/* 1 line number entry for every "breakpointable" source line in a section.
41189857Sobrien   Line numbers are grouped on a per function basis; first entry in a function
41289857Sobrien   grouping will have l_lnno = 0 and in place of physical address will be the
41389857Sobrien   symbol table index of the function name.  */
41433965Sjdp
41533965Sjdpstruct internal_lineno
41633965Sjdp{
41733965Sjdp  union
41833965Sjdp  {
41989857Sobrien    bfd_signed_vma l_symndx;		/* function name symbol index, iff l_lnno == 0*/
42089857Sobrien    bfd_signed_vma l_paddr;		/* (physical) address of line number	*/
42133965Sjdp  }     l_addr;
42233965Sjdp  unsigned long l_lnno;		/* line number		*/
42333965Sjdp};
42433965Sjdp
42533965Sjdp/********************** SYMBOLS **********************/
42633965Sjdp
42733965Sjdp#define SYMNMLEN	8	/* # characters in a symbol name	*/
42833965Sjdp#define FILNMLEN	14	/* # characters in a file name		*/
42933965Sjdp#define DIMNUM		4	/* # array dimensions in auxiliary entry */
43033965Sjdp
43133965Sjdpstruct internal_syment
43233965Sjdp{
43333965Sjdp  union
43433965Sjdp  {
435213274Srpaulo    char _n_name[SYMNMLEN];	/* old COFF version		*/
43633965Sjdp    struct
43733965Sjdp    {
438213274Srpaulo      long _n_zeroes;		/* new == 0			*/
439213274Srpaulo      long _n_offset;		/* offset into string table	*/
44033965Sjdp    }      _n_n;
44133965Sjdp    char *_n_nptr[2];		/* allows for overlaying	*/
44233965Sjdp  }     _n;
443213274Srpaulo  bfd_vma n_value;		/* value of symbol		*/
44433965Sjdp  short n_scnum;		/* section number		*/
44533965Sjdp  unsigned short n_flags;	/* copy of flags from filhdr	*/
44633965Sjdp  unsigned short n_type;	/* type and derived type	*/
44733965Sjdp  unsigned char n_sclass;	/* storage class		*/
44833965Sjdp  unsigned char n_numaux;	/* number of aux. entries	*/
44933965Sjdp};
45033965Sjdp
45133965Sjdp#define n_name		_n._n_name
45233965Sjdp#define n_zeroes	_n._n_n._n_zeroes
45333965Sjdp#define n_offset	_n._n_n._n_offset
45433965Sjdp
45533965Sjdp/* Relocatable symbols have number of the section in which they are defined,
45689857Sobrien   or one of the following:  */
45733965Sjdp
45833965Sjdp#define N_UNDEF	((short)0)	/* undefined symbol */
45933965Sjdp#define N_ABS	((short)-1)	/* value of symbol is absolute */
46033965Sjdp#define N_DEBUG	((short)-2)	/* debugging symbol -- value is meaningless */
46133965Sjdp#define N_TV	((short)-3)	/* indicates symbol needs preload transfer vector */
46233965Sjdp#define P_TV	((short)-4)	/* indicates symbol needs postload transfer vector*/
46333965Sjdp
46489857Sobrien/* Type of a symbol, in low N bits of the word.  */
46589857Sobrien
46633965Sjdp#define T_NULL		0
46733965Sjdp#define T_VOID		1	/* function argument (only used by compiler) */
46833965Sjdp#define T_CHAR		2	/* character		*/
46933965Sjdp#define T_SHORT		3	/* short integer	*/
47033965Sjdp#define T_INT		4	/* integer		*/
47133965Sjdp#define T_LONG		5	/* long integer		*/
47233965Sjdp#define T_FLOAT		6	/* floating point	*/
47333965Sjdp#define T_DOUBLE	7	/* double word		*/
47433965Sjdp#define T_STRUCT	8	/* structure 		*/
47533965Sjdp#define T_UNION		9	/* union 		*/
47633965Sjdp#define T_ENUM		10	/* enumeration 		*/
47733965Sjdp#define T_MOE		11	/* member of enumeration*/
47833965Sjdp#define T_UCHAR		12	/* unsigned character	*/
47933965Sjdp#define T_USHORT	13	/* unsigned short	*/
48033965Sjdp#define T_UINT		14	/* unsigned integer	*/
48133965Sjdp#define T_ULONG		15	/* unsigned long	*/
48233965Sjdp#define T_LNGDBL	16	/* long double		*/
48333965Sjdp
48489857Sobrien/* Derived types, in n_type.  */
48589857Sobrien
48633965Sjdp#define DT_NON		(0)	/* no derived type */
48733965Sjdp#define DT_PTR		(1)	/* pointer */
48833965Sjdp#define DT_FCN		(2)	/* function */
48933965Sjdp#define DT_ARY		(3)	/* array */
49033965Sjdp
49133965Sjdp#define BTYPE(x)	((x) & N_BTMASK)
49260484Sobrien#define DTYPE(x)	(((x) & N_TMASK) >> N_BTSHFT)
49333965Sjdp
49438889Sjdp#define ISPTR(x) \
49538889Sjdp  (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_PTR << N_BTSHFT))
49638889Sjdp#define ISFCN(x) \
49738889Sjdp  (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_FCN << N_BTSHFT))
49838889Sjdp#define ISARY(x) \
49938889Sjdp  (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_ARY << N_BTSHFT))
50038889Sjdp#define ISTAG(x) \
50138889Sjdp  ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)
50238889Sjdp#define DECREF(x) \
50338889Sjdp  ((((x) >> N_TSHIFT) & ~ N_BTMASK) | ((x) & N_BTMASK))
50433965Sjdp
50533965Sjdpunion internal_auxent
50633965Sjdp{
50733965Sjdp  struct
50833965Sjdp  {
50933965Sjdp
51033965Sjdp    union
51133965Sjdp    {
51233965Sjdp      long l;			/* str, un, or enum tag indx */
51333965Sjdp      struct coff_ptr_struct *p;
51433965Sjdp    }     x_tagndx;
51533965Sjdp
51633965Sjdp    union
51733965Sjdp    {
51833965Sjdp      struct
51933965Sjdp      {
52033965Sjdp	unsigned short x_lnno;	/* declaration line number */
52133965Sjdp	unsigned short x_size;	/* str/union/array size */
52233965Sjdp      }      x_lnsz;
52333965Sjdp      long x_fsize;		/* size of function */
52433965Sjdp    }     x_misc;
52533965Sjdp
52633965Sjdp    union
52733965Sjdp    {
52833965Sjdp      struct
52933965Sjdp      {				/* if ISFCN, tag, or .bb */
53089857Sobrien	bfd_signed_vma x_lnnoptr;		/* ptr to fcn line # */
53133965Sjdp	union
53233965Sjdp	{			/* entry ndx past block end */
53333965Sjdp	  long l;
53433965Sjdp	  struct coff_ptr_struct *p;
53533965Sjdp	}     x_endndx;
53633965Sjdp      }      x_fcn;
53733965Sjdp
53833965Sjdp      struct
53933965Sjdp      {				/* if ISARY, up to 4 dimen. */
54033965Sjdp	unsigned short x_dimen[DIMNUM];
54133965Sjdp      }      x_ary;
54233965Sjdp    }     x_fcnary;
54333965Sjdp
54433965Sjdp    unsigned short x_tvndx;	/* tv index */
54533965Sjdp  }      x_sym;
54633965Sjdp
54733965Sjdp  union
54833965Sjdp  {
54933965Sjdp    char x_fname[FILNMLEN];
55033965Sjdp    struct
55133965Sjdp    {
55233965Sjdp      long x_zeroes;
55333965Sjdp      long x_offset;
55433965Sjdp    }      x_n;
55533965Sjdp  }     x_file;
55633965Sjdp
55733965Sjdp  struct
55833965Sjdp  {
55933965Sjdp    long x_scnlen;		/* section length */
56033965Sjdp    unsigned short x_nreloc;	/* # relocation entries */
56133965Sjdp    unsigned short x_nlinno;	/* # line numbers */
56233965Sjdp    unsigned long x_checksum;	/* section COMDAT checksum for PE */
56333965Sjdp    unsigned short x_associated; /* COMDAT associated section index for PE */
56433965Sjdp    unsigned char x_comdat;	/* COMDAT selection number for PE */
56533965Sjdp  }      x_scn;
56633965Sjdp
56733965Sjdp  struct
56833965Sjdp  {
56933965Sjdp    long x_tvfill;		/* tv fill value */
57033965Sjdp    unsigned short x_tvlen;	/* length of .tv */
57133965Sjdp    unsigned short x_tvran[2];	/* tv range */
57233965Sjdp  }      x_tv;			/* info about .tv section (in auxent of symbol .tv)) */
57333965Sjdp
57433965Sjdp  /******************************************
57533965Sjdp   * RS/6000-specific auxent - last auxent for every external symbol
57633965Sjdp   ******************************************/
57733965Sjdp  struct
57833965Sjdp  {
57933965Sjdp    union
58033965Sjdp      {				/* csect length or enclosing csect */
58189857Sobrien	bfd_signed_vma l;
58233965Sjdp	struct coff_ptr_struct *p;
58333965Sjdp      } x_scnlen;
58433965Sjdp    long x_parmhash;		/* parm type hash index */
58533965Sjdp    unsigned short x_snhash;	/* sect num with parm hash */
58633965Sjdp    unsigned char x_smtyp;	/* symbol align and type */
58733965Sjdp    /* 0-4 - Log 2 of alignment */
58833965Sjdp    /* 5-7 - symbol type */
58933965Sjdp    unsigned char x_smclas;	/* storage mapping class */
59033965Sjdp    long x_stab;		/* dbx stab info index */
59133965Sjdp    unsigned short x_snstab;	/* sect num with dbx stab */
59233965Sjdp  }      x_csect;		/* csect definition information */
59333965Sjdp
59433965Sjdp/* x_smtyp values:  */
59533965Sjdp
59633965Sjdp#define	SMTYP_ALIGN(x)	((x) >> 3)	/* log2 of alignment */
59733965Sjdp#define	SMTYP_SMTYP(x)	((x) & 0x7)	/* symbol type */
59833965Sjdp/* Symbol type values:  */
59933965Sjdp#define	XTY_ER	0		/* External reference */
60033965Sjdp#define	XTY_SD	1		/* Csect definition */
60133965Sjdp#define	XTY_LD	2		/* Label definition */
60233965Sjdp#define XTY_CM	3		/* .BSS */
60333965Sjdp#define	XTY_EM	4		/* Error message */
60433965Sjdp#define	XTY_US	5		/* "Reserved for internal use" */
60533965Sjdp
60633965Sjdp/* x_smclas values:  */
60733965Sjdp
60833965Sjdp#define	XMC_PR	0		/* Read-only program code */
60933965Sjdp#define	XMC_RO	1		/* Read-only constant */
61033965Sjdp#define	XMC_DB	2		/* Read-only debug dictionary table */
61133965Sjdp#define	XMC_TC	3		/* Read-write general TOC entry */
61233965Sjdp#define	XMC_UA	4		/* Read-write unclassified */
61333965Sjdp#define	XMC_RW	5		/* Read-write data */
61433965Sjdp#define	XMC_GL	6		/* Read-only global linkage */
61533965Sjdp#define	XMC_XO	7		/* Read-only extended operation */
61633965Sjdp#define	XMC_SV	8		/* Read-only supervisor call */
61733965Sjdp#define	XMC_BS	9		/* Read-write BSS */
61833965Sjdp#define	XMC_DS	10		/* Read-write descriptor csect */
61933965Sjdp#define	XMC_UC	11		/* Read-write unnamed Fortran common */
62033965Sjdp#define	XMC_TI	12		/* Read-only traceback index csect */
62133965Sjdp#define	XMC_TB	13		/* Read-only traceback table csect */
62233965Sjdp/* 		14	??? */
62333965Sjdp#define	XMC_TC0	15		/* Read-write TOC anchor */
62433965Sjdp#define XMC_TD	16		/* Read-write data in TOC */
62533965Sjdp
62633965Sjdp  /******************************************
62733965Sjdp   *  I960-specific *2nd* aux. entry formats
62833965Sjdp   ******************************************/
62933965Sjdp  struct
63033965Sjdp  {
63133965Sjdp    /* This is a very old typo that keeps getting propagated. */
63233965Sjdp#define x_stdindx x_stindx
63333965Sjdp    long x_stindx;		/* sys. table entry */
63433965Sjdp  }      x_sc;			/* system call entry */
63533965Sjdp
63633965Sjdp  struct
63733965Sjdp  {
63833965Sjdp    unsigned long x_balntry;	/* BAL entry point */
63933965Sjdp  }      x_bal;			/* BAL-callable function */
64033965Sjdp
64133965Sjdp  struct
64233965Sjdp  {
64333965Sjdp    unsigned long x_timestamp;	/* time stamp */
64433965Sjdp    char x_idstring[20];	/* producer identity string */
64533965Sjdp  }      x_ident;		/* Producer ident info */
64633965Sjdp
64733965Sjdp};
64833965Sjdp
64933965Sjdp/********************** RELOCATION DIRECTIVES **********************/
65033965Sjdp
65133965Sjdpstruct internal_reloc
65233965Sjdp{
65333965Sjdp  bfd_vma r_vaddr;		/* Virtual address of reference */
65433965Sjdp  long r_symndx;		/* Index into symbol table	*/
65533965Sjdp  unsigned short r_type;	/* Relocation type		*/
65633965Sjdp  unsigned char r_size;		/* Used by RS/6000 and ECOFF	*/
65733965Sjdp  unsigned char r_extern;	/* Used by ECOFF		*/
65833965Sjdp  unsigned long r_offset;	/* Used by Alpha ECOFF, SPARC, others */
65933965Sjdp};
66033965Sjdp
661213274Srpaulo/* X86-64 relocations.  */
662213274Srpaulo#define R_AMD64_ABS 		 0 /* Reference is absolute, no relocation is necessary.  */
663213274Srpaulo#define R_AMD64_DIR64		 1 /* 64-bit address (VA).  */
664213274Srpaulo#define R_AMD64_DIR32		 2 /* 32-bit address (VA) R_DIR32.  */
665213274Srpaulo#define R_AMD64_IMAGEBASE	 3 /* 32-bit absolute ref w/o base R_IMAGEBASE.  */
666213274Srpaulo#define R_AMD64_PCRLONG		 4 /* 32-bit relative address from byte following reloc R_PCRLONG.  */
667213274Srpaulo#define R_AMD64_PCRLONG_1	 5 /* 32-bit relative address from byte distance 1 from reloc.  */
668213274Srpaulo#define R_AMD64_PCRLONG_2	 6 /* 32-bit relative address from byte distance 2 from reloc.  */
669213274Srpaulo#define R_AMD64_PCRLONG_3	 7 /* 32-bit relative address from byte distance 3 from reloc.  */
670213274Srpaulo#define R_AMD64_PCRLONG_4	 8 /* 32-bit relative address from byte distance 4 from reloc.  */
671213274Srpaulo#define R_AMD64_PCRLONG_5	 9 /* 32-bit relative address from byte distance 5 from reloc.  */
672213274Srpaulo#define R_AMD64_SECTION		10 /* Section index.  */
673213274Srpaulo#define R_AMD64_SECREL		11 /* 32 bit offset from base of section containing target R_SECREL.  */
674213274Srpaulo#define R_AMD64_SECREL7		12 /* 7 bit unsigned offset from base of section containing target.  */
675213274Srpaulo#define R_AMD64_TOKEN		13 /* 32 bit metadata token.  */
676213274Srpaulo#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.  */
677213274Srpaulo
678213274Srpaulo/* i386 Relocations.  */
679213274Srpaulo
68060484Sobrien#define R_DIR16 	 1
681130561Sobrien#define R_REL24          5
68260484Sobrien#define R_DIR32 	 6
68360484Sobrien#define R_IMAGEBASE	 7
684213274Srpaulo#define R_SECREL32	11
68560484Sobrien#define R_RELBYTE	15
68660484Sobrien#define R_RELWORD	16
68760484Sobrien#define R_RELLONG	17
68860484Sobrien#define R_PCRBYTE	18
68960484Sobrien#define R_PCRWORD	19
69060484Sobrien#define R_PCRLONG	20
691130561Sobrien#define R_PCR24         21
69260484Sobrien#define R_IPRSHORT	24
69360484Sobrien#define R_IPRLONG	26
69460484Sobrien#define R_GETSEG	29
69560484Sobrien#define R_GETPA 	30
69660484Sobrien#define R_TAGWORD	31
69760484Sobrien#define R_JUMPTARG	32	/* strange 29k 00xx00xx reloc */
698130561Sobrien#define R_PARTLS16      32
699130561Sobrien#define R_PARTMS8       33
70033965Sjdp
70160484Sobrien#define R_PCR16L       128
70260484Sobrien#define R_PCR26L       129
70360484Sobrien#define R_VRT16        130
70460484Sobrien#define R_HVRT16       131
70560484Sobrien#define R_LVRT16       132
70660484Sobrien#define R_VRT32        133
70733965Sjdp
70833965Sjdp
70933965Sjdp/* This reloc identifies mov.b instructions with a 16bit absolute
71033965Sjdp   address.  The linker tries to turn insns with this reloc into
71133965Sjdp   an absolute 8-bit address.  */
71233965Sjdp#define R_MOV16B1    	0x41
71333965Sjdp
71433965Sjdp/* This reloc identifies mov.b instructions which had a 16bit
71533965Sjdp   absolute address which have been shortened into a 8-bit
71633965Sjdp   absolute address.  */
71733965Sjdp#define R_MOV16B2 	0x42
71833965Sjdp
71933965Sjdp/* This reloc identifies jmp insns with a 16bit target address;
72033965Sjdp   the linker tries to turn these insns into bra insns with
72133965Sjdp   an 8bit pc-relative target.  */
72233965Sjdp#define R_JMP1     	0x43
72333965Sjdp
72433965Sjdp/* This reloc identifies a bra with an 8-bit pc-relative
72589857Sobrien   target that was formerly a jmp insn with a 16bit target.  */
72633965Sjdp#define R_JMP2 		0x44
72733965Sjdp
72833965Sjdp/* ??? */
72933965Sjdp#define R_RELLONG_NEG  	0x45
73033965Sjdp
73133965Sjdp/* This reloc identifies jmp insns with a 24bit target address;
73233965Sjdp   the linker tries to turn these insns into bra insns with
73333965Sjdp   an 8bit pc-relative target.  */
73433965Sjdp#define R_JMPL1     	0x46
73533965Sjdp
73633965Sjdp/* This reloc identifies a bra with an 8-bit pc-relative
73789857Sobrien   target that was formerly a jmp insn with a 24bit target.  */
73833965Sjdp#define R_JMPL2		0x47
73933965Sjdp
74033965Sjdp/* This reloc identifies mov.b instructions with a 24bit absolute
74133965Sjdp   address.  The linker tries to turn insns with this reloc into
74233965Sjdp   an absolute 8-bit address.  */
74333965Sjdp
74433965Sjdp#define R_MOV24B1    	0x48
74533965Sjdp
74633965Sjdp/* This reloc identifies mov.b instructions which had a 24bit
74733965Sjdp   absolute address which have been shortened into a 8-bit
74833965Sjdp   absolute address.  */
74933965Sjdp#define R_MOV24B2 	0x49
75033965Sjdp
75133965Sjdp/* An h8300 memory indirect jump/call.  Forces the address of the jump/call
75233965Sjdp   target into the function vector (in page zero), and the address of the
75333965Sjdp   vector entry to be placed in the jump/call instruction.  */
75433965Sjdp#define R_MEM_INDIRECT	0x4a
75533965Sjdp
75633965Sjdp/* This reloc identifies a 16bit pc-relative branch target which was
75733965Sjdp   shortened into an 8bit pc-relative branch target.  */
75833965Sjdp#define R_PCRWORD_B	0x4b
75933965Sjdp
76033965Sjdp/* This reloc identifies mov.[wl] instructions with a 32/24 bit
76133965Sjdp   absolute address; the linker may turn this into a mov.[wl]
76233965Sjdp   insn with a 16bit absolute address.  */
76333965Sjdp#define R_MOVL1    	0x4c
76433965Sjdp
76589857Sobrien/* This reloc identifies mov.[wl] insns which formerly had
76660484Sobrien   a 32/24bit absolute address and now have a 16bit absolute address.  */
76733965Sjdp#define R_MOVL2 	0x4d
76833965Sjdp
76933965Sjdp/* This reloc identifies a bCC:8 which will have it's condition
77033965Sjdp   inverted and its target redirected to the target of the branch
77133965Sjdp   in the following insn.  */
77233965Sjdp#define R_BCC_INV	0x4e
77333965Sjdp
77433965Sjdp/* This reloc identifies a jmp instruction that has been deleted.  */
77533965Sjdp#define R_JMP_DEL	0x4f
77633965Sjdp
77733965Sjdp/* Z8k modes */
77833965Sjdp#define R_IMM16   0x01		/* 16 bit abs */
77933965Sjdp#define R_JR	  0x02		/* jr  8 bit disp */
78033965Sjdp#define R_IMM4L   0x23		/* low nibble */
78133965Sjdp#define R_IMM8    0x22		/* 8 bit abs */
78233965Sjdp#define R_IMM32   R_RELLONG	/* 32 bit abs */
78333965Sjdp#define R_CALL    R_DA		/* Absolute address which could be a callr */
78433965Sjdp#define R_JP	  R_DA		/* Absolute address which could be a jp */
78533965Sjdp#define R_REL16   0x04		/* 16 bit PC rel */
78633965Sjdp#define R_CALLR	  0x05		/* callr 12 bit disp */
78733965Sjdp#define R_SEG     0x10		/* set if in segmented mode */
78833965Sjdp#define R_IMM4H   0x24		/* high nibble */
78933965Sjdp#define R_DISP7   0x25          /* djnz displacement */
79033965Sjdp
791213274Srpaulo/* Z80 modes */
792213274Srpaulo#define R_OFF8    0x32		/* 8 bit signed abs, for (i[xy]+d) */
793213274Srpaulo#define R_IMM24   0x33          /* 24 bit abs */
794213274Srpaulo/* R_JR, R_IMM8, R_IMM16, R_IMM32 - as for Z8k */
795213274Srpaulo
79633965Sjdp/* H8500 modes */
79733965Sjdp
79833965Sjdp#define R_H8500_IMM8  	1		/*  8 bit immediate 	*/
79933965Sjdp#define R_H8500_IMM16 	2		/* 16 bit immediate	*/
80033965Sjdp#define R_H8500_PCREL8 	3		/*  8 bit pcrel 	*/
80133965Sjdp#define R_H8500_PCREL16 4		/* 16 bit pcrel 	*/
80233965Sjdp#define R_H8500_HIGH8  	5		/* high 8 bits of 24 bit address */
80333965Sjdp#define R_H8500_LOW16 	7		/* low 16 bits of 24 bit immediate */
80433965Sjdp#define R_H8500_IMM24	6		/* 24 bit immediate */
80533965Sjdp#define R_H8500_IMM32   8               /* 32 bit immediate */
80633965Sjdp#define R_H8500_HIGH16  9		/* high 16 bits of 32 bit immediate */
80733965Sjdp
80833965Sjdp/* W65 modes */
80933965Sjdp
81033965Sjdp#define R_W65_ABS8	1  /* addr & 0xff 		*/
81133965Sjdp#define R_W65_ABS16	2  /* addr & 0xffff 		*/
81233965Sjdp#define R_W65_ABS24	3  /* addr & 0xffffff 		*/
81333965Sjdp
81433965Sjdp#define R_W65_ABS8S8    4  /* (addr >> 8) & 0xff 	*/
81533965Sjdp#define R_W65_ABS8S16   5  /* (addr >> 16) & 0xff 	*/
81633965Sjdp
81733965Sjdp#define R_W65_ABS16S8   6  /* (addr >> 8) & 0ffff 	*/
81833965Sjdp#define R_W65_ABS16S16  7  /* (addr >> 16) & 0ffff 	*/
81933965Sjdp
82033965Sjdp#define R_W65_PCR8	8
82133965Sjdp#define R_W65_PCR16	9
82233965Sjdp
82333965Sjdp#define R_W65_DP       10  /* direct page 8 bits only   */
82433965Sjdp
82533965Sjdp#endif /* GNU_COFF_INTERNAL_H */
826