aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-07-03 14:26:29 -0400
committerUlrich Drepper <drepper@gmail.com>2011-07-03 14:26:29 -0400
commit17a21a3907cbbc731fed12eab8c50a21dc2d6ad3 (patch)
treefcef6dd9e9571bdd544dd52401b44adda88791dc
parentd5032639a4a7e76213942f5d9c9ea20d2e35c01d (diff)
parent5e9b6af4a9bb2aad0e1929e88b52009d14cb6831 (diff)
downloadglibc-17a21a3907cbbc731fed12eab8c50a21dc2d6ad3.zip
glibc-17a21a3907cbbc731fed12eab8c50a21dc2d6ad3.tar.gz
glibc-17a21a3907cbbc731fed12eab8c50a21dc2d6ad3.tar.bz2
Merge branch 'master' of ssh://sourceware.org/git/glibc
-rw-r--r--ChangeLog39
-rw-r--r--Makefile9
-rw-r--r--Makerules41
-rw-r--r--aclocal.m42
-rw-r--r--config.make.in2
-rwxr-xr-xconfigure16
-rw-r--r--configure.in8
-rw-r--r--elf/Makefile12
-rw-r--r--elf/dynamic-link.h6
-rw-r--r--iconvdata/extra-module.mk2
-rw-r--r--localedata/ChangeLog5
-rw-r--r--localedata/tests-mbwc/tst_funcs.h5
-rwxr-xr-xscripts/check-local-headers.sh31
13 files changed, 137 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 210bded..63887b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2011-07-02 Roland McGrath <roland@hack.frob.com>
+
+ * Makerules ($(common-objpfx)format.lds): Fail if result is empty.
+
+ * Makefile ($(common-objpfx)testrun.sh): Generate to work relative to
+ containing directory rather than embedding absolute directory names.
+
+ * scripts/check-local-headers.sh: Rewritten using awk.
+ Match by word, not by line. Print error messages for matches.
+ * Makefile ($(objpfx)check-local-headers.out): Pass AWK in to it.
+
+ * Makerules [shlib-lds-flags empty]:
+ ($(common-objpfx)libc_pic.opts): New target.
+ ($(common-objpfx)libc_pic.os.clean): New target.
+ ($(common-objpfx)libc.so): Link it instead of libc_pic.os.
+
+ * config.make.in (OBJCOPY): New variable.
+ * aclocal.m4 (LIBC_PROG_BINUTILS): Substitute OBJCOPY too.
+ * configure: Regenerated.
+
+ * config.make.in (use-default-link): New variable.
+ * configure.in (use_default_link): Grok --with-default-link to set it.
+ * configure: Regenerated.
+ * Makerules [$(elf) = yes] [$(use-default-link) = yes]:
+ (shlib-lds, shlib-lds-flags): Define to empty.
+
+ * Makerules (shlib-lds): New variable.
+ (shlib-lds-flags): New variable.
+ (build-shlib, build-moduile, build-module-asneeded): Use it.
+ ($(common-objpfx)libc.so): Use $(shlib-lds).
+ ($(extra-modules-build:%=$(objpfx)%.so)): Likewise.
+ * iconvdata/extra-module.mk ($(objpfx)$(mod).so): Likewise.
+
+ * elf/dynamic-link.h (elf_get_dynamic_info): Make asserts accept
+ DT_FLAGS/DT_FLAGS_1 with zero flags.
+
+ * elf/Makefile ($(objpfx)ld.so): Use -defsym=_begin=0 instead of
+ linker script munging.
+
2011-07-02 Ulrich Drepper <drepper@gmail.com>
* crypt/sha512.h (struct sha512_ctx): Add union to access total also
diff --git a/Makefile b/Makefile
index aac2557..6f2dfa6 100644
--- a/Makefile
+++ b/Makefile
@@ -163,8 +163,10 @@ endif
$(common-objpfx)testrun.sh: $(common-objpfx)config.make \
$(..)Makeconfig $(..)Makefile
(echo '#!/bin/sh'; \
- echo "GCONV_PATH='$(common-objpfx)iconvdata' \\"; \
- echo 'exec $(run-program-prefix) $${1+"$$@"}'; \
+ echo 'builddir=`dirname "$$0"`'; \
+ echo 'GCONV_PATH="$${builddir}/iconvdata" \'; \
+ echo 'exec $(subst $(common-objdir),"$${builddir}",\
+ $(run-program-prefix)) $${1+"$$@"}'; \
) > $@T
chmod a+x $@T
mv -f $@T $@
@@ -284,7 +286,8 @@ endif
endif
$(objpfx)check-local-headers.out: scripts/check-local-headers.sh
- scripts/check-local-headers.sh "$(includedir)" "$(objpfx)" > $@
+ AWK='$(AWK)' scripts/check-local-headers.sh \
+ "$(includedir)" "$(objpfx)" > $@
ifneq ($(PERL),no)
installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
diff --git a/Makerules b/Makerules
index 6b4b0e1..d70a196 100644
--- a/Makerules
+++ b/Makerules
@@ -479,6 +479,11 @@ endif
endif
ifeq (yes,$(elf))
+ifeq (yes,$(use-default-link))
+# If the linker is good enough, we can let it use its default linker script.
+shlib-lds =
+shlib-lds-flags =
+else
# binutils only position loadable notes into the first page for binaries,
# not for shared objects
$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
@@ -514,8 +519,12 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
mv -f $@T $@
common-generated += shlib.lds
+shlib-lds = $(common-objpfx)shlib.lds
+shlib-lds-flags = -T $(shlib-lds)
+endif
+
define build-shlib
-$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
$(csu-objpfx)abi-note.o $(build-shlib-objlist)
endef
else
@@ -557,11 +566,11 @@ ifeq (yes,$(elf))
# binutils only position loadable notes into the first page for binaries,
# not for shared objects
define build-module
-$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-module-helper) -o $@ $(shlib-lds-flags) \
$(csu-objpfx)abi-note.o $(build-module-objlist)
endef
define build-module-asneeded
-$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-module-helper) -o $@ $(shlib-lds-flags) \
$(csu-objpfx)abi-note.o \
-Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
endef
@@ -612,13 +621,30 @@ endif
ifeq ($(elf),yes)
$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
- $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
+ $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^ -o $@
+
+ifeq (,$(strip $(shlib-lds-flags)))
+# Generate a list of -R options to excise .gnu.glibc-stub.* sections.
+$(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os
+ $(OBJDUMP) -h $< | \
+ $(AWK) '$$2 ~ /\.gnu\.glibc-stub\./ { print "-R", $$2 }' \
+ > $@T
+ mv -f $@T $@
+# Apply those -R options.
+$(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \
+ $(common-objpfx)libc_pic.os
+ $(OBJCOPY) @$^ $@
+generated += libc_pic.opts libc_pic.os.clean
+
+libc_pic_clean := .clean
+endif
+
# Use our own special initializer and finalizer files for libc.so.
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
- $(common-objpfx)libc_pic.os \
+ $(common-objpfx)libc_pic.os$(libc_pic_clean) \
$(elfobjdir)/sofini.os \
$(elfobjdir)/interp.os $(elfobjdir)/ld.so \
- $(common-objpfx)shlib.lds
+ $(shlib-lds)
$(build-shlib)
ifeq ($(versioning),yes)
$(common-objpfx)libc.so: $(common-objpfx)libc.map
@@ -689,7 +715,7 @@ include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
$(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
- $(objpfx)%.os $(common-objpfx)shlib.lds \
+ $(objpfx)%.os $(shlib-lds) \
$(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
$(build-module)
endif
@@ -967,6 +993,7 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
$(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
| sed -n -f $< > $@.new
+ test -s $@.new
rm -f $@.so
mv -f $@.new $@
common-generated += format.lds
diff --git a/aclocal.m4 b/aclocal.m4
index 6ad3c87..d226e77 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -101,6 +101,8 @@ AR=`$CC -print-prog-name=ar`
AC_SUBST(AR)
OBJDUMP=`$CC -print-prog-name=objdump`
AC_SUBST(OBJDUMP)
+OBJCOPY=`$CC -print-prog-name=objcopy`
+AC_SUBST(OBJCOPY)
# Determine whether we are using GNU binutils.
AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
diff --git a/config.make.in b/config.make.in
index 0656b1b..6e876eb 100644
--- a/config.make.in
+++ b/config.make.in
@@ -69,6 +69,7 @@ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
fno-unit-at-a-time = @fno_unit_at_a_time@
bind-now = @bindnow@
have-hash-style = @libc_cv_hashstyle@
+use-default-link = @use_default_link@
static-libgcc = @libc_cv_gcc_static_libgcc@
@@ -115,6 +116,7 @@ PWD_P = @PWD_P@
BISON = @BISON@
AUTOCONF = @AUTOCONF@
OBJDUMP = @OBJDUMP@
+OBJCOPY = @OBJCOPY@
# Installation tools.
INSTALL = @INSTALL@
diff --git a/configure b/configure
index 20e7340..936dbf1 100755
--- a/configure
+++ b/configure
@@ -677,6 +677,7 @@ PWD_P
LD
AS
MIG
+OBJCOPY
OBJDUMP
AR
LN_S
@@ -696,6 +697,7 @@ force_install
bindnow
oldest_abi
enable_check_abi
+use_default_link
with_cvs
with_fp
ac_ct_CXX
@@ -770,6 +772,7 @@ with_selinux
with_xcoff
with_cvs
with_headers
+with_default_link
enable_sanity_checks
enable_check_abi
enable_shared
@@ -1464,6 +1467,7 @@ Optional Packages:
--without-cvs if CVS should not be used
--with-headers=PATH location of system headers to use (for example
/usr/src/linux/include) [default=compiler default]
+ --with-default-link do not use explicit linker scripts [default=no]
--with-tls enable support for TLS
--without-__thread do not use TLS features even when supporting them
--with-cpu=CPU select code for CPU variant
@@ -3581,6 +3585,16 @@ else
fi
+
+
+# Check whether --with-default-link was given.
+if test "${with_default_link+set}" = set; then :
+ withval=$with_default_link; use_default_link=$withval
+else
+ use_default_link=no
+fi
+
+
# Check whether --enable-sanity-checks was given.
if test "${enable_sanity_checks+set}" = set; then :
enableval=$enable_sanity_checks; enable_sanity=$enableval
@@ -4673,6 +4687,8 @@ AR=`$CC -print-prog-name=ar`
OBJDUMP=`$CC -print-prog-name=objdump`
+OBJCOPY=`$CC -print-prog-name=objcopy`
+
# Determine whether we are using GNU binutils.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $AS is GNU as" >&5
diff --git a/configure.in b/configure.in
index f2b3921..f34aab3 100644
--- a/configure.in
+++ b/configure.in
@@ -114,6 +114,14 @@ AC_ARG_WITH([headers],
[sysheaders=$withval],
[sysheaders=''])
+AC_SUBST(use_default_link)
+AC_ARG_WITH([default-link],
+ AC_HELP_STRING([--with-default-link],
+ [do not use explicit linker scripts
+ @<:@default=no@:>@]),
+ [use_default_link=$withval],
+ [use_default_link=no])
+
AC_ARG_ENABLE([sanity-checks],
AC_HELP_STRING([--disable-sanity-checks],
[really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
diff --git a/elf/Makefile b/elf/Makefile
index fbd7d88..d418099 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -406,19 +406,11 @@ generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
z-now-yes = -Wl,-z,now
$(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
- @rm -f $@.lds
- $(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now)) \
- $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
- LC_ALL=C \
- sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
- > $@.lds
- test -s $@.lds
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
$(filter-out $(map-file),$^) $(load-map-file) \
- -Wl,-soname=$(rtld-installed-name) -T $@.lds
- rm -f $@.lds
+ -Wl,-soname=$(rtld-installed-name) \
+ -Wl,-defsym=_begin=0
readelf -s $@ \
| $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 6d7e142..9c16da4 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -1,5 +1,5 @@
/* Inline functions for dynamic linking.
- Copyright (C) 1995-2005, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1995-2005,2006,2008,2011 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
@@ -201,9 +201,9 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
#ifdef RTLD_BOOTSTRAP
/* Only the bind now flags are allowed. */
assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL
- || info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val == DF_1_NOW);
+ || (info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val & ~DF_1_NOW) == 0);
assert (info[DT_FLAGS] == NULL
- || info[DT_FLAGS]->d_un.d_val == DF_BIND_NOW);
+ || (info[DT_FLAGS]->d_un.d_val & ~DF_BIND_NOW) == 0);
/* Flags must not be set for ld.so. */
assert (info[DT_RUNPATH] == NULL);
assert (info[DT_RPATH] == NULL);
diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
index 163074f..43f4e12 100644
--- a/iconvdata/extra-module.mk
+++ b/iconvdata/extra-module.mk
@@ -4,7 +4,7 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
$(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
- $(common-objpfx)shlib.lds
+ $(shlib-lds)
$(build-module-asneeded)
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 78965fb..e0e2207 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-02 Roland McGrath <roland@hack.frob.com>
+
+ * tests-mbwc/tst_funcs.h (TST_DECL_VARS, TST_HEAD_LOCALE):
+ Remove unused variable.
+
2011-05-21 Ulrich Drepper <drepper@gmail.com>
[BZ #12788]
diff --git a/localedata/tests-mbwc/tst_funcs.h b/localedata/tests-mbwc/tst_funcs.h
index 552bed2..23dc6a0 100644
--- a/localedata/tests-mbwc/tst_funcs.h
+++ b/localedata/tests-mbwc/tst_funcs.h
@@ -84,7 +84,7 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
#define TST_DECL_VARS(_type_) \
int loc, rec, err_count = 0; \
int warn_count __attribute__ ((unused)); \
- int func_id, seq_num = 0; \
+ int seq_num = 0; \
const char *locale; \
int err_exp, ret_flg; \
int errno_save = 0; \
@@ -96,8 +96,7 @@ extern int result (FILE * fp, char res, const char *func, const char *loc,
#define TST_HEAD_LOCALE(ofunc, s_func) \
- func_id = TST_HEAD (ofunc).func_id; \
- locale = TST_HEAD (ofunc).locale; \
+ locale = TST_HEAD (ofunc).locale; \
if (setlocale (LC_ALL, locale) == NULL) \
{ \
fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n", \
diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh
index d15e9a4..b73078d 100755
--- a/scripts/check-local-headers.sh
+++ b/scripts/check-local-headers.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2005,2007,2009,2011 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
@@ -23,18 +23,21 @@ objpfx="$2"
# To avoid long paths.
cd "$objpfx"
-
# Search all dependency files for file names in the include directory.
# There are a few system headers we are known to use.
-if fgrep "$includedir" */*.{o,os,oS}.d |
-fgrep -v "$includedir/asm" |
-fgrep -v "$includedir/linux" |
-fgrep -v "$includedir/selinux" |
-fgrep -v "$includedir/sys/capability.h" |
-fgrep -v "$includedir/gd" |
-fgrep -v "$includedir/nss3"; then
- # If we found a match something is wrong.
- exit 1
-fi
-
-exit 0
+exec ${AWK} -v includedir="$includedir" '
+BEGIN {
+ status = 0
+ exclude = "^" includedir \
+ "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h)"
+}
+/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
+{
+ for (i = 1; i <= NF; ++i) {
+ if ($i ~ ("^" includedir) && $i !~ exclude) {
+ print "***", obj, "uses", $i
+ status = 1
+ }
+ }
+}
+END { exit status }' */*.{o,os,oS}.d