Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Support GNAT 12.1
Browse files Browse the repository at this point in the history
ref #84
  • Loading branch information
jklmnn committed Aug 2, 2022
1 parent eda905a commit dcb86e9
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 13 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,24 @@ jobs:
uses: alire-project/setup-alire@v1
- name: Install FSF GNAT
run: |
make install_gnat_11
make GNAT_VERSION=11.2.1 install_gnat
- name: GNAT 11.2 on Posix
run: |
eval `make printenv_gnat_11`
eval `make GNAT_VERSION=11.2.1 printenv_gnat`
make && make test
gnat_12_1:
name: gnat-12.1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Alire
uses: alire-project/setup-alire@v1
- name: Install FSF GNAT
run: |
make GNAT_VERSION=12.1.2 install_gnat
- name: GNAT 12.1 on Posix
run: |
eval `make GNAT_VERSION=12.1.2 printenv_gnat`
make && make test
gnat_community_2019:
name: gnat-community-2019
Expand Down
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
VERBOSE ?= @
BOARD ?= default
GNAT_VERSION ?= 12.1.2
GNAT_ESCAPED_VERSION := $(subst .,_,$(GNAT_VERSION))

TEST_DIR = tests/system
UNIT_DIR = tests/unit
Expand Down Expand Up @@ -80,18 +82,18 @@ proof: stm32f0 nrf52
$(VERBOSE)gnatprove --level=3 --checks-as-errors -j0 -Ptests/platform/stm32f0/test.gpr -XOBJECT_DIR=$(OBJ_DIR) --info --report=$(REPORT)
$(VERBOSE)gnatprove --level=3 --checks-as-errors -j0 -Ptests/platform/nrf52/test.gpr -XOBJECT_DIR=$(OBJ_DIR) --info --report=$(REPORT)

install_gnat_11:
alr toolchain --install gnat_native=11.2.1 && \
alr toolchain --select gnat_native=11.2.1 && \
install_gnat:
alr toolchain --install gnat_native=$(GNAT_VERSION) && \
alr toolchain --select gnat_native=$(GNAT_VERSION) && \
mkdir -p build && \
cd build && \
alr -n init --lib gnat_11 && \
cd gnat_11 && \
alr -n init --lib gnat_$(GNAT_ESCAPED_VERSION) && \
cd gnat_$(GNAT_ESCAPED_VERSION) && \
alr -n with aunit

printenv_gnat_11:
@test -d build/gnat_11 && \
cd build/gnat_11 && \
printenv_gnat:
@test -d build/gnat_$(GNAT_ESCAPED_VERSION) && \
cd build/gnat_$(GNAT_ESCAPED_VERSION) && \
alr printenv

clean: clean_test
Expand Down
2 changes: 1 addition & 1 deletion build/nrf52/rts.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library project rts is
end Builder;

package Compiler is
for Default_Switches ("Ada") use ("-gnatg", "-g", "-mthumb", "-ffunction-sections", "-fdata-sections", "-mcpu=cortex-m4");
for Default_Switches ("Ada") use ("-gnatg", "-gnatwG", "-g", "-mthumb", "-ffunction-sections", "-fdata-sections", "-mcpu=cortex-m4");
for Default_Switches ("C") use ("-g", "-mthumb", "-ffunction-sections", "-fdata-sections", "-mcpu=cortex-m4");
for Default_Switches ("Asm_CPP") use ("-g", "-mthumb", "-ffunction-sections", "-fdata-sections", "-mcpu=cortex-m4");
end Compiler;
Expand Down
2 changes: 1 addition & 1 deletion build/posix/rts.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ library project rts is
end Builder;

package Compiler is
for Default_Switches ("Ada") use ("-gnatg", "-fPIC");
for Default_Switches ("Ada") use ("-gnatg", "-gnatwG", "-fPIC");
for Default_Switches ("C") use ("-fPIC");
end Compiler;

Expand Down
2 changes: 1 addition & 1 deletion build/stm32f0/rts.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library project rts is
end Builder;

package Compiler is
for Default_Switches ("Ada") use ("-gnatg", "-g", "-mthumb", "-ffunction-sections", "-fdata-sections");
for Default_Switches ("Ada") use ("-gnatg", "-gnatwG", "-g", "-mthumb", "-ffunction-sections", "-fdata-sections");
for Default_Switches ("C") use ("-g", "-mthumb", "-ffunction-sections", "-fdata-sections");
for Default_Switches ("Asm_CPP") use ("-g", "-mthumb", "-ffunction-sections", "-fdata-sections");
end Compiler;
Expand Down
77 changes: 77 additions & 0 deletions src/minimal/a-tags-gcc_12.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
-- Copyright (C) 2021 Componolit GmbH
--
-- This file is part of the Componolit Ada runtime, which is distributed
-- under the terms of the GNU Affero General Public License version 3.
--
-- 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.

private with System;
private with System.Storage_Elements;

package Ada.Tags with
Preelaborate,
Elaborate_Body
is

type Tag is private with
Preelaborable_Initialization;

No_Tag : constant Tag;

private

package SSE renames System.Storage_Elements;
use type SSE.Storage_Offset;

subtype Cstring is String (Positive);
type Cstring_Ptr is access all Cstring;
pragma No_Strict_Aliasing (Cstring_Ptr);
type Tag_Table is array (Natural range <>) of Tag;
type Prim_Ptr is access procedure;
type Address_Array is array (Positive range <>) of Prim_Ptr;
subtype Dispatch_Table is Address_Array (1 .. 1);

type Tag is access all Dispatch_Table;
pragma No_Strict_Aliasing (Tag);

No_Tag : constant Tag := null;

type Type_Specific_Data (Depth : Natural) is record
Access_Level : Natural;
Alignment : Natural;
Expanded_Name : Cstring_Ptr;
External_Tag : Cstring_Ptr;
Transportable : Boolean;
Needs_Finalization : Boolean;
Tags_Table : Tag_Table (0 .. Depth);
end record;

type Dispatch_Table_Wrapper (Procedure_Count : Natural) is record
Predef_Prims : System.Address;
Offset_To_Top : SSE.Storage_Offset;
TSD : System.Address;
Prims_Ptr : Address_Array (1 .. Procedure_Count);
end record;

Max_Predef_Prims : constant Positive := 10;
subtype Predef_Prims_Table is Address_Array (1 .. Max_Predef_Prims);
type Predef_Prims_Table_Ptr is access Predef_Prims_Table;
pragma No_Strict_Aliasing (Predef_Prims_Table_Ptr);

DT_Predef_Prims_Size : constant SSE.Storage_Count :=
SSE.Storage_Count (Standard'Address_Size / System.Storage_Unit);
DT_Offset_To_Top_Size : constant SSE.Storage_Count :=
SSE.Storage_Count (Standard'Address_Size / System.Storage_Unit);
DT_Typeinfo_Ptr_Size : constant SSE.Storage_Count :=
SSE.Storage_Count (Standard'Address_Size / System.Storage_Unit);
DT_Offset_To_Top_Offset : constant SSE.Storage_Count :=
DT_Typeinfo_Ptr_Size + DT_Offset_To_Top_Size;
DT_Predef_Prims_Offset : constant SSE.Storage_Count :=
DT_Typeinfo_Ptr_Size + DT_Offset_To_Top_Size + DT_Predef_Prims_Size;

type Addr_Ptr is access System.Address;
pragma No_Strict_Aliasing (Addr_Ptr);

end Ada.Tags;

0 comments on commit dcb86e9

Please sign in to comment.