Add sparc64 to the list of supported Ada archs

* Add ncpu detection, this also affects the other archs thus REVISION bump.
* Use SJLJ (setjump/longjump) exceptions because ZCX generates broken
  code on sparc64 (exceptions are thrown, but not caught).
* Disable PCH support, which caused hangs on sparc64, from Pascal
* a-numaux.adb, for those who wonder, contains special sauce for
  i386/amd64 - other architectures get their math functions via -lm,
  thus a-numaux.adb is not needed. Instead of introducing yet another
  PLIST I've chosen to "fake" it and supply an empty body.

Comments? OK?

Index: Makefile
===================================================================
RCS file: /home/vcs/cvs/openbsd/ports/lang/gcc/4.8/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 Makefile
--- Makefile    8 Apr 2013 08:20:19 -0000       1.1.1.1
+++ Makefile    11 Apr 2013 20:46:58 -0000
@@ -12,6 +12,9 @@ ADASTRAP-i386 = adastrap-i386-$V-1.tar.x
 ADASTRAP_LIBC-amd64 = 67.0
 ADASTRAP_LIBM-amd64 = 8.0
 ADASTRAP-amd64 = adastrap-amd64-$V-1.tar.xz
+ADASTRAP_LIBC-sparc64 = 67.0
+ADASTRAP_LIBM-sparc64 = 8.0
+ADASTRAP-sparc64 = adastrap-sparc64-$V-1.tar.xz
 
 PKGNAME-main =  gcc-${FULL_PKGVERSION}
 PKGNAME-c++ =   g++-${FULL_PKGVERSION}
@@ -24,6 +27,8 @@ PKGNAME-ada =   gnat-${FULL_PKGVERSION}
 #PKGNAME-go =  gccgo-${FULL_PKGVERSION}
 PKGSPEC-main = gcc->=4.8,<4.9
 
+REVISION-ada = 0
+
 SHARED_LIBS =  estdc++         16.0 \
                gfortran        5.0 \
                gcj             3.0 \
@@ -41,7 +46,7 @@ SHARED_LIBS = estdc++         16.0 \
 PSEUDO_FLAVORS = no_c++ no_f95 no_objc no_java no_ada no_go full
 FLAVOR ?= 
 
-ONLY_FOR_ARCHS-ada = amd64 i386
+ONLY_FOR_ARCHS-ada = amd64 i386 sparc64
 ONLY_FOR_ARCHS-java = amd64 i386 powerpc sparc64
 
 MULTI_PACKAGES = -main -f95 -objc -c++ -estdc -java -ada
@@ -59,7 +64,8 @@ DISTNAME =    gcc-${FULL_VERSION}
 DISTFILES =    ${DISTNAME}.tar.bz2
 # there's no ecj-4.8.jar
 ECJ =          ecj-4.5.jar
-SUPDISTFILES = ${ADASTRAP-amd64}:0 ${ADASTRAP-i386}:0 ${ECJ}:1
+SUPDISTFILES = ${ADASTRAP-amd64}:0 ${ADASTRAP-i386}:0 ${ECJ}:1 \
+               ${ADASTRAP-sparc64}:0
 EXTRACT_ONLY = ${DISTNAME}.tar.bz2
 
 BUILD_DEPENDS +=       devel/bison \
@@ -136,7 +142,8 @@ CONFIGURE_ARGS += \
        --enable-threads=posix \
        --enable-wchar_t \
        --with-gmp="${LOCALBASE}" \
-       --enable-languages=${LANGS}
+       --enable-languages=${LANGS} \
+       --disable-libstdcxx-pch
 
 # This is needed, as internal cpp is no longer compatible with the
 # visible beast
@@ -241,9 +248,12 @@ post-extract:
 .if ${BUILD_PACKAGES:M-java}
        cp ${FULLDISTDIR}/${ECJ} ${WRKSRC}/ecj.jar
 .endif
+       cp ${FILESDIR}/system-openbsd-sparcv9.ads ${WRKSRC}/gcc/ada/
 
 post-install:
 .if ${BUILD_PACKAGES:M-ada}
