linux-mips
[Top] [All Lists]

Re: Gcc - can't branch to undefined symbol

To: Jerry Walden <jerry.walden@lantronix.com>
Subject: Re: Gcc - can't branch to undefined symbol
From: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Date: Fri, 30 Jan 2004 07:32:54 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
In-reply-to: <20040129221426.GA8465@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <603BA0CFF3788E46A0DB0918D9AA95100A0E3088@sj580004wcom.int.lantronix.com> <20040129221426.GA8465@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.4i
Ralf Baechle wrote:
> On Thu, Jan 29, 2004 at 12:25:16PM -0800, Jerry Walden wrote:
> 
> > I am using gcc 3.3.2 - when I assemble a file that has a branch to a
> > label, and the label is not defined in the .S file (i.e. there is no
> > extern - the label exists in another .S file) the error "cannot branch
> > to an undefined symbol" results.  Using an older version of
> > mipsel-gnu-linux-gcc does not report this error.  Any idea what I am
> > doing wrong?
> 
> This construct is illegal because it cannot be represented in MIPS ELF.

MIPS ELF could do (modulo some documentation bug in the spec), it is
specifically the assembler which forbids branches to external labels.
I wrote once a patch to allow it, but this broke NewABI support in turn.

It would be nice optimization as long as the linker can guarantee the
code is in the maximum branch range (+-128k).


Thiemo

<Prev in Thread] Current Thread [Next in Thread>