| 1 | # Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
|
|---|
| 2 | # This file is part of the GNU C Library.
|
|---|
| 3 |
|
|---|
| 4 | # The GNU C Library is free software; you can redistribute it and/or
|
|---|
| 5 | # modify it under the terms of the GNU Lesser General Public
|
|---|
| 6 | # License as published by the Free Software Foundation; either
|
|---|
| 7 | # version 2.1 of the License, or (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | # The GNU C Library is distributed in the hope that it will be useful,
|
|---|
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 12 | # Lesser General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | # You should have received a copy of the GNU Lesser General Public
|
|---|
| 15 | # License along with the GNU C Library; if not, write to the Free
|
|---|
| 16 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 17 | # 02111-1307 USA.
|
|---|
| 18 |
|
|---|
| 19 | subdir := dlfcn
|
|---|
| 20 | headers := bits/dlfcn.h dlfcn.h
|
|---|
| 21 | extra-libs := libdl
|
|---|
| 22 | libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
|
|---|
| 23 | dlmopen dlfcn
|
|---|
| 24 | routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
|
|---|
| 25 | elide-routines.os := $(routines)
|
|---|
| 26 | distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \
|
|---|
| 27 | defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \
|
|---|
| 28 | modcxaatexit.c modstatic.c modstatic2.c \
|
|---|
| 29 | bug-dlsym1-lib1.c bug-dlsym1-lib2.c
|
|---|
| 30 |
|
|---|
| 31 | extra-libs-others := libdl
|
|---|
| 32 |
|
|---|
| 33 | include ../Makeconfig
|
|---|
| 34 |
|
|---|
| 35 | ifeq ($(versioning),yes)
|
|---|
| 36 | libdl-routines += dlopenold
|
|---|
| 37 | libdl-shared-only-routines := dlopenold dlfcn
|
|---|
| 38 | endif
|
|---|
| 39 |
|
|---|
| 40 | ifeq (yes,$(build-shared))
|
|---|
| 41 | tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
|
|---|
| 42 | bug-dlopen1 bug-dlsym1 tst-dlinfo
|
|---|
| 43 | ifeq (yes,$(have-protected))
|
|---|
| 44 | tests += tstatexit
|
|---|
| 45 | endif
|
|---|
| 46 | endif
|
|---|
| 47 | modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
|
|---|
| 48 | errmsg1mod modatexit modcxaatexit \
|
|---|
| 49 | bug-dlsym1-lib1 bug-dlsym1-lib2
|
|---|
| 50 |
|
|---|
| 51 | failtestmod.so-no-z-defs = yes
|
|---|
| 52 | glreflib2.so-no-z-defs = yes
|
|---|
| 53 | errmsg1mod.so-no-z-defs = yes
|
|---|
| 54 |
|
|---|
| 55 | ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
|
|---|
| 56 | tests += tststatic tststatic2
|
|---|
| 57 | tests-static += tststatic tststatic2
|
|---|
| 58 | modules-names += modstatic modstatic2
|
|---|
| 59 | tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
|
|---|
| 60 | tststatic2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
|
|---|
| 61 | endif
|
|---|
| 62 |
|
|---|
| 63 | extra-objs += $(modules-names:=.os)
|
|---|
| 64 | generated := $(modules-names:=.so)
|
|---|
| 65 |
|
|---|
| 66 | include ../Rules
|
|---|
| 67 |
|
|---|
| 68 | test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
|
|---|
| 69 | $(test-modules): $(objpfx)%.so: $(objpfx)%.os $(common-objpfx)shlib.lds
|
|---|
| 70 | $(build-module)
|
|---|
| 71 |
|
|---|
| 72 | ifeq ($(build-shared),yes)
|
|---|
| 73 | # Build all the modules even when not actually running test programs.
|
|---|
| 74 | tests: $(test-modules)
|
|---|
| 75 | endif
|
|---|
| 76 |
|
|---|
| 77 | $(objpfx)glrefmain: $(libdl)
|
|---|
| 78 | $(objpfx)glrefmain.out: $(objpfx)glrefmain \
|
|---|
| 79 | $(objpfx)glreflib1.so $(objpfx)glreflib2.so
|
|---|
| 80 |
|
|---|
| 81 | $(objpfx)failtest: $(libdl)
|
|---|
| 82 | $(objpfx)failtest.out: $(objpfx)failtestmod.so
|
|---|
| 83 |
|
|---|
| 84 | $(objpfx)tst-dladdr: $(libdl)
|
|---|
| 85 | $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
|
|---|
| 86 |
|
|---|
| 87 | $(objpfx)tst-dlinfo: $(libdl)
|
|---|
| 88 | $(objpfx)tst-dlinfo.out: $(objpfx)glreflib1.so
|
|---|
| 89 |
|
|---|
| 90 | LDFLAGS-default = $(LDFLAGS-rdynamic)
|
|---|
| 91 | $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
|
|---|
| 92 | $(objpfx)defaultmod1.so: $(libdl) $(common-objpfx)libc_nonshared.a
|
|---|
| 93 | LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
|
|---|
| 94 | $(objpfx)defaultmod2.so: $(libdl) $(common-objpfx)libc_nonshared.a
|
|---|
| 95 |
|
|---|
| 96 | $(objpfx)errmsg1: $(libdl)
|
|---|
| 97 | $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
|
|---|
| 98 |
|
|---|
| 99 | $(objpfx)tstatexit: $(libdl)
|
|---|
| 100 | $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
|
|---|
| 101 |
|
|---|
| 102 | $(objpfx)tstcxaatexit: $(libdl)
|
|---|
| 103 | $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
|
|---|
| 104 |
|
|---|
| 105 | $(objpfx)modatexit.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
|
|---|
| 106 |
|
|---|
| 107 | $(objpfx)tststatic: $(objpfx)libdl.a
|
|---|
| 108 | $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
|
|---|
| 109 |
|
|---|
| 110 | $(objpfx)tststatic2: $(objpfx)libdl.a
|
|---|
| 111 | $(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
|
|---|
| 112 | $(objpfx)modstatic2.so
|
|---|
| 113 |
|
|---|
| 114 | $(objpfx)modstatic2.so: $(libdl) $(common-objpfx)libc.so \
|
|---|
| 115 | $(common-objpfx)libc_nonshared.a
|
|---|
| 116 |
|
|---|
| 117 | $(objpfx)bug-dlopen1: $(libdl)
|
|---|
| 118 |
|
|---|
| 119 | $(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
|
|---|
| 120 | $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
|
|---|
| 121 | $(objpfx)bug-dlsym1-lib2.so
|
|---|
| 122 | $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so \
|
|---|
| 123 | $(common-objpfx)libc.so \
|
|---|
| 124 | $(common-objpfx)libc_nonshared.a
|
|---|
| 125 | $(objpfx)bug-dlsym1-lib2.so: $(common-objpfx)libc.so \
|
|---|
| 126 | $(common-objpfx)libc_nonshared.a
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
|---|
| 131 | # This ensures they will load libc.so for needed symbols if loaded by
|
|---|
| 132 | # a statically-linked program that hasn't already loaded it.
|
|---|
| 133 | $(objpfx)libdl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
|
|---|
| 134 | $(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)
|
|---|