Commit 6350cb2a by Pierre-Marie de Rodat

[multiple changes]

2017-11-09  Piotr Trojanek  <trojanek@adacore.com>

	* lib-xref-spark_specific.adb (Add_SPARK_Xrefs): Ignore loop parameters
	in expression funtions that are expanded into variables.

2017-11-09  Piotr Trojanek  <trojanek@adacore.com>

	* sem_util.adb: Minor whitespace cleanup.

2017-11-09  Jerome Lambourg  <lambourg@adacore.com>

	* libgnarl/s-taprop__qnx.adb: Refine aarch64-qnx. Use the POSIX
	s-taprop version rather than a custom one.
	* sigtramp-qnx.c (aarch64-qnx): Implement the signal trampoline.

From-SVN: r254563
parent 136ca74e
2017-11-09 Piotr Trojanek <trojanek@adacore.com>
* lib-xref-spark_specific.adb (Add_SPARK_Xrefs): Ignore loop parameters
in expression funtions that are expanded into variables.
2017-11-09 Piotr Trojanek <trojanek@adacore.com>
* sem_util.adb: Minor whitespace cleanup.
2017-11-09 Jerome Lambourg <lambourg@adacore.com>
* libgnarl/s-taprop__qnx.adb: Refine aarch64-qnx. Use the POSIX
s-taprop version rather than a custom one.
* sigtramp-qnx.c (aarch64-qnx): Implement the signal trampoline.
2017-11-08 Piotr Trojanek <trojanek@adacore.com> 2017-11-08 Piotr Trojanek <trojanek@adacore.com>
* lib-xref.ads, lib-xref-spark_specific.adb * lib-xref.ads, lib-xref-spark_specific.adb
......
...@@ -608,9 +608,11 @@ package body SPARK_Specific is ...@@ -608,9 +608,11 @@ package body SPARK_Specific is
-- the analysis of the expanded body. We don't lose any globals -- the analysis of the expanded body. We don't lose any globals
-- by discarding them, because such loop parameters can only be -- by discarding them, because such loop parameters can only be
-- accessed locally from within the expression function body. -- accessed locally from within the expression function body.
-- Note: some loop parameters are expanded into variables; they
-- also must be ignored.
and then not and then not
(Ekind (Ref.Ent) = E_Loop_Parameter (Ekind_In (Ref.Ent, E_Loop_Parameter, E_Variable)
and then Scope_Within and then Scope_Within
(Ref.Ent, Unique_Entity (Ref.Ref_Scope)) (Ref.Ent, Unique_Entity (Ref.Ref_Scope))
and then Is_Expression_Function (Ref.Ref_Scope)) and then Is_Expression_Function (Ref.Ref_Scope))
......
...@@ -19536,9 +19536,9 @@ package body Sem_Util is ...@@ -19536,9 +19536,9 @@ package body Sem_Util is
N : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char); N : constant Entity_Id := Make_Temporary (Sloc_Value, Id_Char);
begin begin
Set_Ekind (N, Kind); Set_Ekind (N, Kind);
Set_Is_Internal (N, True); Set_Is_Internal (N, True);
Append_Entity (N, Scope_Id); Append_Entity (N, Scope_Id);
if Kind in Type_Kind then if Kind in Type_Kind then
Init_Size_Align (N); Init_Size_Align (N);
......
...@@ -74,14 +74,14 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext, ...@@ -74,14 +74,14 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext,
/* Trampoline body block /* Trampoline body block
--------------------- */ --------------------- */
#define COMMON_CFI(REG) \
".cfi_offset " S(REGNO_##REG) "," S(REG_OFFSET_##REG)
#ifdef __x86_64__ #ifdef __x86_64__
/***************************************** /*****************************************
* x86-64 * * x86-64 *
*****************************************/ *****************************************/
#define COMMON_CFI(REG) \
".cfi_offset " S(REGNO_##REG) "," S(REG_##REG)
// CFI register numbers // CFI register numbers
#define REGNO_RAX 0 #define REGNO_RAX 0
#define REGNO_RDX 1 #define REGNO_RDX 1
...@@ -98,27 +98,27 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext, ...@@ -98,27 +98,27 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext,
#define REGNO_R12 12 #define REGNO_R12 12
#define REGNO_R13 13 #define REGNO_R13 13
#define REGNO_R14 14 #define REGNO_R14 14
#define REGNO_R15 15 #define REGNO_R15 15 /* Used as CFA */
#define REGNO_RPC 16 /* aka %rip */ #define REGNO_RPC 16 /* aka %rip */
// Registers offset from the regset structure // Registers offset from the regset structure
#define REG_RDI 0x00 #define REG_OFFSET_RDI 0x00
#define REG_RSI 0x08 #define REG_OFFSET_RSI 0x08
#define REG_RDX 0x10 #define REG_OFFSET_RDX 0x10
#define REG_R10 0x18 #define REG_OFFSET_R10 0x18
#define REG_R8 0x20 #define REG_OFFSET_R8 0x20
#define REG_R9 0x28 #define REG_OFFSET_R9 0x28
#define REG_RAX 0x30 #define REG_OFFSET_RAX 0x30
#define REG_RBX 0x38 #define REG_OFFSET_RBX 0x38
#define REG_RBP 0x40 #define REG_OFFSET_RBP 0x40
#define REG_RCX 0x48 #define REG_OFFSET_RCX 0x48
#define REG_R11 0x50 #define REG_OFFSET_R11 0x50
#define REG_R12 0x58 #define REG_OFFSET_R12 0x58
#define REG_R13 0x60 #define REG_OFFSET_R13 0x60
#define REG_R14 0x68 #define REG_OFFSET_R14 0x68
#define REG_R15 0x70 #define REG_OFFSET_R15 0x70
#define REG_RPC 0x78 /* RIP */ #define REG_OFFSET_RPC 0x78 /* RIP */
#define REG_RSP 0x90 #define REG_OFFSET_RSP 0x90
#define CFI_COMMON_REGS \ #define CFI_COMMON_REGS \
CR("# CFI for common registers\n") \ CR("# CFI for common registers\n") \
...@@ -163,47 +163,20 @@ TCR("ret") ...@@ -163,47 +163,20 @@ TCR("ret")
* Aarch64 * * Aarch64 *
*****************************************/ *****************************************/
#define UC_MCONTEXT_SS 16 /* CFA reg: any callee saved register will do */
#define CFA_REG 19 #define CFA_REG 19
#define BASE_REG 20
#define DW_CFA_def_cfa 0x0c
#define DW_CFA_expression 0x10
#define DW_OP_breg(n) 0x70+(n)
#define REG_REGNO_GR(n) n /* General purpose registers */
#define REG_REGNO_PC 30 #define REG_OFFSET_GR(n) (n * 8)
#define REGNO_GR(n) n
/* The first byte of the SLEB128 value of the offset. */ /* point to the ELR value of the mcontext registers list */
#define REG_OFFSET_GR(n) (UC_MCONTEXT_SS + n * 8) #define REG_OFFSET_ELR (32 * 8)
#define REG_OFFSET_LONG_GR(n) (UC_MCONTEXT_SS + n * 8 + 128) #define REGNO_PC 30
#define REG_OFFSET_LONG128_GR(n) (UC_MCONTEXT_SS + (n - 16) * 8 + 128)
#define REG_OFFSET_LONG256_GR(n) (UC_MCONTEXT_SS + (n - 32) * 8 + 128)
#define REG_OFFSET_LONG256_PC REG_OFFSET_LONG256_GR(32)
#define CFI_DEF_CFA \ #define CFI_DEF_CFA \
TCR(".cfi_def_cfa " S(CFA_REG) ", 0") TCR(".cfi_def_cfa " S(CFA_REG) ", 0")
/* We need 4 variants depending on the offset: 0+, 64+, 128+, 256+. */
#define COMMON_CFI(REG) \
".cfi_escape " S(DW_CFA_expression) "," S(REG_REGNO_##REG) ",2," \
S(DW_OP_breg(BASE_REG)) "," S(REG_OFFSET_##REG)
#define COMMON_LONG_CFI(REG) \
".cfi_escape " S(DW_CFA_expression) "," S(REG_REGNO_##REG) ",3," \
S(DW_OP_breg(BASE_REG)) "," S(REG_OFFSET_LONG_##REG) ",0"
#define COMMON_LONG128_CFI(REG) \
".cfi_escape " S(DW_CFA_expression) "," S(REG_REGNO_##REG) ",3," \
S(DW_OP_breg(BASE_REG)) "," S(REG_OFFSET_LONG128_##REG) ",1"
#define COMMON_LONG256_CFI(REG) \
".cfi_escape " S(DW_CFA_expression) "," S(REG_REGNO_##REG) ",3," \
S(DW_OP_breg(BASE_REG)) "," S(REG_OFFSET_LONG256_##REG) ",2"
#define CFI_COMMON_REGS \ #define CFI_COMMON_REGS \
CR("# CFI for common registers\n") \ CR("# CFI for common registers\n") \
TCR(COMMON_CFI(GR(0))) \ TCR(COMMON_CFI(GR(0))) \
...@@ -212,48 +185,47 @@ TCR("ret") ...@@ -212,48 +185,47 @@ TCR("ret")
TCR(COMMON_CFI(GR(3))) \ TCR(COMMON_CFI(GR(3))) \
TCR(COMMON_CFI(GR(4))) \ TCR(COMMON_CFI(GR(4))) \
TCR(COMMON_CFI(GR(5))) \ TCR(COMMON_CFI(GR(5))) \
TCR(COMMON_LONG_CFI(GR(6))) \ TCR(COMMON_CFI(GR(6))) \
TCR(COMMON_LONG_CFI(GR(7))) \ TCR(COMMON_CFI(GR(7))) \
TCR(COMMON_LONG_CFI(GR(8))) \ TCR(COMMON_CFI(GR(8))) \
TCR(COMMON_LONG_CFI(GR(9))) \ TCR(COMMON_CFI(GR(9))) \
TCR(COMMON_LONG_CFI(GR(10))) \ TCR(COMMON_CFI(GR(10))) \
TCR(COMMON_LONG_CFI(GR(11))) \ TCR(COMMON_CFI(GR(11))) \
TCR(COMMON_LONG_CFI(GR(12))) \ TCR(COMMON_CFI(GR(12))) \
TCR(COMMON_LONG_CFI(GR(13))) \ TCR(COMMON_CFI(GR(13))) \
TCR(COMMON_LONG128_CFI(GR(14))) \ TCR(COMMON_CFI(GR(14))) \
TCR(COMMON_LONG128_CFI(GR(15))) \ TCR(COMMON_CFI(GR(15))) \
TCR(COMMON_LONG128_CFI(GR(16))) \ TCR(COMMON_CFI(GR(16))) \
TCR(COMMON_LONG128_CFI(GR(17))) \ TCR(COMMON_CFI(GR(17))) \
TCR(COMMON_LONG128_CFI(GR(18))) \ TCR(COMMON_CFI(GR(18))) \
TCR(COMMON_LONG128_CFI(GR(19))) \ TCR(COMMON_CFI(GR(19))) \
TCR(COMMON_LONG128_CFI(GR(20))) \ TCR(COMMON_CFI(GR(20))) \
TCR(COMMON_LONG128_CFI(GR(21))) \ TCR(COMMON_CFI(GR(21))) \
TCR(COMMON_LONG128_CFI(GR(22))) \ TCR(COMMON_CFI(GR(22))) \
TCR(COMMON_LONG128_CFI(GR(23))) \ TCR(COMMON_CFI(GR(23))) \
TCR(COMMON_LONG128_CFI(GR(24))) \ TCR(COMMON_CFI(GR(24))) \
TCR(COMMON_LONG128_CFI(GR(25))) \ TCR(COMMON_CFI(GR(25))) \
TCR(COMMON_LONG128_CFI(GR(26))) \ TCR(COMMON_CFI(GR(26))) \
TCR(COMMON_LONG128_CFI(GR(27))) \ TCR(COMMON_CFI(GR(27))) \
TCR(COMMON_LONG128_CFI(GR(28))) \ TCR(COMMON_CFI(GR(28))) \
TCR(COMMON_LONG128_CFI(GR(29))) \ TCR(COMMON_CFI(GR(29))) \
TCR(COMMON_LONG256_CFI(PC)) TCR(".cfi_offset " S(REGNO_PC) "," S(REG_OFFSET_ELR)) \
TCR(".cfi_return_column " S(REGNO_PC))
#define SIGTRAMP_BODY \ #define SIGTRAMP_BODY \
CFI_DEF_CFA \ CFI_DEF_CFA \
CFI_COMMON_REGS \ CFI_COMMON_REGS \
TCR("# Push FP and LR on stack") \ TCR("# Push FP and LR on stack") \
TCR("stp x29, x30, [sp, #-32]!") \ TCR("stp x29, x30, [sp, #-16]!") \
TCR("stp x" S(CFA_REG) ", x" S(BASE_REG) ", [sp, #16]") \ TCR("# Push CFA register on stack") \
TCR("mov x29, sp") \ TCR("str x" S(CFA_REG) ", [sp, #-8]!" \
TCR("# Load the saved value of the stack pointer as CFA") \ TCR("# Set the CFA register to x2 value") \
TCR("ldr x" S(CFA_REG) ", [x2, #" S(REG_OFFSET_GR(31)) "]") \ TCR("mov x" S(CFA_REG) ", x2") \
TCR("# Use x" S(BASE_REG) " as base register for the CFI") \
TCR("mov x" S(BASE_REG) ", x2") \
TCR("# Call the handler") \ TCR("# Call the handler") \
TCR("blr x3") \ TCR("blr x3") \
TCR("# Release our frame and return (should never get here!).") \ TCR("# Release our frame and return (should never get here!).") \
TCR("ldp x" S(CFA_REG) ", x" S(BASE_REG)" , [sp, #16]") \ TCR("ldr x" S(CFA_REG) " , [sp], 8") \
TCR("ldp x29, x30, [sp], 32") \ TCR("ldp x29, x30, [sp], 16") \
TCR("ret") TCR("ret")
#endif /* AARCH64 */ #endif /* AARCH64 */
......
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