This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

committed: Ada updates


Further IA64/x86_64 fixes
Part of FreeBSD port.

Tested on x86-linux and compiled on x86-freebsd

2003-11-18  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* ada-tree.def: (ALLOCATE_EXPR): Class is "2", not "s".

	* decl.c (gnat_to_gnu_entity, case E_Floating_Point_Subtype): Set
	TYPE_PRECISION directly from esize.

2003-11-18  Thomas Quinot  <quinot@act-europe.fr>

	* cstreams.c: 
	Use realpath(3) on FreeBSD. Fix typo in comment while we are at it.

	* init.c: Initialization routines for FreeBSD

	* link.c: Link info for FreeBSD

	* sysdep.c: Add the case of FreeBSD
--
Index: ada-tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/ada-tree.def,v
retrieving revision 1.7
diff -u -p -r1.7 ada-tree.def
--- ada-tree.def	29 Oct 2003 10:26:12 -0000	1.7
+++ ada-tree.def	18 Nov 2003 09:59:29 -0000
@@ -37,7 +37,7 @@ DEFTREECODE (TRANSFORM_EXPR, "transform_
    by operand 0 at the alignment given by operand 1 and return the
    address of the resulting memory.  */
 
-DEFTREECODE (ALLOCATE_EXPR, "allocate_expr", 's', 2)
+DEFTREECODE (ALLOCATE_EXPR, "allocate_expr", '2', 2)
 
 /* A type that is an unconstrained array itself.  This node is never passed
    to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE
Index: cstreams.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/cstreams.c,v
retrieving revision 1.10
diff -u -p -r1.10 cstreams.c
--- cstreams.c	31 Oct 2003 01:08:40 -0000	1.10
+++ cstreams.c	18 Nov 2003 09:59:29 -0000
@@ -175,9 +175,9 @@ __gnat_full_name (char *nam, char *buffe
 #elif defined (MSDOS)
   _fixpath (nam, buffer);
 
-#elif defined (sgi)
+#elif defined (sgi) || defined (__FreeBSD__)
 
-  /* Use realpath function which resolves links and references to .. and ..
+  /* Use realpath function which resolves links and references to . and ..
      on those Unix systems that support it. Note that GNU/Linux provides it but
      cannot handle more than 5 symbolic links in a full name, so we use the
      getcwd approach instead. */
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/decl.c,v
retrieving revision 1.22
diff -u -p -r1.22 decl.c
--- decl.c	17 Nov 2003 14:58:14 -0000	1.22
+++ decl.c	18 Nov 2003 09:59:30 -0000
@@ -1357,8 +1357,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	}
 
       {
-	enum machine_mode mode;
-
 	if (definition == 0
 	    && Present (Ancestor_Subtype (gnat_entity))
 	    && ! In_Extended_Main_Code_Unit (Ancestor_Subtype (gnat_entity))
@@ -1367,15 +1365,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 	  gnat_to_gnu_entity (Ancestor_Subtype (gnat_entity),
 			      gnu_expr, definition);
 
-	for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
-	     (GET_MODE_WIDER_MODE (mode) != VOIDmode
-	      && GET_MODE_BITSIZE (GET_MODE_WIDER_MODE (mode)) <= esize);
-	     mode = GET_MODE_WIDER_MODE (mode))
-	  ;
-
 	gnu_type = make_node (REAL_TYPE);
 	TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity));
