From 26b1805693eb2ad33a9b77969ce9e93839d5cc4c Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 25 Mar 2025 11:08:44 -0300 Subject: [PATCH] elf: Fix abort localplt issue with clang --- sysdeps/generic/symbol-hacks.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index 58398d33a5..cd5589db9d 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -21,6 +21,15 @@ asm ("strcpy = __GI_strcpy"); asm ("strncpy = __GI_strncpy"); asm ("strcat = __GI_strcat"); +#ifdef __clang__ +/* clang might generate an abort call when cleanup functions (set by + __attribute__ ((cleanup)) calls functions not marked as nothrow. + We can mitigate by marking some internal functions as __THROW, + but it is not possible for functions that issue used-provided + callbacks (for instance pthread_once). */ +asm ("abort = __GI_abort"); +#endif + /* Some targets do not use __stack_chk_fail_local. In libc.so, redirect __stack_chk_fail to a hidden reference __stack_chk_fail_local, to avoid the PLT reference. -- 2.47.3