[lld] r276323 - [ELF] - Basic support of linkerscript commands: DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, CONSTANT
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 11:54:32 PDT 2016
> + // Documentations says there are two ways to compute
> + // the value of DATA_SEGMENT_ALIGN command, depending on whether the second
> + // uses fewer COMMONPAGESIZE sized pages for the data segment(area between the
> + // result of this expression and `DATA_SEGMENT_END') than the first or not.
> + // That is possible optimization, that we do not support, so we compute that
> + // function always as (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1))) now.
> + if (Tok == "DATA_SEGMENT_ALIGN") {
> + expect("(");
> + uint64_t L = parseExpr();
> + expect(",");
> + parseExpr();
> + expect(")");
> + return alignTo(Dot, L) + (Dot & (L - 1));
> + }
I would suggest using the other expression.
(ALIGN(maxpagesize)
+ ((. + commonpagesize - 1) & (maxpagesize - commonpagesize)))
simplifies to just ALIGN(maxpagesize) with just one page size, which
is exactly what we do on the non script case: Immediately align the
address, possibly wasting disk space, but using the smallest number of
run time pages.
Cheers,
Rafael
More information about the llvm-commits
mailing list