OSDN Git Service

cleanup a few things while adding support for the shared library flat file
[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 build_date;   /* When the program/library was built */
37         unsigned long filler[5];    /* Reservered, set to zero */
38 };
39
40 #define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
41 #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
42 #define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
43 #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
44
45
46 #ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
47 /*
48  * While it would be nice to keep this header clean,  users of older
49  * tools still need this support in the kernel.  So this section is
50  * purely for compatibility with old tool chains.
51  *
52  * DO NOT make changes or enhancements to the old format please,  just work
53  *        with the format above,  except to fix bugs with old format support.
54  */
55
56 #include <asm/byteorder.h>
57
58 #define OLD_FLAT_VERSION                        0x00000002L
59 #define OLD_FLAT_RELOC_TYPE_TEXT        0
60 #define OLD_FLAT_RELOC_TYPE_DATA        1
61 #define OLD_FLAT_RELOC_TYPE_BSS         2
62
63 typedef union {
64         unsigned long   value;
65         struct {
66 # if defined(mc68000) && !defined(CONFIG_COLDFIRE)
67                 signed long offset : 30;
68                 unsigned long type : 2;
69 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
70 # elif defined(__BIG_ENDIAN_BITFIELD)
71                 unsigned long type : 2;
72                 signed long offset : 30;
73 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
74 # elif defined(__LITTLE_ENDIAN_BITFIELD)
75                 signed long offset : 30;
76                 unsigned long type : 2;
77 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
78 # else
79 #       error "Unknown bitfield order for flat files."
80 # endif
81         } reloc;
82 } flat_v2_reloc_t;
83
84 #endif
85
86 #endif /* _LINUX_FLAT_H */