|
Message-ID: <CACKH++bJzRAKZedPW46S70sv77-oPPki2Adfizm13-FEbMGtCw@mail.gmail.com>
Date: Sun, 13 Nov 2022 08:11:29 +0800
From: Rui Ueyama <rui314@...il.com>
To: musl@...ts.openwall.com
Subject: `musl-gcc -static` and lld/mold
Hi,
I think I found a musl-gcc issue. It looks like musl-gcc always appends
`-dynamic-linker /lib/ld-musl-x86_64.so.1` even if `-static` is given. That
causes a created program to immediately crash on startup as you can see
below:
$ cat hello.c
#include <stdio.h>
int main() { printf("Hello\n"); }
$ musl-gcc -static -fuse-ld=lld hello.c -o hello
$ ./hello
Segmentation fault (core dumped)
$ musl-gcc -static -fuse-ld=lld hello.c -o hello -Wl,-no-dynamic-linker
$ ./hello
Hello
This also happens to my new linker, mold, as well. `-dynamic-linker` option
is passed to the linker, and lld and mold do what it is told to do, so I
don't think it is a linker's bug. Rather, it's a compiler front end's bug
that passes the unnecessary command line option. Can you not to append
`-dynamic-linker` if `-static`?
Rui Ueyama
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.