From owner-freebsd-current Tue Nov 5 11:45:32 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E76A237B401 for ; Tue, 5 Nov 2002 11:45:30 -0800 (PST) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 859BC43E42 for ; Tue, 5 Nov 2002 11:45:30 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.12.6/8.12.5) with ESMTP id gA5JjUG8020785; Tue, 5 Nov 2002 11:45:30 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.12.6/8.12.6/Submit) id gA5JjUUi020784; Tue, 5 Nov 2002 11:45:30 -0800 (PST) Date: Tue, 5 Nov 2002 11:45:29 -0800 From: Steve Kargl To: Chad Parry Cc: freebsd-current@FreeBSD.ORG Subject: Re: Hello World stuck in infinite loop Message-ID: <20021105194529.GA23849@troutmask.apl.washington.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Nov 05, 2002 at 11:07:02AM -0800, Chad Parry wrote: > I'm seeing an infinite loop that can be traced to a signal handler in the > uthread module. I'm using a snapshot of CURRENT from 2002-01-09. > > Repro: > Write the classic hello world program. When you build it, link in > libc_r. Use a shell script to execute it over and over in a tight > loop. This works on my box (using zsh): > > # echo 'main() { printf("Hello World!\\n"); }' > hello.c > # gcc -o hello hello.c -lc_r With the -v flag, you find /usr/bin/ld -V -dynamic-linker /usr/libexec/ld-elf.so.1 -o h /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /var/tmp/ccGisSmu.o -lc_r -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o What happens if you use gcc -v -o hello -pthread hello.c /usr/bin/ld -V -dynamic-linker /usr/libexec/ld-elf.so.1 -o h1 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /var/tmp/ccjfgwUn.o -lgcc -lc_r -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o Note the order of the libraries. -- Steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message