Subject: toolchain/29141: patch to allow the gnu toolchain to compile for netbsd-ia64
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <cherry.g.mathew@gmail.com>
List: netbsd-bugs
Date: 01/28/2005 06:34:00
>Number:         29141
>Category:       toolchain
>Synopsis:       patch to allow the gnu toolchain to compile for netbsd-ia64
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 28 06:34:00 +0000 2005
>Originator:     Cherry George Mathew
>Release:        -current
>Organization:
>Environment:
>Description:
Patch(es) below should let the toolchain build for netbsd-ia64 via:

"build.sh -m ia64 tools"


Index: build.sh
===================================================================
RCS file: /home/cvsroot/netbsd/src/build.sh,v
retrieving revision 1.134
diff -u -r1.134 build.sh
--- build.sh	13 Oct 2004 23:28:34 -0000	1.134
+++ build.sh	13 Jan 2005 10:46:49 -0000
@@ -225,7 +225,7 @@
 	xen)			# no default MACHINE_ARCH
 		;;
 
-	alpha|i386|sparc|sparc64|vax)
+	alpha|i386|sparc|sparc64|vax|ia64)
 		MACHINE_ARCH=${MACHINE}
 		;;
 
@@ -242,7 +242,7 @@
 	#
 	case "${MACHINE_ARCH}" in
 
-	alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64)
+	alpha|arm|armeb|hppa|i386|m68000|m68k|mipse[bl]|ns32k|powerpc|sh[35]e[bl]|sparc|sparc64|vax|x86_64|ia64)
 		;;
 
 	"")



Index: gnu/dist/gcc/gcc/config.gcc
===================================================================
RCS file: /home/cvsroot/netbsd/src/gnu/dist/gcc/gcc/config.gcc,v
retrieving revision 1.8
diff -u -r1.8 config.gcc
--- gnu/dist/gcc/gcc/config.gcc	10 Feb 2004 12:56:21 -0000	1.8
+++ gnu/dist/gcc/gcc/config.gcc	13 Jan 2005 10:47:21 -0000
@@ -1479,6 +1479,12 @@
 	fi
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	;;
+ia64*-*-netbsd*)
+	tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h ia64/sysv4.h ia64/netbsd.h"
+	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
+	tmake_file="${tmake_file} ia64/t-ia64"
+	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
+	;;
 ia64*-*-freebsd*)
 	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"



--------------------------------------------------------------------------------
amnesiac% diff -urN $PWD/ia64.old/ $PWD/ia64
diff -urN /home/cgmathew/anvil/netbsd-current/src/gnu/dist/gcc/gcc/config/ia64.old/netbsd.h /home/cgmathew/anvil/netbsd-current/src/gnu/dist/gcc/gcc/config/ia64/netbsd.h
--- /home/cgmathew/anvil/netbsd-current/src/gnu/dist/gcc/gcc/config/ia64.old/netbsd.h	1970-01-01 00:00:00.000000000 +0000
+++ /home/cgmathew/anvil/netbsd-current/src/gnu/dist/gcc/gcc/config/ia64/netbsd.h	2005-01-13 09:59:24.000000000 +0000
@@ -0,0 +1,58 @@
+/* Definitions of target machine for GNU compiler,
+   for ia64/ELF NetBSD systems.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+      NETBSD_OS_CPP_BUILTINS_ELF();		\
+      NETBSD_OS_CPP_BUILTINS_LP64();		\
+    }						\
+  while (0)
+
+
+/* Extra specs needed for NetBSD/ia-64 ELF.  */
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS			\
+  { "netbsd_cpp_spec", NETBSD_CPP_SPEC },	\
+  { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF },	\
+  { "netbsd_entry_point", NETBSD_ENTRY_POINT },
+
+
+/* Provide a LINK_SPEC appropriate for a NetBSD/x86-64 ELF target.  */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+  "%(netbsd_link_spec)"
+
+#define NETBSD_ENTRY_POINT "_start"
+
+
+/* Provide a CPP_SPEC appropriate for NetBSD.  */
+
+#undef CPP_SPEC
+#define CPP_SPEC "%(netbsd_cpp_spec)"
+
+
+/* Attempt to enable execute permissions on the stack.  */
+#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
+
+#define TARGET_VERSION fprintf (stderr, " (NetBSD/ia64 ELF)");




>How-To-Repeat:

>Fix: