This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
kill 15 more PLT entries
- From: Bruno Haible <bruno at clisp dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 12 Sep 2002 16:31:19 +0200 (CEST)
- Subject: kill 15 more PLT entries
Roland McGrath wrote:
> All the relocs in .rel.plt (which is the same as all R_386_JUMP_SLOT type
> relocs) are PLT entries.
Here are patches to remove 15 PLT slots from libc on FreeBSD. Also tested
on Linux.
1) __libc_free, __libc_malloc, __libc_realloc.
These are not meant to be overridden by the user, so the reloc is
unnecessary.
2002-09-12 Bruno Haible <bruno@clisp.org>
* malloc/malloc.c (__libc_free, __libc_malloc, __libc_realloc): Add
libc_hidden_proto and libc_hidden_def.
diff -r -c3 glibc-20020828.bak/malloc/malloc.c glibc-20020828/malloc/malloc.c
--- glibc-20020828.bak/malloc/malloc.c 2002-08-27 13:38:47.000000000 +0200
+++ glibc-20020828/malloc/malloc.c 2002-09-12 00:12:14.000000000 +0200
@@ -823,6 +823,9 @@
#else
Void_t* public_mALLOc();
#endif
+#ifdef _LIBC
+libc_hidden_proto (__libc_malloc)
+#endif
/*
free(Void_t* p)
@@ -840,6 +843,9 @@
#else
void public_fREe();
#endif
+#ifdef _LIBC
+libc_hidden_proto (__libc_free)
+#endif
/*
calloc(size_t n_elements, size_t element_size);
@@ -884,6 +890,9 @@
#else
Void_t* public_rEALLOc();
#endif
+#ifdef _LIBC
+libc_hidden_proto (__libc_realloc)
+#endif
/*
memalign(size_t alignment, size_t n);
@@ -5350,6 +5359,10 @@
}
weak_alias (__posix_memalign, posix_memalign)
+libc_hidden_def (__libc_free)
+libc_hidden_def (__libc_malloc)
+libc_hidden_def (__libc_realloc)
+
weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc)
weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
weak_alias (__libc_free, __free) weak_alias (__libc_free, free)
2) __sysctl is exported because some other libraries need it, but it is
not meant to be overridden.
2002-09-12 Bruno Haible <bruno@clisp.org>
* include/sys/sysctl.h (__sysctl): Add libc_hidden_proto.
* sysdeps/unix/sysv/linux/sysctl.c (__sysctl): Add libc_hidden_def.
diff -r -c3 glibc-20020828.bak/include/sys/sysctl.h glibc-20020828/include/sys/sysctl.h
--- glibc-20020828.bak/include/sys/sysctl.h 2002-08-26 15:49:37.000000000 +0200
+++ glibc-20020828/include/sys/sysctl.h 2002-09-12 02:40:55.000000000 +0200
@@ -4,6 +4,7 @@
/* Read or write system parameters (Linux, FreeBSD specific). */
extern int __sysctl (int *__name, int __nlen, void *__oldval,
size_t *__oldlenp, void *__newval, size_t __newlen);
+libc_hidden_proto (__sysctl)
#endif /* _SYS_SYSCTL_H */
diff -r -c3 glibc-20020828.bak/sysdeps/unix/sysv/linux/sysctl.c glibc-20020828/sysdeps/unix/sysv/linux/sysctl.c
--- glibc-20020828.bak/sysdeps/unix/sysv/linux/sysctl.c 2001-07-10 23:01:36.000000000 +0200
+++ glibc-20020828/sysdeps/unix/sysv/linux/sysctl.c 2002-09-12 02:40:51.000000000 +0200
@@ -1,5 +1,5 @@
/* Read or write system information. Linux version.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2000, 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
@@ -46,4 +46,5 @@
return INLINE_SYSCALL (_sysctl, 1, __ptrvalue (&args));
}
+libc_hidden_def (__sysctl)
weak_alias (__sysctl, sysctl)
3) getrlimit, setrlimit, sysconf. Here the reloc can simply be avoided by
using the unexported __ variant.
2002-09-12 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/bsd/ulimit.c (ulimit): Call __getrlimit instead of
getrlimit, __setrlimit instead of setrlimit, __sysconf instead of
sysconf.
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/ulimit.c glibc-20020828/sysdeps/unix/bsd/ulimit.c
--- glibc-20020828.bak/sysdeps/unix/bsd/ulimit.c 2001-10-20 20:12:04.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/ulimit.c 2002-09-12 01:55:10.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 96, 97, 98, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 96-98, 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
@@ -50,7 +50,7 @@
{
case UL_GETFSIZE:
/* Get limit on file size. */
- if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
+ if (__getrlimit (RLIMIT_FSIZE, &limit) == 0)
/* Convert from bytes to 512 byte units. */
result = limit.rlim_cur / 512;
break;
@@ -71,18 +71,18 @@
limit.rlim_max = newlimit * 512;
}
- result = setrlimit (RLIMIT_FSIZE, &limit);
+ result = __setrlimit (RLIMIT_FSIZE, &limit);
}
break;
case __UL_GETMAXBRK:
/* Get maximum address for `brk'. */
- if (getrlimit (RLIMIT_DATA, &limit) == 0)
+ if (__getrlimit (RLIMIT_DATA, &limit) == 0)
result = ((long int) &_etext) + limit.rlim_cur;
break;
case __UL_GETOPENMAX:
- result = sysconf (_SC_OPEN_MAX);
+ result = __sysconf (_SC_OPEN_MAX);
break;
default:
4) ioctl. This also can be avoided by using the __ version.
2002-09-12 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/bsd/gtty.c (gtty): Use __ioctl instead of ioctl.
* sysdeps/unix/bsd/stty.c (stty): Likewise.
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/gtty.c glibc-20020828/sysdeps/unix/bsd/gtty.c
--- glibc-20020828.bak/sysdeps/unix/bsd/gtty.c 2001-07-10 23:01:20.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/gtty.c 2002-09-12 01:04:58.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 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
@@ -25,5 +25,5 @@
int fd;
struct sgttyb *params;
{
- return ioctl (fd, TIOCGETP, (void *) params);
+ return __ioctl (fd, TIOCGETP, (void *) params);
}
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/stty.c glibc-20020828/sysdeps/unix/bsd/stty.c
--- glibc-20020828.bak/sysdeps/unix/bsd/stty.c 2001-07-10 23:01:20.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/stty.c 2002-09-12 01:05:07.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 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
@@ -25,5 +25,5 @@
int fd;
const struct sgttyb *params;
{
- return ioctl (fd, TIOCSETP, (void *) params);
+ return __ioctl (fd, TIOCSETP, (void *) params);
}
5) passwd2des.
2002-09-12 Bruno Haible <bruno@clisp.org>
* sunrpc/xcrypt.c (passwd2des): Add libc_hidden_proto and
libc_hidden_def.
diff -r -c3 glibc-20020828.bak/sunrpc/xcrypt.c glibc-20020828/sunrpc/xcrypt.c
--- glibc-20020828.bak/sunrpc/xcrypt.c 1999-09-07 17:08:43.000000000 +0200
+++ glibc-20020828/sunrpc/xcrypt.c 2002-09-12 01:10:46.000000000 +0200
@@ -70,6 +70,9 @@
static void hex2bin (int, char *, char *) internal_function;
static void bin2hex (int, unsigned char *, char *) internal_function;
void passwd2des (char *pw, char *key);
+#ifdef _LIBC
+libc_hidden_proto (passwd2des)
+#endif
/*
* Encrypt a secret key given passwd
@@ -195,3 +198,7 @@
return -1;
}
#endif
+
+#ifdef _LIBC
+libc_hidden_def (passwd2des)
+#endif
6) revoke. This is called by unlockpt(). To avoid a reloc, introduce an
unexported variant __revoke.
2002-09-12 Bruno Haible <bruno@clisp.org>
* include/unistd.h (__revoke): New declaration.
* sysdeps/generic/revoke.c (__revoke): Renamed from revoke.
(revoke): New alias.
* sysdeps/mach/hurd/revoke.c (__revoke): Renamed from revoke.
(revoke): New alias.
* sysdeps/unix/sysv/aix/revoke.c (__revoke): Renamed from revoke.
(revoke): New alias.
* sysdeps/unix/bsd/bsd4.4/syscalls.list (__revoke): New alias.
* sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of
revoke.
diff -r -c3 glibc-20020828.bak/include/unistd.h glibc-20020828/include/unistd.h
--- glibc-20020828.bak/include/unistd.h 2002-08-26 15:49:37.000000000 +0200
+++ glibc-20020828/include/unistd.h 2002-09-12 02:18:25.000000000 +0200
@@ -106,6 +106,7 @@
extern int __readlink (__const char *__path, char *__buf, size_t __len);
extern int __unlink (__const char *__name);
extern int __gethostname (char *__name, size_t __len);
+extern int __revoke (__const char *__file);
extern int __profil (unsigned short int *__sample_buffer, size_t __size,
size_t __offset, unsigned int __scale);
extern int __getdtablesize (void);
diff -r -c3 glibc-20020828.bak/sysdeps/generic/revoke.c glibc-20020828/sysdeps/generic/revoke.c
--- glibc-20020828.bak/sysdeps/generic/revoke.c 2001-07-10 23:00:29.000000000 +0200
+++ glibc-20020828/sysdeps/generic/revoke.c 2002-09-12 02:17:45.000000000 +0200
@@ -1,5 +1,5 @@
/* Revoke the access of all descriptors currently open on a file.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 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
@@ -21,11 +21,12 @@
#include <errno.h>
int
-revoke (file)
+__revoke (file)
const char *file;
{
__set_errno (ENOSYS);
return -1;
}
+weak_alias (__revoke, revoke)
stub_warning (revoke)
#include <stub-tag.h>
diff -r -c3 glibc-20020828.bak/sysdeps/mach/hurd/revoke.c glibc-20020828/sysdeps/mach/hurd/revoke.c
--- glibc-20020828.bak/sysdeps/mach/hurd/revoke.c 2001-07-10 23:00:56.000000000 +0200
+++ glibc-20020828/sysdeps/mach/hurd/revoke.c 2002-09-12 02:17:23.000000000 +0200
@@ -1,5 +1,5 @@
/* Revoke the access of all descriptors currently open on a file. Hurd version
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 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
@@ -22,7 +22,7 @@
#include <hurd.h>
int
-revoke (file_name)
+__revoke (file_name)
const char *file_name;
{
error_t err;
@@ -38,3 +38,4 @@
return __hurd_fail (err);
return 0;
}
+weak_alias (__revoke, revoke)
diff -r -c3 glibc-20020828.bak/sysdeps/unix/sysv/aix/revoke.c glibc-20020828/sysdeps/unix/sysv/aix/revoke.c
--- glibc-20020828.bak/sysdeps/unix/sysv/aix/revoke.c 2001-07-10 23:01:26.000000000 +0200
+++ glibc-20020828/sysdeps/unix/sysv/aix/revoke.c 2002-09-12 02:17:33.000000000 +0200
@@ -1,5 +1,5 @@
/* Revoke the access of all descriptors currently open on a file. AIX version.
- Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000, 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
@@ -24,7 +24,7 @@
extern int frevoke (int fdes);
int
-revoke (file)
+__revoke (file)
const char *file;
{
int fd;
@@ -39,3 +39,4 @@
return res;
}
+weak_alias (__revoke, revoke)
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/bsd4.4/syscalls.list glibc-20020828/sysdeps/unix/bsd/bsd4.4/syscalls.list
--- glibc-20020828.bak/sysdeps/unix/bsd/bsd4.4/syscalls.list 2002-08-26 15:50:05.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/bsd4.4/syscalls.list 2002-09-12 01:40:28.000000000 +0200
@@ -2,7 +2,7 @@
chflags - chflags 2 chflags
fchflags - fchflags 2 fchflags
-revoke - revoke 1 revoke
+revoke - revoke 1 __revoke revoke
setlogin - setlogin 2 setlogin
sigaltstack - sigaltstack 2 __sigaltstack sigaltstack
wait4 - wait4 4 __wait4 wait4
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/unlockpt.c glibc-20020828/sysdeps/unix/bsd/unlockpt.c
--- glibc-20020828.bak/sysdeps/unix/bsd/unlockpt.c 2001-07-10 23:01:20.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/unlockpt.c 2002-09-12 01:35:38.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
@@ -33,5 +33,5 @@
/* BSD doesn't have a lock, but it does have `revoke'. */
if (__ptsname_r (fd, buf, sizeof (buf)))
return -1;
- return revoke (buf);
+ return __revoke (buf);
}
7) sigaddset. This reloc can be avoided by using __sigaddset; the extra
checking done by sigaddset() is not needed here.
2002-09-12 Bruno Haible <bruno@clisp.org>
* sunrpc/key_call.c (key_call_keyenvoy): Call __sigaddset instead of
sigaddset.
diff -r -c3 glibc-20020828.bak/sunrpc/key_call.c glibc-20020828/sunrpc/key_call.c
--- glibc-20020828.bak/sunrpc/key_call.c 2002-08-08 11:34:34.000000000 +0200
+++ glibc-20020828/sunrpc/key_call.c 2002-09-12 01:44:04.000000000 +0200
@@ -304,7 +304,7 @@
success = 1;
sigemptyset (&mask);
- sigaddset (&mask, SIGCHLD);
+ __sigaddset (&mask, SIGCHLD);
__sigprocmask (SIG_BLOCK, &mask, &oldmask);
/*
8) tcgetattr and write. Avoid the reloc by using __tcgetattr, __write.
2002-09-12 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/bsd/tcflow.c (tcflow): Call __tcgetattr instead of
tcgetattr, and __write instead of write.
diff -r -c3 glibc-20020828.bak/sysdeps/unix/bsd/tcflow.c glibc-20020828/sysdeps/unix/bsd/tcflow.c
--- glibc-20020828.bak/sysdeps/unix/bsd/tcflow.c 2001-07-10 23:01:20.000000000 +0200
+++ glibc-20020828/sysdeps/unix/bsd/tcflow.c 2002-09-12 01:59:43.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 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
@@ -43,10 +43,10 @@
`write'. Is there another way to do this? */
struct termios attr;
unsigned char c;
- if (tcgetattr (fd, &attr) < 0)
+ if (__tcgetattr (fd, &attr) < 0)
return -1;
c = attr.c_cc[action == TCIOFF ? VSTOP : VSTART];
- if (c != _POSIX_VDISABLE && write (fd, &c, 1) < 1)
+ if (c != _POSIX_VDISABLE && __write (fd, &c, 1) < 1)
return -1;
return 0;
}
9) tr_break. This is meant as a breakpoint only.
2002-09-12 Bruno Haible <bruno@clisp.org>
* malloc/mtrace.c (tr_break): Add libc_hidden_proto and
libc_hidden_def.
diff -r -c3 glibc-20020828.bak/malloc/mtrace.c glibc-20020828/malloc/mtrace.c
--- glibc-20020828.bak/malloc/mtrace.c 2002-08-05 13:24:36.000000000 +0200
+++ glibc-20020828/malloc/mtrace.c 2002-09-12 02:04:08.000000000 +0200
@@ -78,6 +78,9 @@
tr_break. */
void tr_break __P ((void));
+#ifdef _LIBC
+libc_hidden_proto (tr_break)
+#endif
void
tr_break ()
{
@@ -319,3 +322,7 @@
__malloc_hook = tr_old_malloc_hook;
__realloc_hook = tr_old_realloc_hook;
}
+
+#ifdef _LIBC
+libc_hidden_def (tr_break)
+#endif
10) xdrstdio_create.
2002-09-12 Bruno Haible <bruno@clisp.org>
* include/rpc/xdr.h (xdrstdio_create): Add libc_hidden_proto.
* sunrpc/xdr_stdio.c (xdrstdio_create): Add libc_hidden_def.
diff -r -c3 glibc-20020828.bak/include/rpc/xdr.h glibc-20020828/include/rpc/xdr.h
--- glibc-20020828.bak/include/rpc/xdr.h 2002-03-02 04:07:59.000000000 +0100
+++ glibc-20020828/include/rpc/xdr.h 2002-09-12 02:11:13.000000000 +0200
@@ -32,3 +32,5 @@
extern bool_t xdrrec_endofrecord_internal (XDR *__xdrs, bool_t __sendnow);
extern bool_t xdrrec_skiprecord_internal (XDR *__xdrs);
extern bool_t xdrrec_eof_internal (XDR *__xdrs);
+
+libc_hidden_proto (xdrstdio_create)
diff -r -c3 glibc-20020828.bak/sunrpc/xdr_stdio.c glibc-20020828/sunrpc/xdr_stdio.c
--- glibc-20020828.bak/sunrpc/xdr_stdio.c 2002-03-02 04:08:14.000000000 +0100
+++ glibc-20020828/sunrpc/xdr_stdio.c 2002-09-12 02:11:09.000000000 +0200
@@ -192,3 +192,5 @@
return FALSE;
return TRUE;
}
+
+libc_hidden_def (xdrstdio_create)