[PATCH] D24230: [ELF] Linkerscript: Fix handling of empty sections

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 02:22:50 PDT 2016


evgeny777 added a comment.

> 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?


Besides wasting some (small) space in ELF image I see two potential issues

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.

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)


https://reviews.llvm.org/D24230





More information about the llvm-commits mailing list