Skip to content

Commit

Permalink
Fix logic for detecting _libc_fpstate API (#1232)
Browse files Browse the repository at this point in the history
This fixes use of the incorrect API on x86 64-bit Linux, which was causing OpenEXR compilation to fail on the latest 64-bit Ubuntu.

See https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/sys/ucontext.h which defines two different `_libc_fpstate` structs inside an `#ifdef __x86_64__`

Signed-off-by: Abe Fettig <[email protected]>
  • Loading branch information
abram authored Mar 17, 2022
1 parent 19be4e0 commit 383d3a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/Iex/IexMathFpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ restoreControlRegs (const ucontext_t& ucon, bool clearExceptions)
inline void
restoreControlRegs (const ucontext_t& ucon, bool clearExceptions)
{
# if defined(__GLIBC__) || defined(__i386__)
# if defined(__GLIBC__) && defined(__i386__)
setCw ((ucon.uc_mcontext.fpregs->cw & cwRestoreMask) | cwRestoreVal);
# else
setCw ((ucon.uc_mcontext.fpregs->cwd & cwRestoreMask) | cwRestoreVal);
# endif

_fpstate* kfp = reinterpret_cast<_fpstate*> (ucon.uc_mcontext.fpregs);
# if defined(__GLIBC__) || defined(__i386__)
# if defined(__GLIBC__) && defined(__i386__)
setMxcsr (kfp->magic == 0 ? kfp->mxcsr : 0, clearExceptions);
# else
setMxcsr (kfp->mxcsr, clearExceptions);
Expand Down

0 comments on commit 383d3a0

Please sign in to comment.