Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Elf shared library building (bsd.lib.mk)

3 views
Skip to first unread message

Dale Rahn

unread,
Feb 3, 2000, 3:00:00 AM2/3/00
to te...@openbsd.org
Currently the way that the shared libraries are built for mips is
to have the shared object name (-soname) be the
-soname ib_name.${SHLIB_MAJOR}

This prevents the executable from knowing which minor version
it was linked with. It seems more correct to to be built with
-soname lib_name.${SHLIB_MAJOR}.${SHLIB_MINOR}

Then the shared library loader (ld.so) would have to look for
the appropriate version of the file.

I am currently proposing the following change, so that powerpc will
be able to support shared libraries.

Since it checks for mips first, this will continue working the same
for both mips and all non-powerpc systems. It seems that
instead of the powerpc check this should be checking if the objtype
is elf. for when other platforms wish to support ELF shared libraries.

This is in preparation for integration of an ELF ld.so.

Index: bsd.lib.mk
===================================================================
RCS file: /cvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.20
diff -c -r1.20 bsd.lib.mk
*** bsd.lib.mk 1999/05/26 19:10:28 1.20
--- bsd.lib.mk 2000/02/03 05:28:15
***************
*** 140,157 ****
@${AR} cq lib${LIB}_pic.a `${LORDER} ${SOBJS} | tsort -q`
${RANLIB} lib${LIB}_pic.a

! .if (${MACHINE_ARCH} != "mips")
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
! $(LD) -x -Bshareable -Bforcearchive \
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
.else
! lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.a ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
! $(LD) -x -shared --whole-archive -soname lib${LIB}.so.${SHLIB_MAJOR} \
! -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}.a ${LDADD}
.endif

LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
--- 140,164 ----
@${AR} cq lib${LIB}_pic.a `${LORDER} ${SOBJS} | tsort -q`
${RANLIB} lib${LIB}_pic.a

! .if (${MACHINE_ARCH} == "mips")
! lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}.a ${DPADD}
! @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
! @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
! $(LD) -x -shared --whole-archive -soname lib${LIB}.so.${SHLIB_MAJOR} \
! -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}.a ${LDADD}
! .elif (${MACHINE_ARCH} == "powerpc" )
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
! $(LD) -x -shared --whole-archive \
! -soname lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
.else
! lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD}
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
! $(LD) -x -Bshareable -Bforcearchive \
! -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
.endif

LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
Dale Rahn dr...@advancenet.net

0 new messages