OSDN Git Service

A new config.sub with blackfin support
[uclinux-h8/elf2flt.git] / flat.h
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  * 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 <asm/flat.h>
18 #endif
19
20 #define FLAT_VERSION                    0x00000004L
21
22 #ifdef CONFIG_BINFMT_SHARED_FLAT
23 #define MAX_SHARED_LIBS                 (4)
24 #else
25 #define MAX_SHARED_LIBS                 (1)
26 #endif
27
28 /*
29  * To make everything easier to port and manage cross platform
30  * development,  all fields are in network byte order.
31  */
32
33 struct flat_hdr {
34         char magic[4];
35         unsigned long rev;          /* version (as above) */
36         unsigned long entry;        /* Offset of first executable instruction
37                                        with text segment from beginning of file */
38         unsigned long data_start;   /* Offset of data segment from beginning of
39                                        file */
40         unsigned long data_end;     /* Offset of end of data segment
41                                        from beginning of file */
42         unsigned long bss_end;      /* Offset of end of bss segment from beginning
43                                        of file */
44
45         /* (It is assumed that data_end through bss_end forms the bss segment.) */
46
47         unsigned long stack_size;   /* Size of stack, in bytes */
48         unsigned long reloc_start;  /* Offset of relocation records from
49                                        beginning of file */
50         unsigned long reloc_count;  /* Number of relocation records */
51         unsigned long flags;       
52         unsigned long build_date;   /* When the program/library was built */
53         unsigned long filler[5];    /* Reservered, set to zero */
54 };
55
56 #define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
57 #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
58 #define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
59 #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
60 #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
61
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         unsigned long   value;
82         struct {
83 # if defined(mc68000) && !defined(CONFIG_COLDFIRE)
84                 signed long offset : 30;
85                 unsigned long type : 2;
86 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
87 # elif defined(__BIG_ENDIAN_BITFIELD)
88                 unsigned long type : 2;
89                 signed long offset : 30;
90 #       define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
91 # elif defined(__LITTLE_ENDIAN_BITFIELD)
92                 signed long offset : 30;
93                 unsigned long 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 */