[ELF] Change the way we compute file offsets
authorEugene Leviant <evgeny.leviant@gmail.com>
Thu, 29 Sep 2016 09:20:33 +0000 (09:20 +0000)
committerEugene Leviant <evgeny.leviant@gmail.com>
Thu, 29 Sep 2016 09:20:33 +0000 (09:20 +0000)
commit3d9abec09159db1fdd208cb750f7bf60ae94325f
tree1dac2a548846c4a75a5ee41dfd7e90346ed9291d
parent71e9e44ae97bcb72e0020961d8e10b57d05d57d4
[ELF] Change the way we compute file offsets

If we two sections reside in the same PT_LOAD segment,
we compute second section using the following formula:
Off2 = Off1 + VA2 - VA1. This allows OS kernel allocating
sections correctly when loading an image.

Differential revision: https://reviews.llvm.org/D25014

llvm-svn: 282705
lld/ELF/OutputSections.h
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/outsections-addr.s