From nobody@FreeBSD.org Fri Jan 21 10:13:38 2011 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4A54106566B for ; Fri, 21 Jan 2011 10:13:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id C48618FC13 for ; Fri, 21 Jan 2011 10:13:38 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p0LADcuf071914 for ; Fri, 21 Jan 2011 10:13:38 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p0LADcq7071913; Fri, 21 Jan 2011 10:13:38 GMT (envelope-from nobody) Message-Id: <201101211013.p0LADcq7071913@red.freebsd.org> Date: Fri, 21 Jan 2011 10:13:38 GMT From: Michael Moll To: freebsd-gnats-submit@FreeBSD.org Subject: lang/perl5.12 doesn't build on arm X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 154189 >Category: arm >Synopsis: lang/perl5.12 doesn't build on arm >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-arm >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 21 10:20:06 UTC 2011 >Closed-Date: >Last-Modified: Mon Dec 12 22:10:09 UTC 2011 >Originator: Michael Moll >Release: -CURRENT >Organization: >Environment: FreeBSD deskstar 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r217665: Fri Jan 21 01:20:34 CET 2011 mmoll@emperor.kvedulv.de:/usr/obj/arm.arm/usr/current/src/sys/DESKSTAR arm >Description: I installed FreeBSD-CURRENT on a FreeBSD Seagate Dockstar. When compiling lang/perl5.12 the generated miniperl dumps core with signal 11 and the following backtrace: #0 0x000fe86c in Perl_new_collate () #1 0x000ff2c8 in Perl_init_i18nl10n () #2 0x00126884 in perl_construct () #3 0x0010b930 in main () I guess that's the same issue as with 5.10 in http://lists.freebsd.org/pipermail/freebsd-arm/2010-February/002174.html Perl 5.8 builds fine on the same system. >How-To-Repeat: Build lang/perl5.12 on arm >Fix: >Release-Note: >Audit-Trail: 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: Fri, 23 Sep 2011 00:42:41 -0400 --20cf30781540855aea04ad94704f Content-Type: text/plain; charset=UTF-8 I have built miniperl that runs by removing "-DPIC -fPIC" from the c flags everywhere. After "make build" fails at miniperl core dump, I removed the *.o, and removed "-DPIC -fPIC" from make files, cflags, etc. Then, I restarted the build in the work/perl-5-12.4 directory with gmake. This builds miniperl that runs. miniperl crashes regardless of debug or optimized build. So, this is not a compiler optimization problem. From those two, the reason of miniperl core dump may be because the objects compiled with -fPIC is not compatible with static-linked miniperl, or miniperl thinking it's statically linked. I suspect that the register for PIC is not either properly set, or the it's using wrong register for PIC access. On Intel machine, the objects compiled with -fPIC links fine with miniperl. Someone with the knowledge of ARM linkage model should be able to at least diag the issue more precisely, or suggest appropriate compile/link options. Another possible work around is to build the perl as statically linked binary and not create libperl.so. -- Tai --20cf30781540855aea04ad94704f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have built miniperl that runs by removing=C2=A0 "-DPIC -fPIC" f= rom the c flags everywhere.
After "make build" fails at minipe= rl core dump, I removed the *.o, and removed "-DPIC -fPIC" from m= ake files, cflags, etc.
Then, I restarted the build in the work/perl-5-12.4 directory with gmake.This builds miniperl that runs.

miniperl crashes regardless of deb= ug or optimized build.
So, this is not a compiler optimization problem.=

From those two, the reason of miniperl core dump may be because the obj= ects compiled with -fPIC is not compatible with static-linked miniperl, or = miniperl thinking it's statically linked.
I suspect that the registe= r for PIC is not either properly set, or the it's using wrong register = for PIC access.

On Intel machine, the objects compiled with -fPIC links fine with minip= erl.

Someone with the knowledge of ARM linkage model should be able = to at least diag the issue more precisely, or suggest appropriate compile/l= ink options.

Another possible work around is to build the perl as statically linked = binary and not create libperl.so.

-- Tai

--20cf30781540855aea04ad94704f-- 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 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: Mon, 12 Dec 2011 16:30:40 -0500 This should be resolved by arm/161128. -- Tai >Unformatted: