From 0f61386628df828c5b1a440a414759e3e60f86a2 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 24 Jan 2024 16:32:50 -0800 Subject: qemu: Replace the basename patch with backport Backport the patch that got applied to fix this issue upstream (From OE-Core rev: 952c94988cf1cf093668e9ac7020485c51cf3a58) Signed-off-by: Khem Raj Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- ...01-vfio-Include-libgen.h-for-basename-API.patch | 57 ---------------------- ...ner-Replace-basename-with-g_path_get_base.patch | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch (limited to 'meta/recipes-devtools/qemu/qemu') diff --git a/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch b/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch deleted file mode 100644 index 5b8b638736..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-vfio-Include-libgen.h-for-basename-API.patch +++ /dev/null @@ -1,57 +0,0 @@ -From e31c67ef65a4217f35f6cd40926251054094dff9 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 11 Dec 2023 16:44:16 -0800 -Subject: [PATCH v2] vfio: Include libgen.h for basename API - -Glibc has two implementation one based on POSIX which is used when -libgen.h is included and second implementation is GNU implementation -which is used when string.h is included. The functions are no identical -in behavior. Musl C library does not implement the GNU version, but it -has provided a declaration in string.h but this has been corrected in -latest musl [1] which exposes places where it was being used from -string.h to error out especially when -Wimplicit-function-declaration is -treated as error. - -| ../qemu-8.1.2/hw/vfio/pci.c:3030:18: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] -| 3030 | group_name = basename(group_path); - -clang-17 treats this warning as error by default - -[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 - -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2023-12/msg01438.html] -Signed-off-by: Khem Raj ---- -v2: Add missing link for [1] - - hw/vfio/pci.c | 1 + - hw/vfio/platform.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c -index c62c02f7b6..f043c93b9e 100644 ---- a/hw/vfio/pci.c -+++ b/hw/vfio/pci.c -@@ -19,6 +19,7 @@ - */ - - #include "qemu/osdep.h" -+#include - #include - #include - -diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c -index 8e3d4ac458..a835ab03be 100644 ---- a/hw/vfio/platform.c -+++ b/hw/vfio/platform.c -@@ -16,6 +16,7 @@ - - #include "qemu/osdep.h" - #include "qapi/error.h" -+#include - #include - #include - --- -2.43.0 - diff --git a/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch b/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch new file mode 100644 index 0000000000..ad4f410178 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0001-vfio-container-Replace-basename-with-g_path_get_base.patch @@ -0,0 +1,50 @@ +From 213ae3ffda463c0503e39e0cf827511b5298c314 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= +Date: Wed, 20 Dec 2023 14:53:02 +0100 +Subject: [PATCH] vfio/container: Replace basename with g_path_get_basename +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +g_path_get_basename() is a portable utility function that has the +advantage of not modifing the string argument. It also fixes a compile +breakage with the Musl C library reported in [1]. + +[1] https://lore.kernel.org/all/20231212010228.2701544-1-raj.khem@gmail.com/ + +Upstream-Status: Backport [https://github.com/qemu/qemu/commit/213ae3ffda463c0503e39e0cf827511b5298c314] +Reported-by: Khem Raj +Reviewed-by: Eric Auger +Reviewed-by: Zhao Liu +Reviewed-by: Zhenzhong Duan +Signed-off-by: Cédric Le Goater +--- + hw/vfio/container.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/hw/vfio/container.c b/hw/vfio/container.c +index 688cf23bab..8d334f52f2 100644 +--- a/hw/vfio/container.c ++++ b/hw/vfio/container.c +@@ -869,7 +869,8 @@ static void vfio_put_base_device(VFIODevice *vbasedev) + + static int vfio_device_groupid(VFIODevice *vbasedev, Error **errp) + { +- char *tmp, group_path[PATH_MAX], *group_name; ++ char *tmp, group_path[PATH_MAX]; ++ g_autofree char *group_name = NULL; + int ret, groupid; + ssize_t len; + +@@ -885,7 +886,7 @@ static int vfio_device_groupid(VFIODevice *vbasedev, Error **errp) + + group_path[len] = 0; + +- group_name = basename(group_path); ++ group_name = g_path_get_basename(group_path); + if (sscanf(group_name, "%d", &groupid) != 1) { + error_setg_errno(errp, errno, "failed to read %s", group_path); + return -errno; +-- +2.43.0 + -- cgit v1.2.3-54-g00ecf