You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling just about any Haskell library using GHC's new JS backend which involves creating an ar file, llvm-ranlib is called (via Emscripten's emranlib), triggering the following crash:
emranlib is just a wrapper around llvm-ranlib that transparently passes through all arguments to llvm-ranlib. /nix/store/b4z1yykly634q6ric5d3w6162slxzrbf-emscripten-llvm-3.1.24/bin/llvm-ranlib is just a symlink to normal llvm-ranlib 14.0.6:
It should be easy to reproduce the crash by running on llvm-ranlib on the archive file produced by GHC (had to upload externally due to GitHub's file size limit) by just executing llvm-ranlib repro-ranlib-crash.a.
You need to build GHC as a cross-compiler for javascript-unknown-ghcjs (for older revisions js-unknown-ghcjs) – using LLVM 14.0.6 of course. Build instructions are available upstream. I used GHC revision a203ad854ffee802e6bf0aca26e6c9a99bec3865.
If you want to use Nix, you can checkout e23efa222d1d7af7fa4380a392afd359f9e5116c of my nixpkgs fork and build nix-build -A pkgsCross.ghcjs.buildPackages.haskell.compiler.ghcHEAD.
Create the following Test.hs:
moduleTest (test) where
test x = x +41
Run javascript-unknown-ghcjs-ghc -outputdir build/ -v -o repro-ranlib-crash.a --make -staticlib Test.hs. You should see the crash already.
You can reproduce the crash again by running llvm-ranlib repro-ranlib-crash.a.
The same crash happens with llvm-ranlib built from 85dbb3f.
sternenseemann
changed the title
14.0.6 llvm-ranlib: crash when called on emscripten .a file produced by GHC's new JS backend
[llvm-ranlib] crash when called on emscripten .a file produced by GHC's new JS backend
Feb 24, 2023
Another repro nix build 'github:nixos/nixpkgs?rev=6c43a3495a11e261e5f41e5d7eda2d71dae1b2fe#legacyPackages.x86_64-linux.pkgsCross.ghcjs.haskell.packages.ghc96.hashable'
When compiling just about any Haskell library using GHC's new JS backend which involves creating an
ar
file,llvm-ranlib
is called (via Emscripten'semranlib
), triggering the following crash:emranlib
is just a wrapper aroundllvm-ranlib
that transparently passes through all arguments tollvm-ranlib
./nix/store/b4z1yykly634q6ric5d3w6162slxzrbf-emscripten-llvm-3.1.24/bin/llvm-ranlib
is just a symlink to normalllvm-ranlib
14.0.6:It should be easy to reproduce the crash by running on
llvm-ranlib
on the archive file produced by GHC (had to upload externally due to GitHub's file size limit) by just executingllvm-ranlib repro-ranlib-crash.a
.llvm-ranlib
comes fromnixpkgs
, of course.Reproducing this using just GHC
javascript-unknown-ghcjs
(for older revisionsjs-unknown-ghcjs
) – using LLVM 14.0.6 of course. Build instructions are available upstream. I used GHC revisiona203ad854ffee802e6bf0aca26e6c9a99bec3865
.If you want to use Nix, you can checkout
e23efa222d1d7af7fa4380a392afd359f9e5116c
of my nixpkgs fork and buildnix-build -A pkgsCross.ghcjs.buildPackages.haskell.compiler.ghcHEAD
.Test.hs
:javascript-unknown-ghcjs-ghc -outputdir build/ -v -o repro-ranlib-crash.a --make -staticlib Test.hs
. You should see the crash already.llvm-ranlib repro-ranlib-crash.a
.Reproducible with:
The text was updated successfully, but these errors were encountered: