This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

a semantic change



The appended patch eliminates the need for a Makefile variable named
libfoo-map when shared library versioning is needed.  Instead,
Makerules knows to use libfoo.map to version libfoo.so.  This is IMO
cleaner semantics.

You can still set libfoo-map to override; elf needs this.

Comments?

zw

p.s. chunks may be offset.

1998-05-15 01:09  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* Makerules (libc-map): Deleted.
	(load-map-file): Set to the appropriate compiler switch, not
	just the file name.  If libfoo-map is not set, look for a
	libfoo.map in the current directory and $(..).
	(map-file): New variable, contains just the mapfile name.
	(build-shlib): Adjust for new value of load-map-file.
	(libc.so): Correct dependencies.

	* extra-lib.mk: Correct shlib dependencies since libfoo-map
	may not be set anymore.

	* elf/Makefile: Set ld-map to $(..)libc.map, not $(libc-map).
	Delete libdl-map.  Tweak ld.so link rule to work with changed
	variable settings in Makerules.
	* iconvdata/Makefile: Tweak build-module to work with changed
	variable settings in Makerules.

	* db/Makefile: Delete libdb-map.
	* hesiod/Makefile: Delete libnss_hesiod-map.
	* linuxthreads/Makefile: Delete libpthread-map.
	* locale/Makefile: Delete libBrokenLocale-map.
	* login/Makefile: Delete libutil-map.
	* math/Makefile: Delete libm-map.
	* md5-crypt/Makefile: Delete libcrypt-map.
	* nis/Makefile: Delete libnsl-map, libnss_nis-map, 
	libnss_nisplus-map, and libnss_compat-map.
	* nss/Makefile: Delete libnss_files-map, libnss_db-map, and
	libnss_ldap-map.
	* resolv/Makefile: Delete libresolv-map and libnss_dns-map.
	* rt/Makefile: Delete librt-map.

Index: Makerules
--- Makerules	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ Makerules	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -325,9 +325,9 @@
 # Reference map file only when versioning is selected and a map file name
 # is given.
 ifeq ($(versioning),yes)
-load-map-file = $($(@F:%.so=%)-map)
-else
-load-map-file =
+map-file = $(firstword $(wildcard \
+		$($(@F:.so=-map)) $(@F:.so=.map) $(..)$(@F:.so=.map)))
+load-map-file = $(map-file:%=-Wl,--version-script=%)
 endif
 
 # Pattern rule to build a shared object from an archive of PIC objects.
@@ -352,12 +346,12 @@
 
 define build-shlib
 $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
-	  -B$(csu-objpfx) $(load-map-file:%=-Wl,--version-script=%) \
+	  -B$(csu-objpfx) $(load-map-file) \
 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
 	  -Wl,--whole-archive \
-	  $(filter-out $($(@F:.so=)-map) $(+preinit) $(+postinit),$^) \
+	  $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
 	  $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
 endef
 
@@ -385,8 +379,6 @@
 LDLIBS-c.so = $(gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
-# We have a versioning file for libc.so.
-libc-map = $(..)libc.map
 # Pre-link the objects of libc_pic.a so that we can locally resolve
 # COMMON symbols before we link against ld.so.  This is because ld.so
 # contains some of libc_pic.a already, which will prevent the COMMONs
@@ -399,7 +391,7 @@
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
 			 $(common-objpfx)libc_pic.os \
 			 $(elfobjdir)/sofini.os $(elfobjdir)/ld.so \
-			 $(libc-map)
+			 $(..)libc.map
 	$(build-shlib)
 common-generated += libc.so libc_pic.os
 ifdef libc.so-version
============================================================
Index: db/Makefile
--- db/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ db/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -19,7 +19,6 @@
 		  mpool \
 		  rec_close rec_delete rec_get rec_open rec_put rec_search \
 		  rec_seq rec_utils
-libdb-map	:= libdb.map
 
 headers		:= db.h mpool.h ndbm.h
 distribute	:= compat.h					\
============================================================
Index: elf/Makefile
--- elf/Makefile	Thu, 14 May 1998 23:51:13 -0400 zack  0.2
+++ elf/Makefile	Fri, 15 May 1998 00:43:50 -0400 zack  Z.4
@@ -35,7 +35,7 @@
 # ld.so uses those routines, plus some special stuff for being the program
 # interpreter and operating independent of libc.
 rtld-routines	:= rtld $(dl-routines) dl-sysdep dl-minimal
-ld-map		= $(libc-map)
+ld-map		= $(..)libc.map
 distribute	= $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
 		  dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
 		  genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
@@ -44,7 +44,6 @@
 extra-libs	 = libdl
 extra-libs-others = $(extra-libs)
 libdl-routines	:= dlopen dlclose dlsym dlvsym dlerror dladdr
-libdl-map	:= libdl.map
 
 before-compile = $(objpfx)trusted-dirs.h $(objpfx)rtldtbl.h
 
@@ -112,14 +111,10 @@
 
 $(objpfx)ld.so: $(objpfx)librtld.os $(addprefix $(objpfx),$(rtld-ldscript)) \
 		$(ld-map)
-	$(rtld-link) -Wl,-soname=$(rtld-installed-name)
-
-define rtld-link
-$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-	  -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
-	  $(filter-out $(rtld-ldscript) $($(@F:.so=)-map),$^) \
-	  $(load-map-file:%=-Wl,--version-script=%)
-endef
+	$(LINK.o) -nostdlib -nostartfiles -shared -o $@		\
+		-Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld)	\
+		$(filter-out $(rtld-ldscript) $(map-file),$^)	\
+		$(load-map-file) -Wl,-soname=$(rtld-installed-name)
 
 # The dl code in the static libc needs a default library path.
 CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
============================================================
Index: extra-lib.mk
--- extra-lib.mk	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ extra-lib.mk	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -50,6 +50,6 @@
 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-$(lib)))
 
 # Add the version script to the dependencies of the shared library.
-$(objpfx)$(lib).so: $($(lib)-map)
+$(objpfx)$(lib).so: $(firstword $(wildcard $($(lib)-map) $(lib).map $(..)$(lib
).map))
 
 endif
============================================================
Index: hesiod/Makefile
--- hesiod/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ hesiod/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -30,7 +30,6 @@
 vpath %.c nss_hesiod
 
 libnss_hesiod-routines	:= hesiod hesiod-grp hesiod-pwd hesiod-service
-libnss_hesiod-map	:= libnss_hesiod.map
 # Build only shared library
 libnss_hesiod-inhibit-o	= $(filter-out .os,$(object-suffixes))
 
============================================================
Index: iconvdata/Makefile
--- iconvdata/Makefile	Thu, 14 May 1998 23:51:13 -0400 zack  0.2
+++ iconvdata/Makefile	Fri, 15 May 1998 00:55:46 -0400 zack  Z.4
@@ -204,11 +205,11 @@
 # and it does not depend on the destination name to start with `lib'.
 define build-module
 $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
-	  -B$(csu-objpfx) $(load-map-file:%=-Wl,--version-script=%) \
+	  -B$(csu-objpfx) $(load-map-file) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
 	  -Wl,--whole-archive \
-	  $(filter-out $($(@F:.so=)-map) $(+preinit) $(+postinit),$^) \
+	  $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
 	  $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
 endef
 
============================================================
Index: linuxthreads/Makefile
--- linuxthreads/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ linuxthreads/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -34,7 +34,6 @@
 libpthread-routines := attr cancel condvar join manager mutex ptfork \
 		       ptlongjmp pthread signals specific errno lockfile \
 		       semaphore spinlock wrapsyscall rwlock
-libpthread-map	:= libpthread.map
 
 include ../Rules
 
============================================================
Index: locale/Makefile
--- locale/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ locale/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -46,7 +46,6 @@
 extra-libs-others = $(extra-libs)
 
 libBrokenLocale-routines = broken_cur_max
-libBrokenLocale-map = libBrokenLocale.map
 
 subdir-dirs	= programs
 vpath %.c programs
============================================================
Index: login/Makefile
--- login/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ login/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -48,7 +48,6 @@
 extra-libs-others := $(extra-libs)
 
 libutil-routines:= login login_tty logout logwtmp openpty forkpty
-libutil-map	:= libutil.map
 
 include ../Rules
 
============================================================
Index: math/Makefile
--- math/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ math/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -36,8 +36,6 @@
 extra-libs	:= libm
 extra-libs-others = $(extra-libs)
 
-libm-map	:= libm.map
-
 libm-support = k_standard s_lib_version s_matherr s_signgam		\
 	       fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg		\
 	       ftestexcept fegetround fesetround fegetenv feholdexcpt	\
============================================================
Index: md5-crypt/Makefile
--- md5-crypt/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ md5-crypt/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -32,7 +32,6 @@
 
 md5-routines := crypt-entry md5-crypt md5
 libcrypt-routines := $(md5-routines)
-libcrypt-map := libcrypt.map
 
 onlymd5-routines := onlymd5-entry md5-crypt md5
 distribute += onlymd5-entry.c
============================================================
Index: nis/Makefile
--- nis/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ nis/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -53,19 +53,15 @@
 		  nis_modify nis_remove nis_add nis_defaults\
 		  nis_findserv nis_callback nis_clone_dir nis_clone_obj\
 		  nis_clone_res
-libnsl-map	= libnsl.map
 
 libnss_compat-routines	:= $(addprefix compat-,grp pwd spwd) nisplus-parser
 libnss_compat-inhibit-o	= $(filter-out .os,$(object-suffixes))
-libnss_compat-map	:= libnss_compat.map
 
 libnss_nis-routines	:= $(addprefix nis-,$(databases))
 libnss_nis-inhibit-o	= $(filter-out .os,$(object-suffixes))
-libnss_nis-map		:= libnss_nis.map
 
 libnss_nisplus-routines	:= $(addprefix nisplus-,$(databases)) nisplus-p
arser
 libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
-libnss_nisplus-map	:= libnss_nisplus.map
 
 include ../Rules
 
============================================================
Index: nss/Makefile
--- nss/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ nss/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -54,19 +54,15 @@
 
 
 libnss_files-routines	:= $(addprefix files-,$(filter-out key, $(databases)))
-libnss_files-map	:= libnss_files.map
 distribute		+= files-XXX.c files-parse.c
 
 libnss_db-routines	:= $(addprefix db-,$(filter-out hosts network key,\
 							$(databases)))
-libnss_db-map		:= libnss_db.map
 generated		+= $(filter-out db-alias.c db-netgrp.c, \
 					$(addsuffix .c,$(libnss_db-routines)))
 distribute		+= db-XXX.c
 
 libnss_ldap-routines	:= $(addprefix ldap-,proto) util ldap-nss
-libnss_ldap-map		:= libnss_ldap.map
-
 
 # Build static module if requested
 ifneq ($(build-static-nss),yes)
============================================================
Index: resolv/Makefile
--- resolv/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.2
+++ resolv/Makefile	Sun, 10 May 1998 21:50:42 -0400 zack  Z.4
@@ -36,13 +36,11 @@
 libresolv-routines := gethnamaddr res_comp res_debug	\
 		      res_data res_mkquery res_query res_send		\
 		      inet_net_ntop inet_net_pton inet_neta base64
-libresolv-map := libresolv.map
 
 subdir-dirs = nss_dns
 vpath %.c nss_dns
 
 libnss_dns-routines	:= dns-host dns-network
-libnss_dns-map		:= libnss_dns.map
 ifneq ($(build-static-nss),yes)
 libnss_dns-inhibit-o	= $(filter-out .os,$(object-suffixes))
 endif
============================================================
Index: rt/Makefile
--- rt/Makefile	Thu, 14 May 1998 23:51:13 -0400 zack  0.2
+++ rt/Makefile	Fri, 15 May 1998 00:43:50 -0400 zack  Z.4
@@ -28,8 +28,6 @@
 		  aio_write64 lio_listio lio_listio64 aio_sigqueue	\
 		  aio_notify
 
-librt-map := librt.map
-
 # Make sure that everything is distributed independent of configuration.
 distribute := aio_misc.h $(librt-routines:=.c) $(librt-map)
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]