OSDN Git Service

Changes to compile under Solaris from The LEOX team <lpm@leox.org>.
[uclinux-h8/elf2flt.git] / flat.h
1
2 /* Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>
3  *                     The Silver Hammer Group, Ltd.
4  *
5  */
6
7 #ifndef _LINUX_FLAT_H
8 #define _LINUX_FLAT_H
9
10 #define FLAT_VERSION                    0x00000004L
11
12 /*
13  * To make everything easier to port and manage cross platform
14  * development,  all fields are in network byte order.
15  */
16
17 struct flat_hdr {
18         char magic[4];
19         unsigned long rev;          /* version (as above) */
20         unsigned long entry;        /* Offset of first executable instruction
21                                        with text segment from beginning of file */
22         unsigned long data_start;   /* Offset of data segment from beginning of
23                                        file */
24         unsigned long data_end;     /* Offset of end of data segment
25                                        from beginning of file */
26         unsigned long bss_end;      /* Offset of end of bss segment from beginning
27                                        of file */
28
29         /* (It is assumed that data_end through bss_end forms the bss segment.) */
30
31         unsigned long stack_size;   /* Size of stack, in bytes */
32         unsigned long reloc_start;  /* Offset of relocation records from
33                                        beginning of file */
34         unsigned long reloc_count;  /* Number of relocation records */
35         unsigned long flags;       
36         unsigned long filler[6];    /* Reservered, set to zero */
37 };
38
39 #define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
40 #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
41 #define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
42 #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
43
44
45 #ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
46 /*
47  * While it would be nice to keep this header clean,  users of older
48  * tools still need this support in the kernel.  So this section is
49  * purely for compatibility with old tool chains.
50  *
51  * DO NOT make changes or enhancements to the old format please,  just work
52  *        with the format above,  except to fix bugs with old format support.
53  */
54
55 #include <asm/byteorder.h>
56
57 #define OLD_FLAT_VERSION                        0x00000002L
58 #define OLD_FLAT_RELOC_TYPE_TEXT        0
59 #define OLD_FLAT_RELOC_TYPE_DATA        1
60 #define OLD_FLAT_RELOC_TYPE_BSS         2
61
62 typedef union {
63         unsigned long   value;
64         struct {
65 # if defined(mc68000) && !defined(CONFIG_COLDFIRE)
66                 signed long offset : 30;
67                 unsigned long type : 2;
68 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
69 # elif defined(__BIG_ENDIAN_BITFIELD)
70                 unsigned long type : 2;
71                 signed long offset : 30;
72 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
73 # elif defined(__LITTLE_ENDIAN_BITFIELD)
74                 signed long offset : 30;
75                 unsigned long type : 2;
76 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
77 # else
78 #       error "Unknown bitfield order for flat files."
79 # endif
80         } reloc;
81 } flat_v2_reloc_t;
82
83 #endif
84
85 #endif /* _LINUX_FLAT_H */