Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip longjmp() SEH unwind in 64-bit build #49

Merged
merged 2 commits into from
Aug 7, 2022

Conversation

bgilbert
Copy link
Member

@bgilbert bgilbert commented Aug 6, 2022

On 64-bit Windows, MinGW passes a frame pointer to _setjmp so longjmp can do a SEH unwind. This seems to work when the caller is also built with MinGW, but sometimes crashes with STATUS_BAD_STACK when the caller is built with MSVC; it appears that this is a longstanding MinGW issue. In 64-bit builds, override setjmp() to pass a NULL frame pointer to skip
the SEH unwind. Our uses of setjmp/longjmp are all in libpng/libjpeg error handling, which isn't expecting to do any cleanup in intermediate stack frames, so this should be fine.

Fixes #47.

We weren't specifying the include and library paths in cppflags/ldflags,
requiring each build system invocation to specify them individually.  As
a result, we weren't specifying -I to cmake or either path to zlib or
iconv.  Centralize path setting in cppflags/ldflags.

Signed-off-by: Benjamin Gilbert <[email protected]>
On 64-bit Windows, MinGW passes a frame pointer to _setjmp so longjmp
can do a SEH unwind.  This seems to work when the caller is also built
with MinGW, but sometimes crashes with STATUS_BAD_STACK when the caller
is built with MSVC; it appears that this is a longstanding MinGW issue.
In 64-bit builds, override setjmp() to pass a NULL frame pointer to skip
the SEH unwind.  Our uses of setjmp/longjmp are all in libpng/libjpeg
error handling, which isn't expecting to do any cleanup in intermediate
stack frames, so this should be fine.

Fixes openslide#47.

Signed-off-by: Benjamin Gilbert <[email protected]>
@github-actions
Copy link

github-actions bot commented Aug 6, 2022

DCO signed off ✔️

All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1.

@bgilbert bgilbert merged commit 53392e7 into openslide:main Aug 7, 2022
@bgilbert bgilbert deleted the setjmp branch August 7, 2022 00:29
bgilbert added a commit to bgilbert/openslide that referenced this pull request Aug 7, 2022
We're no longer trying to strictly comply with C99, since we're now
dependent on the GCC/clang cleanup attribute.  Regardless, the GCC docs
say -pedantic doesn't issue diagnostics for all deviations from the C
standard, so we can't assume that use of the option enforces compliance.
We already enable -Wall and -Wextra, so let's stick to those, rather than
asking for warnings the compiler thinks are dubious.

This makes -Wno-pedantic-ms-format unnecessary, so drop it.

This was originally motivated by openslide-winbuild's use of #include_next
in openslide/openslide-bin#49, coupled with
the use of -Werror in CI.
bgilbert added a commit to bgilbert/openslide that referenced this pull request Aug 7, 2022
We're no longer trying to strictly comply with C99, since we're now
dependent on the GCC/clang cleanup attribute.  Regardless, the GCC docs
say -pedantic doesn't issue diagnostics for all deviations from the C
standard, so we can't assume that use of the option enforces compliance.
We already enable -Wall and -Wextra, so let's stick to those, rather than
asking for warnings the compiler thinks are dubious.

This makes -Wno-pedantic-ms-format unnecessary, so drop it.

This was originally motivated by openslide-winbuild's use of #include_next
in openslide/openslide-bin#49, coupled with
the use of -Werror in CI.

Signed-off-by: Benjamin Gilbert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

OpenSlide Python read_bad_associated_image test crashes on Windows Server 2022
1 participant