[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] CogVM sources as per VMMaker.oscog-eem.2803 (1b896e9)

Eliot Miranda notifications at github.com
Tue Sep 8 16:41:59 UTC 2020


I has hoping I could fix this in platforms/Cross/vm/sqSetjmpShim.h but so far I have not been able to.

The issue is that mingw defines _setjmp, here's the definition that is used when clang is the compiler:

# 242 "/usr/x86_64-w64-mingw32/sys-root/mingw/include/setjmp.h" 3
  int __attribute__((__cdecl__)) __attribute__ ((__nothrow__,__returns_twice__))

So I tried a sqSetjmpShim.h like this:

#if !defined(_WIN32)
# undef setjmp
# undef longjmp
# define setjmp _setjmp
# define longjmp _longjmp
#endif
/* mingw redeclares _setjmp so we have to provide an alternative */
#if __MINGW32__ || __MINGW64__ /* clang on cygwin/mingw */
int __attribute__((__nowthrow__,__returns_twice__)) _setjmp0(jmp_buf);
# undef _setjmp
# define _setjmp _setjmp0
#endif

I know the code is being selected because if I preprocess via -E I see the declaration for _setjmp0.  But the define of _setjmp is not seen and so invocations of _setjmp are not changed by the preprocessor into invocations of _setjmp0.  Sigh...

A reason to prefer redefine _setjmp itself rather than adding our own non-conflicting version is that if any library code included in a plugin uses setjmp/longjmp then the longjmp will likely fail unless it uses our code.

The alternatives seem to be
a) try and figure out why sqSetjmpShim.h is unable to map _setjmp to _setjmp0 and fix this
b) if it cant be fixed, still define the symbols _setjmp and _setjmp0 in _setjmp-x64.asm (& _setjmp-x86.asm when we add it), have Slang emit osvm_setjmp and osvm_longjmp, and have sqSetjmpShim.h map osvm_setjmp and osvm_longjmp to _setjmp/_longjmp, and have _setjmp-x64.asm et al override all symbols for _setjmp/_longjmp, e.g.

        .text
        .globl setjmp
        .globl sigsetjmp
        .globl _setjmp
        .globl _setjmp0
        .p2align        4, 0x90
setjmp:
sigsetjmp:
_setjmp:
_setjmp0:
        ....

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200908/4f3985f3/attachment.html>


More information about the Vm-dev mailing list