-	TYPE_PRECISION (gnu_type) = GET_MODE_BITSIZE (mode);
+	TYPE_PRECISION (gnu_type) = fp_size_to_prec (esize);
 
 	TYPE_MIN_VALUE (gnu_type)
 	  = convert (TREE_TYPE (gnu_type),
Index: init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/init.c,v
retrieving revision 1.20
diff -u -p -r1.20 init.c
--- init.c	4 Nov 2003 12:51:46 -0000	1.20
+++ init.c	18 Nov 2003 09:59:30 -0000
@@ -1456,6 +1456,88 @@ __gnat_initialize(void)
 {
 }
 
+/*************************************************/
+/* __gnat_initialize (FreeBSD version) */
+/*************************************************/
+
+#elif defined (__FreeBSD__)
+
+#include <signal.h>
+#include <unistd.h>
+
+static void
+__gnat_error_handler (sig, code, sc)
+     int sig;
+     int code;
+     struct sigcontext *sc;
+{
+  struct Exception_Data *exception;
+  char *msg;
+
+  switch (sig)
+    {
+    case SIGFPE:
+      exception = &constraint_error;
+      msg = "SIGFPE";
+      break;
+
+    case SIGILL:
+      exception = &constraint_error;
+      msg = "SIGILL";
+      break;
+
+    case SIGSEGV:
+      exception = &storage_error;
+      msg = "stack overflow or erroneous memory access";
+      break;
+
+    case SIGBUS:
+      exception = &constraint_error;
+      msg = "SIGBUS";
+      break;
+
+    default:
+      exception = &program_error;
+      msg = "unhandled signal";
+    }
+
+  Raise_From_Signal_Handler (exception, msg);
+}
+
+void
+__gnat_install_handler ()
+{
+  struct sigaction act;
+
+  /* Set up signal handler to map synchronous signals to appropriate
+     exceptions.  Make sure that the handler isn't interrupted by another
+     signal that might cause a scheduling event! */
+
+  act.sa_handler = __gnat_error_handler;
+  act.sa_flags = SA_NODEFER | SA_RESTART;
+  (void) sigemptyset (&act.sa_mask);
+
+  (void) sigaction (SIGILL,  &act, NULL);
+  (void) sigaction (SIGFPE,  &act, NULL);
+  (void) sigaction (SIGSEGV, &act, NULL);
+  (void) sigaction (SIGBUS,  &act, NULL);
+}
+
+void __gnat_init_float ();
+
+void
+__gnat_initialize ()
+{
+   __gnat_install_handler ();
+
+   /* XXX - Initialize floating-point coprocessor. This call is
+      needed because FreeBSD defaults to 64-bit precision instead
+      of 80-bit precision?  We require the full precision for
+      proper operation, given that we have set Max_Digits etc
+      with this in mind */
+   __gnat_init_float ();
+}
+
 /***************************************/
 /* __gnat_initialize (VXWorks Version) */
 /***************************************/
@@ -1749,7 +1831,7 @@ __gnat_install_handler (void)
    WIN32 and could be used under OS/2 */
 
 #if defined (_WIN32) || defined (__INTERIX) || defined (__EMX__) \
-  || defined (__Lynx__) || defined(__NetBSD__)
+  || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__)
 
 #define HAVE_GNAT_INIT_FLOAT
 
Index: link.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/link.c,v
retrieving revision 1.5
diff -u -p -r1.5 link.c
--- link.c	21 Oct 2003 13:42:09 -0000	1.5
+++ link.c	18 Nov 2003 09:59:30 -0000
@@ -154,6 +154,15 @@ unsigned char objlist_file_supported = 0
 unsigned char using_gnu_linker = 0;
 const char *object_library_extension = ".a";
 
+#elif defined (__FreeBSD__)
+char *object_file_option = "";
+char *run_path_option = "";
+char shared_libgnat_default = SHARED;
+int link_max = 2147483647;
+unsigned char objlist_file_supported = 0;
+unsigned char using_gnu_linker = 0;
+char *object_library_extension = ".a";
+
 #elif defined (linux)
 const char *object_file_option = "";
 const char *run_path_option = "-Wl,-rpath,";
Index: sysdep.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/sysdep.c,v
retrieving revision 1.15
diff -u -p -r1.15 sysdep.c
--- sysdep.c	12 Nov 2003 21:29:28 -0000	1.15
+++ sysdep.c	18 Nov 2003 09:59:30 -0000
@@ -291,7 +291,7 @@ __gnat_ttyname (int filedes)
   || (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \
   || defined (__MACHTEN__) || defined (hpux) || defined (_AIX) \
   || (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \
-  || defined (__CYGWIN__)
+  || defined (__CYGWIN__) || defined (__FreeBSD__)
 
 #ifdef __MINGW32__
 #if OLD_MINGW
@@ -348,7 +348,7 @@ getc_immediate_common (FILE *stream,
     || (defined (__osf__) && ! defined (__alpha_vxworks)) \
     || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (hpux) \
     || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
-    || defined (__Lynx__)
+    || defined (__Lynx__) || defined (__FreeBSD__)
   char c;
   int nread;
   int good_one = 0;
@@ -367,7 +367,7 @@ getc_immediate_common (FILE *stream,
 #if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
     || defined (__osf__) || defined (__MACHTEN__) || defined (hpux) \
     || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
-    || defined (__Lynx__)
+    || defined (__Lynx__) || defined (__FreeBSD__)
       eof_ch = termios_rec.c_cc[VEOF];
 
       /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]