---
Linux 5.14.15 included a patch to fix the issue I posted about
several months ago (it now sets the section type before
gelf_update_rel[a]), but unfortunately 5.14 introduced a new issue
[0] caused by an implicitly created empty Elf_Data. I think this
would be more awkward to change in objtool, and it seems reasonable
to me that elftoolchain should allow NULL d_buf if d_size is 0.

[0] 
https://github.com/oasislinux/oasis/blob/master/pkg/elftoolchain/patch/0005-Allow-empty-Elf_Data.patch

 libelf/elf_update.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index baf64809..4fe663d3 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -818,6 +818,9 @@ _libelf_write_scn(Elf *e, unsigned char *nf, struct 
_Elf_Extent *ex)
 
                rc = (off_t) (sh_off + d->d_off);
 
+               if (d->d_size == 0)
+                       continue;
+
                assert(d->d_buf != NULL);
                assert(d->d_version == e->e_version);
                assert(d->d_size % msz == 0);
-- 
2.32.0



_______________________________________________
Elftoolchain-developers mailing list
Elftoolchain-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/elftoolchain-developers

Reply via email to