From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 952963858D3C for ; Tue, 11 Oct 2022 10:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 952963858D3C 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-ed1-x52a.google.com with SMTP id v12so1231785edc.6 for ; Tue, 11 Oct 2022 03:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ULn1zF3gbLWBj3lIf75xsRK82GLS7sLa8z9dzonK8Uw=; b=IqkByEUVaKmgCa9Bex0ZKgyutrpDd1D+eyXBXrPhtqSRrMe4e4Gby2Nnvflm1iJq8R MoOrlsEx1DqmbFuP6Oai7gTcCLIbL7BfD6t3fN5VI5Ts+bZWB/ObPH0FHfyJLFLIGxrZ mrXK/XCEt/6PTqzYJORLjahQRBKkVnEEadrGAsGz6bQXM2gj3KBfs3EJhPkYD4tQ+5zx WDlaTQeKc3Jf5ekEwb9ci4lumeVOM2xPJ390VvoZqtD4rOrqPFS4KhNtvCNlhBUi2nHQ ZPxPjpAafuFj7NRNYQAsBLbqLKqxYPNn44tj5SXcnd3WQK42n481K3xkyr0EPrKjiq0X AnOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=ULn1zF3gbLWBj3lIf75xsRK82GLS7sLa8z9dzonK8Uw=; b=O992NI3x5Q8XCZjFN7yB13QOxMXLABEqbNSU6Wz6YzUM3aTXkaZxKcmEtMV4gIGLoa bIppvOsPXDrG+gkMYcN8VNbbUhPRggo6OiqkrJNSDH4gsEIOJTOjZ8ftrwLXj7gVf8SK IGOr/RmjUW3k7ume0aU9PRMqEMV8oNOI1KM19PNqEVih1vRjvB+cAUlSeUbi+f3+Sv8Z DXco8wApVozjIny/NTwtwMBc1NswAkoNjOk0izHSTE7ctEOtz9lu/an2GguwF4kum8p/ VSh8h847VhuQgcdW2Itglw4Uy1M7ONW8VUiMBcxV2gOg+whXr9rupxb0Uk6gWrkkc89S Lq+Q== X-Gm-Message-State: ACrzQf1RaWz8Na2zo4DEsswPbVVc3IOsQD7RWH+/iz6X3xLQneKdAYTX T1KXSB1RCi+hwt9RKxzzpANrQ4iTMN5dDCkKwB4= X-Google-Smtp-Source: AMsMyM5rcQkhWTILgUM5S1h0yyv3goF2O97DvNh1tepLa4Ob7E6O45rckxW2582gpmkmZh4m2wzvFt8NcWi0ZxjT2Oo= X-Received: by 2002:a05:6402:3581:b0:45b:4250:2564 with SMTP id y1-20020a056402358100b0045b42502564mr16736775edc.218.1665485260325; Tue, 11 Oct 2022 03:47:40 -0700 (PDT) MIME-Version: 1.0 References: <20221010171809.oqecrrdguv5hcta2@pali> <20221011074309.ojqoxwsosm6v7ozc@pali> In-Reply-To: From: Richard Biener Date: Tue, 11 Oct 2022 12:47:28 +0200 Message-ID: Subject: Re: Error: attempt to get value of unresolved symbol `L0' To: Nick Clifton Cc: =?UTF-8?Q?Pali_Roh=C3=A1r?= , gcc@gcc.gnu.org, binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 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 Tue, Oct 11, 2022 at 12:37 PM 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 : > 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 >