-# Copyright (C) 1995-2012 Free Software Foundation, Inc.
+# Copyright (C) 1995-2015 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
subdir := elf
+include ../Makeconfig
+
headers = elf.h bits/elfclass.h link.h bits/link.h
-routines = $(dl-routines) dl-support dl-iteratephdr \
+routines = $(all-dl-routines) dl-support dl-iteratephdr \
dl-addr enbl-secure dl-profstub \
dl-origin dl-libc dl-sym dl-tsd dl-sysdep
# The core dynamic linking functions are in libc for the static and
# profiled libraries.
-dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
+dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \
runtime error init fini debug misc \
version profile conflict tls origin scope \
execstack caller open close trampoline)
+ifeq (yes,$(use-ldconfig))
+dl-routines += dl-cache
+endif
all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
# But they are absent from the shared libc, because that code is in ld.so.
elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
# ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc.
-rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
+rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal
all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
-include ../Makeconfig
-
ifeq ($(unwind-find-fde),yes)
routines += unwind-dw2-fde-glibc
shared-only-routines += unwind-dw2-fde-glibc
endif
-before-compile = $(objpfx)trusted-dirs.h
-generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
-generated-dirs := for-renamed
+before-compile += $(objpfx)trusted-dirs.h
+generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
+generated-dirs += for-renamed
-ifeq ($(versioning),yes)
+ifeq ($(build-shared),yes)
ld-map = $(common-objpfx)ld.map
endif
ifeq (yes,$(build-shared))
extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
generated += librtld.os dl-allobjs.os ld.so ldd
-install-others = $(inst_slibdir)/$(rtld-installed-name)
+install-others = $(inst_rtlddir)/$(rtld-installed-name)
install-bin-script = ldd
endif
-others = sprof sln pldd
-install-bin = sprof pldd
+others = sprof sln
+install-bin = sprof
others-static = sln
install-rootsbin = sln
+sln-modules := static-stubs
+extra-objs += $(sln-modules:=.o)
ifeq (yes,$(use-ldconfig))
ifeq (yes,$(build-shared))
others += ldconfig
install-rootsbin += ldconfig
-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
+ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
extra-objs += $(ldconfig-modules:=.o)
-
-pldd-modules := xmalloc
+endif
+endif
# To find xmalloc.c and xstrdup.c
vpath %.c ../locale/programs
-endif
-endif
-
-ifeq ($(have-ksh)$(build-shared),yesyes)
+ifeq ($(build-shared),yes)
extra-objs += sotruss-lib.os sotruss-lib.so
install-others += $(inst_auditdir)/sotruss-lib.so
install-bin-script += sotruss
generated += sotruss
-CPPFLAGS-sotruss-lib = -DNOT_IN_libc
+libof-sotruss-lib = extramodules
$(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
$(build-module-asneeded)
$(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
$(common-objpfx)libc_nonshared.a
-$(objpfx)sotruss: sotruss.ksh $(common-objpfx)config.make
- sed -e 's%@KSH@%$(KSH)%g' \
+$(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
+ sed -e 's%@BASH@%$(BASH)%g' \
-e 's%@VERSION@%$(version)%g' \
-e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
- -e 's%@PREFIX@%$(prefix)%g' < $< > $@.new
+ -e 's%@PREFIX@%$(prefix)%g' \
+ -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
+ -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
+ < $< > $@.new
chmod 555 $@.new
mv -f $@.new $@
$(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
$(do-install-program)
endif
-tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
-ifeq (yes,$(have-initfini-array))
-tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
-endif
-tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
+tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
+ tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
+ tst-auxv
+tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
+ tst-leaks1-static tst-array1-static tst-array5-static \
+ tst-ptrguard1-static tst-dl-iter-static \
+ tst-tlsalign-static tst-tlsalign-extern-static
ifeq (yes,$(build-shared))
tests-static += tst-tls9-static
tst-tls9-static-ENV = \
LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
endif
-ifeq (yes,$(have-initfini-array))
-tests-static += tst-array1-static tst-array5-static
-endif
tests += $(tests-static)
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
- constload1 order vismain noload filter unload \
+ constload1 order noload filter unload \
reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
nodlopen nodlopen2 neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
tst-dlmodcount tst-dlopenrpath tst-deep1 \
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
- tst-audit1 tst-audit2 \
+ tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
tst-stackguard1 tst-addr1 tst-thrlock \
- tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
- tst-initorder tst-initorder2 tst-relsort1
+ tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4) \
+ tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
+ tst-ptrguard1 tst-tlsalign tst-tlsalign-extern
# reldep9
+ifeq ($(build-hardcoded-path-in-tests),yes)
+tests += tst-dlopen-aout
+LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
+endif
test-srcs = tst-pathopt
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
ifneq ($(selinux-enabled),1)
tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
endif
-ifeq (x86_64,$(config-machine))
-tests += tst-audit3 tst-audit4 tst-audit5
-ifeq (yes,$(config-cflags-avx))
-tests += tst-audit6 tst-audit7
-endif
-endif
endif
-ifeq ($(cross-compiling),no)
-tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-leaks1-mem.out \
+ $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out
endif
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
order2mod1 order2mod2 order2mod3 order2mod4 \
tst-unique1mod1 tst-unique1mod2 \
tst-unique2mod1 tst-unique2mod2 \
- tst-unique3lib tst-unique3lib2 \
- tst-unique4lib \
+ tst-auditmod9a tst-auditmod9b \
+ $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib) \
tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \
tst-initorder2a tst-initorder2b tst-initorder2c \
tst-initorder2d \
- tst-relsort1mod1 tst-relsort1mod2
-ifeq (yes,$(have-initfini-array))
-modules-names += tst-array2dep tst-array5dep
+ tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
+ tst-array5dep tst-null-argv-lib \
+ tst-tlsalign-lib
+ifeq (yes,$(have-protected-data))
+modules-names += tst-protected1moda tst-protected1modb
+tests += tst-protected1a tst-protected1b
+$(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
+$(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
+tst-protected1modb.so-no-z-defs = yes
endif
ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
-tests += tst-pie1
-tests-pie += tst-pie1
-endif
-ifeq (x86_64,$(config-machine))
-modules-names += tst-auditmod3a tst-auditmod3b \
- tst-auditmod4a tst-auditmod4b \
- tst-auditmod5a tst-auditmod5b \
- tst-auditmod6a tst-auditmod6b tst-auditmod6c \
- tst-auditmod7a tst-auditmod7b
+tests += tst-pie1 tst-pie2
+tests-pie += tst-pie1 tst-pie2
+tests += vismain
+tests-pie += vismain
+CFLAGS-vismain.c = $(PIE-ccflag)
endif
modules-execstack-yes = tst-execstack-mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
endif
endif
+ifeq (yes,$(build-shared))
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
+endif
+tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
+ $(objpfx)check-localplt.out
+endif
-include ../Rules
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
+ $(objpfx)tst-array1-static-cmp.out \
+ $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
+ $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
+ $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
+ $(objpfx)tst-initorder-cmp.out \
+ $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
+ $(objpfx)tst-unused-dep-cmp.out
+endif
-check-abi: check-abi-ld
+check-abi: $(objpfx)check-abi-ld.out
+tests-special += $(objpfx)check-abi-ld.out
update-abi: update-abi-ld
+include ../Rules
+
ifeq (yes,$(build-shared))
# Make sure these things are built in the `make lib' pass so they can be used
# to run programs during the `make others' pass.
z-now-yes = -Wl,-z,now
$(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
- $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
+# Link into a temporary file so that we don't touch $@ at all
+# if the sanity check below fails.
+ $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
$(filter-out $(map-file),$^) $(load-map-file) \
-Wl,-soname=$(rtld-installed-name) \
-Wl,-defsym=_begin=0
- readelf -s $@ \
+ $(call after-link,$@.new)
+ $(READELF) -s $@.new \
| $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
+ mv -f $@.new $@
-# interp.c exists just to get this string into the libraries.
-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
- -DNOT_IN_libc=1
-$(objpfx)interp.os: $(common-objpfx)config.make
+ifeq (yes,$(build-shared))
+# interp.c exists just to get the runtime linker path into libc.so.
+$(objpfx)interp.os: $(common-objpfx)runtime-linker.h
+endif
ifneq (ld.so,$(rtld-installed-name))
# Make sure ld.so.1 exists in the build directory so we can link
$(make-target-directory)
$(do-install-program)
-$(inst_slibdir)/$(rtld-installed-name): \
+$(inst_rtlddir)/$(rtld-installed-name): \
$(inst_slibdir)/$(rtld-version-installed-name) \
$(inst_slibdir)/libc-$(version).so
+ $(make-target-directory)
$(make-shlib-link)
# Special target called by parent to install just the dynamic linker.
.PHONY: ldso_install
-ldso_install: $(inst_slibdir)/$(rtld-installed-name)
+ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
endif
-common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
- -e 's%@VERSION@%$(version)%g'
-sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
-bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
- -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
-
-ifneq ($(have-bash2),yes)
-ldd-shell = sh
-else
-ldd-shell = bash
-endif
+ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
+ -e 's%@VERSION@%$(version)%g' \
+ -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
+ -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
+ -e 's%@BASH@%$(BASH)%g' \
+ -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
ifeq ($(ldd-rewrite-script),no)
define gen-ldd
-LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
+LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
endef
else
define gen-ldd
-LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< \
+LC_ALL=C sed $(ldd-rewrite) < $< \
| LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
endef
endif
$(objpfx)sprof: $(libdl)
-$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
-$(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
+$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
- -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
+ -D'SLIBDIR="$(slibdir)"'
+libof-ldconfig = ldconfig
CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
CFLAGS-cache.c = $(SYSCONF-FLAGS)
CFLAGS-rtld.c = $(SYSCONF-FLAGS)
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
+cpp-srcs-left := $(all-rtld-routines:=.os)
+lib := rtld
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
generated += $(addsuffix .so,$(strip $(modules-names)))
-ifeq (yes,$(build-shared))
-ifeq ($(cross-compiling),no)
-tests: $(objpfx)tst-pathopt.out
-endif
-endif
-
$(objpfx)testobj1.so: $(libdl)
$(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
$(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
-
-LDFLAGS-tst-tlsmod5.so = -nostdlib
-LDFLAGS-tst-tlsmod6.so = -nostdlib
+$(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
+$(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
+
+# BZ#18383: broken on at least ARM (both).
+test-xfail-tst-tlsalign = yes
+test-xfail-tst-tlsalign-static = yes
+
+$(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
+$(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
+
+tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
+LDFLAGS-nodel2mod3.so = $(no-as-needed)
+LDFLAGS-reldepmod5.so = $(no-as-needed)
+LDFLAGS-reldep6mod1.so = $(no-as-needed)
+LDFLAGS-reldep6mod4.so = $(no-as-needed)
+LDFLAGS-reldep8mod3.so = $(no-as-needed)
+LDFLAGS-unload4mod1.so = $(no-as-needed)
+LDFLAGS-unload4mod2.so = $(no-as-needed)
+LDFLAGS-tst-initorder = $(no-as-needed)
+LDFLAGS-tst-initordera2.so = $(no-as-needed)
+LDFLAGS-tst-initordera3.so = $(no-as-needed)
+LDFLAGS-tst-initordera4.so = $(no-as-needed)
+LDFLAGS-tst-initorderb2.so = $(no-as-needed)
+LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
+LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
testobj1.so-no-z-defs = yes
testobj3.so-no-z-defs = yes
ifuncmod1.so-no-z-defs = yes
ifuncmod5.so-no-z-defs = yes
ifuncmod6.so-no-z-defs = yes
+tst-auditmod9a.so-no-z-defs = yes
+tst-auditmod9b.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
$(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
$(objpfx)neededobj3.so $(objpfx)neededobj4.so
-neededtest4-ENV = LC_ALL=C LANGUAGE=C
$(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
$(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
-$(objpfx)order.out: $(objpfx)order
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)order > $@
- (echo "0123456789" | cmp $@ -) > /dev/null
+$(objpfx)order-cmp.out: $(objpfx)order.out
+ (echo "0123456789" | cmp $< -) > $@; \
+ $(evaluate-test)
$(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
-LDFLAGS-noload = -rdynamic
+$(objpfx)noload: $(objpfx)testobj1.so $(libdl)
+LDFLAGS-noload = -rdynamic $(no-as-needed)
$(objpfx)noload.out: $(objpfx)testobj5.so
-$(objpfx)noload-mem: $(objpfx)noload.out
- $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
+$(objpfx)noload-mem.out: $(objpfx)noload.out
+ $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
+ $(evaluate-test)
noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
LDFLAGS-nodelete = -rdynamic
$(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
+LDFLAGS-next = $(no-as-needed)
$(objpfx)unload2: $(libdl)
$(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
$(objpfx)tst-pathopt: $(libdl)
$(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
$(objpfx)pathoptobj.so
- $(SHELL) -e $< $(common-objpfx)
+ $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
+ '$(run-program-env)'; \
+ $(evaluate-test)
+
+$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
+ $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
+ $(evaluate-test)
$(objpfx)initfirst: $(libdl)
$(objpfx)initfirst.out: $(objpfx)firstobj.so
LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
+CFLAGS-tst-execstack-prog.c += -Wno-trampolines
+CFLAGS-tst-execstack-mod.c += -Wno-trampolines
endif
-$(objpfx)tst-array1.out: $(objpfx)tst-array1
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)tst-array1 > $@
- cmp $@ tst-array1.exp > /dev/null
+LDFLAGS-tst-array2 = $(no-as-needed)
+LDFLAGS-tst-array5 = $(no-as-needed)
-$(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
- $(objpfx)tst-array1-static > $@
- cmp $@ tst-array1.exp > /dev/null
+$(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
+ cmp $^ > $@; \
+ $(evaluate-test)
+
+$(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
+ $(objpfx)tst-array1-static.out
+ cmp $^ > $@; \
+ $(evaluate-test)
$(objpfx)tst-array2: $(objpfx)tst-array2dep.so
-$(objpfx)tst-array2.out: $(objpfx)tst-array2
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)tst-array2 > $@
- cmp $@ tst-array2.exp > /dev/null
-
-$(objpfx)tst-array3.out: $(objpfx)tst-array3
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)tst-array3 > $@
- cmp $@ tst-array1.exp > /dev/null
+$(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
+ cmp $^ > $@; \
+ $(evaluate-test)
+
+$(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
+ cmp $^ > $@; \
+ $(evaluate-test)
$(objpfx)tst-array4: $(libdl)
-$(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $< > $@
- cmp $@ tst-array4.exp > /dev/null
+$(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
+$(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
+ cmp $^ > $@; \
+ $(evaluate-test)
$(objpfx)tst-array5: $(objpfx)tst-array5dep.so
-$(objpfx)tst-array5.out: $(objpfx)tst-array5
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)tst-array5 > $@
- cmp $@ tst-array5.exp > /dev/null
+$(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
+ cmp $^ > $@; \
+ $(evaluate-test)
-$(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
- $(objpfx)tst-array5-static > $@
- cmp $@ tst-array5-static.exp > /dev/null
+$(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
+ $(objpfx)tst-array5-static.out
+ cmp $^ > $@; \
+ $(evaluate-test)
CFLAGS-tst-pie1.c += $(pie-ccflag)
+CFLAGS-tst-pie2.c += $(pie-ccflag)
$(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
ifeq (yes,$(build-shared))
-tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
-
-all-built-dso := $(common-objpfx)libc.so \
+all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
$(filter-out $(common-objpfx)linkobj/libc.so, \
$(sort $(wildcard $(addprefix $(common-objpfx), \
*/lib*.so \
LC_ALL=C $(READELF) -W -d $< > $@T
test -s $@T
mv -f $@T $@
-generated += $(all-built-dso:=.dyn)
+common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
$(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
$(all-built-dso:=.dyn)
- LC_ALL=C $(AWK) -f $^ > $@
+ LC_ALL=C $(AWK) -f $^ > $@; \
+ $(evaluate-test)
generated += check-textrel.out
$(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
LC_ALL=C $(READELF) -W -l $< > $@T
test -s $@T
mv -f $@T $@
-generated += $(all-built-dso:=.phdr)
+common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
$(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
$(objpfx)execstack-default \
$(all-built-dso:=.phdr)
- LC_ALL=C $(AWK) -f $^ > $@
+ LC_ALL=C $(AWK) -f $^ > $@; \
+ $(evaluate-test)
generated += check-execstack.out
$(objpfx)tst-dlmodcount: $(libdl)
LC_ALL=C $(READELF) -W -S -d -r $< > $@T
test -s $@T
mv -f $@T $@
-generated += $(all-built-dso:=.jmprel)
-
-check-data := $(firstword $(wildcard \
- $(foreach D,$(add-ons) scripts,\
- $(patsubst %,$(..)$D/data/localplt-%.data,\
- $(abi-name) \
- $(addsuffix -$(config-os),\
- $(config-machine) \
- $(base-machine)) \
- generic))))
-
-tests: $(objpfx)check-localplt.out
+common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
localplt-built-dso := $(addprefix $(common-objpfx),\
libc.so \
+ elf/ld.so \
math/libm.so \
rt/librt.so \
dlfcn/libdl.so \
resolv/libresolv.so \
crypt/libcrypt.so \
)
+ifeq ($(build-mathvec),yes)
+localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
+endif
ifeq ($(have-thread-library),yes)
localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
endif
+vpath localplt.data $(+sysdep_dirs)
+
$(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
$(..)scripts/localplt.awk \
$(localplt-built-dso:=.jmprel) \
- $(check-data)
- LC_ALL=C $(AWK) -f $(filter-out $< $(check-data),$^) | \
- LC_ALL=C $(AWK) -f $< $(check-data) - \
- > $@
+ localplt.data
+ LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
+ LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
+ > $@; \
+ $(evaluate-test)
endif
$(objpfx)tst-dlopenrpathmod.so: $(libdl)
$(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
-$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
+$(objpfx)tst-audit2: $(libdl)
+$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
+# Prevent GCC-5 from translating a malloc/memset pair into calloc
+CFLAGS-tst-audit2.c += -fno-builtin
tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
-$(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
-$(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
-tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
+$(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-audit4: $(objpfx)tst-auditmod4a.so
-$(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
-tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
-
-$(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
-$(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
-tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
-
-$(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
-$(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
- $(objpfx)tst-auditmod6c.so
-tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
-
-$(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
-$(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
-tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
+$(objpfx)tst-audit8: $(libm)
+$(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
+tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
$(objpfx)order2: $(libdl)
-$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
- $(objpfx)order2mod2.so
- $(elf-objpfx)$(rtld-installed-name) \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $(objpfx)order2 > $@
- (echo "12345" | cmp $@ -) > /dev/null
+$(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
+$(objpfx)order2-cmp.out: $(objpfx)order2.out
+ (echo "12345" | cmp $< -) > $@; \
+ $(evaluate-test)
$(objpfx)order2mod1.so: $(objpfx)order2mod4.so
$(objpfx)order2mod4.so: $(objpfx)order2mod3.so
$(objpfx)order2mod2.so: $(objpfx)order2mod3.so
order2mod2.so-no-z-defs = yes
+LDFLAGS-order2mod1.so = $(no-as-needed)
+LDFLAGS-order2mod2.so = $(no-as-needed)
-tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
+tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
+tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
+# When built statically, the pointer guard interface uses
+# __pointer_chk_guard_local.
+CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
+tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
+
$(objpfx)tst-leaks1: $(libdl)
-$(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
- $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
+$(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
+ $(evaluate-test)
+
+$(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
+$(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
+ $(evaluate-test)
tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
+tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
$(objpfx)tst-addr1: $(libdl)
$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
-$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
- $(elf-objpfx)${rtld-installed-name} \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $< > $@
- cmp $@ tst-initorder.exp > /dev/null
+$(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
+ cmp $^ > $@; \
+ $(evaluate-test)
$(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
$(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
$(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
+LDFLAGS-tst-initorder2 = $(no-as-needed)
+LDFLAGS-tst-initorder2a.so = $(no-as-needed)
+LDFLAGS-tst-initorder2b.so = $(no-as-needed)
+LDFLAGS-tst-initorder2c.so = $(no-as-needed)
define o-iterator-doit
$(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
$$(compile-command.c) -DNAME=\"$o\"
object-suffixes-left := a b c d
include $(o-iterator)
-$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
- $(elf-objpfx)${rtld-installed-name} \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $< > $@
- cmp $@ tst-initorder2.exp > /dev/null
-
-ifeq (yes,$(config-cflags-avx))
-AVX-CFLAGS=-mavx
-ifeq (yes,$(config-cflags-novzeroupper))
-AVX-CFLAGS+=-mno-vzeroupper
-endif
-CFLAGS-tst-audit4.c += $(AVX-CFLAGS)
-CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
-CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
-CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
-CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
-CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
-endif
+$(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
+ cmp $^ > $@; \
+ $(evaluate-test)
$(objpfx)tst-relsort1: $(libdl)
$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
$(objpfx)tst-relsort1mod2.so
-ifeq ($(cross-compiling),no)
-tests: $(objpfx)tst-unused-dep.out
-endif
-
$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
+ $(test-wrapper-env) \
LD_TRACE_LOADED_OBJECTS=1 \
LD_DEBUG=unused \
LD_PRELOAD= \
- $(elf-objpfx)${rtld-installed-name} \
- --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
- $< > $@
- cmp $@ /dev/null > /dev/null
+ $(rtld-prefix) \
+ $< > $@; \
+ $(evaluate-test)
+
+$(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
+ cmp $< /dev/null > $@; \
+ $(evaluate-test)