Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Kishore K <hellokishore@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: Re: bal instruction in gcc 3.x
Date: Tue, 19 Jul 2005 22:49:48 +0530	[thread overview]
Message-ID: <f07e6e05071910194bab9b16@mail.gmail.com> (raw)
In-Reply-To: <20050719164427.GB8758@linux-mips.org>

On 7/19/05, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Tue, Jul 19, 2005 at 10:00:20PM +0530, Kishore K wrote:
> 
> > We are facing a problem when U-boot is compiled with gcc 3.x
> >
> > U-boot  uses the following instruction in one of the files.
> >
> > bal jump_to_symbol
> >
> > This code gets compiled without any problem with gcc2. However, if I
> > compile the code
> > with gcc3, it exits with the error "Cannot branch to unknown symbol".
> >
> > What should we do to circumvent this problem ?
> >
> > I replaced
> >
> > bal jump_to_symbol
> >
> > by
> >
> > la t9, jump_to_symbol
> > jalr t9
> >
> > Then code gets compiled properly without any problem. Please let me
> > know, whether this
> > is correct way of fixing the problem. I am newbie to MIPS assembly
> > language. Why this
> > change is required with gcc 3.x compiler ?
> 
> FIrst of all, gcc doesn't care at all about your assembler code, that's
> the assembler which you must have changed along with that.
> 
> There used to be no relocation type to represent a branch to an external
> symbol in an ELF file which is why gas is throwing an error message, so
> gas is throwing an error message.  Latest gas fixed that shortcoming.
> I think there was a bug in somewhat older gas which resulted in such
> invalid code actually being accepted even though it shouldn't have been.
> 
>   Ralf

Thank you very much for the reply.

First of all code got compiled only after removing the option
-mips-allow-branch-to-undefined from Makefile. If this option is
included, compilation fails saying that option is invalid. I am using
binutils-2.14.90.06.
Same problem is observed even with binutils 2.15.94.0.2.2. 

Do you mean to say that no change is required in the code snippet 

bal jump_to_symbol

and code should get compiled with the latest assembler without any
problem. Please clearify.

TIA,
--kishore

  reply	other threads:[~2005-07-19 17:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-19 16:30 bal instruction in gcc 3.x Kishore K
2005-07-19 16:44 ` Ralf Baechle
2005-07-19 17:19   ` Kishore K [this message]
2005-07-19 19:53     ` Pete Popov
2005-07-20  8:59       ` Maciej W. Rozycki
2005-07-20  9:17         ` Thiemo Seufer
2005-07-20  9:47           ` Maciej W. Rozycki
2005-07-20  9:19         ` Kishore K
2005-07-20  9:52           ` Maciej W. Rozycki
2005-07-20 12:39           ` Alexander Voropay
2005-07-20 12:39             ` Alexander Voropay
2005-07-20 12:54             ` Maciej W. Rozycki
2005-07-20 13:24               ` Alexander Voropay
2005-07-20 13:24                 ` Alexander Voropay
2005-07-20 13:25               ` Thiemo Seufer
2005-07-20 12:54             ` Thiemo Seufer

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=f07e6e05071910194bab9b16@mail.gmail.com \
    --to=hellokishore@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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