00001 /* 00002 * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> 00003 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> 00004 * The Silver Hammer Group, Ltd. 00005 * 00006 * This file provides the definitions and structures needed to 00007 * support uClinux flat-format executables. 00008 */ 00009 00010 #define FLAT_VERSION 0x00000004L 00011 00012 #ifdef CONFIG_BINFMT_SHARED_FLAT 00013 #define MAX_SHARED_LIBS (4) 00014 #else 00015 #define MAX_SHARED_LIBS (1) 00016 #endif 00017 00018 /* 00019 * To make everything easier to port and manage cross platform 00020 * development, all fields are in network byte order. 00021 */ 00022 00023 struct flat_hdr { 00024 char magic[4]; 00025 abi_ulong rev; /* version (as above) */ 00026 abi_ulong entry; /* Offset of first executable instruction 00027 with text segment from beginning of file */ 00028 abi_ulong data_start; /* Offset of data segment from beginning of 00029 file */ 00030 abi_ulong data_end; /* Offset of end of data segment 00031 from beginning of file */ 00032 abi_ulong bss_end; /* Offset of end of bss segment from beginning 00033 of file */ 00034 00035 /* (It is assumed that data_end through bss_end forms the bss segment.) */ 00036 00037 abi_ulong stack_size; /* Size of stack, in bytes */ 00038 abi_ulong reloc_start; /* Offset of relocation records from 00039 beginning of file */ 00040 abi_ulong reloc_count; /* Number of relocation records */ 00041 abi_ulong flags; 00042 abi_ulong build_date; /* When the program/library was built */ 00043 abi_ulong filler[5]; /* Reservered, set to zero */ 00044 }; 00045 00046 #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ 00047 #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ 00048 #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ 00049 #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ 00050 #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ 00051 00052 00053 /* 00054 * While it would be nice to keep this header clean, users of older 00055 * tools still need this support in the kernel. So this section is 00056 * purely for compatibility with old tool chains. 00057 * 00058 * DO NOT make changes or enhancements to the old format please, just work 00059 * with the format above, except to fix bugs with old format support. 00060 */ 00061 00062 #define OLD_FLAT_VERSION 0x00000002L 00063 #define OLD_FLAT_RELOC_TYPE_TEXT 0 00064 #define OLD_FLAT_RELOC_TYPE_DATA 1 00065 #define OLD_FLAT_RELOC_TYPE_BSS 2 00066 00067 # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */