From owner-freebsd-arm@FreeBSD.ORG Sat Sep 24 05:20:03 2011 Return-Path: Delivered-To: freebsd-arm@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FABF106566C for ; Sat, 24 Sep 2011 05:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6CD4E8FC14 for ; Sat, 24 Sep 2011 05:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8O5K3ov038789 for ; Sat, 24 Sep 2011 05:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8O5K3pF038784; Sat, 24 Sep 2011 05:20:03 GMT (envelope-from gnats) Date: Sat, 24 Sep 2011 05:20:03 GMT Message-Id: <201109240520.p8O5K3pF038784@freefall.freebsd.org> To: freebsd-arm@FreeBSD.org From: Naoyuki Tai Cc: Subject: Re: arm/154189: lang/perl5.12 doesn't build on arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Naoyuki Tai List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2011 05:20:03 -0000 The following reply was made to PR arm/154189; it has been noted by GNATS. From: Naoyuki Tai To: bug-followup@FreeBSD.org, kvedulv@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