Request to pull in upstream fixes to allow compilation with gcc 4.8

224 views
Skip to first unread message

Harm Hanemaaijer <fgenfb@yahoo.com>

unread,
Jun 27, 2013, 2:49:04 PM6/27/13
to linux...@googlegroups.com
The current linux-sunxi kernels, like other ARM kernels, have issues when compiled with recent gcc versions >= 4.8. This is related to a bug in the ARM memset function in the kernel. However, this is already fixed upstream in the mainline kernel by two commits (one commit provided an initial fix, the other one fixed bugs in that one). However, the latest versions of the stable upstream 3.4.x tree do not contain the fix.

The fix only affects one file, arch/arm/lib/memset.S, which hasn't changed for quite a while. The two relevant commits in the stable 3.9.x tree are:

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/arch/arm/lib/memset.S?id=455bd4c430b0c0a361f38e8658a0d6cb469942b5

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/arch/arm/lib/memset.S?id=418df63adac56841ef6b0f1fcf435bc64d4ed177

From a branch on the linux-sunxi repository the fixes can be pulled in with the command

git cherry-pick 455bd4c430b0c0a361f38e8658a0d6cb469942b5 418df63adac56841ef6b0f1fcf435bc64d4ed177

This has been tested on the sunxi-3.4 branch compiled with the latest linaro gcc 4.8 toolset.

Hans de Goede

unread,
Jun 27, 2013, 3:29:08 PM6/27/13
to linux...@googlegroups.com, Harm Hanemaaijer <fgenfb@yahoo.com>
Hi,
Thanks for this! I've added these 2 patches to my personal wip tree for now:
github.com/jwrdegoede/linux-sunxi.git/sunxi-3.4-a20-wip

Development on the main sunxi-3.4 tree is stalled a bit atm, hopefully that will get fixed
soon.

I noticed in the commit messages that this is a problem since gcc-4.7.2, is that correct?

(I'm asking since I'm currently using 4.7.2)

Regards,

Hans

Siarhei Siamashka

unread,
Jun 27, 2013, 3:56:40 PM6/27/13
to linux...@googlegroups.com, hdeg...@redhat.com, Harm Hanemaaijer <fgenfb@yahoo.com>
I guess the original reporter might have used a linaro toolchain. And
linaro toolchains are heavily patched with various experimental stuff
not yet available in the upstream FSF gcc releases.

--
Best regards,
Siarhei Siamashka

Harm Hanemaaijer <fgenfb@yahoo.com>

unread,
Jun 27, 2013, 3:58:42 PM6/27/13
to linux...@googlegroups.com
Op donderdag 27 juni 2013 21:29:08 UTC+2 schreef Hans de Goede het volgende:

>
> I noticed in the commit messages that this is a problem since gcc-4.7.2, is that correct?
>
> (I'm asking since I'm currently using 4.7.2)
>

Not quite sure, the 4.7.3 version of linaro gcc that I was using previously seemed to work OK without any patches to the kernel. So I guess the problem only shows up for real with gcc 4.8. Of course, if the compiler optimizations that trigger the issue can also happen with gcc 4.7.2 or 4.7.3, that could result in potential problems rearing up unexpectedy.

In any case, the safer solution seems to be to apply the commits regardless whether gcc 4.8 or 4.7 is used to compile the kernel.

Emilio López

unread,
Jun 27, 2013, 6:19:50 PM6/27/13
to linux...@googlegroups.com
El 27/06/13 15:49, Harm Hanemaaijer <fge...@yahoo.com> escribi�:
I can confirm the kernel boots just fine with this applied and building
with a 4.8 linaro toolchain, so I have staged both patches on both 3.0
and 3.4 trees for the time being.

Cheers,

Emilio

Rob Brown

unread,
Jun 27, 2013, 6:25:49 PM6/27/13
to linux...@googlegroups.com
Hi,

This is only tangentially related, I hope it's not too far off topic.

On Friday, June 28, 2013 7:29:08 AM UTC+12, Hans de Goede wrote:
Hi,

On 06/27/2013 08:49 PM, Harm Hanemaaijer <fge...@yahoo.com> wrote:
> The current linux-sunxi kernels, like other ARM kernels, have issues when compiled with recent gcc versions >= 4.8. This is related to a bug in the ARM memset function in the kernel. However, this is already fixed upstream in the mainline kernel by two commits (one commit provided an initial fix, the other one fixed bugs in that one). However, the latest versions of the stable upstream 3.4.x tree do not contain the fix.
>
> The fix only affects one file, arch/arm/lib/memset.S, which hasn't changed for quite a while. The two relevant commits in the stable 3.9.x tree are:
>

Thanks for this! I've added these 2 patches to my personal wip tree for now:
github.com/jwrdegoede/linux-sunxi.git/sunxi-3.4-a20-wip


 
(I'm asking since I'm currently using 4.7.2)

