diff -uNr a/zfp/Makefile b/zfp/Makefile
--- a/zfp/Makefile false
+++ b/zfp/Makefile 84fa5516bb938ec76b4f99ed2e1bd1beb122abd3796a20175df7b120638601950214f5fbddeb654ad4636c4ea8e7554b4191621d97680e4e97f17ac0c3cd75da
@@ -0,0 +1,13 @@
+PROJECT_FILE=gnat_runtime.gpr
+
+all: adalib/libgnat.a adalib/start.o
+
+adalib/start.o:adainclude/start.S
+ as -c $< -o $@
+
+adalib/libgnat.a:adainclude/*.ads
+ gnatmake -P $(PROJECT_FILE)
+
+clean:
+ gprclean -P $(PROJECT_FILE)
+ -rm -Rf adalib/start.o
diff -uNr a/zfp/adainclude/a-textio.adb b/zfp/adainclude/a-textio.adb
--- a/zfp/adainclude/a-textio.adb 64ade4f4343cead30b2019d7bbcffc66b461de9abdef5aa744f674b2da2c433d54a5678c11ef2d48522727c57ac407119109972b0c6afbf915a748b2b9d9e23c
+++ b/zfp/adainclude/a-textio.adb e493b72dc9f010949aeafc3c54c7a420fa7c26289a0e276ae819cf04111040a11603232f51e79cfd5fd389f7d0be17dc528718c2014d8152b69f234d1ec7c9a4
@@ -13,8 +13,12 @@
------------------------------------------------------------------------------
-- Version for use with C run time
+with System.Syscall; use System.Syscall;
package body Ada.Text_IO is
+ -- STDIN : constant := 0;
+ STDOUT : constant := 1;
+ -- STDERR : constant := 2;
--------------
-- New_Line --
@@ -30,20 +34,16 @@
---------
procedure Put (Item : Character) is
- function Putchar (C : Integer) return Integer;
- pragma Import (C, Putchar);
-
- Ignore : Integer;
-
begin
- Ignore := Putchar (Character'Pos (Item));
+ Put ("" & Item);
end Put;
procedure Put (Item : String) is
+ Ignore : Int;
+ E : ErrorCode;
begin
- for J in Item'Range loop
- Put (Item (J));
- end loop;
+ Ignore := Write (STDOUT, Item, E);
+ pragma Unused (E);
end Put;
--------------
diff -uNr a/zfp/adainclude/last_chance_handler.adb b/zfp/adainclude/last_chance_handler.adb
--- a/zfp/adainclude/last_chance_handler.adb c8e02554aee5416547abb98155180f184aa11184825a76e1d119d291accba55e33565dc3868bf42198c880a0cca3cf6b8b329ad9703eb01c0781d5049ac06a44
+++ b/zfp/adainclude/last_chance_handler.adb ec06f5d03656946c1d7f682fa5192ef8bd3c8d460e5bd8b9f0dc1de36b6aa549f1b8fe1e0525d3a660c8a8ab1928aa05868359ec4b838d2d951c5ff672b2d93e
@@ -12,34 +12,27 @@
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-with Ada.Text_IO; use Ada.Text_IO;
-with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
+with Ada.Text_IO; use Ada.Text_IO;
+with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with System.Storage_Elements; use System.Storage_Elements;
+with System.Syscall; use System.Syscall;
-procedure Last_Chance_Handler
- (Msg : System.Address; Line : Integer)
-is
- procedure Exit_Now(status: Integer);
- pragma Import
- (Convention => C,
- Entity => Exit_Now,
- External_Name => "exit");
-
- function Peek (Addr : System.Address) return Character
- is
- C : Character with Address => Addr;
+procedure Last_Chance_Handler (Msg : System.Address; Line : Integer) is
+ function Peek (Addr : System.Address) return Character is
+ C : Character with
+ Address => Addr;
begin
return C;
- end Peek;
+ end Peek;
A : System.Address := Msg;
begin
Put ("GNAT Exception!:");
- Put (Line);
+ Put (Line);
Put (":");
- while Peek(A) /= ASCII.NUL loop
- Put (Peek(A));
+ while Peek (A) /= ASCII.NUL loop
+ Put (Peek (A));
A := A + 1;
end loop;
New_Line;
- Exit_Now(-1);
+ Sys_Exit (1);
end Last_Chance_Handler;
diff -uNr a/zfp/adainclude/last_chance_handler.ads b/zfp/adainclude/last_chance_handler.ads
--- a/zfp/adainclude/last_chance_handler.ads 3d95822d87e16f7a8b8997642e35b7bc8b1f4a2b7cf82c39f27b507d62bd243ff50f9c24d6ce01873254b76a6ad93a26258b96fb1be471e13eb9a7e5322a31af
+++ b/zfp/adainclude/last_chance_handler.ads 76bd3960d6abd0d5209d5e4d6ed9e58aa1b2487d7357b182472bac542ae7b1152ed0d79c17c7bd5d5feb26c8944781bdfa9e97a517b427cacf164d258f0cb0f8
@@ -14,6 +14,5 @@
with System;
-procedure Last_Chance_Handler
- (Msg : System.Address; Line : Integer);
+procedure Last_Chance_Handler (Msg : System.Address; Line : Integer);
pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler");
diff -uNr a/zfp/adainclude/s-elaall.adb b/zfp/adainclude/s-elaall.adb
--- a/zfp/adainclude/s-elaall.adb d72aa05a37c27031cd0e6e91f2f2d7070ef55916103b1168348bef7d7227a975c2c981d549317a691bb9e42eae9435204c83efbef3dae547963028a7ce43cb0a
+++ b/zfp/adainclude/s-elaall.adb 144e69764a0a6e1f9a65a47a8f26f5f155fba6b1ffc26472aaec58c384a3ed99d54b38c6a45b15cef602d8a7317759fc8d7d2cc9cbcc73eb689c30f2a673df90
@@ -28,9 +28,9 @@
procedure Check_Standard_Allocator is
begin
if not Elaboration_In_Progress then
- raise Program_Error with
- "standard allocator after elaboration is complete is not allowed "
- & "(No_Standard_Allocators_After_Elaboration restriction active)";
+ raise Program_Error;-- with
+ --"standard allocator after elaboration is complete is not allowed "
+ --& "(No_Standard_Allocators_After_Elaboration restriction active)";
end if;
end Check_Standard_Allocator;
diff -uNr a/zfp/adainclude/s-maccod.ads b/zfp/adainclude/s-maccod.ads
--- a/zfp/adainclude/s-maccod.ads false
+++ b/zfp/adainclude/s-maccod.ads dea9bcf384ca77e19151cf62555b654683c5726627e1d988409309a0c995a7057ce449f9d987cd225119a4ed635b9142d6b5a2f69a296fc9e3a47c52b6ec315b
@@ -0,0 +1,130 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . M A C H I N E _ C O D E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2011, 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 machine code support, both for intrinsic machine
+-- operations, and also for machine code statements. See GNAT documentation
+-- for full details.
+
+package System.Machine_Code is
+ pragma Pure;
+
+ -- All identifiers in this unit are implementation defined
+
+ pragma Implementation_Defined;
+
+ type Asm_Input_Operand is private;
+ type Asm_Output_Operand is private;
+ -- These types are never used directly, they are declared only so that
+ -- the calls to Asm are type correct according to Ada semantic rules.
+
+ No_Input_Operands : constant Asm_Input_Operand;
+ No_Output_Operands : constant Asm_Output_Operand;
+
+ type Asm_Input_Operand_List is
+ array (Integer range <>) of Asm_Input_Operand;
+
+ type Asm_Output_Operand_List is
+ array (Integer range <>) of Asm_Output_Operand;
+
+ type Asm_Insn is private;
+ -- This type is not used directly. It is declared only so that the
+ -- aggregates used in code statements are type correct by Ada rules.
+
+ procedure Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand_List;
+ Inputs : Asm_Input_Operand_List;
+ Clobber : String := "";
+ Volatile : Boolean := False);
+
+ procedure Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand := No_Output_Operands;
+ Inputs : Asm_Input_Operand_List;
+ Clobber : String := "";
+ Volatile : Boolean := False);
+
+ procedure Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand_List;
+ Inputs : Asm_Input_Operand := No_Input_Operands;
+ Clobber : String := "";
+ Volatile : Boolean := False);
+
+ procedure Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand := No_Output_Operands;
+ Inputs : Asm_Input_Operand := No_Input_Operands;
+ Clobber : String := "";
+ Volatile : Boolean := False);
+
+ function Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand_List;
+ Inputs : Asm_Input_Operand_List;
+ Clobber : String := "";
+ Volatile : Boolean := False) return Asm_Insn;
+
+ function Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand := No_Output_Operands;
+ Inputs : Asm_Input_Operand_List;
+ Clobber : String := "";
+ Volatile : Boolean := False) return Asm_Insn;
+
+ function Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand_List;
+ Inputs : Asm_Input_Operand := No_Input_Operands;
+ Clobber : String := "";
+ Volatile : Boolean := False) return Asm_Insn;
+
+ function Asm
+ (Template : String;
+ Outputs : Asm_Output_Operand := No_Output_Operands;
+ Inputs : Asm_Input_Operand := No_Input_Operands;
+ Clobber : String := "";
+ Volatile : Boolean := False) return Asm_Insn;
+
+ pragma Import (Intrinsic, Asm);
+
+private
+
+ type Asm_Input_Operand is new Integer;
+ type Asm_Output_Operand is new Integer;
+ type Asm_Insn is new Integer;
+ -- All three of these types are dummy types, to meet the requirements of
+ -- type consistency. No values of these types are ever referenced.
+
+ No_Input_Operands : constant Asm_Input_Operand := 0;
+ No_Output_Operands : constant Asm_Output_Operand := 0;
+
+end System.Machine_Code;
diff -uNr a/zfp/adainclude/s-syscal.adb b/zfp/adainclude/s-syscal.adb
--- a/zfp/adainclude/s-syscal.adb false
+++ b/zfp/adainclude/s-syscal.adb 602e857b2c3724b907ca3d6f4b1587d375c7e35f90ac7a23253edaff29187862d6fc2b2c104da14706b16db2f984eb335b4389c40e87407068d853cdbc0e6210
@@ -0,0 +1,74 @@
+with System.Machine_Code; use System.Machine_Code;
+
+package body System.Syscall is
+ SYSCALL_WRITE : constant := 1;
+ SYSCALL_READ : constant := 0;
+ -- SYSCALL_EXIT : constant := 60;
+
+ function Write (fd : in Int; S : in String; E : out ErrorCode) return Int is
+ type byte is mod 2**8;
+ B : array (S'Range) of byte;
+ R : Int := 0;
+ begin
+ for I in S'Range loop
+ B (I) := Character'Pos (S (I));
+ end loop;
+ Asm
+ ("syscall",
+ Outputs => (Int'Asm_Output ("=a", R)),
+ Inputs =>
+ (Int'Asm_Input ("a", SYSCALL_WRITE),
+ Int'Asm_Input ("D", fd),
+ System.Address'Asm_Input ("S", B'Address),
+ Int'Asm_Input ("d", B'Length)),
+ Volatile => True);
+ if R < 0 and R >= -(2**12) then
+ E := ErrorCode'Val (-R);
+ R := -1;
+ else
+ E := OK;
+ end if;
+ return R;
+ end Write;
+
+ function Read (fd : in Int; s : out String; E : out ErrorCode) return Int is
+ type byte is mod 2**8;
+ B : array (S'Range) of byte;
+ R : Int := 0;
+ begin
+ Asm
+ ("syscall",
+ Outputs => (Int'Asm_Output ("=a", R)),
+ Inputs =>
+ (Int'Asm_Input ("a", SYSCALL_READ),
+ Int'Asm_Input ("D", fd),
+ System.Address'Asm_Input ("S", B'Address),
+ Int'Asm_Input ("d", B'Length)));
+ for I in S'Range loop
+ S (I) := Character'Val (B (I));
+ end loop;
+ if R < 0 and R >= -(2**12) then
+ E := ErrorCode'Val (-R);
+ R := -1;
+ else
+ E := OK;
+ end if;
+ return R;
+ end Read;
+
+ procedure Sys_Exit (C : in Integer) is
+ begin
+ Asm
+ ("mov $60, %%rax" &
+ ASCII.LF &
+ ASCII.HT & -- EXIT
+ "mov %0, %%rdi" &
+ ASCII.LF &
+ ASCII.HT & -- CODE
+ "syscall",
+ Inputs => (Int'Asm_Input ("g", Int (C))),
+ Clobber => "rax, rdi",
+ Volatile => True);
+ raise Program_Error;
+ end Sys_Exit;
+end System.Syscall;
diff -uNr a/zfp/adainclude/s-syscal.ads b/zfp/adainclude/s-syscal.ads
--- a/zfp/adainclude/s-syscal.ads false
+++ b/zfp/adainclude/s-syscal.ads e87d5d4ecc1a2a9bed07371e36f4ca73c34e5781cfa4e3c5d159027f7c9468acddfadf8e59e8357a24cf22b1e8ff1148c660c6a09aac40e43614c62137b822b8
@@ -0,0 +1,17 @@
+package System.Syscall is
+ -- 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);
+ -- The return code will be an integer
+ -- On error, an errocode is returned, values are between 0 and 4096
+ type ErrorCode is range 0 .. 2**12;
+
+ OK : constant ErrorCode := 0;
+
+ function Write (fd : in Int; S : in String; E : out ErrorCode) return Int;
+ function Read (fd : in Int; S : out String; E : out ErrorCode) return Int;
+
+ procedure Sys_Exit (C : in Integer) with
+ No_Return;
+
+end System.Syscall;
diff -uNr a/zfp/adainclude/start.S b/zfp/adainclude/start.S
--- a/zfp/adainclude/start.S false
+++ b/zfp/adainclude/start.S ae4df150bcf3b9d5a444dfd82abecc657beb2e47e7c6823ac184d16a872e8fa9eaf813b7a56c650ed9d702303eecda5632dc79854596fbd055a68758c08d3a11
@@ -0,0 +1,34 @@
+/* _start is the default entry point */
+.global _start
+.global __argc
+.global __argv
+
+/* two 64 bit / 8 bytes globals to store the argc number and argv pointer */
+.bss
+ .align 8
+ .type __argc, @object
+ .size __argc, 8
+__argc:
+ .zero 8
+ .type __argv, @object
+ .size __argv, 8
+__argv:
+ .zero 8
+
+.text
+
+_start:
+/* store the arguments */
+ mov (%rsp), %rdi
+ mov %rdi, __argc
+ mov 8(%rsp), %rdi
+ mov %rdi, __argv
+
+/* call the main generated by gnatbind */
+ call main
+
+/* exit syscall, returncode is 0. */
+_exit:
+ mov $60, %rax
+ mov $0, %rdi
+ syscall
diff -uNr a/zfp/examples/Makefile b/zfp/examples/Makefile
--- a/zfp/examples/Makefile false
+++ b/zfp/examples/Makefile d89fab93e12d5f7211cf3c3133e4e4ec50f657d57f7d49c2fb9ef9cc9a4b4c7998ec9ae237d8c7e277dc91d59680d1c54339eb615c4bea5fff26e14144dc9f1c
@@ -0,0 +1,10 @@
+PROJECT_FILE=gnat_runtime.gpr
+
+all: bin/hello
+
+bin/hello:helloworld/hello.adb ../adalib/libgnat.a ../adalib/start.o
+ gprbuild --RTS=..
+
+clean:
+ gprclean -P $(PROJECT_FILE)
+ -rm -Rf adalib/start.o
diff -uNr a/zfp/examples/constraint/constraint.adb b/zfp/examples/constraint/constraint.adb
--- a/zfp/examples/constraint/constraint.adb 6fef4ef76d4582051ce0717bd229c1e0bd09dc0a624786d3b73089592499b733eeb9c75b9c57e0669fd3c14f4fab0f44d6ecf436635bd2433527ceba5528f7d4
+++ b/zfp/examples/constraint/constraint.adb ddc14834edb9b48137eb4de219f8a3a2ca32d3a410aa99daa63ef3e297622a5c1f59a79763280a705fed0b77d4035bad9d07fc9d1e31d140d1d5e66d730e98fc
@@ -28,6 +28,7 @@
Put(I);
New_Line;
Put(A(I));
+ New_Line;
I := I + 1;
if I > 10 then
exit;
diff -uNr a/zfp/examples/examples.gpr b/zfp/examples/examples.gpr
--- a/zfp/examples/examples.gpr 534d9e5e0760d171256e721e59c6d0eb9ee0ed88518b60e661e048e45f3168aaab9a06d6bedb6ea332ff84686f0f9a47078f7adbb9f32f5f392e2959484f4d4d
+++ b/zfp/examples/examples.gpr 9a1306283662239fadfbdb3d1fe8dd2dd3d4dd7a67ea9d0ef1450d71ae41bfea583ae9fda5283682c4d3a0fa1da0d83aa60e153c2b950c8144efec3bd9966751
@@ -15,7 +15,7 @@
for Object_Dir use "obj";
- for Languages use ("Ada", "C");
+ for Languages use ("Ada");
for Source_Dirs use ("helloworld", "constraint");
for Exec_Dir use "bin";
for Main use ("helloworld/hello.adb", "constraint/constraint.adb");
diff -uNr a/zfp/examples/restrict.adc b/zfp/examples/restrict.adc
--- a/zfp/examples/restrict.adc 5225e9986fc2b427c285fbb867ce8dc881f0015f82506ca31e94686c31090f8913dd83321f9839143128873a2dcda7dd8e7d19d676a42af1c0ce979c8195c22c
+++ b/zfp/examples/restrict.adc 7776eae2c0cdca501300525e554c66db69a51ed0e37e57b3d384d0b7b629d930a48d4f9efad765edb68418ef9ed7a09458757ca9f110fb748953b44295f84a96
@@ -83,3 +83,4 @@
pragma Discard_Names;
pragma Restrictions (No_Enumeration_Maps);
pragma Restrictions (No_Exception_Propagation);
+pragma Restrictions (No_Exception_Handlers);
diff -uNr a/zfp/gnat_runtime.gpr b/zfp/gnat_runtime.gpr
--- a/zfp/gnat_runtime.gpr 0a4fab6b53946cb27cd57ae30df5f67b96bf6ab5ad7572824d8b4c6b5430f2808863df330e1b10d41f509172841bbfd6711c7ee0b7ddc8ce5ad7b2bce423c383
+++ b/zfp/gnat_runtime.gpr 333021e0854dd34f16f0f42540dd1ab89940fde79d8283ef965e9bed288de0174d5b69c91e465afe6fa2147f7d597b0a9424fe95c04e3ad0c866acdc058b6443
@@ -34,5 +34,13 @@
"-ffunction-sections",
"-fdata-sections");
end Compiler;
+
+ package Install is
+ for Sources_Subdir use "adainclude";
+ for Ali_Subdir use "adalib";
+ for Lib_Subdir use "adalib";
+ for Required_Artifacts (".") use ("runtime.xml");
+ for Install_Project use "false";
+ end Install;
end Gnat_Runtime;
diff -uNr a/zfp/manifest b/zfp/manifest
--- a/zfp/manifest ec0dcb82d3e2d3c58c7cad6f920dd0ea8bd6baabf69dfcea2a4b95eccb005e51998c48639c5cb1589e99e0582aaa5613837f00e75563e1b6cd67e9fd92c7026d
+++ b/zfp/manifest 69c0cf97b057d92731f3a70d4cf346752478727fecab43d10314ddde83421301aeb82e2a4c51f74f2eedd42f064c44bb208853dad5d408f25816cdea41f5eade
@@ -1,2 +1,3 @@
535595 zfp_genesis ave1 a minimal gnat runtime library
535611 zfp_1_examples ave1 two examples for the minimal runtime
+535612 zfp_2_noc ave1 zfp no dependency on the C library
diff -uNr a/zfp/runtime.xml b/zfp/runtime.xml
--- a/zfp/runtime.xml false
+++ b/zfp/runtime.xml f1f4017587e31f70c8936356b09fb73710ac7fca3a6fd7577ba480d7ae49ed786d17d622802b84de311fdbf32994be887c035b8bca292298be9ee958489b8c6f
@@ -0,0 +1,21 @@
+
+
+
+
+
+ package Linker is
+ for Required_Switches use Linker'Required_Switches &
+ ("${RUNTIME_DIR(ada)}/adalib/libgnat.a") &
+ ("-nostdlib", "-nodefaultlibs", "-lgcc");
+
+ for Required_Switches use Linker'Required_Switches &
+ ("${RUNTIME_DIR(ada)}/adalib/start.o");
+ end Linker;
+
+ package Binder is
+ for Required_Switches ("Ada") use Binder'Required_Switches ("Ada") &
+ ("-nostdlib") ;
+ end Binder;
+
+
+