The callstack testcase fails when the testapp is built with gcc 8. This
is because GCC8 may not emit frame pointers even when the
`-fno-omit-frame-pointer` is used.
To prevent that we manually mark these functions with optimization level
0.
On Clang we also need to include the `-mno-omit-leaf-frame-pointer` flag
along side with the existing `-fno-omit-frame-pointer` to ensure that
frame pointers are emitted. It's not clear if this incompatibility with
GCC is expected [1].
[1]: https://bugs.llvm.org/show_bug.cgi?id=9825
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
AM_CFLAGS += -I$(top_srcdir)/tests/utils/
-AM_CFLAGS += -fno-omit-frame-pointer
+AM_CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
# The feature called Position Independent Execution (PIE) may be enabled by
# default on some systems. Supporting this feature for this testapp would
# increase the complexity of the testcases using this testapp as it would make
* events generated by our test process only.
*/
+#if defined(__clang__)
+#define nooptimization __attribute__((noinline)) __attribute__((optnone))
+#else
+#define nooptimization __attribute__((noinline)) __attribute__((optimize(0)))
+#endif
+
volatile int val = 0;
-long __attribute__ ((noinline))
+long nooptimization
my_gettid(void)
{
long ret;
return ret;
}
-int __attribute__ ((noinline))
+int nooptimization
fct_c(void)
{
return my_gettid();
}
-int __attribute__ ((noinline))
+int nooptimization
fct_b(void)
{
val += fct_c();
return val;
}
-int __attribute__ ((noinline))
+int nooptimization
fct_a(void)
{
val += fct_b();