]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use existing makefile variables for dependencies on glibc libraries.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 16 May 2014 21:38:08 +0000 (21:38 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 16 May 2014 21:38:08 +0000 (21:38 +0000)
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).

In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree.  This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles).  (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so.  But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)

To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files.  This patch just deals with straightforward cases
where such variables already exist.

It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries.  I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).

Tested x86_64.

* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so.  Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.

ChangeLog
benchtests/Makefile
elf/Makefile
malloc/Makefile
math/Makefile
misc/Makefile
nptl/Makefile
setjmp/Makefile
stdio-common/Makefile
stdlib/Makefile

index 91e3a4669e2b2db7ac1b46637d13e1b348aa5296..6a6881d85eae2c8ea3c8bc36296becd5ce377f16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2014-05-16  Joseph Myers  <joseph@codesourcery.com>
+
+       * benchtests/Makefile
+       ($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
+       not $(common-objpfx)math/libm.so.
+       ($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
+       $(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
+       * elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
+       $(common-objpfx)dlfcn/libdl.so.
+       ($(objpfx)tst-audit8): Depend on $(libm), not
+       $(common-objpfx)math/libm.so.
+       * malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
+       not $(common-objpfx)dlfcn/libdl.so.
+       * math/Makefile
+       ($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
+       Depend on $(libm), not $(objpfx)libm.so.  Do not condition on
+       [$(build-shared) = yes].
+       ($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
+       $(common-objpfx)nptl/libpthread.so.
+       * misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
+       $(common-objpfx)math/libm.so$(libm.so-version) or
+       $(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
+       * nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
+       $(common-objpfx)dlfcn/libdl.so.
+       * setjmp/Makefile (link-libm): Remove variable.
+       ($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
+       * stdio-common/Makefile (link-libm): Remove variable.
+       ($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
+       * stdlib/Makefile (link-libm): Remove variable.
+       ($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
+       ($(objpfx)tst-strtod-round): Likewise.
+       ($(objpfx)tst-tininess): Likewise.
+       ($(objpfx)tst-strtod-underflow): Likewise.
+       ($(objpfx)tst-strtod6): Likewise.
+       ($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
+       $(libdl), not $(common-objpfx)nptl/libpthread.so and
+       $(common-objpfx)dlfcn/libdl.so.
+
 2014-05-16  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]: Guard
index a0954cdbc743af7dec47756e87c45b6139053266..63a5a7fd6b7d94fcba1208a42fb9da316aa8e6bf 100644 (file)
@@ -44,9 +44,8 @@ benchset := $(string-bench-all) $(stdlib-bench)
 CFLAGS-bench-ffs.c += -fno-builtin
 CFLAGS-bench-ffsll.c += -fno-builtin
 
-$(addprefix $(objpfx)bench-,$(bench-math)): $(common-objpfx)math/libm.so
-$(addprefix $(objpfx)bench-,$(bench-pthread)): \
-       $(common-objpfx)nptl/libpthread.so
+$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
+$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
 
 \f
 
index 084abcaf2cc3d961e7d18a5889f3f9204a7b65a6..4dcc78a163fc4b1837836297f2d4727d048df743 100644 (file)
@@ -653,7 +653,7 @@ $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
 
-$(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
+$(objpfx)noload: $(objpfx)testobj1.so $(libdl)
 LDFLAGS-noload = -rdynamic $(no-as-needed)
 $(objpfx)noload.out: $(objpfx)testobj5.so
 
@@ -1011,7 +1011,7 @@ $(objpfx)tst-audit9: $(libdl)
 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
 
-$(objpfx)tst-audit8: $(common-objpfx)math/libm.so
+$(objpfx)tst-audit8: $(libm)
 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
index d962331e121383a876f5a302358e0551261a1ed0..7a716f983fd527a83b43f6790ec0dea044dbe033 100644 (file)
@@ -148,7 +148,7 @@ $(objpfx)memusage: memusage.sh
 
 
 # The implementation uses `dlsym'
-$(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so
+$(objpfx)libmemusage.so: $(libdl)
 
 # Extra dependencies
 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
index c13ca80cf8ab6a43066c686cfc20b633e7e36c81..f337a0ef54cb38b8be8c92143114b60b0f39ec86 100644 (file)
@@ -219,12 +219,8 @@ $(objpfx)libieee.a: $(objpfx)ieee-math.o
        $(patsubst %/,cd % &&,$(objpfx)) \
        $(LN_S) $(<F) $(@F)
 
-ifeq ($(build-shared),yes)
-$(addprefix $(objpfx),$(filter-out $(tests-static),$(tests))): $(objpfx)libm.so$(libm.so-version)
+$(addprefix $(objpfx),$(filter-out $(tests-static),$(tests))): $(libm)
 $(addprefix $(objpfx),$(tests-static)): $(objpfx)libm.a
-else
-$(addprefix $(objpfx),$(tests)): $(objpfx)libm.a
-endif
 
 gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%.o,\
                      add_n sub_n cmp addmul_1 mul_1 mul_n divmod_1 \
@@ -233,4 +229,4 @@ gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%.o,\
 $(objpfx)atest-exp: $(gmp-objs)
 $(objpfx)atest-sincos: $(gmp-objs)
 $(objpfx)atest-exp2: $(gmp-objs)
-$(objpfx)test-fenv-tls: $(common-objpfx)nptl/libpthread.so
+$(objpfx)test-fenv-tls: $(shared-thread-library)
index 53d4c2ce440f5aca918e561600a0d3bf3701c8b3..edac24cfc27bbf1ca5bacdd1511f367b473c9097 100644 (file)
@@ -102,11 +102,7 @@ include ../Rules
 
 $(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
 
-ifeq ($(build-shared),yes)
-$(objpfx)tst-tsearch: $(common-objpfx)math/libm.so$(libm.so-version)
-else
-$(objpfx)tst-tsearch: $(common-objpfx)math/libm.a
-endif
+$(objpfx)tst-tsearch: $(libm)
 
 tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace
 tst-error1-ARGS = $(objpfx)tst-error1.out
index 287622475d66dec1493e6c530c39a2923d131e13..7551406cfbe066e806c4390813f27a4b799f2921 100644 (file)
@@ -530,7 +530,7 @@ $(addprefix $(objpfx), \
     $(tests-nolibpthread), \
     $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
                                       $(objpfx)libpthread_nonshared.a
-$(objpfx)tst-unload: $(common-objpfx)dlfcn/libdl.so
+$(objpfx)tst-unload: $(libdl)
 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
 # since otherwise libpthread.so comes before libc.so when linking.
 $(addprefix $(objpfx), $(tests-reverse)): \
index fe0fb5dc6d5ae6e2696cf309004a9484e028f38e..047b9ec9f2d6e3e5ad23deeb2fb1631d19653fdc 100644 (file)
@@ -33,9 +33,4 @@ tests         := tst-setjmp jmpbug bug269-setjmp tst-setjmp-fp \
 
 include ../Rules
 
-ifeq ($(build-shared),yes)
-link-libm = $(common-objpfx)math/libm.so
-else
-link-libm = $(common-objpfx)math/libm.a
-endif
-$(objpfx)tst-setjmp-fp: $(link-libm)
+$(objpfx)tst-setjmp-fp: $(libm)
index 332f205bcfca0ab9b56fe8f08268b5ebe753201d..f179eab50876907fc0f0c4191a8d4075f37fecc2 100644 (file)
@@ -137,9 +137,4 @@ $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
        cmp $^ > $@; \
        $(evaluate-test)
 
-ifeq ($(build-shared),yes)
-link-libm = $(common-objpfx)math/libm.so
-else
-link-libm = $(common-objpfx)math/libm.a
-endif
-$(objpfx)tst-printf-round: $(link-libm)
+$(objpfx)tst-printf-round: $(libm)
index 42482a2a6c2cdae8ab9f94a97c1ae37cf321ea1f..d7a562f6dc21422e0aca77b81f2748b45db04204 100644 (file)
@@ -150,19 +150,13 @@ $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
        $(build-module)
 CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
 
-ifeq ($(build-shared),yes)
-link-libm = $(common-objpfx)math/libm.so
-else
-link-libm = $(common-objpfx)math/libm.a
-endif
-$(objpfx)bug-getcontext: $(link-libm)
-$(objpfx)tst-strtod-round: $(link-libm)
-$(objpfx)tst-tininess: $(link-libm)
-$(objpfx)tst-strtod-underflow: $(link-libm)
-$(objpfx)tst-strtod6: $(link-libm)
+$(objpfx)bug-getcontext: $(libm)
+$(objpfx)tst-strtod-round: $(libm)
+$(objpfx)tst-tininess: $(libm)
+$(objpfx)tst-strtod-underflow: $(libm)
+$(objpfx)tst-strtod6: $(libm)
 
 tst-tls-atexit-lib.so-no-z-defs = yes
 
-$(objpfx)tst-tls-atexit: $(common-objpfx)nptl/libpthread.so \
-                        $(common-objpfx)dlfcn/libdl.so
+$(objpfx)tst-tls-atexit: $(shared-thread-library) $(libdl)
 $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so