ecoff.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Some ECOFF definitions.
  4. */
  5. #include <stdint.h>
  6. typedef struct filehdr {
  7. uint16_t f_magic; /* magic number */
  8. uint16_t f_nscns; /* number of sections */
  9. int32_t f_timdat; /* time & date stamp */
  10. int32_t f_symptr; /* file pointer to symbolic header */
  11. int32_t f_nsyms; /* sizeof(symbolic hdr) */
  12. uint16_t f_opthdr; /* sizeof(optional hdr) */
  13. uint16_t f_flags; /* flags */
  14. } FILHDR;
  15. #define FILHSZ sizeof(FILHDR)
  16. #define MIPSEBMAGIC 0x160
  17. #define MIPSELMAGIC 0x162
  18. typedef struct scnhdr {
  19. char s_name[8]; /* section name */
  20. int32_t s_paddr; /* physical address, aliased s_nlib */
  21. int32_t s_vaddr; /* virtual address */
  22. int32_t s_size; /* section size */
  23. int32_t s_scnptr; /* file ptr to raw data for section */
  24. int32_t s_relptr; /* file ptr to relocation */
  25. int32_t s_lnnoptr; /* file ptr to gp histogram */
  26. uint16_t s_nreloc; /* number of relocation entries */
  27. uint16_t s_nlnno; /* number of gp histogram entries */
  28. int32_t s_flags; /* flags */
  29. } SCNHDR;
  30. #define SCNHSZ sizeof(SCNHDR)
  31. #define SCNROUND ((int32_t)16)
  32. typedef struct aouthdr {
  33. int16_t magic; /* see above */
  34. int16_t vstamp; /* version stamp */
  35. int32_t tsize; /* text size in bytes, padded to DW bdry*/
  36. int32_t dsize; /* initialized data " " */
  37. int32_t bsize; /* uninitialized data " " */
  38. int32_t entry; /* entry pt. */
  39. int32_t text_start; /* base of text used for this file */
  40. int32_t data_start; /* base of data used for this file */
  41. int32_t bss_start; /* base of bss used for this file */
  42. int32_t gprmask; /* general purpose register mask */
  43. int32_t cprmask[4]; /* co-processor register masks */
  44. int32_t gp_value; /* the gp value used for this object */
  45. } AOUTHDR;
  46. #define AOUTHSZ sizeof(AOUTHDR)
  47. #define OMAGIC 0407
  48. #define NMAGIC 0410
  49. #define ZMAGIC 0413
  50. #define SMAGIC 0411
  51. #define LIBMAGIC 0443
  52. #define N_TXTOFF(f, a) \
  53. ((a).magic == ZMAGIC || (a).magic == LIBMAGIC ? 0 : \
  54. ((a).vstamp < 23 ? \
  55. ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + 7) & 0xfffffff8) : \
  56. ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + SCNROUND-1) & ~(SCNROUND-1)) ) )
  57. #define N_DATOFF(f, a) \
  58. N_TXTOFF(f, a) + (a).tsize;