From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id C48513858437 for ; Tue, 11 Oct 2022 07:43:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C48513858437 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53D3461046; Tue, 11 Oct 2022 07:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63697C433C1; Tue, 11 Oct 2022 07:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665474192; bh=gs2fZ8JGAyPX+GrnOpec1O2dm5633eiojQgvp1e1bL4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZsgZHS5upGT2PZ2hYL6MacbAYyONsOEVSC/OKm1J5oG/XhtkgtUI9hn4AKs+BH4Ew xLAjT8DzDGkryMdtRSrPYBmlUNk/cgrM21tL8h3n0xITh9dh74N37VRYUHX5Pc4ARi BuVYIK2+nR5gYg/ohAkPrhdBNORcSRy+XCyQp0Mx2CzKxrKHIMWQ0anARh59e2XSMW U1mwMdGMjW4Bq6nmE2j9AbZs2/RurTXIx3Ci1A3RWkGI2W90dLh1LmE/WUgE935sn4 TRy9iK5pUL4bi2XtmmQzrwlvHS6kUwoy+5xrt/JxB04HwSM96zabmiZAH175M5mF9D XXNurMFxmYZyg== Received: by pali.im (Postfix) id 6993E7B3; Tue, 11 Oct 2022 09:43:09 +0200 (CEST) Date: Tue, 11 Oct 2022 09:43:09 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Richard Biener Cc: gcc@gcc.gnu.org, binutils@sourceware.org Subject: Re: Error: attempt to get value of unresolved symbol `L0' Message-ID: <20221011074309.ojqoxwsosm6v7ozc@pali> References: <20221010171809.oqecrrdguv5hcta2@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 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'.