NetBSD Problem Report #54001

From gson@gson.org  Fri Feb 22 09:14:03 2019
Return-Path: <gson@gson.org>
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 E23E37A1AA
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Feb 2019 09:14:02 +0000 (UTC)
Message-Id: <20190222091358.2C84F98A91B@guava.gson.org>
Date: Fri, 22 Feb 2019 11:13:58 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: call_once2_32, call_once2_static test cases failing on amd64 since gcc7 import
X-Send-Pr-Version: 3.95

>Number:         54001
>Category:       lib
>Synopsis:       call_once2_32, call_once2_static test cases failing on amd64 since gcc7 import
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 22 09:15:00 +0000 2019
>Closed-Date:    Wed May 08 12:55:19 +0000 2019
>Last-Modified:  Wed May 08 12:55:19 +0000 2019
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current
>Organization:

>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:

The following test cases are consistently failing for me on real amd64
hardware since the import of GCC 7:

  usr.bin/c++/t_call_once2/call_once2_32
  usr.bin/c++/t_call_once2/call_once2_static

Recent log output is at:

  http://www.gson.org/netbsd/bugs/build/amd64-baremetal/2019/2019.02.21.14.56.23/test.html#usr.bin_c++_t_call_once2_call_once2_32
  http://www.gson.org/netbsd/bugs/build/amd64-baremetal/2019/2019.02.21.14.56.23/test.html#usr.bin_c++_t_call_once2_call_once2_static

They do not fail reliably under qemu, but one failures is recorded at:

  http://releng.netbsd.org/b5reports/amd64/2019/2019.02.20.19.42.14/test.html#usr.bin_c++_t_call_once2_call_once2_static

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-amd64-maintainer->lib-bug-people
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Mon, 06 May 2019 22:07:32 +0000
Responsible-Changed-Why:
You can work around this with -Wl,--whole-archive -lpthread -Wl,--no-whole-archive. it is a problem with libc stubs being used.


From: maya@netbsd.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/54001 (call_once2_32, call_once2_static test cases failing
 on amd64 since gcc7 import)
Date: Mon, 6 May 2019 22:13:23 +0000

 From Jonathan Wakely:
 the solution on red hat and friends is to create libpthread.a as a single large object, with all the symbols in one section. if you use any of 
 them, you get all of them (and not the stubs)
 on other distros, --whole-archive achieves the same thing

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/54001: call_once2_32, call_once2_static test cases failing
 on amd64 since gcc7 import
Date: Tue, 7 May 2019 17:45:25 +0000

 So, this patch works...

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/src/lib/libpthread/Makefile,v
 retrieving revision 1.92
 diff -u -r1.92 Makefile
 --- Makefile	24 Apr 2019 11:43:19 -0000	1.92
 +++ Makefile	7 May 2019 17:45:12 -0000
 @@ -269,6 +269,14 @@

  INCS+=		threads.h

 +__archivebuild: .USE
 +	${_MKTARGET_BUILD}
 +	@rm -f ${.TARGET}
 +	${LD} -r -o ${.TARGET}.o `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
 +	${AR} ${_ARFL} ${.TARGET} ${.TARGET}.o
 +
 +CLEANFILES+=	${.TARGET}.o
 +
  .include <bsd.lib.mk>

  .else

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54001 CVS commit: src/lib/libpthread
Date: Tue, 7 May 2019 18:12:54 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Tue May  7 18:12:53 UTC 2019

 Modified Files:
 	src/lib/libpthread: Makefile

 Log Message:
 Replace the link command for libpthread.a so that we create a single section
 with all the libpthread symbols in it.
 This makes -lpthread behave like to -Wl,--whole-archive -lpthread.

 This avoids a situation where threaded static binaries use some libc thread
 stubs, which are racy.

 Fixes PR lib/54001: call_once2_32, call_once2_static test cases failing on
 amd64 since gcc7 import.

 Suggested by Jonathan Wakely, thanks!


 To generate a diff of this commit:
 cvs rdiff -u -r1.92 -r1.93 src/lib/libpthread/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Wed, 08 May 2019 12:55:19 +0000
State-Changed-Why:
Fixed by maya, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.