diff -uNr -uN a/zfp/Makefile b/zfp/Makefile
--- a/zfp/Makefile bc8fcf6826493f674ac1143406d08dc51d761a42a32c36f5ce55fc4a6142c99a990bf88d095b48096a0ae33cc70fdcb73eb82a658cb23b56dbb6b361de9b1755
+++ b/zfp/Makefile 146864894a2eaba25aa29d509fbde97df0b4de0367a8e0adab7ad8b5254977c1f8968058318401055b900e5661cd571b2429476bd4297b7065ddf1941f0eabc8
@@ -6,9 +6,13 @@
obj/start.o:adainclude/start.S
as -c $< -o $@
+
+obj/memcpy.o:platform/linux-${PLATFORM}/memcpy.s
+ as -c $< -o $@
-adalib/libgnat.a:adainclude/*.ads
+adalib/libgnat.a:adainclude/*.ads adainclude/*.adb obj/memcpy.o
gprbuild -Xplatform=$(PLATFORM) -P $(PROJECT_FILE)
+ ar r adalib/libgnat.a obj/memcpy.o
install:adalib/libgnat.a
cp runtime-$(PLATFORM).xml runtime.xml
@@ -17,4 +21,5 @@
clean:
gprclean -Xplatform=$(PLATFORM) -P $(PROJECT_FILE)
-rm -Rf obj/start.o
+ -rm -Rf obj/memcpy.o
-rm -f runtime.xml
diff -uNr -uN a/zfp/adainclude/a-assert.adb b/zfp/adainclude/a-assert.adb
--- a/zfp/adainclude/a-assert.adb false
+++ b/zfp/adainclude/a-assert.adb 06a5fc4c88a75ad15919055c78860f1018007c2a483f67e668ff3976d4c5e3c3f0bd79b56980e22b747510a550b9151843c064c380b3259060a1ae3d13754819
@@ -0,0 +1,59 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . A S S E R T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2007-2015, Free Software Foundation, Inc. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Syscall; use System.Syscall;
+with Ada.Text_IO; use Ada.Text_IO;
+
+package body Ada.Assertions with
+ SPARK_Mode
+is
+ ------------
+ -- Assert --
+ ------------
+
+ procedure Assert (Check : Boolean) is
+ begin
+ if Check = False then
+ Put("Assertion Failed" & ASCII.LF);
+ Sys_Exit(1);
+ end if;
+ end Assert;
+
+ procedure Assert (Check : Boolean; Message : String) is
+ begin
+ if Check = False then
+ Put("Assertion Failed:");
+ Put(Message);
+ Sys_Exit(1);
+ end if;
+ end Assert;
+
+end Ada.Assertions;
diff -uNr -uN a/zfp/adainclude/a-assert.ads b/zfp/adainclude/a-assert.ads
--- a/zfp/adainclude/a-assert.ads false
+++ b/zfp/adainclude/a-assert.ads 75b38463d2e8b5cbaa30ae1e1350a45b67eddd92fefb4aa4342248e693d07c27396613fd714be4f31837e830e58c9c16afde51d04c04eb66c633db71f777cc9a
@@ -0,0 +1,53 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . A S S E R T I O N S --
+-- --
+-- Copyright (C) 2015, Free Software Foundation, Inc. --
+-- --
+-- S p e c --
+-- --
+-- 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 contracts that have been added. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Preconditions in this unit are meant for analysis only, not for run-time
+-- checking, so that the expected exceptions are raised when calling Assert.
+-- This is enforced by setting the corresponding assertion policy to Ignore.
+
+pragma Assertion_Policy (Pre => Ignore);
+
+package Ada.Assertions with
+ SPARK_Mode
+is
+ pragma Pure (Assertions);
+
+ procedure Assert (Check : Boolean) with
+ Pre => Check;
+
+ procedure Assert (Check : Boolean; Message : String) with
+ Pre => Check;
+
+end Ada.Assertions;
diff -uNr -uN a/zfp/adainclude/a-textio.ads b/zfp/adainclude/a-textio.ads
--- a/zfp/adainclude/a-textio.ads e3e315f1cc354abadd811a6c37e3908b2c13baa0e0c4f9756c7d7483803bcb13d1ab23abd9cf4a5b2bbeb9a53fcf3ad36a66450ddcdbb383dc7d2aafdfe0b026
+++ b/zfp/adainclude/a-textio.ads 7623dfc6790f30af573d4ba74b307e458083fad565560b8fc7f19d96b61cfdb32a63b59dad89ec2f5df754920bcb4e73eda73b7e123e5d1dae2c090aa5cbf91a
@@ -13,6 +13,7 @@
------------------------------------------------------------------------------
package Ada.Text_IO is
+ pragma Pure (Text_IO);
procedure Put (Item : Character);
-- Output character to the console
diff -uNr -uN a/zfp/adainclude/s-assert.adb b/zfp/adainclude/s-assert.adb
--- a/zfp/adainclude/s-assert.adb false
+++ b/zfp/adainclude/s-assert.adb beaebe01f590b71f887589de2171b57f2b67b58885edc4a5f4f1fb788749ca8b64d3389311cb5b5b841526cfa5c9f00033a971090ea98a06ca16cfb6b4d7e7f3
@@ -0,0 +1,51 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . A S S E R T I O N S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Syscall; use System.Syscall;
+with Ada.Text_IO; use Ada.Text_IO;
+
+pragma Compiler_Unit_Warning;
+
+
+package body System.Assertions is
+
+ --------------------------
+ -- Raise_Assert_Failure --
+ --------------------------
+
+ procedure Raise_Assert_Failure (Msg : String) is
+ begin
+ Put("Assertion Failed:");
+ Put(Msg);
+ Sys_Exit(1);
+ end Raise_Assert_Failure;
+
+end System.Assertions;
diff -uNr -uN a/zfp/adainclude/s-assert.ads b/zfp/adainclude/s-assert.ads
--- a/zfp/adainclude/s-assert.ads false
+++ b/zfp/adainclude/s-assert.ads e855e360d9e5abd63df14dccf0f295bb60871f29fccc53de89256bc84c9b33eea7ab322d45808a1efded1877ae71b0816850c04141e5714a18ef18261e50c4bc
@@ -0,0 +1,50 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . A S S E R T I O N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides support for assertions (including pragma Assert,
+-- pragma Debug, and Precondition/Postcondition/Predicate/Invariant aspects
+-- and their corresponding pragmas).
+
+-- This unit may be used directly from an application program by providing
+-- an appropriate WITH, and the interface can be expected to remain stable.
+
+pragma Compiler_Unit_Warning;
+
+package System.Assertions is
+
+ Assert_Failure : exception;
+ -- Exception raised when assertion fails
+
+ procedure Raise_Assert_Failure (Msg : String);
+ pragma No_Return (Raise_Assert_Failure);
+ -- Called to raise Assert_Failure with given message
+
+end System.Assertions;
diff -uNr -uN a/zfp/adainclude/s-memcom.adb b/zfp/adainclude/s-memcom.adb
--- a/zfp/adainclude/s-memcom.adb false
+++ b/zfp/adainclude/s-memcom.adb 9f3582d4b5b5eed9e6a4467b3c5afcf60cfb57cf7190596dafc31bcd06f0e4e8eff9629fd458a3a1eba13a1b4cb94722727f1f21a54114ae38652416c044589d
@@ -0,0 +1,66 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . M E M O R Y _ C O M P A R E --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2006-2014, Free Software Foundation, Inc. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Unchecked_Conversion;
+with Interfaces.C; use Interfaces.C;
+
+package body System.Memory_Compare is
+
+ subtype mem is char_array (size_t);
+ type memptr is access mem;
+
+ function to_memptr is new Ada.Unchecked_Conversion (Address, memptr);
+
+ ------------
+ -- memcmp --
+ ------------
+
+ function memcmp (S1 : Address; S2 : Address; N : size_t) return int is
+ s1_p : constant memptr := to_memptr (S1);
+ s2_p : constant memptr := to_memptr (S2);
+
+ begin
+ if N = 0 then
+ return 0;
+ end if;
+
+ for J in 0 .. N - 1 loop
+ if s1_p (J) < s2_p (J) then
+ return -1;
+ elsif s1_p (J) > s2_p (J) then
+ return 1;
+ end if;
+ end loop;
+
+ return 0;
+ end memcmp;
+
+end System.Memory_Compare;
diff -uNr -uN a/zfp/adainclude/s-memcom.ads b/zfp/adainclude/s-memcom.ads
--- a/zfp/adainclude/s-memcom.ads false
+++ b/zfp/adainclude/s-memcom.ads 96c612912cfce00ee27b7b1e3fba6bebc736ff965bc87407d056144c9e1a8dbfcff46855abe42624663a1c71c8227bc7194394d6ccde8f84c188b34543a16671
@@ -0,0 +1,46 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . M E M O R Y _ C O M P A R E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2006-2014, Free Software Foundation, Inc. --
+-- --
+-- 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. --
+-- --
+-- --
+-- --
+-- --
+-- --
+-- 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 --
+-- . --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Interfaces.C;
+
+package System.Memory_Compare is
+ pragma Preelaborate;
+
+ function memcmp
+ (S1 : Address;
+ S2 : Address;
+ N : Interfaces.C.size_t) return Interfaces.C.int;
+ pragma Export (C, memcmp, "memcmp");
+ -- Compares the first n bytes of the memory areas s1 and s2. It returns
+ -- an integer less than, equal to, or greater than zero if s1 is
+ -- found, respectively, to be less than, to match, or be greater than s2.
+
+end System.Memory_Compare;
diff -uNr -uN a/zfp/platform/linux-x86_64-asm/memcpy.s b/zfp/platform/linux-x86_64-asm/memcpy.s
--- a/zfp/platform/linux-x86_64-asm/memcpy.s false
+++ b/zfp/platform/linux-x86_64-asm/memcpy.s 25427e79d8a708552e1e82bcdd1120fc558876f6e3c3d883faf689cf9f9054795109413b9dd46f9e10411a86f6a28a8502faa35e4ffffe44b8464b30f02a1002
@@ -0,0 +1,25 @@
+.global memcpy
+.global __memcpy_fwd
+.hidden __memcpy_fwd
+.type memcpy,@function
+memcpy:
+__memcpy_fwd:
+ mov %rdi,%rax
+ cmp $8,%rdx
+ jc 1f
+ test $7,%edi
+ jz 1f
+2: movsb
+ dec %rdx
+ test $7,%edi
+ jnz 2b
+1: mov %rdx,%rcx
+ shr $3,%rcx
+ rep
+ movsq
+ and $7,%edx
+ jz 1f
+2: movsb
+ dec %edx
+ jnz 2b
+1: ret
diff -uNr -uN a/zfp/platform/linux-x86_64-asm/s-syscal.adb b/zfp/platform/linux-x86_64-asm/s-syscal.adb
--- a/zfp/platform/linux-x86_64-asm/s-syscal.adb 602e857b2c3724b907ca3d6f4b1587d375c7e35f90ac7a23253edaff29187862d6fc2b2c104da14706b16db2f984eb335b4389c40e87407068d853cdbc0e6210
+++ b/zfp/platform/linux-x86_64-asm/s-syscal.adb f22bb241a7187c2ecbcde7463a923942062937432808f8263312f28e67d86082f7fd1715bf0b6f218d32fbc18cb69e34d33e54e937f92dfc6a09d6a9d1f6a6e6
@@ -21,6 +21,7 @@
Int'Asm_Input ("D", fd),
System.Address'Asm_Input ("S", B'Address),
Int'Asm_Input ("d", B'Length)),
+ Clobber => "rcx, r11",
Volatile => True);
if R < 0 and R >= -(2**12) then
E := ErrorCode'Val (-R);
@@ -43,7 +44,8 @@
(Int'Asm_Input ("a", SYSCALL_READ),
Int'Asm_Input ("D", fd),
System.Address'Asm_Input ("S", B'Address),
- Int'Asm_Input ("d", B'Length)));
+ Int'Asm_Input ("d", B'Length)),
+ Clobber => "rcx, r11, memory");
for I in S'Range loop
S (I) := Character'Val (B (I));
end loop;
@@ -67,7 +69,7 @@
ASCII.HT & -- CODE
"syscall",
Inputs => (Int'Asm_Input ("g", Int (C))),
- Clobber => "rax, rdi",
+ Clobber => "rax, rdi, rcx, r11",
Volatile => True);
raise Program_Error;
end Sys_Exit;
diff -uNr -uN a/zfp/platform/linux-x86_64-asm/s-syscal.ads b/zfp/platform/linux-x86_64-asm/s-syscal.ads
--- a/zfp/platform/linux-x86_64-asm/s-syscal.ads e87d5d4ecc1a2a9bed07371e36f4ca73c34e5781cfa4e3c5d159027f7c9468acddfadf8e59e8357a24cf22b1e8ff1148c660c6a09aac40e43614c62137b822b8
+++ b/zfp/platform/linux-x86_64-asm/s-syscal.ads ce54d7b70aef890aba776ec1b8922ac8631bab434d5fe1b48fc88666f8b702cb7495e29802269c44f3c262fa41ef1302fdc8a779355aa0853944b2b1a874b390
@@ -1,4 +1,6 @@
package System.Syscall is
+ pragma Pure (Syscall);
+
-- All interaction with system calls use 4 64bit registers
-- These registers are interpreted as integers or pointers
type Int is range -2**63 .. (2**63 - 1);
diff -uNr -uN a/zfp/runtime-x86_64-asm.xml b/zfp/runtime-x86_64-asm.xml
--- a/zfp/runtime-x86_64-asm.xml 88a32de9b9a0db4bc57e5039c996474ecc4206ed5654bd159401adacd63a381d9472516489dc399b6a0a166972b762b62cbf68ec81ba072b37af6c053cffcc63
+++ b/zfp/runtime-x86_64-asm.xml 25422148edf229800ad68e7b7ac00d4edccb854fd490ce04a790917c3eab4a2772823c56f7f9250f221a7f92eeef0dc3449f3968b465bf272cb448285f3c18b4
@@ -14,7 +14,7 @@
package Binder is
for Required_Switches ("Ada") use Binder'Required_Switches ("Ada") &
- ("-nostdlib") ;
+ ("-nostdlib");
end Binder;