Subject: gcc-2.5.8 for NetBSD/sparc
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: A.M. Raportirenko <ram@sunct1.jinr.dubna.su>
List: current-users
Date: 06/06/1994 20:42:10
Hi!
I used following patches long time to complie gcc-2.5.8 on NetBSD/sparc.
It is very simple to compile it with next script. I use GNU make for this,
wich are compiled on NetBSD without problem.
(Of corse you must include patches for sh bugs, mensioned by Andrew)
#! /bin/sh
#
echo ../gcc-2.5.8/configure --target=sparc-sun-netbsd --srcdir=../gcc-2.5.8
../gcc-2.5.8/configure --target=sparc-sun-netbsd --srcdir=../gcc-2.5.8
echo make LANGUAGES=c CFLAGS=
make LANGUAGES=c CFLAGS=
echo make stage1
make stage1
echo make CC="stage1/xgcc -Bstage1/" CFLAGS=" -O" LANGUAGES=c
make CC="stage1/xgcc -Bstage1/" CFLAGS=" -O" LANGUAGES=c
echo make stage2
make stage2
echo rm -rf stage1
rm -rf stage1
echo make CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
make CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
echo make compare
make compare
echo make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
echo make install CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
make install CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
echo make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS=" -O"
ram
diff -rc2N gcc-2.5.8.gnu/config/sparc/netbsd.h gcc-2.5.8.net/config/sparc/netbsd.h
*** gcc-2.5.8.gnu/config/sparc/netbsd.h Thu Jan 1 03:00:00 1970
--- gcc-2.5.8.net/config/sparc/netbsd.h Sun Mar 20 14:25:45 1994
***************
*** 0 ****
--- 1,102 ----
+ /* Configuration for NetBSD Sparc */
+ /* $Id: tm.h,v 1.6 1994/02/10 20:36:31 pk Exp $ */
+
+ #include "sparc/sparc.h"
+
+ #undef LIB_SPEC
+ #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+
+ #undef CPP_PREDEFINES
+ #define CPP_PREDEFINES "-Dsparc -D__NetBSD__ -Dunix -D__GCC_NEW_VARARGS__"
+ /* Provide required defaults for linker -e and -d switches. */
+
+ #define LINK_SPEC \
+ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
+
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+
+ #define HAVE_ATEXIT
+
+ /*
+ * Some imports from svr4.h in support of shared libraries.
+ */
+
+ /* 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. */
+
+ #define TYPE_ASM_OP ".type"
+ #define SIZE_ASM_OP ".size"
+ #define WEAK_ASM_OP ".weak"
+
+ /* The following macro defines the format used to output the second
+ operand of the .type assembler directive. Different svr4 assemblers
+ expect various different forms for this operand. The one given here
+ is just a default. You may need to override it in your machine-
+ specific tm.h file (depending upon the particulars of your assembler). */
+
+ #define TYPE_OPERAND_FMT "@%s"
+
+ /* These macros generate the special .type and .size directives which
+ are used to set the corresponding fields of the linker symbol table
+ entries in an ELF object file under SVR4. These macros also output
+ the starting labels for the relevant functions/objects. */
+
+ /* Write the extra assembler code needed to declare a function properly.
+ Some svr4 assemblers need to also have something extra said about the
+ function's return value. We allow for that here. */
+
+ #undef ASM_DECLARE_FUNCTION_NAME
+ #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
+ putc ('\n', FILE); \
+ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+ /* Write the extra assembler code needed to declare an object properly. */
+
+ #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do { \
+ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ putc (',', FILE); \
+ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
+ putc ('\n', FILE); \
+ if (!flag_inhibit_size_directive) \
+ { \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (decl))); \
+ } \
+ ASM_OUTPUT_LABEL(FILE, NAME); \
+ } while (0)
+
+ /* This is how to declare the size of a function. */
+
+ #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
+ do { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ char label[256]; \
+ static int labelno; \
+ labelno++; \
+ ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
+ ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, (FNAME)); \
+ fprintf (FILE, ","); \
+ assemble_name (FILE, label); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, (FNAME)); \
+ putc ('\n', FILE); \
+ } \
+ } while (0)
+
diff -rc2N gcc-2.5.8.gnu/configure gcc-2.5.8.net/configure
*** gcc-2.5.8.gnu/configure Sun Apr 24 18:01:14 1994
--- gcc-2.5.8.net/configure Sun Mar 20 14:51:13 1994
***************
*** 610,613 ****
--- 610,616 ----
use_collect2=yes
;;
+ sparc-*-netbsd*)
+ tm_file=sparc/netbsd.h
+ ;;
sparc-*-bsd*)
tm_file=sparc/bsd.h
diff -rc2N gcc-2.5.8.gnu/gstdarg.h gcc-2.5.8.net/gstdarg.h
*** gcc-2.5.8.gnu/gstdarg.h Sun Apr 24 18:02:20 1994
--- gcc-2.5.8.net/gstdarg.h Sun Apr 24 18:15:30 1994
***************
*** 137,141 ****
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
--- 137,141 ----
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (__NetBSD__) || defined (__bsdi__)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
***************
*** 143,147 ****
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__))
#define _VA_LIST_
#endif
--- 143,147 ----
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
! #if !(defined (__BSD_NET2__) || defined (__NetBSD__) || defined (__bsdi__))
#define _VA_LIST_
#endif
diff -rc2N gcc-2.5.8.gnu/gstddef.h gcc-2.5.8.net/gstddef.h
*** gcc-2.5.8.gnu/gstddef.h Sun Apr 24 18:02:20 1994
--- gcc-2.5.8.net/gstddef.h Sun Mar 20 21:41:52 1994
***************
*** 23,27 ****
/* On 4.3bsd-net2, make sure ansi.h is included, so we have
one less case to deal with in the following. */
! #if defined (__BSD_NET2__) || defined (____386BSD____)
#include <machine/ansi.h>
#endif
--- 23,27 ----
/* On 4.3bsd-net2, make sure ansi.h is included, so we have
one less case to deal with in the following. */
! #if defined (__BSD_NET2__) || defined (__NetBSD__) || defined (____386BSD____)
#include <machine/ansi.h>
#endif
diff -rc2N gcc-2.5.8.gnu/gvarargs.h gcc-2.5.8.net/gvarargs.h
*** gcc-2.5.8.gnu/gvarargs.h Sun Apr 24 18:02:20 1994
--- gcc-2.5.8.net/gvarargs.h Sun Apr 24 18:18:47 1994
***************
*** 151,155 ****
Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
use for va_list (``typedef _VA_LIST_ va_list'') */
! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
--- 151,155 ----
Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
use for va_list (``typedef _VA_LIST_ va_list'') */
! #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (__NetBSD__) || defined (__bsdi__) || defined (__sequent__)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
***************
*** 157,161 ****
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
! #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__))
#define _VA_LIST_
#endif
--- 157,161 ----
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
! #if !(defined (__BSD_NET2__) || defined (__NetBSD__) || defined (__bsdi__) || defined (__sequent__))
#define _VA_LIST_
#endif
------------------------------------------------------------------------------