1 # Copyright (C) 1995-2013 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 headers
:= bits
/dlfcn.h dlfcn.h
21 libdl-routines
:= dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
23 routines
:= $(patsubst %,s
%,$(filter-out dlfcn
,$(libdl-routines
)))
24 elide-routines.os
:= $(routines
)
26 extra-libs-others
:= libdl
30 ifeq ($(versioning
),yes
)
31 libdl-routines
+= dlopenold
32 libdl-shared-only-routines
:= dlopenold dlfcn
35 ifeq (yes
,$(build-shared
))
36 tests
= glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
37 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
40 modules-names
= glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
41 defaultmod2 errmsg1mod modatexit modcxaatexit \
42 bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
43 bug-atexit2-lib bug-atexit3-lib
45 failtestmod.so-no-z-defs
= yes
46 glreflib2.so-no-z-defs
= yes
47 errmsg1mod.so-no-z-defs
= yes
49 ifeq (yes
,$(build-shared
))
50 tests
+= tststatic tststatic2
51 tests-static
+= tststatic tststatic2
52 modules-names
+= modstatic modstatic2
53 tststatic-ENV
= LD_LIBRARY_PATH
=$(objpfx
):$(common-objpfx
):$(common-objpfx
)elf
54 tststatic2-ENV
= LD_LIBRARY_PATH
=$(objpfx
):$(common-objpfx
):$(common-objpfx
)elf
57 extra-test-objs
+= $(modules-names
:=.os
)
58 generated
:= $(modules-names
:=.so
)
62 test-modules
= $(addprefix $(objpfx
),$(addsuffix .so
,$(modules-names
)))
64 ifeq ($(build-shared
),yes
)
65 # Build all the modules even when not actually running test programs.
66 tests
: $(test-modules
)
69 $(objpfx
)glrefmain
: $(libdl
)
70 $(objpfx
)glrefmain.out
: $(objpfx
)glrefmain \
71 $(objpfx
)glreflib1.so
$(objpfx
)glreflib2.so
73 $(objpfx
)failtest
: $(libdl
)
74 $(objpfx
)failtest.out
: $(objpfx
)failtestmod.so
76 $(objpfx
)tst-dladdr
: $(libdl
)
77 $(objpfx
)tst-dladdr.out
: $(objpfx
)glreflib1.so
79 $(objpfx
)tst-dlinfo
: $(libdl
)
80 $(objpfx
)tst-dlinfo.out
: $(objpfx
)glreflib3.so
81 LDFLAGS-glreflib3.so
= -Wl
,-rpath
,:
83 LDFLAGS-default
= $(LDFLAGS-rdynamic
)
84 $(objpfx
)default
: $(libdl
) $(objpfx
)defaultmod1.so
$(objpfx
)defaultmod2.so
85 $(objpfx
)defaultmod1.so
: $(libdl
)
86 LDFLAGS-defaultmod2.so
= $(LDFLAGS-Bsymbolic
)
87 $(objpfx
)defaultmod2.so
: $(libdl
)
89 $(objpfx
)errmsg1
: $(libdl
)
90 $(objpfx
)errmsg1.out
: $(objpfx
)errmsg1
$(objpfx
)errmsg1mod.so
92 $(objpfx
)tstatexit
: $(libdl
)
93 $(objpfx
)tstatexit.out
: $(objpfx
)tstatexit
$(objpfx
)modatexit.so
95 $(objpfx
)tstcxaatexit
: $(libdl
)
96 $(objpfx
)tstcxaatexit.out
: $(objpfx
)tstcxaatexit
$(objpfx
)modcxaatexit.so
98 $(objpfx
)tststatic
: $(objpfx
)libdl.a
99 $(objpfx
)tststatic.out
: $(objpfx
)tststatic
$(objpfx
)modstatic.so
101 $(objpfx
)tststatic2
: $(objpfx
)libdl.a
102 $(objpfx
)tststatic2.out
: $(objpfx
)tststatic2
$(objpfx
)modstatic.so \
103 $(objpfx
)modstatic2.so
105 $(objpfx
)modstatic2.so
: $(libdl
)
107 $(objpfx
)bug-dlopen1
: $(libdl
)
109 $(objpfx
)bug-dlsym1
: $(libdl
) $(objpfx
)bug-dlsym1-lib2.so
110 $(objpfx
)bug-dlsym1.out
: $(objpfx
)bug-dlsym1-lib1.so \
111 $(objpfx
)bug-dlsym1-lib2.so
112 $(objpfx
)bug-dlsym1-lib1.so
: $(objpfx
)bug-dlsym1-lib2.so
114 $(objpfx
)bug-atexit1
: $(libdl
)
115 $(objpfx
)bug-atexit1.out
: $(objpfx
)bug-atexit1-lib.so
117 $(objpfx
)bug-atexit2
: $(libdl
)
118 $(objpfx
)bug-atexit2.out
: $(objpfx
)bug-atexit2-lib.so
120 LDLIBS-bug-atexit3-lib.so
= -lstdc
++ -lgcc_eh
$(elfobjdir
)/ld.so \
121 $(common-objpfx
)libc_nonshared.a
122 $(objpfx
)bug-atexit3
: $(libdl
)
123 $(objpfx
)bug-atexit3.out
: $(objpfx
)bug-atexit3-lib.so
126 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
127 # This ensures they will load libc.so for needed symbols if loaded by
128 # a statically-linked program that hasn't already loaded it.
129 $(objpfx
)libdl.so
: $(common-objpfx
)libc.so
$(common-objpfx
)libc_nonshared.a \