[multiple changes]

2014-07-29  Doug Rupp  <rupp@adacore.com>

	* sigtramp-armvxw.c: Enhance to handle RTP trampolining.
	* init.c: Remove guard on sigtramp for ARM VxWorks RTP.

2014-07-29  Vincent Celier  <celier@adacore.com>

	* 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  <dewar@adacore.com>

	* gnat_ugn.texi: Minor documentation clarification.
	* switch-c.adb: Minor reformatting.

From-SVN: r213187
This commit is contained in:
Arnaud Charlet 2014-07-29 15:48:13 +02:00
parent 24d14b918a
commit 3808a9c729
5 changed files with 102 additions and 54 deletions

View File

@ -1,3 +1,19 @@
2014-07-29 Doug Rupp <rupp@adacore.com>
* sigtramp-armvxw.c: Enhance to handle RTP trampolining.
* init.c: Remove guard on sigtramp for ARM VxWorks RTP.
2014-07-29 Vincent Celier <celier@adacore.com>
* 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 <dewar@adacore.com>
* gnat_ugn.texi: Minor documentation clarification.
* switch-c.adb: Minor reformatting.
2014-07-29 Robert Dewar <dewar@adacore.com> 2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address): * sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address):

View File

@ -8567,8 +8567,8 @@ objects with pragma Initialize_Scalars.
The @var{xxx} ^string specified with the switch^option^ may be either The @var{xxx} ^string specified with the switch^option^ may be either
@itemize @bullet @itemize @bullet
@item ``@option{^in^INVALID^}'' requesting an invalid value where possible @item ``@option{^in^INVALID^}'' requesting an invalid value where possible
@item ``@option{^lo^LOW^}'' for the lowest possible value @item ``@option{^lo^LOW^}'' for the lowest possible value (all 0 bits)
@item ``@option{^hi^HIGH^}'' for the highest possible value @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 @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). value @code{16#@var{xx}#} (i.e., @var{xx} is a string of two hexadecimal digits).
@end itemize @end itemize

View File

@ -1703,7 +1703,9 @@ __gnat_install_handler ()
#include <signal.h> #include <signal.h>
#include <taskLib.h> #include <taskLib.h>
#ifndef __RTP__ #ifdef __RTP__
#include <base/b_ucontext_t.h>
#else
#include <intLib.h> #include <intLib.h>
#include <iv.h> #include <iv.h>
#endif #endif
@ -1911,7 +1913,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
sigdelset (&mask, sig); sigdelset (&mask, sig);
sigprocmask (SIG_SETMASK, &mask, NULL); 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 /* On PowerPC, kernel mode, we process signals through a Call Frame Info
trampoline, voiding the need for myriads of fallback_frame_state trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX variants in the ZCX runtime. We have no simple way to distinguish ZCX

View File

@ -38,7 +38,12 @@
#include <vxWorks.h> #include <vxWorks.h>
#include <arch/../regs.h> #include <arch/../regs.h>
#ifndef __RTP__
#include <sigLib.h> #include <sigLib.h>
#else
#include <signal.h>
#include <base/b_ucontext_t.h>
#endif
/* ---------------------- /* ----------------------
-- General comments -- -- General comments --
@ -47,29 +52,29 @@
Stubs are generated from toplevel asms and .cfi directives, much simpler Stubs are generated from toplevel asms and .cfi directives, much simpler
to use and check for correctness than manual encodings of CFI byte to use and check for correctness than manual encodings of CFI byte
sequences. The general idea is to establish CFA as sigcontext->sc_pregs 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 As of today, we support a stub providing CFI info for common
registers (GPRs, LR, ...). We might need variants with support for floating registers (GPRs, LR, ...). We might need variants with support for floating
point or altivec registers as well at some point. point or altivec registers as well at some point.
Checking which variant should apply and getting at sc_pregs is simpler Checking which variant should apply and getting at sc_pregs / mcontext
to express in C (we can't use offsetof in toplevel asms and hardcoding is simpler to express in C (we can't use offsetof in toplevel asms and
constants is not workable with the flurry of VxWorks variants), so this hardcoding constants is not workable with the flurry of VxWorks variants),
is the choice for our toplevel interface. so this is the choice for our toplevel interface.
Note that the registers we "restore" here are those to which we have Note that the registers we "restore" here are those to which we have
direct access through the system sigcontext structure, which includes direct access through the system sigcontext structure, which includes
only a partial set of the non-volatiles ABI-wise. */ 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 Eventhough our symbols will remain local, the prototype claims "extern"
symbols will remain local, the prototype claims "extern" and not and not "static" to prevent compiler complaints about a symbol used but
"static" to prevent compiler complaints about a symbol used but never never defined. */
defined. */
/* sigtramp stub providing CFI info for common registers. */ /* 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, void __gnat_sigtramp (int signo, void *si, void *sc,
__sigtramphandler_t * handler) __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; struct sigcontext * sctx = (struct sigcontext *) sc;
__gnat_sigtramp_common (signo, si, sctx, handler, sctx->sc_pregs); __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("# registers we're going to modify") \
TCR("mov ip, sp") \ TCR("mov ip, sp") \
TCR("stmfd sp!, {r"S(CFA_REG)", fp, ip, lr, pc}") \ 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("ldr r"S(CFA_REG)", [ip]") \
TCR("") \ TCR("") \
TCR("# Call the real handler. The signo, siginfo and sigcontext") \ TCR("# Call the real handler. The signo, siginfo and sigcontext") \

View File

@ -38,6 +38,7 @@ with Warnsw; use Warnsw;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with System.WCh_Con; use System.WCh_Con; with System.WCh_Con; use System.WCh_Con;
with System.OS_Lib;
package body Switch.C is package body Switch.C is
@ -207,54 +208,70 @@ package body Switch.C is
or else Switch_Chars (Ptr + 3) /= '=' or else Switch_Chars (Ptr + 3) /= '='
then then
Osint.Fail ("missing path for --RTS"); Osint.Fail ("missing path for --RTS");
else else
-- Check that this is the first time --RTS is specified or if declare
-- it is not the first time, the same path has been specified. Runtime_Dir : String_Access;
if RTS_Specified = null then begin
RTS_Specified := new String'(Switch_Chars (Ptr + 4 .. Max)); 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 else
RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max) Runtime_Dir :=
then new String'(Switch_Chars (Ptr + 4 .. Max));
Osint.Fail ("--RTS cannot be specified multiple times"); end if;
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; if RTS_Specified = null then
Opt.RTS_Switch := True; RTS_Specified := Runtime_Dir;
RTS_Src_Path_Name := elsif RTS_Specified.all /= Runtime_Dir.all then
Get_RTS_Search_Dir Osint.Fail ("--RTS cannot be specified multiple times");
(Switch_Chars (Ptr + 4 .. Max), Include); end if;
RTS_Lib_Path_Name := -- Valid --RTS switch
Get_RTS_Search_Dir
(Switch_Chars (Ptr + 4 .. Max), Objects);
if RTS_Src_Path_Name /= null Opt.No_Stdinc := True;
and then RTS_Lib_Path_Name /= null Opt.RTS_Switch := True;
then
-- Store the -fRTS switch (Note: Store_Compilation_Switch
-- changes -fRTS back into --RTS for the actual output).
Store_Compilation_Switch (Switch_Chars); RTS_Src_Path_Name :=
Get_RTS_Search_Dir (Runtime_Dir.all, Include);
elsif RTS_Src_Path_Name = null RTS_Lib_Path_Name :=
and then RTS_Lib_Path_Name = null Get_RTS_Search_Dir (Runtime_Dir.all, Objects);
then
Osint.Fail ("RTS path not valid: missing " &
"adainclude and adalib directories");
elsif RTS_Src_Path_Name = null then if RTS_Src_Path_Name /= null
Osint.Fail ("RTS path not valid: missing " & and then RTS_Lib_Path_Name /= null
"adainclude directory"); 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 Store_Compilation_Switch (Switch_Chars);
Osint.Fail ("RTS path not valid: missing " &
"adalib directory"); elsif RTS_Src_Path_Name = null
end if; 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; end if;
-- There are no other switches not starting with -gnat -- There are no other switches not starting with -gnat
@ -363,7 +380,7 @@ package body Switch.C is
if C = 'b' if C = 'b'
and then (Ptr /= First_Ptr + 1 and then (Ptr /= First_Ptr + 1
or else not First_Switch) or else not First_Switch)
then then
Osint.Fail Osint.Fail
("-gnatd.b must be first if combined " ("-gnatd.b must be first if combined "