Fix address computation for headers.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 Nov 2016 19:59:33 +0000 (19:59 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 Nov 2016 19:59:33 +0000 (19:59 +0000)
commit1c57007ec81ad66471da6aea3b510cb82c8f4ff7
tree418052e0035306e61a2b78c4804a27f819b543bc
parentb38ddb15dd9153b7887a67660d5ce1462dae4dea
Fix address computation for headers.

If the linker script has SECTIONS, the address computation is now
always done in LinkerScript::assignAddresses, like for any other
section.

Before fixHeaders would do a tentative computation that
assignAddresses would sometimes override.

This patch also splits the cases where assignAddresses needs to add
the headers to the first PT_LOAD and the address computation. The net
effect is that we no longer create an empty page for no reason in the
included test case, which matches bfd behavior.

llvm-svn: 287565
lld/ELF/LinkerScript.cpp
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/header-addr.s [new file with mode: 0644]