public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Jörg Krause" <joerg.krause@embedded.rocks>
To: u-boot@lists.denx.de
Subject: [U-Boot] GCC 5.2 issue on imx28
Date: Thu, 06 Aug 2015 10:33:46 +0200	[thread overview]
Message-ID: <1438850026.32524.12.camel@embedded.rocks> (raw)
In-Reply-To: <yw1x7fp9fskd.fsf@unicorn.mansr.com>

On Mi, 2015-08-05 at 20:23 +0100, M?ns Rullg?rd wrote:
> J?rg Krause <joerg.krause@embedded.rocks> writes:
> 
> > Dear M?ns Rullg?rd, Otavio Salvador,
> > 
> > On Di, 2015-07-28 at 14:39 +0100, M?ns Rullg?rd wrote:
> > > Otavio Salvador <otavio.salvador@ossystems.com.br> writes:
> > 
> > [snip]
> > 
> > > There are two errors reports:
> > > 
> > > 1. An undefined reference to the symbol "lowlevel_init"
> > > 2. A complaint about the ".rel.plt" section not being handled by 
> > > the
> > >    linker script.
> > > 
> > > The second error is probably caused by the first.  A quick grep 
> > > turns 
> > > up
> > > this snippet in arch/arm/cpu/arm926ejs/mxs/mxs.c:
> > > 
> > > /* Lowlevel init isn't used on i.MX28, so just have a dummy here 
> > > */
> > > inline void lowlevel_init(void) {}
> > > 
> > > The semantics for non-static functions declared inline have 
> > > changed 
> > > in
> > > gcc5, causing the above (empty) function not to be emitted as an
> > > external symbol.
> > > 
> > > Since that function is only referenced from start.S, it should 
> > > not be
> > > declared inline at all.  This patch should thus fix your problem:
> > > 
> > > diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c 
> > > b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> > > index ef130ae..b1d8721 100644
> > > --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> > > +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> > > @@ -24,7 +24,7 @@
> > >  DECLARE_GLOBAL_DATA_PTR;
> > >  
> > >  /* Lowlevel init isn't used on i.MX28, so just have a dummy here 
> > > */
> > > -inline void lowlevel_init(void) {}
> > > +void lowlevel_init(void) {}
> > >  
> > >  void reset_cpu(ulong ignored) __attribute__((noreturn));
> > >  
> > 
> > I stumbled over the same problem. Unfortunatly, I did not find this
> > patch before (only the error report from Otavia) and submitted a
> > similar patch [1] which keeps the inline keyword.
> > 
> > Best regards
> > J?rg Krause
> > 
> > [1] "arm: mxs: make inline function compatible for GCC 5"
> > https://patchwork.ozlabs.org/patch/504043/
> 
> Since the function is only referenced from outside the C file, any 
> use
> of inline makes little sense to me.  While your patch achieves the
> result of creating a linkable instance of the function, it is more
> complicated than it needs to be.
> 

In my opinion it quite make sense to use inline for functions
referenced only from other files. The keyword is just an hint to the
compiler and why should it not make sense for other C files? However,
in this case it makes really no difference if lowlevel_init is marked
as inline, gcc will generate an "BL lowlevel_init" instruction in both
cases.

J?rg

  reply	other threads:[~2015-08-06  8:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 13:19 [U-Boot] GCC 5.2 issue on imx28 Otavio Salvador
2015-07-28 13:37 ` Wolfgang Denk
2015-07-28 13:39 ` Måns Rullgård
2015-07-28 17:16   ` Otavio Salvador
2015-08-05 19:17   ` Jörg Krause
2015-08-05 19:23     ` Måns Rullgård
2015-08-06  8:33       ` Jörg Krause [this message]
2015-08-06 10:45         ` Måns Rullgård
2015-08-13 13:23   ` Tom Rini

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=1438850026.32524.12.camel@embedded.rocks \
    --to=joerg.krause@embedded.rocks \
    --cc=u-boot@lists.denx.de \
    /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