3
2011-10-12 Mikael Pettersson <mikpe@it.uu.se>
6
* gcc-interface/Makefile.in: Add support for m68k-linux.
7
* system-linux-m68k.ads: New file based on system-linux-ppc.ads
8
and system-vxworks-m68k.ads.
9
* s-memory.adb (Gnat_Malloc): New wrapper around Alloc, returning
10
the memory address as a pointer not an integer.
11
Add Gnat_Malloc -> __gnat_malloc export.
12
* s-memory.ads: Remove Alloc -> __gnat_malloc export.
14
--- a/src/gcc/ada/gcc-interface/Makefile.in
15
+++ b/src/gcc/ada/gcc-interface/Makefile.in
16
@@ -1919,6 +1919,35 @@ ifeq ($(strip $(filter-out arm%-linux,$(
17
LIBRARY_VERSION := $(LIB_VERSION)
21
+ifeq ($(strip $(filter-out m68k% linux%,$(arch) $(osys))),)
22
+ LIBGNAT_TARGET_PAIRS = \
23
+ a-intnam.ads<a-intnam-linux.ads \
24
+ s-inmaop.adb<s-inmaop-posix.adb \
25
+ s-intman.adb<s-intman-posix.adb \
26
+ s-linux.ads<s-linux.ads \
27
+ s-osinte.adb<s-osinte-posix.adb \
28
+ s-osinte.ads<s-osinte-linux.ads \
29
+ s-osprim.adb<s-osprim-posix.adb \
30
+ s-taprop.adb<s-taprop-linux.adb \
31
+ s-tasinf.ads<s-tasinf-linux.ads \
32
+ s-tasinf.adb<s-tasinf-linux.adb \
33
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
34
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
35
+ system.ads<system-linux-m68k.ads
37
+ TOOLS_TARGET_PAIRS = \
38
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
39
+ indepsw.adb<indepsw-gnu.adb
41
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
43
+ THREADSLIB = -lpthread
44
+ GNATLIB_SHARED = gnatlib-shared-dual
46
+ LIBRARY_VERSION := $(LIB_VERSION)
50
ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
51
LIBGNAT_TARGET_PAIRS_COMMON = \
52
--- a/src/gcc/ada/s-memory.adb
53
+++ b/src/gcc/ada/s-memory.adb
54
@@ -47,6 +47,7 @@ with Ada.Exceptions;
55
with System.Soft_Links;
56
with System.Parameters;
58
+with Ada.Unchecked_Conversion;
60
package body System.Memory is
62
@@ -100,6 +101,22 @@ package body System.Memory is
66
+ type Char_Ptr is access all Character;
67
+ pragma Convention (C, Char_Ptr);
68
+ pragma No_Strict_Aliasing (Char_Ptr);
70
+ function To_Char_Ptr is
71
+ new Ada.Unchecked_Conversion (System.Address, Char_Ptr);
73
+ -- The function exported as __gnat_malloc MUST return a pointer type.
74
+ function Gnat_Malloc (Size : size_t) return Char_Ptr;
75
+ pragma Export (C, Gnat_Malloc, "__gnat_malloc");
77
+ function Gnat_Malloc (Size : size_t) return Char_Ptr is
79
+ return To_Char_Ptr (Alloc (Size));
85
--- a/src/gcc/ada/s-memory.ads
86
+++ b/src/gcc/ada/s-memory.ads
87
@@ -100,7 +100,6 @@ private
89
-- The following names are used from the generated compiler code
91
- pragma Export (C, Alloc, "__gnat_malloc");
92
pragma Export (C, Free, "__gnat_free");
93
pragma Export (C, Realloc, "__gnat_realloc");
96
+++ b/src/gcc/ada/system-linux-m68k.ads
98
+------------------------------------------------------------------------------
100
+-- GNAT RUN-TIME COMPONENTS --
105
+-- (GNU-Linux/M68K Version) --
107
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
109
+-- This specification is derived from the Ada Reference Manual for use with --
110
+-- GNAT. The copyright notice above, and the license provisions that follow --
111
+-- apply solely to the contents of the part following the private keyword. --
113
+-- GNAT is free software; you can redistribute it and/or modify it under --
114
+-- terms of the GNU General Public License as published by the Free Soft- --
115
+-- ware Foundation; either version 3, or (at your option) any later ver- --
116
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
117
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
118
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
120
+-- As a special exception under Section 7 of GPL version 3, you are granted --
121
+-- additional permissions described in the GCC Runtime Library Exception, --
122
+-- version 3.1, as published by the Free Software Foundation. --
124
+-- You should have received a copy of the GNU General Public License and --
125
+-- a copy of the GCC Runtime Library Exception along with this program; --
126
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
127
+-- <http://www.gnu.org/licenses/>. --
129
+-- GNAT was originally developed by the GNAT team at New York University. --
130
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
132
+------------------------------------------------------------------------------
136
+ -- Note that we take advantage of the implementation permission to make
137
+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
138
+ -- 2005, this is Pure in any case (AI-362).
140
+ type Name is (SYSTEM_NAME_GNAT);
141
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
143
+ -- System-Dependent Named Numbers
145
+ Min_Int : constant := Long_Long_Integer'First;
146
+ Max_Int : constant := Long_Long_Integer'Last;
148
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
149
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
151
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
152
+ Max_Digits : constant := Long_Long_Float'Digits;
154
+ Max_Mantissa : constant := 63;
155
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
157
+ Tick : constant := 0.000_001;
159
+ -- Storage-related Declarations
161
+ type Address is private;
162
+ pragma Preelaborable_Initialization (Address);
163
+ Null_Address : constant Address;
165
+ Storage_Unit : constant := 8;
166
+ Word_Size : constant := 32;
167
+ Memory_Size : constant := 2 ** 32;
169
+ -- Address comparison
171
+ function "<" (Left, Right : Address) return Boolean;
172
+ function "<=" (Left, Right : Address) return Boolean;
173
+ function ">" (Left, Right : Address) return Boolean;
174
+ function ">=" (Left, Right : Address) return Boolean;
175
+ function "=" (Left, Right : Address) return Boolean;
177
+ pragma Import (Intrinsic, "<");
178
+ pragma Import (Intrinsic, "<=");
179
+ pragma Import (Intrinsic, ">");
180
+ pragma Import (Intrinsic, ">=");
181
+ pragma Import (Intrinsic, "=");
183
+ -- Other System-Dependent Declarations
185
+ type Bit_Order is (High_Order_First, Low_Order_First);
186
+ Default_Bit_Order : constant Bit_Order := High_Order_First;
187
+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
189
+ -- Priority-related Declarations (RM D.1)
191
+ -- 0 .. 98 corresponds to the system priority range 1 .. 99.
193
+ -- If the scheduling policy is SCHED_FIFO or SCHED_RR the runtime makes use
194
+ -- of the entire range provided by the system.
196
+ -- If the scheduling policy is SCHED_OTHER the only valid system priority
197
+ -- is 1 and other values are simply ignored.
199
+ Max_Priority : constant Positive := 97;
200
+ Max_Interrupt_Priority : constant Positive := 98;
202
+ subtype Any_Priority is Integer range 0 .. 98;
203
+ subtype Priority is Any_Priority range 0 .. 97;
204
+ subtype Interrupt_Priority is Any_Priority range 98 .. 98;
206
+ Default_Priority : constant Priority := 48;
210
+ type Address is mod Memory_Size;
211
+ Null_Address : constant Address := 0;
213
+ --------------------------------------
214
+ -- System Implementation Parameters --
215
+ --------------------------------------
217
+ -- These parameters provide information about the target that is used
218
+ -- by the compiler. They are in the private part of System, where they
219
+ -- can be accessed using the special circuitry in the Targparm unit
220
+ -- whose source should be consulted for more detailed descriptions
221
+ -- of the individual switch values.
223
+ Backend_Divide_Checks : constant Boolean := False;
224
+ Backend_Overflow_Checks : constant Boolean := True;
225
+ Command_Line_Args : constant Boolean := True;
226
+ Configurable_Run_Time : constant Boolean := False;
227
+ Denorm : constant Boolean := True;
228
+ Duration_32_Bits : constant Boolean := False;
229
+ Exit_Status_Supported : constant Boolean := True;
230
+ Fractional_Fixed_Ops : constant Boolean := False;
231
+ Frontend_Layout : constant Boolean := False;
232
+ Machine_Overflows : constant Boolean := False;
233
+ Machine_Rounds : constant Boolean := True;
234
+ Preallocated_Stacks : constant Boolean := False;
235
+ Signed_Zeros : constant Boolean := False;
236
+ Stack_Check_Default : constant Boolean := False;
237
+ Stack_Check_Probes : constant Boolean := False;
238
+ Stack_Check_Limits : constant Boolean := False;
239
+ Support_64_Bit_Divides : constant Boolean := True;
240
+ Support_Aggregates : constant Boolean := True;
241
+ Support_Composite_Assign : constant Boolean := True;
242
+ Support_Composite_Compare : constant Boolean := True;
243
+ Support_Long_Shifts : constant Boolean := True;
244
+ Always_Compatible_Rep : constant Boolean := True;
245
+ Suppress_Standard_Library : constant Boolean := False;
246
+ Use_Ada_Main_Program_Name : constant Boolean := False;
247
+ ZCX_By_Default : constant Boolean := True;
248
+ GCC_ZCX_Support : constant Boolean := True;