summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2025-06-16 11:45:54 +0300
committerEfraim Flashner <efraim@flashner.co.il>2025-06-16 12:04:56 +0300
commita8287d8bc477ec6bbca1b805a845257c74a31a8e (patch)
tree143344e58775584fbee0ceae9aa0cb6133c840e7
parent379aee7b4fc3d9aad8815c1250ebbfcc5eb17b32 (diff)
gnu: efivar: Fix build on other architectures.
* gnu/packages/linux.scm (efivar)[source]: Add patch. * gnu/packages/patches/efivar-fix-fprint-format.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: I6b80ef642e953bbf68b9dd972a176a2bb155104f
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/linux.scm3
-rw-r--r--gnu/packages/patches/efivar-fix-fprint-format.patch46
3 files changed, 49 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 1565828f88..aeb4b660c7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1214,6 +1214,7 @@ dist_patch_DATA = \
%D%/packages/patches/dwarves-threading-reproducibility.patch \
%D%/packages/patches/dynaconf-unvendor-deps.patch \
%D%/packages/patches/efivar-211.patch \
+ %D%/packages/patches/efivar-fix-fprint-format.patch \
%D%/packages/patches/eigen-fix-strict-aliasing-bug.patch \
%D%/packages/patches/einstein-build.patch \
%D%/packages/patches/elfutils-tests-ptrace.patch \
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 42ca4946f9..dd477e02c7 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -8274,7 +8274,8 @@ under OpenGL graphics workloads.")
(file-name (git-file-name name version))
(sha256
(base32
- "1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))))
+ "1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))
+ (patches (search-patches "efivar-fix-fprint-format.patch"))))
(build-system gnu-build-system)
(arguments
(list
diff --git a/gnu/packages/patches/efivar-fix-fprint-format.patch b/gnu/packages/patches/efivar-fix-fprint-format.patch
new file mode 100644
index 0000000000..41f78b696c
--- /dev/null
+++ b/gnu/packages/patches/efivar-fix-fprint-format.patch
@@ -0,0 +1,46 @@
+iter->offset is type off_t, so signed int, and is always safe to cast to unsigned long.
+This fixes builds on i686 and armhf, and cross-compiling from x86_64 to riscv64.
+
+The issue can be traced at https://github.com/rhboot/efivar/issues/270
+And this commit is at https://github.com/rhboot/efivar/pull/281
+
+diff --git a/src/esl-iter.c b/src/esl-iter.c
+index 4a1938a..e4c8fb8 100644
+--- a/src/esl-iter.c
++++ b/src/esl-iter.c
+@@ -337,7 +337,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ if (correct_size && (iter->len - iter->offset) > 0) {
+ warnx("correcting ESL size from %d to %jd at %lx",
+ iter->esl->signature_list_size,
+- (intmax_t)(iter->len - iter->offset), iter->offset);
++ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
+ debug("correcting ESL size from %d to %zd at %lx",
+ iter->esl->signature_list_size,
+ iter->len - iter->offset, iter->offset);
+@@ -362,7 +362,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ if (correct_size && (iter->len - iter->offset) > 0) {
+ warnx("correcting ESL size from %d to %jd at 0x%lx",
+ iter->esl->signature_list_size,
+- (intmax_t)(iter->len - iter->offset), iter->offset);
++ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
+ debug("correcting ESL size from %d to %zd at 0x%lx",
+ iter->esl->signature_list_size,
+ iter->len - iter->offset, iter->offset);
+@@ -394,7 +394,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ if ((uint32_t)iter->offset >= iter->len)
+ return 0;
+ iter->esl = (efi_signature_list_t *)((intptr_t)iter->buf
+- + iter->offset);
++ + (unsigned long)iter->offset);
+ }
+
+ efi_signature_list_t esl;
+@@ -413,7 +413,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
+ if (correct_size && (iter->len - iter->offset) > 0) {
+ warnx("correcting ESL size from %d to %jd at 0x%lx",
+ iter->esl->signature_list_size,
+- (intmax_t)(iter->len - iter->offset), iter->offset);
++ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
+ debug("correcting ESL size from %d to %zd at 0x%lx",
+ iter->esl->signature_list_size,
+ iter->len - iter->offset, iter->offset);