[PATCH] D22683: [ELF] Symbol assignment within input section list

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 10:32:09 PDT 2016


On 29 July 2016 at 13:15, Eugene Leviant <evgeny.leviant at gmail.com> wrote:
> evgeny777 added inline comments.
>
> ================
> Comment at: ELF/LinkerScript.cpp:85
> @@ +84,3 @@
> +    // OutSecOff is added to value in getSymVA().
> +    Regular->Value = Cmd->Expression(this->OutSecOff) - this->OutSecOff;
> +}
> ----------------
> rafael wrote:
>> This is a bit odd.
>>
>> The way normal DefinedRegular symbols are handled is to have a Value that is the offset in the input section. In this case, since the input section is a dummy empty section that should always be 0.
>>
>> It is the offset of the input section in the output section that we should be computing.
>>
> What about this expression? Will this work, if you always set Value to 0?
> ```
> a = ALIGN(8);
> ```

No, but it does suggest there is something odd with this design. We
are creating symbols that point past the end of the input section they
are "in".

I was looking at what would be necessary to support . assignment too,
and I think what we need to do is stop using
OutputSection<ELFT>::assignOffsets when linker scripts are active.
That is similar to what is done for assigning addresses to output
sections.

We would walk the commands in each output section definition keeping
tract of the Dot. That way we can just use a DenifedSynthetic for the
symbols and will be able to handle things like ". = ALIGN(...)';

Cheers,
Rafael


More information about the llvm-commits mailing list