Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp15612ybd; Tue, 25 Jun 2019 15:30:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR/FmB+o57h4h+o+faVLjbmJwW5vyL+S5h/s/PcoasRZTAdGKCgHOL2TrqmVZDJgTwvTxI X-Received: by 2002:a17:902:f81:: with SMTP id 1mr1088110plz.191.1561501852386; Tue, 25 Jun 2019 15:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561501852; cv=none; d=google.com; s=arc-20160816; b=PYa5VUvnipw0LEXYUG9Lw/9fH3To1Jd0CVZUIKtbCUqY6Eul0iikzRh7DKuXuZKMIG iUojd9tM6bfcSR9RtZdKbmbsBpYXFQShTYvaZAkNMyv/KWK3IDdtjm+7A/BbErJnrQ+E 18wR3q+eWgaAw9N9r3v8HO6AKUO9/Rlx3yxWaLce2K0NE5MmH3Y0T913i2xta8pQrrPn uIbIFSIJq4PrcJ1Ya+7yMFkmijfIJX8/OG7tu0CqElc/ItjxSWfIxee5EIfatK+B2M2o vAHHR+U/mHbLQxqGwp11V+sHv6cXEcaVyGzHEowvXpzrjJ0ftlAJMXMDRoQ9Ff2eMTNP ICPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3zmH9lJXO98dXAW/otC00OC8tN8jKlDr08T5+Mh+wMw=; b=K5livXSezhpZxeo9epr1mE3sTSjYzViFkPdKA5AblSeguytC+08Kd3UpQMDkRX3Hr0 mmx7WZNaGfTsiuaLmkcXEYu+R1rOhogRcGxH2yr8+KbdhM++6PRP5Fu3Ciedyrxpf9C7 4pp96CWYFDYY0tSOym7o2vtmyhpJwVQZl2gKom3ryV14X6Sg0IUBL/XAZ2Alo/+5oV/6 htFsKirn9I0y0LHivzrUhn63rHBYKZt689x+IwA7XCAZGmD+uSJBiaGWDD0cIG1jESY3 EadtWEIvNH7qVinN7MJKlkYmf84Skt33qA/JqJts3ffx1+xhAYELmZnM7q6WZCau4JeQ 7h7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e124si12922733pgc.115.2019.06.25.15.30.31; Tue, 25 Jun 2019 15:30:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbfFYW3y (ORCPT + 99 others); Tue, 25 Jun 2019 18:29:54 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:40222 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbfFYW3y (ORCPT ); Tue, 25 Jun 2019 18:29:54 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hftwb-0001ZR-4N; Tue, 25 Jun 2019 22:29:41 +0000 Date: Tue, 25 Jun 2019 23:29:41 +0100 From: Al Viro To: Christoph Hellwig Cc: Greg Ungerer , 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 Subject: Re: [PATCH 08/17] binfmt_flat: consolidate two version of flat_v2_reloc_t Message-ID: <20190625222941.GA1343@ZenIV.linux.org.uk> References: <20190613070903.17214-1-hch@lst.de> <20190613070903.17214-9-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190613070903.17214-9-hch@lst.de> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 13, 2019 at 09:08:54AM +0200, Christoph Hellwig wrote: > Two branches of the ifdef maze actually have the same content, so merge > them. > > Signed-off-by: Christoph Hellwig > --- > include/linux/flat.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/linux/flat.h b/include/linux/flat.h > index 2b7cda6e9c1b..19c586b74b99 100644 > --- a/include/linux/flat.h > +++ b/include/linux/flat.h > @@ -69,15 +69,13 @@ struct flat_hdr { > typedef union { > unsigned long value; > struct { > -# if defined(mc68000) && !defined(CONFIG_COLDFIRE) > +#if defined(__LITTLE_ENDIAN_BITFIELD) || \ > + (defined(mc68000) && !defined(CONFIG_COLDFIRE)) > signed long offset : 30; > unsigned long type : 2; > # elif defined(__BIG_ENDIAN_BITFIELD) > unsigned long type : 2; > signed long offset : 30; > -# elif defined(__LITTLE_ENDIAN_BITFIELD) > - signed long offset : 30; > - unsigned long type : 2; > # else > # error "Unknown bitfield order for flat files." > # endif > -- > 2.20.1 > FWIW, I wonder if keeping that type is worth bothering. Something like old_reloc(__be32 reloc) { u32 v = be32_to_cpu(reloc); int offset, type; #if (defined(mc68000) && !defined(CONFIG_COLDFIRE)) /* old m68k uses unusual format - type is in lower bits of octet 3 */ type = v % 4; offset = (int)v / 4; #else /* everything else (including coldfire) has it in upper bits of octet 0 */ type = v >> 30; offset = (int)(v << 2) >> 2; /* or (v & 0x1fffffff) - (v & 0x20000000) * 4 */ #endif ... and to hell with bitfields, aliasing unions, etc. Unless I'm misreading the whole thing, that is... Greg?