+       # add a-numaux.adb to all archs to simplify packaging
+       touch ${PREFIX}/lib/gcc/${CONFIG}/$V/adainclude/a-numaux.adb
        chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adainclude
        chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/lib/gcc/*/$V/adalib
 .endif
Index: distinfo
===================================================================
RCS file: /home/vcs/cvs/openbsd/ports/lang/gcc/4.8/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 distinfo
--- distinfo    8 Apr 2013 08:20:19 -0000       1.1.1.1
+++ distinfo    11 Apr 2013 20:46:58 -0000
@@ -1,8 +1,10 @@
 SHA256 (gcc/adastrap-amd64-4.8.0-1.tar.xz) = 
8zqPYBYcNX913KeXrRlg37VHLuPGnssCCob4Fc51hNg=
 SHA256 (gcc/adastrap-i386-4.8.0-1.tar.xz) = 
HoPDSgf0fCHyyKknoxThnFgxWZ0T3mdSiXBomEEH5m4=
+SHA256 (gcc/adastrap-sparc64-4.8.0-1.tar.xz) = 
g9RJkaXJXtumPRctcUSH83xKXrd8BDLyB2MV6r3EgHs=
 SHA256 (gcc/ecj-4.5.jar) = mP0Sjx03TZ5C/Z1INr3SScbVEevGwN8X+8G535bD14E=
 SHA256 (gcc/gcc-4.8.0.tar.bz2) = sDf+UTK3HsrS6nFB7JIpK10yQnv5D9kM3kMrHVq6zCw=
 SIZE (gcc/adastrap-amd64-4.8.0-1.tar.xz) = 31996808
 SIZE (gcc/adastrap-i386-4.8.0-1.tar.xz) = 30038792
+SIZE (gcc/adastrap-sparc64-4.8.0-1.tar.xz) = 27002840
 SIZE (gcc/ecj-4.5.jar) = 1470676
 SIZE (gcc/gcc-4.8.0.tar.bz2) = 86663646
Index: files/system-openbsd-sparcv9.ads
===================================================================
RCS file: files/system-openbsd-sparcv9.ads
diff -N files/system-openbsd-sparcv9.ads
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/system-openbsd-sparcv9.ads    11 Apr 2013 20:46:58 -0000
@@ -0,0 +1,142 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                        GNAT RUN-TIME COMPONENTS                          --
+--                                                                          --
+--                               S Y S T E M                                --
+--                                                                          --
+--                                 S p e c                                  --
+--                         (OpenBSD/sparc64 Version)                        --
+--                                                                          --
+--          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--                                                                          --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the  contents of the part following the private keyword. --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+package System is
+pragma Pure (System);
+--  Note that we take advantage of the implementation permission to
+--  make this unit Pure instead of Preelaborable, see RM 13.7(36)
+
+   type Name is (SYSTEM_NAME_GNAT);
+   System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+   --  System-Dependent Named Numbers
+
+   Min_Int               : constant := Long_Long_Integer'First;
+   Max_Int               : constant := Long_Long_Integer'Last;
+
+   Max_Binary_Modulus    : constant := 2 ** Long_Long_Integer'Size;
+   Max_Nonbinary_Modulus : constant := Integer'Last;
+
+   Max_Base_Digits       : constant := Long_Long_Float'Digits;
+   Max_Digits            : constant := Long_Long_Float'Digits;
+
+   Max_Mantissa          : constant := 63;
+   Fine_Delta            : constant := 2.0 ** (-Max_Mantissa);
+
+   Tick                  : constant := 0.000_001;
+
+   --  Storage-related Declarations
+
+   type Address is private;
+   Null_Address : constant Address;
+
+   Storage_Unit : constant := 8;
+   Word_Size    : constant := 64;
+   Memory_Size  : constant := 2 ** 64;
+
+   --  Address comparison
+
+   function "<"  (Left, Right : Address) return Boolean;
+   function "<=" (Left, Right : Address) return Boolean;
+   function ">"  (Left, Right : Address) return Boolean;
+   function ">=" (Left, Right : Address) return Boolean;
+   function "="  (Left, Right : Address) return Boolean;
+
+   pragma Import (Intrinsic, "<");
+   pragma Import (Intrinsic, "<=");
+   pragma Import (Intrinsic, ">");
+   pragma Import (Intrinsic, ">=");
+   pragma Import (Intrinsic, "=");
+
+   --  Other System-Dependent Declarations
+
+   type Bit_Order is (High_Order_First, Low_Order_First);
+   Default_Bit_Order : constant Bit_Order := High_Order_First;
+   pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+   --  Priority-related Declarations (RM D.1)
+
+   Max_Priority           : constant Positive := 30;
+   Max_Interrupt_Priority : constant Positive := 31;
+
+   subtype Any_Priority       is Integer      range  0 .. 31;
+   subtype Priority           is Any_Priority range  0 .. 30;
+   subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+   Default_Priority : constant Priority := 15;
+
+private
+
+   type Address is mod Memory_Size;
+   Null_Address : constant Address := 0;
+
+   --------------------------------------
+   -- System Implementation Parameters --
+   --------------------------------------
+
+   --  These parameters provide information about the target that is used
+   --  by the compiler. They are in the private part of System, where they
+   --  can be accessed using the special circuitry in the Targparm unit
+   --  whose source should be consulted for more detailed descriptions
+   --  of the individual switch values.
+
+   Backend_Divide_Checks     : constant Boolean := False;
+   Backend_Overflow_Checks   : constant Boolean := False;
+   Command_Line_Args         : constant Boolean := True;
+   Configurable_Run_Time     : constant Boolean := False;
+   Denorm                    : constant Boolean := True;
+   Duration_32_Bits          : constant Boolean := False;
+   Exit_Status_Supported     : constant Boolean := True;
+   Fractional_Fixed_Ops      : constant Boolean := False;
+   Frontend_Layout           : constant Boolean := False;
+   Machine_Overflows         : constant Boolean := False;
+   Machine_Rounds            : constant Boolean := True;
+   Preallocated_Stacks       : constant Boolean := False;
+   Signed_Zeros              : constant Boolean := True;
+   Stack_Check_Default       : constant Boolean := False;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
+   Support_64_Bit_Divides    : constant Boolean := True;
+   Support_Aggregates        : constant Boolean := True;
+   Support_Composite_Assign  : constant Boolean := True;
+   Support_Composite_Compare : constant Boolean := True;
+   Support_Long_Shifts       : constant Boolean := True;
+   Always_Compatible_Rep     : constant Boolean := True;
+   Suppress_Standard_Library : constant Boolean := False;
+   Use_Ada_Main_Program_Name : constant Boolean := False;
+   ZCX_By_Default            : constant Boolean := False;
+
+end System;
Index: patches/patch-gcc_ada_adaint_c
===================================================================
RCS file: 
/home/vcs/cvs/openbsd/ports/lang/gcc/4.8/patches/patch-gcc_ada_adaint_c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-gcc_ada_adaint_c
--- patches/patch-gcc_ada_adaint_c      8 Apr 2013 08:20:24 -0000       1.1.1.1
+++ patches/patch-gcc_ada_adaint_c      11 Apr 2013 20:46:58 -0000
@@ -1,7 +1,17 @@
 $OpenBSD: patch-gcc_ada_adaint_c,v 1.1.1.1 2013/04/08 08:20:24 pascal Exp $
---- gcc/ada/adaint.c.orig      Thu Jan  3 11:09:24 2013
-+++ gcc/ada/adaint.c   Sat Jan 12 13:27:07 2013
-@@ -3855,3 +3855,9 @@ void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_U
+--- gcc/ada/adaint.c.orig      Wed Feb  6 13:01:20 2013
++++ gcc/ada/adaint.c   Wed Apr 10 01:42:27 2013
+@@ -2467,7 +2467,8 @@ __gnat_number_of_cpus (void)
+ {
+   int cores = 1;
+ 
+-#if defined (linux) || defined (sun) || defined (AIX) || defined (__APPLE__)
++#if defined (linux) || defined (sun) || defined (AIX) || defined (__APPLE__) 
||\
++  defined (__OpenBSD__)
+   cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
+ 
+ #elif defined (__hpux__)
+@@ -3855,3 +3856,9 @@ void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_U
  #ifdef __cplusplus
  }
  #endif
Index: patches/patch-gcc_ada_gcc-interface_Makefile_in
===================================================================
RCS file: 
/home/vcs/cvs/openbsd/ports/lang/gcc/4.8/patches/patch-gcc_ada_gcc-interface_Makefile_in,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 patch-gcc_ada_gcc-interface_Makefile_in
--- patches/patch-gcc_ada_gcc-interface_Makefile_in     8 Apr 2013 08:20:24 
-0000       1.1.1.1
+++ patches/patch-gcc_ada_gcc-interface_Makefile_in     11 Apr 2013 20:46:58 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-gcc_ada_gcc-interface_Makefile_in,v 1.1.1.1 2013/04/08 
08:20:24 pascal Exp $
 --- gcc/ada/gcc-interface/Makefile.in.orig     Wed Feb  6 12:19:08 2013
-+++ gcc/ada/gcc-interface/Makefile.in  Sun Apr  7 17:02:16 2013
-@@ -1333,6 +1333,58 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(o
++++ gcc/ada/gcc-interface/Makefile.in  Thu Apr 11 02:03:24 2013
+@@ -1333,6 +1333,85 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(o
    MISCLIB = -lutil
  endif
  
@@ -51,6 +51,33 @@ $OpenBSD: patch-gcc_ada_gcc-interface_Ma
 +  GNATLIB_SHARED = gnatlib-shared-dual
 +
 +  EH_MECHANISM=-gcc
++  THREADSLIB= -lpthread
++  GMEM_LIB = gmemlib
++  LIBRARY_VERSION := $(LIB_VERSION)
++  MISCLIB = -lutil
++endif
++
++ifeq ($(strip $(filter-out sparc64 openbsd%,$(arch) $(osys))),)
++  LIBGNAT_TARGET_PAIRS = \
++  a-intnam.ads<a-intnam-freebsd.ads \
++  s-inmaop.adb<s-inmaop-posix.adb \
++  s-intman.adb<s-intman-posix.adb \
++  s-osinte.ads<s-osinte-freebsd.ads \
++  s-osinte.adb<s-osinte-freebsd.adb \
++  s-osprim.adb<s-osprim-posix.adb \
++  s-taprop.adb<s-taprop-posix.adb \
++  s-taspri.ads<s-taspri-posix.ads \
++  s-tpopsp.adb<s-tpopsp-posix.adb \
++  $(ATOMICS_TARGET_PAIRS) \
++  $(ATOMICS_BUILTINS_TARGET_PAIRS) \
++  system.ads<system-openbsd-sparcv9.ads
++
++  TOOLS_TARGET_PAIRS = \
++  mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
++  GNATLIB_SHARED = gnatlib-shared-dual
++
++  # Empty when not using ZCX
++  EH_MECHANISM=
 +  THREADSLIB= -lpthread
 +  GMEM_LIB = gmemlib
 +  LIBRARY_VERSION := $(LIB_VERSION)

Reply via email to