public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: "Martin Liška" <mliska@suse.cz>,
	"Jakub Jelinek" <jakub@redhat.com>,
	"GCC Patches" <gcc-patches@gcc.gnu.org>,
	Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] PR lto/94249: Correct endianness detection with the __BYTE_ORDER macro
Date: Wed, 1 Apr 2020 09:17:35 +0200	[thread overview]
Message-ID: <CAFiYyc3YCX7fByAaa3QXVtoiYZTJnbqBqRDdpjH2R0by50Q40w@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.21.2003301906260.2689954@eddie.linux-mips.org>

On Tue, Mar 31, 2020 at 3:28 PM Maciej W. Rozycki <macro@linux-mips.org> wrote:
>
> 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 architecture 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ška wrote:
>
> > >> +/* Detect endianess based on _BYTE_ORDER.  */
> > >> +#if _BYTE_ORDER == _LITTLE_ENDIAN
> > >
> > > So most likely _BYTE_ORDER and _LITTLE_ENDIAN macros will not be defined.
> > > Which means this will be handled as #if 0 == 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 corresponding
> > 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 architecture 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 the
> 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
> ===================================================================
> --- 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 <endian.h>
> -#ifdef _BYTE_ORDER
> +#ifdef __BYTE_ORDER
>  #if __BYTE_ORDER == __LITTLE_ENDIAN
>  #define PLUGIN_LITTLE_ENDIAN 1
>  #elif __BYTE_ORDER == __BIG_ENDIAN

  parent reply	other threads:[~2020-04-01  7:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200323103505.GF2156@tucnak>
     [not found] ` <6313e487-6dbb-ac17-4160-4ac600af40be@suse.cz>
     [not found]   ` <7369b1aa-be0d-92cc-4f81-1612f101e2e8@suse.cz>
     [not found]     ` <CAFiYyc3yKQpWzh3Yzh7b40adi=gtFmYLeEZex_yCqYGSOdFcEw@mail.gmail.com>
     [not found]       ` <CAMe9rOqQf+3wO2rosK-jCNYEqc3e-OMP3NtVH0EX26aKGaFeBg@mail.gmail.com>
     [not found]         ` <3786da05-1530-38c5-e9e2-cd69418cd42a@suse.cz>
     [not found]           ` <CAMe9rOpFyGpzQwqsmz0ikZz3MhY4FsZYv_+jCNAHq0768vPw5Q@mail.gmail.com>
     [not found]             ` <5b27738a-9885-9906-0c93-888daf4a066f@suse.cz>
     [not found]               ` <20200324083109.GP2156@tucnak>
     [not found]                 ` <e96704f3-9025-48af-f894-81401a5718a4@suse.cz>
     [not found]                   ` <20200324091805.GQ2156@tucnak>
     [not found]                     ` <b5a25c37-d29c-b636-04ef-eba959ad495b@suse.cz>
2020-03-31 13:27                       ` Maciej W. Rozycki
2020-04-01  5:01                         ` Hans-Peter Nilsson
2020-04-01  7:43                           ` Martin Liška
2020-04-01 23:57                             ` Hans-Peter Nilsson
2020-04-01  7:17                         ` Richard Biener [this message]
2020-04-01  7:41                         ` Martin Liška
2020-04-01  9:55                           ` Maciej W. Rozycki
2020-04-01 10:01                             ` Martin Liška
2020-04-01 15:59                               ` Maciej W. Rozycki
2020-04-01 16:54                                 ` Martin Liška
2020-04-01 17:28                                   ` Maciej W. Rozycki
2020-04-01 10:04                           ` Maciej W. Rozycki
2020-04-01 10:09                             ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc3YCX7fByAaa3QXVtoiYZTJnbqBqRDdpjH2R0by50Q40w@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=macro@linux-mips.org \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).