Changeset 618 for trunk/src/binutils/include/aout/aout64.h
- Timestamp:
- Aug 16, 2003, 11:33:53 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/binutils/include/aout/aout64.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r617 r618 1 1 /* `a.out' object-file definitions, including extensions to 64-bit fields 2 2 3 Copyright 2001 Free Software Foundation, Inc.3 Copyright 2001, 2003 Free Software Foundation, Inc. 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 20 20 #define __A_OUT_64_H__ 21 21 22 /* This is the layout on disk of the 32-bit or 64-bit exec header. */ 22 #ifndef BYTES_IN_WORD 23 #define BYTES_IN_WORD 4 24 #endif 25 26 /* This is the layout on disk of the 32-bit or 64-bit exec header. */ 23 27 24 28 #ifndef external_exec 25 29 struct external_exec 26 30 { 27 bfd_byte e_info[4]; /* magic number and stuff*/28 bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes*/29 bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes*/30 bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes*/31 bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes*/32 bfd_byte e_entry[BYTES_IN_WORD]; /* start address*/33 bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info*/34 bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info*/31 bfd_byte e_info[4]; /* Magic number and stuff. */ 32 bfd_byte e_text[BYTES_IN_WORD]; /* Length of text section in bytes. */ 33 bfd_byte e_data[BYTES_IN_WORD]; /* Length of data section in bytes. */ 34 bfd_byte e_bss[BYTES_IN_WORD]; /* Length of bss area in bytes. */ 35 bfd_byte e_syms[BYTES_IN_WORD]; /* Length of symbol table in bytes. */ 36 bfd_byte e_entry[BYTES_IN_WORD]; /* Start address. */ 37 bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info. */ 38 bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info. */ 35 39 }; 36 40 37 41 #define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) 38 42 39 /* Magic numbers for a.out files */43 /* Magic numbers for a.out files. */ 40 44 41 45 #if ARCH_SIZE==64 42 #define OMAGIC 0x1001 /* Code indicating object file */46 #define OMAGIC 0x1001 /* Code indicating object file. */ 43 47 #define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */ 44 48 #define NMAGIC 0x1003 /* Code indicating pure executable. */ … … 50 54 && N_MAGIC(x) != ZMAGIC) 51 55 #else 52 #define OMAGIC 0407 /* ...object file or impure executable. */56 #define OMAGIC 0407 /* Object file or impure executable. */ 53 57 #define NMAGIC 0410 /* Code indicating pure executable. */ 54 58 #define ZMAGIC 0413 /* Code indicating demand-paged executable. */ … … 127 131 * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true, 128 132 and for which the starting address is TARGET_PAGE_SIZE (or should this be 129 SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). 130 */ 133 SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). */ 131 134 132 135 /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header 133 136 in the text. */ 134 137 #ifndef N_HEADER_IN_TEXT 135 #define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) 138 #define N_HEADER_IN_TEXT(x) \ 139 (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) 136 140 #endif 137 141 … … 153 157 #ifndef N_TXTADDR 154 158 #define N_TXTADDR(x) \ 155 (/* The address of a QMAGIC file is always one page in, */ \ 156 /* with the header in the text. */ \ 157 N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \ 158 N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\ 159 N_SHARED_LIB(x) ? 0 : \ 160 N_HEADER_IN_TEXT(x) ? \ 161 TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\ 162 TEXT_START_ADDR /* a page of padding */\ 163 ) 159 (/* The address of a QMAGIC file is always one page in, \ 160 with the header in the text. */ \ 161 N_IS_QMAGIC (x) \ 162 ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE \ 163 : (N_MAGIC (x) != ZMAGIC \ 164 ? (bfd_vma) 0 /* Object file or NMAGIC. */ \ 165 : (N_SHARED_LIB (x) \ 166 ? (bfd_vma) 0 \ 167 : (N_HEADER_IN_TEXT (x) \ 168 ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE \ 169 : (bfd_vma) TEXT_START_ADDR)))) 164 170 #endif 165 171 … … 179 185 /* Offset in an a.out of the start of the text section. */ 180 186 #ifndef N_TXTOFF 181 #define N_TXTOFF(x) \ 182 (/* For {O,N,Q}MAGIC, no padding. */ \ 183 N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \ 184 N_SHARED_LIB(x) ? 0 : \ 185 N_HEADER_IN_TEXT(x) ? \ 186 EXEC_BYTES_SIZE : /* no padding */\ 187 ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\ 188 ) 187 #define N_TXTOFF(x) \ 188 (/* For {O,N,Q}MAGIC, no padding. */ \ 189 N_MAGIC (x) != ZMAGIC \ 190 ? EXEC_BYTES_SIZE \ 191 : (N_SHARED_LIB (x) \ 192 ? 0 \ 193 : (N_HEADER_IN_TEXT (x) \ 194 ? EXEC_BYTES_SIZE /* No padding. */ \ 195 : ZMAGIC_DISK_BLOCK_SIZE /* A page of padding. */))) 189 196 #endif 190 197 /* Size of the text section. It's always as stated, except that we … … 195 202 #ifndef N_TXTSIZE 196 203 #define N_TXTSIZE(x) \ 197 (/* For QMAGIC, we don't consider the header part of the text section. */\ 198 N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \ 199 (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \ 200 N_HEADER_IN_TEXT(x) ? \ 201 (x).a_text - EXEC_BYTES_SIZE: /* no padding */\ 202 (x).a_text /* a page of padding */\ 203 ) 204 (/* For QMAGIC, we don't consider the header part of the text section. */\ 205 N_IS_QMAGIC (x) \ 206 ? (x).a_text - EXEC_BYTES_SIZE \ 207 : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ 208 ? (x).a_text \ 209 : (N_HEADER_IN_TEXT (x) \ 210 ? (x).a_text - EXEC_BYTES_SIZE /* No padding. */ \ 211 : (x).a_text /* A page of padding. */ ))) 204 212 #endif 205 213 /* The address of the data segment in virtual memory. 206 214 It is the text segment address, plus text segment size, rounded 207 up to a N_SEGSIZE boundary for pure or pageable files. */215 up to a N_SEGSIZE boundary for pure or pageable files. */ 208 216 #ifndef N_DATADDR 209 217 #define N_DATADDR(x) \ 210 (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \ 211 : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) 218 (N_MAGIC (x) == OMAGIC \ 219 ? (N_TXTADDR (x) + N_TXTSIZE (x)) \ 220 : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1) \ 221 & ~ (bfd_vma) (N_SEGSIZE (x) - 1)))) 212 222 #endif 213 223 /* The address of the BSS segment -- immediately after the data segment. */ 214 224 215 #define N_BSSADDR(x) (N_DATADDR (x) + (x).a_data)225 #define N_BSSADDR(x) (N_DATADDR (x) + (x).a_data) 216 226 217 227 /* Offsets of the various portions of the file after the text segment. */ … … 230 240 231 241 #ifndef N_DATOFF 232 #define N_DATOFF(x) \ 233 (N_TXTOFF(x) + N_TXTSIZE(x)) 234 #endif 235 242 #define N_DATOFF(x) (N_TXTOFF (x) + N_TXTSIZE (x)) 243 #endif 236 244 #ifndef N_TRELOFF 237 #define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data)245 #define N_TRELOFF(x) (N_DATOFF (x) + (x).a_data) 238 246 #endif 239 247 #ifndef N_DRELOFF 240 #define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize)248 #define N_DRELOFF(x) (N_TRELOFF (x) + (x).a_trsize) 241 249 #endif 242 250 #ifndef N_SYMOFF 243 #define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize)251 #define N_SYMOFF(x) (N_DRELOFF (x) + (x).a_drsize) 244 252 #endif 245 253 #ifndef N_STROFF 246 #define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms)254 #define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) 247 255 #endif 248 256 … … 250 258 /* Symbols */ 251 259 #ifndef external_nlist 252 struct external_nlist { 253 bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ 254 bfd_byte e_type[1]; /* type of symbol */ 255 bfd_byte e_other[1]; /* misc info (usually empty) */ 256 bfd_byte e_desc[2]; /* description field */ 257 bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ 260 struct external_nlist 261 { 262 bfd_byte e_strx[BYTES_IN_WORD]; /* Index into string table of name. */ 263 bfd_byte e_type[1]; /* Type of symbol. */ 264 bfd_byte e_other[1]; /* Misc info (usually empty). */ 265 bfd_byte e_desc[2]; /* Description field. */ 266 bfd_byte e_value[BYTES_IN_WORD]; /* Value of symbol. */ 258 267 }; 259 268 #define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) 260 269 #endif 261 270 262 struct internal_nlist { 263 unsigned long n_strx; /* index into string table of name */ 264 unsigned char n_type; /* type of symbol */ 265 unsigned char n_other; /* misc info (usually empty) */ 266 unsigned short n_desc; /* description field */ 267 bfd_vma n_value; /* value of symbol */ 271 struct internal_nlist 272 { 273 unsigned long n_strx; /* Index into string table of name. */ 274 unsigned char n_type; /* Type of symbol. */ 275 unsigned char n_other; /* Misc info (usually empty). */ 276 unsigned short n_desc; /* Description field. */ 277 bfd_vma n_value; /* Value of symbol. */ 268 278 }; 269 279 270 280 /* The n_type field is the symbol type, containing: */ 271 281 272 #define N_UNDF 0 /* Undefined symbol */273 #define N_ABS 2 /* Absolute symbol -- defined at particular addr */274 #define N_TEXT 4 /* Text sym -- defined at offset in text seg */275 #define N_DATA 6 /* Data sym -- defined at offset in data seg */276 #define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */277 #define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */278 #define N_FN 0x1f /* File name of .o file */279 #define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */282 #define N_UNDF 0 /* Undefined symbol. */ 283 #define N_ABS 2 /* Absolute symbol -- defined at particular addr. */ 284 #define N_TEXT 4 /* Text sym -- defined at offset in text seg. */ 285 #define N_DATA 6 /* Data sym -- defined at offset in data seg. */ 286 #define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg. */ 287 #define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink). */ 288 #define N_FN 0x1f /* File name of .o file. */ 289 #define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh). */ 280 290 /* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, 281 291 N_DATA, or N_BSS. When the low-order bit of other types is set, 282 292 (e.g. N_WARNING versus N_FN), they are two different types. */ 283 #define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */293 #define N_EXT 1 /* External symbol (as opposed to local-to-this-file). */ 284 294 #define N_TYPE 0x1e 285 #define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */295 #define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol. */ 286 296 287 297 #define N_INDR 0x0a … … 299 309 300 310 /* These appear as input to LD, in a .o file. */ 301 #define N_SETA 0x14 /* Absolute set element symbol */302 #define N_SETT 0x16 /* Text set element symbol */303 #define N_SETD 0x18 /* Data set element symbol */304 #define N_SETB 0x1A /* Bss set element symbol */311 #define N_SETA 0x14 /* Absolute set element symbol. */ 312 #define N_SETT 0x16 /* Text set element symbol. */ 313 #define N_SETD 0x18 /* Data set element symbol. */ 314 #define N_SETB 0x1A /* Bss set element symbol. */ 305 315 306 316 /* This is output from LD. */ … … 337 347 the target with a displacement of 16 or 32 bits. On the sparc, move 338 348 instructions use an offset of 14 bits, so the offset is stored in 339 the reloc field, and the data in the section is ignored. 340 */ 349 the reloc field, and the data in the section is ignored. */ 341 350 342 351 /* This structure describes a single relocation to be performed. … … 345 354 Likewise, the data-relocation section applies to the data section. */ 346 355 347 struct reloc_std_external { 348 bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ 349 bfd_byte r_index[3]; /* symbol table index of symbol */ 350 bfd_byte r_type[1]; /* relocation type */ 356 struct reloc_std_external 357 { 358 bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */ 359 bfd_byte r_index[3]; /* Symbol table index of symbol. */ 360 bfd_byte r_type[1]; /* Relocation type. */ 351 361 }; 352 362 … … 371 381 #define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40) 372 382 373 #define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */383 #define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry. */ 374 384 375 385 struct reloc_std_internal … … 394 404 /* The next three bits are for SunOS shared libraries, and seem to 395 405 be undocumented. */ 396 unsigned int r_baserel:1; /* Linkage table relative */397 unsigned int r_jmptable:1; /* pc-relative to jump table */398 unsigned int r_relative:1; /* "relative relocation" */406 unsigned int r_baserel:1; /* Linkage table relative. */ 407 unsigned int r_jmptable:1; /* pc-relative to jump table. */ 408 unsigned int r_relative:1; /* "relative relocation". */ 399 409 /* unused */ 400 unsigned int r_pad:1; /* Padding -- set to zero */ 401 }; 402 403 404 /* EXTENDED RELOCS */ 405 406 struct reloc_ext_external { 407 bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ 408 bfd_byte r_index[3]; /* symbol table index of symbol */ 409 bfd_byte r_type[1]; /* relocation type */ 410 bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ 410 unsigned int r_pad:1; /* Padding -- set to zero. */ 411 }; 412 413 414 /* EXTENDED RELOCS. */ 415 416 struct reloc_ext_external 417 { 418 bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */ 419 bfd_byte r_index[3]; /* Symbol table index of symbol. */ 420 bfd_byte r_type[1]; /* Relocation type. */ 421 bfd_byte r_addend[BYTES_IN_WORD]; /* Datum addend. */ 411 422 }; 412 423 … … 435 446 #endif 436 447 437 /* Bytes per relocation entry */448 /* Bytes per relocation entry. */ 438 449 #define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) 439 450 440 451 enum reloc_type 441 452 { 442 /* simple relocations*/453 /* Simple relocations. */ 443 454 RELOC_8, /* data[0:7] = addend + sv */ 444 455 RELOC_16, /* data[0:15] = addend + sv */ 445 456 RELOC_32, /* data[0:31] = addend + sv */ 446 /* pc-rel displacement*/457 /* PC-rel displacement. */ 447 458 RELOC_DISP8, /* data[0:7] = addend - pc + sv */ 448 459 RELOC_DISP16, /* data[0:15] = addend - pc + sv */ 449 460 RELOC_DISP32, /* data[0:31] = addend - pc + sv */ 450 /* Special */461 /* Special. */ 451 462 RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ 452 463 RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ … … 457 468 RELOC_SFA_BASE, 458 469 RELOC_SFA_OFF13, 459 /* P.I.C. (base-relative) */470 /* P.I.C. (base-relative). */ 460 471 RELOC_BASE10, /* Not sure - maybe we can do this the */ 461 472 RELOC_BASE13, /* right way now */ 462 473 RELOC_BASE22, 463 /* for some sort of pc-rel P.I.C. (?)*/474 /* For some sort of pc-rel P.I.C. (?) */ 464 475 RELOC_PC10, 465 476 RELOC_PC22, 466 /* P.I.C. jump table */477 /* P.I.C. jump table. */ 467 478 RELOC_JMP_TBL, 468 /* reputedly for shared libraries somehow*/479 /* Reputedly for shared libraries somehow. */ 469 480 RELOC_SEGOFF16, 470 481 RELOC_GLOB_DAT, … … 478 489 RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ 479 490 480 /* 29K relocation types */491 /* 29K relocation types. */ 481 492 RELOC_JUMPTARG, 482 493 RELOC_CONST, 483 494 RELOC_CONSTH, 484 495 485 /* All the new ones I can think of, for sparc v9 */ 486 496 /* All the new ones I can think of, for sparc v9. */ 487 497 RELOC_64, /* data[0:63] = addend + sv */ 488 498 RELOC_DISP64, /* data[0:63] = addend - pc + sv */ … … 494 504 Since this is a clean slate, can we throw away the ones we dont 495 505 understand ? Should we sort the values ? What about using a 496 microcode format like the 68k ? 497 */ 506 microcode format like the 68k ? */ 498 507 NO_RELOC 499 508 }; 500 509 501 510 502 struct reloc_internal { 503 bfd_vma r_address; /* offset of of data to relocate */ 504 long r_index; /* symbol table index of symbol */ 505 enum reloc_type r_type; /* relocation type */ 506 bfd_vma r_addend; /* datum addend */ 511 struct reloc_internal 512 { 513 bfd_vma r_address; /* Offset of of data to relocate. */ 514 long r_index; /* Symbol table index of symbol. */ 515 enum reloc_type r_type; /* Relocation type. */ 516 bfd_vma r_addend; /* Datum addend. */ 507 517 }; 508 518 … … 511 521 512 522 Q. 513 What about archive indexes ? 514 515 */ 523 What about archive indexes ? */ 516 524 517 525 #endif /* __A_OUT_64_H__ */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.