From 3eaca9bbc6fee4b6be0f22b844f7d3214222f434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 4 May 2023 10:36:05 +0300 Subject: [PATCH 1/2] glibc hacks: also add a few dn_* functions --- lib/libc/include/generic-glibc/resolv.h | 25 ++++++++++++++++--------- test/link/glibc_compat/main.c | 3 +++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/libc/include/generic-glibc/resolv.h b/lib/libc/include/generic-glibc/resolv.h index 406727e8fb82..d0f9955f9461 100644 --- a/lib/libc/include/generic-glibc/resolv.h +++ b/lib/libc/include/generic-glibc/resolv.h @@ -170,16 +170,20 @@ __END_DECLS #define res_isourserver __res_isourserver /* In glibc 2.33 and earlier res_search, res_nsearch, res_query, res_nquery, - * res_querydomain, res_nquerydomain were #define'd to __res_search, - * __res_nsearch, etc. glibc 2.34 onwards removes the macros and exposes the - * symbols directly. New glibc exposes compat symbols with underscores for - * backwards compatibility. Applications linked to glibc 2.34+ are expected - * to use the non-underscored symbols. + * res_querydomain, res_nquerydomain, dn_skipname, dn_comp, dn_expand were + * #define'd to __res_search, __res_nsearch, etc. glibc 2.34 onwards removes + * the macros and exposes the symbols directly. New glibc exposes compat + * symbols with underscores for backwards compatibility. Applications linked to + * glibc 2.34+ are expected to use the non-underscored symbols. * - * It will be enough to bring the macros back when compiling against the older - * glibc versions. + * It is enough to bring the macros back when compiling against the older glibc + * versions. * - * See glibc commit ea9878ec271c791880fcbbe519d70c42f8113750. + * See glibc commits: + * - ea9878ec271c791880fcbbe519d70c42f8113750 res_* + * - 391e02236b931132c0e8b5ba4c3b087c2aaa1044 dn_skipname + * - fd8a87c0c1932de591e7ad108ff6288a4b6b18c9 dn_comp + * - 640bbdf71c6f10ac26252ac67a22902e26657bd8 dn_expand */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34) #define res_search __res_search @@ -188,6 +192,9 @@ __END_DECLS #define res_nquery __res_nquery #define res_querydomain __res_querydomain #define res_nquerydomain __res_nquerydomain +#define dn_skipname __dn_skipname +#define dn_comp __dn_comp +#define dn_expand __dn_expand #endif /* end glibc compat hacks */ @@ -327,4 +334,4 @@ void res_nclose (res_state) __THROW; __END_DECLS -#endif /* !_RESOLV_H_ */ \ No newline at end of file +#endif /* !_RESOLV_H_ */ diff --git a/test/link/glibc_compat/main.c b/test/link/glibc_compat/main.c index d9059eb8a628..29ec920a58b2 100644 --- a/test/link/glibc_compat/main.c +++ b/test/link/glibc_compat/main.c @@ -34,4 +34,7 @@ int main() { printf("address to res_nquery: %p\n", res_nquery); printf("address to res_querydomain: %p\n", res_querydomain); printf("address to res_nquerydomain: %p\n", res_nquerydomain); + printf("address to dn_skipname: %p\n", dn_skipname); + printf("address to dn_comp: %p\n", dn_comp); + printf("address to dn_expand: %p\n", dn_expand); } From 892d4e13027b4469f89f9b0d75991639a87cd03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 4 May 2023 10:36:37 +0300 Subject: [PATCH 2/2] glibc hacks: add another commit to our patches --- lib/libc/glibc/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/glibc/README.md b/lib/libc/glibc/README.md index 399d3beb2d27..e5fe99a53267 100644 --- a/lib/libc/glibc/README.md +++ b/lib/libc/glibc/README.md @@ -6,3 +6,4 @@ need to be cherry-picked in the future glibc header upgrades: - 39083c31a550ed80f369f60d35791e98904b8096 - a89813ef282c092a9caf699731c7faaf485acabe +- 3eaca9bbc6fee4b6be0f22b844f7d3214222f434