This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adjust stack checking on VxWorks


Recent stack checking issues on non-mainstream platforms made me investigate 
its status on the various VxWorks ports that are in the tree and realize that 
it is in a somewhat inconsistent state.  The attached patch fixes it and makes 
it more efficient, at least in RTP mode; it only affects the Ada compiler.

Built and tested for the affected ports, applied on the mainline.


2016-03-13  Eric Botcazou  <ebotcazou@adacore.com>

	* config/arm/vxworks.h (STACK_CHECK_STATIC_BUILTIN): Define.
	(STACK_CHECK_PROTECT): Likewise.
	* config/i386/vxworks.h (STACK_CHECK_STATIC_BUILTIN): Likewise
	(STACK_CHECK_PROTECT): Likewise.
	* config/rs6000/vxworks.h (STACK_CHECK_STATIC_BUILTIN): Likewise
	(STACK_CHECK_PROTECT): Likewise.
	* config/rs6000/vxworksae.h (STACK_CHECK_PROTECT): Likewise.
	* config/sparc/vxworks.h (STACK_CHECK_STATIC_BUILTIN): Likewise.
	(STACK_CHECK_PROTECT): Likewise.

ada/

2016-03-13  Eric Botcazou  <ebotcazou@adacore.com>

	* system-vxworks-m68k.ads (Stack_Check_Probes): Set to True.
	(Stack_Check_Limits): Set to False.
	* system-vxworks-mips.ads (Stack_Check_Probes): Set to True.
	(Stack_Check_Limits): Set to False.
	* system-vxworks-ppc.ads (Stack_Check_Probes): Set to True.
	(Stack_Check_Limits): Set to False.
	* system-vxworks-sparcv9.ads (Stack_Check_Probes): Set to True.
	(Stack_Check_Limits): Set to False.
	* system-vxworks-x86.ads (Stack_Check_Probes): Set to True.
	(Stack_Check_Limits): Set to False.

-- 
Eric Botcazou
Index: ada/system-vxworks-m68k.ads
===================================================================
--- ada/system-vxworks-m68k.ads	(revision 234160)
+++ ada/system-vxworks-m68k.ads	(working copy)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                          (VxWorks version M68K)                          --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -145,8 +145,8 @@ private
    Preallocated_Stacks       : constant Boolean := False;
    Signed_Zeros              : constant Boolean := False;
    Stack_Check_Default       : constant Boolean := False;
-   Stack_Check_Probes        : constant Boolean := False;
-   Stack_Check_Limits        : constant Boolean := True;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
    Support_Aggregates        : constant Boolean := True;
    Support_Composite_Assign  : constant Boolean := True;
    Support_Composite_Compare : constant Boolean := True;
Index: ada/system-vxworks-mips.ads
===================================================================
--- ada/system-vxworks-mips.ads	(revision 234160)
+++ ada/system-vxworks-mips.ads	(working copy)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                         (VxWorks Version Mips)                           --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -145,8 +145,8 @@ private
    Preallocated_Stacks       : constant Boolean := False;
    Signed_Zeros              : constant Boolean := True;
    Stack_Check_Default       : constant Boolean := False;
-   Stack_Check_Probes        : constant Boolean := False;
-   Stack_Check_Limits        : constant Boolean := True;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
    Support_Aggregates        : constant Boolean := True;
    Support_Composite_Assign  : constant Boolean := True;
    Support_Composite_Compare : constant Boolean := True;
Index: ada/system-vxworks-ppc.ads
===================================================================
--- ada/system-vxworks-ppc.ads	(revision 234160)
+++ ada/system-vxworks-ppc.ads	(working copy)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                         (VxWorks 5 Version PPC)                          --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -152,8 +152,8 @@ private
    Preallocated_Stacks       : constant Boolean := False;
    Signed_Zeros              : constant Boolean := True;
    Stack_Check_Default       : constant Boolean := False;
-   Stack_Check_Probes        : constant Boolean := False;
-   Stack_Check_Limits        : constant Boolean := True;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
    Support_Aggregates        : constant Boolean := True;
    Support_Composite_Assign  : constant Boolean := True;
    Support_Composite_Compare : constant Boolean := True;
Index: ada/system-vxworks-sparcv9.ads
===================================================================
--- ada/system-vxworks-sparcv9.ads	(revision 234160)
+++ ada/system-vxworks-sparcv9.ads	(working copy)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                       (VxWorks Version Sparc/64)                         --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -147,8 +147,8 @@ private
    Preallocated_Stacks       : constant Boolean := False;
    Signed_Zeros              : constant Boolean := True;
    Stack_Check_Default       : constant Boolean := False;
