public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
	Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Check endianess detection.
Date: Tue, 24 Mar 2020 09:31:09 +0100	[thread overview]
Message-ID: <20200324083109.GP2156@tucnak> (raw)
In-Reply-To: <5b27738a-9885-9906-0c93-888daf4a066f@suse.cz>

On Tue, Mar 24, 2020 at 09:19:12AM +0100, Martin Liška wrote:
> 2020-03-24  Martin Liska  <mliska@suse.cz>
> 
> 	PR lto/94249
> 	* plugin-api.h: Add more robust endianess detection.
> ---
>  include/plugin-api.h | 43 +++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/include/plugin-api.h b/include/plugin-api.h
> index 673f136ce68..4a211d51f43 100644
> --- a/include/plugin-api.h
> +++ b/include/plugin-api.h
> @@ -42,6 +42,43 @@ extern "C"
>  {
>  #endif

The location is incorrect, you don't want to include system headers
inside explicit extern "C", so please move it a few lines above it.

Furthermore, you don't have the glibc case with GCC < 4.6 handled, that
needs something like:
#if defined(__GLIBC__) || defined(__GNU_LIBRARY__) \
    || defined(__ANDROID__)
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define PLUGIN_LITTLE_ENDIAN 1
#elif __BYTE_ORDER == __BIG_ENDIAN
#define PLUGIN_BIG_ENDIAN 1
...
(of course done only if __BYTE_ORDER__ and __ORDER_*_ENDIAN__ isn't
defined).

And, you don't handle PDP endian, while GCC does support pdp11-*,
so IMNSHO you also need to detect PDP endian and use:

#elif PLUGIN_PDP_ENDIAN == 1
  char symbol_type;
  char def;
  char unused;
  char section_kind;

	Jakub


  reply	other threads:[~2020-03-24  8:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  9:25 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 [this message]
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
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=20200324083109.GP2156@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.com \
    /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).