* [U-Boot] GCC 5.2 issue on imx28
@ 2015-07-28 13:19 Otavio Salvador
2015-07-28 13:37 ` Wolfgang Denk
2015-07-28 13:39 ` Måns Rullgård
0 siblings, 2 replies; 9+ messages in thread
From: Otavio Salvador @ 2015-07-28 13:19 UTC (permalink / raw)
To: u-boot
Hello folks,
OE-Core is preparing for upgrade to GCC 5.2 as default compiler and
mx28 is failing[1] to build with it.
1. http://errors.yoctoproject.org/Errors/Details/13878/
I am not a linker guy so could someone shed any light on this?
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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
1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2015-07-28 13:37 UTC (permalink / raw)
To: u-boot
Dear Otavio,
In message <CAP9ODKqqA6v6Ug4+Cx4fBdCRLchaOxL3SCZN5+iwbbFoKyq-mA@mail.gmail.com> you wrote:
>
> OE-Core is preparing for upgrade to GCC 5.2 as default compiler and
> mx28 is failing[1] to build with it.
>
> 1. http://errors.yoctoproject.org/Errors/Details/13878/
>
> I am not a linker guy so could someone shed any light on this?
Does the same problem happen with the pristine mainline U-Boot tree?
The error message looks pretty cleaar to me:
../arch/arm/cpu/arm926ejs/start.S:108: undefined reference to `lowlevel_init'
In your case (mx28evk_config) this would normally come from
arch/arm/cpu/arm926ejs/mxs/mxs.c:
inline void lowlevel_init(void) {}
Did you check the compiler release notes for differences in the
handling of such inline funtions?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'd rather be led to hell than managed to heaven.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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
` (2 more replies)
1 sibling, 3 replies; 9+ messages in thread
From: Måns Rullgård @ 2015-07-28 13:39 UTC (permalink / raw)
To: u-boot
Otavio Salvador <otavio.salvador@ossystems.com.br> writes:
> Hello folks,
>
> OE-Core is preparing for upgrade to GCC 5.2 as default compiler and
> mx28 is failing[1] to build with it.
>
> 1. http://errors.yoctoproject.org/Errors/Details/13878/
>
> I am not a linker guy so could someone shed any light on this?
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));
--
M?ns Rullg?rd
mans at mansr.com
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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-13 13:23 ` Tom Rini
2 siblings, 0 replies; 9+ messages in thread
From: Otavio Salvador @ 2015-07-28 17:16 UTC (permalink / raw)
To: u-boot
On Tue, Jul 28, 2015 at 10:39 AM, M?ns Rullg?rd <mans@mansr.com> wrote:
...
> 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));
Works like a charm.
Tested-by: Otavio Salvador <otavio@ossystems.com.br>
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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-13 13:23 ` Tom Rini
2 siblings, 1 reply; 9+ messages in thread
From: Jörg Krause @ 2015-08-05 19:17 UTC (permalink / raw)
To: u-boot
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/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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
0 siblings, 1 reply; 9+ messages in thread
From: Måns Rullgård @ 2015-08-05 19:23 UTC (permalink / raw)
To: u-boot
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.
--
M?ns Rullg?rd
mans at mansr.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
2015-08-05 19:23 ` Måns Rullgård
@ 2015-08-06 8:33 ` Jörg Krause
2015-08-06 10:45 ` Måns Rullgård
0 siblings, 1 reply; 9+ messages in thread
From: Jörg Krause @ 2015-08-06 8:33 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
2015-08-06 8:33 ` Jörg Krause
@ 2015-08-06 10:45 ` Måns Rullgård
0 siblings, 0 replies; 9+ messages in thread
From: Måns Rullgård @ 2015-08-06 10:45 UTC (permalink / raw)
To: u-boot
J?rg Krause <joerg.krause@embedded.rocks> writes:
> 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?
If using link-time optimisation, it could make sense, yes. If not,
there is no way a function can be inlined across translation units.
> 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.
Correct. Here the only caller is in an assembly file, which is not
subject to link-time optimisations.
--
M?ns Rullg?rd
mans at mansr.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] GCC 5.2 issue on imx28
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-13 13:23 ` Tom Rini
2 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2015-08-13 13:23 UTC (permalink / raw)
To: u-boot
On Tue, Jul 28, 2015 at 02:39:49PM +0100, M?ns Rullg?rd wrote:
> Otavio Salvador <otavio.salvador@ossystems.com.br> writes:
>
> > Hello folks,
> >
> > OE-Core is preparing for upgrade to GCC 5.2 as default compiler and
> > mx28 is failing[1] to build with it.
> >
> > 1. http://errors.yoctoproject.org/Errors/Details/13878/
> >
> > I am not a linker guy so could someone shed any light on this?
>
> 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:
> Tested-by: Otavio Salvador <otavio@ossystems.com.br>
>
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> index ef130ae..b1d8721 100644
After a bit re-wording of the commit message, applied to u-boot/master,
thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150813/b1be4463/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-08-13 13:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-08-06 10:45 ` Måns Rullgård
2015-08-13 13:23 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox