Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 1995 18:27:45 -0700
From:      Nate Williams <nate@rocky.sri.MT.net>
To:        "Marc G. Fournier" <scrappy@hub.org>
Cc:        freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: Shared Libraries...almost there...
Message-ID:  <199511170127.SAA10855@rocky.sri.MT.net>
In-Reply-To: <Pine.BSF.3.91.951116195056.6449c-100000@hub.org>
References:  <Pine.BSF.3.91.951116195056.6449c-100000@hub.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Marc G. Fournier writes:
> 
> Hi...
> 
> 	Well, I've finally got it down to the point that I have
> to compile with -fpic, and then link with "ld -Bshareable" to create
> a shared library...but it doesn't look right...
> 
> 	Looking at /usr/share/mk/bsd.lib.mk, I'm supposed to be using
> "shlib_version" to get major/minor numbers for the libraries I create,
> but I can't find that.  And, the shared library I created is over 3x
> the size of the original ncurses shared library that comes with the 
> system...so I screwed up somewhere :(

Look /usr/share/mk/bsd.lib.mk and note the ld commands.  These are used
to 'strip' out un-necessary (And some necessary according to Bruce)
symbols out of the resulting .o files.

.cc.so .C.so:
        ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
        @${LD} -x -r ${.TARGET}
        @mv a.out ${.TARGET}

So, if you use a .c.o target that is similar and add the 'ld -x -r' to
the resulting .o I suspect your library will also be smaller.



Nate



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