<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-07-29 20:32 GMT+03:00 Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 29 July 2016 at 13:15, Eugene Leviant <<a href="mailto:evgeny.leviant@gmail.com">evgeny.leviant@gmail.com</a>> wrote:<br>
> evgeny777 added inline comments.<br>
><br>
> ================<br>
> Comment at: ELF/LinkerScript.cpp:85<br>
> @@ +84,3 @@<br>
> +    // OutSecOff is added to value in getSymVA().<br>
> +    Regular->Value = Cmd->Expression(this->OutSecOff) - this->OutSecOff;<br>
> +}<br>
> ----------------<br>
> rafael wrote:<br>
>> This is a bit odd.<br>
>><br>
>> 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.<br>
>><br>
>> It is the offset of the input section in the output section that we should be computing.<br>
>><br>
> What about this expression? Will this work, if you always set Value to 0?<br>
> ```<br>
> a = ALIGN(8);<br>
> ```<br>
<br>
</span>No, but it does suggest there is something odd with this design. We<br>
are creating symbols that point past the end of the input section they<br>
are "in".<br>
<br>
I was looking at what would be necessary to support . assignment too,<br>
and I think what we need to do is stop using<br>
OutputSection<ELFT>::assignOffsets when linker scripts are active.<br>
That is similar to what is done for assigning addresses to output<br>
sections.<br>
<br>
We would walk the commands in each output section definition keeping<br>
tract of the Dot. That way we can just use a DenifedSynthetic for the<br>
symbols and will be able to handle things like ". = ALIGN(...)'; <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
Cheers,<br>
Rafael<br></blockquote><div><br></div><div>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,</div><div>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.</div><div><br></div><div>Thanks,</div><div>Eugene</div><div> </div></div><br></div></div>