[PATCH] libc: Fix dns-related build issues.

- The first observed issue is linking failure: ` /usr/bin/ld: libc/libc_so.a(encodeq.os): in function `__encode_question': encodeq.c:(.text+0x16): undefined reference to `__GI___dn_comp' /usr/bin/ld: libc/libc_so.a(dnslookup.os): in function `__dns_lookup': dnslookup.c:(.text+0x6fb): undefined reference to `__GI___dn_expand' /usr/bin/ld: dnslookup.c:(.text+0x7ab): undefined reference to `__hnbad' collect2: error: ld returned 1 exit status ` The root cause is that the resolv.c file contains some functions (dn_comp, dn_expand, __hnbad) under `#ifdef L_ns_name` and `#ifdef L_ns_comp` which wasn't defined, so we had undefined refs to such functions. - The second issue is misleading indentation inside `ns_name_pack`. ` libc/inet/resolv.c: In function '__ns_name_pack': libc/inet/resolv.c:3519:17: warning: this 'if' clause does not guard... 3519 | if (msg != NULL) ... ./include/errno.h:73:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 73 | # define errno errno /* For #ifndef errno tests. */ | ^~~~~ libc/inet/resolv.c:3522:25: note: in expansion of macro 'errno' 3522 | errno = EMSGSIZE; ` Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com> --- libc/inet/encodeq.c | 2 ++ libc/inet/resolv.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c index 5555aa548..dc7945bc6 100644 --- a/libc/inet/encodeq.c +++ b/libc/inet/encodeq.c @@ -5,4 +5,6 @@ */ #define L_encodeq +#define L_ns_name +#define L_res_comp #include RESOLVER diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 2f627ca08..37842021c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3519,8 +3519,8 @@ cleanup: if (msg != NULL) *lpp = NULL; - errno = EMSGSIZE; - return -1; + errno = EMSGSIZE; + return -1; } return dstp - dst; -- 2.43.0

Hi Dmitry, can you send us your .config so that I can locally reproduce the issue? Dmitry Chestnykh wrote,
- The first observed issue is linking failure: ` /usr/bin/ld: libc/libc_so.a(encodeq.os): in function `__encode_question': encodeq.c:(.text+0x16): undefined reference to `__GI___dn_comp' /usr/bin/ld: libc/libc_so.a(dnslookup.os): in function `__dns_lookup': dnslookup.c:(.text+0x6fb): undefined reference to `__GI___dn_expand' /usr/bin/ld: dnslookup.c:(.text+0x7ab): undefined reference to `__hnbad' collect2: error: ld returned 1 exit status ` The root cause is that the resolv.c file contains some functions (dn_comp, dn_expand, __hnbad) under `#ifdef L_ns_name` and `#ifdef L_ns_comp` which wasn't defined, so we had undefined refs to such functions.
- The second issue is misleading indentation inside `ns_name_pack`. ` libc/inet/resolv.c: In function '__ns_name_pack': libc/inet/resolv.c:3519:17: warning: this 'if' clause does not guard... 3519 | if (msg != NULL) ... ./include/errno.h:73:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 73 | # define errno errno /* For #ifndef errno tests. */ | ^~~~~ libc/inet/resolv.c:3522:25: note: in expansion of macro 'errno' 3522 | errno = EMSGSIZE; `
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com> --- libc/inet/encodeq.c | 2 ++ libc/inet/resolv.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c index 5555aa548..dc7945bc6 100644 --- a/libc/inet/encodeq.c +++ b/libc/inet/encodeq.c @@ -5,4 +5,6 @@ */
#define L_encodeq +#define L_ns_name +#define L_res_comp #include RESOLVER diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 2f627ca08..37842021c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3519,8 +3519,8 @@ cleanup: if (msg != NULL) *lpp = NULL;
- errno = EMSGSIZE; - return -1; + errno = EMSGSIZE; + return -1; }
return dstp - dst; -- 2.43.0
_______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org

