Skip to content

SRT offset optimisation breaks on MachO platforms

2b0918c9 reduces the overhead of SRT references by encoding them as an offset on amd64, as such references are always possible to represent in a half-word in the small memory model.

Unfortunately, this appears to break on MachO platforms (e.g. Darwin) due to an object format limitation. Specifically, linking fails with:

/var/folders/3y/qjvrbynj45j_z4jt_l1k1qg00000gv/T/ghc32020_0/ghc_3.s:219:8: error:
     error: unsupported relocation with subtraction expression, symbol '_integerzmgmp_GHCziIntegerziType_quotInteger_closure' can not be undefined in a subtraction expression
            .long   _integerzmgmp_GHCziIntegerziType_quotInteger_closure-(_cOA_info)+0
                    ^
    |
219 |         .long   _integerzmgmp_GHCziIntegerziType_quotInteger_closure-(_cOA_info)+0
    |

Apparently MachO does not permit relocations' subtraction expressions to refer to undefined symbols. As far as I can tell this means that it is essentially impossible to express an offset between symbols living in different compilation units. This means that we lively can't use this optimisation on MachO platforms.

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information