diff options
| -rw-r--r-- | meta/recipes-devtools/pkgconfig/pkgconfig/0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch | 157 | ||||
| -rw-r--r-- | meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 1 |
2 files changed, 158 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch b/meta/recipes-devtools/pkgconfig/pkgconfig/0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch new file mode 100644 index 0000000000..5ef4cec811 --- /dev/null +++ b/meta/recipes-devtools/pkgconfig/pkgconfig/0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | From 5fb4ae80ae13ae134a33804b1938af0e9f27a222 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dan Fuhry <dan@fuhry.com> | ||
| 3 | Date: Sun, 26 Oct 2025 09:09:07 -0700 | ||
| 4 | Subject: [PATCH] Backport g(s)size -> g(u)intptr atomics in builtin glib for | ||
| 5 | gcc14 and clang15 | ||
| 6 | |||
| 7 | pkg-config 0.29.2 doesn't build on clang 15 and up and | ||
| 8 | gcc 14 and up, due to -Wint-conversion now defaulting to being an error in | ||
| 9 | both compilers. The old version of glib 2.36 bundled with pkg-config uses | ||
| 10 | gssize/gssize as the return type of the g_atomic_pointer_* functions, which | ||
| 11 | newer versions of gcc and clang complain (rightly) is not portable (as | ||
| 12 | these are aliased to long and ulong, respectively). | ||
| 13 | |||
| 14 | This was previously addressed in glib upstream commit c762d511 [1] by Alex | ||
| 15 | Richardson on Dec 14, 2022. The attached patch backports Alex's change to | ||
| 16 | glib 2.36 bundled with pkg-config, and also switches to the newer | ||
| 17 | __atomic_* intrinsics from commit 2eb37622 [2] (Philip Withnall). | ||
| 18 | |||
| 19 | This patch has been tested on clang 17 and only clang 17. | ||
| 20 | |||
| 21 | [1] | ||
| 22 | https://gitlab.gnome.org/GNOME/glib/-/commit/c762d511346d3cb84cea3557a246ccf8873b4a1c | ||
| 23 | [2] | ||
| 24 | https://gitlab.gnome.org/GNOME/glib/-/commit/2eb37622418a5c9f31a9d728a99bc621d3157ab0 | ||
| 25 | |||
| 26 | Upstream-Status: Submitted [https://lists.freedesktop.org/archives/pkg-config/2024-May/001122.html] | ||
| 27 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 28 | --- | ||
| 29 | glib/glib/gatomic.c | 14 +++++++------- | ||
| 30 | glib/glib/gatomic.h | 34 ++++++++++++++++++++-------------- | ||
| 31 | 2 files changed, 27 insertions(+), 21 deletions(-) | ||
| 32 | |||
| 33 | diff --git a/glib/glib/gatomic.c b/glib/glib/gatomic.c | ||
| 34 | index eb2fe46..c0609eb 100644 | ||
| 35 | --- a/glib/glib/gatomic.c | ||
| 36 | +++ b/glib/glib/gatomic.c | ||
| 37 | @@ -385,7 +385,7 @@ gboolean | ||
| 38 | * | ||
| 39 | * Since: 2.30 | ||
| 40 | **/ | ||
| 41 | -gssize | ||
| 42 | +gintptr | ||
| 43 | (g_atomic_pointer_add) (volatile void *atomic, | ||
| 44 | gssize val) | ||
| 45 | { | ||
| 46 | @@ -409,11 +409,11 @@ gssize | ||
| 47 | * | ||
| 48 | * Since: 2.30 | ||
| 49 | **/ | ||
| 50 | -gsize | ||
| 51 | +guintptr | ||
| 52 | (g_atomic_pointer_and) (volatile void *atomic, | ||
| 53 | gsize val) | ||
| 54 | { | ||
| 55 | - return g_atomic_pointer_and ((volatile gpointer *) atomic, val); | ||
| 56 | + return g_atomic_pointer_and ((gpointer *) atomic, val); | ||
| 57 | } | ||
| 58 | |||
| 59 | /** | ||
| 60 | @@ -433,11 +433,11 @@ gsize | ||
| 61 | * | ||
| 62 | * Since: 2.30 | ||
| 63 | **/ | ||
| 64 | -gsize | ||
| 65 | +guintptr | ||
| 66 | (g_atomic_pointer_or) (volatile void *atomic, | ||
| 67 | gsize val) | ||
| 68 | { | ||
| 69 | - return g_atomic_pointer_or ((volatile gpointer *) atomic, val); | ||
| 70 | + return g_atomic_pointer_or ((gpointer *) atomic, val); | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | @@ -457,11 +457,11 @@ gsize | ||
| 75 | * | ||
| 76 | * Since: 2.30 | ||
| 77 | **/ | ||
| 78 | -gsize | ||
| 79 | +guintptr | ||
| 80 | (g_atomic_pointer_xor) (volatile void *atomic, | ||
| 81 | gsize val) | ||
| 82 | { | ||
| 83 | - return g_atomic_pointer_xor ((volatile gpointer *) atomic, val); | ||
| 84 | + return g_atomic_pointer_xor ((gpointer *) atomic, val); | ||
| 85 | } | ||
| 86 | |||
| 87 | #elif defined (G_PLATFORM_WIN32) | ||
| 88 | diff --git a/glib/glib/gatomic.h b/glib/glib/gatomic.h | ||
| 89 | index e7fd1f2..124a3dd 100644 | ||
| 90 | --- a/glib/glib/gatomic.h | ||
| 91 | +++ b/glib/glib/gatomic.h | ||
| 92 | @@ -66,16 +66,16 @@ gboolean g_atomic_pointer_compare_and_exchange (volatile void *a | ||
| 93 | gpointer oldval, | ||
| 94 | gpointer newval); | ||
| 95 | GLIB_AVAILABLE_IN_ALL | ||
| 96 | -gssize g_atomic_pointer_add (volatile void *atomic, | ||
| 97 | +gintptr g_atomic_pointer_add (volatile void *atomic, | ||
| 98 | gssize val); | ||
| 99 | GLIB_AVAILABLE_IN_2_30 | ||
| 100 | -gsize g_atomic_pointer_and (volatile void *atomic, | ||
| 101 | +guintptr g_atomic_pointer_and (volatile void *atomic, | ||
| 102 | gsize val); | ||
| 103 | GLIB_AVAILABLE_IN_2_30 | ||
| 104 | -gsize g_atomic_pointer_or (volatile void *atomic, | ||
| 105 | +guintptr g_atomic_pointer_or (volatile void *atomic, | ||
| 106 | gsize val); | ||
| 107 | GLIB_AVAILABLE_IN_ALL | ||
| 108 | -gsize g_atomic_pointer_xor (volatile void *atomic, | ||
| 109 | +guintptr g_atomic_pointer_xor (volatile void *atomic, | ||
| 110 | gsize val); | ||
| 111 | |||
| 112 | GLIB_DEPRECATED_IN_2_30_FOR(g_atomic_add) | ||
| 113 | @@ -167,28 +167,34 @@ G_END_DECLS | ||
| 114 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ | ||
| 115 | (void) (0 ? (gpointer) *(atomic) : 0); \ | ||
| 116 | (void) (0 ? (val) ^ (val) : 0); \ | ||
| 117 | - (gssize) __sync_fetch_and_add ((atomic), (val)); \ | ||
| 118 | + (guintptr) __atomic_fetch_add ((atomic), (val), __ATOMIC_SEQ_CST); \ | ||
| 119 | })) | ||
| 120 | #define g_atomic_pointer_and(atomic, val) \ | ||
| 121 | (G_GNUC_EXTENSION ({ \ | ||
| 122 | + guintptr *gapa_atomic = (guintptr *) atomic; \ | ||
| 123 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ | ||
| 124 | - (void) (0 ? (gpointer) *(atomic) : 0); \ | ||
| 125 | - (void) (0 ? (val) ^ (val) : 0); \ | ||
| 126 | - (gsize) __sync_fetch_and_and ((atomic), (val)); \ | ||
| 127 | + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (guintptr)); \ | ||
| 128 | + (void) (0 ? (gpointer) *(atomic) : NULL); \ | ||
| 129 | + (void) (0 ? (val) ^ (val) : 1); \ | ||
| 130 | + (guintptr) __atomic_fetch_and (gapa_atomic, (val), __ATOMIC_SEQ_CST); \ | ||
| 131 | })) | ||
| 132 | #define g_atomic_pointer_or(atomic, val) \ | ||
| 133 | (G_GNUC_EXTENSION ({ \ | ||
| 134 | + guintptr *gapa_atomic = (guintptr *) atomic; \ | ||
| 135 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ | ||
| 136 | - (void) (0 ? (gpointer) *(atomic) : 0); \ | ||
| 137 | - (void) (0 ? (val) ^ (val) : 0); \ | ||
| 138 | - (gsize) __sync_fetch_and_or ((atomic), (val)); \ | ||
| 139 | + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (guintptr)); \ | ||
| 140 | + (void) (0 ? (gpointer) *(atomic) : NULL); \ | ||
| 141 | + (void) (0 ? (val) ^ (val) : 1); \ | ||
| 142 | + (guintptr) __atomic_fetch_or (gapa_atomic, (val), __ATOMIC_SEQ_CST); \ | ||
| 143 | })) | ||
| 144 | #define g_atomic_pointer_xor(atomic, val) \ | ||
| 145 | (G_GNUC_EXTENSION ({ \ | ||
| 146 | + guintptr *gapa_atomic = (guintptr *) atomic; \ | ||
| 147 | G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ | ||
| 148 | - (void) (0 ? (gpointer) *(atomic) : 0); \ | ||
| 149 | - (void) (0 ? (val) ^ (val) : 0); \ | ||
| 150 | - (gsize) __sync_fetch_and_xor ((atomic), (val)); \ | ||
| 151 | + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (guintptr)); \ | ||
| 152 | + (void) (0 ? (gpointer) *(atomic) : NULL); \ | ||
| 153 | + (void) (0 ? (val) ^ (val) : 1); \ | ||
| 154 | + (guintptr) __atomic_fetch_xor (gapa_atomic, (val), __ATOMIC_SEQ_CST); \ | ||
| 155 | })) | ||
| 156 | |||
| 157 | #else /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */ | ||
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb index f537c635ef..19b9b6bc9d 100644 --- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | |||
| @@ -16,6 +16,7 @@ SRC_URI = "git://gitlab.freedesktop.org/pkg-config/pkg-config.git;branch=master; | |||
| 16 | file://pkg-config-native.in \ | 16 | file://pkg-config-native.in \ |
| 17 | file://0001-glib-gettext.m4-Update-AM_GLIB_GNU_GETTEXT-to-match-.patch \ | 17 | file://0001-glib-gettext.m4-Update-AM_GLIB_GNU_GETTEXT-to-match-.patch \ |
| 18 | file://0001-Do-not-use-bool-as-a-field-name.patch \ | 18 | file://0001-Do-not-use-bool-as-a-field-name.patch \ |
| 19 | file://0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch \ | ||
| 19 | " | 20 | " |
| 20 | 21 | ||
| 21 | inherit autotools | 22 | inherit autotools |
