2004-10-01 H.J. Lu * 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