From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id D69463858437 for ; Tue, 11 Oct 2022 06:47:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D69463858437 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62a.google.com with SMTP id b2so29289403eja.6 for ; Mon, 10 Oct 2022 23:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Vz19XfatSOU+4L67GF0VySn2k8ox4VMdDz0WbQVN/tw=; b=XBin3osQwlfDg8Oquz2qsXxvrZVbQ2H4AVgSiDw0r35n5OXI+1khHO8azSdH28B6Og BEo5/kjNtESeir30eNMmcXc7dOnyCuzpPu5Sad0hcNenhWyP+9URBWTnABUuAJB82BM9 /zkk+y1b+S9URh7TF3bNIdV0exgPkej43A1gg+MFJI0KjHtz3znUiAYXW4ATPPONo0cm xXMw03Ng5KD2xnClxPnFUHdrTWveG6XzlbGr+QXdqIzkJ/5NMosAEXISFpoizrVNrdR7 YFX7ZzlyGttrSxxI6mSGGyH+kkRl2U6kZH1zvD52BAe4LRVsAC45mM2opDCPpLdRk5t7 IX4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vz19XfatSOU+4L67GF0VySn2k8ox4VMdDz0WbQVN/tw=; b=4yTPLrLQZWq7fzahBAOsA6kX8dwJQvh0yJCCjqJY+NqRcG89f0NFtCFLcKN+BgOV98 Rr8DdsNh6MYs3pvSMYxK8xgWi9ZEutXC+IPZoRIm6GkBw95jaPd7YBux3Sq2BjvjV5GL CqTyDDCPSXc2pgTW1Wrpsm5J77JyZjzk9kcfy024ITbw2UWiWZdAK10W4uD6212rhk4u x3AxGaEhzYmMOgICuc3fk0hViIgfxUcgnYXlfqIEYOmtnSULJc1yrKl1e+ovhjvPurwH 1j2VEn4QgQ8z+SSxuBFhHf+v51pmV0Dqe2ktYUEovAbtbS8rgYdMx3cu7GpVfhqiQNvt wHFQ== X-Gm-Message-State: ACrzQf1tLwyW6nXrCBUfUmwYWVxbQHvW5qaQ6vb3VRqYpQODPokQ3Gmk WJvipv56c26kVFJUZov+XDEGz8Kfbg1fjnaYVHg= X-Google-Smtp-Source: AMsMyM7z9URIu1YP9iWdMLqwpeG1K+uDzNhHZ0Ld23K1rRW0KicZE2+KtfLEmmZoY1VDKnOewdJ5y87jLWdPbP39QMU= X-Received: by 2002:a17:907:7b9e:b0:78d:cddc:1ba5 with SMTP id ne30-20020a1709077b9e00b0078dcddc1ba5mr3766528ejc.754.1665470830496; Mon, 10 Oct 2022 23:47:10 -0700 (PDT) MIME-Version: 1.0 References: <20221010171809.oqecrrdguv5hcta2@pali> In-Reply-To: <20221010171809.oqecrrdguv5hcta2@pali> From: Richard Biener Date: Tue, 11 Oct 2022 08:46:58 +0200 Message-ID: Subject: Re: Error: attempt to get value of unresolved symbol `L0' To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: gcc@gcc.gnu.org, binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 Mon, Oct 10, 2022 at 7:19 PM Pali Roh=C3=A1r via Gcc w= rote: > > 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=3D0x40000 -DCONFIG_SYS_TEXT_BAS= E=3D0x80008000 -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 thi= nk this is an assembler issue or this use is not supported. Simplified testca= se: > 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=3Darm-linux-gnueabi-gcc > COLLECT_LTO_WRAPPER=3D/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrappe= r > Target: arm-linux-gnueabi > Configured with: ../src/configure -v --with-pkgversion=3D'Debian 8.3.0-= 2' --with-bugurl=3Dfile:///usr/share/doc/gcc-8/README.Bugs --enable-languag= es=3Dc,ada,c++,go,d,fortran,objc,obj-c++ --prefix=3D/usr --with-gcc-major-v= ersion-only --program-suffix=3D-8 --enable-shared --enable-linker-build-id = --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix= --libdir=3D/usr/lib --enable-nls --with-sysroot=3D/ --enable-clocale=3Dgnu= --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-default-libs= tdcxx-abi=3Dnew --enable-gnu-unique-object --disable-libitm --disable-libqu= admath --disable-libquadmath-support --enable-plugin --enable-default-pie -= -with-system-zlib --with-target-system-zlib --enable-multiarch --disable-sj= lj-exceptions --with-arch=3Darmv5te --with-float=3Dsoft --disable-werror --= enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-= gnu --target=3Darm-linux-gnueabi --program-prefix=3Darm-linux-gnueabi- --in= cludedir=3D/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'.