public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: remove some GCC version checks
Date: Wed, 21 Feb 2024 15:03:41 +0000	[thread overview]
Message-ID: <376e43c3-80b2-4824-87e7-d8564dbb74aa@palves.net> (raw)
In-Reply-To: <20240221021939.5213-1-simon.marchi@efficios.com>

On 2024-02-21 02:19, Simon Marchi wrote:

> 
> diff --git a/gdb/nat/x86-gcc-cpuid.h b/gdb/nat/x86-gcc-cpuid.h
> index dfd12587d813..b2eda44a2294 100644
> --- a/gdb/nat/x86-gcc-cpuid.h
> +++ b/gdb/nat/x86-gcc-cpuid.h
> @@ -195,7 +195,6 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
>  
>  #ifndef __x86_64__
>    /* See if we can use cpuid.  On AMD64 we always can.  */
> -#if __GNUC__ >= 3
>    __asm__ ("pushf{l|d}\n\t"
>  	   "pushf{l|d}\n\t"
>  	   "pop{l}\t%0\n\t"
> @@ -208,22 +207,6 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
>  	   "popf{l|d}\n\t"
>  	   : "=&r" (__eax), "=&r" (__ebx)
>  	   : "i" (0x00200000));
> -#else
> -/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
> -   nor alternatives in i386 code.  */
> -  __asm__ ("pushfl\n\t"
> -	   "pushfl\n\t"
> -	   "popl\t%0\n\t"
> -	   "movl\t%0, %1\n\t"
> -	   "xorl\t%2, %0\n\t"
> -	   "pushl\t%0\n\t"
> -	   "popfl\n\t"
> -	   "pushfl\n\t"
> -	   "popl\t%0\n\t"
> -	   "popfl\n\t"
> -	   : "=&r" (__eax), "=&r" (__ebx)
> -	   : "i" (0x00200000));
> -#endif
>  
>    if (!((__eax ^ __ebx) & 0x00200000))
>      return 0;

It would be better IMO to avoid local changes to this file, especially if they're not
really needed:

/*
 * Helper cpuid.h file copied from gcc-6.0.0.  Code in gdb should not
                       ^^^^^^^^^^^^^^^^^^^^^
 * include this directly, but pull in x86-cpuid.h and use that func.
 */

At some point, someone may want to pull a newer version from GCC, and local changes
just make that a little more difficult.

> diff --git a/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
> index 8b232324d2ec..6369e91aa276 100644
> --- a/gdbserver/tracepoint.h
> +++ b/gdbserver/tracepoint.h
> @@ -38,11 +38,7 @@ void initialize_tracepoint (void);
>  #if defined _WIN32 || defined __CYGWIN__
>  # define EXPORTED_SYMBOL __declspec (dllexport)
>  #else
> -# if __GNUC__ >= 4
>  #  define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))

That "#  define" line should be "reindented".

> -# else
> -#  define EXPORTED_SYMBOL
> -# endif
>  #endif



  parent reply	other threads:[~2024-02-21 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  2:19 Simon Marchi
2024-02-21  2:19 ` [PATCH 2/2] gdbsupport: assume that compiler supports std::{is_trivially_constructible,is_trivially_copyable} Simon Marchi
2024-02-21 15:03 ` Pedro Alves [this message]
2024-02-21 16:45   ` [PATCH 1/2] gdb: remove some GCC version checks Simon Marchi

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=376e43c3-80b2-4824-87e7-d8564dbb74aa@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).