On Tuesday 11 October 2022 19:07:55 Pali Rohár wrote:
> On Tuesday 11 October 2022 15:33:59 Nick Clifton wrote:
> > Hi Pali, Hi Richard,
> > 
> > > Having file name and line number would be also useful as it took me
> > > some time to figure out where is the issue...
> > 
> > Right - I have tried a little harder and come up with a follow up patch.
> > This is now checked in, and given an input file that looks like this:
> > 
> >   % cat t.s
> >   kernoff:
> >     .set KERNEL_OFFSET, 0x40000
> >     .set CONFIG_SYS_TEXT_BASE, 0x80008000
> >     .word 44
> >     .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> >     .word - (. - 0x80008000)
> >     .word 0x40000 - (. - 0x0)
> > 
> > The assembler now produces the following output:
> > 
> >   t.s: Assembler messages:
> >   t.s:5: Error: expression is too complex to be resolved or converted into 
> > relocations
> >   t.s:6: Error: expression is too complex to be resolved or converted into 
> > relocations
> > 
> > Note - some targets do support applying multiple relocations to a
> > single address, but even then there can be expressions that cannot
> > be resolved this way.  That is why the error message refers to
> > "converted into relocations" rather than just "converted into a
> > relocation".
> > 
> > Cheers
> >   Nick
> > 
> 
> Nice!
> 
> Anyway, what should I use in code?
> 
>   .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
> 
> or
> 
>   .word CONFIG_SYS_TEXT_BASE + KERNEL_OFFSET - .
> 
> And can you guarantee that one of those form would work also in future
> gcc/binutils versions, and it is not something version specific or
> undocumented?

Hello Nick, could you clarify which option should I use?

And could you extend documentation about Dot symbol usage, what is
supported, what not, to make it clear?
https://sourceware.org/binutils/docs/as/Dot.html

Reply via email to