[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>
* 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
@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

View File

@ -1703,7 +1703,9 @@ __gnat_install_handler ()
#include <signal.h>
#include <taskLib.h>
#ifndef __RTP__
#ifdef __RTP__
#include <base/b_ucontext_t.h>
#else
#include <intLib.h>
#include <iv.h>
#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

View File

@ -38,7 +38,12 @@
#include <vxWorks.h>
#include <arch/../regs.h>
#ifndef __RTP__
#include <sigLib.h>
#else
#include <signal.h>
#include <base/b_ucontext_t.h>
#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") \

View File

@ -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,16 +208,33 @@ 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;
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)));
else
Runtime_Dir :=
new String'(Switch_Chars (Ptr + 4 .. Max));
end if;
-- Check that this is the first time --RTS is specified
-- or if it is not the first time, the same path has been
-- specified.
if RTS_Specified = null then
RTS_Specified := new String'(Switch_Chars (Ptr + 4 .. Max));
RTS_Specified := Runtime_Dir;
elsif
RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max)
then
elsif RTS_Specified.all /= Runtime_Dir.all then
Osint.Fail ("--RTS cannot be specified multiple times");
end if;
@ -226,12 +244,10 @@ package body Switch.C is
Opt.RTS_Switch := True;
RTS_Src_Path_Name :=
Get_RTS_Search_Dir
(Switch_Chars (Ptr + 4 .. Max), Include);
Get_RTS_Search_Dir (Runtime_Dir.all, Include);
RTS_Lib_Path_Name :=
Get_RTS_Search_Dir
(Switch_Chars (Ptr + 4 .. Max), Objects);
Get_RTS_Search_Dir (Runtime_Dir.all, Objects);
if RTS_Src_Path_Name /= null
and then RTS_Lib_Path_Name /= null
@ -244,17 +260,18 @@ package body Switch.C is
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");
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");
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");
Osint.Fail ("RTS path not valid: missing "
& "adalib directory");
end if;
end;
end if;
-- There are no other switches not starting with -gnat