Subject: Re: COFF shared libraries
To: Vadim Vygonets <vadik-sh3@vygo.net>
From: Todd Vierling <tv@wasabisystems.com>
List: port-sh3
Date: 01/25/2001 18:34:39
On Fri, 26 Jan 2001, Vadim Vygonets wrote:

: > On Fri, 26 Jan 2001, Vadim Vygonets wrote:
: > BTW, the preferred method for this detection is to pass __ELF__ through the
: > preprocessor and see if it is still __ELF__ (meaning *non*-ELF system).
:
: The one I used (advised by Andrew Doran) was to use a makefile
: which includes <bsd.own.mk> and prints out OBJECT_FMT.

OBJECT_FMT doesn't exist in <bsd.own.mk> on some older NetBSD versions.
Additionally, <bsd.own.mk> is not guaranteed to match what the
compiler-in-use will actually do (and you want this information, as alluded
by your comments about multiple builds for a.out and ELF in the same tree).

The sole source of this information should be the compiler itself; I suggest
using the shellcode from my prior message.

: > The -Wl,-R... option will add -R to the ld command line--note the trailing
: > slash.
:
: Interesting...  It worked for me without the trailing slash,

But won't necessarily work on all systems and versions without it.  I
believe it's required by the old ELF ld.so on pmax, but the memory of that
is ages old.

Anyhow, the ELF detection method above, and the "-Wl,-R/path/to/foo/"
option, are specifically tailored to be guaranteed to work on all NetBSD
systems past and present (and hopefully future).

: > (It will probably work, and be ignored, on static binary systems too.)
:
: Can somebody please check this?  Pleeeze?

Easy to check:  link programs with -static.  On ELF systems (GNU ld), this
works; I can't check a.out systems at the moment.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi NetBSD:  Run with it.
-- NetBSD 1.5 now available on CD-ROM  --  http://www.wasabisystems.com/