[0/7] htl: move pthread_condattr_* into libc.

Message ID 20241126205329.2215295-1-gfleury@disroot.org (mailing list archive)
Headers
Series htl: move pthread_condattr_* into libc. |

Message

gfleury Nov. 26, 2024, 8:53 p.m. UTC
  Hello,

I’m working on moving pthread_condattr_* and have a question regarding the pthread_condattr_getclock and pthread_condattr_setclock functions for example

For pthread_condattr_getclock, I’m using the following format:

versioned_symbol (libpthread, __pthread_condattr_getclock, pthread_condattr_getclock, GLIBC_2_41);
However, for pthread_condattr_setclock, I see two different formats:

+versioned_symbol (libc, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
and

+versioned_symbol (libpthread, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
I have checked the ABI for libc and verified the PLT, and both formats pass those checks.

Which approach is correct, and what are the reasons for choosing one over the other?

Note: I haven't had time to work on pthread_setcancestate again.

gfleury (7):
  htl: move pthread_condattr_destroy into libc.
  htl: move __pthread_default_condattr  into libc.
  htl: move pthread_condattr_getclock into libc.
  htl: move pthread_condattr_getpshared into libc.
  htl: move pthread_condattr_init into libc.
  htl: move pthread_condattr_setclock into libc.
  htl: move pthread_condattr_setpshared into libc.

 htl/Makefile                                | 14 +++++++-------
 htl/Versions                                | 16 ++++++++++++----
 htl/forward.c                               |  4 ----
 htl/pt-initialize.c                         |  2 --
 htl/pt-internal.h                           |  1 +
 sysdeps/htl/pt-cond.c                       |  1 +
 sysdeps/htl/pt-condattr-destroy.c           |  6 +++++-
 sysdeps/htl/pt-condattr-getclock.c          |  9 +++++++--
 sysdeps/htl/pt-condattr-getpshared.c        |  8 +++++++-
 sysdeps/htl/pt-condattr-init.c              |  7 ++++++-
 sysdeps/htl/pt-condattr-setclock.c          | 10 ++++++++--
 sysdeps/htl/pt-condattr-setpshared.c        |  8 +++++++-
 sysdeps/htl/pthread-functions.h             |  4 ----
 sysdeps/htl/pthreadP.h                      |  2 ++
 sysdeps/mach/hurd/i386/libc.abilist         | 10 ++++++++++
 sysdeps/mach/hurd/i386/libpthread.abilist   |  6 ------
 sysdeps/mach/hurd/x86_64/libc.abilist       |  8 ++++++++
 sysdeps/mach/hurd/x86_64/libpthread.abilist |  6 ------
 18 files changed, 81 insertions(+), 41 deletions(-)
  

Comments

Florian Weimer Nov. 26, 2024, 9:11 p.m. UTC | #1
> I’m working on moving pthread_condattr_* and have a question regarding the pthread_condattr_getclock and pthread_condattr_setclock functions for example
>
> For pthread_condattr_getclock, I’m using the following format:
>
> versioned_symbol (libpthread, __pthread_condattr_getclock, pthread_condattr_getclock, GLIBC_2_41);
> However, for pthread_condattr_setclock, I see two different formats:
>
> +versioned_symbol (libc, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
> and
>
> +versioned_symbol (libpthread, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
> I have checked the ABI for libc and verified the PLT, and both formats pass those checks.
>
> Which approach is correct, and what are the reasons for choosing one
> over the other?

Some ports have different ABI baselines for libc and libpthread.  For
example, GLIBC_2.0 may have existed in libpthread (prior to the move),
but not in libc because it started at GLIBC_2.2.  So if you write

versioned_symbol (libpthread, __some_function, some_function, GLIBC_2_0)

it would turn into some_function@@GLIBC_2.0, but for

versioned_symbol (libc, __some_function, some_function, GLIBC_2_0)

you would get some_function@@GLIBC_2.2 instead.

In your case, that difference does not matter because you are using it
with a much later version, so the baseline adjustment does not happen.
(I haven't checked if i386-gnu is one of the ports with differing
baselines.)

I would stick to libc for consistency, but we have some (harmless)
libpthread uses after the NPTL conversion.

Thanks,
Florian
  
Samuel Thibault Dec. 9, 2024, 1:26 a.m. UTC | #2
Applied, thanks!

gfleury, le mar. 26 nov. 2024 22:53:22 +0200, a ecrit:
> Hello,
> 
> I’m working on moving pthread_condattr_* and have a question regarding the pthread_condattr_getclock and pthread_condattr_setclock functions for example
> 
> For pthread_condattr_getclock, I’m using the following format:
> 
> versioned_symbol (libpthread, __pthread_condattr_getclock, pthread_condattr_getclock, GLIBC_2_41);
> However, for pthread_condattr_setclock, I see two different formats:
> 
> +versioned_symbol (libc, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
> and
> 
> +versioned_symbol (libpthread, __pthread_condattr_setclock, pthread_condattr_setclock, GLIBC_2_41);
> I have checked the ABI for libc and verified the PLT, and both formats pass those checks.
> 
> Which approach is correct, and what are the reasons for choosing one over the other?
> 
> Note: I haven't had time to work on pthread_setcancestate again.
> 
> gfleury (7):
>   htl: move pthread_condattr_destroy into libc.
>   htl: move __pthread_default_condattr  into libc.
>   htl: move pthread_condattr_getclock into libc.
>   htl: move pthread_condattr_getpshared into libc.
>   htl: move pthread_condattr_init into libc.
>   htl: move pthread_condattr_setclock into libc.
>   htl: move pthread_condattr_setpshared into libc.
> 
>  htl/Makefile                                | 14 +++++++-------
>  htl/Versions                                | 16 ++++++++++++----
>  htl/forward.c                               |  4 ----
>  htl/pt-initialize.c                         |  2 --
>  htl/pt-internal.h                           |  1 +
>  sysdeps/htl/pt-cond.c                       |  1 +
>  sysdeps/htl/pt-condattr-destroy.c           |  6 +++++-
>  sysdeps/htl/pt-condattr-getclock.c          |  9 +++++++--
>  sysdeps/htl/pt-condattr-getpshared.c        |  8 +++++++-
>  sysdeps/htl/pt-condattr-init.c              |  7 ++++++-
>  sysdeps/htl/pt-condattr-setclock.c          | 10 ++++++++--
>  sysdeps/htl/pt-condattr-setpshared.c        |  8 +++++++-
>  sysdeps/htl/pthread-functions.h             |  4 ----
>  sysdeps/htl/pthreadP.h                      |  2 ++
>  sysdeps/mach/hurd/i386/libc.abilist         | 10 ++++++++++
>  sysdeps/mach/hurd/i386/libpthread.abilist   |  6 ------
>  sysdeps/mach/hurd/x86_64/libc.abilist       |  8 ++++++++
>  sysdeps/mach/hurd/x86_64/libpthread.abilist |  6 ------
>  18 files changed, 81 insertions(+), 41 deletions(-)
> 
> -- 
> 2.39.5
>