From 3808a9c7296e110a2ba0b40248445f043547b826 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 29 Jul 2014 15:48:13 +0200 Subject: [PATCH] [multiple changes] 2014-07-29 Doug Rupp * sigtramp-armvxw.c: Enhance to handle RTP trampolining. * init.c: Remove guard on sigtramp for ARM VxWorks RTP. 2014-07-29 Vincent Celier * switch-c.adb (Scan_Front_End_Switches): Do not fail when two runtime directorie specified with two switches --RTS= designate the same directory, even when there are no literarily the same. 2014-07-29 Robert Dewar * gnat_ugn.texi: Minor documentation clarification. * switch-c.adb: Minor reformatting. From-SVN: r213187 --- gcc/ada/ChangeLog | 16 +++++++ gcc/ada/gnat_ugn.texi | 4 +- gcc/ada/init.c | 6 ++- gcc/ada/sigtramp-armvxw.c | 39 +++++++++++------ gcc/ada/switch-c.adb | 91 +++++++++++++++++++++++---------------- 5 files changed, 102 insertions(+), 54 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4c977791553..8ce008efa95 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2014-07-29 Doug Rupp + + * sigtramp-armvxw.c: Enhance to handle RTP trampolining. + * init.c: Remove guard on sigtramp for ARM VxWorks RTP. + +2014-07-29 Vincent Celier + + * switch-c.adb (Scan_Front_End_Switches): Do not fail when two + runtime directorie specified with two switches --RTS= designate + the same directory, even when there are no literarily the same. + +2014-07-29 Robert Dewar + + * gnat_ugn.texi: Minor documentation clarification. + * switch-c.adb: Minor reformatting. + 2014-07-29 Robert Dewar * sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address): diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index e6cc74da608..169233834df 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -8567,8 +8567,8 @@ objects with pragma Initialize_Scalars. The @var{xxx} ^string specified with the switch^option^ may be either @itemize @bullet @item ``@option{^in^INVALID^}'' requesting an invalid value where possible -@item ``@option{^lo^LOW^}'' for the lowest possible value -@item ``@option{^hi^HIGH^}'' for the highest possible value +@item ``@option{^lo^LOW^}'' for the lowest possible value (all 0 bits) +@item ``@option{^hi^HIGH^}'' for the highest possible value (all 1 bits) @item ``@option{@var{xx}}'' for a value consisting of repeated bytes with the value @code{16#@var{xx}#} (i.e., @var{xx} is a string of two hexadecimal digits). @end itemize diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 587638ba148..41156cecd1e 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -1703,7 +1703,9 @@ __gnat_install_handler () #include #include -#ifndef __RTP__ +#ifdef __RTP__ +#include +#else #include #include #endif @@ -1911,7 +1913,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(_WRS_KERNEL) +#if defined (__ARMEL__) || (defined (__PPC__) && defined (_WRS_KERNEL)) /* On PowerPC, 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 diff --git a/gcc/ada/sigtramp-armvxw.c b/gcc/ada/sigtramp-armvxw.c index cbe774ff607..0cef508908e 100644 --- a/gcc/ada/sigtramp-armvxw.c +++ b/gcc/ada/sigtramp-armvxw.c @@ -38,7 +38,12 @@ #include #include +#ifndef __RTP__ #include +#else +#include +#include +#endif /* ---------------------- -- General comments -- @@ -47,29 +52,29 @@ Stubs are generated from toplevel asms and .cfi directives, much simpler to use and check for correctness than manual encodings of CFI byte sequences. The general idea is to establish CFA as sigcontext->sc_pregs - and state where to find the registers as offsets from there. + (for DKM) and mcontext (for RTP) and state where to find the registers as + offsets from there. As of today, we support a stub providing CFI info for common registers (GPRs, LR, ...). We might need variants with support for floating point or altivec registers as well at some point. - Checking which variant should apply and getting at sc_pregs is simpler - to express in C (we can't use offsetof in toplevel asms and hardcoding - constants is not workable with the flurry of VxWorks variants), so this - is the choice for our toplevel interface. + Checking which variant should apply and getting at sc_pregs / mcontext + is simpler to express in C (we can't use offsetof in toplevel asms and + hardcoding constants is not workable with the flurry of VxWorks variants), + so this is the choice for our toplevel interface. Note that the registers we "restore" here are those to which we have direct access through the system sigcontext structure, which includes only a partial set of the non-volatiles ABI-wise. */ -/* ----------------------------------------- - -- Protypes for our internal asm stubs -- - ----------------------------------------- +/* ------------------------------------------- + -- Prototypes for our internal asm stubs -- + ------------------------------------------- - SC_PREGS is always expected to be SIGCONTEXT->sc_pregs. Eventhough our - symbols will remain local, the prototype claims "extern" and not - "static" to prevent compiler complaints about a symbol used but never - defined. */ + Eventhough our symbols will remain local, the prototype claims "extern" + and not "static" to prevent compiler complaints about a symbol used but + never defined. */ /* sigtramp stub providing CFI info for common registers. */ @@ -91,9 +96,17 @@ void __gnat_sigtramp (int signo, void *si, void *sc, void __gnat_sigtramp (int signo, void *si, void *sc, __sigtramphandler_t * handler) { +#ifdef __RTP__ + mcontext_t *mcontext = &((ucontext_t *) sc)->uc_mcontext; + + /* Pass MCONTEXT in the fifth position so that the assembly code can find + it at the same stack location or in the same register as SC_PREGS. */ + __gnat_sigtramp_common (signo, si, mcontext, handler, mcontext); +#else struct sigcontext * sctx = (struct sigcontext *) sc; __gnat_sigtramp_common (signo, si, sctx, handler, sctx->sc_pregs); +#endif } @@ -199,7 +212,7 @@ TCR("# Allocate frame and save the non-volatile") \ TCR("# registers we're going to modify") \ TCR("mov ip, sp") \ TCR("stmfd sp!, {r"S(CFA_REG)", fp, ip, lr, pc}") \ -TCR("# Setup CFA_REG = sc_pregs, that we'll retrieve as our CFA value") \ +TCR("# Setup CFA_REG = context, which we'll retrieve as our CFA value") \ TCR("ldr r"S(CFA_REG)", [ip]") \ TCR("") \ TCR("# Call the real handler. The signo, siginfo and sigcontext") \ diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 04a6fa188f3..76b4c5d8001 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -38,6 +38,7 @@ with Warnsw; use Warnsw; with Ada.Unchecked_Deallocation; with System.WCh_Con; use System.WCh_Con; +with System.OS_Lib; package body Switch.C is @@ -207,54 +208,70 @@ package body Switch.C is or else Switch_Chars (Ptr + 3) /= '=' then Osint.Fail ("missing path for --RTS"); + else - -- Check that this is the first time --RTS is specified or if - -- it is not the first time, the same path has been specified. + declare + Runtime_Dir : String_Access; - if RTS_Specified = null then - RTS_Specified := new String'(Switch_Chars (Ptr + 4 .. Max)); + begin + if System.OS_Lib.Is_Absolute_Path + (Switch_Chars (Ptr + 4 .. Max)) + then + Runtime_Dir := + new String' + (System.OS_Lib.Normalize_Pathname + (Switch_Chars (Ptr + 4 .. Max))); - elsif - RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max) - then - Osint.Fail ("--RTS cannot be specified multiple times"); - end if; + else + Runtime_Dir := + new String'(Switch_Chars (Ptr + 4 .. Max)); + end if; - -- Valid --RTS switch + -- Check that this is the first time --RTS is specified + -- or if it is not the first time, the same path has been + -- specified. - Opt.No_Stdinc := True; - Opt.RTS_Switch := True; + if RTS_Specified = null then + RTS_Specified := Runtime_Dir; - RTS_Src_Path_Name := - Get_RTS_Search_Dir - (Switch_Chars (Ptr + 4 .. Max), Include); + elsif RTS_Specified.all /= Runtime_Dir.all then + Osint.Fail ("--RTS cannot be specified multiple times"); + end if; - RTS_Lib_Path_Name := - Get_RTS_Search_Dir - (Switch_Chars (Ptr + 4 .. Max), Objects); + -- Valid --RTS switch - if RTS_Src_Path_Name /= null - and then RTS_Lib_Path_Name /= null - then - -- Store the -fRTS switch (Note: Store_Compilation_Switch - -- changes -fRTS back into --RTS for the actual output). + Opt.No_Stdinc := True; + Opt.RTS_Switch := True; - Store_Compilation_Switch (Switch_Chars); + RTS_Src_Path_Name := + Get_RTS_Search_Dir (Runtime_Dir.all, Include); - elsif RTS_Src_Path_Name = null - and then RTS_Lib_Path_Name = null - then - Osint.Fail ("RTS path not valid: missing " & - "adainclude and adalib directories"); + RTS_Lib_Path_Name := + Get_RTS_Search_Dir (Runtime_Dir.all, Objects); - elsif RTS_Src_Path_Name = null then - Osint.Fail ("RTS path not valid: missing " & - "adainclude directory"); + if RTS_Src_Path_Name /= null + and then RTS_Lib_Path_Name /= null + then + -- Store the -fRTS switch (Note: Store_Compilation_Switch + -- changes -fRTS back into --RTS for the actual output). - elsif RTS_Lib_Path_Name = null then - Osint.Fail ("RTS path not valid: missing " & - "adalib directory"); - end if; + Store_Compilation_Switch (Switch_Chars); + + elsif RTS_Src_Path_Name = null + and then RTS_Lib_Path_Name = null + then + Osint.Fail ("RTS path not valid: missing " + & "adainclude and adalib directories"); + + elsif RTS_Src_Path_Name = null then + Osint.Fail ("RTS path not valid: missing " + & "adainclude directory"); + + elsif RTS_Lib_Path_Name = null then + Osint.Fail ("RTS path not valid: missing " + & "adalib directory"); + end if; + end; end if; -- There are no other switches not starting with -gnat @@ -363,7 +380,7 @@ package body Switch.C is if C = 'b' and then (Ptr /= First_Ptr + 1 - or else not First_Switch) + or else not First_Switch) then Osint.Fail ("-gnatd.b must be first if combined " -- 2.30.2