Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

binfmt_flat: remove the uapi <linux/flat.h> header

The split between the two flat.h files is completely arbitrary, and the
uapi version even contains CONFIG_ ifdefs that can't work in userspace.
The only userspace program known to use the header is elf2flt, and it
ships with its own version of the combined header.

Use the chance to move the <asm/flat.h> inclusion out of this file, as it
is in no way needed for the format defintion, but just for the binfmt
implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>

authored by

Christoph Hellwig and committed by
Greg Ungerer
06d2bfed bdd15a28

+42 -63
+1
fs/binfmt_flat.c
··· 42 42 #include <asm/unaligned.h> 43 43 #include <asm/cacheflush.h> 44 44 #include <asm/page.h> 45 + #include <asm/flat.h> 45 46 46 47 #ifndef flat_get_relocate_addr 47 48 #define flat_get_relocate_addr(rel) (rel)
+41 -4
include/linux/flat.h
··· 10 10 #ifndef _LINUX_FLAT_H 11 11 #define _LINUX_FLAT_H 12 12 13 - #include <uapi/linux/flat.h> 14 - #include <asm/flat.h> 13 + #define FLAT_VERSION 0x00000004L 14 + 15 + #ifdef CONFIG_BINFMT_SHARED_FLAT 16 + #define MAX_SHARED_LIBS (4) 17 + #else 18 + #define MAX_SHARED_LIBS (1) 19 + #endif 20 + 21 + /* 22 + * To make everything easier to port and manage cross platform 23 + * development, all fields are in network byte order. 24 + */ 25 + 26 + struct flat_hdr { 27 + char magic[4]; 28 + unsigned long rev; /* version (as above) */ 29 + unsigned long entry; /* Offset of first executable instruction 30 + with text segment from beginning of file */ 31 + unsigned long data_start; /* Offset of data segment from beginning of 32 + file */ 33 + unsigned long data_end; /* Offset of end of data segment 34 + from beginning of file */ 35 + unsigned long bss_end; /* Offset of end of bss segment from beginning 36 + of file */ 37 + 38 + /* (It is assumed that data_end through bss_end forms the bss segment.) */ 39 + 40 + unsigned long stack_size; /* Size of stack, in bytes */ 41 + unsigned long reloc_start; /* Offset of relocation records from 42 + beginning of file */ 43 + unsigned long reloc_count; /* Number of relocation records */ 44 + unsigned long flags; 45 + unsigned long build_date; /* When the program/library was built */ 46 + unsigned long filler[5]; /* Reservered, set to zero */ 47 + }; 48 + 49 + #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ 50 + #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ 51 + #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ 52 + #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ 53 + #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ 15 54 16 55 /* 17 56 * While it would be nice to keep this header clean, users of older ··· 60 21 * DO NOT make changes or enhancements to the old format please, just work 61 22 * with the format above, except to fix bugs with old format support. 62 23 */ 63 - 64 - #include <asm/byteorder.h> 65 24 66 25 #define OLD_FLAT_VERSION 0x00000002L 67 26 #define OLD_FLAT_RELOC_TYPE_TEXT 0
-59
include/uapi/linux/flat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> 4 - * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> 5 - * The Silver Hammer Group, Ltd. 6 - * 7 - * This file provides the definitions and structures needed to 8 - * support uClinux flat-format executables. 9 - */ 10 - 11 - #ifndef _UAPI_LINUX_FLAT_H 12 - #define _UAPI_LINUX_FLAT_H 13 - 14 - 15 - #define FLAT_VERSION 0x00000004L 16 - 17 - #ifdef CONFIG_BINFMT_SHARED_FLAT 18 - #define MAX_SHARED_LIBS (4) 19 - #else 20 - #define MAX_SHARED_LIBS (1) 21 - #endif 22 - 23 - /* 24 - * To make everything easier to port and manage cross platform 25 - * development, all fields are in network byte order. 26 - */ 27 - 28 - struct flat_hdr { 29 - char magic[4]; 30 - unsigned long rev; /* version (as above) */ 31 - unsigned long entry; /* Offset of first executable instruction 32 - with text segment from beginning of file */ 33 - unsigned long data_start; /* Offset of data segment from beginning of 34 - file */ 35 - unsigned long data_end; /* Offset of end of data segment 36 - from beginning of file */ 37 - unsigned long bss_end; /* Offset of end of bss segment from beginning 38 - of file */ 39 - 40 - /* (It is assumed that data_end through bss_end forms the bss segment.) */ 41 - 42 - unsigned long stack_size; /* Size of stack, in bytes */ 43 - unsigned long reloc_start; /* Offset of relocation records from 44 - beginning of file */ 45 - unsigned long reloc_count; /* Number of relocation records */ 46 - unsigned long flags; 47 - unsigned long build_date; /* When the program/library was built */ 48 - unsigned long filler[5]; /* Reservered, set to zero */ 49 - }; 50 - 51 - #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ 52 - #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ 53 - #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ 54 - #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ 55 - #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ 56 - 57 - 58 - 59 - #endif /* _UAPI_LINUX_FLAT_H */