[GHC] #15169: SRT offset optimisation breaks on MachO platforms

GHC ghc-devs at haskell.org
Sun May 20 15:35:12 UTC 2018


#15169: SRT offset optimisation breaks on MachO platforms
--------------------------------------+---------------------------------
           Reporter:  bgamari         |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:  8.6.1
          Component:  Compiler        |           Version:  8.2.2
           Keywords:                  |  Operating System:  MacOS X
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 2b0918c9834be1873728176e4944bec26271234a 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
     |
 }}}

 [[https://llvm.org/viewvc/llvm-
 project?view=revision&revision=220599|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.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15169>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list