about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile30
1 files changed, 29 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 81aa217e3d..e029fbafd0 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -75,6 +75,8 @@ others		+= ldconfig
 install-rootsbin += ldconfig
 endif
 
+tests = loadtest
+
 include ../Rules
 
 
@@ -200,6 +202,32 @@ else
 $(objpfx)sprof: $(objpfx)libdl.a
 endif
 
+# This macro is similar to build-shlib but it does not define a soname
+# 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) \
+	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
+	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
+	  -Wl,--whole-archive -Wl,-soname,$(@F) \
+	  $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
+	  $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
+endef
+
+modules-names = testobj1 testobj2 testobj3
+test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
+
+$(objpfx)testobj2.so: $(objpfx)testobj1.so
+LDLIBS-testobj2.so = $(objpfx)testobj1.so
+
+$(test-modules): $(objpfx)%.so: %.c
+	$(build-module)
+
+$(objpfx)loadtest: $(objpfx)libdl.so
+LDFLAGS-loadtest = -rdynamic
+
+$(objpfx)loadtest.out: $(test-modules)
+
 # muwahaha
 
 LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name)