a.out.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* This file describes the a.out file format
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. /* JF I'm not sure where this file came from. I put the permit.text message in
  16. it anyway. This file came to me as part of the original VAX assembler */
  17. #define OMAGIC 0407
  18. #define NMAGIC 0410
  19. #define ZMAGIC 0413
  20. struct exec {
  21. long a_magic; /* number identifies as .o file and gives type of such. */
  22. unsigned a_text; /* length of text, in bytes */
  23. unsigned a_data; /* length of data, in bytes */
  24. unsigned a_bss; /* length of uninitialized data area for file, in bytes */
  25. unsigned a_syms; /* length of symbol table data in file, in bytes */
  26. unsigned a_entry; /* start address */
  27. unsigned a_trsize; /* length of relocation info for text, in bytes */
  28. unsigned a_drsize; /* length of relocation info for data, in bytes */
  29. };
  30. #define N_BADMAG(x) \
  31. (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC)
  32. #define N_TXTOFF(x) \
  33. ((x).a_magic == ZMAGIC ? 1024 : sizeof(struct exec))
  34. #define N_SYMOFF(x) \
  35. (N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize)
  36. #define N_STROFF(x) \
  37. (N_SYMOFF(x) + (x).a_syms)
  38. struct nlist {
  39. union {
  40. char *n_name;
  41. struct nlist *n_next;
  42. long n_strx;
  43. } n_un;
  44. char n_type;
  45. char n_other;
  46. short n_desc;
  47. unsigned n_value;
  48. };
  49. #define N_UNDF 0
  50. #define N_ABS 2
  51. #define N_TEXT 4
  52. #define N_DATA 6
  53. #define N_BSS 8
  54. #define N_FN 31 /* JF: Someone claims this should be 31 instead of
  55. 15. I just inherited this file; I didn't write
  56. it. Who is right? */
  57. #define N_EXT 1
  58. #define N_TYPE 036
  59. #define N_STAB 0340
  60. struct relocation_info {
  61. int r_address;
  62. unsigned r_symbolnum:24,
  63. r_pcrel:1,
  64. r_length:2,
  65. r_extern:1,
  66. r_bsr:1, /* OVE: used on ns32k based systems, if you want */
  67. r_disp:1, /* OVE: used on ns32k based systems, if you want */
  68. nuthin:2;
  69. };