sparc: Export sparc64 setcontext with weak_alias [BZ #34669]
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
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(-)
Comments
On 23/09/26 08:20, Stian Halseth wrote:
> 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>
WE don't have a strict guideline for the internal names, so __libc_ should
ok.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> 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)
Hi Adhemerval,
Thanks, let me know if there's anything else!
Stian
On Wed, 2026-09-23 at 15:59 -0300, Adhemerval Zanella Netto wrote:
>
>
> On 23/09/26 08:20, Stian Halseth wrote:
> > 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>
>
> WE don't have a strict guideline for the internal names, so __libc_
> should
> ok.
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> > ---
> > 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)
>
@@ -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)