Fix: don't call __builtin_return_address(0) on 32-bit powerpc
[lttng-ust.git] / include / helper.h
index 9d6617a8de044b2f1fa04481c9c1874cb8ffbcd2..9873feadd85b020556c1cd1e4f45925094b1fdd1 100644 (file)
@@ -43,4 +43,16 @@ void *zmalloc(size_t len)
 
 #define LTTNG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
+/*
+ * Use of __builtin_return_address(0) sometimes seems to cause stack
+ * corruption on 32-bit PowerPC. Disable this feature on that
+ * architecture for now by always using the NULL value for the ip
+ * context.
+ */
+#if defined(__PPC__) && !defined(__PPC64__)
+#define LTTNG_UST_CALLER_IP()          NULL
+#else /* #if defined(__PPC__) && !defined(__PPC64__) */
+#define LTTNG_UST_CALLER_IP()          __builtin_return_address(0)
+#endif /* #else #if defined(__PPC__) && !defined(__PPC64__) */
+
 #endif /* _LTTNG_UST_HELPER_H */
This page took 0.022911 seconds and 4 git commands to generate.