mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-17 13:00:43 +08:00
* sysdeps/generic/errno.c (__libc_errno): Remove alias.
* inet/herrno.c (__libc_h_errno): Likewise. * resolv/res_libc.c (__libc_res): Likewise. [USE___THREAD]: Use this in place of [USE_TLS && HAVE___THREAD]. (__res_state) [! USE___THREAD]: Don't define as weak. * csu/Versions: Revert last change. * resolv/Versions: Revert last change. * Makerules ($(common-objpfx)%.make): New pattern rule. * tls.make.c: New file. * Makefile (distribute): Add it.
This commit is contained in:
parent
3fa5f1fa0a
commit
53da80ab88
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
2002-11-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/generic/errno.c (__libc_errno): Remove alias.
|
||||
* inet/herrno.c (__libc_h_errno): Likewise.
|
||||
* resolv/res_libc.c (__libc_res): Likewise.
|
||||
[USE___THREAD]: Use this in place of [USE_TLS && HAVE___THREAD].
|
||||
(__res_state) [! USE___THREAD]: Don't define as weak.
|
||||
* csu/Versions: Revert last change.
|
||||
* resolv/Versions: Revert last change.
|
||||
|
||||
* Makerules ($(common-objpfx)%.make): New pattern rule.
|
||||
* tls.make.c: New file.
|
||||
* Makefile (distribute): Add it.
|
||||
|
||||
* sysdeps/generic/errno.c [! USE___THREAD]
|
||||
[HAVE_ELF && SHARED && DO_VERSIONING] (errno, _errno): Declare these
|
||||
with compat_symbol so they are not link-time visible.
|
||||
|
4
Makefile
4
Makefile
@ -272,8 +272,8 @@ distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
|
||||
rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
|
||||
test-skeleton.c include/des.h include/libc-internal.h \
|
||||
include/shlib-compat.h include/pthread.h Versions.def \
|
||||
cppflags-iterator.mk INTERFACE CONFORMANCE NAMESPACE \
|
||||
LICENSES \
|
||||
cppflags-iterator.mk tls.make.c \
|
||||
INTERFACE CONFORMANCE NAMESPACE LICENSES \
|
||||
$(addprefix scripts/, \
|
||||
rellns-sh config.sub config.guess \
|
||||
mkinstalldirs move-if-change install-sh \
|
||||
|
14
Makerules
14
Makerules
@ -146,6 +146,20 @@ before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
|
||||
ifdef before-compile
|
||||
$(before-compile):
|
||||
endif
|
||||
|
||||
# If a makefile needs to do something conditional on something that
|
||||
# can only be figured out from headers, write a FOO.make.c input
|
||||
# file that uses cpp contructs and contains @@@ LINE @@@ for each LINE
|
||||
# to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.
|
||||
$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules
|
||||
rm -f $@T $@.dT
|
||||
(echo '# Generated from $*.make.c by Makerules.'; \
|
||||
SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -E $< \
|
||||
| sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \
|
||||
echo 'common-generated += $(@F)'; \
|
||||
cat $@.dT; rm -f $@.dT) > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
# Generate an ordered list of implicit rules which find the source files in
|
||||
# each sysdep directory. The old method was to use vpath to search all the
|
||||
|
@ -1,3 +1,22 @@
|
||||
2002-11-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* libc-tsd.c: New file.
|
||||
* Makefile (distribute): Add it.
|
||||
(libc-link.so): New variable.
|
||||
($(objpfx)libpthread.so): Depend on that instead of libc.so file name.
|
||||
(libc-ok-for-link): New variable.
|
||||
[$(versioning) = yes]: Include $(common-objpfx)tls.make and define
|
||||
libc-ok-for-link to $(use-thread).
|
||||
[$(libc-ok-for-link) = no]
|
||||
(libc-link.so): Set to $(objpfx)libc.so, not $(common-objpfx)libc.so.
|
||||
($(objpfx)libc_pic_lite.a,$(objpfx)libc_pic_lite.os, $(objpfx)libc.so):
|
||||
New targets.
|
||||
(generated): Append them.
|
||||
(extra-objs): Append libc-tsd.os.
|
||||
|
||||
* libc-tls-loc.c: New file.
|
||||
* Makefile (libpthread-routines): Add it.
|
||||
|
||||
2002-11-14 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* sysdeps/unix/sysv/linux/ia64/pt-initfini.c: Fix unterminated
|
||||
|
@ -25,7 +25,8 @@ linuxthreads-version := $(shell sed -n 's/^.*$(subdir)-\([0-9.]*\).*$$/\1/p' \
|
||||
Banner)
|
||||
|
||||
headers := pthread.h semaphore.h
|
||||
distribute := internals.h queue.h restart.h spinlock.h smp.h tst-signal.sh
|
||||
distribute := internals.h queue.h restart.h spinlock.h smp.h tst-signal.sh \
|
||||
libc-tsd.c
|
||||
|
||||
routines := weaks no-tsd
|
||||
|
||||
@ -37,7 +38,7 @@ libpthread-routines := attr cancel condvar join manager mutex ptfork \
|
||||
semaphore spinlock wrapsyscall rwlock pt-machine \
|
||||
oldsemaphore events getcpuclockid pspinlock barrier \
|
||||
ptclock_gettime ptclock_settime sighandler \
|
||||
pthandles
|
||||
pthandles libc-tls-loc
|
||||
|
||||
nodelete-yes = -Wl,--enable-new-dtags,-z,nodelete
|
||||
initfirst-yes = -Wl,--enable-new-dtags,-z,initfirst
|
||||
@ -89,11 +90,49 @@ CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES -D_RPC_THREAD_SAFE_
|
||||
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"
|
||||
CFLAGS-sighandler.c += $(exceptions)
|
||||
|
||||
ifeq (yes,$(versioning))
|
||||
-include $(common-objpfx)tls.make
|
||||
libc-ok-for-link = $(use-thread)
|
||||
else
|
||||
libc-ok-for-link = yes
|
||||
endif
|
||||
|
||||
ifeq (no,$(libc-ok-for-link))
|
||||
# These hacks are necessary to let us link against a libc.so that exports
|
||||
# the symbols _errno, _h_errno, and _res. Those symbols are accessible
|
||||
# in libc at runtime (dynamic linkable), but are not exported at link time
|
||||
# so that applications cannot link against them. However, libpthread.so
|
||||
# needs to link against them for its __errno_location et al functions to
|
||||
# find the locations that libc's symbols resolve to. We cannot do this
|
||||
# with aliases in libc.so(GLIBC_PRIVATE), because we need to refer to an
|
||||
# executable's symbols when it defines them with copy relocs.
|
||||
libc-link.so = $(objpfx)libc.so
|
||||
|
||||
$(objpfx)libc_pic_lite.a: $(common-objpfx)libc_pic.a
|
||||
cp $< $@T
|
||||
$(AR) d $@T errno.os herrno.os res_libc.os
|
||||
mv -f $@T $@
|
||||
|
||||
extra-objs += libc-tsd.os
|
||||
$(objpfx)libc_pic_lite.os: $(objpfx)libc_pic_lite.a $(objpfx)libc-tsd.os
|
||||
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
|
||||
$(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
|
||||
|
||||
$(objpfx)libc.so: $(elfobjdir)/soinit.os \
|
||||
$(objpfx)libc_pic_lite.os \
|
||||
$(elfobjdir)/sofini.os \
|
||||
$(elfobjdir)/interp.os $(elfobjdir)/ld.so
|
||||
$(build-shlib)
|
||||
|
||||
generated += libc_pic_lite.a libc_pic_lite.os libc.so
|
||||
else
|
||||
libc-link.so = $(common-objpfx)libc.so
|
||||
endif
|
||||
|
||||
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
||||
# This ensures they will load libc.so for needed symbols if loaded by
|
||||
# a statically-linked program that hasn't already loaded it.
|
||||
$(objpfx)libpthread.so: $(common-objpfx)libc.so \
|
||||
$(common-objpfx)libc_nonshared.a
|
||||
$(objpfx)libpthread.so: $(libc-link.so) $(common-objpfx)libc_nonshared.a
|
||||
|
||||
# Make sure we link with the thread library.
|
||||
ifeq ($(build-shared),yes)
|
||||
|
49
linuxthreads/libc-tls-loc.c
Normal file
49
linuxthreads/libc-tls-loc.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Special definitions for libc's own exposed thread-specific variables.
|
||||
Copyright (C) 2002 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
|
||||
modify it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <tls.h>
|
||||
|
||||
#if USE___THREAD
|
||||
# include <errno.h>
|
||||
# include <netdb.h>
|
||||
# include <resolv.h>
|
||||
|
||||
/* These functions have identical definitions in libc. But the versioned
|
||||
dependencies in executables bind them to libpthread.so definitions,
|
||||
so we must have some here. */
|
||||
|
||||
int *
|
||||
__errno_location (void)
|
||||
{
|
||||
return &errno;
|
||||
}
|
||||
|
||||
int *
|
||||
__h_errno_location (void)
|
||||
{
|
||||
return &h_errno;
|
||||
}
|
||||
|
||||
struct __res_state *
|
||||
__res_state (void)
|
||||
{
|
||||
return &_res;
|
||||
}
|
||||
|
||||
#endif
|
34
linuxthreads/libc-tsd.c
Normal file
34
linuxthreads/libc-tsd.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* Special hack used to build link-time libc.so object for linking libpthread.
|
||||
Copyright (C) 2002 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
|
||||
modify it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <tls.h>
|
||||
|
||||
#if ! USE___THREAD
|
||||
|
||||
/* Special hack used to build link-time libc.so object for linking libpthread.
|
||||
See Makefile comments near libc_pic_lite.os rule for what this is for. */
|
||||
|
||||
# include <resolv.h>
|
||||
# undef _res
|
||||
|
||||
int _errno;
|
||||
int _h_errno;
|
||||
struct __res_state _res;
|
||||
|
||||
#endif
|
9
tls.make.c
Normal file
9
tls.make.c
Normal file
@ -0,0 +1,9 @@
|
||||
/* This produces a makefile fragment saying `use-thread = yes' or no. */
|
||||
|
||||
#include <tls.h>
|
||||
|
||||
#if USE___THREAD
|
||||
@@@ use-thread = yes @@@
|
||||
#else
|
||||
@@@ use-thread = no @@@
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user