master hovercats/oakiss / pkg / elftoolchain / patch / 0005-Allow-empty-Elf_Data.patch
 1From fe335f0f01aabe08df740092306ecc107ff5d96d Mon Sep 17 00:00:00 2001
 2From: Michael Forney <mforney@mforney.org>
 3Date: Mon, 28 Jun 2021 18:23:22 -0700
 4Subject: [PATCH] Allow empty Elf_Data
 5
 6---
 7 libelf/elf_update.c | 3 +++
 8 1 file changed, 3 insertions(+)
 9
10diff --git a/libelf/elf_update.c b/libelf/elf_update.c
11index 3e19b78a..62f64fc1 100644
12--- a/libelf/elf_update.c
13+++ b/libelf/elf_update.c
14@@ -815,6 +815,9 @@ _libelf_write_scn(Elf *e, unsigned char *nf, struct _Elf_Extent *ex)
15 			    LIBELF_PRIVATE(fillchar),
16 			    (size_t) (sh_off + d->d_off - (uint64_t) rc));
17 
18+		if (d->d_size == 0)
19+			continue;
20+
21 		rc = (off_t) (sh_off + d->d_off);
22 
23 		assert(d->d_buf != NULL);
24-- 
252.32.0
26