Issue |
137510
|
Summary |
lld not creating fully statically linked binaries on Alpine Linux
|
Labels |
lld
|
Assignees |
|
Reporter |
benz0li
|
### Your environment
Which OS do you use? Alpine Linux 3.21.3
Which version of LLVM do you use and how did you install it? Version 18. Installed using `apk`.
### Expected behaviour
E.g. building https://github.com/jgm/pandoc using `cabal update && cabal build --enable-executable-static --ghc-options '-optl-pthread' pandoc-cli` in [`quay.io/benz0li/ghc-musl:9.10.1-int-native`](https://quay.io/repository/benz0li/ghc-musl) (default linker: `ld.bfd`):
```shell
ldd /tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc
```
```
/lib/ld-musl-aarch64.so.1: /tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc: Not a valid dynamic program
```
\---
```shell
file /tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc
```
```
/tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=0f5f5dfdb712dcea7d9322a55303eb37486d114d, with debug_info, not stripped
```
### Actual behaviour
When using [a *GHC musl* image with `ld.lld` as default linker](https://github.com/benz0li/ghc-musl/blob/dd801c1966902e1cac20db228a5fd1110cb8692c/dockerfiles/9.10.1.Dockerfile):
```shell
ldd /tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc
```
```
/lib/ld-musl-aarch64.so.1 (0xffff9e133000)
```
\---
```shell
file /tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc
```
```
/tmp/pandoc/dist-newstyle/build/aarch64-linux/ghc-9.10.1/pandoc-cli-3.6.4/x/pandoc/build/pandoc/pandoc: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[xxHash]=a31bd72d4c384ddd, with debug_info, not stripped
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs