00001 /* COFF spec for AMD 290*0 00002 00003 Copyright 2001 Free Software Foundation, Inc. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 Contributed by David Wood @ New York University. */ 00020 00021 #ifndef AMD 00022 # define AMD 00023 #endif 00024 00025 #define L_LNNO_SIZE 2 00026 #include "coff/external.h" 00027 00028 /* 00029 ** Magic numbers for Am29000 00030 ** (AT&T will assign the "real" magic number) 00031 */ 00032 00033 #define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */ 00034 #define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */ 00035 00036 #define A29K_MAGIC_BIG SIPFBOMAGIC 00037 #define A29K_MAGIC_LITTLE SIPRBOMAGIC 00038 #define A29KBADMAG(x) ( ((x).f_magic != A29K_MAGIC_BIG) && \ 00039 ((x).f_magic != A29K_MAGIC_LITTLE)) 00040 00041 #define OMAGIC A29K_MAGIC_BIG 00042 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ 00043 00044 /* 00045 ** File header flags currently known to us. 00046 ** 00047 ** Am29000 will use the F_AR32WR and F_AR32W flags to indicate 00048 ** the byte ordering in the file. 00049 */ 00050 00051 /*--------------------------------------------------------------*/ 00052 00053 00054 /* aouthdr magic numbers */ 00055 #define NMAGIC 0410 /* separate i/d executable */ 00056 #define SHMAGIC 0406 /* NYU/Ultra3 shared data executable 00057 (writable text) */ 00058 #undef _ETEXT 00059 #define _ETEXT "_etext" 00060 00061 /*--------------------------------------------------------------*/ 00062 00063 00064 /* More names of "special" sections. */ 00065 #define _LIT ".lit" 00066 00067 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ 00068 00069 /* 00070 ** Section types - with additional section type for global 00071 ** registers which will be relocatable for the Am29000. 00072 ** 00073 ** In instances where it is necessary for a linker to produce an 00074 ** output file which contains text or data not based at virtual 00075 ** address 0, e.g. for a ROM, then the linker should accept 00076 ** address base information as command input and use PAD sections 00077 ** to skip over unused addresses. 00078 */ 00079 00080 #define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ 00081 #define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ 00082 #define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ 00083 00084 /*--------------------------------------------------------------*/ 00085 00086 /* 00087 ** Relocation information declaration and related definitions 00088 */ 00089 00090 struct external_reloc 00091 { 00092 char r_vaddr[4]; /* (virtual) address of reference */ 00093 char r_symndx[4]; /* index into symbol table */ 00094 char r_type[2]; /* relocation type */ 00095 }; 00096 00097 #define RELOC struct external_reloc 00098 #define RELSZ 10 /* sizeof (RELOC) */ 00099 00100 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ 00101 00102 /* 00103 ** Relocation types for the Am29000 00104 */ 00105 00106 #define R_ABS 0 /* reference is absolute */ 00107 00108 #define R_IREL 030 /* instruction relative (jmp/call) */ 00109 #define R_IABS 031 /* instruction absolute (jmp/call) */ 00110 #define R_ILOHALF 032 /* instruction low half (const) */ 00111 #define R_IHIHALF 033 /* instruction high half (consth) part 1 */ 00112 #define R_IHCONST 034 /* instruction high half (consth) part 2 */ 00113 /* constant offset of R_IHIHALF relocation */ 00114 #define R_BYTE 035 /* relocatable byte value */ 00115 #define R_HWORD 036 /* relocatable halfword value */ 00116 #define R_WORD 037 /* relocatable word value */ 00117 00118 #define R_IGLBLRC 040 /* instruction global register RC */ 00119 #define R_IGLBLRA 041 /* instruction global register RA */ 00120 #define R_IGLBLRB 042 /* instruction global register RB */ 00121 00122 /* 00123 NOTE: 00124 All the "I" forms refer to 29000 instruction formats. The linker is 00125 expected to know how the numeric information is split and/or aligned 00126 within the instruction word(s). R_BYTE works for instructions, too. 00127 00128 If the parameter to a CONSTH instruction is a relocatable type, two 00129 relocation records are written. The first has an r_type of R_IHIHALF 00130 (33 octal) and a normal r_vaddr and r_symndx. The second relocation 00131 record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which 00132 is redundant), and an r_symndx containing the 32-bit constant offset 00133 to the relocation instead of the actual symbol table index. This 00134 second record is always written, even if the constant offset is zero. 00135 The constant fields of the instruction are set to zero. 00136 */ 00137 00138 /*--------------------------------------------------------------*/ 00139 00140 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ 00141 00142 /* 00143 ** Storage class definitions - new classes for global registers. 00144 */ 00145 00146 #define C_GLBLREG 19 /* global register */ 00147 #define C_EXTREG 20 /* external global register */ 00148 #define C_DEFREG 21 /* ext. def. of global register */
1.5.6