Merge branch 'master' of ssh://sourceware.org/git/glibc

This commit is contained in:
Ulrich Drepper 2011-07-03 14:26:29 -04:00
commit 17a21a3907
13 changed files with 137 additions and 41 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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

2
aclocal.m4 vendored
View File

@ -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,

View File

@ -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@

16
configure vendored
View File

@ -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

View File

@ -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@:>@]),

View File

@ -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 }'

View File

@ -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);

View File

@ -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.

View File

@ -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]

View File

@ -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", \

View File

@ -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