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