Opened 7 years ago

Closed 6 years ago

#12114 closed Bugs (fixed)

boost context does not preserve fpu context on ios arm64 devices

Reported by: ykirpichev@… Owned by: olli
Milestone: To Be Determined Component: context
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

The problem with floating point calculations was observed when trying to use boost context on arm64 ios devices. It looks like, in certain conditions floating point arithmetic stops working properly.

It is hard to provide exact way how to reproduce the issue, but after investigation it has been found out that VFP_FP is not defined by clang++ when the following command is executed:

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" -x assembler-with-cpp -O3 -finline-functions -Wno-inline -Wall -gdwarf-2 -fexceptions -DBUNDLE_VERSION=1.60.0.yandex.4 -DYANDEX_BOOST -DMOBILE_BUILD -O2 -Wno-unused-variable -Wno-unknown-pragmas -Wno-reorder -Wno-unused-local-typedefs -stdlib=libc++ -fobjc-arc -fvisibility=hidden -Qunused-arguments -lc++ -miphoneos-version-min=6.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/include -arch arm64 -fembed-bitcode -O2 -arch arm64 -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/context/build/6a8dcaa993b5623b8882ae19f514636b/asm/jump_arm64_aapcs_macho_gas.o" "libs/context/src/asm/jump_arm64_aapcs_macho_gas.S"

As a result floating point context is not stored/restored and eventually leads to some mysterious issues.

The problem can be solved by defining VFP_FP directly, however, better way to fix it is to remove #if (defined(VFP_FP) && !defined(SOFTFP)) from jump_arm64_aapcs_macho_gas.S.

Change History (8)

comment:1 by olli, 7 years ago

hmm - preserving FPU is removed in version 1.61. Could you check branch develop?

in reply to:  1 comment:2 by ykirpichev@…, 7 years ago

Replying to olli:

hmm - preserving FPU is removed in version 1.61. Could you check branch develop?

Yes, I saw it, that is why I'm wondering why it is removed in version 1.61? It will break usage of floating point in coroutines on arm64 ios devices.

in reply to:  1 comment:2 by ykirpichev@…, 7 years ago

Replying to olli:

hmm - preserving FPU is removed in version 1.61. Could you check branch develop?

Yes, I saw it, that is why I'm wondering why it is removed in version 1.61? It will break usage of floating point in coroutines on arm64 ios devices.

in reply to:  1 comment:2 by ykirpichev@…, 7 years ago

Replying to olli:

hmm - preserving FPU is removed in version 1.61. Could you check branch develop?

Yes, I saw it, that is why I'm wondering why it is removed in version 1.61? It will break usage of floating point in coroutines on arm64 ios devices.

comment:3 by Yury Kirpichev <ykirpichev@…>, 7 years ago

Sorry, I added previous comment several time by accident. Do you want me to try newer boost version and check whether problem exist? I can relatively easily check version 1.61 beta. Is it ok?

in reply to:  3 comment:4 by olli, 6 years ago

Replying to Yury Kirpichev <ykirpichev@…>:

Sorry, I added previous comment several time by accident. Do you want me to try newer boost version and check whether problem exist? I can relatively easily check version 1.61 beta. Is it ok?

would be nice, if you could test 1.61 on this platform

comment:5 by olli, 6 years ago

fixed in commit f3d3ca3ab8b747c3efde7d1b26602be1f01eafbf (branch develop). could you verify that the fix works on IOS, please? ARM64 + ELF (Linux) seams to work.

Last edited 6 years ago by olli (previous) (diff)

comment:6 by olli, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.