<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Sep 7, 2016 at 2:22 AM, Eugene Leviant <span dir="ltr"><<a href="mailto:evgeny.leviant@gmail.com" target="_blank">evgeny.leviant@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">evgeny777 added a comment.<br>
<span class=""><br>
> I'm wondering why we need to remove empty output sections from output. I cannot think of a reason to not leave them as is except small file/virtual address space wastes for the section table slot for the empty section. Do we need to handle it as a special case?<br>
<br>
<br>
</span>Besides wasting some (small) space in ELF image I see two potential issues<br>
<br>
a) What type and attributes will you assign for those empty sections? If you flag them with SHF_ALLOC you may end up having extra LOAD segments in ELF image. If you don't, then you'll have to treat them specially in assignAddresses.<br></blockquote><div><br></div><div>If you do the latter, you'd probably need to add only a few lines to assignAddresses, which seems a fairly good deal.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
b) All "special" sections listed in linker script (like .got, .eh_frame and so on) will have duplicates in ELF image, because they don't consist of input sections. I don't know if this is a real problem, but looks confusing at the very least (IMHO)<br></blockquote><div><br></div><div>By duplicates, do you mean we'll end up having two or more special sections with the same name (e.g. having two .got sections)? If so, I think I don't understand how this would happen. What am I missing?</div></div></div></div>