Re: [PATCH 2/2] sparc: Run SUBTARGET_INIT_BUILTINS if it exists

2021-02-13 Thread coypu--- via Gcc-patches
I hope that writing the detailed commit message will encourage someone
with better knowledge of GCC internals to point out a better place for
this logic. I can follow through with any suggestions :)

On Sat, Feb 13, 2021 at 12:20:30PM +, Maya Rashish wrote:
> Some subtargets don't provide the canonical function names as
> the symbol name in C libraries, and libcalls will only work if
> the builtins are patched to emit the correct library name.
> 
> For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
> and the patching is done via netbsd_patch_builtin.
> 
> With this change, libgfortran.so is correctly built with a
> reference to __c99_cabsl, instead of "cabsl" which is not defined.


Re: [PATCH 00/31] VAX: Bring the port up to date (yes, MODE_CC conversion is included)

2020-11-25 Thread coypu--- via Gcc-patches
On Tue, Nov 24, 2020 at 05:27:10AM +, Maciej W. Rozycki wrote:
> On Tue, 24 Nov 2020, Maciej W. Rozycki wrote:
> 
> > > I don't know how or why __FLT_HAS_INFINITY is set for a target which
> > > does not support it, but if you get rid of that macro, that particular
> > > problem should be solved.
> > 
> >  Thanks for the hint; I didn't look into it any further not to distract 
> > myself from the scope of the project.  I have now, and the check you have 
> > quoted is obviously broken (as are all the remaining similar ones), given:
> > 
> > $ vax-netbsdelf-gcc -E -dM - < /dev/null | sort | grep _HAS_
> > #define __DBL_HAS_DENORM__ 0
> > #define __DBL_HAS_INFINITY__ 0
> > #define __DBL_HAS_QUIET_NAN__ 0
> > #define __FLT_HAS_DENORM__ 0
> > #define __FLT_HAS_INFINITY__ 0
> > #define __FLT_HAS_QUIET_NAN__ 0
> > #define __LDBL_HAS_DENORM__ 0
> > #define __LDBL_HAS_INFINITY__ 0
> > #define __LDBL_HAS_QUIET_NAN__ 0
> > $ 
> > 
> > which looks reasonable to me.  This seems straightforward to fix to me, so 
> > I'll include it along with verification I am about to schedule (assuming 
> > that this will be enough for libgfortran to actually build; obviously it 
> > hasn't been tried by anyone with such a setup for a while now, as these 
> > libgfortran checks date back to 2009).
> 
>  Well, it is still broken, owing to NetBSD failing to implement POSIX 2008 
> locale handling correctly, apparently deliberately[1], and missing 
> uselocale(3)[2] while still providing newlocale(3).  This confuses our 
> conditionals and consequently:
> 
> .../libgfortran/io/transfer.c: In function 'data_transfer_init_worker':
> .../libgfortran/io/transfer.c:3416:30: error:
> 'old_locale_lock' undeclared (first use in this function)
>  3416 |   __gthread_mutex_lock (_locale_lock);
>   |  ^~~
> 
> etc.
> 
>  We can probably work it around by downgrading to setlocale(3) for NetBSD 
> (i.e. whenever either function is missing) unless someone from the NetBSD 
> community contributes a better implementation (they seem to prefer their 
> own non-standard printf_l(3) library API).

Hi Maciej,

I've been building successfully with setting:
export ac_cv_func_freelocale=no
export ac_cv_func_newlocale=no
export ac_cv_func_uselocale=no

I think the code to avoid these functions already exists, but just the
configure tests need tuning.

Also, this is amazing work!


Re: [PR target/85401][v2] Add test-cases

2019-10-10 Thread coypu
On Thu, Oct 10, 2019 at 09:41:35AM +0100, Maciej W. Rozycki wrote:
> On Wed, 9 Oct 2019, co...@sdf.org wrote:
> 
> > diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c 
> > b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
> > new file mode 100644
> > index 000..1d68d0b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
> > @@ -0,0 +1,18 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O2" } */
> > +
> > +int h(void);
> > +int i(int);
> > +
> > +struct a b;
> > +struct a {
> > +  unsigned c : 4;
> > +} d() {
> > +  int e, f = b.c << 2, g = h();
> > +  for (; g;)
> > +;
> > +  if (e == 0)
> > +if (f)
> > +  i(f);
> > +  return b;
> > +}
> 
>  Can you please run this (and the other test case) through `indent -gnu'?
> 
>   Maciej

OK.

2019-10-09  Maya Rashish  
* gcc.c-torture/compile/pr85401: New test.

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401.c 
b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
new file mode 100644
index 000..fa8fa19be59
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int h (void);
+int i (int);
+
+struct a b;
+struct a
+{
+  unsigned c:4;
+} d ()
+{
+  int e, f = b.c << 2, g = h ();
+  for (; g;)
+;
+  if (e == 0)
+if (f)
+  i (f);
+  return b;
+}



[PR target/85401][v2] Add test-cases

2019-10-09 Thread coypu
On Fri, Oct 04, 2019 at 02:28:55PM -0600, Jeff Law wrote:
> On 10/4/19 1:43 PM, co...@sdf.org wrote:
> > On Tue, Oct 01, 2019 at 01:26:16PM -0600, Jeff Law wrote:
> >> On 9/30/19 2:45 PM, co...@sdf.org wrote:
> >>> On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
>  Yes, the patch is mostly ok.  You can commit it into the trunk after
>  applying changes mentioned below. If you do not have a write access, let 
>  me
>  know I'll commit the patch by myself.
> >>>
> >>> I don't have commit access. It would be nice if you committed it :)
> >> I took care of the nits and committed the patch.
> >>
> >>
> >>>
>  It would be nice to add a small test too.  But it is not obligatory for 
>  this
>  case as the patch is obvious and it might be hard to create a small test 
>  to
>  reproduce the bug.
> >>>
> >>> I have the C code that produces this failure. I can creduce it, but I'm
> >>> not sure there's a relationship between it and the bug.
> >>> Doing unrelated changes (adding instruction scheduling) to vax also hid 
> >>> it.
> >>>
> >>> Is this kind of test still valuable?
> >> Often they are.
> >>
> >> jeff
> > 
> > Here's the two tests I used. It might be too machine-made.
> > One is in the vax specific directory since it needed -fno-pic.
> > 
> > 
> > 2019-10-04  Maya Rashish  
> > * gcc.c-torture/compile/pr85401-2.c: New test.
> > * gcc.target/vax/pr85401-1.c: New test.
> ISTM that both should be in c-torture.  We can use dg-* things in there too.
> 
> jeff

Sorry. I didn't realize while sending that they both produce the same
crash.

I was trying to produce test cases that don't produce warnings, and
didn't notice the change. The original second test case has an
unintialized variable use, so I am omitting it.


2019-10-09  Maya Rashish  
* gcc.c-torture/compile/pr85401: New test.


diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c 
b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
new file mode 100644
index 000..1d68d0b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85401.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int h(void);
+int i(int);
+
+struct a b;
+struct a {
+  unsigned c : 4;
+} d() {
+  int e, f = b.c << 2, g = h();
+  for (; g;)
+;
+  if (e == 0)
+if (f)
+  i(f);
+  return b;
+}



[PR target/85401] Add test-cases

2019-10-04 Thread coypu
On Tue, Oct 01, 2019 at 01:26:16PM -0600, Jeff Law wrote:
> On 9/30/19 2:45 PM, co...@sdf.org wrote:
> > On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
> >> Yes, the patch is mostly ok.  You can commit it into the trunk after
> >> applying changes mentioned below. If you do not have a write access, let me
> >> know I'll commit the patch by myself.
> > 
> > I don't have commit access. It would be nice if you committed it :)
> I took care of the nits and committed the patch.
> 
> 
> > 
> >> It would be nice to add a small test too.  But it is not obligatory for 
> >> this
> >> case as the patch is obvious and it might be hard to create a small test to
> >> reproduce the bug.
> > 
> > I have the C code that produces this failure. I can creduce it, but I'm
> > not sure there's a relationship between it and the bug.
> > Doing unrelated changes (adding instruction scheduling) to vax also hid it.
> > 
> > Is this kind of test still valuable?
> Often they are.
> 
> jeff

Here's the two tests I used. It might be too machine-made.
One is in the vax specific directory since it needed -fno-pic.


2019-10-04  Maya Rashish  
* gcc.c-torture/compile/pr85401-2.c: New test.
* gcc.target/vax/pr85401-1.c: New test.


diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c 
b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
new file mode 100644
index 000..1d68d0b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85401-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int h(void);
+int i(int);
+
+struct a b;
+struct a {
+  unsigned c : 4;
+} d() {
+  int e, f = b.c << 2, g = h();
+  for (; g;)
+;
+  if (e == 0)
+if (f)
+  i(f);
+  return b;
+}
diff --git a/gcc/testsuite/gcc.target/vax/pr85401-1.c 
b/gcc/testsuite/gcc.target/vax/pr85401-1.c
new file mode 100644
index 000..3a06f45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/vax/pr85401-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-pic" } */
+
+int f;
+struct ac g;
+void h();
+void j() {}
+struct c {
+  int d;
+} k() {
+  ((struct c *)j)->d ^= f;
+}
+int *l();
+struct ac {
+  unsigned i : 4;
+} m() {
+  int *a, *c;
+  int b = g.i << 2, d, e;
+  ((struct c *)j)->d & 8;
+  a = l();
+  c = a;
+  h();
+  if (c)
+goto aj;
+  h();
+  d = b;
+  for (; d; d -= e += e)
+h();
+aj:
+  k();
+}



[PR target/85401] initialize the move cost table before using it (in another place, too)

2019-10-04 Thread coypu
On Tue, Oct 01, 2019 at 01:26:16PM -0600, Jeff Law wrote:
> On 9/30/19 2:45 PM, co...@sdf.org wrote:
> > On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
> >> Yes, the patch is mostly ok.  You can commit it into the trunk after
> >> applying changes mentioned below. If you do not have a write access, let me
> >> know I'll commit the patch by myself.
> > 
> > I don't have commit access. It would be nice if you committed it :)
> I took care of the nits and committed the patch.
> 
> 
> > 
> >> It would be nice to add a small test too.  But it is not obligatory for 
> >> this
> >> case as the patch is obvious and it might be hard to create a small test to
> >> reproduce the bug.
> > 
> > I have the C code that produces this failure. I can creduce it, but I'm
> > not sure there's a relationship between it and the bug.
> > Doing unrelated changes (adding instruction scheduling) to vax also hid it.
> > 
> > Is this kind of test still valuable?
> Often they are.
> 
> jeff

So it was. Here's another missed initialization, that running creduce
accidentally reached.



The mode might have changed, let's make sure the new mode is initialized
too.

2019-10-04  Maya Rashish 
* ira-color.c (update_costs_from_allocno): Call
ira_init_register_move_cost_if_necessary.

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 505d5c8ffb3..fb8b4dbc652 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1372,6 +1372,7 @@ update_costs_from_allocno (ira_allocno_t allocno, int 
hard_regno,
 e.g. DImode for AREG on x86.  For such cases the
 register move cost will be maximal.  */
  mode = narrower_subreg_mode (mode, ALLOCNO_MODE (cp->second));
+ ira_init_register_move_cost_if_necessary (mode);
  
  cost = (cp->second == allocno
  ? ira_register_move_cost[mode][rclass][aclass]



Re: [ping][PR target/85401] initialize the move cost table before using it

2019-09-30 Thread coypu
On Mon, Sep 30, 2019 at 11:46:24AM -0400, Vladimir Makarov wrote:
> Yes, the patch is mostly ok.  You can commit it into the trunk after
> applying changes mentioned below. If you do not have a write access, let me
> know I'll commit the patch by myself.

I don't have commit access. It would be nice if you committed it :)

> It would be nice to add a small test too.  But it is not obligatory for this
> case as the patch is obvious and it might be hard to create a small test to
> reproduce the bug.

I have the C code that produces this failure. I can creduce it, but I'm
not sure there's a relationship between it and the bug.
Doing unrelated changes (adding instruction scheduling) to vax also hid it.

Is this kind of test still valuable?

Thanks.


[ping][PR target/85401] initialize the move cost table before using it

2019-09-28 Thread coypu
re-posting, now CC'ing vmakarov who might be the right person to ping
about issues in this file.  apologies for the noise if I'm wrong.

--
This seems to be the way the rest of ira-color.c does it.
I hope it's OK. It does fix the segfault.

2019-09-10  Maya Rashish 

PR target/85401
* ira-color.c: (allocno_copy_cost_saving) Call
ira_init_register_move_cost_if_necessary

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 99236994d64..5d721102e19 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -2828,6 +2828,7 @@ allocno_copy_cost_saving (ira_allocno_t allocno, int 
hard_regno)
}
   else
gcc_unreachable ();
+  ira_init_register_move_cost_if_necessary(allocno_mode);
   cost += cp->freq * ira_register_move_cost[allocno_mode][rclass][rclass];
 }
   return cost;




Re: Deprecating cc0 (and consequently cc0 targets)

2019-09-22 Thread coypu
On Fri, Sep 20, 2019 at 09:38:38AM -0600, Jeff Law wrote:
> this time -- removals would happen during the gcc-11 cycle.

Hi Jeff,

I'm concerned that if I don't reach this milestone for VAX, it'll mean
that future code review will require justifying some of the original
changes which is getting increasingly challenging.

My first attempt at a CCmode conversion crashes early, and I was
suggested to first address any known bugs. I'll take another shot at it.


[PATCH target/86811] Mark VAX as not needing speculation barriers

2019-09-17 Thread coypu
According to Bob Supnik (who is a very authoritative source on VAX),

> Funny you should ask. The short answer is no. No VAX ever did
> speculative or out of order execution.

As such, marking VAX as not needing speculation barriers.


PR target/86811
* config/vax/vax.c (TARGET_HAVE_SPECULATION_SAFE_VALUE):
Define to speculation_safe_value_not_needed.

---
 gcc/config/vax/vax.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 1c220ff..fe5f04e 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -121,6 +121,9 @@ static HOST_WIDE_INT vax_starting_frame_offset (void);
 #undef TARGET_STARTING_FRAME_OFFSET
 #define TARGET_STARTING_FRAME_OFFSET vax_starting_frame_offset
 
+#undef TARGET_HAVE_SPECULATION_SAFE_VALUE
+#define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Set global variables as needed for the options enabled.  */
-- 


[PR target/85401] initialize the move cost table before using it

2019-09-14 Thread coypu
This seems to be the way the rest of ira-color.c does it.
I hope it's OK. It does fix the segfault.

2019-09-10  Maya Rashish 

PR target/85401
* ira-color.c: (allocno_copy_cost_saving) Call
ira_init_register_move_cost_if_necessary
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 99236994d64..5d721102e19 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -2828,6 +2828,7 @@ allocno_copy_cost_saving (ira_allocno_t allocno, int 
hard_regno)
}
   else
gcc_unreachable ();
+  ira_init_register_move_cost_if_necessary(allocno_mode);
   cost += cp->freq * ira_register_move_cost[allocno_mode][rclass][rclass];
 }
   return cost;


Re: [patch] Add NetBSD/hppa target

2019-06-25 Thread coypu
On Fri, Jun 14, 2019 at 01:32:11PM -0400, John David Anglin wrote:
> >> +hppa*-*-netbsd*)
> >> +  target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
> > Any reason to not use the PA 2.0 ISA?   I'm virtually certain we
> > supported the 32bit ABI running on PA 2.0 hardware in hpbsd (which is
> > where the netbsd PA code is ultimately derived from).   I'd be really
> > surprised if there's any PA1.1 hardware running anywhere, though there's
> > certainly some PA2.0 hardware out in the wild.
> You might also consider adding MASK_CALLER_COPIES as libgomp is broken for 
> callee
> copies.  This is an ABI choice so ideally you should do it now or not at all.


Hi Jeff, Dave,

I've spoken to the authority of NetBSD/hppa (that's Nick Hudson), and he
said he'd rather keep the ABI as it is for the purpose of upstreaming.
He might switch ABIs eventually, but would rather do it with the local
copy of GCC first.
(And he has several PA1.1 machines :))

Thanks.


[PATCH, netbsd] Give a name to the number 0 in sysarch(0, ...)

2019-06-19 Thread coypu
The definition originates in
https://nxr.netbsd.org/xref/src/sys/arch/arm/include/sysarch.h#58

I've added the prefix SYSARCH to avoid any naming conflict concerns.

It looked a bit like an error on a first impression :-)
* config/arm/netbsd-elf.h (SYSARCH_ARM_SYNC_ICACHE): New definition.
(CLEAR_INSN_CACHE) Use it.
---
 gcc/config/arm/netbsd-elf.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arm/netbsd-elf.h b/gcc/config/arm/netbsd-elf.h
index ec68d3fd10f..e42a32f927c 100644
--- a/gcc/config/arm/netbsd-elf.h
+++ b/gcc/config/arm/netbsd-elf.h
@@ -138,6 +138,8 @@
 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
 
+#define SYSARCH_ARM_SYNC_ICACHE0
+
 /* Clear the instruction cache from `BEG' to `END'.  This makes a
call to the ARM_SYNC_ICACHE architecture specific syscall.  */
 #define CLEAR_INSN_CACHE(BEG, END) \
@@ -151,6 +153,6 @@ do  
\
   } s; \
 s.addr = (unsigned int)(BEG);  \
 s.len = (END) - (BEG); \
-(void) sysarch (0, );\
+(void) sysarch (SYSARCH_ARM_SYNC_ICACHE, );  \
   }\
 while (0)
-- 
2.11.0



[patch] Add NetBSD/hppa target

2019-06-14 Thread coypu
This adds netbsd/hppa support. I tested it on the shiny new QEMU-git
which can now boot NetBSD too :-)

Files are very similar to the linux code.

Please let me know if any changes need to be made.

Matt Thomas 
Nick Hudson 
Matthew Green 
Maya Rashish 

gcc/ChangeLog:
config.gcc (hppa*-*-netbsd*): New target.
config/pa/pa-netbsd.h: New file.
config/pa/pa32-netbsd.h: New file.

libgcc/ChangeLog:
config.host (hppa*-*-netbsd*): New case.
config/pa/t-netbsd: New file.

---
 gcc/config.gcc  |   8 +++
 gcc/config/pa/pa-netbsd.h   | 137 
 gcc/config/pa/pa32-netbsd.h |  37 ++
 libgcc/config.host  |   3 +
 libgcc/config/pa/t-netbsd   |   9 +++
 5 files changed, 194 insertions(+)
 create mode 100644 gcc/config/pa/pa-netbsd.h
 create mode 100644 gcc/config/pa/pa32-netbsd.h
 create mode 100644 libgcc/config/pa/t-netbsd

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 76bb316942d..ba93bb41ec8 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1481,6 +1481,14 @@ hppa*-*-openbsd*)
gas=yes
gnu_ld=yes
;;
+hppa*-*-netbsd*)
+   target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
+   tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} \
+pa/pa-netbsd.h pa/pa32-regs.h pa/pa32-netbsd.h"
+   tmake_file="${tmake_file}"
+   tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
+   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+   ;;
 hppa[12]*-*-hpux10*)
case ${target} in
hppa1.1-*-* | hppa2*-*-*)
diff --git a/gcc/config/pa/pa-netbsd.h b/gcc/config/pa/pa-netbsd.h
new file mode 100644
index 000..88790987561
--- /dev/null
+++ b/gcc/config/pa/pa-netbsd.h
@@ -0,0 +1,137 @@
+/* Definitions for PA_RISC with ELF format
+   Copyright (C) 1999-2019 Free Software Foundation, 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
+.  */
+
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()   \
+  do   \
+{  \
+   NETBSD_OS_CPP_BUILTINS_ELF();   \
+   builtin_assert ("machine=bigendian");   \
+}  \
+  while (0)
+
+#undef CPP_SPEC
+#define CPP_SPEC NETBSD_CPP_SPEC
+
+#undef ASM_SPEC
+#define ASM_SPEC \
+  "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
+
+#undef EXTRA_SPECS
+#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS
+#undef SUBTARGET_EXTRA_SPECS
+
+#define NETBSD_ENTRY_POINT "__start"
+
+#undef LINK_SPEC
+#define LINK_SPEC NETBSD_LINK_SPEC_ELF
+
+/* NetBSD profiling functions don't need gcc to allocate counters.  */
+#define NO_DEFERRED_PROFILE_COUNTERS 1
+
+/* Define the strings used for the special svr4 .type and .size directives.
+   These strings generally do not vary from one system running svr4 to
+   another, but if a given system (e.g. m88k running svr) needs to use
+   different pseudo-op names for these, they may be overridden in the
+   file which includes this one.  */
+
+#undef STRING_ASM_OP
+#define STRING_ASM_OP   "\t.stringz\t"
+
+#define TEXT_SECTION_ASM_OP "\t.text"
+#define DATA_SECTION_ASM_OP "\t.data"
+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
+
+#define TARGET_ASM_FILE_START pa_linux_file_start
+
+/* We want local labels to start with period if made with asm_fprintf.  */
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+/* Define these to generate the Linux/ELF/SysV style of internal
+   labels all the time - i.e. to be compatible with
+   ASM_GENERATE_INTERNAL_LABEL in .  Compare these with the
+   ones in pa.h and note the lack of dollar signs in these.  FIXME:
+   shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
+
+#undef ASM_OUTPUT_ADDR_VEC_ELT
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+  fprintf (FILE, "\t.word .L%d\n", VALUE)
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
+
+/* Use the default.  */
+#undef ASM_OUTPUT_LABEL
+
+/* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
+   does what we want (i.e. uses colons).  It must be compatible with
+   ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
+
+/* Use the default.  */
+#undef ASM_OUTPUT_INTERNAL_LABEL
+
+/* Use the default.  */
+#undef 

[patch][aarch64] add netbsd/aarch64 target

2019-06-14 Thread coypu
Hi folks,

This patch adds support for netbsd/aarch64.
It would be nice to have it committed, please tell me if anything is
wrong.

Thanks.

Matthew Green 
Maya Rashish 

gcc:
* config.gcc (aarch64*-*-netbsd*): New target.
* config/aarch64/aarch64-netbsd.h: New file.
* config/aarch64/t-aarch64-netbsd: Likewise.

libgcc:
* config.host (aarch64*-*-netbsd*): New case.



---
 gcc/config.gcc  |  6 +++
 gcc/config/aarch64/aarch64-netbsd.h | 80 +
 gcc/config/aarch64/t-aarch64-netbsd | 21 
 libgcc/config.host  |  6 +++
 4 files changed, 113 insertions(+)
 create mode 100644 gcc/config/aarch64/aarch64-netbsd.h
 create mode 100644 gcc/config/aarch64/t-aarch64-netbsd

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 0f80e836f4e..678c4ec51a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1021,6 +1021,12 @@ aarch64*-*-freebsd*)
tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd"
tm_defines="${tm_defines}  TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
;;
+aarch64*-*-netbsd*)
+   tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file}"
+   tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-netbsd.h"
+   tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
+   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+   ;;
 aarch64*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h"
diff --git a/gcc/config/aarch64/aarch64-netbsd.h 
b/gcc/config/aarch64/aarch64-netbsd.h
new file mode 100644
index 000..72fe6a2bdb5
--- /dev/null
+++ b/gcc/config/aarch64/aarch64-netbsd.h
@@ -0,0 +1,80 @@
+/* Definitions for AArch64 running NetBSD
+   Copyright (C) 2016-2019 Free Software Foundation, 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
+   .  */
+
+#ifndef GCC_AARCH64_NETBSD_H
+#define GCC_AARCH64_NETBSD_H
+
+#define TARGET_LINKER_BIG_EMULATION "aarch64nbsdb"
+#define TARGET_LINKER_LITTLE_EMULATION "aarch64nbsd"
+
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_LINKER_EMULATION  TARGET_LINKER_BIG_EMULATION
+#else
+#define TARGET_LINKER_EMULATION  TARGET_LINKER_LITTLE_EMULATION
+#endif
+
+#undef  SUBTARGET_EXTRA_LINK_SPEC
+#define SUBTARGET_EXTRA_LINK_SPEC " -m" TARGET_LINKER_EMULATION
+
+#define NETBSD_ENTRY_POINT "__start"
+
+#define NETBSD_TARGET_LINK_SPEC  "%{h*}\
+   -X %{mbig-endian:-EB -m " TARGET_LINKER_BIG_EMULATION "} \
+   %{mlittle-endian:-EL -m " TARGET_LINKER_LITTLE_EMULATION "} \
+   %(netbsd_link_spec)"
+
+#if TARGET_FIX_ERR_A53_835769_DEFAULT
+#define CA53_ERR_835769_SPEC \
+  " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#else
+#define CA53_ERR_835769_SPEC \
+  " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
+#endif
+
+#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT
+#define CA53_ERR_843419_SPEC \
+  " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}"
+#else
+#define CA53_ERR_843419_SPEC \
+  " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}"
+#endif
+
+#undef  LINK_SPEC
+#define LINK_SPEC NETBSD_LINK_SPEC_ELF \
+ NETBSD_TARGET_LINK_SPEC   \
+  CA53_ERR_835769_SPEC \
+  CA53_ERR_843419_SPEC
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()   \
+  do   \
+{  \
+  NETBSD_OS_CPP_BUILTINS_ELF();\
+}  \
+  while (0)
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
+
+#undef EXTRA_SPECS
+#define EXTRA_SPECS \
+  { "asm_cpu_spec", ASM_CPU_SPEC }, \
+  NETBSD_SUBTARGET_EXTRA_SPECS
+
+#endif  /* GCC_AARCH64_NETBSD_H */
diff --git a/gcc/config/aarch64/t-aarch64-netbsd 
b/gcc/config/aarch64/t-aarch64-netbsd
new file mode 100644
index 000..aa447d0f6d4
--- /dev/null
+++ b/gcc/config/aarch64/t-aarch64-netbsd
@@ -0,0 +1,21 @@
+# Machine description for AArch64 architecture.
+#  Copyright (C) 2016-2019 Free Software Foundation, 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 

[PATCH, wwwdocs] Update on existence of free emulators

2019-06-13 Thread coypu
pinging this with more changes:
https://gcc.gnu.org/ml/gcc-patches/2019-03/msg01471.html

S   A Free simulator does not exist.

HPPA and alpha are supported by QEMU.
https://wiki.qemu.org/Features/HPPA
https://wiki.qemu.org/Documentation/Platforms/Alpha
VAX is supported by SIMH.
http://simh.trailing-edge.com/

Index: backends.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/backends.html,v
retrieving revision 1.84
diff -u -r1.84 backends.html
--- backends.html   18 Jan 2019 11:52:12 -  1.84
+++ backends.html   13 Jun 2019 14:35:24 -
@@ -69,7 +69,7 @@
 Target | HMSLQNFICBD lqrcpbfmgiates
 ---+---
 aarch64| Qq   b  gia  s
-alpha  |  ?? Q   Cq mgi  e
+alpha  |  ?  Q   Cq mgi  e
 arc|  B   b  gia
 arm|  b   ia  s
 avr|L  FIl  cp   g
@@ -101,7 +101,7 @@
 nds32  |   F Cia  s
 nios2  | Cia
 nvptx  |   S Q   Cq mg   e
-pa |   ? Q   CBD  qr  b   i  e
+pa | Q   CBD  qr  b   i  e
 pdp11  |L   ICqr  b  e
 powerpcspe | Q   Cqr pb   ia
 riscv  | Q   Cqr gia
@@ -116,7 +116,7 @@
 tilegx |   S Q   Cq  gi  e
 tilepro|   S   F C   gi  e
 v850   | g a  s
-vax|  M?I   c b   i  e
+vax|  M I   c b   i  e
 visium |  B  g  t s
 xtensa | C
 



Re: [PATCH] netbsd EABI support

2019-06-12 Thread coypu
I think copyright assignment is done. Thanks for bearing with me.

I noticed the version I submitted in April is missing some changes we
discussed on October 2018.

I took the patch from then and removed -matpcs too, the unnecessary
change to libgcc t-netbsd (which is the OABI configuration anyway), and
some whitespace git warned about.

Added the change to libatomic ifunc usage, since we recently claim ifunc
support on netbsd.
(Got lost in https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00290.html -
that one is my fault for submitting patches badly)


Matt Thomas 
matthew green 
Nick Hudson 
Maya Rashish 

gcc/ChangeLog:

* 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: Don't pass -matpcs unconditionally.
* config/netbsd-elf.h: Define SUBTARGET_EXTRA_SPECS.

libgcc/ChangeLog:

* 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.

libatomic/ChangeLog:
* configure.tgt: Exclude arm*-*-netbsd* from try_ifunc.



---
 gcc/config.gcc  | 29 +-
 gcc/config.host |  2 +-
 gcc/config/arm/netbsd-eabi.h| 97 +
 gcc/config/arm/netbsd-elf.h |  3 +-
 gcc/config/netbsd-elf.h | 14 +
 libatomic/configure.tgt |  2 +-
 libgcc/config.host  | 11 +++-
 libgcc/config/arm/t-netbsd  |  8 +++
 libgcc/config/arm/t-netbsd-eabi | 18 ++
 9 files changed, 177 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 6b00c387247..9fe57f4c7de 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1159,10 +1159,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 2213404dd0e..82409e32f96 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..5cbfcc92a59
--- /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 

Re: [PATCH] netbsd EABI support

