From 878247108f51ecac54251aaf47be7a1d4228d74a Mon Sep 17 00:00:00 2001
From: Serge Lamikhov-Center <to_serge@users.sourceforge.net>
Date: Tue, 20 Dec 2016 20:11:20 +0200
Subject: [PATCH] Ignore sections of zero size. Thanks to Martin Bickel

---
 elfio/elfio.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp
index 3a86c93..69160ff 100644
--- a/elfio/elfio.hpp
+++ b/elfio/elfio.hpp
@@ -632,7 +632,8 @@ class elfio
                 // Fix up the alignment
                 if ( !section_generated[index] && sec->is_address_initialized()
                     && SHT_NOBITS != sec->get_type()
-                    && SHT_NULL != sec->get_type() ) {
+                    && SHT_NULL != sec->get_type()
+                    && 0 != sec->get_size() ) {
                     // Align the sections based on the virtual addresses
                     // when possible (this is what matters for execution)
                     Elf64_Off req_offset = sec->get_address() - seg->get_virtual_address();
-- 
GitLab