* [PATCH] .text.compat markings
2004-03-10 9:36 .text.compat Ulrich Drepper
@ 2004-03-10 10:55 ` Jakub Jelinek
2004-03-10 19:29 ` Ulrich Drepper
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2004-03-10 10:55 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: GNU libc hacker
Hi!
On Wed, Mar 10, 2004 at 01:35:36AM -0800, Ulrich Drepper wrote:
> I just checked in some changes which move the compatibility code in libc
> into its own section, .text.compat. The linker scripts will add the new
> section at the end of the .text section.
>
> The benefit is, of course, to move hopefully rarely used code out of the
> usual body of code. Currently these are about 13k on x86. It has the
> potential to improve paging behavior, maybe even icache usage.
>
> Anyway, I looked through x86 only so far. Other archs with compat
> symbols which are not used by x86 need some work done. Just add the
> attribute_compat_text_section macro.
I've done some grepping and changed what I found.
powerpc64 *context.S are not done, since there .section .text is in
the ENTRY macro, so it would need further macro surgery.
2004-03-10 Jakub Jelinek <jakub@redhat.com>
* include/libc-symbols.h [__ASSEMBLY__] (compat_text_section,
compat_data_section): Define.
* sysdeps/unix/sysv/linux/alpha/adjtime.c (ADJTIME): Add
attribute_compat_text_section.
* sysdeps/unix/sysv/linux/alpha/wordexp.c (__old_wordexp): Likewise.
* sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob,
__old_globfree): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/chown.c (__chown_is_lchown):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c
(__posix_fadvise64_l32): Likewise.
* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c
(__posix_fadvise64_l32): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c (__old_semctl):
Likewise.
* sysdeps/unix/sysv/linux/semctl.c (__old_semctl): Likewise.
* sysdeps/unix/sysv/linux/posix_fadvise64.c (__posix_fadvise64_l32):
Likewise.
* sysdeps/unix/sysv/linux/shmctl.c (__old_shmctl): Likewise.
* hurd/compat-20.c (_hurd_proc_init_compat_20): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
(__swapcontext, __novec_swapcontext): Use END instead of PSEUDO_END.
(__novec_swapcontext, __swapcontext_stub): Add compat_text_section.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
(__makecontext_stub): Likewise.
(__novec_makecontext): Likewise. Fix name in END () to match
function name.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
(__setcontext): Use END instead of PSEUDO_END.
(__novec_setcontext): Add compat_text_section. Use END instead of
PSEUDO_END, fix the name in END () to match function name.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
(__getcontext, __novec_getcontext): Use END instead of PSEUDO_END.
(__novec_getcontext, __getcontext_stub): Add compat_text_section.
--- libc/sysdeps/unix/sysv/linux/alpha/adjtime.c.jj 2004-01-27 15:44:26.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/alpha/adjtime.c 2004-03-10 11:01:11.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2002, 2003, 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
@@ -58,7 +58,7 @@ struct timex32 {
#define TIMEVAL timeval32
#define TIMEX timex32
-#define ADJTIME __adjtime_tv32
+#define ADJTIME attribute_compat_text_section __adjtime_tv32
#define ADJTIMEX(x) INLINE_SYSCALL (old_adjtimex, 1, x)
#define ADJTIMEX32(x) INLINE_SYSCALL (old_adjtimex, 1, x)
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
@@ -72,7 +72,9 @@ LINKAGE int ADJTIME (const struct TIMEVA
#include <sysdeps/unix/sysv/linux/adjtime.c>
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
-int __adjtimex_tv32 (struct timex32 *tx) { return ADJTIMEX (tx); }
+int
+attribute_compat_text_section
+__adjtimex_tv32 (struct timex32 *tx) { return ADJTIMEX (tx); }
strong_alias (__adjtimex_tv32, __adjtimex_tv32_1);
strong_alias (__adjtimex_tv32, __adjtimex_tv32_2);
compat_symbol (libc, __adjtimex_tv32_1, __adjtimex, GLIBC_2_0);
--- libc/sysdeps/unix/sysv/linux/alpha/wordexp.c.jj 2001-07-06 06:56:13.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/alpha/wordexp.c 2004-03-10 11:01:40.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 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
@@ -38,6 +38,7 @@ typedef struct
int
+attribute_compat_text_section
__old_wordexp (const char *words, old_wordexp_t *pwordexp, int flags)
{
wordexp_t we;
--- libc/sysdeps/unix/sysv/linux/alpha/oldglob.c.jj 2001-07-06 06:56:13.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/alpha/oldglob.c 2004-03-10 11:01:02.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 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
@@ -44,6 +44,7 @@ typedef struct
int
+attribute_compat_text_section
__old_glob (const char *pattern, int flags,
int (*errfunc) (const char *, int),
old_glob_t *pglob)
@@ -82,6 +83,7 @@ compat_symbol (libc, __old_glob, glob, G
/* Free storage allocated in PGLOB by a previous `glob' call. */
void
+attribute_compat_text_section
__old_globfree (old_glob_t *pglob)
{
glob_t correct;
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/chown.c.jj 2003-09-03 13:10:52.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/chown.c 2004-03-10 11:03:34.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 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
@@ -97,6 +97,7 @@ __real_chown (const char *file, uid_t ow
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
/* Compiling for compatibiity. */
int
+attribute_compat_text_section
__chown_is_lchown (const char *file, uid_t owner, gid_t group)
{
return __lchown (file, owner, group);
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c.jj 2003-12-06 01:12:16.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c 2004-03-10 11:02:28.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -78,6 +78,7 @@ __posix_fadvise64_l64 (int fd, off64_t o
#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
int
+attribute_compat_text_section
__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
{
return __posix_fadvise64_l64 (fd, offset, len, advise);
--- libc/sysdeps/unix/sysv/linux/msgctl.c.jj 2002-07-20 03:09:37.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/msgctl.c 2004-03-10 11:16:00.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000, 2002, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -55,6 +56,7 @@ int __new_msgctl (int, int, struct msqid
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
+attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, CHECK_1 (buf));
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S.jj 2004-03-08 12:02:27.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S 2004-03-10 11:29:12.386908792 +0100
@@ -467,12 +467,13 @@ L(do_sigret):
sc
/* NOTREACHED */
-PSEUDO_END(__swapcontext)
+END(__swapcontext)
versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+ compat_text_section
ENTRY(__novec_swapcontext)
/* Save the current context */
addi r3,r3,_UC_REG_SPACE
@@ -682,7 +683,8 @@ L(novec_do_sigret):
sc
/* NOTREACHED */
-PSEUDO_END(__novec_swapcontext)
+END(__novec_swapcontext)
+ .previous
compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
@@ -693,10 +695,12 @@ compat_symbol (libc, __novec_swapcontext
#define _ERRNO_H 1
#include <bits/errno.h>
+ compat_text_section
ENTRY (__swapcontext_stub)
li r3,ENOSYS
b JUMPTARGET(__syscall_error)
- END (__swapcontext_stub)
+END (__swapcontext_stub)
+ .previous
compat_symbol (libc, __swapcontext_stub, swapcontext, GLIBC_2_1)
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S.jj 2004-01-27 15:44:26.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2004-03-10 11:42:43.753521666 +0100
@@ -111,6 +111,7 @@ versioned_symbol (libc, __makecontext, m
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+ compat_text_section
ENTRY(__novec_makecontext)
/* Set up the first 7 args to the function in its registers */
addi r11,r3,_UC_REG_SPACE
@@ -191,7 +192,8 @@ L(novec_exitcode):
4: bl HIDDEN_JUMPTARGET(exit)
b 4b
-END(__makecontext)
+END(__novec_makecontext)
+ .previous
compat_symbol (libc, __novec_makecontext, makecontext, GLIBC_2_3_3)
#endif
@@ -201,10 +203,12 @@ compat_symbol (libc, __novec_makecontext
#define _ERRNO_H 1
#include <bits/errno.h>
+ compat_text_section
ENTRY (__makecontext_stub)
li r3,ENOSYS
b JUMPTARGET(__syscall_error)
- END (__makecontext_stub)
+END (__makecontext_stub)
+ .previous
compat_symbol (libc, __makecontext_stub, makecontext, GLIBC_2_1)
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S.jj 2004-03-08 12:02:26.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S 2004-03-10 11:42:15.871517897 +0100
@@ -261,12 +261,13 @@ L(do_sigret):
sc
/* NOTREACHED */
-PSEUDO_END (__setcontext)
+END (__setcontext)
versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+ compat_text_section
ENTRY(__novec_setcontext)
mflr r0
stwu r1,-16(r1)
@@ -388,7 +389,8 @@ L(novec_do_sigret):
sc
/* NOTREACHED */
-PSEUDO_END (__setcontext)
+END (__novec_setcontext)
+ .previous
compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
@@ -399,10 +401,12 @@ compat_symbol (libc, __novec_setcontext,
#define _ERRNO_H 1
#include <bits/errno.h>
+ compat_text_section
ENTRY (__setcontext_stub)
li r3,ENOSYS
b JUMPTARGET(__syscall_error)
- END (__setcontext_stub)
+END (__setcontext_stub)
+ .previous
compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_1)
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S.jj 2004-03-08 12:02:26.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S 2004-03-10 11:29:27.057280095 +0100
@@ -244,12 +244,13 @@ L(no_vec):
addi r1,r1,16
mtlr r0
blr
-PSEUDO_END(__getcontext)
+END(__getcontext)
versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+ compat_text_section
ENTRY(__novec_getcontext)
/*
* Since we are not attempting to save the altivec registers,
@@ -355,7 +356,8 @@ ENTRY(__novec_getcontext)
addi r1,r1,16
mtlr r0
blr
-PSEUDO_END(__novec_getcontext)
+END(__novec_getcontext)
+ .previous
compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
@@ -366,10 +368,12 @@ compat_symbol (libc, __novec_getcontext,
#define _ERRNO_H 1
#include <bits/errno.h>
+ compat_text_section
ENTRY (__getcontext_stub)
li r3,ENOSYS
b JUMPTARGET(__syscall_error)
- END (__getcontext_stub)
+END (__getcontext_stub)
+ .previous
compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c.jj 2003-09-02 02:39:37.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c 2004-03-10 11:05:27.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -65,6 +65,7 @@ __posix_fadvise64_l64 (int fd, off64_t o
#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
int
+attribute_compat_text_section
__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
{
return __posix_fadvise64_l64 (fd, offset, len, advise);
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c.jj 2003-08-29 12:22:59.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c 2004-03-10 11:06:33.000000000 +0100
@@ -1,5 +1,6 @@
/* Semctl for architectures where word sized unions are passed indirectly
- Copyright (C) 1995,1997,1998,2000,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 1998, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -72,6 +73,7 @@ int __new_semctl (int semid, int semnum,
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
+attribute_compat_text_section
__old_semctl (int semid, int semnum, int cmd, ...)
{
union semun arg;
--- libc/sysdeps/unix/sysv/linux/semctl.c.jj 2003-08-06 20:36:17.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/semctl.c 2004-03-10 11:08:33.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -63,6 +64,7 @@ int __new_semctl (int semid, int semnum,
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
+attribute_compat_text_section
__old_semctl (int semid, int semnum, int cmd, ...)
{
union semun arg;
--- libc/sysdeps/unix/sysv/linux/posix_fadvise64.c.jj 2003-09-02 11:11:04.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/posix_fadvise64.c 2004-03-10 11:16:11.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 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
@@ -69,6 +69,7 @@ __posix_fadvise64_l64 (int fd, off64_t o
#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
int
+attribute_compat_text_section
__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
{
return __posix_fadvise64_l64 (fd, offset, len, advise);
--- libc/sysdeps/unix/sysv/linux/shmctl.c.jj 2003-08-06 20:36:17.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/shmctl.c 2004-03-10 11:16:27.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -62,6 +63,7 @@ int __new_shmctl (int, int, struct shmid
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
+attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid,
--- libc/include/libc-symbols.h.jj 2004-03-10 10:31:58.000000000 +0100
+++ libc/include/libc-symbols.h 2004-03-10 11:25:08.461615665 +0100
@@ -761,9 +761,14 @@ for linking")
/* Move compatibility symbols out of the way by placing them all in a
special section. */
-#define attribute_compat_text_section \
+#ifndef __ASSEMBLER__
+# define attribute_compat_text_section \
__attribute__ ((section (".text.compat")))
-#define attribute_compat_data_section \
+# define attribute_compat_data_section \
__attribute__ ((section (".data.compat")))
+#else
+# define compat_text_section .section ".text.compat", "ax";
+# define compat_data_section .section ".data.compat", "aw";
+#endif
#endif /* libc-symbols.h */
--- libc/hurd/compat-20.c.jj 2001-07-06 06:54:47.000000000 +0200
+++ libc/hurd/compat-20.c 2004-03-10 11:15:26.000000000 +0100
@@ -1,5 +1,5 @@
/* Old-versioned functions for binary compatibility with glibc-2.0.
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 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
@@ -28,6 +28,7 @@
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
void
+attribute_compat_text_section
_hurd_proc_init_compat_20 (char **argv)
{
_hurd_proc_init (argv, NULL, 0);
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread