diff mbox series

[alpha] PR target/85095

Message ID 20180524135451.GA3587@SDF.ORG
State New
Headers show
Series [alpha] PR target/85095 | expand

Commit Message

Maya Rashish May 24, 2018, 1:54 p.m. UTC
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(-)

Comments

Jeff Law May 24, 2018, 6:48 p.m. UTC | #1
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
Maya Rashish May 24, 2018, 7:17 p.m. UTC | #2
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?
Jeff Law May 24, 2018, 7:32 p.m. UTC | #3
On 05/24/2018 01:17 PM, coypu@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
Maya Rashish May 24, 2018, 10:34 p.m. UTC | #4
On Thu, May 24, 2018 at 01:32:17PM -0600, Jeff Law wrote:
> On 05/24/2018 01:17 PM, coypu@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 <coypu@sdf.org>
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
Gerald Pfeifer May 31, 2018, 6:56 p.m. UTC | #5
On Thu, 24 May 2018, Jeff Law wrote:
> > 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.

Ab-so-lutely.  In fact, just yank it out, without any deprecation.

   % grep sparc $PORTSDIR/lang/gcc*/Makefile | grep -i alpha | wc -l
       0

None of the GCC ports in the FreeBSD Ports Collection (the oldest of 
which is gcc47 right now) has had any trace of alpha support left for 
years and years, and there have been zero requests/complaints.

Gerald
Jeff Law June 12, 2018, 9:59 p.m. UTC | #6
On 05/31/2018 12:56 PM, Gerald Pfeifer wrote:
> On Thu, 24 May 2018, Jeff Law wrote:
>>> 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.
> 
> Ab-so-lutely.  In fact, just yank it out, without any deprecation.
> 
>    % grep sparc $PORTSDIR/lang/gcc*/Makefile | grep -i alpha | wc -l
>        0
> 
> None of the GCC ports in the FreeBSD Ports Collection (the oldest of 
> which is gcc47 right now) has had any trace of alpha support left for 
> years and years, and there have been zero requests/complaints.
> 
> Gerald
> 
Done.

Jeff
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 6c184f766b7..f3f7928859e 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-12  Jeff Law  <law@redhat.com>
+
+	* config-list.mk (LIST): Remove alpha-freebsd6.
+
 2018-05-08  Richard Biener  <rguenther@suse.de>
 
 	PR bootstrap/85571
diff --git a/contrib/config-list.mk b/contrib/config-list.mk
index fee08b02a2b..d04aca237f5 100644
--- a/contrib/config-list.mk
+++ b/contrib/config-list.mk
@@ -31,7 +31,7 @@ GCC_SRC_DIR=../../gcc
 
 # v850e1-elf is rejected by config.sub
 LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \
-  alpha-linux-gnu alpha-freebsd6 alpha-netbsd alpha-openbsd \
+  alpha-linux-gnu alpha-netbsd alpha-openbsd \
   alpha64-dec-vms alpha-dec-vms \
   arc-elf32OPT-with-cpu=arc600 arc-elf32OPT-with-cpu=arc700 \
   arc-linux-uclibcOPT-with-cpu=arc700 arceb-linux-uclibcOPT-with-cpu=arc700 \
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1bba11ccd67..20d862c91f4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-12  Jeff Law  <law@redhat.com>
+
+	* config.gcc (alpha*-*-freebsd*): Remove.
+	* config/alpha/freebsd.h: Remove.
+
 2018-06-12  David Malcolm  <dmalcolm@redhat.com>
 
 	PR other/69968
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8b2fd908c38..2f17eb0d5fa 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1026,11 +1026,6 @@ alpha*-*-linux*)
 	tmake_file="${tmake_file} alpha/t-linux alpha/t-alpha"
 	extra_options="${extra_options} alpha/elf.opt"
 	;;
-alpha*-*-freebsd*)
-	tm_file="elfos.h ${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
-	tmake_file="${tmake_file} alpha/t-alpha"
-	extra_options="${extra_options} alpha/elf.opt"
-	;;
 alpha*-*-netbsd*)
 	tm_file="elfos.h ${tm_file} ${nbsd_tm_file} alpha/elf.h alpha/netbsd.h"
 	tmake_file="${tmake_file} alpha/t-alpha"