2019-05-23 Thread coypu
On Thu, May 23, 2019 at 05:11:30PM +0100, Richard Earnshaw (lists) wrote:
> On 23/05/2019 17:01, Richard Earnshaw (lists) wrote:
> > On 23/05/2019 15:11, Richard Earnshaw (lists) wrote:
> >> On 23/05/2019 15:03, Richard Earnshaw (lists) wrote:
> >>> On 20/05/2019 20:24, Jeff Law wrote:
>  On 4/9/19 10:36 AM, Richard Earnshaw (lists) wrote:
> > On 09/04/2019 16:04, Jeff Law wrote:
> >> On 4/8/19 9:17 AM, co...@sdf.org wrote:
> >>> Pinging again in the hope of getting the patch in, I'd like to have
> >>> less outstanding patches :) (I have quite a few and new releases
> >>> can become painful!)
> >>>
> >>> gcc/ChangeLog
> >>>
> >>> 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/ChangeLog
> >>>
> >>> 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.
> >> So we're well into stage4 which means technically it's too late for
> >> something like this.  However, given it's limited scope I won't object
> >> if the ARM port maintainers want to go forward.  Otherwise I'll queue 
> >> it
> >> for gcc-10.
> >>
> >> jeff
> >>
> >
> > I was about to approve this (modulo removing the now obsolete
> > FPU_DEFAULT macro), until I noticed that it also modifies the generic
> > NetBSD code as well.  I'm certainly not willing to approve that myself
> > at this late stage, but if one of the NetBSD OS maintainers wants to
> > step up and do so, I'll happily take the Arm back-end code as that's not
> > a primary or secondary target.
>  So is removal of the FPUTYPE_DEFAULT stuff all that's needed for this to
>  go forward now that Jason T has chimed in?
> 
>  jeff
> 
> 
> >>>
> >>> Very close.  I was just doing a last pass through the patch to make that
> >>> small edit when I noticed this in config/arm/netbsd-eabi.h:
> >>>
> >>>
> >>> #define SUBTARGET_EXTRA_ASM_SPEC  \
> >>>   "-matpcs ..."
> >>>
> >>> Why is the assembler unconditionally passed -matpcs for an eabi
> >>> configuration?  That sounds broken.
> >>>
> >>> R.
> >>>
> >>
> >>
> >> Looking at what GAS does with this flag, it simply causes the assembler
> >> to create an empty .arm.atpcs debug section.  On that basis, I would
> >> expect that it's then safe (and correct) to remove this: the EABI is not
> >> the ATPCS.
> >>
> >> R.
> >>
> > 
> > 
> > Finally, I need the names of the authors and their email addresses in a
> > format suitable for the ChangeLog file.  As far as I can tell, that means:
> > 
> > Yourself
> > Matt Thomas
> > Matthew Green
> > Nick Hudson
> > 
> > R.
> > 
> 
> Argh, there's a final issue.  We can't find a copyright assignment
> against your email address.  Do you have one?
> 
> R.

Unfortunately no :-(
How do I do it?


Re: [PATCH] netbsd EABI support

2019-05-10 Thread coypu
On Fri, May 10, 2019 at 11:44:28AM +0100, Richard Earnshaw (lists) wrote:
> I was hoping to get a comment from one of the netbsd port maintainers on
> the changes to the common NetBSD code.  Are they no-longer active?

Jason Thorpe said he can't contribute to GCC because of where he works.
Krister Walfridsson is slow to respond but does eventually and knows a
lot about GCC.


Re: [PATCH] netbsd EABI support

2019-05-09 Thread coypu
On Tue, Apr 09, 2019 at 05:36:47PM +0100, Richard Earnshaw (lists) wrote:
> > So we're well into stage4 which means technically it's too late for
> > something like this.  However, given it's limited scope I won't object
> > if the ARM port maintainers want to go forward.  Otherwise I'll queue it
> > for gcc-10.
> > 
> > jeff
> > 
> 
> I was about to approve this (modulo removing the now obsolete
> FPU_DEFAULT macro), until I noticed that it also modifies the generic
> NetBSD code as well.  I'm certainly not willing to approve that myself
> at this late stage, but if one of the NetBSD OS maintainers wants to
> step up and do so, I'll happily take the Arm back-end code as that's not
> a primary or secondary target.
> 
> R.

Congrats on a new release :-)
ping


[PATCH] netbsd EABI support

2019-04-08 Thread coypu
Pinging again in the hope of getting the patch in, I'd like to have
less outstanding patches :) (I have quite a few and new releases
can become painful!)

gcc/ChangeLog

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/ChangeLog

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.

---
 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 { "mabi=aapcs-linux" }
+
+#define TARGET_LINKER_EABI_SUFFIX \
+(TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
+ ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
+ : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
+#define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
+#define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
+
+/* TARGET_BIG_ENDIAN_DEFAULT is set in
+   config.gcc for big endian configurations.  */
+#undef  

Re: [PATCH] claim ifunc support on several NetBSD architectures

2019-04-08 Thread coypu
Small addition for ARM. Since it doesn't have a geneirc way to detect
CPU features the code in libatomic relies on a linux-specific behaviour,
the ifunc condition is only defined for linux.

To unbreak compilation, I'd like to exclude netbsd/arm from the
libatomic ifunc camp :)

libatomic/ChangeLog:
* configure.tgt: Exclude arm*-*-netbsd* from try_ifunc.

diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ecbb7d33cc1..4a1294bc1ff 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -53,7 +53,7 @@ case "${target_cpu}" in
   arm*)
ARCH=arm
case "${target}" in
-arm*-*-freebsd*)
+arm*-*-freebsd* | arm*-*-netbsd*)
 ;;
 *)
 # ??? Detect when -march=armv7 is already enabled.



[PATCH] claim ifunc support on several NetBSD architectures

2019-04-07 Thread coypu
architecture list from netbsd src/tests/libexec/ld.elf_so/t_ifunc.c
(quick reference: 
https://github.com/NetBSD/src/blob/trunk/tests/libexec/ld.elf_so/t_ifunc.c#L38 )
tested on netbsd/amd64.

ifuncs worked anyway, but I can't use target_clones without this change.
that is one very cool feature I'd like to use :)

gcc/ChangeLog:
2019-04-07  Maya Rashish
* config.gcc (default_gnu_indirect_function): Default to yes
for arm*-*-netbsd*, i[34567]86-*-netbsd*, powerpc*-*-netbsd*,
sparc*-*-netbsd*, x86_64-*-netbsd*


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 3eb2e800fc5..73debdde10f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -849,6 +849,11 @@ case ${target} in
   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
   default_use_cxa_atexit=yes
   target_has_targetdm=yes
+  case ${target} in
+arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
+  default_gnu_indirect_function=yes
+  ;;
+  esac
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"



[PATCH, wwwdocs] Update on existence of free emulators for alpha, VAX

2019-03-31 Thread coypu
As far as I can tell, alpha can be emulated by QEMU.
VAX has SIMH. (Perhaps I should mention it somewhere? :))

Index: backends.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/backends.html,v
retrieving revision 1.84
diff -u -r1.84 backends.html
--- backends.html   18 Jan 2019 11:52:12 -  1.84
+++ backends.html   31 Mar 2019 08:00:23 -
@@ -69,7 +69,7 @@
 Target | HMSLQNFICBD lqrcpbfmgiates
 ---+---
 aarch64| Qq   b  gia  s
-alpha  |  ?? Q   Cq mgi  e
+alpha  |  ?  Q   Cq mgi  e
 arc|  B   b  gia
 arm|  b   ia  s
 avr|L  FIl  cp   g
@@ -116,7 +116,7 @@
 tilegx |   S Q   Cq  gi  e
 tilepro|   S   F C   gi  e
 v850   | g a  s
-vax|  M?I   c b   i  e
+vax|  M I   c b   i  e
 visium |  B  g  t s
 xtensa | C
 



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 wit

Re: [PATCH,GDC] Add netbsd support to GDC

2019-02-11 Thread coypu
On Wed, Jan 23, 2019 at 09:35:03AM +, co...@sdf.org wrote:
> > Is this necessary?  I'd prefer to not set this field if it can be
> > avoided.  The same goes for the others, I intend to remove them at
> > soonest convenience once the problematic parts of the front-end logic
> > has been abstracted away.
> > 
> > Other than that, looks reasonable to me.
> 
> It's not necessary. Here's an updated diff without it.
> I also forgot to add netbsd-d.c, which is referenced in the previous
> diff.

ping :-)
If it is good, can someone commit it? I don't have the ability to do so.


Re: [PATCH,GDC] Add netbsd support to GDC

2019-01-23 Thread coypu
(Oops, added the wrong email out of habit to the first reply :-))

On Tue, Jan 22, 2019 at 08:37:25PM +0100, Iain Buclaw wrote:
> > diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc
> > index b0a315a3ed9..ca105c7635d 100644
> > --- a/gcc/d/d-builtins.cc
> > +++ b/gcc/d/d-builtins.cc
> > @@ -382,6 +382,8 @@ d_add_builtin_version (const char* ident)
> >  global.params.isWindows = true;
> >else if (strcmp (ident, "FreeBSD") == 0)
> >  global.params.isFreeBSD = true;
> > +  else if (strcmp (ident, "NetBSD") == 0)
> > +global.params.isNetBSD = true;
> >else if (strcmp (ident, "OpenBSD") == 0)
> >  global.params.isOpenBSD = true;
> >else if (strcmp (ident, "Solaris") == 0)
> 
> Is this necessary?  I'd prefer to not set this field if it can be
> avoided.  The same goes for the others, I intend to remove them at
> soonest convenience once the problematic parts of the front-end logic
> has been abstracted away.
> 
> Other than that, looks reasonable to me.

It's not necessary. Here's an updated diff without it.
I also forgot to add netbsd-d.c, which is referenced in the previous
diff.

libphobos/libdruntime changes were contributed upstream:
https://github.com/dlang/druntime/pull/2472
(caveat: pending a change to netbsd/execinfo.d)

gcc/config.gcc (*-*-netbsd*): add netbsd-d.o
gcc/config/t-netbsd: add netbsd-d.o
gcc/config/netbsd-d.c: New, define Posix and NetBSD builtins for NetBSD targets

gcc/d/d-system.h: NetBSD is POSIX
libphobos/configure.tgt: Mark netbsd/x86 as supported
---
 gcc/config.gcc  |  2 ++
 gcc/config/netbsd-d.c   | 41 +
 gcc/config/t-netbsd |  4 
 gcc/d/d-system.h|  3 ++-
 libphobos/configure.tgt |  2 ++
 5 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 gcc/config/netbsd-d.c

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a189cb19f63..c5d3044b017 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -839,6 +839,7 @@ case ${target} in
   tm_p_file="${tm_p_file} netbsd-protos.h"
   tmake_file="t-netbsd t-slibgcc"
   extra_objs="${extra_objs} netbsd.o"
