Don't allocate a header bellow address 0.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 1 Mar 2018 15:25:46 +0000 (15:25 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 1 Mar 2018 15:25:46 +0000 (15:25 +0000)
commite75b42ee4ef0ed54d73a93c66f8bb9e9ed4e7006
tree3604b9df58f5c36159645b17b844729c3f2a50cc
parent237e52674fb0f3959da2f3422905cdafc796ae45
Don't allocate a header bellow address 0.

With the current code if the script has a PHDRS we always obey and try
to allocate a header. This can cause Min - HeaderSize to underflow.

It looks like bfd actually prints an error for this case. With this
patch we do the same.

Found while looking at pr36515.

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