Find arm-linux-gnueabihf-gcc in compile

Message ID 1516265199-29059-1-git-send-email-yao.qi@linaro.org
State New, archived
Headers

Commit Message

Yao Qi Jan. 18, 2018, 8:46 a.m. UTC
  GCC for arm-linux has different names on different distros.  It is
arm-linux-gnu-gcc on fedora.  Debian/Ubuntu has arm-linux-gnueabihf-gcc.
So when I run gdb.compile/ tests on arm-linux, I get,

(gdb) compile code -- ;
Could not find a compiler matching "^arm(-[^-]*)?-linux(-gnu)?-gcc$"

This patch extend the regexp to match both arm-linux-gnu-gcc and
arm-linux-gnueabihf-gcc.

gdb:

2018-01-17  Yao Qi  <yao.qi@linaro.org>

	* osabi.c (gdb_osabi_names): Extend the regexp for
	arm-linux-gnueabihf.
---
 gdb/osabi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Simon Marchi Jan. 18, 2018, 3:35 p.m. UTC | #1
On 2018-01-18 03:46, Yao Qi wrote:
> GCC for arm-linux has different names on different distros.  It is
> arm-linux-gnu-gcc on fedora.  Debian/Ubuntu has 
> arm-linux-gnueabihf-gcc.
> So when I run gdb.compile/ tests on arm-linux, I get,
> 
> (gdb) compile code -- ;
> Could not find a compiler matching "^arm(-[^-]*)?-linux(-gnu)?-gcc$"
> 
> This patch extend the regexp to match both arm-linux-gnu-gcc and
> arm-linux-gnueabihf-gcc.
> 
> gdb:
> 
> 2018-01-17  Yao Qi  <yao.qi@linaro.org>
> 
> 	* osabi.c (gdb_osabi_names): Extend the regexp for
> 	arm-linux-gnueabihf.
> ---
>  gdb/osabi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/osabi.c b/gdb/osabi.c
> index 129164f..fd44deb 100644
> --- a/gdb/osabi.c
> +++ b/gdb/osabi.c
> @@ -63,7 +63,7 @@ static const struct osabi_names gdb_osabi_names[] =
>    { "SVR4", NULL },
>    { "GNU/Hurd", NULL },
>    { "Solaris", NULL },
> -  { "GNU/Linux", "linux(-gnu)?" },
> +  { "GNU/Linux", "linux(-gnu[^-]*)?" },
>    { "FreeBSD", NULL },
>    { "NetBSD", NULL },
>    { "OpenBSD", NULL },

That seem reasonable to me.

Simon
  
Pedro Alves Jan. 18, 2018, 6:32 p.m. UTC | #2
On 01/18/2018 08:46 AM, Yao Qi wrote:
> GCC for arm-linux has different names on different distros.  It is
> arm-linux-gnu-gcc on fedora.  Debian/Ubuntu has arm-linux-gnueabihf-gcc.
> So when I run gdb.compile/ tests on arm-linux, I get,
> 
> (gdb) compile code -- ;
> Could not find a compiler matching "^arm(-[^-]*)?-linux(-gnu)?-gcc$"
> 
> This patch extend the regexp to match both arm-linux-gnu-gcc and
> arm-linux-gnueabihf-gcc.

Debian seems to have a "arm-linux-gnueabi-gcc" as well,
<https://packages.debian.org/sid/gcc-7-arm-linux-gnueabi>, 
which I assume is a version that defaults to soft-float.  (Or
is that softfp?)

So it's not entirely accurate to say that it's
arm-linux-gnueabihf-gcc on Debian.  It has both (and maybe more).

The "hf" in the name is encoding the default float ABI the compiler
outputs (hf is for hard float), which may not be the right one if
you have multiple versions of the compiler around in the PATH.
(more likely in a cross setup than on native, I guess.)

I think either gnueabihf/gnueabi compiler would be able to emit
code for either ABI, it's just a matter of what is the default, so
which ABI to pick can be left to making gdb pass the
right -mfloat-abi=soft/softfp/hard (and likewise other
"-m" options).

Thus, seems OK.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/osabi.c b/gdb/osabi.c
index 129164f..fd44deb 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -63,7 +63,7 @@  static const struct osabi_names gdb_osabi_names[] =
   { "SVR4", NULL },
   { "GNU/Hurd", NULL },
   { "Solaris", NULL },
-  { "GNU/Linux", "linux(-gnu)?" },
+  { "GNU/Linux", "linux(-gnu[^-]*)?" },
   { "FreeBSD", NULL },
   { "NetBSD", NULL },
   { "OpenBSD", NULL },