+  d_target_objs="${d_target_objs} netbsd-d.o"
   gas=yes
   gnu_ld=yes
   use_gcc_stdint=wrap
@@ -847,6 +848,7 @@ case ${target} in
   esac
   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
   default_use_cxa_atexit=yes
+  target_has_targetdm=yes
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"
diff --git a/gcc/config/netbsd-d.c b/gcc/config/netbsd-d.c
new file mode 100644
index 000..8593f8bd430
--- /dev/null
+++ b/gcc/config/netbsd-d.c
@@ -0,0 +1,41 @@
+/* Functions for generic NetBSD as target machine for GNU D compiler.
+   Copyright (C) 2019 Free Software Foundation, 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
+.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "varasm.h"
+#include "netbsd-protos.h"
+#include "tm_p.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+static void
+netbsd_d_os_builtins (void)
+{
+  d_add_builtin_version ("Posix");
+  d_add_builtin_version ("NetBSD");
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS netbsd_d_os_builtins
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd
index 4626e963ebf..716a94f86c6 100644
--- a/gcc/config/t-netbsd
+++ b/gcc/config/t-netbsd
@@ -19,3 +19,7 @@
 netbsd.o: $(srcdir)/config/netbsd.c
$(COMPILE) $<
$(POSTCOMPILE)
+
+netbsd-d.o: $(srcdir)/config/netbsd-d.c
+   $(COMPILE) $<
+   $(POSTCOMPILE)
diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h
index cd59b827812..c32825d4ad1 100644
--- a/gcc/d/d-system.h
+++ b/gcc/d/d-system.h
@@ -24,7 +24,8 @@
 
 /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
 #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
-  || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun)
+  || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
+  || __sun)
 
 /* Forward assert invariants to gcc_assert.  */
 #undef assert
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 2b2a9746811..0471bfd816b 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -30,6 +30,8 @@ case "${target}" in
;;
   x86_64-*-linux* | i?86-*-linux*)
;;
+  x86_64-*-netbsd* | 

[PATCH] Provide early warning about configure failure

2018-12-08 Thread coypu
Hi folks,

I was bitten by this, and it seemed like a few people online had similar
issues (for example https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65794).

We run a configure script from another configure script, to generate 
auto-build.h.
Secondary configure might fail.
This failure isn't fatal, and we continue running a configure script.
The output is obscured by a lot of configure messages.
We fail later auto-build.h not existing.

I added a test to see if making auto-build.h succeeded and fail & warn
otherwise. As an added bonus, it means the secondary configure
config.log stays around to inspect.

Let me know what you think.
configure.ac: Fail early if creating auto-build.h fails
configure: regen

---
 gcc/configure| 8 ++--
 gcc/configure.ac | 4 
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index dc4298097..5bf4b2954 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11893,6 +11893,10 @@ else
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
 
+   if test ! -f auto-host.h ; then
+   as_fn_error $? "Failed to generate build configuration" 
"$LINENO" 5
+   fi
+
# We just finished tests for the build machine, so rename
# the file auto-build.h in the gcc directory.
mv auto-host.h ../auto-build.h
@@ -18572,7 +18576,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18575 "configure"
+#line 18579 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18678,7 +18682,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18681 "configure"
+#line 18685 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 2a1f3bb39..5f05ab8da 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1740,6 +1740,10 @@ else
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
 
+   if test ! -f auto-host.h ; then
+   AC_MSG_ERROR([Failed to generate build configuration])
+   fi
+
# We just finished tests for the build machine, so rename
# the file auto-build.h in the gcc directory.
mv auto-host.h ../auto-build.h
-- 
2.19.1



[PATCH] Fix PIE on netbsd (PR target/87221)

2018-11-09 Thread coypu
Re-sending because my patch doesn't seem to appear on the archive


This matches to what netbsd is doing with its own copy of GCC,
it can be simpler.

PR target/87221:
config/netbsd-elf.h (NETBSD_STARTFILE_SPEC): use crtbeginS.o for PIE
(NETBSD_ENDFILE_SPEC): use crtendS.o for PIE

---
 gcc/config/netbsd-elf.h | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/config/netbsd-elf.h b/gcc/config/netbsd-elf.h
index 4dc2aa757..26e5d996e 100644
--- a/gcc/config/netbsd-elf.h
+++ b/gcc/config/netbsd-elf.h
@@ -40,8 +40,11 @@ along with GCC; see the file COPYING3.  If not see
%{!p:crt0%O%s}}}\
%:if-exists(crti%O%s)   \
%{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
-   %{!static: \
- %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
+   %{!static:   \
+ %{!shared: \
+   %{!pie:crtbegin%O%s} \
+   %{pie:crtbeginS%O%s}}\
+ %{shared:crtbeginS%O%s}}"
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
@@ -52,7 +55,10 @@ along with GCC; see the file COPYING3.  If not see
C++ file-scope static objects deconstructed after exiting "main".  */
 
 #define NETBSD_ENDFILE_SPEC\
-  "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
+  "%{!shared:   \
+%{!pie:crtend%O%s}  \
+%{pie:crtendS%O%s}} \
+   %{shared:crtendS%O%s}\
%:if-exists(crtn%O%s)"
 
 #undef ENDFILE_SPEC
-- 
2.19.1


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

2018-11-02 Thread coypu
On Fri, Nov 02, 2018 at 11:04:06AM +, Richard Earnshaw (lists) wrote:
> Sorry about that.  You don't really expect me to remember every patch I
> committed 18 years ago!
> 
> And pedantically, that was a branch merge patch.  The original commit
> (back in the CVS days) was:
> 
> 
>   revision 1.9.2.1
>   date: 1999/10/25 17:47:02;  author: [redacted];  state: Exp;  lines:
> +34 -10
>   Initial check in of merged arm/thumb backend.
> 
> However, the age of this makes me suspect that it quite likely is not
> relevant any more and that we should investigate whether it is safe to
> remove.  We're running some tests here, but can you test the NetBSD port
> without that as well for another data point?

I thought it's funny, sorry :-)
netbsd seems to only do this for OABI (and defaults to EABI).
I tried it anyway on netbsd's mutant GCC 6.4 and ran a full userland with
it. It works really well!
I'm surprised I can run code that file identifies as "ARMv1" on a machine
that can run Aarch64.


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

2018-10-31 Thread coypu
On Wed, Oct 31, 2018 at 03:23:27PM +, Richard Earnshaw (lists) wrote:
> On 31/10/2018 14:10, co...@sdf.org wrote:
> > +
> > +# Currently there is a bug somewhere in GCC's alias analysis
> > +# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
> > +# Disabling function inlining is a workaround for this problem.
> > +HOST_LIBGCC2_CFLAGS += -fno-inline
> 
> This needs to be investigated properly (and fixed if it's still a problem).
> 
> R.

After some VCS digging, it turns out you committed this change:
https://github.com/gcc-mirror/gcc/commit/cffb2a26c44c682185b6bb405d48fcbe1fbc0b37

NetBSD copied it over from existing GCC files, and it still exists in
GCC trunk, in libgcc/config/arm/t-elf.


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

2018-10-31 Thread coypu
Thanks for the feedback. I made some improvements.
Changes from the first patch:

config.gcc:
need_64bit_hwint=yes No longer needed
resolve conflict from strongarm being default for netbsd.
switch default cpu for armv7--netbsdelf-eabi: cortex-a8 -> generic-armv7-a,
(make -mfpu=auto pick VFPv3-D16)
remove redundant extra configuration for armv4, all it did was pick
strongarm as the default CPU, and now it is the default CPU for all
arm*-*-netbsdelf*.
(This means there is no natural place to rule out armv4-eabihf configurations,
so I didn't add it - do we still want it?)


config/arm/netbsd-eabi.h:
remove BE8_LINK_SPEC, not needed any more
remove SUBTARGET_ASM_FLOAT_SPEC, handled by generic ARM code better,
with -mfpu=auto

config/arm/netbsd-elf.h:
don't define FPUTYPE_DEFAULT, it's unused.
remove CTOR_LISTS_DEFINED_EXTERNALLY definition, it's unused.



Some things that I am still conflicted about:
- I get the libgcc_s.so mismatch on native builds. This wasn't a problem
  in a previous attempt against gcc-7, I haven't pinned down why yet.
- there's duplicate logic for picking default CPU in
gcc/config/arm/netbsd-elf.h
- CTOR_LISTS_DEFINED_EXTERNALLY does nothing now, but I'm not sure
we actually didn't need it.
- I didn't add HOST_LIBGCC2_CFLAGS, I'll have to do some
investigation why it was put in place.


changelog entries (I assume that they need to be split out like
this)

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.

---
 gcc/config.gcc  | 29 +-
 gcc/config.host |  2 +-
 gcc/config/arm/netbsd-eabi.h| 97 +
 gcc/config/arm/netbsd-elf.h |  1 +
 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, 181 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 b108697cf..10e2477c6 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1155,10 +1155,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 c65569da2..59208d250 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 0..13bc27417
--- /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 

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] Default to an ARM cpu that exists

2018-10-22 Thread coypu
On Mon, Oct 22, 2018 at 03:56:24PM +0100, Richard Earnshaw (lists) wrote:
> I think strongarm would be a better choice.  I'm not aware of anyone
> running NetBSD on Arm8 cpus.
> 
> Otherwise, this is fine with a suitable ChangeLog entry.
> 
> R.

I hope this is OK. Thanks!

Maya Rashish  

PR target/86383
* config.gcc (arm*-*-*): Change default -mcpu to strongarm.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 720e6a737..23e2e85c8 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3987,7 +3987,7 @@ case "${target}" in
TM_MULTILIB_CONFIG="$with_multilib_list"
fi
fi
-   target_cpu_cname=${target_cpu_cname:-arm6}
+   target_cpu_cname=${target_cpu_cname:-strongarm}
with_cpu=${with_cpu:-$target_cpu_cname}
;;
 



Re: [PATCH] Default to an ARM cpu that exists

2018-10-22 Thread coypu
On Mon, Oct 22, 2018 at 03:56:24PM +0100, Richard Earnshaw (lists) wrote:
> I think strongarm would be a better choice.  I'm not aware of anyone
> running NetBSD on Arm8 cpus.

Clarifying: this is the global default for all GCC ARM targets,
not just netbsd. Is strongarm still the preferred choice?

Thanks.


[PATCH] Default to an ARM cpu that exists

2018-10-20 Thread coypu
Regarding target/86383, it wasn't sufficient to not just pick arm6 for
netbsd, as the default -mcpu is still arm6, which also fails to build.

I assume the default is expected to be the oldest support, and I think
now that's arm8, so maybe default to that.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 720e6a737..278c48287 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3987,7 +3987,7 @@ case "${target}" in
TM_MULTILIB_CONFIG="$with_multilib_list"
fi
fi
-   target_cpu_cname=${target_cpu_cname:-arm6}
+   target_cpu_cname=${target_cpu_cname:-arm8}
with_cpu=${with_cpu:-$target_cpu_cname}
;;
 



Re: [PATCH] Fix extra parens in config/tls.m4

2018-09-16 Thread coypu
On Sun, Sep 16, 2018 at 01:00:21PM +0200, Andreas Schwab wrote:
> On Sep 03 2018, co...@sdf.org wrote:
> 
> > config/tls.m4: Remove extra parentheses
> 
> There are no extra parentheses.
> 

For the benefit of the discussion, I've added the more minimal version
of the patch.

This is a weird configure test because of the parens. It's not wrong
because its wrongness is compensated for later. So maybe it's a matter
of opinion.

But probably this is the intended generated autoconf output.
diff --git a/config/tls.m4 b/config/tls.m4
index 4e170c8d6ae..b9b363d8a80 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -104,7 +104,7 @@ AC_DEFUN([GCC_CHECK_CC_TLS], [
 gcc_cv_have_cc_tls, [
 AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
   [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
-)])
+)
   if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
 AC_DEFINE(HAVE_CC_TLS, 1,
  [Define to 1 if the target assembler supports thread-local 
storage.])
diff --git a/libgcc/configure b/libgcc/configure
index 79068536175..8ccb700da0f 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5304,6 +5304,11 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_cc_tls" >&5
 $as_echo "$gcc_cv_have_cc_tls" >&6; }
+  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_CC_TLS 1" >>confdefs.h
+
+  fi
 set_have_cc_tls=
 if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
   set_have_cc_tls="-DHAVE_CC_TLS"


Re: [PATCH] Fix extra parens in config/tls.m4

2018-09-16 Thread coypu
ping.
I can provide a less scary patch to correct the typo if people are
afraid of the cleanup changes.


[PATCH] Fix extra parens in config/tls.m4

2018-09-03 Thread coypu
Hi folks,
This typo meant that HAVE_CC_TLS wasn't added to confdefs.h.

We run a potentially questionable setup where we save the results of
running configure for every architecture and then use it in subsequent
builds for reliability.

the addition of -DHAVE_CC_TLS wasn't saved to confdefs, so that's how
we got a bug: https://gnats.netbsd.org/53567

I don't know if anyone else runs a similar setup, but it is a cleanup
and an overall improvement to the code, nevertheless.

Maya Rashish 

config/tls.m4: Remove extra parentheses
libgcc/configure.ac: Remove unnecessary logic for set_have_cc_tls
set_use_emutls, provided in confdefs.h
libgcc/configure: Regen
libgcc/Makefile.in: Remove extra logic for @set_have_cc_tls@
@set_use_emutls@, now provided by confdefs.h
diff --git a/config/tls.m4 b/config/tls.m4
index 4e170c8d6ae..b9b363d8a80 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -104,7 +104,7 @@ AC_DEFUN([GCC_CHECK_CC_TLS], [
 gcc_cv_have_cc_tls, [
 AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
   [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
-)])
+)
   if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
 AC_DEFINE(HAVE_CC_TLS, 1,
  [Define to 1 if the target assembler supports thread-local 
storage.])
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 0c5b264f717..84738e76eaa 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -291,7 +291,7 @@ override CFLAGS := $(filter-out -fprofile-generate 
-fprofile-use,$(CFLAGS))
 # will usually contain -g, so for the moment CFLAGS goes first.  We must
 # include CFLAGS - that's where multilib options live.
 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
- $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
+ $(INCLUDES)
 
 # Options to use when compiling crtbegin/end.
 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
diff --git a/libgcc/configure b/libgcc/configure
index 090e5484131..f71afa3de01 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -567,8 +567,6 @@ tm_defines
 tm_file
 tmake_file
 sfp_machine_header
-set_use_emutls
-set_have_cc_tls
 vis_hide
 real_host_noncanonical
 accel_dir_suffix
@@ -5304,11 +5302,11 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_cc_tls" >&5
 $as_echo "$gcc_cv_have_cc_tls" >&6; }
-set_have_cc_tls=
-if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
-  set_have_cc_tls="-DHAVE_CC_TLS"
-fi
+  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_CC_TLS 1" >>confdefs.h
 
+  fi
 
 # See if we have emulated thread-local storage.
 
@@ -5340,11 +5338,6 @@ $as_echo "$gcc_cv_use_emutls" >&6; }
 $as_echo "#define USE_EMUTLS 1" >>confdefs.h
 
   fi
