[PATCH] glibc.spec, AC-branch, budowanie z TLS

Michal Kochanowicz michal w michal.waw.pl
Sob, 20 Lis 2004, 16:57:44 CET


Hej

Załączony patch pozwala zbudować glibc'a z --with tls. Bez niego się to
nie udaje.

http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2004-10&msgid=20041001231821.GA8657%40lucon.org

-- 
--= Michal Kochanowicz =--==--==BOFH==--==--= michal w michal.waw.pl =--
--= finger me for PGP public key or visit http://michal.waw.pl/PGP =--
--==--==--==--==--==-- Vodka. Connecting people.--==--==--==--==--==--
A chodzenie po górach SSIE!!!
-------------- następna część ---------
2004-10-01  H.J. Lu  <hongjiu.lu w intel.com>

	* elf/Makefile (rtld-routines): Add dl-errno.
	($(objpfx)librtld.map): Copy libc_pic.a to libc_pic.a, remove
	errno.os from libc_pic.a and use libc_rtld.a instead of
	libc_pic.a.
	($(objpfx)librtld.mk): Match libc_rtld.a instead of libc_pic.a.

	* elf/dl-errno.c: New file.

--- elf/Makefile.tls	2004-09-23 15:55:51.000000000 -0700
+++ elf/Makefile	2004-10-01 16:10:16.000000000 -0700
@@ -38,7 +38,8 @@ shared-only-routines += dl-caller
 
 # 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 $(dl-routines) dl-sysdep dl-environ \
+		   dl-minimal dl-errno
 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
 
 distribute	:= rtld-Rules \
@@ -229,11 +230,17 @@ $(objpfx)dl-allobjs.os: $(all-rtld-routi
 # those modules come from and builds special rtld-foo.os versions that
 # are compiled with special flags, and puts these modules into rtld-libc.a
 # for us.  Then we do the real link using rtld-libc.a instead of libc_pic.a.
+# `errno' is a special case. We don't want the one in libc_pic.a since
+# `errno' in libc_pic.a may be a TLS, but the dynamic linker doesn't
+# use TLS. The linker doesn't allow mixing TLS and non-TLS symbols.
 
 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
 	@-rm -f $@T
-	$(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
-	rm -f $@.o
+	@rm -f libc_rtld.a
+	cp $(common-objpfx)libc_pic.a $(common-objpfx)libc_rtld.a
+	$(AR) d$(verbose) $(common-objpfx)libc_rtld.a errno.os
+	$(reloc-link) -o $@.o '-Wl,-(' $(objpfx)dl-allobjs.os $(common-objpfx)libc_rtld.a -lgcc '-Wl,-)' -Wl,-Map,$@T
+	rm -f $@.o $(common-objpfx)libc_rtld.a
 	mv -f $@T $@
 
 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
@@ -242,7 +249,7 @@ $(objpfx)librtld.mk: $(objpfx)librtld.ma
 	    $< | \
 	while read lib file; do \
 	  case $$lib in \
-	  libc_pic.a) \
+	  libc_rtld.a) \
 	    LC_ALL=C fgrep -l /$$file \
 		  $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
 	    LC_ALL=C \
--- elf/dl-errno.c.tls	2004-10-01 14:57:23.000000000 -0700
+++ elf/dl-errno.c	2004-10-01 15:34:30.000000000 -0700
@@ -0,0 +1,19 @@
+/* Copyright (C) 2004 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; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.c>
-------------- następna część ---------
Index: glibc.spec
===================================================================
RCS file: /cvsroot/SPECS/glibc.spec,v
retrieving revision 1.523.2.4
diff -u -r1.523.2.4 glibc.spec
--- glibc.spec	14 Nov 2004 23:13:36 -0000	1.523.2.4
+++ glibc.spec	20 Nov 2004 15:55:36 -0000
@@ -114,7 +114,8 @@
 # PaX
 Patch30:	%{name}-pax_iconvconfig.patch
 Patch31:	%{name}-pax_dl-execstack.patch
-Patch50:	glibc-ZA_collate.patch
+Patch50:	%{name}-ZA_collate.patch
+Patch51:	%{name}-fix_tls_linkage.patch
 URL:		http://www.gnu.org/software/libc/
 BuildRequires:	automake
 BuildRequires:	binutils >= 2:2.15.90.0.3
@@ -811,6 +812,10 @@
 %patch30 -p1
 %patch31 -p1
 %patch50 -p1
+
+%if %{with tls}
+%patch51 -p0
+%endif
 
 chmod +x scripts/cpp
 


Więcej informacji o liście dyskusyjnej pld-devel-pl