diff --git a/community/stlink/APKBUILD b/community/stlink/APKBUILD
index 0f74c5d324dd19bce8bd547ca27d1073eb3f31b6..7ecd254971c50160d12fc738bd4965ca2a8aa797 100644
--- a/community/stlink/APKBUILD
+++ b/community/stlink/APKBUILD
@@ -11,6 +11,7 @@ makedepends="cmake libusb-dev samurai"
 options="!check" # upstream doesn't have automated tests
 subpackages="$pkgname-doc $pkgname-dev"
 source="$pkgname-$pkgver.tar.gz::https://github.com/stlink-org/stlink/archive/v$pkgver.tar.gz
+	gcc14.patch
 	"
 
 build() {
@@ -38,4 +39,5 @@ package() {
 
 sha512sums="
 49245a4b0aeb926dd71ec4260b707d900318fe68e3a36e2e5543587fefb4886a9ff0ff42e0e12a8e727a5d4e9c7b4ce13989ca4d963842dbf960065e5fa0c968  stlink-1.8.0.tar.gz
+f0374641756981c94d865d282cbe8009ccc9e9b41499501310f7442878e68b1984418428d13a7ea1f22312d5c928ec7bdb845d99a54a4264497a954859ad38cc  gcc14.patch
 "
diff --git a/community/stlink/gcc14.patch b/community/stlink/gcc14.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c90de2ab28f01e1422699add593211d63434d3a9
--- /dev/null
+++ b/community/stlink/gcc14.patch
@@ -0,0 +1,13 @@
+diff --git a/src/stlink-lib/chipid.c b/src/stlink-lib/chipid.c
+index c115089..0a6a4e9 100644
+--- a/src/stlink-lib/chipid.c
++++ b/src/stlink-lib/chipid.c
+@@ -65,7 +65,7 @@ void process_chipfile(char *fname) {
+     return;
+   }
+ 
+-  ts = calloc(sizeof(struct stlink_chipid_params), 1);
++  ts = calloc(1, sizeof(struct stlink_chipid_params));
+ 
+   while (fgets(buf, sizeof(buf), fp) != NULL) {
+