public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Error: attempt to get value of unresolved symbol `L0'
@ 2022-10-10 17:18 Pali Rohár
  2022-10-11  6:46 ` Richard Biener
  0 siblings, 1 reply; 9+ messages in thread
From: Pali Rohár @ 2022-10-10 17:18 UTC (permalink / raw)
  To: gcc, binutils

Hello!

During development and debugging of U-Boot bootloader I got strange
error from ARM GNU assembler, which looks like a bug in binutils or gcc.

Below is simplified code which can trigger it:

  $ cat test.S
  kernoffs:
  .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)

  $ arm-linux-gnueabi-gcc -DKERNEL_OFFSET=0x40000 -DCONFIG_SYS_TEXT_BASE=0x80008000 -pipe -c test.S
  {standard input}: Assembler messages:
  {standard input}: Error: attempt to get value of unresolved symbol `L0'

I do not use any L0 symbol in the code, so error message seems to be
incorrect. And also I do not think that there is issue in that simple
assembler code.

On the other hand, if I declare negated value then compilation passes
without any error/warning. Code is:

  kernoffs:
  .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET

It is quite strange that negated value can be compiled by gcc/as without
issue here.

I was told that I should report this issue, so I'm sending email to
binutils and gcc mailing list.

Do you have any idea where is the issue? It is a bug in gcc / as or is
there some syntax / semantic error in that simple example?

Just for the record I'm using standard ARM cross compiler available on
Debian 10 Buster system. Here are version information:

  $ arm-linux-gnueabi-gcc -v
  Using built-in specs.
  COLLECT_GCC=arm-linux-gnueabi-gcc
  COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrapper
  Target: arm-linux-gnueabi
  Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-2' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv5te --with-float=soft --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
  Thread model: posix
  gcc version 8.3.0 (Debian 8.3.0-2)

  $ arm-linux-gnueabi-as --version
  GNU assembler (GNU Binutils for Debian) 2.31.1
  Copyright (C) 2018 Free Software Foundation, Inc.
  This program is free software; you may redistribute it under the terms of
  the GNU General Public License version 3 or later.
  This program has absolutely no warranty.
  This assembler was configured for a target of `arm-linux-gnueabi'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-10 17:18 Error: attempt to get value of unresolved symbol `L0' Pali Rohár
@ 2022-10-11  6:46 ` Richard Biener
  2022-10-11  7:43   ` Pali Rohár
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Biener @ 2022-10-11  6:46 UTC (permalink / raw)
  To: Pali Rohár; +Cc: gcc, binutils

On Mon, Oct 10, 2022 at 7:19 PM Pali Rohár via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello!
>
> During development and debugging of U-Boot bootloader I got strange
> error from ARM GNU assembler, which looks like a bug in binutils or gcc.
>
> Below is simplified code which can trigger it:
>
>   $ cat test.S
>   kernoffs:
>   .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
>
>   $ arm-linux-gnueabi-gcc -DKERNEL_OFFSET=0x40000 -DCONFIG_SYS_TEXT_BASE=0x80008000 -pipe -c test.S
>   {standard input}: Assembler messages:
>   {standard input}: Error: attempt to get value of unresolved symbol `L0'
>
> I do not use any L0 symbol in the code, so error message seems to be
> incorrect. And also I do not think that there is issue in that simple
> assembler code.

You are using (. - CONFIG_SYS_TEXT_BASE) where '.' is the "current"
address, that's where L0 (a local label) gets introduced internally.  I think
this is an assembler issue or this use is not supported.  Simplified testcase:

> cat t.s
kernoffs:
.word - (. - 0x80008000)
> as -o t.o t.s
t.s: Assembler messages:
t.s: Error: attempt to get value of unresolved symbol `L0'

Richard.

>
> On the other hand, if I declare negated value then compilation passes
> without any error/warning. Code is:
>
>   kernoffs:
>   .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
>
> It is quite strange that negated value can be compiled by gcc/as without
> issue here.
>
> I was told that I should report this issue, so I'm sending email to
> binutils and gcc mailing list.
>
> Do you have any idea where is the issue? It is a bug in gcc / as or is
> there some syntax / semantic error in that simple example?
>
> Just for the record I'm using standard ARM cross compiler available on
> Debian 10 Buster system. Here are version information:
>
>   $ arm-linux-gnueabi-gcc -v
>   Using built-in specs.
>   COLLECT_GCC=arm-linux-gnueabi-gcc
>   COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrapper
>   Target: arm-linux-gnueabi
>   Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-2' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv5te --with-float=soft --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
>   Thread model: posix
>   gcc version 8.3.0 (Debian 8.3.0-2)
>
>   $ arm-linux-gnueabi-as --version
>   GNU assembler (GNU Binutils for Debian) 2.31.1
>   Copyright (C) 2018 Free Software Foundation, Inc.
>   This program is free software; you may redistribute it under the terms of
>   the GNU General Public License version 3 or later.
>   This program has absolutely no warranty.
>   This assembler was configured for a target of `arm-linux-gnueabi'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11  6:46 ` Richard Biener
@ 2022-10-11  7:43   ` Pali Rohár
  2022-10-11 10:37     ` Nick Clifton
  0 siblings, 1 reply; 9+ messages in thread
From: Pali Rohár @ 2022-10-11  7:43 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc, binutils

On Tuesday 11 October 2022 08:46:58 Richard Biener wrote:
> On Mon, Oct 10, 2022 at 7:19 PM Pali Rohár via Gcc <gcc@gcc.gnu.org> wrote:
> >
> > Hello!
> >
> > During development and debugging of U-Boot bootloader I got strange
> > error from ARM GNU assembler, which looks like a bug in binutils or gcc.
> >
> > Below is simplified code which can trigger it:
> >
> >   $ cat test.S
> >   kernoffs:
> >   .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> >
> >   $ arm-linux-gnueabi-gcc -DKERNEL_OFFSET=0x40000 -DCONFIG_SYS_TEXT_BASE=0x80008000 -pipe -c test.S
> >   {standard input}: Assembler messages:
> >   {standard input}: Error: attempt to get value of unresolved symbol `L0'
> >
> > I do not use any L0 symbol in the code, so error message seems to be
> > incorrect. And also I do not think that there is issue in that simple
> > assembler code.
> 
> You are using (. - CONFIG_SYS_TEXT_BASE) where '.' is the "current"
> address, that's where L0 (a local label) gets introduced internally.  I think
> this is an assembler issue or this use is not supported.  Simplified testcase:
> 
> > cat t.s
> kernoffs:
> .word - (. - 0x80008000)
> > as -o t.o t.s
> t.s: Assembler messages:
> t.s: Error: attempt to get value of unresolved symbol `L0'
> 
> Richard.

Interesting... Another test case which is working fine:

  kernoffs:
  .word 0x40000 - (. - 0x0)

So which use case could not be supported? I still do not see pattern
what can be accepted and what not.

I have feeling that this is assembler issue somewhere...

> >
> > On the other hand, if I declare negated value then compilation passes
> > without any error/warning. Code is:
> >
> >   kernoffs:
> >   .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
> >
> > It is quite strange that negated value can be compiled by gcc/as without
> > issue here.
> >
> > I was told that I should report this issue, so I'm sending email to
> > binutils and gcc mailing list.
> >
> > Do you have any idea where is the issue? It is a bug in gcc / as or is
> > there some syntax / semantic error in that simple example?
> >
> > Just for the record I'm using standard ARM cross compiler available on
> > Debian 10 Buster system. Here are version information:
> >
> >   $ arm-linux-gnueabi-gcc -v
> >   Using built-in specs.
> >   COLLECT_GCC=arm-linux-gnueabi-gcc
> >   COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrapper
> >   Target: arm-linux-gnueabi
> >   Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-2' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv5te --with-float=soft --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
> >   Thread model: posix
> >   gcc version 8.3.0 (Debian 8.3.0-2)
> >
> >   $ arm-linux-gnueabi-as --version
> >   GNU assembler (GNU Binutils for Debian) 2.31.1
> >   Copyright (C) 2018 Free Software Foundation, Inc.
> >   This program is free software; you may redistribute it under the terms of
> >   the GNU General Public License version 3 or later.
> >   This program has absolutely no warranty.
> >   This assembler was configured for a target of `arm-linux-gnueabi'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11  7:43   ` Pali Rohár
@ 2022-10-11 10:37     ` Nick Clifton
  2022-10-11 10:47       ` Richard Biener
  2022-10-11 10:57       ` Pali Rohár
  0 siblings, 2 replies; 9+ messages in thread
From: Nick Clifton @ 2022-10-11 10:37 UTC (permalink / raw)
  To: Pali Rohár, Richard Biener; +Cc: gcc, binutils

Hi Pali, Hi Richard,

> Interesting... Another test case which is working fine:
> 
>    kernoffs:
>    .word 0x40000 - (. - 0x0)

This works because this expression can be converted into an instruction
and a relocation in the object file:

   % as t.s -o t.o
   % objdump -dr t.o
   Disassembly of section .text:

   00000000 <kernoffs>:
    0:	0003fffc 	.word	0x0003fffc
			0: R_ARM_REL32	*ABS*

Which shows that when this object file is linked the word at offset 0
inside the .text section should be converted into an absolute value of
(pc - 0x4000), where pc is the address of the word.

This instruction however:

	.word - (. - 0x80008000)

Cannot be converted since the linker would need to compute ((pc - 0x800800) * -1)
which cannot be expressed by a single relocation.  Similarly:

	.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)

Cannot be expressed by a single value, modified by a single relocation, even
when the KERNEL_OFFSET and CONFIG_SYS_TEXT_BASE values are known at assembly
time.

A clever assembler might be able to rearrange the expression, assuming that
overflow is unimportant, but gas does not do that.  But just for reference
the following would work:

	.word KERNEL_OFFSET + CONFIG_SYS_TEXT_BASE - .


I agree however that this message:

         t.s: Error: attempt to get value of unresolved symbol `L0'

is unhelpful.  So I am going to check in a patch to change it to:

	t.s: Error: expression is too complex to be resolved

I looked into providing a file name and line number with the error
message, but this would involve reworking a lot of the assembler's
internal expression parser.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11 10:37     ` Nick Clifton
@ 2022-10-11 10:47       ` Richard Biener
  2022-10-11 10:57       ` Pali Rohár
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Biener @ 2022-10-11 10:47 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Pali Rohár, gcc, binutils

On Tue, Oct 11, 2022 at 12:37 PM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Pali, Hi Richard,
>
> > Interesting... Another test case which is working fine:
> >
> >    kernoffs:
> >    .word 0x40000 - (. - 0x0)
>
> This works because this expression can be converted into an instruction
> and a relocation in the object file:
>
>    % as t.s -o t.o
>    % objdump -dr t.o
>    Disassembly of section .text:
>
>    00000000 <kernoffs>:
>     0:  0003fffc        .word   0x0003fffc
>                         0: R_ARM_REL32  *ABS*
>
> Which shows that when this object file is linked the word at offset 0
> inside the .text section should be converted into an absolute value of
> (pc - 0x4000), where pc is the address of the word.
>
> This instruction however:
>
>         .word - (. - 0x80008000)
>
> Cannot be converted since the linker would need to compute ((pc - 0x800800) * -1)
> which cannot be expressed by a single relocation.  Similarly:
>
>         .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
>
> Cannot be expressed by a single value, modified by a single relocation, even
> when the KERNEL_OFFSET and CONFIG_SYS_TEXT_BASE values are known at assembly
> time.
>
> A clever assembler might be able to rearrange the expression, assuming that
> overflow is unimportant, but gas does not do that.  But just for reference
> the following would work:
>
>         .word KERNEL_OFFSET + CONFIG_SYS_TEXT_BASE - .
>
>
> I agree however that this message:
>
>          t.s: Error: attempt to get value of unresolved symbol `L0'
>
> is unhelpful.  So I am going to check in a patch to change it to:
>
>         t.s: Error: expression is too complex to be resolved
>
> I looked into providing a file name and line number with the error
> message, but this would involve reworking a lot of the assembler's
> internal expression parser.

