Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp481365ybd; Wed, 26 Jun 2019 01:18:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQJGDKe6936i+xMCBGcxtLfoVoW/5X9whYgIvkJ4PjztlJZpASC20owT20DHGuI9tEXgb8 X-Received: by 2002:a63:fe13:: with SMTP id p19mr1737225pgh.359.1561537127196; Wed, 26 Jun 2019 01:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561537127; cv=none; d=google.com; s=arc-20160816; b=aTZ+OW0uUDFvgnse3MIxXUMjD04Ged4Ir/ozqiCemYUaQgl5nknZoldlvf9ehVSKf0 Utmi2eSAtxjeviKUJnU33YUsrvr3oXkRz0F6g3jPmBfhx4xNR4nA3UhN2ZYhLWqX+EsZ DNhkPnbq0EIoTtkNasjeoiPP47WpVRKlTyDnZJc4qNC/uzHvy1uqP/QzZEafNBb395e5 X1mfZYnWr+yn+gs2+8ia9eXSN1qaqhtD2OXlki+EGEJZZlnCeVWGv/bHhwiLVDfh1QJk EHFX/5TWZoxi9Y1zlmSwrvVy2uqopi7ssS9bb94ap6+P694vQsp9uRKuSTQ6qZ/V5YA2 uRxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=0IVbKnkaSGCX3gm0GB9llTNW29e8KVqX77iAzmybS0U=; b=wSOrbrf4pPoAasdnRQKGLsOsoTMwnmYC1mJO6SfBiCPfnL7LQSsSGdY0xW3XuzHzCy r2qJQj8RUZpgKsGf+yDM5Q0huA31Q4x4SCJFC3VQGCbBUhaaz/Aa+Lggm+51ufqX+Nf/ NXHiOjb/b6Z2YOsQi9LbtHWIHDMH2LE4KjaGib2VOrlBCCEhENUldxTOkERqKIayCjfA ODgSDpHZ0YeSGABayDIh/qA33oiN33smHIBzlCBPLmmM6QFTHR0EuHG1wjL2LeVJ7cO7 y3Nxuzg2B5E/+Q8jbAxe5P7C3sy23u3sal4NX4Kx+LYPfZmLX9nGjP7YSbhWDLHTXRDZ gGrg== 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 m5si2658318pls.18.2019.06.26.01.18.31; Wed, 26 Jun 2019 01:18:47 -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 S1726757AbfFZISO (ORCPT + 99 others); Wed, 26 Jun 2019 04:18:14 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:36399 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfFZISO (ORCPT ); Wed, 26 Jun 2019 04:18:14 -0400 Received: by mail-ot1-f65.google.com with SMTP id r6so1674960oti.3; Wed, 26 Jun 2019 01:18:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0IVbKnkaSGCX3gm0GB9llTNW29e8KVqX77iAzmybS0U=; b=Q267OzRAYVpkoVfPQzItRmukN57ROVqBXVKUNPm90cgFLAmXm4DeH5Em4lrBChFL0h pfh91E/ybI6UvXtPPoOxY94bCcPd/aem9NkqzuyqF0mrAddbZvaNiSDNqxVps2fq31VL EUVz3Am0KuVmHi9m6o45jwulL3gOcEWkVgmAplNZmJ9Jd2J/KJaQvb4VovQwqmC3hGWu fUa6XFsmzTKi6O1ig+SvCEnkr7i+jAIZrNgT0lH7Aw5FSay4bSkDxnuXBKrv9SetCX6K J72AubuoYHrUtg5T1BAuzEecOWCGkaq9vOnjKbrwnlkLwdgHua05HBg2Twk6w4bc3Ix2 /wig== X-Gm-Message-State: APjAAAWLfFN8jgv7Nsiy8CfUVpr6vOG4gYwMaiEIjvj4+FrXNsyKkXfD CUrljCi0cNOatV8nxo4wxLgiu5DB9gBzHbKXWwVPaQ== X-Received: by 2002:a9d:69ce:: with SMTP id v14mr2314425oto.39.1561537093283; Wed, 26 Jun 2019 01:18:13 -0700 (PDT) MIME-Version: 1.0 References: <20190613070903.17214-1-hch@lst.de> <20190613070903.17214-9-hch@lst.de> <20190625222941.GA1343@ZenIV.linux.org.uk> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 26 Jun 2019 10:18:02 +0200 Message-ID: Subject: Re: [PATCH 08/17] binfmt_flat: consolidate two version of flat_v2_reloc_t To: Greg Ungerer Cc: Al Viro , Christoph Hellwig , Michal Simek , Linux ARM , linux-c6x-dev@linux-c6x.org, "moderated list:H8/300 ARCHITECTURE" , linux-m68k , linux-riscv@lists.infradead.org, Linux-sh list , linux-xtensa@linux-xtensa.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Wed, Jun 26, 2019 at 9:23 AM Greg Ungerer wrote: > On 26/6/19 8:29 am, Al Viro wrote: > > 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? > > I think you are right. This is much better. > The old mc6800 is the odd one out, the rest have it in network order, > and this makes that much clearer. Is that correct for Microblaze, which can be big or little endian? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds