This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't export *xstat64 from ld.so


On Thu, Jan 31, 2002 at 04:35:31PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> The following patch moves internal glibc symbols to GLIBC_PRIVATE symbol
> version. Glibc bootstrap is still running, I'm posting this just to hear
> feedback if you find any symbols which aren't actually private but are
> marked so, or if you come up with symbols which aren't marked as private by
> this patch although they are.

There is a problem, since there are no more @GLIBC_2.2 symbols in ld.so,
but fxstat64.c and xstat64.c on i386-linux comes with __xstat64@@GLIBC_2.2
and __xstat64@GLIBC_2.1, which is not something the linker is happy about
(well, doesn't link ld.so).
IMHO it is a bug that ld.so actually exports *xstat64, it shouldn't (and
didn't used to 2 years ago).
Here is a patch (with which + GLIBC_PRIVATE patch glibc bootstrapped):

2002-01-31  Jakub Jelinek  <jakub@redhat.com>

	* elf/Makefile (rtld-routines): Add dl-xstat64, dl-fxstat64.
	* elf/dl-xstat64.c: New file.
	* elf/dl-fxstat64.c: New file.
	* sysdeps/unix/sysv/linux/fxstat64.c: If RTLD_STAT64 is defined,
	don't export __fxstat64 at multiple versions.
	* sysdeps/unix/sysv/linux/lxstat64.c: Similarly.
	* sysdeps/unix/sysv/linux/xstat64.c: Similarly.

--- libc/elf/Makefile.jj	Wed Jan 30 18:40:00 2002
+++ libc/elf/Makefile	Thu Jan 31 19:10:50 2002
@@ -37,7 +37,8 @@ elide-routines.os = $(all-dl-routines) d
 
 # 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-xstat64 dl-fxstat64
 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
 
 distribute	:= $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
--- libc/elf/dl-xstat64.c.jj	Thu Jan 31 18:41:11 2002
+++ libc/elf/dl-xstat64.c	Thu Jan 31 18:43:25 2002
@@ -0,0 +1,25 @@
+/* Dynamic linker's private version of __xstat64.
+   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; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This special file is needed because some xstat64.c implementations
+   use versioning for __xstat64 and we need to keep it local to
+   the dynamic linker.  */
+
+#define RTLD_STAT64
+#include <xstat64.c>
--- libc/elf/dl-fxstat64.c.jj	Thu Jan 31 18:41:11 2002
+++ libc/elf/dl-fxstat64.c	Thu Jan 31 18:43:49 2002
@@ -0,0 +1,25 @@
+/* Dynamic linker's private version of __fxstat64.
+   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; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This special file is needed because some fxstat64.c implementations
+   use versioning for __fxstat64 and we need to keep it local to
+   the dynamic linker.  */
+
+#define RTLD_STAT64
+#include <fxstat64.c>
--- libc/sysdeps/unix/sysv/linux/fxstat64.c.jj	Thu Aug 23 18:50:44 2001
+++ libc/sysdeps/unix/sysv/linux/fxstat64.c	Thu Jan 31 19:13:41 2002
@@ -1,5 +1,5 @@
 /* fxstat64 using old-style Unix fstat system call.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,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
@@ -85,11 +85,16 @@ ___fxstat64 (int vers, int fd, struct st
 #endif
 }
 
-#include <shlib-compat.h>
+#ifndef RTLD_STAT64
+# include <shlib-compat.h>
 
 versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
 
-#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
 strong_alias (___fxstat64, __old__fxstat64)
 compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
+# endif
+
+#else
+strong_alias (___fxstat64, __fxstat64);
 #endif
--- libc/sysdeps/unix/sysv/linux/lxstat64.c.jj	Thu Aug 23 18:50:44 2001
+++ libc/sysdeps/unix/sysv/linux/lxstat64.c	Thu Jan 31 19:12:46 2002
@@ -1,5 +1,5 @@
 /* lxstat64 using old-style Unix lstat system call.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,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
@@ -87,11 +87,16 @@ ___lxstat64 (int vers, const char *name,
 #endif
 }
 
-#include <shlib-compat.h>
+#ifndef RTLD_STAT64
+# include <shlib-compat.h>
 
 versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
 
-#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
 strong_alias (___lxstat64, __old__lxstat64)
 compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1);
+# endif
+
+#else
+strong_alias (___lxstat64, __lxstat64);
 #endif
--- libc/sysdeps/unix/sysv/linux/xstat64.c.jj	Thu Aug 23 18:50:47 2001
+++ libc/sysdeps/unix/sysv/linux/xstat64.c	Thu Jan 31 19:13:15 2002
@@ -1,5 +1,5 @@
 /* xstat64 using old-style Unix stat system call.
-   Copyright (C) 1991,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1991,95,96,97,98,99,2000,01,02 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
@@ -91,11 +91,16 @@ ___xstat64 (int vers, const char *name, 
 #endif
 }
 
-#include <shlib-compat.h>
+#ifndef RTLD_STAT64
+# include <shlib-compat.h>
 
 versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
 
-#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
 strong_alias (___xstat64, __old__xstat64)
 compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1);
+# endif
+
+#else
+strong_alias (___xstat64, __xstat64);
 #endif


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]