Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Nov 2002 11:45:29 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Chad Parry <chad@isilon.com>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Hello World stuck in infinite loop
Message-ID:  <20021105194529.GA23849@troutmask.apl.washington.edu>
In-Reply-To: <Pine.BSF.4.21.0211051103540.55960-200000@isilon.com>
References:  <Pine.BSF.4.21.0211051103540.55960-200000@isilon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021105194529.GA23849>