Subject: Re: gcc -nostdlib and shared libs
To: Cherry G. Mathew <>
From: Todd Vierling <>
List: tech-toolchain
Date: 03/14/2005 20:43:22
On Tue, 15 Mar 2005, Cherry G. Mathew wrote:

> > > I'm trying to get an elf binary with .dynamic and friends available
> > > and _DYNAMIC defined properly. ( Essentially a shared obj. ) It looks
> > > like doing LDFLAGS +=  -nostdlib makes linking static.

BTW, on NetBSD, -nostdlib should not cause "static" linking.  However:

> > Why does -shared (without -nostdlib) not work for you?
> It won't work for boot code. The dynamic relocator code within the
> boot code walks through the .dynamic section to resolve run-time
> linking.

If you're going this low-level route, you may want to consider invoking ld
directly, with -shared.

-- Todd Vierling <> <>