Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Apr 2021 10:37:40 +0200 (CEST)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        freebsd-ports@freebsd.org, freebsd-arm@freebsd.org
Subject:   Illegal instruction on new port mongodb49 on arm64
Message-ID:  <1071728798.124.1617266260257@localhost>

next in thread | raw e-mail | index | archive | help
Hi,

I created a new port for mongodb49: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254631
It compiles fine: https://www.klop.ws/mongodb49-4.9.0.r0.log

When I run an application I get "Illegal Instruction" error.

==============================================================
[root@rpi4 /tmp]# lldb /usr/local/bin/mongo
(lldb) target create "/usr/local/bin/mongo"
Current executable set to '/usr/local/bin/mongo' (aarch64).
(lldb) run
Process 55420 launching
Process 55420 launched: '/usr/local/bin/mongo' (aarch64)
Process 55420 stopped
* thread #1, name = 'mongo', stop reason = signal SIGILL: illegal trap
    frame #0: 0x00000000016a320c mongo`___lldb_unnamed_symbol32$$mongo + 1784
mongo`___lldb_unnamed_symbol32$$mongo:
->  0x16a320c <+1784>: ldaddal x9, x8, [x8]
    0x16a3210 <+1788>: ldr    q0, [x11]
    0x16a3214 <+1792>: mov    w10, #0x20
    0x16a3218 <+1796>: strb   wzr, [sp, #0x68]
(lldb) bt
* thread #1, name = 'mongo', stop reason = signal SIGILL: illegal trap
  * frame #0: 0x00000000016a320c mongo`___lldb_unnamed_symbol32$$mongo + 1784
    frame #1: 0x0000000042b29b58
    frame #2: 0x0000000042b289f8

==============================================================
[root@rpi4 /tmp]# /usr/local/bin/mongo
Illegal instruction (core dumped)

[root@rpi4 /tmp]# lldb /usr/local/bin/mongo -c /var/tmp/0.mongo.0.55421.core
(lldb) target create "/usr/local/bin/mongo" --core "/var/tmp/0.mongo.0.55421.core"
Core file '/var/tmp/0.mongo.0.55421.core' (aarch64) was loaded.

(lldb) bt
* thread #1, name = 'mongo', stop reason = signal SIGILL
  * frame #0: 0x00000000016a320c mongo`___lldb_unnamed_symbol32$$mongo + 1784
    frame #1: 0x0000000042b29b58 ld-elf.so.1`objlist_call_init(list=<unavailable>, lockstate=<unavailable>) at rtld.c:2855:7
    frame #2: 0x0000000042b289f8 ld-elf.so.1`_rtld(sp=<unavailable>, exit_proc=<unavailable>, objp=<unavailable>) at rtld.c:828:5
    frame #3: 0x0000000042b264d8 ld-elf.so.1`.rtld_start at rtld_start.S:41

==============================================================

NB: The default of the port uses LTO. I disabled it on my build system because of lack of memory.

Can anybody help me with this?

It would be interesting to know if this also happens on amd64.

Regards,
Ronald.
 
From owner-freebsd-arm@freebsd.org  Thu Apr  1 08:47:57 2021
Return-Path: <owner-freebsd-arm@freebsd.org>
Delivered-To: freebsd-arm@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 933E05C4675;
 Thu,  1 Apr 2021 08:47:57 +0000 (UTC)
 (envelope-from mgorny@gentoo.org)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4F9xf42B5dz3CWK;
 Thu,  1 Apr 2021 08:47:55 +0000 (UTC)
 (envelope-from mgorny@gentoo.org)
Message-ID: <dc54a8d4ee2ca73f41930681348bc9b2a3e89376.camel@gentoo.org>
Subject: Re: Illegal instruction on new port mongodb49 on arm64
From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= <mgorny@gentoo.org>
To: Ronald Klop <ronald-lists@klop.ws>, freebsd-ports@freebsd.org, 
 freebsd-arm@freebsd.org
Date: Thu, 01 Apr 2021 10:47:49 +0200
In-Reply-To: <1071728798.124.1617266260257@localhost>
References: <1071728798.124.1617266260257@localhost>
Organization: Gentoo
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.38.4 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 4F9xf42B5dz3CWK
X-Spamd-Bar: -
Authentication-Results: mx1.freebsd.org; dkim=none;
 dmarc=pass (policy=none) header.from=gentoo.org;
 spf=pass (mx1.freebsd.org: domain of mgorny@gentoo.org designates
 140.211.166.183 as permitted sender) smtp.mailfrom=mgorny@gentoo.org
X-Spamd-Result: default: False [-1.39 / 15.00]; ARC_NA(0.00)[];
 R_MIXED_CHARSET(0.91)[subject];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[];
 R_SPF_ALLOW(-0.20)[+ip4:140.211.166.183];
 MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(1.00)[1.000];
 NEURAL_HAM_LONG(-1.00)[-1.000];
 RWL_MAILSPIKE_GOOD(0.00)[140.211.166.183:from];
 HAS_ORG_HEADER(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[];
 DMARC_POLICY_ALLOW(-0.50)[gentoo.org,none];
 RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[];
 R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+];
 ASN(0.00)[asn:3701, ipnet:140.211.0.0/16, country:US];
 MID_RHS_MATCH_FROM(0.00)[];
 MAILMAN_DEST(0.00)[freebsd-arm,freebsd-ports];
 RCVD_IN_DNSWL_HI(-0.50)[140.211.166.183:from]
X-BeenThere: freebsd-arm@freebsd.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Porting FreeBSD to ARM processors <freebsd-arm.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-arm>,
 <mailto:freebsd-arm-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-arm/>;
List-Post: <mailto:freebsd-arm@freebsd.org>
List-Help: <mailto:freebsd-arm-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-arm>,
 <mailto:freebsd-arm-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Apr 2021 08:47:57 -0000

On Thu, 2021-04-01 at 10:37 +0200, Ronald Klop wrote:
> Hi,
> 
> I created a new port for mongodb49: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254631
> It compiles fine: https://www.klop.ws/mongodb49-4.9.0.r0.log
> 
> When I run an application I get "Illegal Instruction" error.
> 
> ==============================================================
> [root@rpi4 /tmp]# lldb /usr/local/bin/mongo
> (lldb) target create "/usr/local/bin/mongo"
> Current executable set to '/usr/local/bin/mongo' (aarch64).
> (lldb) run
> Process 55420 launching
> Process 55420 launched: '/usr/local/bin/mongo' (aarch64)
> Process 55420 stopped
> * thread #1, name = 'mongo', stop reason = signal SIGILL: illegal trap
>     frame #0: 0x00000000016a320c mongo`___lldb_unnamed_symbol32$$mongo + 1784
> mongo`___lldb_unnamed_symbol32$$mongo:
> ->  0x16a320c <+1784>: ldaddal x9, x8, [x8]

According to [1], this instruction requires ARMv8.1.  If I grep
correctly, rpi4 is ARMv8-A.  Yet you're compiling with -march=armv8.2-a,
so it's a case of wrong -march.

[1] https://developer.arm.com/documentation/100069/0608/A64-Data-Transfer-Instructions/LDADDA--LDADDAL--LDADD--LDADDL--LDADDAL--LDADD--LDADDL

-- 
Best regards,
Michał Górny





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1071728798.124.1617266260257>