From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 16 23:50:38 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5CA5DE2; Mon, 16 Feb 2015 23:50:38 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33EBA3D7; Mon, 16 Feb 2015 23:50:38 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t1GNoWV2073379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Feb 2015 01:50:32 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t1GNoWV2073379 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t1GNoWUr073377; Tue, 17 Feb 2015 01:50:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 17 Feb 2015 01:50:32 +0200 From: Konstantin Belousov To: sbruno@freebsd.org Subject: Re: -current static linking or overlinking ... Message-ID: <20150216235032.GP34251@kib.kiev.ua> References: <54E25342.9060308@ignoranthack.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54E25342.9060308@ignoranthack.me> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2015 23:50:38 -0000 On Mon, Feb 16, 2015 at 12:29:54PM -0800, Sean Bruno wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Building the qemu bsd-user static targets on head seem to be > "overlinking" or something that is pulling in multiple copies of > symbols. I'm not confident in my terminology here so I could be using > the wrong terms. > > This is a recent regression (last couple of months). > > e.g. checkout qemu source, configure with: > ./configure --target-list="i386-bsd-user" --static > > and build with gmake, You'll see a bunch of this at random places where > things are linked statically. I assume "something" has changed in the > toolchain that requires a change to the QEMU build? > > CC stubs/vm-stop.o > CC stubs/vmstate.o > CC stubs/cpus.o > CC stubs/kvm.o > CC stubs/qmp_pc_dimm_device_list.o > AR libqemustub.a > LINK qemu-ga > /usr/lib/libpthread.a(thr_spec.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_sig.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_init.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_rtld.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_fork.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_create.o): warning: multiple common of > `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_exit.o): warning: multiple common of `__cleanup' > /usr/lib/crt1.o: warning: previous common is here > /usr/lib/libpthread.a(thr_error.o): warning: multiple common of > `__cleanup' > /usr/lib/crt1.o: warning: previous common is here This should fix it. You must rebuild the world to test. diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 71fc8df..e4bf4a6 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -271,7 +271,7 @@ void _malloc_first_thread(void); /* * Function to clean up streams, called from abort() and exit(). */ -void (*__cleanup)(void) __hidden; +extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly