[lld] r276323 - [ELF] - Basic support of linkerscript commands: DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, CONSTANT

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 01:51:22 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

Probably yes, since we anyways do not support the exact logic of
DATA_SEGMENT_ALIGN, we can simplify it I think.

I can prepare a patch a bit later for that place.

George.


More information about the llvm-commits mailing list