-staticlib creates malformed archives in wasm backend
$ touch test.c
$ /workspace/ghc/_build/stage1/bin/wasm32-wasi-ghc -staticlib -no-auto-link-packages test.c -o test.a
The above commands will segfault llvm-ranlib
. Now:
$ mv test.o test.orig.o
$ ar x test.a
$ ls -l
total 12
-rw-r--r-- 1 gitpod gitpod 354 Dec 10 17:32 test.a
-rw-r--r-- 1 gitpod gitpod 0 Dec 10 17:32 test.c
-rw-r--r-- 1 gitpod gitpod 286 Dec 10 17:35 test.o
-rw-r--r-- 1 gitpod gitpod 285 Dec 10 17:32 test.orig.o
So, the original test.o
is 285 bytes. And the archive created by GHC extracts to a test.o
that has 286 bytes. It may be tempting to say something is wrong in GHC.SysTools.Ar
, but I can't reproduce this behavior in GHC head's x86_64-linux bindist.