From 988328716d269005ebb55095d74576bf88f5154f Mon Sep 17 00:00:00 2001 From: Andy Caldwell Date: Mon, 12 May 2025 16:01:52 +0100 Subject: [PATCH] Mark `__dls2` as `__attribute__((used))` This function is only referenced indirectly (though an explicit symbol lookup on inline assembly) which causes LTO to strip it, causing linker errors. The `used` attribute tells the compiler (including the LTO phase) that the function is referenced, even if the compiler can't see that, preventing the function getting dropped. --- ldso/dynlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 715948f4..ab78274e 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1704,7 +1704,7 @@ static void install_new_tls(void) * symbols. Its job is to perform symbolic relocations on the dynamic * linker itself, but some of the relocations performed may need to be * replaced later due to copy relocations in the main program. */ - +__attribute__((used)) hidden void __dls2(unsigned char *base, size_t *sp) { size_t *auxv; -- 2.49.0