This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: hppa, global symbols and the BL instruction
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: binutils at sourceware dot org
- Date: Sun, 11 Dec 2005 11:18:30 +0100
- Subject: Re: hppa, global symbols and the BL instruction
- References: <200512102030.jBAKUaJd015795@hiauly1.hia.nrc.ca>
* John David Anglin:
>> Could anybody please enlight me why the following does not assemble on
>> HPPA?
>>
>> .text
>> .org . + 262144
>> .globl foo
>> foo:
>> bl foo, %r0
>>
>> (The .org instruction is only used to avoid insert many instructions,
>> which are otherwise required to trigger this bug.)
>>
>> I would have expect that foo is reachable with a 17-bit displacement
>> even if foo is a global symbol. But instead, I get this error message:
>>
>> foo.s:5: Error: Field out of range [-262144..262143] (-262152).
>
> I think the error is a bug. foo could be overloaded with another
> definition should the above code get linked into a shared library.
Ah, I missed that.
> In that case, the branch would be out of range. However, I think
> it should be up to the linker to issue an error.
It seems that GAS cannot encode the necessary relocation if the symbol
is more than 64K instructions away from the start of the object file.
It's probably not a bug in GAS. In any case, the compiler which
generates such assembler files needs to be fixed.