NetBSD Problem Report #52528

From Manuel.Bouyer@lip6.fr  Tue Sep  5 08:51:10 2017
Return-Path: <Manuel.Bouyer@lip6.fr>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5B4487A177
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  5 Sep 2017 08:51:10 +0000 (UTC)
Message-Id: <20170905085004.4043EA936@armandeche.soc.lip6.fr>
Date: Tue,  5 Sep 2017 10:50:04 +0200 (MEST)
From: Manuel.Bouyer@lip6.fr
Reply-To: Manuel.Bouyer@lip6.fr
To: gnats-bugs@NetBSD.org
Subject: CPUFLAGS=-mfpu=neon-vfpv4 breaks some programs
X-Send-Pr-Version: 3.95

>Number:         52528
>Category:       port-arm
>Synopsis:       CPUFLAGS=-mfpu=neon-vfpv4 breaks some programs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 05 08:55:00 +0000 2017
>Originator:     Manuel Bouyer
>Release:        NetBSD 8.0_BETA
>Organization:
>Environment:
System: NetBSD chartplotter 8.0_BETA NetBSD 8.0_BETA (CUBIEBOARD) #0: Fri Sep 1 13:15:30 CEST 2017 bouyer@bop.soc.lip6.fr:/dsk/l1/misc/bouyer/tmp/earmv7hf/obj/dsk/l1/misc/bouyer/netbsd-8/src/sys/arch/evbarm/compile/CUBIEBOARD evbarm
Architecture: earmv7hf
Machine: evbarm
>Description:
	building a release with
	./build.sh -m evbarm -a earmv7hf -V CPUFLAGS="-mfpu=neon-vfpv4" 
	(call this a earmv7hf-neonvfpv4 release) cause some programs to
	fail on the target system.
	Here is an example:
cat > /tmp/conftest.cpp << EOF

//  (C) Copyright John Maddock 2001. 
//  Use, modification and distribution are subject to the 
//  Boost Software License, Version 1.0. (See accompanying file 
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org/libs/config for most recent version.

//  MACRO:         BOOST_NO_EXCEPTIONS
//  TITLE:         exception handling support
//  DESCRIPTION:   The compiler in its current translation mode supports
//                 exception handling.


namespace boost_no_exceptions{

void throw_it(int i)
{
   throw i;
}

int test()
{
   try
   {
      throw_it(2);
   }
   catch(int i)
   {
      return (i == 2) ? 0 : -1;
   }
   catch(...)
   {
      return -1;
   }
   return -1;
}

}
int main(){ return boost_no_exceptions::test(); }
EOF
c++ -o conftest conftest.c

	It doens't matter if the program is built on earmv7hf-neonvfpv4 or
	plain earmv7hf. When run on earmv7hf the program runs as expected,
	on earmv7hf-neonvfpv4 it fails with:
terminate called after throwing an instance of 'int'
terminate called recursively
Abort (core dumped)

	I tracked it down to libc (running on a plain earmv7hf with the
	earmv7hf-neonvfpv4 libc is enough to make it fail), and more
	specifically to libunwind.o in libc: on a earmv7hf-neonvfpv4 system,
c++ -static -o conftest conftest.c
	gives a non-working program, but
c++ -static -o conftest conftest.c libunwind.o
	gives a working one, with libunwind.o extracted from a plain
	earmv7hf libc.a

>How-To-Repeat:
	see above.
>Fix:
	unkown.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.