Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 May 2017 16:38:10 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318750 - in head/contrib: binutils/bfd binutils/ld binutils/ld/emulparams gcc gcc/config/s390
Message-ID:  <201705231638.v4NGcAq1005935@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue May 23 16:38:10 2017
New Revision: 318750
URL: https://svnweb.freebsd.org/changeset/base/318750

Log:
  Bring some rough support for FreeBSD S/390 to the GNU toolchain.
  
  This is no-op and only for reference: the S/390 port seems to be elusive
  in the BSDs so it is convenient to keep some trace from past efforts.
  It is likely newer attempts will focus on a newer toolchain using clang
  instead.
  
  Obtained from:	Perforce depot/projects/s390

Added:
  head/contrib/binutils/ld/emulparams/elf64_s390_fbsd.sh   (contents, props changed)
  head/contrib/binutils/ld/emulparams/elf_s390_fbsd.sh   (contents, props changed)
  head/contrib/gcc/config/s390/freebsd.h
     - copied, changed from r318546, head/contrib/gcc/config/s390/linux.h
Modified:
  head/contrib/binutils/bfd/config.bfd
  head/contrib/binutils/ld/configure.tgt
  head/contrib/gcc/config.gcc

Modified: head/contrib/binutils/bfd/config.bfd
==============================================================================
--- head/contrib/binutils/bfd/config.bfd	Tue May 23 16:12:50 2017	(r318749)
+++ head/contrib/binutils/bfd/config.bfd	Tue May 23 16:38:10 2017	(r318750)
@@ -1156,13 +1156,13 @@ case "${targ}" in
     targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
     ;;
 
-  s390-*-linux*)
+  s390-*-freebsd* | s390-*-linux*)
     targ_defvec=bfd_elf32_s390_vec
     targ64_selvecs=bfd_elf64_s390_vec
     want64=true
     ;;
 #ifdef BFD64
-  s390x-*-linux*)
+  s390x-*-freebsd* | s390x-*-linux*)
     targ_defvec=bfd_elf64_s390_vec
     targ_selvecs=bfd_elf32_s390_vec
     want64=true

Modified: head/contrib/binutils/ld/configure.tgt
==============================================================================
--- head/contrib/binutils/ld/configure.tgt	Tue May 23 16:12:50 2017	(r318749)
+++ head/contrib/binutils/ld/configure.tgt	Tue May 23 16:38:10 2017	(r318750)
@@ -480,12 +480,21 @@ powerpc-*-lynxos*)	targ_emul=ppclynx ;;
 rs6000-*-aix5*)		targ_emul=aix5rs6 ;;
 rs6000-*-aix*)		targ_emul=aixrs6
 			;;
+s390x-*-freebsd*)         targ_emul=elf64_s390
+			targ_extra_emuls=elf_s390
+			targ_extra_libpath=$targ_extra_emuls
+			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
 s390x-*-linux*)         targ_emul=elf64_s390
 			targ_extra_emuls=elf_s390
 			targ_extra_libpath=$targ_extra_emuls
 			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
 s390x-*-tpf*)		targ_emul=elf64_s390
 			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
+s390-*-freebsd*)          targ_emul=elf_s390
+			targ64_extra_emuls=elf64_s390
+			targ64_extra_libpath=elf64_s390
+			tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
+			;;
 s390-*-linux*)          targ_emul=elf_s390
 			targ64_extra_emuls=elf64_s390
 			targ64_extra_libpath=elf64_s390

Added: head/contrib/binutils/ld/emulparams/elf64_s390_fbsd.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/binutils/ld/emulparams/elf64_s390_fbsd.sh	Tue May 23 16:38:10 2017	(r318750)
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf64_s390.sh
+. ${srcdir}/emulparams/elf_fbsd.sh

Added: head/contrib/binutils/ld/emulparams/elf_s390_fbsd.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/binutils/ld/emulparams/elf_s390_fbsd.sh	Tue May 23 16:38:10 2017	(r318750)
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf_s390.sh
+. ${srcdir}/emulparams/elf_fbsd.sh

