Commit f921a1cd by Jose Ruiz Committed by Arnaud Charlet

2008-07-30 Jose Ruiz <ruiz@adacore.com>

	* adaint.c
	(__gnat_file_exists): Do not use __gnat_stat for RTX.
	(__main for RTX in RTSS mode): Create this dummy procedure symbol to
	avoid the use of this symbol from libgcc.a in RTX kernel mode.

	* cio.c
	(put_int, put_int_stderr, put_char, put_char_stderr): For RTX we call
	the function RtPrintf for console output.
	
	* argv.c Do not use the environ variable for RTX.
	
	* gnatlink.adb (gnatlink): The part that handles the --RTS option has
	been moved before the call to Osint.Add_Default_Search_Dirs in order
	to take into account the flags in system.ads (RTX_RTSS_Kernel_Module)
	from the appropriate run time.
	
	* targparm.ads
	(RTX_RTSS_Kernel_Module_On_Target): Add this flag that is set to True if
	target is a RTSS module for RTX.
	
	* targparm.adb (Targparm_Tags, RTX_Str, Targparm_Str): Add tag RTX for
	RTX_RTSS_Kernel_Module
	(Get_Target_Parameters): Add processing of RTX_RTSS_Kernel_Module flag.

	* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for RTX): Use gcc
	exception handling mechanism for Windows and RTX in Win32 mode, but
	not for RTX in kernel mode (RTSS).
	(LIBGNAT_SRCS): Remove ada.h

