2
0

flat.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com>
  3. * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
  4. * The Silver Hammer Group, Ltd.
  5. *
  6. * This file provides the definitions and structures needed to
  7. * support uClinux flat-format executables.
  8. */
  9. #ifndef LINUX_USER_FLAT_H
  10. #define LINUX_USER_FLAT_H
  11. #define FLAT_VERSION 0x00000004L
  12. /* QEMU doesn't support bflt shared libraries */
  13. #define MAX_SHARED_LIBS (1)
  14. /*
  15. * To make everything easier to port and manage cross platform
  16. * development, all fields are in network byte order.
  17. */
  18. struct flat_hdr {
  19. char magic[4];
  20. abi_ulong rev; /* version (as above) */
  21. abi_ulong entry; /* Offset of first executable instruction
  22. with text segment from beginning of file */
  23. abi_ulong data_start; /* Offset of data segment from beginning of
  24. file */
  25. abi_ulong data_end; /* Offset of end of data segment
  26. from beginning of file */
  27. abi_ulong bss_end; /* Offset of end of bss segment from beginning
  28. of file */
  29. /* (It is assumed that data_end through bss_end forms the bss segment.) */
  30. abi_ulong stack_size; /* Size of stack, in bytes */
  31. abi_ulong reloc_start; /* Offset of relocation records from
  32. beginning of file */
  33. abi_ulong reloc_count; /* Number of relocation records */
  34. abi_ulong flags;
  35. abi_ulong build_date; /* When the program/library was built */
  36. abi_ulong filler[5]; /* Reserved, set to zero */
  37. };
  38. #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */
  39. #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
  40. #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
  41. #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
  42. #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
  43. /*
  44. * While it would be nice to keep this header clean, users of older
  45. * tools still need this support in the kernel. So this section is
  46. * purely for compatibility with old tool chains.
  47. *
  48. * DO NOT make changes or enhancements to the old format please, just work
  49. * with the format above, except to fix bugs with old format support.
  50. */
  51. #define OLD_FLAT_VERSION 0x00000002L
  52. #define OLD_FLAT_RELOC_TYPE_TEXT 0
  53. #define OLD_FLAT_RELOC_TYPE_DATA 1
  54. #define OLD_FLAT_RELOC_TYPE_BSS 2
  55. # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */
  56. #endif