public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Nick Clifton <nickc@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	gcc@gcc.gnu.org, binutils@sourceware.org
Subject: Re: Error: attempt to get value of unresolved symbol `L0'
Date: Tue, 11 Oct 2022 19:07:55 +0200	[thread overview]
Message-ID: <20221011170755.zkugr3ag27jghpcm@pali> (raw)
In-Reply-To: <5d886f55-0efa-0d0c-8edc-26cfe5cd4d09@redhat.com>

On Tuesday 11 October 2022 15:33:59 Nick Clifton wrote:
> Hi Pali, Hi Richard,
> 
> > Having file name and line number would be also useful as it took me
> > some time to figure out where is the issue...
> 
> Right - I have tried a little harder and come up with a follow up patch.
> This is now checked in, and given an input file that looks like this:
> 
>   % cat t.s
>   kernoff:
> 	.set KERNEL_OFFSET, 0x40000
> 	.set CONFIG_SYS_TEXT_BASE, 0x80008000
> 	.word 44
> 	.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> 	.word - (. - 0x80008000)
> 	.word 0x40000 - (. - 0x0)
> 
> The assembler now produces the following output:
> 
>   t.s: Assembler messages:
>   t.s:5: Error: expression is too complex to be resolved or converted into relocations
>   t.s:6: Error: expression is too complex to be resolved or converted into relocations
> 
> Note - some targets do support applying multiple relocations to a
> single address, but even then there can be expressions that cannot
> be resolved this way.  That is why the error message refers to
> "converted into relocations" rather than just "converted into a
> relocation".
> 
> Cheers
>   Nick
> 

Nice!

Anyway, what should I use in code?

  .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET

or

  .word CONFIG_SYS_TEXT_BASE + KERNEL_OFFSET - .

And can you guarantee that one of those form would work also in future
gcc/binutils versions, and it is not something version specific or
undocumented?

  reply	other threads:[~2022-10-11 17:08 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
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 [this message]
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=20221011170755.zkugr3ag27jghpcm@pali \
    --to=pali@kernel.org \
    --cc=binutils@sourceware.org \
    --cc=gcc@gcc.gnu.org \
    --cc=nickc@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).