[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 25 Nov 2015 15:09:38 +0000 (16:09 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 25 Nov 2015 15:09:38 +0000 (16:09 +0100)
2015-11-25  Jerome Lambourg  <lambourg@adacore.com>

* init.c: Enable the signal trampoline on x86_64-vx7
* sigtramp-vxworks-target.inc: Implement the signal trampoline
for x86_64
* tracebak.c: Remove the hook to use the generic
unwinder on x86_64-vx7.

2015-11-25  Vincent Celier  <celier@adacore.com>

* gnatcmd.adb: When "gnat name -P" is called, invoke gprname
directly if available.

From-SVN: r230875

gcc/ada/ChangeLog
gcc/ada/gnatcmd.adb
gcc/ada/init.c
gcc/ada/sigtramp-vxworks-target.inc
gcc/ada/tracebak.c

index 64c43fb3dadffa1e40ca48147e65dc471f8fce39..b7be5a5202b9c55d092515143632a9fd1c8fa443 100644 (file)
@@ -1,3 +1,16 @@
+2015-11-25  Jerome Lambourg  <lambourg@adacore.com>
+
+       * init.c: Enable the signal trampoline on x86_64-vx7
+       * sigtramp-vxworks-target.inc: Implement the signal trampoline
+       for x86_64
+       * tracebak.c: Remove the hook to use the generic
+       unwinder on x86_64-vx7.
+
+2015-11-25  Vincent Celier  <celier@adacore.com>
+
+       * gnatcmd.adb: When "gnat name -P" is called, invoke gprname
+       directly if available.
+
 2015-11-25  Tristan Gingold  <gingold@adacore.com>
 
        * init.c (__gnat_is_stack_guard): Do not use mach calls for
index dcc3a85f539ac9535716b9a89f8a2c33c17b77a0..df648319c5f6efed9bb15f1ac988aba3cbb94f8e 100644 (file)
@@ -63,6 +63,9 @@ procedure GNATCmd is
    Gprclean  : constant String := "gprclean";
    Gnatclean : constant String := "gnatclean";
 
+   Gprname  : constant String := "gprname";
+   Gnatname : constant String := "gnatname";
+
    Normal_Exit : exception;
    --  Raise this exception for normal program termination
 
@@ -1183,8 +1186,12 @@ begin
          --  If we want to invoke gnatmake/gnatclean with -P, then check if
          --  gprbuild/gprclean is available; if it is, use gprbuild/gprclean
          --  instead of gnatmake/gnatclean.
+         --  Ditto for gnatname -> gprname.
 
-         if Program.all = Gnatmake or else Program.all = Gnatclean then
+         if Program.all = Gnatmake
+            or else Program.all = Gnatclean
+            or else Program.all = Gnatname
+         then
             declare
                Project_File_Used : Boolean := False;
                Switch            : String_Access;
@@ -1209,6 +1216,11 @@ begin
                     and then Locate_Exec_On_Path (Gprclean) /= null
                   then
                      Program := new String'(Gprclean);
+
+                  elsif Program.all = Gnatname
+                    and then Locate_Exec_On_Path (Gprname) /= null
+                  then
+                     Program := new String'(Gprname);
                   end if;
                end if;
             end;
index 57b02a1475d2f31f5b442b19fb03b64adfd193b5..06e366d7856db54bde40409b6406f97f42bb4c50 100644 (file)
@@ -1974,7 +1974,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
   sigdelset (&mask, sig);
   sigprocmask (SIG_SETMASK, &mask, NULL);
 
-#if defined (__ARMEL__) || defined (__PPC__) || (defined (__i386__) && _WRS_VXWORKS_MAJOR < 7)
+#if defined (__ARMEL__) || defined (__PPC__) || defined (__i386__) || defined (__x86_64__)
   /* On certain targets, kernel mode, we process signals through a Call Frame
      Info trampoline, voiding the need for myriads of fallback_frame_state
      variants in the ZCX runtime.  We have no simple way to distinguish ZCX
@@ -1982,19 +1982,23 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
      necessary.  This only incurs a few extra instructions and a tiny
      amount of extra stack usage.  */
 
-#if defined (__i386__) && !defined (VTHREADS)
+#ifdef HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
+  /* We need to sometimes to adjust the PC in case of signals so that it
+     doesn't reference the exception that actually raised the signal but the
+     instruction before it. */
+  __gnat_adjust_context_for_raise (sig, sc);
+#endif
+
+#if defined (__i386__) && !defined (VTHREADS) && (__WRS_VXWORKS_MAJOR < 7)
    /* On x86, the vxsim signal context is subtly different and is processeed
-      by a handler compiled especially for vxsim.  */
+      by a handler compiled especially for vxsim.
+      Vxsim is not supported anymore on our vxworks-7 port. */
 
   if (is_vxsim)
     __gnat_vxsim_error_handler (sig, si, sc);
 #endif
 
-#ifdef HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
-  __gnat_adjust_context_for_raise (sig, sc);
-#endif
-
-#include "sigtramp.h"
+# include "sigtramp.h"
 
   __gnat_sigtramp (sig, (void *)si, (void *)sc,
                   (__sigtramphandler_t *)&__gnat_map_signal);
index f31594d68b955d31b086b7f6ca6c1b63dbfd026f..fbb708ba2cadd3c45bf06a77c4aa17df9766a4a5 100644 (file)
    the latter depends on the platform.
 */
 
+#elif defined (__x86_64__)
+
+/* These are the cfi colunm numbers */
+
+#define REGNO_RAX 0
+#define REGNO_RDX 1
+#define REGNO_RCX 2
+#define REGNO_RBX 3
+#define REGNO_RSI 4
+#define REGNO_RDI 5
+#define REGNO_RBP 6
+#define REGNO_RSP 7
+#define REGNO_R8 8
+#define REGNO_R9 9
+#define REGNO_R10 10
+#define REGNO_R11 11
+#define REGNO_R12 12
+#define REGNO_R13 13
+#define REGNO_R14 14
+#define REGNO_R15 15
+#define REGNO_SET_PC 16 /* aka %rip */
+#define REGNO_EFLAGS 49
+#define REGNO_FS 54
+
+#define FUNCTION "@function"
+
 #else
 Not_implemented;
 #endif /* REGNO constants */
@@ -174,6 +200,11 @@ Not_implemented;
 
 #define CFA_REG 7
 
+#elif defined (__x86_64__)
+
+/* R15 register */
+#define CFA_REG 15
+
 #else
 Not_implemented;
 #endif /* CFA setup block */
@@ -366,6 +397,52 @@ TCR("popl  %edi") \
 TCR("leave") \
 TCR("ret")
 
+#elif defined (__x86_64__)
+
+#define COMMON_CFI(REG) \
+  ".cfi_offset " S(REGNO_##REG) "," S(REG_##REG)
+#define PC_CFI(REG) \
+  ".cfi_offset " S(REGNO_##REG) "," S(REG_##REG)
+
+#define CFI_COMMON_REGS \
+CR("# CFI for common registers\n") \
+TCR(COMMON_CFI(R15)) \
+TCR(COMMON_CFI(R14)) \
+TCR(COMMON_CFI(R13)) \
+TCR(COMMON_CFI(R12)) \
+TCR(COMMON_CFI(R11)) \
+TCR(COMMON_CFI(R10)) \
+TCR(COMMON_CFI(R9)) \
+TCR(COMMON_CFI(R8)) \
+TCR(COMMON_CFI(RDI)) \
+TCR(COMMON_CFI(RSI)) \
+TCR(COMMON_CFI(RBP)) \
+TCR(COMMON_CFI(RSP)) \
+TCR(COMMON_CFI(RBX)) \
+TCR(COMMON_CFI(RDX)) \
+TCR(COMMON_CFI(RCX)) \
+TCR(COMMON_CFI(RAX)) \
+TCR(COMMON_CFI(EFLAGS)) \
+TCR(COMMON_CFI(SET_PC)) \
+TCR(COMMON_CFI(FS)) \
+TCR(".cfi_return_column " S(REGNO_SET_PC))
+
+/* Trampoline body block
+   ---------------------  */
+
+#define SIGTRAMP_BODY \
+CR("") \
+TCR("# Allocate frame and save the non-volatile") \
+TCR("# registers we're going to modify") \
+TCR("subq      $8, %rsp") \
+TCR("# Setup CFA_REG = context, which we'll retrieve as our CFA value") \
+TCR("movq      %r8, %r15") \
+TCR("# Call the real handler. The signo, siginfo and sigcontext") \
+TCR("# arguments are the same as those we received") \
+TCR("call      *%rcx") \
+TCR("# This part should never be executed") \
+TCR("ret")
+
 #else
 Not_implemented;
 #endif /* CFI_COMMON_REGS and SIGTRAMP_BODY */
index 3f40ae40c185cd5a75ea1eb127018062a79cabf4..ff85ca5baf5befac6132384c02bf9030b534daaf 100644 (file)
@@ -433,7 +433,7 @@ struct layout
    but our only alternative is the generic unwinder which requires
    compilation forcing a frame pointer to be reliable.  */
 
-#if (defined (__x86_64__) || defined (__linux__)) && !defined (__USING_SJLJ_EXCEPTIONS__) && !defined (__vxworks)
+#if (defined (__x86_64__) || defined (__linux__)) && !defined (__USING_SJLJ_EXCEPTIONS__)
 #define USE_GCC_UNWINDER
 #else
 #define USE_GENERIC_UNWINDER