[PATCH] sparc: Export sparc64 setcontext with weak_alias [BZ #34669]

Stian Halseth stian@itx.no
Wed Sep 23 11:20:30 GMT 2026


setcontext.S marks setcontext weak with .weak and then defines it with
ENTRY, which emits .global.  GNU as lets .weak win, but LLVM's
integrated assembler rejects the change of binding (deliberately, since
LLVM 12), so the file does not assemble with clang:

  error: setcontext changed binding to STB_GLOBAL

Define the stub as __libc_setcontext and export it with weak_alias, as
getcontext, makecontext and swapcontext in the same directory already
do.  setcontext stays a weak GLIBC_2.2 function.

Tested on sparc64 with gcc: the dynamic symbol for setcontext is
unchanged, check-abi passes, and the stdlib ucontext tests pass.  With
clang the file now assembles without errors or warnings.

Signed-off-by: Stian Halseth <stian@itx.no>
---
 sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
index 810eeb225f..71cc541467 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
@@ -19,13 +19,13 @@
 #include "ucontext_i.h"
 
 /* int setcontext(ucontext_t *ctx); */
-.weak setcontext
-ENTRY(setcontext)
+ENTRY(__libc_setcontext)
 
 	ba,pt	%xcc, 1f
 	 mov	1, %o1
 
-END(setcontext)
+END(__libc_setcontext)
+weak_alias (__libc_setcontext, setcontext)
 
 /* int __setcontext(ucontext_t *ctx, int restoremask); */
 ENTRY(__setcontext)
-- 
2.55.0



More information about the Libc-alpha mailing list