arm/154189: lang/perl5.12 doesn't build on arm
Naoyuki Tai
ntai at smartfruit.com
Sat Sep 24 05:20:03 UTC 2011
The following reply was made to PR arm/154189; it has been noted by GNATS.
From: Naoyuki Tai <ntai at smartfruit.com>
To: bug-followup at FreeBSD.org, kvedulv at kvedulv.de
Cc:
Subject: Re: arm/154189: lang/perl5.12 doesn't build on arm
Date: Sat, 24 Sep 2011 01:11:32 -0400
After spending some more time on this, I can reasonably conclude that
this is a compiler bug.
First off, the build succeeds if "-fstack-protector" is not used.
Here is the locale.s from locale.s of perl5-10.1, without stack protector.
(Sorry I'm using perl5.10.1 for this example, but 5.10 and 5.12
crashes same way.)
Perl_new_collate:
@ args = 0, pretend = 0, frame = 104
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, r5, r6, fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #104
ldr r6, .L48
.LPIC2:
add r6, pc, r6
subs r5, r0, #0
bne .L31
ldr r3, .L48+4
And the data segment .L48 is
L48:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC2+8)
.word PL_collation_name(GOT)
Here is the assembler output of locale.c with the -fstack-protector.
Perl_new_collate:
@ args = 0, pretend = 0, frame = 104
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, r5, r6, fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #104
ldr r6, .L49
.LPIC2:
add r6, pc, r6
ldr r3, .L49+4
And the data segment is
.L49:
.word _GLOBAL_OFFSET_TABLE_-(.LPIC2+8)
.word __stack_chk_guard(GOT)
.word PL_collation_name(GOT)
Notice the last "ldr r3, .L49+4".
It is loading r3 register from __stack_chk_guard(GOT) instead of
PL_collation_name(GOT).
So, I think that the arm backend has a bug that it is producing wrong
offsets in the data segment when the stack protector is used.
After noticing this, I took out the "-fstack-protector" from build and
the build succeeds.
It may be the problem that the combination of -fPIC and
-fstack-protector is used.
In any case, it is clear that the GCC's arm backend has a bug.
cc --version
cc (GCC) 4.2.1 20070719 [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- Tai
More information about the freebsd-arm
mailing list