Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2019-03-20 Thread coypu
More pings!

On Fri, Mar 08, 2019 at 09:56:05AM +, co...@sdf.org wrote:
> Ping.
> 
> Link for possible convenience :-)
> https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01899.html


Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2019-03-08 Thread coypu
Ping.

Link for possible convenience :-)
https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01899.html


Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2019-02-24 Thread coypu
Pinging with updated patch.
I removed a conflict with copyright year change. No longer using
unwind-arm (we use dwarf on eabi).

I re-tested cross compilation and resulting C and C++ works (caveat:
with text relocations, i tested small programs)
I believe matt #2 (green) has sent a copyright assignment.

Changelog:
gcc:

config.gcc (arm*-*-netbsdelf*) Add support for EABI configuration
config.host (arm*-*-netbsd*): Build driver-arm.o
config/arm/netbsd-eabi.h: New file.
config/arm/netbsd-elf.h
config/netbsd-elf.h: Define SUBTARGET_EXTRA_SPECS.

libgcc:

config.host (arm*-*-netbsdelf*): Add support for EABI configuration
config/arm/t-netbsd: LIB1ASMFUNCS: Append to existing set.
 HOST_LIBGCC2_CFLAGS: workaround possible bug
config/arm/t-netbsd-eabi: New file.

>From c138b94b036e1485ed71c57966894e80f84fea1a Mon Sep 17 00:00:00 2001
From: coypu 
Date: Wed, 31 Oct 2018 00:33:06 +0200
Subject: [PATCH 1/1] netbsd eabi

Now with:
armv4 isn't needed as a separate case, because strongarm is the
default for all netbsd. it makes no difference otherwise.

-mfpu=auto

cleaned up things as requested by richard earnshaw.

tested: armv6,7 hf.
---
 gcc/config.gcc  | 29 +-
 gcc/config.host |  2 +-
 gcc/config/arm/netbsd-eabi.h| 97 +
 gcc/config/arm/netbsd-elf.h | 10 
 gcc/config/netbsd-elf.h | 15 +
 libgcc/config.host  | 10 +++-
 libgcc/config/arm/t-netbsd  | 10 +++-
 libgcc/config/arm/t-netbsd-eabi | 18 ++
 8 files changed, 184 insertions(+), 7 deletions(-)
 create mode 100644 gcc/config/arm/netbsd-eabi.h
 create mode 100644 libgcc/config/arm/t-netbsd-eabi

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 3ee31c5993d..736b2163a24 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1161,10 +1161,33 @@ arm*-*-freebsd*)# ARM FreeBSD EABI
with_tls=${with_tls:-gnu}
;;
 arm*-*-netbsdelf*)
-   tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h 
${tm_file} arm/netbsd-elf.h"
-   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
-   tmake_file="${tmake_file} arm/t-arm"
target_cpu_cname="strongarm"
+   tmake_file="${tmake_file} arm/t-arm"
+   tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
+   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+   case ${target} in
+   arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
+   esac
+   case ${target} in
+   arm*-*-netbsdelf-*eabi*)
+   tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
+   tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
+   ;;
+   *)
+   tm_file="$tm_file arm/netbsd-elf.h"
+   tmake_file="$tmake_file arm/t-netbsd"
+   ;;
+   esac
+   tm_file="${tm_file} arm/aout.h arm/arm.h"
+   case ${target} in
+   arm*-*-netbsdelf-*eabihf*)
+   tm_defines="${tm_defines} 
TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
+   ;;
+   esac
+   case ${target} in
+   armv6*) target_cpu_cname="arm1176jzf-s";;
+   armv7*) target_cpu_cname="generic-armv7-a";;
+   esac
;;
 arm*-*-linux-*)# ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h 
glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
diff --git a/gcc/config.host b/gcc/config.host
index 816a0f06cb7..5077c0ee33a 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -107,7 +107,7 @@ case ${host} in
;;
 esac
 ;;
-  arm*-*-freebsd* | arm*-*-linux* | arm*-*-fuchsia*)
+  arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia*)
 case ${target} in
   arm*-*-*)
