From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5064 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Linking musl with ld.gold Date: Tue, 6 May 2014 12:14:10 +0200 Message-ID: <20140506101410.GP12324@port70.net> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1399399496 22030 80.91.229.3 (6 May 2014 18:04:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 May 2014 18:04:56 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5067-gllmg-musl=m.gmane.org@lists.openwall.com Tue May 06 20:04:51 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Whj3E-00008B-Pi for gllmg-musl@plane.gmane.org; Tue, 06 May 2014 19:21:08 +0200 Original-Received: (qmail 30464 invoked by uid 550); 6 May 2014 10:14:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30456 invoked from network); 6 May 2014 10:14:27 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:5064 Archived-At: * Stephen Thomas [2014-05-06 10:07:59 +0100]: > I have come across a problem and it only appears when the gold linker is used. I am using the latest release of binutils, binutils-2.24.51.0.3. > I discovered that busybox was not flushing stdout (as there was no prompt appearing) when using musl. Busybox calls fflush(NULL) which should flush stdout as done in src/stdio/fflush.c. > In that file I checked the value for __stdout_used and it came back as 0. So I changed the declaration of the weak symbol to an extern FILE* __stdout_used and stdout was being flushed. > Has anyone else seen this and have they reported this apparent bug in binutils? i think we only reported a broken tls visibility issue against gold https://sourceware.org/bugzilla/show_bug.cgi?id=16728 you should try to reproduce the bug on a minimal example, eg. the following code works here with gold (binutils 2.22) // a.c struct foo {int i;}; static struct foo *const dummy = 0; extern struct foo *const hasfoo __attribute__((weak, alias("dummy"))); int f(void) { return hasfoo ? hasfoo->i : 0; } // b.c struct foo {int i;}; static struct foo foo = {42}; struct foo *const hasfoo = &foo; // main.c int f(void); int main() { return f(); } gcc main.o a.o -o t1 gcc main.o a.o b.o -o t2 ./t1 returns 0 ./t2 returns 42