Modified: head/contrib/gcc/config.gcc
==============================================================================
--- head/contrib/gcc/config.gcc	Tue May 23 16:12:50 2017	(r318749)
+++ head/contrib/gcc/config.gcc	Tue May 23 16:38:10 2017	(r318750)
@@ -1942,10 +1942,19 @@ rs6000-ibm-aix[56789].* | powerpc-ibm-ai
 	thread_file='aix'
 	extra_headers=
 	;;
+s390-*-freebsd*)
+	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} s390/freebsd.h"
+	;;
 s390-*-linux*)
 	tm_file="s390/s390.h dbxelf.h elfos.h svr4.h linux.h s390/linux.h"
 	tmake_file="${tmake_file} t-dfprules s390/t-crtstuff s390/t-linux"
 	;;
+s390x-*-freebsd*)
+	tm_file="s390/s390.h s390/s390x.h dbxelf.h elfos.h ${fbsd_tm_file} s390/freebsd.h"
+	tm_p_file=s390/s390-protos.h
+	md_file=s390/s390.md
+	out_file=s390/s390.c
+	;;
 s390x-*-linux*)
 	tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h svr4.h linux.h s390/linux.h"
 	tm_p_file=s390/s390-protos.h

Copied and modified: head/contrib/gcc/config/s390/freebsd.h (from r318546, head/contrib/gcc/config/s390/linux.h)
==============================================================================
--- head/contrib/gcc/config/s390/linux.h	Fri May 19 17:14:29 2017	(r318546, copy source)
+++ head/contrib/gcc/config/s390/freebsd.h	Tue May 23 16:38:10 2017	(r318750)
@@ -1,4 +1,4 @@
-/* Definitions for Linux for S/390.
+/* Definitions for FreeBSD for S/390.
    Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Contributed by Hartmut Penner (hpenner@de.ibm.com) and
@@ -21,25 +21,26 @@ along with GCC; see the file COPYING.  I
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
-#ifndef _LINUX_H
-#define _LINUX_H
+#ifndef _CONFIG_S390_FREEBSD_H
+#define _CONFIG_S390_FREEBSD_H
 
 /* Target specific version string.  */
 
 #ifdef DEFAULT_TARGET_64BIT
 #undef  TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (Linux for zSeries)");
+#define TARGET_VERSION fprintf (stderr, " (FreeBSD for zSeries)");
 #else
 #undef  TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (Linux for S/390)");
+#define TARGET_VERSION fprintf (stderr, " (FreeBSD for S/390)");
 #endif
 
 
 /* Target specific type definitions.  */
 
 /* ??? Do we really want long as size_t on 31-bit?  */
+/* Answer is yes for FreeBSD. */
 #undef  SIZE_TYPE
-#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "long unsigned int")
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
 #undef  PTRDIFF_TYPE
 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
 
@@ -48,16 +49,8 @@ Software Foundation, 51 Franklin Street,
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
-
-/* Target specific preprocessor settings.  */
-
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-      LINUX_TARGET_OS_CPP_BUILTINS();		\
-    }						\
-  while (0)
-
+#undef DEFAULT_SIGNED_CHAR
+#define DEFAULT_SIGNED_CHAR 1
 
 /* Target specific assembler settings.  */
 
@@ -92,7 +85,7 @@ Software Foundation, 51 Franklin Street,
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
+#define MD_UNWIND_SUPPORT "config/s390/freebsd-unwind.h"
 
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
@@ -103,4 +96,10 @@ Software Foundation, 51 Franklin Street,
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
 
+/* Override the default comment-starter of "/APP" from unix.h.  */
+#undef  ASM_APP_ON
+#define ASM_APP_ON	"#APP\n"
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF	"#NO_APP\n"
+
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705231638.v4NGcAq1005935>