Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # Copyright (C) 1995-2026 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3. # The GNU C Library is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU Lesser General Public
  5. # License as published by the Free Software Foundation; either
  6. # version 2.1 of the License, or (at your option) any later version.
  7. # The GNU C Library is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. # Lesser General Public License for more details.
  11. # You should have received a copy of the GNU Lesser General Public
  12. # License along with the GNU C Library; if not, see
  13. # <https://www.gnu.org/licenses/>.
  14. subdir := dlfcn
  15. include ../Makeconfig
  16. headers := \
  17. bits/dl_find_object.h \
  18. bits/dlfcn.h \
  19. dlfcn.h \
  20. # headers
  21. extra-libs := libdl
  22. libdl-routines := libdl-compat
  23. routines = \
  24. dladdr \
  25. dladdr1 \
  26. dlclose \
  27. dlerror \
  28. dlinfo \
  29. dlmopen \
  30. dlopen \
  31. dlsym \
  32. dlvsym \
  33. libc_dlerror_result \
  34. # routines
  35. extra-libs-others := libdl
  36. libdl-shared-only-routines += libdl-compat
  37. # Pretend that libdl.so is a linker script, so that the symbolic
  38. # link is not installed.
  39. install-lib-ldscripts = libdl.so
  40. $(inst_libdir)/libdl.so:
  41. ifeq ($(build-shared),yes)
  42. routines += dlopenold
  43. shared-only-routines := dlopenold
  44. endif
  45. ifeq (yes,$(build-shared))
  46. tests = \
  47. bug-atexit1 \
  48. bug-atexit2 \
  49. bug-atexit3 \
  50. bug-dl-leaf \
  51. bug-dlopen1 \
  52. bug-dlsym1 \
  53. default \
  54. errmsg1 \
  55. failtest \
  56. glrefmain \
  57. tst-dladdr \
  58. tst-dlinfo \
  59. tst-rec-dlopen \
  60. tstatexit \
  61. tstcxaatexit \
  62. # tests
  63. endif
  64. modules-names = \
  65. bug-atexit1-lib \
  66. bug-atexit2-lib \
  67. bug-dl-leaf-lib \
  68. bug-dl-leaf-lib-cb \
  69. bug-dlsym1-lib1 \
  70. bug-dlsym1-lib2 \
  71. defaultmod1 \
  72. defaultmod2 \
  73. errmsg1mod \
  74. failtestmod \
  75. glreflib1 \
  76. glreflib2 \
  77. glreflib3 \
  78. modatexit \
  79. modcxaatexit \
  80. moddummy1 \
  81. moddummy2 \
  82. # modules-names
  83. failtestmod.so-no-z-defs = yes
  84. glreflib2.so-no-z-defs = yes
  85. errmsg1mod.so-no-z-defs = yes
  86. ifeq (yes,$(build-shared))
  87. tests += \
  88. tststatic \
  89. tststatic2 \
  90. tststatic3 \
  91. tststatic4 \
  92. tststatic5 \
  93. # tests
  94. tests-static += \
  95. tststatic \
  96. tststatic2 \
  97. tststatic3 \
  98. tststatic4 \
  99. tststatic5 \
  100. # tests-static
  101. modules-names += \
  102. modstatic \
  103. modstatic2 \
  104. modstatic3 \
  105. modstatic5 \
  106. # modules-names
  107. tststatic-ENV = LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf
  108. tststatic2-ENV = $(tststatic-ENV)
  109. tststatic3-ENV = $(tststatic-ENV)
  110. tststatic4-ENV = $(tststatic-ENV)
  111. tststatic5-ENV = $(tststatic-ENV)
  112. tests-internal += \
  113. tst-dlinfo-phdr \
  114. # tests-internal
  115. ifneq (,$(CXX))
  116. modules-names += bug-atexit3-lib
  117. else
  118. tests-unsupported += bug-atexit3
  119. endif
  120. endif
  121. extra-test-objs += $(modules-names:=.os)
  122. generated += $(modules-names:=.so)
  123. include ../Rules
  124. test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
  125. ifeq ($(build-shared),yes)
  126. # Build all the modules even when not actually running test programs.
  127. tests: $(test-modules)
  128. endif
  129. $(objpfx)glrefmain.out: $(objpfx)glrefmain \
  130. $(objpfx)glreflib1.so $(objpfx)glreflib2.so
  131. $(objpfx)failtest.out: $(objpfx)failtestmod.so
  132. $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
  133. $(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so
  134. LDFLAGS-glreflib3.so = -Wl,-rpath,:
  135. LDFLAGS-default = $(LDFLAGS-rdynamic)
  136. $(objpfx)default: $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
  137. LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
  138. $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
  139. $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
  140. $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
  141. $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
  142. $(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
  143. $(objpfx)modstatic2.so
  144. $(objpfx)tststatic3.out: $(objpfx)tststatic3 $(objpfx)modstatic3.so
  145. $(objpfx)tststatic4.out: $(objpfx)tststatic4 $(objpfx)modstatic3.so
  146. $(objpfx)tststatic5.out: $(objpfx)tststatic5 $(objpfx)modstatic5.so
  147. $(objpfx)bug-dlsym1: $(objpfx)bug-dlsym1-lib2.so
  148. $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
  149. $(objpfx)bug-dlsym1-lib2.so
  150. $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so
  151. $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
  152. $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
  153. ifneq (,$(CXX))
  154. LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh
  155. $(objpfx)bug-atexit3-lib.so: $(libsupport)
  156. $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
  157. endif
  158. $(objpfx)bug-dl-leaf: $(objpfx)bug-dl-leaf-lib.so
  159. $(objpfx)bug-dl-leaf.out: $(objpfx)bug-dl-leaf-lib-cb.so
  160. $(objpfx)bug-dl-leaf-lib-cb.so: $(objpfx)bug-dl-leaf-lib.so
  161. $(objpfx)tst-rec-dlopen.out: $(objpfx)moddummy1.so $(objpfx)moddummy2.so