From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Thu, 13 Jun 2019 07:08:52 +0000 Subject: [PATCH 06/17] binfmt_flat: remove the uapi header Message-Id: <20190613070903.17214-7-hch@lst.de> List-Id: References: <20190613070903.17214-1-hch@lst.de> In-Reply-To: <20190613070903.17214-1-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg Ungerer Cc: uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, Michal Simek , Vladimir Murzin , linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org 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 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 Tested-by: Vladimir Murzin Reviewed-by: Vladimir Murzin --- fs/binfmt_flat.c | 1 + include/linux/flat.h | 45 ++++++++++++++++++++++++++--- include/uapi/linux/flat.h | 59 --------------------------------------- 3 files changed, 42 insertions(+), 63 deletions(-) delete mode 100644 include/uapi/linux/flat.h diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index a15fdd5d95ed..b63c5e63ae3f 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef flat_get_relocate_addr #define flat_get_relocate_addr(rel) (rel) diff --git a/include/linux/flat.h b/include/linux/flat.h index 569b67d64d5c..21d901ba191b 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h @@ -10,8 +10,47 @@ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H -#include -#include +#define FLAT_VERSION 0x00000004L + +#ifdef CONFIG_BINFMT_SHARED_FLAT +#define MAX_SHARED_LIBS (4) +#else +#define MAX_SHARED_LIBS (1) +#endif + +/* + * To make everything easier to port and manage cross platform + * development, all fields are in network byte order. + */ + +struct flat_hdr { + char magic[4]; + unsigned long rev; /* version (as above) */ + unsigned long entry; /* Offset of first executable instruction + with text segment from beginning of file */ + unsigned long data_start; /* Offset of data segment from beginning of + file */ + unsigned long data_end; /* Offset of end of data segment + from beginning of file */ + unsigned long bss_end; /* Offset of end of bss segment from beginning + of file */ + + /* (It is assumed that data_end through bss_end forms the bss segment.) */ + + unsigned long stack_size; /* Size of stack, in bytes */ + unsigned long reloc_start; /* Offset of relocation records from + beginning of file */ + unsigned long reloc_count; /* Number of relocation records */ + unsigned long flags; + unsigned long build_date; /* When the program/library was built */ + unsigned long filler[5]; /* Reservered, set to zero */ +}; + +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ /* * While it would be nice to keep this header clean, users of older @@ -22,8 +61,6 @@ * with the format above, except to fix bugs with old format support. */ -#include - #define OLD_FLAT_VERSION 0x00000002L #define OLD_FLAT_RELOC_TYPE_TEXT 0 #define OLD_FLAT_RELOC_TYPE_DATA 1 diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h deleted file mode 100644 index 27e595e44fb7..000000000000 --- a/include/uapi/linux/flat.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * Copyright (C) 2002-2003 David McCullough - * Copyright (C) 1998 Kenneth Albanowski - * The Silver Hammer Group, Ltd. - * - * This file provides the definitions and structures needed to - * support uClinux flat-format executables. - */ - -#ifndef _UAPI_LINUX_FLAT_H -#define _UAPI_LINUX_FLAT_H - - -#define FLAT_VERSION 0x00000004L - -#ifdef CONFIG_BINFMT_SHARED_FLAT -#define MAX_SHARED_LIBS (4) -#else -#define MAX_SHARED_LIBS (1) -#endif - -/* - * To make everything easier to port and manage cross platform - * development, all fields are in network byte order. - */ - -struct flat_hdr { - char magic[4]; - unsigned long rev; /* version (as above) */ - unsigned long entry; /* Offset of first executable instruction - with text segment from beginning of file */ - unsigned long data_start; /* Offset of data segment from beginning of - file */ - unsigned long data_end; /* Offset of end of data segment - from beginning of file */ - unsigned long bss_end; /* Offset of end of bss segment from beginning - of file */ - - /* (It is assumed that data_end through bss_end forms the bss segment.) */ - - unsigned long stack_size; /* Size of stack, in bytes */ - unsigned long reloc_start; /* Offset of relocation records from - beginning of file */ - unsigned long reloc_count; /* Number of relocation records */ - unsigned long flags; - unsigned long build_date; /* When the program/library was built */ - unsigned long filler[5]; /* Reservered, set to zero */ -}; - -#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ -#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ -#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ -#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ -#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ - - - -#endif /* _UAPI_LINUX_FLAT_H */ -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF792C31E45 for ; Thu, 13 Jun 2019 16:39:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9568B20644 for ; Thu, 13 Jun 2019 16:39:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="LB9Ac0yU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392759AbfFMQjO (ORCPT ); Thu, 13 Jun 2019 12:39:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40056 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730604AbfFMHJe (ORCPT ); Thu, 13 Jun 2019 03:09:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=liRfqBd4FU/1QUtK1l5E3mCH3KDKIkOHrkNG1NZ/aQk=; b=LB9Ac0yUlODginMpntEq2vEJwh kkhLAqS2fTeykjMvS9fcBEERt+p72opH4DF/CjDlhXyr6Uxs1jLP0KDVn1G89U8OeC3yXRRIo2xD9 30F30NhmqeDvxHSzbxFmRfoK4JGi0lhBlDmigyxJoiTyK3Z+Aec1zy9jJ2yhubHjgT0feMP4+S8rY Y1T+PiyayWmOnSbGicNTfYaAggQh814hYqrgGNdiee0go9ERLojdGgQ7NWaT/HZYHvQSV8330+uJy QwNRG0J1zKGmETdEL4S+nmjNk29rAUviGlG8lSGyQc0eLqhtIulR/f7LsiYiaKc1qF6skLZ1UPMya Mxxr01/g==; Received: from mpp-cp1-natpool-1-013.ethz.ch ([82.130.71.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbJrR-0004Fd-I3; Thu, 13 Jun 2019 07:09:26 +0000 From: Christoph Hellwig To: Greg Ungerer Cc: Michal Simek , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, uclinux-h8-devel@lists.sourceforge.jp, linux-m68k@lists.linux-m68k.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org, Vladimir Murzin Subject: [PATCH 06/17] binfmt_flat: remove the uapi header Date: Thu, 13 Jun 2019 09:08:52 +0200 Message-Id: <20190613070903.17214-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613070903.17214-1-hch@lst.de> References: <20190613070903.17214-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 Tested-by: Vladimir Murzin Reviewed-by: Vladimir Murzin --- fs/binfmt_flat.c | 1 + include/linux/flat.h | 45 ++++++++++++++++++++++++++--- include/uapi/linux/flat.h | 59 --------------------------------------- 3 files changed, 42 insertions(+), 63 deletions(-) delete mode 100644 include/uapi/linux/flat.h diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index a15fdd5d95ed..b63c5e63ae3f 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef flat_get_relocate_addr #define flat_get_relocate_addr(rel) (rel) diff --git a/include/linux/flat.h b/include/linux/flat.h index 569b67d64d5c..21d901ba191b 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h @@ -10,8 +10,47 @@ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H -#include -#include +#define FLAT_VERSION 0x00000004L + +#ifdef CONFIG_BINFMT_SHARED_FLAT +#define MAX_SHARED_LIBS (4) +#else +#define MAX_SHARED_LIBS (1) +#endif + +/* + * To make everything easier to port and manage cross platform + * development, all fields are in network byte order. + */ + +struct flat_hdr { + char magic[4]; + unsigned long rev; /* version (as above) */ + unsigned long entry; /* Offset of first executable instruction + with text segment from beginning of file */ + unsigned long data_start; /* Offset of data segment from beginning of + file */ + unsigned long data_end; /* Offset of end of data segment + from beginning of file */ + unsigned long bss_end; /* Offset of end of bss segment from beginning + of file */ + + /* (It is assumed that data_end through bss_end forms the bss segment.) */ + + unsigned long stack_size; /* Size of stack, in bytes */ + unsigned long reloc_start; /* Offset of relocation records from + beginning of file */ + unsigned long reloc_count; /* Number of relocation records */ + unsigned long flags; + unsigned long build_date; /* When the program/library was built */ + unsigned long filler[5]; /* Reservered, set to zero */ +}; + +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ /* * While it would be nice to keep this header clean, users of older @@ -22,8 +61,6 @@ * with the format above, except to fix bugs with old format support. */ -#include - #define OLD_FLAT_VERSION 0x00000002L #define OLD_FLAT_RELOC_TYPE_TEXT 0 #define OLD_FLAT_RELOC_TYPE_DATA 1 diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h deleted file mode 100644 index 27e595e44fb7..000000000000 --- a/include/uapi/linux/flat.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * Copyright (C) 2002-2003 David McCullough - * Copyright (C) 1998 Kenneth Albanowski - * The Silver Hammer Group, Ltd. - * - * This file provides the definitions and structures needed to - * support uClinux flat-format executables. - */ - -#ifndef _UAPI_LINUX_FLAT_H -#define _UAPI_LINUX_FLAT_H - - -#define FLAT_VERSION 0x00000004L - -#ifdef CONFIG_BINFMT_SHARED_FLAT -#define MAX_SHARED_LIBS (4) -#else -#define MAX_SHARED_LIBS (1) -#endif - -/* - * To make everything easier to port and manage cross platform - * development, all fields are in network byte order. - */ - -struct flat_hdr { - char magic[4]; - unsigned long rev; /* version (as above) */ - unsigned long entry; /* Offset of first executable instruction - with text segment from beginning of file */ - unsigned long data_start; /* Offset of data segment from beginning of - file */ - unsigned long data_end; /* Offset of end of data segment - from beginning of file */ - unsigned long bss_end; /* Offset of end of bss segment from beginning - of file */ - - /* (It is assumed that data_end through bss_end forms the bss segment.) */ - - unsigned long stack_size; /* Size of stack, in bytes */ - unsigned long reloc_start; /* Offset of relocation records from - beginning of file */ - unsigned long reloc_count; /* Number of relocation records */ - unsigned long flags; - unsigned long build_date; /* When the program/library was built */ - unsigned long filler[5]; /* Reservered, set to zero */ -}; - -#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ -#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ -#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ -#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ -#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ - - - -#endif /* _UAPI_LINUX_FLAT_H */ -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19AE3C31E45 for ; Thu, 13 Jun 2019 07:12:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCD582084D for ; Thu, 13 Jun 2019 07:12:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mVIJeLyx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCD582084D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=alFnangYOJ0omsTUymw0gN3hp5xh3QpPrruGWgCH9HY=; b=mVIJeLyxYS5q39 MQiflZtjQWzKGAgAX5420DK+dAr+QCLt0dSouP6uQTaCVxLc03oMCYVeV0c/1kOrUx3OiBu4+EEH/ DT54Vqj/ZoiKE4MaJjB4bKSB7ALjyJih0XTT4VzyRQElUClfDOj9GMqpEvjNL3uxQnjWFfsSsxV/p Bid3M7i+MCDcg56xxZqOZTn8HobxLfoOP1Wkjh5mQ4lehM8a7UaT4l916VjAJVQAYelj316H4uw5z ESLUWYCEVpkM3GYUCJ8DnlX8z33CYCSwbsj5ofUvNB2OtzDRV3p2wp9FZMrdTfr/h+tTwwr5TyhGT +pFAHvrVa5MgWu2USTrg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbJuU-0007lM-BO; Thu, 13 Jun 2019 07:12:34 +0000 Received: from mpp-cp1-natpool-1-013.ethz.ch ([82.130.71.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbJrR-0004Fd-I3; Thu, 13 Jun 2019 07:09:26 +0000 From: Christoph Hellwig To: Greg Ungerer Subject: [PATCH 06/17] binfmt_flat: remove the uapi header Date: Thu, 13 Jun 2019 09:08:52 +0200 Message-Id: <20190613070903.17214-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613070903.17214-1-hch@lst.de> References: <20190613070903.17214-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, Michal Simek , Vladimir Murzin , linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org 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 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 Tested-by: Vladimir Murzin Reviewed-by: Vladimir Murzin --- fs/binfmt_flat.c | 1 + include/linux/flat.h | 45 ++++++++++++++++++++++++++--- include/uapi/linux/flat.h | 59 --------------------------------------- 3 files changed, 42 insertions(+), 63 deletions(-) delete mode 100644 include/uapi/linux/flat.h diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index a15fdd5d95ed..b63c5e63ae3f 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef flat_get_relocate_addr #define flat_get_relocate_addr(rel) (rel) diff --git a/include/linux/flat.h b/include/linux/flat.h index 569b67d64d5c..21d901ba191b 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h @@ -10,8 +10,47 @@ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H -#include -#include +#define FLAT_VERSION 0x00000004L + +#ifdef CONFIG_BINFMT_SHARED_FLAT +#define MAX_SHARED_LIBS (4) +#else +#define MAX_SHARED_LIBS (1) +#endif + +/* + * To make everything easier to port and manage cross platform + * development, all fields are in network byte order. + */ + +struct flat_hdr { + char magic[4]; + unsigned long rev; /* version (as above) */ + unsigned long entry; /* Offset of first executable instruction + with text segment from beginning of file */ + unsigned long data_start; /* Offset of data segment from beginning of + file */ + unsigned long data_end; /* Offset of end of data segment + from beginning of file */ + unsigned long bss_end; /* Offset of end of bss segment from beginning + of file */ + + /* (It is assumed that data_end through bss_end forms the bss segment.) */ + + unsigned long stack_size; /* Size of stack, in bytes */ + unsigned long reloc_start; /* Offset of relocation records from + beginning of file */ + unsigned long reloc_count; /* Number of relocation records */ + unsigned long flags; + unsigned long build_date; /* When the program/library was built */ + unsigned long filler[5]; /* Reservered, set to zero */ +}; + +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ /* * While it would be nice to keep this header clean, users of older @@ -22,8 +61,6 @@ * with the format above, except to fix bugs with old format support. */ -#include - #define OLD_FLAT_VERSION 0x00000002L #define OLD_FLAT_RELOC_TYPE_TEXT 0 #define OLD_FLAT_RELOC_TYPE_DATA 1 diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h deleted file mode 100644 index 27e595e44fb7..000000000000 --- a/include/uapi/linux/flat.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * Copyright (C) 2002-2003 David McCullough - * Copyright (C) 1998 Kenneth Albanowski - * The Silver Hammer Group, Ltd. - * - * This file provides the definitions and structures needed to - * support uClinux flat-format executables. - */ - -#ifndef _UAPI_LINUX_FLAT_H -#define _UAPI_LINUX_FLAT_H - - -#define FLAT_VERSION 0x00000004L - -#ifdef CONFIG_BINFMT_SHARED_FLAT -#define MAX_SHARED_LIBS (4) -#else -#define MAX_SHARED_LIBS (1) -#endif - -/* - * To make everything easier to port and manage cross platform - * development, all fields are in network byte order. - */ - -struct flat_hdr { - char magic[4]; - unsigned long rev; /* version (as above) */ - unsigned long entry; /* Offset of first executable instruction - with text segment from beginning of file */ - unsigned long data_start; /* Offset of data segment from beginning of - file */ - unsigned long data_end; /* Offset of end of data segment - from beginning of file */ - unsigned long bss_end; /* Offset of end of bss segment from beginning - of file */ - - /* (It is assumed that data_end through bss_end forms the bss segment.) */ - - unsigned long stack_size; /* Size of stack, in bytes */ - unsigned long reloc_start; /* Offset of relocation records from - beginning of file */ - unsigned long reloc_count; /* Number of relocation records */ - unsigned long flags; - unsigned long build_date; /* When the program/library was built */ - unsigned long filler[5]; /* Reservered, set to zero */ -}; - -#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ -#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ -#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ -#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ -#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ - - - -#endif /* _UAPI_LINUX_FLAT_H */ -- 2.20.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9FB9C31E45 for ; Thu, 13 Jun 2019 07:12:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 820E62084D for ; Thu, 13 Jun 2019 07:12:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mBGOmVL8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 820E62084D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D7z2MnRyUqnvUucwAdsZj/XkkEBk9mngZdXLKYoppHY=; b=mBGOmVL8i4sucw PfhbgQjVZRgQy1POIufGBgTTHigTkUAa/a1jz+He4abrdB/QZ+65H3KnP9pWw8m4ij1WpxxdNjBMC WrINyKKwYu/AvHUBcwBn91WrmCT+ID0Nb3YzJvvlwJAxgyM7SVddOq8uz01DvLRy+UHG2egP3ZO1R fwbL34pLcAbjGNYUqt40Yid/6I41mMfiwZi2aCU2S/nLhzmNrN2ohIfs0EbpLexfShWCP5v1/9dC+ QxTFoRzA0bL21Mp8M0QGfSvyWJ1i9FmdagtAa7upgwEZt7AstMNg99qu6ZkDkv2vmLhgC0N3FpIoG 7O8T6iO3QgESW7/b9c/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbJuE-0007XB-Sw; Thu, 13 Jun 2019 07:12:19 +0000 Received: from mpp-cp1-natpool-1-013.ethz.ch ([82.130.71.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbJrR-0004Fd-I3; Thu, 13 Jun 2019 07:09:26 +0000 From: Christoph Hellwig To: Greg Ungerer Subject: [PATCH 06/17] binfmt_flat: remove the uapi header Date: Thu, 13 Jun 2019 09:08:52 +0200 Message-Id: <20190613070903.17214-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190613070903.17214-1-hch@lst.de> References: <20190613070903.17214-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, Michal Simek , Vladimir Murzin , linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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 Tested-by: Vladimir Murzin Reviewed-by: Vladimir Murzin --- fs/binfmt_flat.c | 1 + include/linux/flat.h | 45 ++++++++++++++++++++++++++--- include/uapi/linux/flat.h | 59 --------------------------------------- 3 files changed, 42 insertions(+), 63 deletions(-) delete mode 100644 include/uapi/linux/flat.h diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index a15fdd5d95ed..b63c5e63ae3f 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef flat_get_relocate_addr #define flat_get_relocate_addr(rel) (rel) diff --git a/include/linux/flat.h b/include/linux/flat.h index 569b67d64d5c..21d901ba191b 100644 --- a/include/linux/flat.h +++ b/include/linux/flat.h @@ -10,8 +10,47 @@ #ifndef _LINUX_FLAT_H #define _LINUX_FLAT_H -#include -#include +#define FLAT_VERSION 0x00000004L + +#ifdef CONFIG_BINFMT_SHARED_FLAT +#define MAX_SHARED_LIBS (4) +#else +#define MAX_SHARED_LIBS (1) +#endif + +/* + * To make everything easier to port and manage cross platform + * development, all fields are in network byte order. + */ + +struct flat_hdr { + char magic[4]; + unsigned long rev; /* version (as above) */ + unsigned long entry; /* Offset of first executable instruction + with text segment from beginning of file */ + unsigned long data_start; /* Offset of data segment from beginning of + file */ + unsigned long data_end; /* Offset of end of data segment + from beginning of file */ + unsigned long bss_end; /* Offset of end of bss segment from beginning + of file */ + + /* (It is assumed that data_end through bss_end forms the bss segment.) */ + + unsigned long stack_size; /* Size of stack, in bytes */ + unsigned long reloc_start; /* Offset of relocation records from + beginning of file */ + unsigned long reloc_count; /* Number of relocation records */ + unsigned long flags; + unsigned long build_date; /* When the program/library was built */ + unsigned long filler[5]; /* Reservered, set to zero */ +}; + +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ /* * While it would be nice to keep this header clean, users of older @@ -22,8 +61,6 @@ * with the format above, except to fix bugs with old format support. */ -#include - #define OLD_FLAT_VERSION 0x00000002L #define OLD_FLAT_RELOC_TYPE_TEXT 0 #define OLD_FLAT_RELOC_TYPE_DATA 1 diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h deleted file mode 100644 index 27e595e44fb7..000000000000 --- a/include/uapi/linux/flat.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * Copyright (C) 2002-2003 David McCullough - * Copyright (C) 1998 Kenneth Albanowski - * The Silver Hammer Group, Ltd. - * - * This file provides the definitions and structures needed to - * support uClinux flat-format executables. - */ - -#ifndef _UAPI_LINUX_FLAT_H -#define _UAPI_LINUX_FLAT_H - - -#define FLAT_VERSION 0x00000004L - -#ifdef CONFIG_BINFMT_SHARED_FLAT -#define MAX_SHARED_LIBS (4) -#else -#define MAX_SHARED_LIBS (1) -#endif - -/* - * To make everything easier to port and manage cross platform - * development, all fields are in network byte order. - */ - -struct flat_hdr { - char magic[4]; - unsigned long rev; /* version (as above) */ - unsigned long entry; /* Offset of first executable instruction - with text segment from beginning of file */ - unsigned long data_start; /* Offset of data segment from beginning of - file */ - unsigned long data_end; /* Offset of end of data segment - from beginning of file */ - unsigned long bss_end; /* Offset of end of bss segment from beginning - of file */ - - /* (It is assumed that data_end through bss_end forms the bss segment.) */ - - unsigned long stack_size; /* Size of stack, in bytes */ - unsigned long reloc_start; /* Offset of relocation records from - beginning of file */ - unsigned long reloc_count; /* Number of relocation records */ - unsigned long flags; - unsigned long build_date; /* When the program/library was built */ - unsigned long filler[5]; /* Reservered, set to zero */ -}; - -#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ -#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ -#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ -#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ -#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ - - - -#endif /* _UAPI_LINUX_FLAT_H */ -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel