OSDN Git Service

Re-autconf configure script after Mike Frysinger's recent AC_ERROR
[uclinux-h8/elf2flt.git] / flat.h
1 /*
2  * Copyright (C) 2002-2005  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  * This is Free Software, under the GNU Public Licence v2 or greater.
10  *
11  */
12
13 #ifndef _LINUX_FLAT_H
14 #define _LINUX_FLAT_H
15
16 #ifdef __KERNEL__
17 #include <linux/types.h>
18 #include <asm/flat.h>
19 #endif
20
21 #define FLAT_VERSION                    0x00000004L
22
23 #ifdef CONFIG_BINFMT_SHARED_FLAT
24 #define MAX_SHARED_LIBS                 (4)
25 #else
26 #define MAX_SHARED_LIBS                 (1)
27 #endif
28
29 /*
30  * To make everything easier to port and manage cross platform
31  * development,  all fields are in network byte order.
32  */
33
34 struct flat_hdr {
35     char magic[4];
36     uint32_t rev;          /* version (as above) */
37     uint32_t entry;        /* Offset of first executable instruction
38                               with text segment from beginning of file */
39     uint32_t data_start;   /* Offset of data segment from beginning of
40                               file */
41     uint32_t data_end;     /* Offset of end of data segment from beginning
42                               of file */
43     uint32_t bss_end;      /* Offset of end of bss segment from beginning
44                               of file */
45
46     /* (It is assumed that data_end through bss_end forms the bss segment.) */
47
48     uint32_t stack_size;   /* Size of stack, in bytes */
49     uint32_t reloc_start;  /* Offset of relocation records from beginning
50                               of file */
51     uint32_t reloc_count;  /* Number of relocation records */
52     uint32_t flags;       
53     uint32_t build_date;   /* When the program/library was built */
54     uint32_t filler[5];    /* Reservered, set to zero */
55 };
56
57 #define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
58 #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
59 #define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
60 #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
61 #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
62
63 #ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
64 /*
65  * While it would be nice to keep this header clean,  users of older
66  * tools still need this support in the kernel.  So this section is
67  * purely for compatibility with old tool chains.
68  *
69  * DO NOT make changes or enhancements to the old format please,  just work
70  *        with the format above,  except to fix bugs with old format support.
71  */
72
73 #include <asm/byteorder.h>
74
75 #define OLD_FLAT_VERSION                0x00000002L
76 #define OLD_FLAT_RELOC_TYPE_TEXT        0
77 #define OLD_FLAT_RELOC_TYPE_DATA        1
78 #define OLD_FLAT_RELOC_TYPE_BSS         2
79
80 typedef union {
81     uint32_t        value;
82     struct {
83 # if defined(mc68000) && !defined(CONFIG_COLDFIRE)
84         int32_t     offset : 30;
85         uint32_t    type   : 2;
86 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
87 # elif defined(__BIG_ENDIAN_BITFIELD)
88         uint32_t    type   : 2;
89         int32_t     offset : 30;
90 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
91 # elif defined(__LITTLE_ENDIAN_BITFIELD)
92         int32_t     offset : 30;
93         uint32_t    type   : 2;
94 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
95 # else
96 #       error "Unknown bitfield order for flat files."
97 # endif
98     } reloc;
99 } flat_v2_reloc_t;
100
101 #endif /* __KERNEL__ */
102
103 #endif /* _LINUX_FLAT_H */
104
105 /* this __MUST__ be at the VERY end of the file - do NOT move!!
106  * Local Variables:
107  * c-basic-offset: 4
108  * tab-width: 8
109  * end:
110  * vi: tabstop=8 shiftwidth=4 textwidth=79 noexpandtab
111  */