support: Free gdb_script_name
[glibc.git] / dlfcn / Makefile
blob994a3afee6ace6ad32d30a3f34d015d5572fe5cc
1 # Copyright (C) 1995-2021 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 # <https://www.gnu.org/licenses/>.
18 subdir := dlfcn
20 include ../Makeconfig
22 headers := bits/dlfcn.h dlfcn.h
23 extra-libs := libdl
24 libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
25 dlmopen dlfcn
26 routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
27 elide-routines.os := $(routines)
28 routines += libc_dlerror_result
30 extra-libs-others := libdl
32 ifeq ($(build-shared),yes)
33 libdl-routines += dlopenold
34 libdl-shared-only-routines := dlopenold dlfcn
35 endif
37 ifeq (yes,$(build-shared))
38 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
39 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
40 bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
41 endif
42 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
43 defaultmod2 errmsg1mod modatexit modcxaatexit \
44 bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
45 bug-atexit2-lib bug-dl-leaf-lib \
46 bug-dl-leaf-lib-cb moddummy1 moddummy2
48 failtestmod.so-no-z-defs = yes
49 glreflib2.so-no-z-defs = yes
50 errmsg1mod.so-no-z-defs = yes
52 ifeq (yes,$(build-shared))
53 tests += tststatic tststatic2 tststatic3 tststatic4 tststatic5
54 tests-static += tststatic tststatic2 tststatic3 tststatic4 tststatic5
55 modules-names += modstatic modstatic2 modstatic3 modstatic5
56 tststatic-ENV = LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf
57 tststatic2-ENV = $(tststatic-ENV)
58 tststatic3-ENV = $(tststatic-ENV)
59 tststatic4-ENV = $(tststatic-ENV)
60 tststatic5-ENV = $(tststatic-ENV)
62 ifneq (,$(CXX))
63 modules-names += bug-atexit3-lib
64 else
65 tests-unsupported += bug-atexit3
66 endif
67 endif
69 extra-test-objs += $(modules-names:=.os)
70 generated += $(modules-names:=.so)
72 include ../Rules
74 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
76 ifeq ($(build-shared),yes)
77 # Build all the modules even when not actually running test programs.
78 tests: $(test-modules)
79 endif
81 $(objpfx)glrefmain: $(libdl)
82 $(objpfx)glrefmain.out: $(objpfx)glrefmain \
83 $(objpfx)glreflib1.so $(objpfx)glreflib2.so
85 $(objpfx)failtest: $(libdl)
86 $(objpfx)failtest.out: $(objpfx)failtestmod.so
88 $(objpfx)tst-dladdr: $(libdl)
89 $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
91 $(objpfx)tst-dlinfo: $(libdl)
92 $(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so
93 LDFLAGS-glreflib3.so = -Wl,-rpath,:
95 LDFLAGS-default = $(LDFLAGS-rdynamic)
96 $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
97 $(objpfx)defaultmod1.so: $(libdl)
98 LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
99 $(objpfx)defaultmod2.so: $(libdl)
101 $(objpfx)errmsg1: $(libdl)
102 $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
104 $(objpfx)tstatexit: $(libdl)
105 $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
107 $(objpfx)tstcxaatexit: $(libdl)
108 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
110 $(objpfx)tststatic: $(objpfx)libdl.a
111 $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
113 $(objpfx)tststatic2: $(objpfx)libdl.a
114 $(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
115 $(objpfx)modstatic2.so
117 $(objpfx)modstatic2.so: $(libdl)
119 $(objpfx)tststatic3: $(objpfx)libdl.a
120 $(objpfx)tststatic3.out: $(objpfx)tststatic3 $(objpfx)modstatic3.so
122 $(objpfx)tststatic4: $(objpfx)libdl.a
123 $(objpfx)tststatic4.out: $(objpfx)tststatic4 $(objpfx)modstatic3.so
125 $(objpfx)tststatic5: $(objpfx)libdl.a
126 $(objpfx)tststatic5.out: $(objpfx)tststatic5 $(objpfx)modstatic5.so
128 $(objpfx)bug-dlopen1: $(libdl)
130 $(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
131 $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
132 $(objpfx)bug-dlsym1-lib2.so
133 $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so
135 $(objpfx)bug-atexit1: $(libdl)
136 $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
138 $(objpfx)bug-atexit2: $(libdl)
139 $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
141 ifneq (,$(CXX))
142 LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh
143 $(objpfx)bug-atexit3-lib.so: $(libsupport)
144 $(objpfx)bug-atexit3: $(libdl)
145 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
146 endif
148 $(objpfx)bug-dl-leaf: $(objpfx)bug-dl-leaf-lib.so
149 $(objpfx)bug-dl-leaf.out: $(objpfx)bug-dl-leaf-lib-cb.so
150 $(objpfx)bug-dl-leaf-lib.so: $(libdl)
151 $(objpfx)bug-dl-leaf-lib-cb.so: $(objpfx)bug-dl-leaf-lib.so
153 $(objpfx)tst-rec-dlopen: $(libdl)
154 $(objpfx)tst-rec-dlopen.out: $(objpfx)moddummy1.so $(objpfx)moddummy2.so