aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-11 07:14:18 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-01-11 07:14:18 -0800
commit740b3dbee8ef034019b240dc4838b39dfa0c01e2 (patch)
tree6b4caa77b597058c873bd5df2e0f7a859327c90a
parentc6fe55cf6089fc5cf1cea15fc7e1c9a8b90d9fda (diff)
downloadglibc-740b3dbee8ef034019b240dc4838b39dfa0c01e2.tar.xz
glibc-740b3dbee8ef034019b240dc4838b39dfa0c01e2.zip
Add --enable-hardcoded-path-in-tests configure option
-rw-r--r--ChangeLog126
-rw-r--r--Makeconfig83
-rw-r--r--Makefile2
-rw-r--r--Makerules8
-rw-r--r--Rules23
-rw-r--r--catgets/Makefile2
-rwxr-xr-xcatgets/test-gencat.sh4
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure14
-rw-r--r--configure.in7
-rw-r--r--elf/Makefile32
-rw-r--r--grp/Makefile2
-rw-r--r--grp/tst_fgetgrent.sh10
-rw-r--r--iconvdata/Makefile2
-rwxr-xr-xiconvdata/tst-table.sh6
-rwxr-xr-xiconvdata/tst-tables.sh4
-rw-r--r--intl/Makefile10
-rwxr-xr-xintl/tst-gettext.sh4
-rw-r--r--intl/tst-gettext2.sh4
-rwxr-xr-xintl/tst-gettext4.sh4
-rw-r--r--intl/tst-gettext6.sh4
-rwxr-xr-xintl/tst-translit.sh4
-rw-r--r--io/Makefile2
-rw-r--r--libio/Makefile2
-rwxr-xr-xlibio/test-freopen.sh4
-rw-r--r--localedata/ChangeLog27
-rw-r--r--localedata/Makefile21
-rw-r--r--localedata/sort-test.sh6
-rwxr-xr-xlocaledata/tst-fmon.sh5
-rwxr-xr-xlocaledata/tst-mbswcs.sh12
-rw-r--r--localedata/tst-numeric.sh4
-rwxr-xr-xlocaledata/tst-trans.sh3
-rw-r--r--malloc/Makefile2
-rwxr-xr-xmalloc/tst-mtrace.sh4
-rw-r--r--manual/install.texi5
-rw-r--r--nptl/ChangeLog17
-rw-r--r--nptl/Makefile12
-rwxr-xr-xnptl/tst-tls6.sh6
-rw-r--r--posix/Makefile12
-rwxr-xr-xposix/globtest.sh101
-rwxr-xr-xposix/wordexp-tst.sh22
-rw-r--r--rt/Makefile2
-rw-r--r--stdio-common/Makefile6
-rw-r--r--stdio-common/tst-printf.sh4
-rwxr-xr-xstdio-common/tst-unbputc.sh4
-rw-r--r--stdlib/Makefile2
-rwxr-xr-xstdlib/tst-fmtmsg.sh4
-rw-r--r--string/Makefile2
48 files changed, 449 insertions, 198 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bf5772907..dc9ea9596e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,129 @@
+2013-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makeconfig (+link-pie-before-libc): New.
+ (+link-pie-after-libc): Likewise.
+ (+link-pie-tests): Likewise.
+ (+link-pie): Rewritten.
+ (link-before-libc): Remove $(config-LDFLAGS).
+ (+link): Add $(rtld-LDFLAGS) after $(+link-before-libc).
+ (+link-tests): Add $(rtld-tests-LDFLAGS) after $(+link-before-libc).
+ (config-LDFLAGS): Renamed to ...
+ (rtld-LDFLAGS): This.
+ (rtld-tests-LDFLAGS): New macro.
+ (link-libc-rpath-link): Likewise.
+ (link-libc-tests-rpath-link): Likewise.
+ (link-libc-before-gnulib): Remove -Wl,-rpath-link=$(rpath-link).
+ (link-libc): Prepand $(link-libc-rpath-link).
+ (link-libc-tests): Prepand $(link-libc-tests-rpath-link).
+ (test-program-prefix): New macro.
+ (test-via-rtld-prefix): Likewise.
+ (test-program-cmd): Likewise.
+ (host-test-program-cmd): Likewise.
+ * Makefile ($(common-objpfx)testrun.sh): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * Makerules ($(LINK.o)): Replace $(config-LDFLAGS) with
+ $(rtld-LDFLAGS).
+ ($(common-objpfx)shlib.lds): Likewise.
+ (build-module-helper): Likewise.
+ ($(common-objpfx)format.lds): Likewise.
+ * Rules (binaries-pie-tests): New.
+ (binaries-pie-notests): Likewise.
+ (binaries-pie): Rewritten.
+ ($(addprefix $(objpfx),$(binaries-pie))): Renamed to ...
+ ($(addprefix $(objpfx),$(binaries-pie-notests))): This.
+ ($(addprefix $(objpfx),$(binaries-pie-tests))): New.
+ (make-test-out): Replace $(host-built-program-cmd) with
+ $(host-test-program-cmd).
+ * config.make.in (build-hardcoded-path-in-tests): New variable.
+ * configure.in (--enable-hardcoded-path-in-tests): New configure
+ option.
+ (hardcoded_path_in_tests): New AC_SUBST.
+ * configure: Regenerated.
+ * catgets/Makefile ($(objpfx)test-gencat.out): Replace
+ $(built-program-cmd) with $(test-program-cmd).
+ * catgets/test-gencat.sh (run_program_cmd): Renamed to ...
+ (test_program_cmd): This.
+ * elf/Makefile ($(objpfx)order.out): Run test with
+ $(test-program-prefix).
+ ($(objpfx)order2.out): Likewise.
+ ($(objpfx)tst-initorder.out): Likewise.
+ ($(objpfx)tst-initorder2.out): Likewise.
+ ($(objpfx)tst-array1.out): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ ($(objpfx)tst-array1-static.out): Likewise.
+ ($(objpfx)tst-array2.out): Likewise.
+ ($(objpfx)tst-array3.out): Likewise.
+ ($(objpfx)tst-array4.out): Likewise.
+ ($(objpfx)tst-array5.out): Likewise.
+ ($(objpfx)tst-array5-static.out): Likewise.
+ (tst-stackguard1-ARGS): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ * grp/Makefile ($(objpfx)tst_fgetgrent.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * grp/tst_fgetgrent.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * iconvdata/Makefile ($(objpfx)tst-tables.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * iconvdata/tst-table.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * iconvdata/tst-tables.sh: Likewise.
+ * intl/Makefile ($(objpfx)tst-gettext.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ ($(objpfx)tst-translit.out): Likewise.
+ ($(objpfx)tst-gettext2.out): Likewise.
+ ($(objpfx)tst-gettext4.out): Likewise.
+ ($(objpfx)tst-gettext6.out): Likewise.
+ * intl/tst-gettext.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * intl/tst-gettext2.sh: Likewise.
+ * intl/tst-gettext4.sh Likewise.
+ * intl/tst-gettext6.sh: Likewise.
+ * intl/tst-translit.sh: Likewise.
+ * io/Makefile ($(objpfx)ftwtest.out): Replace $(run-program-cmd)
+ with $(test-program-cmd).
+ * libio/Makefile ($(objpfx)test-freopen.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * libio/test-freopen.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * malloc/Makefile ($(objpfx)tst-mtrace.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * malloc/tst-mtrace.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * manual/install.texi: Document --enable-hardcoded-path-in-tests.
+ * posix/Makefile ($(objpfx)globtest.out): Replace
+ $(run-via-rtld-prefix) and $(test-wrapper) with
+ $(test-program-prefix) and $(test-via-rtld-prefix).
+ ($(objpfx)wordexp-tst.out): Replace $(run-program-prefix) with
+ $(test-program-prefix).
+ (tst-exec-ARGS): Replace $(host-built-program-cmd) with
+ $(host-test-program-cmd).
+ (tst-spawn-ARGS): Likewise.
+ ($(objpfx)tst-rxspencer-mem): Replace $(run-program-prefix) with
+ $(test-program-prefix).
+ * posix/globtest.sh (un_via_rtld_prefix): Renamed to ...
+ (test_via_rtld_prefix): This.
+ (test_wrapper): Renamed to ...
+ (test_program_prefix): This.
+ (run_program_prefix): Replaced by test_program_prefix.
+ * posix/wordexp-tst.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * rt/Makefile (tst-mqueue7-ARGS): Replace $(host-built-program-cmd)
+ with $(host-test-program-cmd).
+ * stdio-common/Makefile ($(objpfx)tst-unbputc.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ ($(objpfx)tst-printf.out): Likewise.
+ ($(objpfx)tst-setvbuf1.out): Replace $(built-program-cmd) with
+ $(test-program-cmd).
+ * stdio-common/tst-printf.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * stdio-common/tst-unbputc.sh: Likewise.
+ * stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Replace
+ $(run-program-prefix) with $(test-program-prefix).
+ * stdlib/tst-fmtmsg.sh (run_program_prefix): Renamed to ...
+ (test_program_prefix): This.
+ * string/Makefile ($(objpfx)tst-svc.out): Replace
+ $(built-program-cmd) with $(test-program-cmd).
+
2013-01-11 Andreas Jaeger <aj@suse.de>
[BZ #15003]
diff --git a/Makeconfig b/Makeconfig
index d2158f1e74..8da4ad3b4a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -379,8 +379,8 @@ endif
# Command for linking PIE programs with the C library.
ifndef +link-pie
-+link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
++link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
$(addprefix $(csu-objpfx),S$(start-installed-name)) \
$(+preinit) $(+prectorS) \
@@ -388,7 +388,12 @@ ifndef +link-pie
S$(start-installed-name))\
$(+preinit) $(link-extra-libs) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ $(link-extra-libs)
++link-pie-after-libc = $(+postctorS) $(+postinit)
++link-pie = $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) \
+ $(+link-pie-after-libc)
++link-pie-tests = $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) \
+ $(link-libc-tests) $(+link-pie-after-libc)
endif
# Command for statically linking programs with the C library.
ifndef +link-static
@@ -411,7 +416,7 @@ endif
ifndef +link
ifeq (yes,$(build-shared))
+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
$(addprefix $(csu-objpfx),$(start-installed-name)) \
$(+preinit) $(+prector) \
@@ -421,8 +426,10 @@ ifeq (yes,$(build-shared))
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs)
+link-after-libc = $(+postctor) $(+postinit)
-+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
-+link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
++link = $(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) \
+ $(+link-after-libc)
++link-tests = $(+link-before-libc) $(rtld-tests-LDFLAGS) \
+ $(link-libc-tests) $(+link-after-libc)
else
+link = $(+link-static)
+link-tests = $(+link-static-tests)
@@ -440,9 +447,16 @@ ifndef +link-bounded
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-bounded) $(link-libc-bounded) $(+postctorT) $(+postinit)
endif
-ifndef config-LDFLAGS
ifeq (yes,$(build-shared))
-config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+ifndef rtld-LDFLAGS
+rtld-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+endif
+ifndef rtld-tests-LDFLAGS
+ifeq (yes,$(build-hardcoded-path-in-tests))
+rtld-tests-LDFLAGS = -Wl,-dynamic-linker=$(common-objpfx)elf/ld.so
+else
+rtld-tests-LDFLAGS = $(rtld-LDFLAGS)
+endif
endif
endif
ifndef link-libc
@@ -450,12 +464,19 @@ ifeq (yes,$(build-shared))
# We need the versioned name of libc.so in the deps of $(others) et al
# so that the symlink to libc.so is created before anything tries to
# run the linked programs.
-link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \
- $(common-objpfx)libc.so$(libc.so-version) \
- $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed)
-link-libc = $(link-libc-before-gnulib) $(gnulib)
-link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests)
+link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
+ifeq (yes,$(build-hardcoded-path-in-tests))
+link-libc-tests-rpath-link = -Wl,-rpath=$(rpath-link)
+else
+link-libc-tests-rpath-link = $(link-libc-rpath-link)
+endif
+link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
+ $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
+ $(as-needed) $(common-objpfx)elf/ld.so \
+ $(no-as-needed)
+link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib)
+link-libc-tests = $(link-libc-tests-rpath-link) \
+ $(link-libc-before-gnulib) $(gnulib-tests)
# This is how to find at build-time things that will be installed there.
rpath-dirs = math elf dlfcn nss nis rt resolv crypt
rpath-link = \
@@ -628,6 +649,40 @@ ifndef LD
LD := ld -X
endif
+# $(test-via-rtld-prefix) is a command that, when prepended to the name
+# of a test program built with the newly built library, produces a command
+# that, executed on the host for which the library is built, runs that
+# program. For the statically-linked %-bp test programs, and for
+# tests listed in tests-static or xtests-static as well as when test
+# programs are hardcoded to the newly built libraries, it is empty.
+
+# $(test-program-prefix) is a command that, when prepended to the name
+# of a test program built with the newly built library, produces a command
+# that, executed on the build system on which "make" is run, runs that
+# test program.
+
+# $(test-program-cmd) is a command that, executed on the build system
+# on which "make" is run, runs the newly built test program that is the
+# second dependency of the makefile target in which
+# $(test-program-cmd) is used.
+
+# $(host-test-program-cmd) is a command that, executed on the host
+# for which the library is built, runs the newly built test program that
+# is the second dependency of the makefile target in which
+# $(host-test-program-cmd) is used.
+
+ifeq (yes,$(build-hardcoded-path-in-tests))
+test-via-rtld-prefix =
+test-program-prefix = $(test-wrapper)
+test-program-cmd = $(test-wrapper) $(built-program-file)
+host-test-program-cmd = $(built-program-file)
+else
+test-via-rtld-prefix = $(run-via-rtld-prefix)
+test-program-prefix = $(run-program-prefix)
+test-program-cmd = $(built-program-cmd)
+host-test-program-cmd = $(host-built-program-cmd)
+endif
+
# Extra flags to pass to GCC.
ifeq ($(all-warnings),yes)
+gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
diff --git a/Makefile b/Makefile
index 3ae5211833..c12e332503 100644
--- a/Makefile
+++ b/Makefile
@@ -155,7 +155,7 @@ $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
echo 'builddir=`dirname "$$0"`'; \
echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
echo 'exec $(subst $(common-objdir),"$${builddir}",\
- $(run-program-prefix)) $${1+"$$@"}'; \
+ $(test-program-prefix)) $${1+"$$@"}'; \
) > $@T
chmod a+x $@T
mv -f $@T $@
diff --git a/Makerules b/Makerules
index 0463244582..ce86d5085a 100644
--- a/Makerules
+++ b/Makerules
@@ -447,7 +447,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
define build-shlib-helper
$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
- $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(config-LDFLAGS) \
+ $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
@@ -465,7 +465,7 @@ else
$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
$(LINK.o) -shared -Wl,-O1 \
-nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+ $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
-Wl,--verbose 2>&1 | \
sed > $@T \
-e '/^=========/,/^=========/!d;/^=========/d' \
@@ -505,7 +505,7 @@ $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
endef
define build-module-helper
-$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
-B$(csu-objpfx) $(load