public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@bitrange.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, binutils@sourceware.org
Subject: Re: [PATCH] PR lto/94249: Correct endianness detection with the __BYTE_ORDER macro
Date: Wed, 1 Apr 2020 19:57:32 -0400 (EDT)	[thread overview]
Message-ID: <alpine.BSF.2.20.16.2004010607210.83067@arjuna.pair.com> (raw)
In-Reply-To: <5d567802-b94a-7078-7165-e5b2eadf122e@suse.cz>

On Wed, 1 Apr 2020, Martin Li?ka wrote:

> On 4/1/20 7:01 AM, Hans-Peter Nilsson wrote:
> > On Tue, 31 Mar 2020, Maciej W. Rozycki 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.
> >
> > > 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
> >
> > FWIW, I was about to commit that as obvious, also the bignum.h
> > inclusion thing!
> >
> > The only question being, how the typo passed any kind of testing
> > in the first place...
>
> Because I don't have a legacy system with an ancient glibc version.

Before anyone starts doing this too: NO.  That's just not valid
procedure and not a valid excuse.  Please test your patches more
carefully.

*Ask* for it to be tested if you can't find a way to test it on
your own.  I see you didn't even say that you didn't test those
lines, when the patch was submitted.

> Note that testing matrix for such a change is massive, including such
> exotic targets like SUN, minix, Windows, ...

Not necessary, you just have to cover those lines for *one*
host system.

Such situations can usually even be worked around to make sure
those lines are tested at least once, something like "to test
this on my current glibc system, I temporarily edited
plugins-api.h, putting an #undef __BYTE_ORDER" just after the
'Older GCC' comment".

Another solution would be to disable plugins for such legacy
systems.

> >  No actually, there's also the question
> > why the plugin-API needs to bother with host endianness.  It's
> > not like endians are going to be different between plugins and
> > gcc on host.
>
> No, the plugin endianess matches with a host compiler endianess.

If that's true then it could be just written and read as-is,
unless you do different pickling on the way in, but if so, that
could be fixed cleaner than writing differently than reading.
...oh, I see there's a hack; there's an assumption that there
was padding with the "old" API and abusing that to add fields
for a "new" API, and using the endianness to indicate the
location of the padding.  Ew.  I'm not going to step closer than
that.

BTW, was this old/new plugin-API support tested
*cross*-versions?

brgds, H-P

  reply	other threads:[~2020-04-01 23:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  9:25 [PATCH] Check endianess detection Martin Liška
2020-03-23  9:43 ` Jakub Jelinek
2020-03-23 10:00   ` Martin Liška
2020-03-23 10:10     ` Jakub Jelinek
2020-03-23 10:28       ` Martin Liška
2020-03-23 10:35         ` Jakub Jelinek
2020-03-23 12:43           ` Martin Liška
2020-03-23 15:06             ` Martin Liška
2020-03-23 15:39               ` Richard Biener
2020-03-23 16:06                 ` H.J. Lu
2020-03-23 17:17                   ` Martin Liška
2020-03-23 17:40                     ` H.J. Lu
2020-03-24  8:19                       ` Martin Liška
2020-03-24  8:31                         ` Jakub Jelinek
2020-03-24  8:49                           ` Martin Liška
2020-03-24  9:18                             ` Jakub Jelinek
2020-03-24 10:32                               ` Martin Liška
2020-03-24 10:39                                 ` Jakub Jelinek
2020-03-31 13:27                                 ` [PATCH] PR lto/94249: Correct endianness detection with the __BYTE_ORDER macro 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 [this message]
2020-04-01  7:17                                   ` Richard Biener
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
2020-03-23 15:16             ` [PATCH] Check endianess detection Richard Biener

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=alpine.BSF.2.20.16.2004010607210.83067@arjuna.pair.com \
    --to=hp@bitrange.com \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.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).