host_extra_gcc_objs="driver-arm.o"
diff --git a/gcc/config/arm/netbsd-eabi.h b/gcc/config/arm/netbsd-eabi.h
new file mode 100644
index 000..13bc274175d
--- /dev/null
+++ b/gcc/config/arm/netbsd-eabi.h
@@ -0,0 +1,97 @@
+/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Contributed by Wasabi Systems, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   .  */
+
+/* Run-time Target Specification.  */
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { 

Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2018-10-24 Thread Ramana Radhakrishnan
On Wed, Oct 24, 2018 at 12:30 PM  wrote:
>
> Thanks for the detailed response.
> Sorry to give only a partial reply.
>
> On Tue, Oct 23, 2018 at 02:36:57PM +0100, Richard Earnshaw (lists) wrote:
> > Thanks for posting this.  Before we can commit it, however, we need to
> > sort out the authorship and ensure that all the appropriate copyright
> > assignments are in place.  Are you the sole author, or are other NetBSD
> > developers involved?
>
> The authors of these patches to netbsd are:
> - matt thomas
> - nick hudson

I see assignments for the following people for past and future changes
on fencepost for GCC :

Matthew Thomas (matt at 3am-software dot com) and Nicholas Hudson
(with a nick at nthcliff dot demon dot co dot uk email address).  Not
sure if Nick Hudson is the same as the person in the copyright
assignment as I don't have an email address to check this against.

I see nothing for Matthew Green for GCC .

regards
Ramana

> - matthew green
>
> They are all listed in MAINTAINERS files in FSF projects so I think they
> have a copyright assignment on file.
> Matt Thomas is unresponsive lately but I can ask someone to bug him in
> person.
>
> > > +/* Default to full VFP if -mhard-float is specified.  */
> > > +#undef SUBTARGET_ASM_FLOAT_SPEC
> > > +#define SUBTARGET_ASM_FLOAT_SPEC   \
> > > +  "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
> > > +   %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
> >
> > Please rework this to use -mfpu=auto.  -mfpu=vfp is very rarely the
> > right setting to use.
>
> This change seems scary. Going over my default CPUs, I guess the
> problematic one might cortex-a8.
> I'm worried it might have negative repercussions for VFPv3-d16.
> Is that a valid concern?
> I see generic-armv7-a is a more popular default CPU, but I am not sure
> from reading the code that it avoids this problem.
>
> Thanks.


Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2018-10-24 Thread Richard Earnshaw (lists)
On 24/10/2018 12:29, co...@sdf.org wrote:

>>> +/* Default to full VFP if -mhard-float is specified.  */
>>> +#undef SUBTARGET_ASM_FLOAT_SPEC
>>> +#define SUBTARGET_ASM_FLOAT_SPEC   \
>>> +  "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
>>> +   %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
>>
>> Please rework this to use -mfpu=auto.  -mfpu=vfp is very rarely the
>> right setting to use.
> 
> This change seems scary. Going over my default CPUs, I guess the
> problematic one might cortex-a8.
> I'm worried it might have negative repercussions for VFPv3-d16.
> Is that a valid concern?
> I see generic-armv7-a is a more popular default CPU, but I am not sure
> from reading the code that it avoids this problem.

Well, auto should be the default anyway, unless overridden during configure.

You're right that cortex-a8 has Advanced SIMD enabled by default.  But
generic-armv7-a should be fine (the architecture there is armv7-a+fp and
+fp in this context means VFPv3-d16, which is exactly what you want in
this case).

For armv6 arm1176jzf-s is fine too, that enables FP automatically.  Only
armv4 from your current list is incompatible with FP (armv5t is as well,
but armv5te is fine).  ARMv8-a never has FP without SIMD so any CPU with
SIMD will be fine.

Note that -mfpu=vfp means VFPv2, so you really don't want that on ARMv7
or later devices as it will restrict the ISA unnecessarily.

R.


Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2018-10-24 Thread coypu
Thanks for the detailed response.
Sorry to give only a partial reply.

On Tue, Oct 23, 2018 at 02:36:57PM +0100, Richard Earnshaw (lists) wrote:
> Thanks for posting this.  Before we can commit it, however, we need to
> sort out the authorship and ensure that all the appropriate copyright
> assignments are in place.  Are you the sole author, or are other NetBSD
> developers involved?

The authors of these patches to netbsd are:
- matt thomas
- nick hudson
- matthew green

They are all listed in MAINTAINERS files in FSF projects so I think they
have a copyright assignment on file.
Matt Thomas is unresponsive lately but I can ask someone to bug him in
person.

> > +/* Default to full VFP if -mhard-float is specified.  */
> > +#undef SUBTARGET_ASM_FLOAT_SPEC
> > +#define SUBTARGET_ASM_FLOAT_SPEC   \
> > +  "%{mhard-float:%{!mfpu=*:-mfpu=vfp}}   \
> > +   %{mfloat-abi=hard:%{!mfpu=*:-mfpu=vfp}}"
> 
> Please rework this to use -mfpu=auto.  -mfpu=vfp is very rarely the
> right setting to use.

This change seems scary. Going over my default CPUs, I guess the
problematic one might cortex-a8.
I'm worried it might have negative repercussions for VFPv3-d16.
Is that a valid concern?
I see generic-armv7-a is a more popular default CPU, but I am not sure
from reading the code that it avoids this problem.

Thanks.


Re: [PATCH] bring netbsd/arm support up to speed. eabi, etc.

2018-10-23 Thread Richard Earnshaw (lists)
Thanks for posting this.  Before we can commit it, however, we need to
sort out the authorship and ensure that all the appropriate copyright
assignments are in place.  Are you the sole author, or are other NetBSD
developers involved?

Firstly, please provide a ChangeLog description for the patch.

Below are some initial comments, I might have more once I have a more
detailed look.

R.

On 20/10/2018 22:05, Maya Rashish wrote:
> ---
>  gcc/config.gcc  |  33 +-
>  gcc/config.host |   2 +-
>  gcc/config/arm/netbsd-eabi.h| 108 
>  gcc/config/arm/netbsd-elf.h |  10 +++
>  gcc/config/netbsd-elf.h |  15 +
>  libgcc/config.host  |  11 +++-
>  libgcc/config/arm/t-netbsd  |  15 -
>  libgcc/config/arm/t-netbsd-eabi |  18 ++
>  8 files changed, 205 insertions(+), 7 deletions(-)
>  create mode 100644 gcc/config/arm/netbsd-eabi.h
>  create mode 100644 libgcc/config/arm/t-netbsd-eabi
> 
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 8521f7d556e..e749c61e75f 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1130,10 +1130,37 @@ arm*-*-freebsd*)# ARM FreeBSD EABI
>   with_tls=${with_tls:-gnu}
>   ;;
>  arm*-*-netbsdelf*)
> - tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h 
> ${tm_file} arm/netbsd-elf.h"
> - extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
>   tmake_file="${tmake_file} arm/t-arm"
> - target_cpu_cname="arm6"

