Skip to content

Commit 06dca1d

Browse files
committed
In IA32ABI plugin on 32-bit (x86/IA32) platforms, use -O0 in thunkEntry when compiling via gcc to not mess it up. Works fine with clang.
For 32-bit Windows builds via Cygwin/MSYS/MinGW, default to clang instead of gcc for the above reasons. Also see (merged) PR #353.
1 parent 80bc701 commit 06dca1d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

building/win32x86/common/Makefile.tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export TOOLPREFIX
99
# C compiler settings (gcc 4.x)
1010
#
1111
ifeq ($(COMPILER_TO_USE),)
12-
COMPILER_TO_USE:=gcc
12+
COMPILER_TO_USE:=clang
1313
endif
1414

1515
ifeq ($(COMPILER_TO_USE),clang)

platforms/Cross/plugins/IA32ABI/ia32abicc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,14 @@ getMostRecentCallbackContext() { return mostRecentCallbackContext; }
147147
* args would get copied into a struct on the stack. A pointer to the struct
148148
* is then passed as an element of the VMCallbackContext.
149149
*
150-
* N.B. On gcc 7.4.x thunkEntry fails if optimized, for as yet not fully
150+
* N.B. On gcc, thunkEntry fails if optimized, for as yet not fully
151151
* diagnosed reasons. See
152152
* https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353
153-
* Hence the pragma below.
153+
* Hence the pragma below. Works fine for clang.
154154
*/
155155
long
156-
#ifdef __GNUC__
157-
# if __GNUC__ == 7 && __GNUC_MINOR__ >= 4
156+
#if defined(__GNUC__) && !defined(__clang__)
158157
__attribute__((optimize("O0")))
159-
# endif
160158
#endif
161159
thunkEntry(void *thunkp, sqIntptr_t *stackp)
162160
{

0 commit comments

Comments
 (0)