[ELF] Don't output headers into a segment if there's no space for them
Currently, LLD checks whether there's enough space for headers by checking if headers fit below the address of the first allocated section. However, that's always thue if the binary doesn't start at zero which means that LLD always emits a segment for headers, even if no other sections belong to that segment. This is a problem in cases when linker script is being used with a non-zero start address when we don't want to make the headers visible by not leaving enough space for them. This pattern is common in embedded programming but doesn't work in LLD. This patch changes the behavior of LLD in case when linker script is being to match the behavior of BFD ld and gold, which is to only place headers into a segment when they're covered by some output section. Differential Revision: https://reviews.llvm.org/D36256 llvm-svn: 311586
Loading
Please register or sign in to comment