This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Assembler messages
- From: Shaun Jackman <sjackman at telus dot net>
- To: binutils at sources dot redhat dot com
- Cc: Dave Korn <dk at artimi dot com>
- Date: Wed, 16 Jun 2004 09:08:55 -0700
- Subject: Re: Assembler messages
- References: <NUTMEGXCRQcqmSvux4J000002f3@NUTMEG.CAM.ARTIMI.COM>
> > [a.s]
> > .text
> > a:
> > .word 0
> >
> > [b.s]
> > .text
> > b:
> > ldr r0, a
> >
> > To me, just because the symbol and the referencer are in
> > different files shouldn't end the world. That's why we have a
> > linker. If you merge the two files it works just fine.
>
> Yes, that'll work fine. In the prior example, the symbol X was
> assumed not to actually be defined anywhere else, I assume.
Ah, but it doesn't work, and I don't understand why.
$ arm-elf-gcc -c a.s b.s
b.s: Assembler messages:
b.s:3: Error: internal_relocation (type: OFFSET_IMM) not fixed up
$ cat a.s b.s > ab.s
$ arm-elf-gcc -c ab.s
$
Can this be made to work?
> > and a check for the second case is needed:
> > "`%s' must be defined in the same section"
>
> When gas detects that two symbols are in different sections and
> the abi doesn't support the necessary reloc, it emits the following
> message (gas/write.c:fixup_segment)
>
> Error: can't resolve `.text' {.text section} - `.L13' {.rodata
> section}
>
> May I suggest it would be good to make the messages consistent
> between assembler and linker?
I found that the assembler produced the same cryptic message.
$ cat > c.s
.data
a:
.word 0
.text
b:
ldr r0, a
$ arm-elf-gcc -c c.s
c.s: Assembler messages:
c.s:6: Error: internal_relocation (type: OFFSET_IMM) not fixed up
I'd like to replace all occurrences of this message this a message
explaining why the assembler was unable to fix up the relocation.
Cheers,
Shaun