[PATCH] D34204: [LLD][LinkerScript] Allow non-alloc sections to be assigned to segments.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 09:11:43 PDT 2017


bd1976 llvm <bd1976llvm at gmail.com> writes:

> Hi Rafael,
>
> It is a bit odd.
>
> Our platform has this requirement for historical reasons, mostly either:
>
> 1. There is a mismatch between the flags assigned to sections by the
> compiler and the sections to segments mapping.
> 2. The section header flags are used to control the behaviour of binary
> manipulation tools.
>
> These phdrs mostly get an address of 0 and an image size of 0.

But then this means that putting a non SHF_ALLOC section in a program header
will have no effect, as the address range is empty. How does any tool
find out what sections are in the program header?

> Having said that the current lld behaviour is *very* odd.
> If you assign a section to a phdr in the linker script it really should end
> up in that phdr.

The more I think of it the more it seems the best behavior would be to
error on a non alloc section being put in a program header. The section
has no address, but the program header uses addresses to define what is
in it.

Cheers,
Rafael


More information about the llvm-commits mailing list