-set_use_emutls=
-if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
-  set_use_emutls="-DUSE_EMUTLS"
-fi
-
 
 
 
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 9d0bbcaba86..91fcb321010 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -519,19 +519,9 @@ fi
 # gcc, which can't be used to build executable due to that libgcc
 # is yet to be built here.
 GCC_CHECK_CC_TLS
-set_have_cc_tls=
-if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
-  set_have_cc_tls="-DHAVE_CC_TLS"
-fi
-AC_SUBST(set_have_cc_tls)
 
 # See if we have emulated thread-local storage.
 GCC_CHECK_EMUTLS
-set_use_emutls=
-if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
-  set_use_emutls="-DUSE_EMUTLS"
-fi
-AC_SUBST(set_use_emutls)
 
 dnl Check if as supports AVX instructions.
 AC_DEFUN([LIBGCC_CHECK_AS_AVX], [


Re: [PATCH 1/2] Untangle stddef.h a little

2018-06-19 Thread coypu
On Tue, Jun 19, 2018 at 03:31:55PM +, Joseph Myers wrote:
> On Sun, 4 Feb 2018, Maya Rashish wrote:
> 
> > Of the currently supported BSDs:
> > - FreeBSD, doesn't have ansi.h or define _MACHINE_ANSI_H anywhere
> > in its other headers since the long-gone 5.x release.
> > - OpenBSD, DragonflyBSD don't have ansi.h either.
> > - NetBSD, sole remaining with ansi.h
> > 
> > Replace all the ifdef macros to be ifdef __NetBSD__ as it's the
> > sole remaining user.
> > 
> > Whether it is appropriate to make per-OS choices here is debatable,
> > but this change allows for further future cleanup.
> > 
> > This enables using the headers on netbsd archs that use different
> > include guards for ansi.h, like ARM.
> 
> These two patches are OK, please commit.
> 
> (GCC officially removed support for FreeBSD versions before FreeBSD 5 with
> 
> r260852 | gerald | 2018-05-28 23:20:15 + (Mon, 28 May 2018) | 5 lines
> 
> * config.gcc: Identify FreeBSD 3.x and 4.x as unsupported.
> 
> * config/freebsd-spec.h (FBSD_LIB_SPEC): Only consider FreeBSD 5
> and later.
> 
> .)
> 

Hi! I have no commit access. 
Can someone commit it?

Thanks :-)


Re: [PATCH, alpha] PR target/85095

2018-06-17 Thread coypu
Ping.
Anything else to do for this?

Thanks.


Re: [PATCH, alpha] PR target/85095

2018-05-24 Thread coypu
On Thu, May 24, 2018 at 01:32:17PM -0600, Jeff Law wrote:
> On 05/24/2018 01:17 PM, co...@sdf.org wrote:
> > On Thu, May 24, 2018 at 12:48:22PM -0600, Jeff Law wrote:
> >> On 05/24/2018 07:54 AM, Maya Rashish wrote:
> >>> Move linux-specific specfile definitions to linux.h
> >>> gcc/config/alpha/linux.h (STARTFILE_SPEC, ENDFILE_SPEC) move from 
> >>> alpha/elf.h
> >>> ---
> >>>  gcc/config/alpha/elf.h   | 26 --
> >>>  gcc/config/alpha/linux.h | 26 ++
> >>>  2 files changed, 26 insertions(+), 26 deletions(-)
> >> So is there going to be some kind of follow-up to fix freebsd, netbsd
> >> and openbsd which currently get their STARTFILE/ENDFILE from elf.h?
> >>
> >> jeff
> > 
> > I can try to fix openbsd soon, but freebsd dropped alpha in 2009.
> > How does gcc feel about me picking up patches from openbsd ports, their
> > package manager, that weren't written by myself?
> So ISTM we should deprecate freebsd alpha.
> 
> WRT picking up bits from others.  It'd really depend on their size and
> complexity -- I'd have to see them to be able to judge.  I'll review if
> you extract the necessary bits and submit them.
> 
> Jeff

- With the original patch
- Attached patch to update the specfile for openbsd from openbsd ports
(It is here: 
https://github.com/openbsd/ports/blob/master/lang/gcc/6/patches/patch-gcc_config_alpha_openbsd_h
 )
- Attached patch to recognise cross compilation for openbsd (from me)
- A violent hack of "borrowing" stdatomic.h from a newer GCC
- Disabling libssp

I can build trunk for openbsd--alpha.
>From 1387836d5af4150ea08b888a202f72c08909a32f Mon Sep 17 00:00:00 2001
From: Maya Rashish 
Date: Fri, 25 May 2018 01:26:01 +0300
Subject: [PATCH 1/2] Recognise cross compilation for openbsd

---
 libstdc++-v3/configure  | 2 +-
 libstdc++-v3/crossconfig.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 79eb18727ea..cb51a01feeb 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -66148,7 +66148,7 @@ fi
 done
 
 ;;
-  *-netbsd*)
+  *-netbsd* | *-openbsd*)
 SECTION_FLAGS='-ffunction-sections -fdata-sections'
 
 
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index 669d87f7602..0dbfe4057bd 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -201,7 +201,7 @@ case "${host}" in
 AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
 AC_CHECK_FUNCS(_wfopen)
 ;;
-  *-netbsd*)
+  *-netbsd* | *-openbsd*)
 SECTION_FLAGS='-ffunction-sections -fdata-sections'
 AC_SUBST(SECTION_FLAGS) 
 GLIBCXX_CHECK_LINKER_FEATURES
-- 
2.17.0

>From 164a025328b007fb73ccd4491bc7d6fc70b88f0d Mon Sep 17 00:00:00 2001
From: Maya Rashish 
Date: Fri, 25 May 2018 01:26:16 +0300
Subject: [PATCH 2/2] Update openbsd/alpha specfile.

Taken from OpenBSD ports
---
 gcc/config/alpha/openbsd.h | 33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/gcc/config/alpha/openbsd.h b/gcc/config/alpha/openbsd.h
index aa369d7630a..9f035150d8b 100644
--- a/gcc/config/alpha/openbsd.h
+++ b/gcc/config/alpha/openbsd.h
@@ -19,6 +19,28 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Controlling the compilation driver.  */
 
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+   (MASK_FPREGS | MASK_IEEE | MASK_IEEE_CONFORMANT)
+
+ #define LINK_SPEC \
+  "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start \
+   %{shared:-shared} %{R*} \
+   %{static:-Bstatic} \
+   %{!static:-Bdynamic} \
+   %{rdynamic:-export-dynamic} \
+   %{assert*} \
+   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+
+/* As an elf system, we need crtbegin/crtend stuff.  */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+   %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
+   %{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
+   %{!nopie:rcrt0%O%s crtbegin%O%s} %{shared:crtbeginS%O%s}"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
 /* run-time target specifications */
 #define TARGET_OS_CPP_BUILTINS()   \
 do {   \
@@ -28,18 +50,27 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Layout of source language data types.  */
 
-/* This must agree with  */
+/* This must agree with  */
 #undef SIZE_TYPE
 #define SIZE_TYPE "long unsigned int"
 
 #undef PTRDIFF_TYPE
 #define PTRDIFF_TYPE "long int"
 
+#undef INTMAX_TYPE
+#define INTMAX_TYPE "long long int"
+
+#undef UINTMAX_TYPE
+#define UINTMAX_TYPE "long long unsigned int"
+
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
+#undef WINT_TYPE
+#define WINT_TYPE "int"
+
 
 #define LOCAL_LABEL_PREFIX "."
-- 
2.17.0



Re: [PATCH, alpha] PR target/85095

2018-05-24 Thread coypu
On Thu, May 24, 2018 at 12:48:22PM -0600, Jeff Law wrote:
> On 05/24/2018 07:54 AM, Maya Rashish wrote:
> > Move linux-specific specfile definitions to linux.h
> > gcc/config/alpha/linux.h (STARTFILE_SPEC, ENDFILE_SPEC) move from 
> > alpha/elf.h
> > ---
> >  gcc/config/alpha/elf.h   | 26 --
> >  gcc/config/alpha/linux.h | 26 ++
> >  2 files changed, 26 insertions(+), 26 deletions(-)
> So is there going to be some kind of follow-up to fix freebsd, netbsd
> and openbsd which currently get their STARTFILE/ENDFILE from elf.h?
> 
> jeff

I can try to fix openbsd soon, but freebsd dropped alpha in 2009.
How does gcc feel about me picking up patches from openbsd ports, their
package manager, that weren't written by myself?


Re: [PATCH] PR target/85904: Fix configure when cross compiling for netbsd

2018-05-24 Thread coypu
On Thu, May 24, 2018 at 06:31:25PM +0100, Jonathan Wakely wrote:
> On 24/05/18 16:14 +0100, Jonathan Wakely wrote:
> > On 24/05/18 13:14 +, co...@sdf.org wrote:
> > > In the past I was asked to post bugzilla patches here. I am doing this.
> > > It fixes a build failure.
> > > 
> > > PR target/85904
> > > libstdc++-v3/crossconfig.m4: test for aligned_alloc on netbsd
> > > libstdc++-v3/configure: Regenerate
> > > 
> > > Attached is patch.
> > 
> > Thanks for the patch. We made a similar fix for FreeBSD recently, so
> > I'll commit this for you.
> 
> For consistency with freebsd and mingw what I committed to trunk has
> the AC_CHECK_FUNCS at the end of the netbsd section. Could you check
> it still works please? (I'm unable to build a netbsd cross-compiler
> for some reason).

It works, thank you!


[PATCH] PR target/85904: Fix configure when cross compiling for netbsd

2018-05-24 Thread coypu
In the past I was asked to post bugzilla patches here. I am doing this.
It fixes a build failure.

PR target/85904
libstdc++-v3/crossconfig.m4: test for aligned_alloc on netbsd
libstdc++-v3/configure: Regenerate

Attached is patch.
>From ac7a1f364b0ca5e3a6a5a68a16266d1cb78ee5da Mon Sep 17 00:00:00 2001
From: Maya Rashish 
Date: Thu, 24 May 2018 16:05:27 +0300
Subject: [PATCH 1/1] check for aligned_alloc on netbsd crosscompilation.

Fixes build issue:
/home/fly/gcc/libstdc++-v3/libsupc++/new_opa.cc:62:1: error: 'void* 
aligned_alloc(std::size_t, std::size_t)' was declared 'extern' and later 
'static' [-fpermissive]
 aligned_alloc (std::size_t al, std::size_t sz)
 ^
In file included from /tmp/build/alpha--netbsd/libstdc++-v3/include/cstdlib:75,
 from /tmp/build/alpha--netbsd/libstdc++-v3/include/stdlib.h:36,
 from /home/fly/gcc/libstdc++-v3/libsupc++/new_opa.cc:27:
/tmp/build/gcc/include-fixed/stdlib.h:254:7: note: previous declaration of 
'void* aligned_alloc(size_t, size_t)'
 void *aligned_alloc(size_t, size_t);
   ^
---
 libstdc++-v3/configure  | 13 +
 libstdc++-v3/crossconfig.m4 |  1 +
 2 files changed, 14 insertions(+)

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index f3522ee..9fd6197169a 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -66150,6 +66150,19 @@ done
 ;;
   *-netbsd*)
 SECTION_FLAGS='-ffunction-sections -fdata-sections'
+for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
 
 
   # If we're not using GNU ld, then there's no point in even trying these
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index f0a55c68404..dcc807eb76a 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -203,6 +203,7 @@ case "${host}" in
 ;;
   *-netbsd*)
 SECTION_FLAGS='-ffunction-sections -fdata-sections'
+AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
 AC_SUBST(SECTION_FLAGS) 
 GLIBCXX_CHECK_LINKER_FEATURES
 AC_DEFINE(HAVE_FINITEF)
-- 
2.17.0



Re: [PATCH 1/2] Untangle stddef.h a little

2018-02-28 Thread coypu
hi gcc-patches,

as part of pinging, i'll explain the story of this patch.

I want to make sure all netbsd archs work with upstream gcc.
in this case, netbsd/arm's EABI support.
I try to break up my changes into digestible chunks that are rational,
which is why this change came first.

building netbsd/arm gcc-trunk, I had a build error in libstdc++, because
this stddef.h relies on include guards:

#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_)  
|| defined(_I386_ANSI_H_)

In theory I could have just added:
 || _ARM_ANSI_H_

this felt gross, so I tried a better solution.
the file even comes with comments like:
  /* Why is this file so hard to maintain properly?
so I try my best to help.

Please let me upstream local changes. there are a lot of them. and I
feel unable to get them across.
I have so many changes that it feels inappropriate to ask for help with
hard problems like internal compiler errors because upstream GCC hit a
different problem. I'm not familiar with stuff so this is hard :-(


Re: [PATCH 1/2] Untangle stddef.h a little

2018-02-19 Thread coypu
ping
they're good patches. ask questions. I have more.


Re: [PATCH 1/2] Untangle stddef.h a little

2018-02-12 Thread coypu
ping, let me know if there is anything wrong with it.


[PATCH 2/2] Simplify: combine cases for dfly+fbsd with vms.

2018-02-03 Thread coypu
No need to have VMS in a separate elif case and a separate comment
for it saying the same thing.

No functional change intended.
---
 gcc/ginclude/stddef.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 15a99e7da..8d5a73ab5 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -196,10 +196,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
   || defined(__DragonFly__) \
-  || defined(__FreeBSD_kernel__)
-/* __size_t is a typedef on FreeBSD 5, must not trash it. */
-#elif defined (__VMS__)
-/* __size_t is also a typedef on VMS.  */
+  || defined(__FreeBSD_kernel__) \
+  || defined(__VMS__)
+/* __size_t is a typedef, must not trash it.  */
 #else
 #define __size_t
 #endif
-- 
2.15.1




Re: [PATCH, alpha] Move linux-specific specfile definitions to linux.h

2017-10-24 Thread coypu
On Fri, Oct 13, 2017 at 11:13:52AM -0600, Jeff Law wrote:
> So we can't depend on patches that OpenBSD applies.  What's important is
> what is in the official GCC sources.
> 
> I'd like to see some discussion about what these macros should look like
> for the *bsd ports.  Merely removing them from elf.h without providing
> something for the *bsd ports seems wrong to me.

Hi Jeff,

OpenBSD has no crt1.o, crtn.o, and crtfastmath.o Linking to those
would fail.  As testimony: they are overriding it locally.

And journalists may say, "OpenBSD has declined to comment on this patch".


Re: Fix inconsistent section flags

2017-08-22 Thread coypu
ping


Re: [PATCH] Use a specfile that actually allows building programs on NetBSD

2017-06-29 Thread coypu
On Thu, Jun 29, 2017 at 05:23:37PM -0600, Jeff Law wrote:
> On 06/29/2017 09:51 AM, coypu wrote:
> > I was thinking of holding a party for the upcoming one year anniversary
> > of pinging this patch, that was committed to NetBSD's copy of GCC about
> > a decade ago. without it, I can't compile simple programs.
> When it was committed to NetBSD isn't at all relevant.  We don't scour
> downstream uses for patches that might be useful and since few, if any,
> of the most active GCC developers use NetBSD we're unlikely to trip over
> the problem ourselves.  That makes us reliant upon others to report bugs
> and sometimes to even provide patches to fix platform specific issues.
> 
> Krister indicated back when you first posted the patch in Jan that he
> was going to fix this and other issues in specs handling, but I don't
> see that Krister ever followed up.
> 
> I wouldn't at all be surprised if this needs further work for pthreads.
> But I'll have to leave investigation there to folks that use NetBSD.
> 
> I've installed your patch on the trunk.

Thank you.

I've spoken with Krister and he is responsive and still interested in
cleaning everything up, but it's good to have things working until then.

I've mentioned it as I'd like to close N many years of not upstreaming
patches :-) sometimes we have good changes, too, but they'll be mostly
netbsd ones.


[PATCH] Use a specfile that actually allows building programs on NetBSD

2017-06-29 Thread coypu
I was thinking of holding a party for the upcoming one year anniversary
of pinging this patch, that was committed to NetBSD's copy of GCC about
a decade ago. without it, I can't compile simple programs.
---
 gcc/config/netbsd.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index 4001f240d..f4ac23a73 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
@@ -109,6 +110,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
-- 
2.13.1



Re: [PATCH, VAX] Correct ffs instruction constraint

2017-06-29 Thread coypu
Ping.

On Tue, Jun 20, 2017 at 08:05:42PM +, co...@sdf.org wrote:
> VAX' FFS as variable-length bit field instruction uses a "base"
> operand of type "vb" meaning "byte address".
> "base" can be 32 bits (SI) and due to the definition of
> ffssi2/__builtin_ffs() with the operand constraint "m", code can be
> emitted which incorrectly implies a mode-dependent (= longword, for
> the 32-bit operand) address.
> File scsipi_base.c compiled with -Os for our VAX install kernel shows:
> 
> ffs $0x0,$0x20,0x50(r11)[r0],r9
> 
> Apparently, 0x50(r11)[r0] as a longword address is assumed to be
> evaluated in longword context by FFS, but the instruction expects a
> byte address.
> 
> Our fix is to change the operand constraint from "m" to "Q", i. e.
> "operand is a MEM that does not have a mode-dependent address", which
> results in:
> 
> moval 0x50(r11)[r0],r1
> ffs $0x0,$0x20,(r1),r9
> 
> MOVAL evaluates the source operand/address in longword context, so
> effectively converts the word address to a byte address for FFS.
> 
> See NetBSD PR port-vax/51761 (http://gnats.netbsd.org/51761) and
> discussion on port-vax mailing list
> (http://mail-index.netbsd.org/port-vax/2017/01/06/msg002954.html).
> 
> Changlog:
> 
> 2017-06-20  Maya Rashish  
> 
>   * gcc/config/vax/builtins.md: Correct ffssi2_internal
>   instruction constraint.
> 
> 
> ---
>  gcc/config/vax/builtins.md | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/config/vax/builtins.md b/gcc/config/vax/builtins.md
> index fb0f69acb..b78fb5616 100644
> --- a/gcc/config/vax/builtins.md
> +++ b/gcc/config/vax/builtins.md
> @@ -41,7 +41,7 @@
>  
>  (define_insn "ffssi2_internal"
>[(set (match_operand:SI 0 "nonimmediate_operand" "=rQ")
> - (ffs:SI (match_operand:SI 1 "general_operand" "nrmT")))
> + (ffs:SI (match_operand:SI 1 "general_operand" "nrQT")))
> (set (cc0) (match_dup 0))]
>""
>"ffs $0,$32,%1,%0")
> -- 
> 2.13.1


[PATCH, VAX] Correct ffs instruction constraint

2017-06-20 Thread coypu
VAX' FFS as variable-length bit field instruction uses a "base"
operand of type "vb" meaning "byte address".
"base" can be 32 bits (SI) and due to the definition of
ffssi2/__builtin_ffs() with the operand constraint "m", code can be
emitted which incorrectly implies a mode-dependent (= longword, for
the 32-bit operand) address.
File scsipi_base.c compiled with -Os for our VAX install kernel shows:

ffs $0x0,$0x20,0x50(r11)[r0],r9

Apparently, 0x50(r11)[r0] as a longword address is assumed to be
evaluated in longword context by FFS, but the instruction expects a
byte address.

Our fix is to change the operand constraint from "m" to "Q", i. e.
"operand is a MEM that does not have a mode-dependent address", which
results in:

moval 0x50(r11)[r0],r1
ffs $0x0,$0x20,(r1),r9

MOVAL evaluates the source operand/address in longword context, so
effectively converts the word address to a byte address for FFS.

See NetBSD PR port-vax/51761 (http://gnats.netbsd.org/51761) and
discussion on port-vax mailing list
(http://mail-index.netbsd.org/port-vax/2017/01/06/msg002954.html).

Changlog:

2017-06-20  Maya Rashish  

* gcc/config/vax/builtins.md: Correct ffssi2_internal
instruction constraint.


---
 gcc/config/vax/builtins.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/vax/builtins.md b/gcc/config/vax/builtins.md
index fb0f69acb..b78fb5616 100644
--- a/gcc/config/vax/builtins.md
+++ b/gcc/config/vax/builtins.md
@@ -41,7 +41,7 @@
 
 (define_insn "ffssi2_internal"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=rQ")
-   (ffs:SI (match_operand:SI 1 "general_operand" "nrmT")))
+   (ffs:SI (match_operand:SI 1 "general_operand" "nrQT")))
(set (cc0) (match_dup 0))]
   ""
   "ffs $0,$32,%1,%0")
-- 
2.13.1



Re: [PATCH 1/1] Remove redundant definition of srcrootpre

2017-06-08 Thread coypu
I paid extra attention to it because it appeared in the last line of a
build failure likely caused by shell tools differences. cd rarely outputs
the new directory for me.


[PATCH 1/1] Remove redundant definition of srcrootpre

2017-06-05 Thread coypu
This script has the only occurrence of it, and in this line
it defines and exports it.

---
 config-ml.in | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config-ml.in b/config-ml.in
index 47f153350..58c80a35c 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -493,7 +493,6 @@ multi-do:
  true; \
else \
  rootpre=`${PWD_COMMAND}`/; export rootpre; \
- srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
  lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
  compiler="$(CC)"; \
  for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
-- 
2.12.2



Re: Use a specfile that actually allows building programs on NetBSD

2017-01-11 Thread coypu
On Wed, Jan 11, 2017 at 04:41:44PM +0100, Krister Walfridsson wrote:
> On Mon, 9 Jan 2017, co...@sdf.org wrote:
> 
> >3 month ping, 1 week ping (trying again), etc...
> 
> Apologies for not getting back to you sooner.
> 
> 
> >Like most operating systems, NetBSD has a libc which contains
> >stuff it needs for most programs to work, and people expect
> >it to be linked without explicitly specifying -lc.
> 
> Well, most programs already get -lc automatically -- it is only when you
> pass -shared that it fails... :-)
> 
> But I'll fix this, together with some other SPEC issues, in a few days.
> 
>/Krister

yay! thanks

netbsd patches stuff a lot more here, but I try not to upstream
stuff I don't understand and did not need. I've done this to get
gcc from pkgsrc working more, and it does for x86, but not for
any other archs yet.


Re: Use a specfile that actually allows building programs on NetBSD

2017-01-09 Thread coypu
3 month ping, 1 week ping (trying again), etc...

This patch has zero affect on non-netbsd users and was already
accepted in NetBSD years ago.

On Wed, Jan 04, 2017 at 11:24:27AM +, coypu wrote:
> Like most operating systems, NetBSD has a libc which contains
> stuff it needs for most programs to work, and people expect
> it to be linked without explicitly specifying -lc.
> 
> This patch is needed for just about any program to work.
> 
> ---
>  gcc/config/netbsd.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
> index f2d6cc6..65ce943 100644
> --- a/gcc/config/netbsd.h
> +++ b/gcc/config/netbsd.h
> @@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.  If not see
> %{!pg:-lposix}}   \
>   %{p:-lposix_p}  \
>   %{pg:-lposix_p}}\
> +   %{shared:-lc} \
> %{!shared:\
>   %{!symbolic:\
> %{!p: \
> @@ -109,6 +110,7 @@ along with GCC; see the file COPYING3.  If not see
> %{!pg:-lposix}}   \
>   %{p:-lposix_p}  \
>   %{pg:-lposix_p}}\
> +   %{shared:-lc} \
> %{!shared:\
>   %{!symbolic:\
> %{!p: \
> -- 
> 2.9.0


Re: Use a specfile that actually allows building programs on NetBSD

2017-01-04 Thread coypu
Identical patch was committed to NetBSD in April 28, 2008.
https://github.com/jsonn/src/commit/7105def538f68e0a0034f5c93ec7fc384ca849b2


Use a specfile that actually allows building programs on NetBSD

2017-01-04 Thread coypu
Like most operating systems, NetBSD has a libc which contains
stuff it needs for most programs to work, and people expect
it to be linked without explicitly specifying -lc.

This patch is needed for just about any program to work.

---
 gcc/config/netbsd.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index f2d6cc6..65ce943 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
@@ -109,6 +110,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
-- 
2.9.0



[PATCH 1/1] [netbsd] when building shared, link against libc

2016-09-10 Thread coypu
---
 gcc/config/netbsd.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index f2d6cc6..65ce943 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -96,6 +96,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
@@ -109,6 +110,7 @@ along with GCC; see the file COPYING3.  If not see
%{!pg:-lposix}} \
  %{p:-lposix_p}\
  %{pg:-lposix_p}}  \
+   %{shared:-lc}   \
%{!shared:  \
  %{!symbolic:  \
%{!p:   \
-- 
2.9.0