From 3fe3f8076e4e0d3f5cd27f85dc0aa76b2f625917 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 25 Jun 2021 10:30:36 +0200 Subject: Linux: Move lio_listio, lio_listio64 from librt to libc The symbols were moved using scripts/move-symbol-to-libc.py. Placeholder symbols are needed on some architectures, to keep the GLIBC_2.1 and GLIBC_2.4 symbol versions around. Reviewed-by: Adhemerva Zanella --- rt/Makefile | 4 ++-- rt/Versions | 20 ++++++++++++++++++-- rt/librt-compat.c | 12 ++++++++++++ rt/lio_listio-common.c | 29 ++++++++++++++++++++++------- 4 files changed, 54 insertions(+), 11 deletions(-) (limited to 'rt') diff --git a/rt/Makefile b/rt/Makefile index 3d930d1..5a5e45b 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -30,8 +30,6 @@ routines = \ librt-routines = \ librt-compat \ - lio_listio \ - lio_listio64 \ mq_close \ mq_getattr \ mq_notify \ @@ -63,6 +61,8 @@ $(librt-routines-var) += \ aio_suspend \ aio_write \ aio_write64 \ + lio_listio \ + lio_listio64 \ tests := tst-shm tst-timer tst-timer2 \ tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \ diff --git a/rt/Versions b/rt/Versions index f2b4ced..0565707 100644 --- a/rt/Versions +++ b/rt/Versions @@ -16,12 +16,20 @@ libc { aio_suspend64; aio_write; aio_write64; + lio_listio; + lio_listio64; %endif } GLIBC_2.2 { shm_open; shm_unlink; } + GLIBC_2.4 { +%if PTHREAD_IN_LIBC + lio_listio; + lio_listio64; +%endif + } GLIBC_2.34 { %if PTHREAD_IN_LIBC aio_cancel; @@ -39,6 +47,8 @@ libc { aio_suspend64; aio_write; aio_write64; + lio_listio; + lio_listio64; %endif shm_open; shm_unlink; @@ -59,7 +69,9 @@ libc { } librt { GLIBC_2.1 { -%if !PTHREAD_IN_LIBC +%if PTHREAD_IN_LIBC + __librt_version_placeholder; +%else aio_cancel; aio_cancel64; aio_error; @@ -75,9 +87,9 @@ librt { aio_suspend64; aio_write; aio_write64; -%endif lio_listio; lio_listio64; +%endif } GLIBC_2.2 { timer_create; @@ -99,8 +111,12 @@ librt { mq_unlink; } GLIBC_2.4 { +%if PTHREAD_IN_LIBC + __librt_version_placeholder; +%else lio_listio; lio_listio64; +%endif } GLIBC_2.7 { __mq_open_2; diff --git a/rt/librt-compat.c b/rt/librt-compat.c index 7e5f1db..23c87b0 100644 --- a/rt/librt-compat.c +++ b/rt/librt-compat.c @@ -26,4 +26,16 @@ __attribute_used__ __librt_version_placeholder_1 (void) { } + +# if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_2) +compat_symbol (librt, __librt_version_placeholder_1, + __librt_version_placeholder, GLIBC_2_1); +# endif + +# if SHLIB_COMPAT (librt, GLIBC_2_4, GLIBC_2_34) \ + && ABI_librt_GLIBC_2_4 != ABI_librt_GLIBC_2_1 +compat_symbol (librt, __librt_version_placeholder_1, + __librt_version_placeholder, GLIBC_2_4); +# endif + #endif diff --git a/rt/lio_listio-common.c b/rt/lio_listio-common.c index 3e087aa..aa4ee5f 100644 --- a/rt/lio_listio-common.c +++ b/rt/lio_listio-common.c @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -87,7 +88,7 @@ lio_listio_internal (int mode, struct AIOCB *const list[], int nent, } /* Request the mutex. */ - pthread_mutex_lock (&__aio_requests_mutex); + __pthread_mutex_lock (&__aio_requests_mutex); /* Now we can enqueue all requests. Since we already acquired the mutex the enqueue function need not do this. */ @@ -120,7 +121,7 @@ lio_listio_internal (int mode, struct AIOCB *const list[], int nent, /* Release the mutex. We do this before raising a signal since the signal handler might do a `siglongjmp' and then the mutex is locked forever. */ - pthread_mutex_unlock (&__aio_requests_mutex); + __pthread_mutex_unlock (&__aio_requests_mutex); if (LIO_MODE (mode) == LIO_NOWAIT) __aio_notify_only (sig); @@ -223,13 +224,13 @@ lio_listio_internal (int mode, struct AIOCB *const list[], int nent, } /* Release the mutex. */ - pthread_mutex_unlock (&__aio_requests_mutex); + __pthread_mutex_unlock (&__aio_requests_mutex); return result; } -#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4) +#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4) int attribute_compat_text_section LIO_LISTIO_OLD (int mode, struct AIOCB *const list[], int nent, @@ -248,7 +249,7 @@ compat_symbol (librt, LIO_LISTIO_OLD, LIO_LISTIO, GLIBC_2_1); # if __WORDSIZE == 64 compat_symbol (librt, LIO_LISTIO_OLD, lio_listio64, GLIBC_2_1); # endif -#endif /* SHLIB_COMPAT */ +#endif /* OTHER_SHLIB_COMPAT */ int @@ -264,7 +265,21 @@ LIO_LISTIO_NEW (int mode, struct AIOCB *const list[], int nent, return lio_listio_internal (mode, list, nent, sig); } + +#if PTHREAD_IN_LIBC +versioned_symbol (libc, LIO_LISTIO_NEW, LIO_LISTIO, GLIBC_2_34); +# if __WORDSIZE == 64 +versioned_symbol (libc, LIO_LISTIO_NEW, lio_listio64, GLIBC_2_34); +# endif +# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_4, GLIBC_2_34) +compat_symbol (librt, LIO_LISTIO_NEW, LIO_LISTIO, GLIBC_2_4); +# if __WORDSIZE == 64 +compat_symbol (librt, LIO_LISTIO_NEW, lio_listio64, GLIBC_2_4); +# endif +# endif /* OTHER_SHLIB_COMPAT */ +#else /* !PTHREAD_IN_LIBC */ versioned_symbol (librt, LIO_LISTIO_NEW, LIO_LISTIO, GLIBC_2_4); -#if __WORDSIZE == 64 +# if __WORDSIZE == 64 versioned_symbol (librt, LIO_LISTIO_NEW, lio_listio64, GLIBC_2_4); -#endif +# endif +#endif /* !PTHREAD_IN_LIBC */ -- cgit v1.1