diff options
| -rw-r--r-- | meta-networking/recipes-connectivity/openthread/ot-br-posix/Turn-off-sign-compare-for-musl-libc.patch | 131 | ||||
| -rw-r--r-- | meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb | 3 |
2 files changed, 2 insertions, 132 deletions
diff --git a/meta-networking/recipes-connectivity/openthread/ot-br-posix/Turn-off-sign-compare-for-musl-libc.patch b/meta-networking/recipes-connectivity/openthread/ot-br-posix/Turn-off-sign-compare-for-musl-libc.patch deleted file mode 100644 index df84550be0..0000000000 --- a/meta-networking/recipes-connectivity/openthread/ot-br-posix/Turn-off-sign-compare-for-musl-libc.patch +++ /dev/null | |||
| @@ -1,131 +0,0 @@ | |||
| 1 | From: Stefan Schmidt <stefan.schmidt@huawei.com> | ||
| 2 | Subject: Turn off sign compare for musl libc | ||
| 3 | |||
| 4 | When building with musl and clang the usage of CMSG_NXTHDR results in | ||
| 5 | sign-compare error. Disable the check only in this specific part of the | ||
| 6 | code with a #pragma. | ||
| 7 | |||
| 8 | | /home/stefan/huawei/yocto-upstream/yoe/workspace/sources/ot-br-posix/third_party/openthread/repo/src/posix/platform/udp.cpp:147:28: fatal error: comparison of integers of different signs: 'unsigned long' and 'long' [-Wsign-compare] | ||
| 9 | | cmsg = CMSG_NXTHDR(&msg, cmsg); | ||
| 10 | | ^~~~~~~~~~~~~~~~~~~~~~~ | ||
| 11 | | /home/stefan/huawei/yocto-upstream/yoe/build/tmp/work/cortexa57-yoe-linux-musl/ot-br-posix/0.3.0+git999-r0/recipe-sysroot/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR' | ||
| 12 | | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ | ||
| 13 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 14 | | 1 error generated. | ||
| 15 | |||
| 16 | Idea and fix taken from | ||
| 17 | recipes-devtools/breakpad/breakpad/0001-Turn-off-sign-compare-for-musl-libc.patch | ||
| 18 | by Khem Raj. | ||
| 19 | |||
| 20 | Upstream-Status: Inappropriate [OE specific] | ||
| 21 | |||
| 22 | Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com> | ||
| 23 | |||
| 24 | diff --git a/src/backbone_router/nd_proxy.cpp b/src/backbone_router/nd_proxy.cpp | ||
| 25 | index 7136878c3d..8a223c95c7 100644 | ||
| 26 | --- a/src/backbone_router/nd_proxy.cpp | ||
| 27 | +++ b/src/backbone_router/nd_proxy.cpp | ||
| 28 | @@ -185,9 +185,18 @@ void NdProxyManager::ProcessMulticastNeighborSolicition() | ||
| 29 | VerifyOrExit(icmp6header->icmp6_type == ND_NEIGHBOR_SOLICIT, error = OTBR_ERROR_PARSE); | ||
| 30 | |||
| 31 | otbrLogDebug("NdProxyManager: Received ND-NS from %s", src.ToString().c_str()); | ||
| 32 | - | ||
| 33 | +#ifndef __GLIBC__ | ||
| 34 | + // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes | ||
| 35 | + // clang to throw sign-compare warning. This is to suppress the warning | ||
| 36 | + // inline. | ||
| 37 | + #pragma clang diagnostic push | ||
| 38 | + #pragma clang diagnostic ignored "-Wsign-compare" | ||
| 39 | +#endif | ||
| 40 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr; cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr)) | ||
| 41 | - { | ||
| 42 | +#ifndef __GLIBC__ | ||
| 43 | + #pragma clang diagnostic pop | ||
| 44 | +#endif | ||
| 45 | + { | ||
| 46 | if (cmsghdr->cmsg_level != IPPROTO_IPV6) | ||
| 47 | { | ||
| 48 | continue; | ||
| 49 | Submodule third_party/openthread/repo contains modified content | ||
| 50 | diff --git a/third_party/openthread/repo/src/posix/platform/infra_if.cpp b/third_party/openthread/repo/src/posix/platform/infra_if.cpp | ||
| 51 | index 9f93d2b1c..1ed40fe50 100644 | ||
| 52 | --- a/third_party/openthread/repo/src/posix/platform/infra_if.cpp | ||
| 53 | +++ b/third_party/openthread/repo/src/posix/platform/infra_if.cpp | ||
| 54 | @@ -228,7 +228,17 @@ otError InfraNetif::SendIcmp6Nd(uint32_t aInfraIfIndex, | ||
| 55 | packetInfo->ipi6_ifindex = mInfraIfIndex; | ||
| 56 | |||
| 57 | // Per section 6.1.2 of RFC 4861, we need to send the ICMPv6 message with IP Hop Limit 255. | ||
| 58 | +#ifndef __GLIBC__ | ||
| 59 | + // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes | ||
| 60 | + // clang to throw sign-compare warning. This is to suppress the warning | ||
| 61 | + // inline. | ||
| 62 | + #pragma clang diagnostic push | ||
| 63 | + #pragma clang diagnostic ignored "-Wsign-compare" | ||
| 64 | +#endif | ||
| 65 | cmsgPointer = CMSG_NXTHDR(&msgHeader, cmsgPointer); | ||
| 66 | +#ifndef __GLIBC__ | ||
| 67 | + #pragma clang diagnostic pop | ||
| 68 | +#endif | ||
| 69 | cmsgPointer->cmsg_level = IPPROTO_IPV6; | ||
| 70 | cmsgPointer->cmsg_type = IPV6_HOPLIMIT; | ||
| 71 | cmsgPointer->cmsg_len = CMSG_LEN(sizeof(hopLimit)); | ||
| 72 | @@ -481,7 +491,17 @@ void InfraNetif::ReceiveIcmp6Message(void) | ||
| 73 | |||
| 74 | bufferLength = static_cast<uint16_t>(rval); | ||
| 75 | |||
| 76 | +#ifndef __GLIBC__ | ||
| 77 | + // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes | ||
| 78 | + // clang to throw sign-compare warning. This is to suppress the warning | ||
| 79 | + // inline. | ||
| 80 | + #pragma clang diagnostic push | ||
| 81 | + #pragma clang diagnostic ignored "-Wsign-compare" | ||
| 82 | +#endif | ||
| 83 | for (cmh = CMSG_FIRSTHDR(&msg); cmh; cmh = CMSG_NXTHDR(&msg, cmh)) | ||
| 84 | +#ifndef __GLIBC__ | ||
| 85 | + #pragma clang diagnostic pop | ||
| 86 | +#endif | ||
| 87 | { | ||
| 88 | if (cmh->cmsg_level == IPPROTO_IPV6 && cmh->cmsg_type == IPV6_PKTINFO && | ||
| 89 | cmh->cmsg_len == CMSG_LEN(sizeof(struct in6_pktinfo))) | ||
| 90 | diff --git a/third_party/openthread/repo/src/posix/platform/udp.cpp b/third_party/openthread/repo/src/posix/platform/udp.cpp | ||
| 91 | index b7aacc5fa..a814fea70 100644 | ||
| 92 | --- a/third_party/openthread/repo/src/posix/platform/udp.cpp | ||
| 93 | +++ b/third_party/openthread/repo/src/posix/platform/udp.cpp | ||
| 94 | @@ -144,8 +144,18 @@ otError transmitPacket(int aFd, uint8_t *aPayload, uint16_t aLength, const otMes | ||
| 95 | { | ||
| 96 | struct in6_pktinfo pktinfo; | ||
| 97 | |||
| 98 | +#ifndef __GLIBC__ | ||
| 99 | + // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes | ||
| 100 | + // clang to throw sign-compare warning. This is to suppress the warning | ||
| 101 | + // inline. | ||
| 102 | + #pragma clang diagnostic push | ||
| 103 | + #pragma clang diagnostic ignored "-Wsign-compare" | ||
| 104 | +#endif | ||
| 105 | cmsg = CMSG_NXTHDR(&msg, cmsg); | ||
| 106 | - cmsg->cmsg_level = IPPROTO_IPV6; | ||
| 107 | +#ifndef __GLIBC__ | ||
| 108 | + #pragma clang diagnostic pop | ||
| 109 | +#endif | ||
| 110 | + cmsg->cmsg_level = IPPROTO_IPV6; | ||
| 111 | cmsg->cmsg_type = IPV6_PKTINFO; | ||
| 112 | cmsg->cmsg_len = CMSG_LEN(sizeof(pktinfo)); | ||
| 113 | |||
| 114 | @@ -200,7 +210,17 @@ otError receivePacket(int aFd, uint8_t *aPayload, uint16_t &aLength, otMessageIn | ||
| 115 | VerifyOrExit(rval > 0, perror("recvmsg")); | ||
| 116 | aLength = static_cast<uint16_t>(rval); | ||
| 117 | |||
| 118 | +#ifndef __GLIBC__ | ||
| 119 | + // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes | ||
| 120 | + // clang to throw sign-compare warning. This is to suppress the warning | ||
| 121 | + // inline. | ||
| 122 | + #pragma clang diagnostic push | ||
| 123 | + #pragma clang diagnostic ignored "-Wsign-compare" | ||
| 124 | +#endif | ||
| 125 | for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) | ||
| 126 | +#ifndef __GLIBC__ | ||
| 127 | + #pragma clang diagnostic pop | ||
| 128 | +#endif | ||
| 129 | { | ||
| 130 | if (cmsg->cmsg_level == IPPROTO_IPV6) | ||
| 131 | { | ||
diff --git a/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb b/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb index d9f558d792..c1af388627 100644 --- a/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +++ b/meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb | |||
| @@ -16,7 +16,6 @@ PV = "0.3.0+git${SRCPV}" | |||
| 16 | 16 | ||
| 17 | SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main \ | 17 | SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main \ |
| 18 | file://0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch \ | 18 | file://0001-otbr-agent.service.in-remove-pre-exec-hook-for-mdns-.patch \ |
| 19 | file://Turn-off-sign-compare-for-musl-libc.patch \ | ||
| 20 | " | 19 | " |
| 21 | 20 | ||
| 22 | S = "${WORKDIR}/git" | 21 | S = "${WORKDIR}/git" |
| @@ -24,6 +23,8 @@ SYSTEMD_SERVICE:${PN} = "otbr-agent.service" | |||
| 24 | 23 | ||
| 25 | inherit pkgconfig cmake systemd | 24 | inherit pkgconfig cmake systemd |
| 26 | 25 | ||
| 26 | CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare" | ||
| 27 | |||
| 27 | EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \ | 28 | EXTRA_OECMAKE = "-DBUILD_TESTING=OFF \ |
| 28 | -DOTBR_DBUS=ON \ | 29 | -DOTBR_DBUS=ON \ |
| 29 | -DOTBR_REST=ON \ | 30 | -DOTBR_REST=ON \ |
