Thread: Re: Reduce dependancies of postmaster (without --as-needed)

Re: Reduce dependancies of postmaster (without --as-needed)

From
Larry Rosenman
Date:
On Nov 28 2005, Tom Lane wrote:

> Larry Rosenman <ler@lerctr.org> writes:
> > -lnsl is needed on SVR4 derivatives, like Solaris and UnixWare. it is
> > the network services library.
>
> > You'll needed it for ANY socket based code on these platforms.
>
> Is there any specific function symbol we can test for in that library?
> If it exports something like socket() or connect() on SVR4, we can make
> configure probe for that instead of blindly including the library.

libsocket requires libnsl:

$ dump -Lv /usr/lib/libsocket.so|more

/usr/lib/libsocket.so:

                ****  DYNAMIC SECTION INFORMATION ****
[INDEX]   Tag         Value

.dynamic:
[1]       NEEDED      /usr/lib/libnsl.so.1
[2]       INIT        0xba30
[3]       SONAME      /usr/lib/libsocket.so.2
[4]       HASH        0xa0
[5]       STRTAB      0x22bc
[6]       SYMTAB      0x95c
[7]       STRSZ       0x1229
[8]       SYMENT      0x10
[9]       PLTGOT      0xec2c
[10]      PLTSZ       0x4b8
[11]      PLTREL      0x11
[12]      JMPREL      0x36d0
[13]      REL         0x34e8
[14]      RELSZ       0x1e8
.....

So, Is there a configure check for stuff like that?

LER

--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611


Re: Reduce dependancies of postmaster (without --as-needed)

From
Tom Lane
Date:
Larry Rosenman <ler@lerctr.org> writes:
>> -lnsl is needed on SVR4 derivatives, like Solaris and UnixWare. it is
>> the network services library.

> libsocket requires libnsl:

> [1]       NEEDED      /usr/lib/libnsl.so.1

Hmmm ... but given that, is it needed to mention libnsl in the link
command at all, or can the linker pick it up implicitly?

            regards, tom lane

Re: Reduce dependancies of postmaster (without --as-needed)

From
Martijn van Oosterhout
Date:
On Mon, Nov 28, 2005 at 05:31:55PM -0500, Tom Lane wrote:
> Larry Rosenman <ler@lerctr.org> writes:
> >> -lnsl is needed on SVR4 derivatives, like Solaris and UnixWare. it is
> >> the network services library.
>
> > libsocket requires libnsl:
>
> > [1]       NEEDED      /usr/lib/libnsl.so.1
>
> Hmmm ... but given that, is it needed to mention libnsl in the link
> command at all, or can the linker pick it up implicitly?

Normal linkers automatically follow any NEEDED entries, that's why they
are there after all. I'm not ruling out bugs in the linker though.
That's why on most systems you can say -lreadline and not worry about
whether it uses curses or termcap.

And in any case, if it's only libsocket it that needs and we don't use
any symbols in it ourselves, then we surely don't need to reference it.
That's purely a dynamic linker issue.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment