Date: Tue, 29 Dec 2020 12:56:53 +0100 From: Charlotte Delenk <darkkirb@...kkirb.de> To: musl@...ts.openwall.com Subject: [PATCH 1/2] Fix LTO shared library build on GCC and Clang Both GCC and Clang are currently unable to compile the musl dynamic library with link time optimizations enabled, due to them overzealously removing certain symbols used on program start which they deem are not necessary. This patch adds new link flags to the libc.so link that tell the linker that a symbol is used externally, so that code for these functions is always emitted. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index e8cc4436..15190fb9 100644 --- a/Makefile +++ b/Makefile @@ -131,6 +131,9 @@ $(CRT_OBJS): CFLAGS_ALL += -DCRT $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC +# Work around LTO compiler bugs +lib/libc.so: CFLAGS_ALL += -u_dlstart_c -u__dls2 -u__dls2b -u__dls3 -u__stack_chk_guard -u_start_c + CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $< # Choose invocation of assembler to be used -- 2.29.2
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.