diff --git a/gcc/config/alpha/freebsd.h b/gcc/config/alpha/freebsd.h
deleted file mode 100644
index 22362226627..00000000000
--- a/gcc/config/alpha/freebsd.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Definitions for DEC Alpha/AXP running FreeBSD using the ELF format
-   Copyright (C) 2000-2018 Free Software Foundation, Inc.
-   Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
-
-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
-<http://www.gnu.org/licenses/>.  */
-
-
-#undef  EXTRA_SPECS
-#define EXTRA_SPECS \
-  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
-
-/* Provide a CPP_SPEC appropriate for FreeBSD/alpha -- dealing with
-   the GCC option `-posix'.  */
-
-#undef  CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-
-#define LINK_SPEC "%{G*} %{relax:-relax}				\
-  %{p:%nconsider using '-pg' instead of '-p' with gprof(1)}		\
-  %{assert*} %{R*} %{rpath*} %{defsym*}					\
-  %{shared:-Bshareable %{h*} %{soname*}}				\
-  %{!shared:								\
-    %{!static:								\
-      %{rdynamic:-export-dynamic}					\
-      -dynamic-linker %(fbsd_dynamic_linker) }	\
-    %{static:-Bstatic}}							\
-  %{symbolic:-Bsymbolic}"
-
-
-/************************[  Target stuff  ]***********************************/
-
-/* Define the actual types of some ANSI-mandated types.  
-   Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
-   c-common.c, and config/<arch>/<arch>.h.  */
-
-/* alpha.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
-#undef WCHAR_TYPE
-
-#undef  WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE	32
-
-#define TARGET_ELF	1
-
-#undef HAS_INIT_SECTION
-
-/* Show that we need a GP when profiling.  */
-#undef  TARGET_PROFILING_NEEDS_GP
-#define TARGET_PROFILING_NEEDS_GP 1
-
-/* Don't default to pcc-struct-return, we want to retain compatibility with
-   older FreeBSD releases AND pcc-struct-return may not be reentrant.  */
-
-#undef  DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
Maya Rashish June 17, 2018, 9:17 p.m. UTC | #7
Ping.
Anything else to do for this?

Thanks.
Jeff Law June 18, 2018, 5:29 p.m. UTC | #8
On 05/24/2018 04:34 PM, coypu@sdf.org wrote:
> On Thu, May 24, 2018 at 01:32:17PM -0600, Jeff Law wrote:
>> On 05/24/2018 01:17 PM, coypu@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.
> 
Thanks.  I've created a ChangeLog and applied your first patch as well
as this one.

Jeff
diff mbox series

Patch

diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index db766616156..2a767f193f2 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -100,32 +100,6 @@  do {									\
     ASM_OUTPUT_DEF (FILE, alias, name);				\
   } while (0)
 
-/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
-   (even more) magical crtbegin.o file which provides part of the
-   support for getting C++ file-scope static object constructed
-   before entering `main'.  */
-
-#undef	STARTFILE_SPEC
-#ifdef HAVE_LD_PIE
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
-
-/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
-   magical crtend.o file which provides part of the support for
-   getting C++ file-scope static object constructed before entering
-   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
-
-#undef	ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
 /* This variable should be set to 'true' if the target ABI requires
    unwinding tables even when exceptions are not used.  */
 #define TARGET_UNWIND_TABLES_DEFAULT true
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index 9ef320668c7..2bf52fe78ae 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -78,6 +78,32 @@  along with GCC; see the file COPYING3.  If not see
 
 #define TARGET_POSIX_IO
 
+/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
+   (even more) magical crtbegin.o file which provides part of the
+   support for getting C++ file-scope static object constructed
+   before entering `main'.  */
+
+#undef	STARTFILE_SPEC
+#ifdef HAVE_LD_PIE
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#else
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#endif
+
+/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
+   magical crtend.o file which provides part of the support for
+   getting C++ file-scope static object constructed before entering
+   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
+
+#undef	ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static|static-pie:--start-group} %G %L \
    %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"