[multiple changes]

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
This commit is contained in:
Arnaud Charlet 2015-11-25 16:09:38 +01:00
parent d75a7b1f32
commit ccaca7e9f0
5 changed files with 116 additions and 10 deletions

View 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

View 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;

View 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);

View File

@ -139,6 +139,32 @@
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 */

View 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