Yes, of course сб, 10 февр. 2024 г. в 12:10, Waldemar Brodkorb <wbx@openadk.org>:
Hi Dmitry,
can you send us your .config so that I can locally reproduce the issue?
Dmitry Chestnykh wrote,
- The first observed issue is linking failure: ` /usr/bin/ld: libc/libc_so.a(encodeq.os): in function `__encode_question': encodeq.c:(.text+0x16): undefined reference to `__GI___dn_comp' /usr/bin/ld: libc/libc_so.a(dnslookup.os): in function `__dns_lookup': dnslookup.c:(.text+0x6fb): undefined reference to `__GI___dn_expand' /usr/bin/ld: dnslookup.c:(.text+0x7ab): undefined reference to `__hnbad' collect2: error: ld returned 1 exit status ` The root cause is that the resolv.c file contains some functions (dn_comp, dn_expand, __hnbad) under `#ifdef L_ns_name` and `#ifdef L_ns_comp` which wasn't defined, so we had undefined refs to such functions.
- The second issue is misleading indentation inside `ns_name_pack`. ` libc/inet/resolv.c: In function '__ns_name_pack': libc/inet/resolv.c:3519:17: warning: this 'if' clause does not guard... 3519 | if (msg != NULL) ... ./include/errno.h:73:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 73 | # define errno errno /* For #ifndef errno tests. */ | ^~~~~ libc/inet/resolv.c:3522:25: note: in expansion of macro 'errno' 3522 | errno = EMSGSIZE; `
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com> --- libc/inet/encodeq.c | 2 ++ libc/inet/resolv.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c index 5555aa548..dc7945bc6 100644 --- a/libc/inet/encodeq.c +++ b/libc/inet/encodeq.c @@ -5,4 +5,6 @@ */
#define L_encodeq +#define L_ns_name +#define L_res_comp #include RESOLVER diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 2f627ca08..37842021c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3519,8 +3519,8 @@ cleanup: if (msg != NULL) *lpp = NULL;
- errno = EMSGSIZE; - return -1; + errno = EMSGSIZE; + return -1; }
return dstp - dst; -- 2.43.0
_______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org

Hi Dmitry, I could reproduce the issue with your config. Thanks for fixing it, applied and pushed. best regards Waldemar Dmitry Chestnykh wrote,
- The first observed issue is linking failure: ` /usr/bin/ld: libc/libc_so.a(encodeq.os): in function `__encode_question': encodeq.c:(.text+0x16): undefined reference to `__GI___dn_comp' /usr/bin/ld: libc/libc_so.a(dnslookup.os): in function `__dns_lookup': dnslookup.c:(.text+0x6fb): undefined reference to `__GI___dn_expand' /usr/bin/ld: dnslookup.c:(.text+0x7ab): undefined reference to `__hnbad' collect2: error: ld returned 1 exit status ` The root cause is that the resolv.c file contains some functions (dn_comp, dn_expand, __hnbad) under `#ifdef L_ns_name` and `#ifdef L_ns_comp` which wasn't defined, so we had undefined refs to such functions.
- The second issue is misleading indentation inside `ns_name_pack`. ` libc/inet/resolv.c: In function '__ns_name_pack': libc/inet/resolv.c:3519:17: warning: this 'if' clause does not guard... 3519 | if (msg != NULL) ... ./include/errno.h:73:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 73 | # define errno errno /* For #ifndef errno tests. */ | ^~~~~ libc/inet/resolv.c:3522:25: note: in expansion of macro 'errno' 3522 | errno = EMSGSIZE; `
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com> --- libc/inet/encodeq.c | 2 ++ libc/inet/resolv.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/inet/encodeq.c b/libc/inet/encodeq.c index 5555aa548..dc7945bc6 100644 --- a/libc/inet/encodeq.c +++ b/libc/inet/encodeq.c @@ -5,4 +5,6 @@ */
#define L_encodeq +#define L_ns_name +#define L_res_comp #include RESOLVER diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 2f627ca08..37842021c 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -3519,8 +3519,8 @@ cleanup: if (msg != NULL) *lpp = NULL;
- errno = EMSGSIZE; - return -1; + errno = EMSGSIZE; + return -1; }
return dstp - dst; -- 2.43.0
_______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org
participants (3)
-
Dmitriy Chestnykh
-
Dmitry Chestnykh
-
Waldemar Brodkorb