Regards,

Hans

This is interesting...  I'm getting a build failure on your sunxi-3.4-a20-wip tree, which is not exactly the same but may be related. I was going to ask what compiler you're using (I've only tried 4.6, on the board itself using the Ubuntu image compiler, and on a Gentoo box using their crossdev toolchain).

The error is:

   LD      arch/arm/mach-sun7i/pm/standby/standby.elf
arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `itoa':
/home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:167: 
undefined reference to `memcpy'
arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `utoa':
/home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:213: 
undefined reference to `memcpy'
arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `print_align':
/home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:368: 
undefined reference to `memcpy'
make[3]: *** [arch/arm/mach-sun7i/pm/standby/standby.elf] Error 1
make[2]: *** [arch/arm/mach-sun7i/pm/standby/standby.bin] Error 2
make[1]: *** [arch/arm/mach-sun7i/pm] Error 2
make: *** [arch/arm/mach-sun7i] Error 2

Google finds a lot of similar failures (over many years). I'm sure it will be pretty trivial to fix, but initially I'm going to just try building with a 4.7 gcc.

Cheers,
Rob.

Hans de Goede

unread,
Jun 27, 2013, 6:37:37 PM6/27/13
to linux...@googlegroups.com, Rob Brown
Hi,

On 06/28/2013 12:25 AM, Rob Brown wrote:
> Hi,
>
> This is only tangentially related, I hope it's not too far off topic.
>
> On Friday, June 28, 2013 7:29:08 AM UTC+12, Hans de Goede wrote:
>
> Hi,
>
> On 06/27/2013 08:49 PM, Harm Hanemaaijer <fge...@yahoo.com> wrote:
> > The current linux-sunxi kernels, like other ARM kernels, have issues when compiled with recent gcc versions >= 4.8. This is related to a bug in the ARM memset function in the kernel. However, this is already fixed upstream in the mainline kernel by two commits (one commit provided an initial fix, the other one fixed bugs in that one). However, the latest versions of the stable upstream 3.4.x tree do not contain the fix.
> >
> > The fix only affects one file, arch/arm/lib/memset.S, which hasn't changed for quite a while. The two relevant commits in the stable 3.9.x tree are:
> >
>
> Thanks for this! I've added these 2 patches to my personal wip tree for now:
> github.com/jwrdegoede/linux-sunxi.git/sunxi-3.4-a20-wip <http://github.com/jwrdegoede/linux-sunxi.git/sunxi-3.4-a20-wip>
>
>
> (I'm asking since I'm currently using 4.7.2)
>
> Regards,
>
> Hans
>
>
> This is interesting... I'm getting a build failure on your sunxi-3.4-a20-wip tree, which is not exactly the same but may be related. I was going to ask what compiler you're using (I've only tried 4.6, on the board itself using the Ubuntu image compiler, and on a Gentoo box using their crossdev toolchain).
>
> The error is:
>
> LD arch/arm/mach-sun7i/pm/standby/standby.elf
> arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `itoa':
> /home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:167:
> undefined reference to `memcpy'
> arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `utoa':
> /home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:213:
> undefined reference to `memcpy'
> arch/arm/mach-sun7i/pm/standby/mem_printk.o: In function `print_align':
> /home/rfbrown/projects/cubie/linux-sunxi/arch/arm/mach-sun7i/pm/standby/mem_printk.c:368:
> undefined reference to `memcpy'
> make[3]: *** [arch/arm/mach-sun7i/pm/standby/standby.elf] Error 1
> make[2]: *** [arch/arm/mach-sun7i/pm/standby/standby.bin] Error 2
> make[1]: *** [arch/arm/mach-sun7i/pm] Error 2
> make: *** [arch/arm/mach-sun7i] Error 2
>
> Google finds a lot of similar failures (over many years). I'm sure it will be pretty trivial to fix, but initially I'm going to just try building with a 4.7 gcc.

Ah, yes that looks like a bug where the sunxi code depends on being compiled with a compiler
which replaces memcpy with inline code for all their uses of it. I plan to remove super-standby
support anyways, since most of the drivers in the sunxi lack support for it (allwinner
"invented" it after the initial source dump the sunxi code is mostly based on), and we don't
have it (super standby support) for sun4i or sun5i either. In the mean time using 4.7 should
work I guess.

Good news btw, I've just got the hdmi out on my cubie2 working! My work needs some cleanup,
I'll do that tomorrow and push it then.

Attached is my wip patch. The cleanup needed is to not simply commment out the hdmi cec loop
call (which currently hangs because of a broken usleep implementation in the cec code.

Regards,

Hans
wip
Reply all
Reply to author
Forward
0 new messages