From: Richard Biener <richard.guenther@gmail.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: gcc@gcc.gnu.org, binutils@sourceware.org
Subject: Re: Error: attempt to get value of unresolved symbol `L0'
Date: Tue, 11 Oct 2022 08:46:58 +0200 [thread overview]
Message-ID: <CAFiYyc1YLoN7HKmq6bKHwqT0_xwC5vioNwvMX60aXdbpzkgiQQ@mail.gmail.com> (raw)
In-Reply-To: <20221010171809.oqecrrdguv5hcta2@pali>
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'.
next prev parent reply other threads:[~2022-10-11 6:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 17:18 Pali Rohár
2022-10-11 6:46 ` Richard Biener [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc1YLoN7HKmq6bKHwqT0_xwC5vioNwvMX60aXdbpzkgiQQ@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=binutils@sourceware.org \
--cc=gcc@gcc.gnu.org \
--cc=pali@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).