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

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 12:04:26 PDT 2016


2016-07-29 20:32 GMT+03:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:

> 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
>

That was Rui's suggestion to use DefinedRegular. My initial suggestion
(though it contained a bug) was about using DefinedSynthetic and setting
offset within output section,
not input section. I hardly see difference between these approaches - to my
understanding they are of equal implementation complexity. May be Rui tell
us, what he thinks.

Thanks,
Eugene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160729/00fdbe3c/attachment.html>


More information about the llvm-commits mailing list