boostorg / context

307 stars 150 forks source link

boost 1.81 architecture=arm+x86 fails to match fcontext asm implementation #214

Closed uptycs-rmack closed 1 year ago

uptycs-rmack commented 1 year ago

It looks like sometime recently boost changed the architecture flag for building fat binaries on Apple from "combined" to "arm+x86". That appears to me to break the auto-selection of the fcontext asm implementation. A patch such as below is needed to include both implementations as expected.

--- boost_1_81_0.orig/libs/context/build/Jamfile.v2     2022-12-07 20:02:41.000000000 -0500
+++ boost_1_81_0/libs/context/build/Jamfile.v2  2022-12-22 17:03:41.000000000 -0500
@@ -853,7 +853,7 @@
      asm/jump_combined_sysv_macho_gas.S
      asm/ontop_combined_sysv_macho_gas.S
    : <abi>sysv
-     <architecture>combined
+     <architecture>arm+x86
      <binary-format>mach-o
    ;
olk commented 1 year ago

ty - could you verify commit '5bcc1ab architecture flag for Apple's combined ha changed to 'arm+x86'' please (I don't own Appple hardware).

uptycs-rmack commented 1 year ago

I applied the patch to boost 1.81 source tarball and built boost using the x86_64 build of Apple's compiler with the "-arch x86_64 -arch arm64" compiler flags to build a universal binary. I confirmed using lipo/nm that libboost_context-mt-a64.a contained the context-related objects for both Intel and Arm. I confirmed my application successfully linked a universal binary against this library. Patch looks good, thank you.

olk commented 1 year ago

ty