GCC has a global input_location conveniently available when all other
bets are off.  Maybe mention "relocation" in the error message somehow?
So "expression is too complex to be resolved by a single relocation"?

Richard.

>
> Cheers
>    Nick
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11 10:37     ` Nick Clifton
  2022-10-11 10:47       ` Richard Biener
@ 2022-10-11 10:57       ` Pali Rohár
  2022-10-11 14:33         ` Nick Clifton
  1 sibling, 1 reply; 9+ messages in thread
From: Pali Rohár @ 2022-10-11 10:57 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Richard Biener, gcc, binutils

On Tuesday 11 October 2022 11:37:03 Nick Clifton wrote:
> Hi Pali, Hi Richard,
> 
> > Interesting... Another test case which is working fine:
> > 
> >    kernoffs:
> >    .word 0x40000 - (. - 0x0)
> 
> This works because this expression can be converted into an instruction
> and a relocation in the object file:
> 
>   % as t.s -o t.o
>   % objdump -dr t.o
>   Disassembly of section .text:
> 
>   00000000 <kernoffs>:
>    0:	0003fffc 	.word	0x0003fffc
> 			0: R_ARM_REL32	*ABS*
> 
> Which shows that when this object file is linked the word at offset 0
> inside the .text section should be converted into an absolute value of
> (pc - 0x4000), where pc is the address of the word.
> 
> This instruction however:
> 
> 	.word - (. - 0x80008000)
> 
> Cannot be converted since the linker would need to compute ((pc - 0x800800) * -1)
> which cannot be expressed by a single relocation.  Similarly:
> 
> 	.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> 
> Cannot be expressed by a single value, modified by a single relocation, even
> when the KERNEL_OFFSET and CONFIG_SYS_TEXT_BASE values are known at assembly
> time.

Hello! Thank you for this information. I would suggest to extend GAS
documentation to include this kind of information into . (dot) usage as
it is not really obvious that simple form with just addition and minus
operations results in something complex with multiplication. And also
that multiplication cannot be used in dot usage.

> A clever assembler might be able to rearrange the expression, assuming that
> overflow is unimportant, but gas does not do that.

This looks like some useful feature which is not supported...

> But just for reference the following would work:
> 
> 	.word KERNEL_OFFSET + CONFIG_SYS_TEXT_BASE - .
> 
> 
> I agree however that this message:
> 
>         t.s: Error: attempt to get value of unresolved symbol `L0'
> 
> is unhelpful.  So I am going to check in a patch to change it to:
> 
> 	t.s: Error: expression is too complex to be resolved

Perfect, that would be better.

> I looked into providing a file name and line number with the error
> message, but this would involve reworking a lot of the assembler's
> internal expression parser.

Having file name and line number would be also useful as it took me
some time to figure out where is the issue...

> 
> Cheers
>   Nick
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11 10:57       ` Pali Rohár
@ 2022-10-11 14:33         ` Nick Clifton
  2022-10-11 17:07           ` Pali Rohár
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Clifton @ 2022-10-11 14:33 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Richard Biener, gcc, binutils

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11 14:33         ` Nick Clifton
@ 2022-10-11 17:07           ` Pali Rohár
  2022-10-16 10:20             ` Pali Rohár
  0 siblings, 1 reply; 9+ messages in thread
From: Pali Rohár @ 2022-10-11 17:07 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Richard Biener, gcc, binutils

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?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Error: attempt to get value of unresolved symbol `L0'
  2022-10-11 17:07           ` Pali Rohár
@ 2022-10-16 10:20             ` Pali Rohár
  0 siblings, 0 replies; 9+ messages in thread
From: Pali Rohár @ 2022-10-16 10:20 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Richard Biener, gcc, binutils

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-10-16 10:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 17:18 Error: attempt to get value of unresolved symbol `L0' Pali Rohár
2022-10-11  6:46 ` Richard Biener
2022-10-11  7:43   ` Pali Rohár
2022-10-11 10:37     ` Nick Clifton
2022-10-11 10:47       ` Richard Biener
2022-10-11 10:57       ` Pali Rohár
2022-10-11 14:33         ` Nick Clifton
2022-10-11 17:07           ` Pali Rohár
2022-10-16 10:20             ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).