From patchwork Sun Jan 15 18:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1C2AC3DA78 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mx.groups.io with SMTP id smtpd.web10.147208.1673808716618346669 for ; Sun, 15 Jan 2023 10:51:56 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Du1VqgAO; spf=pass (domain: gmail.com, ip: 209.85.216.53, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f53.google.com with SMTP id bj3so23916906pjb.0 for ; Sun, 15 Jan 2023 10:51:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Eajfo8R5ogrPRPSYGNd0ytoUyGMFARBm8GA7qlWCEBE=; b=Du1VqgAOf0QATxPAfeHmwYugY0pvZqCeWL85zI9ovyBYK74kSOpM2jqQE1TaXmmO/3 oRIs9SZvYAauoWqeBKaqBkUl0E+Y4WzeBmR56NIZ1TZAfgCM8pIbKNUhY2rzQzrv/xhx qMFboV15JkaZpXzXjOUBqgUhssKF72abM/0K7egXvu+HRFesG3kddl4v6rhV+U2W5tBA G2NTpxiWkxgG9WnKr8pnGNQZ8NzBipQI3lJm/2zU44x/11mvpZKdgm0mypHuqri4qWMv zj7tsYIzMzR+vNcrqYdEeGBNXgsNfZoo4pGWTLfeugQbZ+O+4t2HxKRQYesixzW6b/AF zXwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Eajfo8R5ogrPRPSYGNd0ytoUyGMFARBm8GA7qlWCEBE=; b=XWbVIZw+K+Ieq486eEV56iQpumvcuOH0azl+TnFsyXO0BGC4UpodfwnJuMGXWlwQcO MJi5vHUhBd0CQ22nrnpm/Qp0oVXuAmtbiAfdpvHlKnEt1rsykbfHlujWug9/j9Iutq3q NQLu6DXxKfyWwEW3tVTDOmd8VvuXb/X0nJowB6EJkH/8huLTPKCtM2c7DPGt/U3yPJ4s 7GJ7qGHpjBBlAnUtydI41c/UDx+pVdEnu2z4sLBghG6092h7MwyLGRuYnj4tdzYyMQdx Rsj8i/HX1cXazyZb8a9KFPgKa4/PtOGEdy3ssK6vVKhaPND4ZVpeXxgum5YxSBcmWciz dt8g== X-Gm-Message-State: AFqh2koReK+uvnVd3FcD2p7+U13WI6/Oc5KFpsnJUqrZVXHynrXBqy1S UfmNF384U03ZPijXnnKTpHvOmQqMkQVNCA== X-Google-Smtp-Source: AMrXdXswqYS/8JvK9qHznlmal/G99OOVho+f3yzZDNElyk1zQ6HXuIT61wzj4Wc2qYFsQ5c61Rki3Q== X-Received: by 2002:a17:902:9898:b0:193:1aa5:573 with SMTP id s24-20020a170902989800b001931aa50573mr18394595plp.13.1673808715675; Sun, 15 Jan 2023 10:51:55 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:55 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 1/6] libxcb: Fixed c2x standard undefined behaviour Date: Sun, 15 Jan 2023 10:51:48 -0800 Message-Id: <20230115185153.2277534-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175950 Signed-off-by: Khem Raj --- ...-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch | 45 +++++++++++++++++++ meta/recipes-graphics/xorg-lib/libxcb_1.15.bb | 3 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-graphics/xorg-lib/libxcb/0001-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch diff --git a/meta/recipes-graphics/xorg-lib/libxcb/0001-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch b/meta/recipes-graphics/xorg-lib/libxcb/0001-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch new file mode 100644 index 0000000000..5b159d646d --- /dev/null +++ b/meta/recipes-graphics/xorg-lib/libxcb/0001-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch @@ -0,0 +1,45 @@ +From d55b6b1fa87700f3eae3a29522972d2e7be7d53e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 10:11:35 -0800 +Subject: [PATCH] use _Alignof to avoid UB in ALIGNOF + +WG14 N2350 clearly says that it is an UB having type definitions +within "offsetof" [1]. Clang 16+ has started diagnosing it [2]. +This patch changes the implementation of macro +"ALIGNOF" to builtin "_Alignof" to avoid undefined behavior. + +_Alignof() return the ABI required minimum alignment. + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/42] +Signed-off-by: Khem Raj +--- + src/c_client.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/c_client.py b/src/c_client.py +index fd256f0..4e48f13 100644 +--- a/src/c_client.py ++++ b/src/c_client.py +@@ -288,7 +288,6 @@ def c_open(self): + _c('#include "%s.h"', _ns.header) + + _c('') +- _c('#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)') + + if _ns.is_ext: + for (n, h) in self.direct_imports: +@@ -1266,7 +1265,7 @@ def _c_serialize_helper_fields(context, self, + count += 1 + + code_lines.append( +- '%s xcb_align_to = ALIGNOF(%s);' ++ '%s xcb_align_to = _Alignof(%s);' + % (space, + 'char' + if field.c_field_type == 'void' or field.type.is_switch +-- +2.39.0 + diff --git a/meta/recipes-graphics/xorg-lib/libxcb_1.15.bb b/meta/recipes-graphics/xorg-lib/libxcb_1.15.bb index 839577326e..411f51ac39 100644 --- a/meta/recipes-graphics/xorg-lib/libxcb_1.15.bb +++ b/meta/recipes-graphics/xorg-lib/libxcb_1.15.bb @@ -9,7 +9,8 @@ SECTION = "x11/libs" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7" -SRC_URI = "http://xcb.freedesktop.org/dist/libxcb-${PV}.tar.xz" +SRC_URI = "http://xcb.freedesktop.org/dist/libxcb-${PV}.tar.xz \ + file://0001-use-_Alignof-to-avoid-UB-in-ALIGNOF.patch" SRC_URI[sha256sum] = "cc38744f817cf6814c847e2df37fcb8997357d72fa4bcbc228ae0fe47219a059" From patchwork Sun Jan 15 18:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D385BC678D9 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mx.groups.io with SMTP id smtpd.web10.147209.1673808717675495114 for ; Sun, 15 Jan 2023 10:51:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UtcM6spN; spf=pass (domain: gmail.com, ip: 209.85.214.175, mailfrom: raj.khem@gmail.com) Received: by mail-pl1-f175.google.com with SMTP id k18so4206818pll.5 for ; Sun, 15 Jan 2023 10:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vViIPr9Wfz1GDkzyMAdQEpaAVwTP6pOBz6mq8OFAW3U=; b=UtcM6spNmIIhC2ZuRFIEQPsIARqdcQhIN+9yJ2nTSL3XpfuI0jHzQgYw4Y9Kp6rhQp vfTLSmRc5KbjX4Z71Tcu4u1nfVcpxnYKmG5ZuJjQarR19L3l+GLQxFBhEa14QGUBqrL7 bferCcAXysLVF5ag0OOu5p0HILw6HQstfFct4rvkd/x3OdK5CLWCMuGR2e0i5hWGFmDU PtPxtEGa2AiI1wwVhrXXSUBsUlFahD1MAv1iv6l1WlM3AFGFLzTQGx4XIS+/OpXFzHf/ ql0WgvMit/mlDypiybJLq6yqkVHWOhN1Ml0m7QdAqLJRnmqzumvGTxQINAmHmuEBkWwF X8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vViIPr9Wfz1GDkzyMAdQEpaAVwTP6pOBz6mq8OFAW3U=; b=utVg+W10HkSuL6SxaAiyUXa8rVvJGZCu0NzrJBEwp0NeFjPIW/zK4nGXuMKnLP7Iq4 ejjY0BVu+jrEtmJchd2jkPAl4BF5t7v19HQB6TJhKxcRJ2Diu+lK04n68TPg95F3apij R7ofGUDXs38hDLHmLYVydhjvS0LtS4/r2L24XcmbLfCgKoXxxWJe6Lo8mjciSLETs5dl 7Lkjpi+A67LxYsFZ0XCOfXV/dzBgvBs6fYEypHrXrNb6+kfXs4HwwCCDV32FWfoUmiL3 B10wykmBnzHrmGw/bZi+ROxKYqBatvk10mHWt6CzSK0cIbIreFx+6xd1BtzippeIpn9L br/g== X-Gm-Message-State: AFqh2krz9vhv1ULEbzatqF+cwbTJOFCnfh0tRJ7Q95PALuBL04bPGuUE BCcL23iAkJ2E3Xw99KI1/1E96XIW9fV/5A== X-Google-Smtp-Source: AMrXdXviWlFYlOikABnvn3nuqSG27Xt3tOjE720V1U7oq0QKGJ5iZ516pvrkebLpQ2Vbr04PkgABEA== X-Received: by 2002:a17:902:bb8f:b0:194:620c:9216 with SMTP id m15-20020a170902bb8f00b00194620c9216mr14285190pls.21.1673808716790; Sun, 15 Jan 2023 10:51:56 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:56 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 2/6] glib-2.0: Switch to using C11 std Date: Sun, 15 Jan 2023 10:51:49 -0800 Message-Id: <20230115185153.2277534-2-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115185153.2277534-1-raj.khem@gmail.com> References: <20230115185153.2277534-1-raj.khem@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175951 Signed-off-by: Khem Raj --- ...0001-Switch-from-C99-to-C11-standard.patch | 40 +++++++++++++++++ ...efine-check_alignof-for-std-c11-and-.patch | 44 +++++++++++++++++++ meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb | 2 + 3 files changed, 86 insertions(+) create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0001-Switch-from-C99-to-C11-standard.patch create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0001-tests-macros.c-Define-check_alignof-for-std-c11-and-.patch diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Switch-from-C99-to-C11-standard.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Switch-from-C99-to-C11-standard.patch new file mode 100644 index 0000000000..4ddf49a9df --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Switch-from-C99-to-C11-standard.patch @@ -0,0 +1,40 @@ +From 59f4bdaedccb14802810e2f28646cc039a92f3d3 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 12:15:29 -0800 +Subject: [PATCH] Switch from C99 to C11 standard + +We need to start using _Alignof consistently as the fallback +implementation which uses types within offsetof is UB as per WG14 N2350 +[1], moreover newer compilers like clang 16+ have started to error on +such use. + +Fixes errors like below with clang 16+ + +| ../glib-2.74.4/glib/ghash.c:299:18: error: 'struct (unnamed at ../glib-2.74.4/glib/ghash.c:299:1)' cannot be defined in '__builtin_offsetof' +| G_STATIC_ASSERT (G_ALIGNOF (GHashTableIter) >= G_ALIGNOF (RealIter)); + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3202] +Signed-off-by: Khem Raj +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 8d3500ad7..87662fa47 100644 +--- a/meson.build ++++ b/meson.build +@@ -5,7 +5,7 @@ project('glib', 'c', + default_options : [ + 'buildtype=debugoptimized', + 'warning_level=3', +- 'c_std=gnu99' ++ 'c_std=gnu11' + ] + ) + +-- +2.39.0 + diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-tests-macros.c-Define-check_alignof-for-std-c11-and-.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-tests-macros.c-Define-check_alignof-for-std-c11-and-.patch new file mode 100644 index 0000000000..c6f2ee1948 --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-tests-macros.c-Define-check_alignof-for-std-c11-and-.patch @@ -0,0 +1,44 @@ +From 3a86bfadd67983267e5d89b1a7e3a637041e599b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 10:54:28 -0800 +Subject: [PATCH] tests/macros.c: Define check_alignof for std=c11 and newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch changes the implementation of macro +check_alignof to builtin "_Alignof" to avoid undefined behavior. + +clang 16+ has started to diagnose this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3201] +Signed-off-by: Khem Raj +--- + glib/tests/macros.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/glib/tests/macros.c b/glib/tests/macros.c +index efe632b..17b1646 100644 +--- a/glib/tests/macros.c ++++ b/glib/tests/macros.c +@@ -42,9 +42,13 @@ test_assert_static (void) + static void + test_alignof_fallback (void) + { ++#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) ++#define check_alignof(type) \ ++ g_assert_cmpint (G_ALIGNOF (type), ==, _Alignof (type)) ++#else + #define check_alignof(type) \ + g_assert_cmpint (G_ALIGNOF (type), ==, G_STRUCT_OFFSET (struct { char a; type b; }, b)) +- ++#endif + check_alignof (char); + check_alignof (int); + check_alignof (float); +-- +2.39.0 + diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb index e5279e946c..de3f55e865 100644 --- a/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb +++ b/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb @@ -19,6 +19,8 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ file://cpp-null.patch \ file://cpp-null2.patch \ file://fix-errno.patch \ + file://0001-tests-macros.c-Define-check_alignof-for-std-c11-and-.patch \ + file://0001-Switch-from-C99-to-C11-standard.patch \ " SRC_URI:append:class-native = " file://relocate-modules.patch" From patchwork Sun Jan 15 18:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3EB9C67871 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mx.groups.io with SMTP id smtpd.web10.147210.1673808718549268336 for ; Sun, 15 Jan 2023 10:51:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Y0n9Mucf; spf=pass (domain: gmail.com, ip: 209.85.216.44, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f44.google.com with SMTP id o13so23624494pjg.2 for ; Sun, 15 Jan 2023 10:51:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4KVr+H2nOvMC9YxQdQk2BOwsmMvtMykaC9C9gTNoGM0=; b=Y0n9Mucf40slG+anIlU671WSvGd12qz1e7f/VSMF7RiiLgsQblpQIQT8ijT1RuzjM/ W8pAkdQbF7FwsAvwjZ3dolnbmgxO3vtc+usyrkMcC0lrn0brQ+Tzu/MY65RR5BpafPNW A5kRbPtr6NBXPUS/V7KNA5A2Wwjd8umTi9SVIwSlMFtcfui5Ppv0IbKpvEochCQy47gQ t5JT4shNHne2JxShhYxPuT6jKaUlO04if/JBIai7uUHmyNgg3p2EFniI2zEbl8eyVgsX 6+em92Pw9+11162PyOfdaeH0hh7QptaX3/V6PAe587o2RDEq9KjGYTTGumuwb9rmc1N6 GxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4KVr+H2nOvMC9YxQdQk2BOwsmMvtMykaC9C9gTNoGM0=; b=idAtgpyQS/4E1MUolc1mYEIdk1NQ5amzChJfeyXdI9FrtCxWlOfow/5lWVqyFJuCoH 4BI6loCu5dEmwIbqaGqBzxJtq/lV1mILahWC4NvYL3HHAPrC6wSxU9gbVnyYtPIrjAA8 BBC7UZCk3+Cdx+Xx/TBed1o6y/J12OdmJZNaKqV3K+31CA9mTWJwAGknzR2l+UAF6ofp GC9RF1Jd5C8lO2LKqwT3PuUbwOhaSphGxgufbXoGtpt/k/69J8ZZqxseB7goOEFo4mHa G0pk7L4zPdKBlfe+H8yehqGth/toOd+XW/e9b/xlyWqaA90N2RWLNfhqOt+DrvPR+TcM Zi1A== X-Gm-Message-State: AFqh2koMoY8tkUYAUyYMxOJA5HLm4Imc9fmhTEKcMxpcgMDEaVPxbj0C YDXtxrX0MLFIe4pAoLwZ6LQ+V3KIRBVjjg== X-Google-Smtp-Source: AMrXdXvfdSw7W5mrmTUAS7uqo5E4NuYoHCt2I7g2TcDYrA0FaWIuVuvvQcLN1HjeH8/K1CUY0HpW+g== X-Received: by 2002:a17:902:b613:b0:18f:98bb:c08e with SMTP id b19-20020a170902b61300b0018f98bbc08emr85325478pls.36.1673808717761; Sun, 15 Jan 2023 10:51:57 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:57 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 3/6] dbus: Use Alignof when using C11 or newer standard Date: Sun, 15 Jan 2023 10:51:50 -0800 Message-Id: <20230115185153.2277534-3-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115185153.2277534-1-raj.khem@gmail.com> References: <20230115185153.2277534-1-raj.khem@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175952 Fixes an UB found with with clang Signed-off-by: Khem Raj --- ...GNOF-using-_Alignof-when-using-C11-o.patch | 42 +++++++++++++++++++ meta/recipes-core/dbus/dbus_1.14.4.bb | 1 + 2 files changed, 43 insertions(+) create mode 100644 meta/recipes-core/dbus/dbus/0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch diff --git a/meta/recipes-core/dbus/dbus/0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch b/meta/recipes-core/dbus/dbus/0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch new file mode 100644 index 0000000000..7b4e26f99e --- /dev/null +++ b/meta/recipes-core/dbus/dbus/0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch @@ -0,0 +1,42 @@ +From c3e2c873ffa8e89b5f83dccc4e4e35dfcea633cb Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 12:39:43 -0800 +Subject: [PATCH] Define _DBUS_ALIGNOF using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch changes the implementation of macro +_DBUS_ALIGNOF to builtin "_Alignof" to avoid undefined behavior. + +clang 16+ has started to diagnose this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/389] +Signed-off-by: Khem Raj +--- + dbus/dbus-internals.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h +index cc98c92a..2387752d 100644 +--- a/dbus/dbus-internals.h ++++ b/dbus/dbus-internals.h +@@ -201,8 +201,12 @@ void _dbus_real_assert_not_reached (const char *explanation, + ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member)) + #endif + ++#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) ++#define _DBUS_ALIGNOF(type) _Alignof(type) ++#else + #define _DBUS_ALIGNOF(type) \ + (_DBUS_STRUCT_OFFSET (struct { char _1; type _2; }, _2)) ++#endif + + #if defined(DBUS_DISABLE_CHECKS) || defined(DBUS_DISABLE_ASSERT) + /* this is an assert and not an error, but in the typical --disable-checks case (you're trying +-- +2.39.0 + diff --git a/meta/recipes-core/dbus/dbus_1.14.4.bb b/meta/recipes-core/dbus/dbus_1.14.4.bb index 5f91ec2dc1..ee05496203 100644 --- a/meta/recipes-core/dbus/dbus_1.14.4.bb +++ b/meta/recipes-core/dbus/dbus_1.14.4.bb @@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6423dcd74d7be9715b0db247fd889da3 \ SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.xz \ file://run-ptest \ file://tmpdir.patch \ + file://0001-Define-_DBUS_ALIGNOF-using-_Alignof-when-using-C11-o.patch \ file://dbus-1.init \ " From patchwork Sun Jan 15 18:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1DC1C678D7 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mx.groups.io with SMTP id smtpd.web10.147212.1673808719503905427 for ; Sun, 15 Jan 2023 10:51:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ef5c0Tzf; spf=pass (domain: gmail.com, ip: 209.85.216.50, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f50.google.com with SMTP id s13-20020a17090a6e4d00b0022900843652so10323651pjm.1 for ; Sun, 15 Jan 2023 10:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pn70orqqyWieroVIwIoqRA3ywcJ6lv4m6C3blwZ9Nd4=; b=Ef5c0TzfzyOkG/YdRzydAexNSW1vSmn7ht0JRkrEoOjvFlhd1su+HmXxeQ3zY/rf57 LoDfuzN99Xh72D0/inK0ph32dVb3E+RVJHZaFgLuBSfnMd+6ugiTLtDmTWdMgZcgaLwQ EWgy5BOTgbcZY7grYbquqa03Rlhpk5o64SFY7JgOnSfiuvwYB+eW5tMyYtFsWcqkT0Bg cdBk53dFGAIIbtA6u4xJ2wRsqLJa4Lk57+4oA2q5BkKiZ9qTeih1JQp/BMNRhewQB32/ D6Col/KwAj1NTon2nCUDST7wAjEbb0WKQX/d7h+XlL6bVCtmRmtnWpKc5u6gXqtkFn8s KWaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pn70orqqyWieroVIwIoqRA3ywcJ6lv4m6C3blwZ9Nd4=; b=hpZMqvxI9GFayzuToHQqfnjuoScSR9wiZuu91YzjK3yFzU9T+VwffSb4nQd3oRBPf2 Ohlufqy62qh6fXzMAimuY1GuzdCuEk/L6xfmg6xEvLk/WdUcD2mDU+VDjfXzM0v/Yq+/ YrG26N4EfRc4SiDPuJ6Hks/o9HKMR0YYhnYfUY44MEZ45ODDiDncqj36NUh32YzwTjEU srvuWB7Tt4V3ZQb25FcC6YfeKLyTzv8VC+cFoLs3Sk6NAN8WAv9fuAfYyMSw/ZV6lIe/ /jVR0HBY0Z+MYR6VRQTPN22w07e1S0BWLGPtM9535RDkCNvnkbIEHlB9u4zpYHoSBXH9 pEpQ== X-Gm-Message-State: AFqh2kqXwR8o/78O9xaODOpZb5SKPrl8u+U+gZ2FNLxASIohDivrFY1e f64iltOG1vFsfQliPj/MtdRA4Eh2tiC+Dw== X-Google-Smtp-Source: AMrXdXt2kMetkR4EMTcx74VS8rnBNf2c+Phlkczy+lZIQJ+LvSLUUFZVLFawZeSQGzO6XWHsF/qVNg== X-Received: by 2002:a17:902:e3d2:b0:192:fd1e:a96c with SMTP id r18-20020a170902e3d200b00192fd1ea96cmr16138504ple.26.1673808718709; Sun, 15 Jan 2023 10:51:58 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:58 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 4/6] m4: Define alignof_slot using _Alignof when using C11 or newer Date: Sun, 15 Jan 2023 10:51:51 -0800 Message-Id: <20230115185153.2277534-4-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115185153.2277534-1-raj.khem@gmail.com> References: <20230115185153.2277534-1-raj.khem@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175953 Signed-off-by: Khem Raj --- meta/recipes-devtools/m4/m4-1.4.19.inc | 1 + ...lot-using-_Alignof-when-using-C11-or.patch | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 meta/recipes-devtools/m4/m4/0001-Define-alignof_slot-using-_Alignof-when-using-C11-or.patch diff --git a/meta/recipes-devtools/m4/m4-1.4.19.inc b/meta/recipes-devtools/m4/m4-1.4.19.inc index 6ee9742277..c098a4077e 100644 --- a/meta/recipes-devtools/m4/m4-1.4.19.inc +++ b/meta/recipes-devtools/m4/m4-1.4.19.inc @@ -9,6 +9,7 @@ inherit autotools texinfo ptest gettext SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \ file://ac_config_links.patch \ file://0001-sigsegv-Fix-build-on-ppc-musl.patch \ + file://0001-Define-alignof_slot-using-_Alignof-when-using-C11-or.patch \ " SRC_URI:append:class-target = " file://run-ptest \ file://serial-tests-config.patch \ diff --git a/meta/recipes-devtools/m4/m4/0001-Define-alignof_slot-using-_Alignof-when-using-C11-or.patch b/meta/recipes-devtools/m4/m4/0001-Define-alignof_slot-using-_Alignof-when-using-C11-or.patch new file mode 100644 index 0000000000..8757abd7a0 --- /dev/null +++ b/meta/recipes-devtools/m4/m4/0001-Define-alignof_slot-using-_Alignof-when-using-C11-or.patch @@ -0,0 +1,49 @@ +From b0fd3a58354b1f5ead891907979dfd3dd36840d5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 14:55:03 -0800 +Subject: [PATCH] Define alignof_slot using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch enhances the implementation of macro +alignof_slot to use builtin "_Alignof" to avoid undefined behavior on +when using std=c11 or newer + +clang 16+ has started to flag this [2] + +Fixes build when using -std >= gnu11 and using clang16+ [3] + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 +[3] https://public-inbox.org/bug-gnulib/20230114232744.215167-1-raj.khem@gmail.com/T/#u + +Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d404c7dd974cc65f894526f4a1b76bc1dcd8d82] +Signed-off-by: Khem Raj +--- + lib/alignof.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/lib/alignof.h ++++ b/lib/alignof.h +@@ -18,19 +18,19 @@ + #define _ALIGNOF_H + + #include ++#include "stdalign.h" + + /* alignof_slot (TYPE) + Determine the alignment of a structure slot (field) of a given type, + at compile time. Note that the result depends on the ABI. +- This is the same as alignof (TYPE) and _Alignof (TYPE), defined in +- if __alignof_is_defined is 1. ++ This is the same as alignof (TYPE). + Note: The result cannot be used as a value for an 'enum' constant, + due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ + #if defined __cplusplus + template struct alignof_helper { char __slot1; type __slot2; }; + # define alignof_slot(type) offsetof (alignof_helper, __slot2) + #else +-# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) ++# define alignof_slot(type) alignof (type) + #endif + + /* alignof_type (TYPE) From patchwork Sun Jan 15 18:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A789EC63797 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mx.groups.io with SMTP id smtpd.web10.147213.1673808720337827403 for ; Sun, 15 Jan 2023 10:52:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lJ9yKSjy; spf=pass (domain: gmail.com, ip: 209.85.216.47, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f47.google.com with SMTP id m7-20020a17090a730700b00225ebb9cd01so31842352pjk.3 for ; Sun, 15 Jan 2023 10:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qiLmCTixg5KbxsYbSgLyC4jY8nkP22EyklJZ0D8P3vg=; b=lJ9yKSjyu354nmpvCVA+8U1el8HJPe2Bsdr33rH/8r8e7QzZk+4YTYRKR0mVewBwic 8dS49oBRqns4XGdHR9NFd/VAz6zu2fT+jdN1Lk6BJMv0OsFK+5aTHwIHbDE7WUBAjt8K QkcNjdi1yasBtipjp9p1Aejjg9vBuc62W3NOMSE8k9SrNiF6IsxplIxmqvqUoNKgY7FF wSArq3SarS+JOdftyGpUKu53GIO/Obz7pQQ6QYgGMX18etAHP6ZZj0bmSu9g4kGUZmrL IjgX5DMKEH6uTfYyu8HNEjw3CVA2q+YGivZ8DJnYzP0/zC1wCEZYq4PLh8nWO/Pzuz7K FqiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qiLmCTixg5KbxsYbSgLyC4jY8nkP22EyklJZ0D8P3vg=; b=WxLxykCzt6yUXDwDrhbJ5Zn0jake7Npk6NenNeWYnWO+OhzcFESv43mq/2a9vPXd3+ Y9V1QFPelyP14kMO7JfCnVU8tltQB1w7MVNZhw9uog/VXc8/niPz+UwMzCFnOmf2cGH7 0JoQ/HKnIY4B+kVucF5G7NFW+6A83c25mmKhLEPD2ADL3USSANIJwidvt6RLT+Fbsbmv B4/CaovypWdH3i6HW8vXac5ElB5Ub7DKZemeg5jthkGX/rtbx/ZA0lbZw/4JKos3StVI xsiSFf1bxpEcfCK2wK7st4f3R65SEeAZ7ozjNrsb5miyyn+oOdsIT0yaYRJLfZtRddwQ h+gQ== X-Gm-Message-State: AFqh2krU6hCiRl8cYZZ36/rr731VQjukEHHuL5Ltg3/gaCqE+BOUKkFb PQiIXtmzh+YW0utEf64zSA3/hJAAzly2xA== X-Google-Smtp-Source: AMrXdXun71sdLfaeOkGu6NenfJW4L72S5LkIOX1ypyk6Jg4VffZsbnzAUQBtPGvOtKR5k5JSgrzSrw== X-Received: by 2002:a17:902:bd8d:b0:192:8cd1:5e79 with SMTP id q13-20020a170902bd8d00b001928cd15e79mr19269512pls.41.1673808719493; Sun, 15 Jan 2023 10:51:59 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:59 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 5/6] opkg: Define alignof using _Alignof when using C11 or newer Date: Sun, 15 Jan 2023 10:51:52 -0800 Message-Id: <20230115185153.2277534-5-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115185153.2277534-1-raj.khem@gmail.com> References: <20230115185153.2277534-1-raj.khem@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175954 Signed-off-by: Khem Raj --- ...sing-_Alignof-when-using-C11-or-newe.patch | 51 +++++++++++++++++++ meta/recipes-devtools/opkg/opkg_0.6.1.bb | 1 + 2 files changed, 52 insertions(+) create mode 100644 meta/recipes-devtools/opkg/opkg/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch diff --git a/meta/recipes-devtools/opkg/opkg/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta/recipes-devtools/opkg/opkg/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch new file mode 100644 index 0000000000..3406878a1d --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch @@ -0,0 +1,51 @@ +From 4089affd371e6d62dd8c1e57b344f8cc329005ea Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 14 Jan 2023 23:11:08 -0800 +Subject: [PATCH] Define alignof using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch enhances the implementation of macro +alignof_slot to use builtin "_Alignof" to avoid undefined behavior on +when using std=c11 or newer + +clang 16+ has started to flag this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it +may support C11, exclude those compilers too + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Submitted [https://groups.google.com/g/opkg-devel/c/gjcQPZgT_jI] +Signed-off-by: Khem Raj +--- + libopkg/md5.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libopkg/md5.c b/libopkg/md5.c +index 981b9b8..ccb645e 100644 +--- a/libopkg/md5.c ++++ b/libopkg/md5.c +@@ -237,7 +237,17 @@ void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx) + /* Process available complete blocks. */ + if (len >= 64) { + #if !_STRING_ARCH_unaligned ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ . ++ clang versions < 8.0.0 have the same bug. */ ++#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) + #define alignof(type) offsetof (struct { char c; type x; }, x) ++#else ++#define alignof(type) _Alignof(type) ++#endif + #define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P(buffer)) + while (len > 64) { +-- +2.39.0 + diff --git a/meta/recipes-devtools/opkg/opkg_0.6.1.bb b/meta/recipes-devtools/opkg/opkg_0.6.1.bb index 712f066f0e..c95a40d268 100644 --- a/meta/recipes-devtools/opkg/opkg_0.6.1.bb +++ b/meta/recipes-devtools/opkg/opkg_0.6.1.bb @@ -16,6 +16,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ file://0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch \ + file://0001-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ file://run-ptest \ " From patchwork Sun Jan 15 18:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 18160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8ABDC677F1 for ; Sun, 15 Jan 2023 18:52:02 +0000 (UTC) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mx.groups.io with SMTP id smtpd.web11.147061.1673808721260438838 for ; Sun, 15 Jan 2023 10:52:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Uy6X3Uxs; spf=pass (domain: gmail.com, ip: 209.85.216.41, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f41.google.com with SMTP id dw9so25706564pjb.5 for ; Sun, 15 Jan 2023 10:52:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dKj7wQ7kNuz1BHNi1sZGZVSIk4Mg6KHpbCG9mKMFrjs=; b=Uy6X3Uxsd3+hvoLj5SoeEXuM3VorKFm+2dJXEvrPtcdLWiM4VdnqOTalLyminfh3/+ cqMNgLoynPsb+LZCKIwrVFP+0xOE7YRcJmsQaWfJEIUT8IA0uho0czqAf2DDViAN5MOz oZBkqutzJ0nP3982v/vrvyzTU+Sgl+y19JuhHHoY4MPUiilz1t+e6r/+qEBYTEqCyVCv tI/i9lUy05WhPhZcKf/W8OGNpcaZbRoNylcCnKJN0xoYrpc9lEnpzwJaAKIawwihRGAO 8+z5IJRfB4Y4AN+CEtBkGR+KlUEZRTg+q6gLe7zWqgf4U7sZUTlv8s0X3EGJaHQuRr/x miXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dKj7wQ7kNuz1BHNi1sZGZVSIk4Mg6KHpbCG9mKMFrjs=; b=f/U3LShu+Xee9FhPLaLtUS1+5AETxf6btXJH6J/0dFvhSp4xI8U/8oBoUFwtLqedtj VYZOtCQ5CKHWlC40a2pzPS0mgSxJ8SUH/sOwB/kp3Mr1sOL/nztNU6Y42M0Apd8dfTmp pUF4UR+NOi65oCydTNqPSThk0hnsKTGDfudqev8TSkkyEFRZ4CcsbbhFAz6rBnsSeGGG gLbMJ4KTxsfZhajjxXjAwV/6dLvCIxICQsFoOzJI/rn+6N6OZO0GT99aettFvArAsXDv XLpbB4OPMEqKzS19vyBqYM+iVf+kZHTjdW1YzMjfE4hND+osQTWSN7+Y7TU+55Jx0951 or8A== X-Gm-Message-State: AFqh2koSIPnfvTOE/N3yAa+HZ6EOxg/DP++NsNZfNI2YZSm75G4fHX3f 0SCmUR1VdjbIEY0vohO+3wh9Z5EApNATUw== X-Google-Smtp-Source: AMrXdXv0PheOpJDBUFlHB5jLfejxVZdQaIsu4NI6G2Jri1Yx6U4vUATcfNj0GwtjlpinBj18dWCwvA== X-Received: by 2002:a17:902:7b8d:b0:193:25b6:71bc with SMTP id w13-20020a1709027b8d00b0019325b671bcmr26698037pll.25.1673808720445; Sun, 15 Jan 2023 10:52:00 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::b940]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c20600b0019468fe44d3sm5417127pll.25.2023.01.15.10.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 10:51:59 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 6/6] cpio: Fix gnulib alignof implementation on clang Date: Sun, 15 Jan 2023 10:51:53 -0800 Message-Id: <20230115185153.2277534-6-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230115185153.2277534-1-raj.khem@gmail.com> References: <20230115185153.2277534-1-raj.khem@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 15 Jan 2023 18:52:02 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175955 Backport needed patches Signed-off-by: Khem Raj --- .../0001-Use-__alignof__-with-clang.patch | 42 +++++++++++++++++++ meta/recipes-extended/cpio/cpio_2.13.bb | 1 + 2 files changed, 43 insertions(+) create mode 100644 meta/recipes-extended/cpio/cpio-2.13/0001-Use-__alignof__-with-clang.patch diff --git a/meta/recipes-extended/cpio/cpio-2.13/0001-Use-__alignof__-with-clang.patch b/meta/recipes-extended/cpio/cpio-2.13/0001-Use-__alignof__-with-clang.patch new file mode 100644 index 0000000000..d637e70395 --- /dev/null +++ b/meta/recipes-extended/cpio/cpio-2.13/0001-Use-__alignof__-with-clang.patch @@ -0,0 +1,42 @@ +From 6e169bb5fadb73b4dd300b28e9cae1e1772855e8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 15 Jan 2023 02:05:23 -0800 +Subject: [PATCH] Use __alignof__ with clang. + +For clang versions < 8, use the same +workaround as for GCC versions < 4.9. + +Backport couple of gnulib patches squashed + +[1] https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=57caf9541d98314102a55dd1cd0b8dc2be747471 +[2] https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=2af490a4c4ce85567296e27be6a9528964ca851e + +Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/stdalign.in.h?id=57caf9541d98314102a55dd1cd0b8dc2be747471] + +Signed-off-by: Khem Raj +--- + gnu/stdalign.in.h | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/gnu/stdalign.in.h b/gnu/stdalign.in.h +index 5f56eee..e6e6a65 100644 +--- a/gnu/stdalign.in.h ++++ b/gnu/stdalign.in.h +@@ -53,9 +53,12 @@ + #undef _Alignof + + /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 +- . */ ++ . ++ clang versions < 8.0.0 have the same bug. */ + #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ +- || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) + # ifdef __cplusplus + # if 201103 <= __cplusplus + # define _Alignof(type) alignof (type) +-- +2.39.0 + diff --git a/meta/recipes-extended/cpio/cpio_2.13.bb b/meta/recipes-extended/cpio/cpio_2.13.bb index 50d3e14c14..eb3dc138a9 100644 --- a/meta/recipes-extended/cpio/cpio_2.13.bb +++ b/meta/recipes-extended/cpio/cpio_2.13.bb @@ -11,6 +11,7 @@ SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \ file://0002-src-global.c-Remove-superfluous-declaration-of-progr.patch \ file://0001-obstack-Fix-a-clang-warning.patch \ file://CVE-2021-38185.patch \ + file://0001-Use-__alignof__-with-clang.patch \ " SRC_URI[md5sum] = "389c5452d667c23b5eceb206f5000810"