Add Ada support for sparc64.

Use SJLJ exceptions instead of ZCX because gcc produces broken code
for the later. Enable ncpu detection in the runtime for all archs.

ok pascal@
This commit is contained in:
tobiasu 2013-04-12 10:01:47 +00:00
parent 549396691b
commit 8575a638bc
7 changed files with 207 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.1.1.1 2013/04/08 08:20:19 pascal Exp $
# $OpenBSD: Makefile,v 1.2 2013/04/12 10:01:47 tobiasu Exp $
ONLY_FOR_ARCHS = amd64 i386 powerpc sparc64
@ -12,6 +12,9 @@ ADASTRAP-i386 = adastrap-i386-$V-1.tar.xz
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-0.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

View File

@ -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-0.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-0.tar.xz) = 27002840
SIZE (gcc/ecj-4.5.jar) = 1470676
SIZE (gcc/gcc-4.8.0.tar.bz2) = 86663646

View File

@ -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
$OpenBSD: patch-gcc_ada_adaint_c,v 1.2 2013/04/12 10:01:47 tobiasu Exp $
--- 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

View File

@ -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 $
$OpenBSD: patch-gcc_ada_gcc-interface_Makefile_in,v 1.2 2013/04/12 10:01:47 tobiasu 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
@ -56,6 +56,33 @@ $OpenBSD: patch-gcc_ada_gcc-interface_Makefile_in,v 1.1.1.1 2013/04/08 08:20:24
+ 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)
+ MISCLIB = -lutil
+endif
+
# S390 Linux
ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)

View File

@ -0,0 +1,146 @@
$OpenBSD: patch-gcc_ada_system-openbsd-sparcv9_ads,v 1.1 2013/04/12 10:01:47 tobiasu Exp $
--- gcc/ada/system-openbsd-sparcv9.ads.orig Thu Apr 11 23:58:35 2013
+++ gcc/ada/system-openbsd-sparcv9.ads Thu Apr 11 23:58:35 2013
@@ -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;

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.I386-ada,v 1.1 2013/04/12 10:01:47 tobiasu Exp $
lib/gcc/${CONFIG}/${V}/adainclude/a-numaux.adb

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-ada,v 1.1.1.1 2013/04/08 08:20:20 pascal Exp $
@comment $OpenBSD: PLIST-ada,v 1.2 2013/04/12 10:01:47 tobiasu Exp $
@bin bin/egnat
@bin bin/egnatbind
@bin bin/egnatchop
@ -246,7 +246,6 @@ lib/gcc/${CONFIG}/${V}/adainclude/a-nudira.ads
lib/gcc/${CONFIG}/${V}/adainclude/a-nuelfu.ads
lib/gcc/${CONFIG}/${V}/adainclude/a-nuflra.adb
lib/gcc/${CONFIG}/${V}/adainclude/a-nuflra.ads
lib/gcc/${CONFIG}/${V}/adainclude/a-numaux.adb
lib/gcc/${CONFIG}/${V}/adainclude/a-numaux.ads
lib/gcc/${CONFIG}/${V}/adainclude/a-numeri.ads
lib/gcc/${CONFIG}/${V}/adainclude/a-nurear.ads
@ -1940,4 +1939,5 @@ lib/gcc/${CONFIG}/${V}/adalib/system.ali
lib/gcc/${CONFIG}/${V}/adalib/text_io.ali
lib/gcc/${CONFIG}/${V}/adalib/unchconv.ali
lib/gcc/${CONFIG}/${V}/adalib/unchdeal.ali
%%I386%%
@bin libexec/gcc/${CONFIG}/${V}/gnat1