-   Stack_Check_Probes        : constant Boolean := False;
-   Stack_Check_Limits        : constant Boolean := True;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
    Support_Aggregates        : constant Boolean := True;
    Support_Composite_Assign  : constant Boolean := True;
    Support_Composite_Compare : constant Boolean := True;
Index: ada/system-vxworks-x86.ads
===================================================================
--- ada/system-vxworks-x86.ads	(revision 234160)
+++ ada/system-vxworks-x86.ads	(working copy)
@@ -7,7 +7,7 @@
 --                                 S p e c                                  --
 --                         (VxWorks 5 Version x86)                          --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -148,8 +148,8 @@ private
    Preallocated_Stacks       : constant Boolean := False;
    Signed_Zeros              : constant Boolean := True;
    Stack_Check_Default       : constant Boolean := False;
-   Stack_Check_Probes        : constant Boolean := False;
-   Stack_Check_Limits        : constant Boolean := True;
+   Stack_Check_Probes        : constant Boolean := True;
+   Stack_Check_Limits        : constant Boolean := False;
    Support_Aggregates        : constant Boolean := True;
    Support_Atomic_Primitives : constant Boolean := True;
    Support_Composite_Assign  : constant Boolean := True;
Index: config/arm/vxworks.h
===================================================================
--- config/arm/vxworks.h	(revision 234160)
+++ config/arm/vxworks.h	(working copy)
@@ -112,3 +112,10 @@ see the files COPYING3 and COPYING.RUNTI
 
 #undef TARGET_DEFAULT_WORD_RELOCATIONS
 #define TARGET_DEFAULT_WORD_RELOCATIONS 1
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* This platform supports the probing method of stack checking (RTP mode).
+   8K is reserved in the stack to propagate exceptions in case of overflow.  */
+#define STACK_CHECK_PROTECT 8192
Index: config/i386/vxworks.h
===================================================================
--- config/i386/vxworks.h	(revision 234160)
+++ config/i386/vxworks.h	(working copy)
@@ -88,3 +88,10 @@ along with GCC; see the file COPYING3.
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 
 #define IX86_MAYBE_NO_LIBGCC_TFMODE
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* This platform supports the probing method of stack checking (RTP mode).
+   8K is reserved in the stack to propagate exceptions in case of overflow.  */
+#define STACK_CHECK_PROTECT 8192
Index: config/rs6000/vxworks.h
===================================================================
--- config/rs6000/vxworks.h	(revision 234160)
+++ config/rs6000/vxworks.h	(working copy)
@@ -138,3 +138,10 @@ VXWORKS_ADDITIONAL_CPP_SPEC
 /* No _mcount profiling on VxWorks.  */
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* This platform supports the probing method of stack checking (RTP mode).
+   8K is reserved in the stack to propagate exceptions in case of overflow.  */
+#define STACK_CHECK_PROTECT 8192
Index: config/rs6000/vxworksae.h
===================================================================
--- config/rs6000/vxworksae.h	(revision 234160)
+++ config/rs6000/vxworksae.h	(working copy)
@@ -21,3 +21,8 @@ along with GCC; see the file COPYING3.
 /* VxWorksAE for E500V2 expects a specific CPU value to designate 8548.  */
 #undef VXCPU_FOR_8548
 #define VXCPU_FOR_8548 "PPCE500V2"
+
+/* This platform supports the probing method of stack checking and
+   requires 4K of space for executing a possible last chance handler.  */
+#undef STACK_CHECK_PROTECT
+#define STACK_CHECK_PROTECT 4096
Index: config/sparc/vxworks.h
===================================================================
--- config/sparc/vxworks.h	(revision 234160)
+++ config/sparc/vxworks.h	(working copy)
@@ -55,3 +55,10 @@ along with GCC; see the file COPYING3.
 /* We cannot use PC-relative accesses for VxWorks PIC because there is no
    fixed gap between segments.  */
 #undef ASM_PREFERRED_EH_DATA_FORMAT
+
+/* Define this to be nonzero if static stack checking is supported.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* This platform supports the probing method of stack checking (RTP mode).
+   8K is reserved in the stack to propagate exceptions in case of overflow.  */
+#define STACK_CHECK_PROTECT 8192

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]