[ELF] Fix program headers.

The ELF writer creates a invalid binary for few cases with large filesize and
memory size for segments. This patch addresses the functionality and updates the
test. This patch also cleans up parts of the ELF writer for future enhancements
to support Linker scripts.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@221233 91177308-0d34-0410-b5e6-96231b3b80d8
[ELF] Fix MSVC buildbot.

For some reason, MSVC doesnot like the style.

Checking to make sure this fixes the problem with the build.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@221234 91177308-0d34-0410-b5e6-96231b3b80d8