This is the couple of testcases for the gnat.dg testsuite. They test for the
presence of the GNU-stack executable marker in the assembly file on Linux.
2016-07-04 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/trampoline3.adb: New test.
* gnat.dg/trampoline4.adb: Likewise.
--
Eric Botcazou
Index: testsuite/gnat.dg/trampoline3.adb
===================================================================
--- testsuite/gnat.dg/trampoline3.adb (revision 0)
+++ testsuite/gnat.dg/trampoline3.adb (working copy)
@@ -0,0 +1,22 @@
+-- { dg-do compile { target *-*-linux* } }
+-- { dg-options "-gnatws" }
+
+procedure Trampoline3 is
+
+ A : Integer;
+
+ type FuncPtr is access function (I : Integer) return Integer;
+
+ function F (I : Integer) return Integer is
+ begin
+ return A + I;
+ end F;
+
+ P : FuncPtr := F'Access;
+ I : Integer;
+
+begin
+ I := P(0);
+end;
+
+-- { dg-final { scan-assembler-not "GNU-stack.*x" } }
Index: testsuite/gnat.dg/trampoline4.adb
===================================================================
--- testsuite/gnat.dg/trampoline4.adb (revision 0)
+++ testsuite/gnat.dg/trampoline4.adb (working copy)
@@ -0,0 +1,23 @@
+-- { dg-do compile { target *-*-linux* } }
+-- { dg-options "-ftrampolines -gnatws" }
+-- { dg-skip-if "native descriptors" { hppa*-*-* ia64-*-* powerpc64-*-* } }
+
+procedure Trampoline4 is
+
+ A : Integer;
+
+ type FuncPtr is access function (I : Integer) return Integer;
+
+ function F (I : Integer) return Integer is
+ begin
+ return A + I;
+ end F;
+
+ P : FuncPtr := F'Access;
+ I : Integer;
+
+begin
+ I := P(0);
+end;
+
+-- { dg-final { scan-assembler "GNU-stack.*x" } }