resolv: Move libanl symbols to libc on hurd too

This commit is contained in:
Samuel Thibault
2026-03-15 21:24:00 +01:00
parent 62d3f3a10f
commit f6143a7848
21 changed files with 65 additions and 131 deletions
-9
View File
@@ -1456,15 +1456,6 @@ endif
sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
$(firstword $(subst :, ,$p))))
# $(libanl-routines-var) is the make
# variable to which libanl routines need to be added to land in the
# right library.
ifeq ($(pthread-in-libc),yes)
libanl-routines-var = routines
else
libanl-routines-var = libanl-routines
endif
# A sysdeps Makeconfig fragment may set libc-reentrant to yes.
ifeq (yes,$(libc-reentrant))
defines += -D_LIBC_REENTRANT
-4
View File
@@ -2714,10 +2714,6 @@ $(objpfx)tst-ldconfig-soname.out : tst-ldconfig-soname.sh \
# Test static linking of all the libraries we can possibly link
# together. Note that in some configurations this may be less than the
# complete list of libraries we build but we try to maxmimize this list.
ifeq ($(pthread-in-libc),no)
$(objpfx)tst-linkall-static: \
$(common-objpfx)resolv/libanl.a
endif
$(objpfx)tst-linkall-static: \
$(common-objpfx)math/libm.a \
$(common-objpfx)resolv/libresolv.a \
-4
View File
@@ -199,11 +199,7 @@ libc_hidden_proto (ruserpass)
# else
extern int __gai_suspend_time64 (const struct gaicb *const list[], int ent,
const struct __timespec64 *timeout);
# if PTHREAD_IN_LIBC
libc_hidden_proto (__gai_suspend_time64)
# else
libanl_hidden_proto (__gai_suspend_time64)
# endif
# endif
/* The following definition has been removed from the public header
-2
View File
@@ -81,11 +81,9 @@ extern void __libc_dlerror_result_free (void) attribute_hidden;
/* From either libc.so or libpthread.so */
extern void __libpthread_freeres (void) attribute_hidden;
/* From either libc.so or libanl.so */
#if PTHREAD_IN_LIBC
extern void __gai_freemem (void) attribute_hidden;
/* From either libc.so or librt.so */
extern void __aio_freemem (void) attribute_hidden;
#endif
/* From libc.so */
extern char * __libc_fgetgrent_freemem_ptr attribute_hidden;
-2
View File
@@ -170,11 +170,9 @@ __libc_freeres (void)
call_function_static_weak (__libc_tzset_freemem);
call_function_static_weak (__libc_localealias_freemem);
#if PTHREAD_IN_LIBC
call_function_static_weak (__gai_freemem);
call_function_static_weak (__aio_freemem);
#endif
call_function_static_weak (__libpthread_freeres);
+6 -9
View File
@@ -34,6 +34,12 @@ routines := \
dns-canon \
dns-host \
dns-network \
gai_cancel \
gai_error \
gai_misc \
gai_notify \
gai_suspend \
getaddrinfo_a \
herror \
inet_addr \
inet_ntop \
@@ -209,15 +215,6 @@ libanl-routines += libanl-compat
libanl-shared-only-routines += libanl-compat
endif
$(libanl-routines-var) += \
gai_cancel \
gai_error \
gai_misc \
gai_notify \
gai_suspend \
getaddrinfo_a \
# $(libanl-routines-var)
# Pretend that libanl.so is a linker script, so that the symbolic link
# is not installed.
install-lib-ldscripts = libanl.so
+6 -14
View File
@@ -40,12 +40,10 @@ libc {
_res_hconf;
}
GLIBC_2.2.3 {
%if PTHREAD_IN_LIBC
gai_cancel;
gai_error;
gai_suspend;
getaddrinfo_a;
%endif
}
GLIBC_2.9 {
ns_name_compress;
@@ -57,12 +55,10 @@ libc {
ns_name_unpack;
}
GLIBC_2.34 {
%if PTHREAD_IN_LIBC
gai_cancel;
gai_error;
gai_suspend;
getaddrinfo_a;
%endif
dn_comp;
dn_expand;
dn_skipname;
@@ -88,10 +84,13 @@ libc {
res_search;
res_send;
}
GLIBC_2.44 {
gai_cancel;
gai_error;
gai_suspend;
getaddrinfo_a;
}
GLIBC_PRIVATE {
%if !PTHREAD_IN_LIBC
__gai_sigqueue;
%endif
__h_errno;
__inet_aton_exact;
__inet_pton_length;
@@ -231,13 +230,6 @@ libnss_dns {
libanl {
GLIBC_2.2.3 {
%if PTHREAD_IN_LIBC
__libanl_version_placeholder;
%else
gai_cancel;
gai_error;
gai_suspend;
getaddrinfo_a;
%endif
}
}
+4 -7
View File
@@ -19,6 +19,7 @@
#include <pthread.h>
#include <shlib-compat.h>
#include <gai_misc.h>
#include <resolv-libc.h>
int
@@ -44,12 +45,8 @@ __gai_cancel (struct gaicb *gaicbp)
return result;
}
#if PTHREAD_IN_LIBC
versioned_symbol (libc, __gai_cancel, gai_cancel, GLIBC_2_34);
versioned_symbol (libc, __gai_cancel, gai_cancel, ANL_IN_LIBC);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
#if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, ANL_IN_LIBC)
compat_symbol (libanl, __gai_cancel, gai_cancel, GLIBC_2_2_3);
# endif
#else /* !PTHREAD_IN_LIBC */
strong_alias (__gai_cancel, gai_cancel)
#endif /* !PTHREAD_IN_LIBC */
#endif
+4 -7
View File
@@ -18,18 +18,15 @@
#include <netdb.h>
#include <shlib-compat.h>
#include <gai_misc.h>
#include <resolv-libc.h>
int
__gai_error (struct gaicb *req)
{
return req->__return;
}
#if PTHREAD_IN_LIBC
versioned_symbol (libc, __gai_error, gai_error, GLIBC_2_34);
versioned_symbol (libc, __gai_error, gai_error, ANL_IN_LIBC);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
#if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, ANL_IN_LIBC)
compat_symbol (libanl, __gai_error, gai_error, GLIBC_2_2_3);
# endif
#else /* !PTHREAD_IN_LIBC */
strong_alias (__gai_error, gai_error)
#endif /* !PTHREAD_IN_LIBC */
#endif
+1 -14
View File
@@ -23,17 +23,7 @@
#include <sys/time.h>
#include <gai_misc.h>
#if !PTHREAD_IN_LIBC
/* The available function names differ outside of libc. (In libc, we
need to use hidden aliases to avoid the PLT.) */
#define __pthread_attr_init pthread_attr_init
#define __pthread_attr_setdetachstate pthread_attr_setdetachstate
#define __pthread_cond_signal pthread_cond_signal
#define __pthread_cond_timedwait pthread_cond_timedwait
#define __pthread_create pthread_create
#define __pthread_exit pthread_exit
#endif
#include <resolv-libc.h>
#ifndef gai_create_helper_thread
# define gai_create_helper_thread __gai_create_helper_thread
@@ -435,9 +425,6 @@ handle_requests (void *arg)
/* Free allocated resources. */
#if !PTHREAD_IN_LIBC
__attribute__ ((__destructor__)) static
#endif
void
__gai_freemem (void)
{
+2 -11
View File
@@ -19,16 +19,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <gai_misc.h>
#if !PTHREAD_IN_LIBC
/* The available function names differ outside of libc. (In libc, we
need to use hidden aliases to avoid the PLT.) */
#define __pthread_attr_init pthread_attr_init
#define __pthread_attr_setdetachstate pthread_attr_setdetachstate
#define __pthread_cond_signal pthread_cond_signal
#define __pthread_cond_timedwait pthread_cond_timedwait
#define __pthread_create pthread_create
#endif
#include <resolv-libc.h>
struct notify_func
{
@@ -119,7 +110,7 @@ __gai_notify (struct requestlist *req)
/* Decrement the counter. */
--*waitlist->counterp;
pthread_cond_signal (waitlist->cond);
__pthread_cond_signal (waitlist->cond);
#endif
}
else
+9 -22
View File
@@ -22,6 +22,7 @@
#include <sys/time.h>
#include <gai_misc.h>
#include <resolv-libc.h>
int
___gai_suspend_time64 (const struct gaicb *const list[], int ent,
@@ -97,7 +98,7 @@ ___gai_suspend_time64 (const struct gaicb *const list[], int ent,
GAI_MISC_WAIT (result, cntr, timeout == NULL ? NULL : &ts, 1);
#else
struct timespec ts32 = valid_timespec64_to_timespec (ts);
result = pthread_cond_timedwait (&cond, &__gai_requests_mutex,
result = __pthread_cond_timedwait (&cond, &__gai_requests_mutex,
timeout == NULL ? NULL : &ts32);
#endif
@@ -124,7 +125,7 @@ ___gai_suspend_time64 (const struct gaicb *const list[], int ent,
#ifndef DONT_NEED_GAI_MISC_COND
/* Release the conditional variable. */
if (pthread_cond_destroy (&cond) != 0)
if (__pthread_cond_destroy (&cond) != 0)
/* This must never happen. */
abort ();
#endif
@@ -150,25 +151,15 @@ ___gai_suspend_time64 (const struct gaicb *const list[], int ent,
}
#if __TIMESIZE == 64
# if PTHREAD_IN_LIBC
versioned_symbol (libc, ___gai_suspend_time64, gai_suspend, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
versioned_symbol (libc, ___gai_suspend_time64, gai_suspend, ANL_IN_LIBC);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, ANL_IN_LIBC)
compat_symbol (libanl, ___gai_suspend_time64, gai_suspend, GLIBC_2_2_3);
# endif
# else
weak_alias (___gai_suspend_time64, gai_suspend)
# endif /* PTHREAD_IN_LIBC */
# endif
#else /* __TIMESIZE != 64 */
# if PTHREAD_IN_LIBC
libc_hidden_ver (___gai_suspend_time64, __gai_suspend_time64)
versioned_symbol (libc, ___gai_suspend_time64, __gai_suspend_time64,
GLIBC_2_34);
# else /* !PTHREAD_IN_LIBC */
# if IS_IN (libanl)
hidden_ver (___gai_suspend_time64, __gai_suspend_time64)
# endif
#endif /* !PTHREAD_IN_LIBC */
ANL_IN_LIBC);
int
___gai_suspend (const struct gaicb *const list[], int ent,
@@ -181,12 +172,8 @@ ___gai_suspend (const struct gaicb *const list[], int ent,
return __gai_suspend_time64 (list, ent, timeout != NULL ? &ts64 : NULL);
}
#if PTHREAD_IN_LIBC
versioned_symbol (libc, ___gai_suspend, gai_suspend, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
versioned_symbol (libc, ___gai_suspend, gai_suspend, ANL_IN_LIBC);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, ANL_IN_LIBC)
compat_symbol (libanl, ___gai_suspend, gai_suspend, GLIBC_2_2_3);
# endif
# else
weak_alias (___gai_suspend, gai_suspend)
# endif /* !PTHREAD_IN_LIBC */
#endif /* __TIMESIZE != 64 */
+6 -9
View File
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <gai_misc.h>
#include <resolv-libc.h>
/* We need this special structure to handle asynchronous I/O. */
@@ -126,7 +127,7 @@ __getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
int not_used __attribute__ ((unused));
GAI_MISC_WAIT (not_used, total, NULL, 1);
#else
pthread_cond_wait (&cond, &__gai_requests_mutex);
__pthread_cond_wait (&cond, &__gai_requests_mutex);
#endif
}
@@ -135,7 +136,7 @@ __getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
#ifndef DONT_NEED_GAI_MISC_COND
/* Release the conditional variable. */
if (pthread_cond_destroy (&cond) != 0)
if (__pthread_cond_destroy (&cond) != 0)
/* This must never happen. */
abort ();
#endif
@@ -179,12 +180,8 @@ __getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig)
return result;
}
#if PTHREAD_IN_LIBC
versioned_symbol (libc, __getaddrinfo_a, getaddrinfo_a, GLIBC_2_34);
versioned_symbol (libc, __getaddrinfo_a, getaddrinfo_a, ANL_IN_LIBC);
# if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, GLIBC_2_34)
#if OTHER_SHLIB_COMPAT (libanl, GLIBC_2_2_3, ANL_IN_LIBC)
compat_symbol (libanl, __getaddrinfo_a, getaddrinfo_a, GLIBC_2_2_3);
# endif
#else /* !PTHREAD_IN_LIBC */
strong_alias (__getaddrinfo_a, getaddrinfo_a)
#endif /* !PTHREAD_IN_LIBC */
#endif
+2 -4
View File
@@ -16,9 +16,8 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#if PTHREAD_IN_LIBC
# include <shlib-compat.h>
# include <sys/cdefs.h>
#include <shlib-compat.h>
#include <sys/cdefs.h>
/* This file is used to keep specific symbol versions occupied, so
that ld does not generate weak symbol version definitions. */
@@ -32,4 +31,3 @@ __libanl_version_placeholder_1 (void)
compat_symbol (libanl, __libanl_version_placeholder_1,
__libanl_version_placeholder, GLIBC_2_2_3);
#endif
+1
View File
@@ -0,0 +1 @@
#define ANL_IN_LIBC GLIBC_2_44
+5 -5
View File
@@ -39,11 +39,11 @@ __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
pthread_attr_t attr;
/* Make sure the thread is created detached. */
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
__pthread_attr_init (&attr);
__pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
/* The helper thread needs only very little resources. */
(void) pthread_attr_setstacksize (&attr, 0x10000);
(void) __pthread_attr_setstacksize (&attr, 0x10000);
/* Block all signals in the helper thread. To do this thoroughly we
temporarily have to block all signals here. */
@@ -54,13 +54,13 @@ __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
sigerr = __pthread_sigmask (SIG_SETMASK, &ss, &oss);
assert_perror (sigerr);
int ret = pthread_create (threadp, &attr, tf, arg);
int ret = __pthread_create (threadp, &attr, tf, arg);
/* Restore the signal mask. */
sigerr = __pthread_sigmask (SIG_SETMASK, &oss, NULL);
assert_perror (sigerr);
(void) pthread_attr_destroy (&attr);
(void) __pthread_attr_destroy (&attr);
return ret;
}
+1 -4
View File
@@ -1,4 +1 @@
GLIBC_2.2.6 gai_cancel F
GLIBC_2.2.6 gai_error F
GLIBC_2.2.6 gai_suspend F
GLIBC_2.2.6 getaddrinfo_a F
GLIBC_2.2.6 __libanl_version_placeholder F
+8
View File
@@ -1065,7 +1065,10 @@ GLIBC_2.2.6 fwprintf F
GLIBC_2.2.6 fwrite F
GLIBC_2.2.6 fwrite_unlocked F
GLIBC_2.2.6 fwscanf F
GLIBC_2.2.6 gai_cancel F
GLIBC_2.2.6 gai_error F
GLIBC_2.2.6 gai_strerror F
GLIBC_2.2.6 gai_suspend F
GLIBC_2.2.6 gcvt F
GLIBC_2.2.6 get_avphys_pages F
GLIBC_2.2.6 get_current_dir_name F
@@ -1075,6 +1078,7 @@ GLIBC_2.2.6 get_nprocs_conf F
GLIBC_2.2.6 get_phys_pages F
GLIBC_2.2.6 get_privileged_ports F
GLIBC_2.2.6 getaddrinfo F
GLIBC_2.2.6 getaddrinfo_a F
GLIBC_2.2.6 getaliasbyname F
GLIBC_2.2.6 getaliasbyname_r F
GLIBC_2.2.6 getaliasent F
@@ -2810,6 +2814,10 @@ GLIBC_2.44 aio_suspend F
GLIBC_2.44 aio_suspend64 F
GLIBC_2.44 aio_write F
GLIBC_2.44 aio_write64 F
GLIBC_2.44 gai_cancel F
GLIBC_2.44 gai_error F
GLIBC_2.44 gai_suspend F
GLIBC_2.44 getaddrinfo_a F
GLIBC_2.44 lio_listio F
GLIBC_2.44 lio_listio64 F
GLIBC_2.44 mq_close F
+1 -4
View File
@@ -1,4 +1 @@
GLIBC_2.38 gai_cancel F
GLIBC_2.38 gai_error F
GLIBC_2.38 gai_suspend F
GLIBC_2.38 getaddrinfo_a F
GLIBC_2.38 __libanl_version_placeholder F
+8
View File
@@ -973,7 +973,10 @@ GLIBC_2.38 fwprintf F
GLIBC_2.38 fwrite F
GLIBC_2.38 fwrite_unlocked F
GLIBC_2.38 fwscanf F
GLIBC_2.38 gai_cancel F
GLIBC_2.38 gai_error F
GLIBC_2.38 gai_strerror F
GLIBC_2.38 gai_suspend F
GLIBC_2.38 gcvt F
GLIBC_2.38 get_avphys_pages F
GLIBC_2.38 get_current_dir_name F
@@ -982,6 +985,7 @@ GLIBC_2.38 get_nprocs_conf F
GLIBC_2.38 get_phys_pages F
GLIBC_2.38 get_privileged_ports F
GLIBC_2.38 getaddrinfo F
GLIBC_2.38 getaddrinfo_a F
GLIBC_2.38 getaliasbyname F
GLIBC_2.38 getaliasbyname_r F
GLIBC_2.38 getaliasent F
@@ -2486,6 +2490,10 @@ GLIBC_2.44 aio_suspend F
GLIBC_2.44 aio_suspend64 F
GLIBC_2.44 aio_write F
GLIBC_2.44 aio_write64 F
GLIBC_2.44 gai_cancel F
GLIBC_2.44 gai_error F
GLIBC_2.44 gai_suspend F
GLIBC_2.44 getaddrinfo_a F
GLIBC_2.44 lio_listio F
GLIBC_2.44 lio_listio64 F
GLIBC_2.44 mq_close F
+1
View File
@@ -0,0 +1 @@
#define ANL_IN_LIBC GLIBC_2_34