From d64ec364c8969acd128144fb878ab64915a40073 Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Tue, 9 May 2023 16:43:20 -0400 Subject: sys-libs/efivar: backport musl fix Closes: https://bugs.gentoo.org/905930 Signed-off-by: Mike Gilbert --- sys-libs/efivar/efivar-38.ebuild | 1 + sys-libs/efivar/files/efivar-38-64bit-off_t.patch | 46 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 sys-libs/efivar/files/efivar-38-64bit-off_t.patch diff --git a/sys-libs/efivar/efivar-38.ebuild b/sys-libs/efivar/efivar-38.ebuild index d00381caef83..cf449a8640f7 100644 --- a/sys-libs/efivar/efivar-38.ebuild +++ b/sys-libs/efivar/efivar-38.ebuild @@ -37,6 +37,7 @@ src_prepare() { "${FILESDIR}"/efivar-38-lld-fixes.patch "${FILESDIR}"/efivar-38-efisecdb-musl.patch "${FILESDIR}"/efivar-38-efisecdb-optarg.patch + "${FILESDIR}"/efivar-38-64bit-off_t.patch # Rejected upstream, keep this for ia64 support "${FILESDIR}"/efivar-38-ia64-relro.patch diff --git a/sys-libs/efivar/files/efivar-38-64bit-off_t.patch b/sys-libs/efivar/files/efivar-38-64bit-off_t.patch new file mode 100644 index 000000000000..d06868b22587 --- /dev/null +++ b/sys-libs/efivar/files/efivar-38-64bit-off_t.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/905930 + +From 914c686cc54b2405dab08bff77cd60827aab54b1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 16:55:51 -0800 +Subject: [PATCH] Use off_t instead of off64_t + +Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t + +This helps building efivar for 32bit arches on systems using musl C +library. It works with glibc since _GNU_SOURCE defines +_LARGEFILE64_SOURCE as well, this feature test macro enables the 64bit +interfaces which were done as intermediate steps when transition to +66-bit off_t was done as part olf LFS64 support. + +Signed-off-by: Khem Raj +--- + src/error.c | 2 +- + src/include/defaults.mk | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/error.c b/src/error.c +index fcbba0d6..9530e22c 100644 +--- a/src/error.c ++++ b/src/error.c +@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *buf, size_t size) + } + + static int +-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence) ++dbglog_seek(void *cookie UNUSED, off_t *offset, int whence) + { + FILE *log = efi_errlog ? efi_errlog : stderr; + int rc; +diff --git a/src/include/defaults.mk b/src/include/defaults.mk +index 42bd3d6e..bb9c997f 100644 +--- a/src/include/defaults.mk ++++ b/src/include/defaults.mk +@@ -34,6 +34,7 @@ CPPFLAGS ?= + override _CPPFLAGS := $(CPPFLAGS) + override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \ + -D_GNU_SOURCE \ ++ -D_FILE_OFFSET_BITS=64 \ + -I$(TOPDIR)/src/include/ + CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS) + CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \ -- cgit v1.2.3-65-gdbad