See patch I posted this morning, a default here is probably still needed.

> + tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
> + extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
> + case ${target} in
> + arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
> + esac
> + case ${target} in
> + arm*-*-netbsdelf-*eabi*)
> + tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
> + tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
> + # The BPABI long long divmod functions return a 128-bit value in
> + # registers r0-r3.  Correctly modeling that requires the use of
> + # TImode.
> + need_64bit_hwint=yes

need_64bit_hwint isn't needed any more (removed in 2014).

> + ;;
> + *)
> + tm_file="$tm_file arm/netbsd-elf.h"
> + tmake_file="$tmake_file arm/t-netbsd"
> + ;;
> + esac
> + tm_file="${tm_file} arm/aout.h arm/arm.h"
> + case ${target} in
> + arm*-*-netbsdelf-*eabihf*)
> + tm_defines="${tm_defines} 
> TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
> + ;;
> + esac
> + case ${target} in
> + armv4*) target_cpu_cname="strongarm";;

You might want to filter out some bogus combinations here, such as armv4
+ eabihf which can't be supported.

> + armv6*) target_cpu_cname="arm1176jzf-s";;
> + armv7*) target_cpu_cname="cortex-a8";;

The list overall, seems somewhat incomplete.  What about armv4t, armv5
and armv8?

> + esac
>   ;;
>  arm*-*-linux-*)  # ARM GNU/Linux with ELF
>   tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h 
> glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
> diff --git a/gcc/config.host b/gcc/config.host
> index c65569da2e9..59208d2508f 100644
> --- a/gcc/config.host
> +++ b/gcc/config.host
> @@ -107,7 +107,7 @@ case ${host} in
>   ;;
>  esac
>  ;;
> -  arm*-*-freebsd* | arm*-*-linux* | arm*-*-fuchsia*)
> +  arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia*)
>  case ${target} in
>arm*-*-*)
>   host_extra_gcc_objs="driver-arm.o"
> diff --git a/gcc/config/arm/netbsd-eabi.h b/gcc/config/arm/netbsd-eabi.h
> new file mode 100644
> index 000..92f31b885f0
> --- /dev/null
> +++ b/gcc/config/arm/netbsd-eabi.h
> @@ -0,0 +1,108 @@
> +/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
> +   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
> +   Contributed by Wasabi Systems, Inc.
> +
> +   This file is part of GCC.
> +
> +   GCC is free software; you can redistribute it and/or modify it
> +   under the terms of the GNU General Public License as published
> +   by the Free Software Foundation; either version 3, or (at your
> +   option) any later version.
> +
> +   GCC is distributed in the hope that it will be useful, but WITHOUT
> +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> +   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
> +   License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with GCC; see the file COPYING3.  If not see
> +   .  */
> +
> +/* Run-time Target Specification.  */
> +#undef MULTILIB_DEFAULTS
> +#define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
> +
> +#define TARGET_LINKER_EABI_SUFFIX \
> +