From-SVN: r138305
parent 88462e81
......@@ -1061,6 +1061,7 @@ __gnat_readdir (DIR *dirp, char *buffer, int *len)
/* Not supported in RTX */
return NULL;
#elif defined (__MINGW32__)
struct _tdirent *dirent = _treaddir ((_TDIR*)dirp);
......@@ -1606,7 +1607,7 @@ __gnat_stat (char *name, struct stat *statbuf)
int
__gnat_file_exists (char *name)
{
#if defined (__MINGW32__) && !defined (RTX)
#ifdef __MINGW32__
/* On Windows do not use __gnat_stat() because a bug in Microsoft
_stat() routine. When the system time-zone is set with a negative
offset the _stat() routine fails on specific files like CON: */
......@@ -3048,11 +3049,14 @@ __gnat_sals_init_using_constructors ()
#endif
}
#ifdef RTX
/* In RTX mode, the procedure to get the time (as file time) is different
in RTSS mode and Win32 mode. In order to avoid duplicating an Ada file,
we introduce an intermediate procedure to link against the corresponding
one in each situation. */
#ifdef RTX
extern void GetTimeAsFileTime(LPFILETIME pTime);
void GetTimeAsFileTime(LPFILETIME pTime)
{
......@@ -3062,6 +3066,16 @@ void GetTimeAsFileTime(LPFILETIME pTime)
GetSystemTimeAsFileTime (pTime); /* w32 interface */
#endif
}
#ifdef RTSS
/* Add symbol that is required to link. It would otherwise be taken from
libgcc.a and it would try to use the gcc constructors that are not
supported by Microsoft linker. */
extern void __main (void);
void __main (void) {}
#endif
#endif
#if defined (linux) || defined(__GLIBC__)
......
......@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* Copyright (C) 1992-2008, 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- *
......@@ -61,7 +61,7 @@ int gnat_argc = 0;
const char **gnat_argv = (const char **) 0;
const char **gnat_envp = (const char **) 0;
#ifdef _WIN32
#if defined (_WIN32) && !defined (RTX)
/* Note that on Windows environment the environ point to a buffer that could
be reallocated if needed. It means that gnat_envp needs to be updated
before using gnat_envp to point to the right environment space */
......
......@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* Copyright (C) 1992-2008, 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- *
......@@ -56,6 +56,11 @@
#undef getchar
#endif
#ifdef RTX
#include <windows.h>
#include <Rtapi.h>
#endif
int
get_char (void)
{
......@@ -78,27 +83,43 @@ get_int (void)
void
put_int (int x)
{
#ifdef RTX
RtPrintf ("%d", x);
#else
/* Use fprintf rather than printf, since the latter is unbuffered
on vxworks */
fprintf (stdout, "%d", x);
#endif
}
void
put_int_stderr (int x)
{
#ifdef RTX
RtPrintf ("%d", x);
#else
fprintf (stderr, "%d", x);
#endif
}
void
put_char (int c)
{
#ifdef RTX
RtPrintf ("%c", c);
#else
putchar (c);
#endif
}
void
put_char_stderr (int c)
{
#ifdef RTX
RtPrintf ("%c", c);
#else
fputc (c, stderr);
#endif
}
#ifdef __vxworks
......
......@@ -1326,13 +1326,20 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
s-intman.adb<s-intman-dummy.adb \
s-osinte.ads<s-osinte-rtx.ads \
s-osprim.adb<s-osprim-rtx.adb \
s-taprop.adb<s-taprop-rtx.adb \
system.ads<system-rtx.ads
s-taprop.adb<s-taprop-rtx.adb
EXTRA_GNATRTL_NONTASKING_OBJS = s-win32.o
MISCLIB = -lwsock32 -lrtapi_w32
THREADSLIB=-lrtapi_w32
ifeq ($(strip $(filter-out rtx_w32,$(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS += system.ads<system-rtx.ads
EH_MECHANISM=-gcc
else
LIBGNAT_TARGET_PAIRS += system.ads<system-rtx-rtss.ads
EH_MECHANISM=
endif
else
LIBGNAT_TARGET_PAIRS += \
a-exetim.adb<a-exetim-mingw.adb \
......@@ -1354,13 +1361,14 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
# ??? This will be replaced by gnatlib-shared-dual-win32 when GNAT
# auto-import support for array/record will be done.
GNATLIB_SHARED = gnatlib-shared-win32
EH_MECHANISM=-gcc
endif
TOOLS_TARGET_PAIRS= \
mlib-tgt-specific.adb<mlib-tgt-specific-mingw.adb \
indepsw.adb<indepsw-mingw.adb
EH_MECHANISM=-gcc
GMEM_LIB = gmemlib
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
EXTRA_GNATTOOLS = ../../gnatdll$(exeext)
......@@ -1706,7 +1714,7 @@ endif
# while GNATRTL_OBJS lists the object files compiled from Ada sources that
# go into the directory. The pthreads emulation is built in the threads
# subdirectory and copied.
LIBGNAT_SRCS = ada.h adaint.c adaint.h argv.c cio.c cstreams.c \
LIBGNAT_SRCS = adaint.c adaint.h argv.c cio.c cstreams.c \
errno.c exit.c cal.c ctrl_c.c env.c env.h \
raise.h raise.c sysdep.c aux-io.c init.c initialize.c seh_init.c \
final.c tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c expect.c mkdir.c \
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2007, Free Software Foundation, Inc. --
-- Copyright (C) 1999-2008, 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- --
......@@ -54,6 +54,7 @@ package body Targparm is
MOV, -- Machine_Overflows
MRN, -- Machine_Rounds
PAS, -- Preallocated_Stacks
RTX, -- RTX_RTSS_Kernel_Module
S64, -- Support_64_Bit_Divides
SAG, -- Support_Aggregates
SCA, -- Support_Composite_Assign
......@@ -90,6 +91,7 @@ package body Targparm is
MOV_Str : aliased constant Source_Buffer := "Machine_Overflows";
MRN_Str : aliased constant Source_Buffer := "Machine_Rounds";
PAS_Str : aliased constant Source_Buffer := "Preallocated_Stacks";
RTX_Str : aliased constant Source_Buffer := "RTX_RTSS_Kernel_Module";
S64_Str : aliased constant Source_Buffer := "Support_64_Bit_Divides";
SAG_Str : aliased constant Source_Buffer := "Support_Aggregates";
SCA_Str : aliased constant Source_Buffer := "Support_Composite_Assign";
......@@ -126,6 +128,7 @@ package body Targparm is
MOV_Str'Access,
MRN_Str'Access,
PAS_Str'Access,
RTX_Str'Access,
S64_Str'Access,
SAG_Str'Access,
SCA_Str'Access,
......@@ -573,6 +576,7 @@ package body Targparm is
when MOV => Machine_Overflows_On_Target := Result;
when MRN => Machine_Rounds_On_Target := Result;
when PAS => Preallocated_Stacks_On_Target := Result;
when RTX => RTX_RTSS_Kernel_Module_On_Target := Result;
when S64 => Support_64_Bit_Divides_On_Target := Result;
when SAG => Support_Aggregates_On_Target := Result;
when SCA => Support_Composite_Assign_On_Target := Result;
......
......@@ -216,6 +216,9 @@ package Targparm is
OpenVMS_On_Target : Boolean := False;
-- Set to True if target is OpenVMS
RTX_RTSS_Kernel_Module_On_Target : Boolean := False;
-- Set to True if target is RTSS module for RTX
type Virtual_Machine_Kind is (No_VM, JVM_Target, CLI_Target);
VM_Target : Virtual_Machine_Kind := No_VM;
-- Kind of virtual machine targetted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment