From 68441ad4dbebd96c4b92c0c72ed166b3037160e5 Mon Sep 17 00:00:00 2001 From: Eliot Miranda Date: Tue, 22 Jan 2019 14:40:31 -0800 Subject: [PATCH] Make the disablement of optimizatiomn in x86's thunkProtect specific to gcc 7.4.x. Guille, Pablo, All, please take note of this style. The point being we want correctness, but we shouldn't penalise unnecessarily other platfoms or build configurations that do function correctly. --- platforms/Cross/plugins/IA32ABI/ia32abicc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platforms/Cross/plugins/IA32ABI/ia32abicc.c b/platforms/Cross/plugins/IA32ABI/ia32abicc.c index 9297f5716c..5ede37265b 100644 --- a/platforms/Cross/plugins/IA32ABI/ia32abicc.c +++ b/platforms/Cross/plugins/IA32ABI/ia32abicc.c @@ -168,8 +168,18 @@ getMostRecentCallbackContext() { return mostRecentCallbackContext; } * longs, followed by the thunkp and stackp passed on the stack. The register * args would get copied into a struct on the stack. A pointer to the struct * is then passed as an element of the VMCallbackContext. + * + * N.B. On gcc 7.4.x thunkEntry fails if optimized, for as yet not fully + * diagnosed reasons. See + * https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353 + * Hence the pragma below. */ -long __attribute__((optimize("O0"))) +long +#ifdef __GNUC__ +# if __GNUC__ == 7 && __GNUC_MINOR__ >= 4 +__attribute__((optimize("O0"))) +# endif +#endif thunkEntry(void *thunkp, sqIntptr_t *stackp) { VMCallbackContext vmcc;