Skip to content

"Error: bad register name" when compiling with profiling on GHC 9.2.5

Summary

Building xmonad-contrib (on top of xmonad, both with some local changes) resulted in a strange error from the assembler:

...
Build with /nix/store/625ha5v4kdpz8z8py8z57j7xy7dfd0dr-ghc-9.2.5.
...
[204 of 306] Compiling XMonad.Util.RemoteWindows ( XMonad/Util/RemoteWindows.hs, dist/build/XMonad/Util/RemoteWindows.o, dist/build/XMonad/Util/RemoteWindows.dyn_o )
[205 of 306] Compiling XMonad.Layout.Stoppable ( XMonad/Layout/Stoppable.hs, dist/build/XMonad/Layout/Stoppable.o, dist/build/XMonad/Layout/Stoppable.dyn_o )
[206 of 306] Compiling XMonad.Layout.SortedLayout ( XMonad/Layout/SortedLayout.hs, dist/build/XMonad/Layout/SortedLayout.o, dist/build/XMonad/Layout/SortedLayout.dyn_o )
...
[204 of 306] Compiling XMonad.Util.RemoteWindows ( XMonad/Util/RemoteWindows.hs, dist/build/XMonad/Util/RemoteWindows.p_o )
/build/ghc7249_0/ghc_1836.s: Assembler messages:

/build/ghc7249_0/ghc_1836.s:1031:0: error:
     Error: bad register name `%bax'
     |
1031 |         movq 864(%r13),%bax
     | ^

<no location info>: error:
    `cc' failed in phase `Assembler'. (Exit code: 1)
[206 of 306] Compiling XMonad.Layout.SortedLayout ( XMonad/Layout/SortedLayout.hs, dist/build/XMonad/Layout/SortedLayout.p_o )
...

The trouble appears to be with the profiling objects for the 205th module, XMonad.Layout.Stoppable.

(bulk elided for brevity; the full log can be provided if necessary)

Steps to reproduce

When attempted a second time, the error did not reoccur, so reproduction may be difficult. I don't think it should make a difference, but the second run was with nixos-rebuild -j1 ..., whereas the first was default, probably equivalent to -j8.

My system config repo will have captured all the relevant revisions in its flake.lock, so I can put my local changes online and provide a flake that attempts the same build, but it's not done at this point in time.

Expected behavior

Successful compilation.

Environment

  • GHC version used: 9.2.5

Optional:

  • Operating System: NixOS
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information