[ELF] - Basic support of linkerscript commands: DATA_SEGMENT_ALIGN, DATA_SEGMENT_END...
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 21 Jul 2016 19:48:00 +0000 (19:48 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 21 Jul 2016 19:48:00 +0000 (19:48 +0000)
commit92e93fb4ba476b3501d4455855687a6d0272e986
treea1fa2a8419672746fef6189df118a9e4e5ac8b07
parent629e0aa5be18b1199c4a1392a129eb4081e6f3d8
[ELF] - Basic support of linkerscript commands: DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, CONSTANT

It is called basic because:

CONSTANT expression can refer to COMMONPAGESIZE and MAXPAGESIZE.
This sizes are usually different and used for possible optimization of
memory consumption.
More details are here: https://sourceware.org/ml/binutils/2002-02/msg00265.html
We currently do not support this optimization, so both CONSTANT(MAXPAGESIZE)
and CONSTANT(COMMONPAGESIZE) just return Target->PageSize value.

DATA_SEGMENT_ALIGN and DATA_SEGMENT_END are used as a part of opt.
The latter one is just ignored now.
According to documentation DATA_SEGMENT_ALIGN has 2 possible
calculation, but since we do not support mentioned opt - it
is always calculated now as (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1))).

In general this should work for now until we deside to support this opt.

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

llvm-svn: 276323
lld/ELF/LinkerScript.cpp
lld/test/ELF/linkerscript-locationcounter.s