From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by sourceware.org (Postfix) with ESMTPS id 1D551385DC04 for ; Wed, 1 Apr 2020 07:17:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D551385DC04 Received: by mail-lj1-x243.google.com with SMTP id i20so24638561ljn.6 for ; Wed, 01 Apr 2020 00:17:48 -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:content-transfer-encoding; bh=JeAclzOFJAYboHpLKhgOvN0uXyUxOw8KKdcrJ7DAX/A=; b=VqXAzxjxOhiWI1JhYYukz1/W+8odWQUIiSX4lpToAi4qKQJpnvJ1TlCcUwDR5h2GQE NKllTaJBb9IZdrHbHzF8nsgG157GG3rKAkmAKmNQK56IiBuAHk7DN5Qz/ZUQsX8Ts7FH KGeOQsc+R/qApiFZH9/3mhxWUlWsg2W10z8LGi4jEzGMGEoj2BDoSWio8tXzmdHrxWvE nSKZb7yj+55KNZSd8WTCb/qwcmY0KTFCAzxVgppopW8JM7gBkv4y2bdlOnsRsO/m97js lwMysSwZOiRt+8hfMJ2Y3N9Icbabfocar+ogMzlQb9UM763yLvfXzyjwdMcIOLOows6x H3Bw== X-Gm-Message-State: AGi0PuaXgyzr3/b3jlX+Yh4tgMNcTkw9WKRx/3Pd9RhuA6UfsEjiYPeR sZkctEI26/ck4w2yGYxMNQwCo0K1C36LqaQuQc0= X-Google-Smtp-Source: APiQypKzvEmgGFoZVR5IJJ22gPZGVSNR2yVd1/gFCQfuy4StRbe79x+KM++d1oQAxvQbt2t3paFeB8aBPini87h2c+4= X-Received: by 2002:a2e:818e:: with SMTP id e14mr12487755ljg.225.1585725466883; Wed, 01 Apr 2020 00:17:46 -0700 (PDT) MIME-Version: 1.0 References: <20200323103505.GF2156@tucnak> <6313e487-6dbb-ac17-4160-4ac600af40be@suse.cz> <7369b1aa-be0d-92cc-4f81-1612f101e2e8@suse.cz> <3786da05-1530-38c5-e9e2-cd69418cd42a@suse.cz> <5b27738a-9885-9906-0c93-888daf4a066f@suse.cz> <20200324083109.GP2156@tucnak> <20200324091805.GQ2156@tucnak> In-Reply-To: From: Richard Biener Date: Wed, 1 Apr 2020 09:17:35 +0200 Message-ID: Subject: Re: [PATCH] PR lto/94249: Correct endianness detection with the __BYTE_ORDER macro To: "Maciej W. Rozycki" Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , Jakub Jelinek , GCC Patches , Binutils Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 07:17:49 -0000 On Tue, Mar 31, 2020 at 3:28 PM Maciej W. Rozycki wr= ote: > > Correct an issue with GCC commit 906b3eb9df6c ("Improve endianess > detection.") and fix a typo in the __BYTE_ORDER fallback macro check > that causes compilation errors like: > > .../include/plugin-api.h:162:2: error: #error "Could not detect architect= ure endianess" > > on systems that do not provide the __BYTE_ORDER__ macro. > > include/ > PR lto/94249 > * plugin-api.h: Fix a typo in the __BYTE_ORDER macro check. > --- > On Tue, 24 Mar 2020, Martin Li=C5=A1ka wrote: > > > >> +/* Detect endianess based on _BYTE_ORDER. */ > > >> +#if _BYTE_ORDER =3D=3D _LITTLE_ENDIAN > > > > > > So most likely _BYTE_ORDER and _LITTLE_ENDIAN macros will not be defi= ned. > > > Which means this will be handled as #if 0 =3D=3D 0 and override the > > >> +#define PLUGIN_LITTLE_ENDIAN 1 > > > > > > will define also PLUGIN_LITTLE_ENDIAN. > > > > Ok, for being sure, I've wrapped all equality comparison with correspon= ding > > check of the LHS is defined. > > This change, when merged into binutils, caused BFD to fail building in > one of my configurations: > > In file included from .../bfd/elflink.c:31: > .../bfd/../include/plugin-api.h:162:2: error: #error "Could not detect ar= chitecture endianess" > make[4]: *** [elflink.lo] Error 1 > > This is due to a missing underscore in the: > > #ifdef _BYTE_ORDER > > check. > > OK to apply this hopefully obvious fix to GCC and then merge to binutils= ? OK. > NB if posting as an attachment please try matching the message subject > with the change heading as otherwise it takes a lot of effort to track th= e > patch submission corresponding to a given commit. > > Maciej > --- > include/plugin-api.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > binutils-include-plugin-api-byte-order.diff > Index: binutils/include/plugin-api.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- binutils.orig/include/plugin-api.h > +++ binutils/include/plugin-api.h > @@ -51,7 +51,7 @@ > /* Older GCC releases (<4.6.0) can make detection from glibc macros. */ > #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) || defined(__ANDROID_= _) > #include > -#ifdef _BYTE_ORDER > +#ifdef __BYTE_ORDER > #if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN > #define PLUGIN_LITTLE_ENDIAN 1 > #elif __BYTE_ORDER =3D=3D __BIG_ENDIAN