diff --git a/ChangeLog b/ChangeLog index 522bf1e435..98435be439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2003-09-24 Ulrich Drepper + + * sysdeps/ia64/dl-machine.h (RTLD_START): Remove setting of + __libc_stack_end. Patch by David Mosberger. + +2003-09-24 Jakub Jelinek + + * elf/Versions (ld): Export __libc_stack_end@GLIBC_2.1 instead of + __libc_stack_end@GLIBC_PRIVATE. + + * sysdeps/generic/dl-sysdep.c (DL_STACK_END): Define if not defined. + (_dl_sysdep_start): Set __libc_stack_end here. + * sysdeps/alpha/dl-machine.h (RTLD_START): Remove setting of + __libc_stack_end. + * sysdeps/arm/dl-machine.h (RTLD_START): Likewise. + * sysdeps/cris/dl-machine.h (RTLD_START): Likewise. + * sysdeps/i386/dl-machine.h (RTLD_START): Likewise. + * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. + * sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Likewise. + * sysdeps/s390/s390-64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/sh/dl-machine.h (RTLD_START): Likewise. + * sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise. + * sysdeps/ia64/dl-machine.h (DL_STACK_END): Define. + * sysdeps/sparc/sparc32/dl-machine.h (DL_STACK_END): Define. + (RTLD_START): Remove setting of __libc_stack_end. + * sysdeps/sparc/sparc64/dl-machine.h (DL_STACK_END): Define. + (RTLD_START): Remove setting of __libc_stack_end. + +2003-09-24 Ulrich Drepper + + * sysdeps/unix/sysv/linux/sys/sysmacros.h: Add gnu_dev_ prefix to + function definitions. Adjust macro expansions accordingly. + * sysdeps/unix/sysv/linux/Versions: Add gnu_dev_ prefix to major, + minor, makedev name. + * sysdeps/unix/sysv/linux/makedev.c: Likewise. + +2003-09-24 Jakub Jelinek + + * sysdeps/unix/sysv/linux/sys/sysmacros.h (major, minor, makedev): + Add __THROW. + 2003-09-24 Jakub Jelinek * nscd/Makefile (others): Add nscd before including ../Rules. diff --git a/elf/Versions b/elf/Versions index d3ed536d0f..21f8cdbd6f 100644 --- a/elf/Versions +++ b/elf/Versions @@ -36,6 +36,8 @@ ld { GLIBC_2.1 { # functions used in other libraries _dl_mcount; + # historically used by Garbage Collectors + __libc_stack_end; } GLIBC_2.3 { # runtime interface to TLS @@ -43,7 +45,7 @@ ld { } GLIBC_PRIVATE { # Those are in the dynamic linker, but used by libc.so. - __libc_enable_secure; __libc_stack_end; + __libc_enable_secure; _dl_argv; _dl_catch_error; _dl_check_map_versions; _dl_debug_printf; _dl_debug_state; _dl_dst_count; _dl_dst_substitute; _dl_init; _dl_lookup_symbol; _dl_lookup_symbol_skip; diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index b3c1eac695..6680abf379 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -319,8 +319,6 @@ _dl_start_user: \n\ .prologue 0 \n\ /* Save the user entry point address in s0. */ \n\ mov $0, $9 \n\ - /* Store the highest stack address. */ \n\ - stq $30, __libc_stack_end \n\ /* See if we were run as a command with the executable \n\ file name as an extra leading argument. */ \n\ ldl $1, _dl_skip_args($gp) !gprel \n\ diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 15de939a3c..9b1d53a0a1 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -265,10 +265,6 @@ _dl_start_user:\n\ ldr sl, .L_GET_GOT\n\ add sl, pc, sl\n\ .L_GOT_GOT:\n\ - @ Store the highest stack address\n\ - ldr r1, .L_STACK_END\n\ - ldr r1, [sl, r1]\n\ - str sp, [r1]\n\ @ See if we were run as a command with the executable file\n\ @ name as an extra leading argument.\n\ ldr r4, .L_SKIP_ARGS\n\ @@ -311,8 +307,6 @@ _dl_start_user:\n\ .word _dl_starting_up(GOT)\n\ .L_FINI_PROC:\n\ .word _dl_fini(GOT)\n\ -.L_STACK_END:\n\ - .word __libc_stack_end(GOT)\n\ .L_LOADED:\n\ .word _rtld_local(GOT)\n\ .previous\n\ diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index 206e621902..368733e73f 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -188,9 +188,6 @@ _dl_start_user:\n\ ; Point R0 at the GOT.\n\ move.d $pc,$r0\n\ sub.d .:GOTOFF,$r0\n\ - ; Remember the highest stack address.\n\ - move.d [$r0+__libc_stack_end:GOT16],$r13\n\ - move.d $sp,[$r13]\n\ ; See if we were run as a command with the executable file\n\ ; name as an extra leading argument.\n\ move.d [$r0+_dl_skip_args:GOT16],$r13\n\ diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 532da96d3a..8408e38085 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -69,6 +69,9 @@ static ElfW(auxv_t) *_dl_auxv; } while (0) #endif +#ifndef DL_STACK_END +# define DL_STACK_END(cookie) ((void *) (cookie)) +#endif ElfW(Addr) _dl_sysdep_start (void **start_argptr, @@ -98,6 +101,7 @@ _dl_sysdep_start (void **start_argptr, ElfW(Word) new_sysinfo = 0; #endif + __libc_stack_end = DL_STACK_END (start_argptr); DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ, _dl_auxv); diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 9e84e2c059..d384e6d470 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -276,17 +276,15 @@ _dl_runtime_profile:\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ - # Point %ebx at the GOT.\n\ - call 0b\n\ - addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ # Note that _dl_start gets the parameter in %eax.\n\ movl %esp, %eax\n\ - # Store the highest stack address\n\ - movl %eax, __libc_stack_end@GOTOFF(%ebx)\n\ call _dl_start\n\ _dl_start_user:\n\ # Save the user entry point address in %edi.\n\ movl %eax, %edi\n\ + # Point %ebx at the GOT.\n\ + call 0b\n\ + addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ movl _dl_skip_args@GOTOFF(%ebx), %eax\n\ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index f09fb9bae0..c0f9263bf7 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -267,6 +267,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) strong_alias (_dl_runtime_resolve, _dl_runtime_profile); #endif +/* Undo the adds out0 = 16, sp below to get at the value we want in + __libc_stack_end. */ +#define DL_STACK_END(cookie) \ + ((void *) (((long) (cookie)) - 16)) /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; @@ -318,21 +322,14 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " .save ar.pfs, r32\n" \ " .body\n" \ " { .mii\n" \ +" addl r3 = @gprel(_dl_skip_args), gp\n" \ +" adds r11 = 24, sp /* Load the address of argv. */\n" \ " /* Save the pointer to the user entry point fptr in loc2. */\n" \ " mov loc2 = ret0\n" \ -" /* Store the highest stack address. */\n" \ -" addl r2 = @ltoff(__libc_stack_end#), gp\n" \ -" addl r3 = @gprel(_dl_skip_args), gp\n" \ -" ;;\n" \ -" }\n" \ -" { .mmi\n" \ -" ld8 r2 = [r2]\n" \ -" ld4 r3 = [r3]\n" \ -" adds r11 = 24, sp /* Load the address of argv. */\n" \ " ;;\n" \ " }\n" \ " { .mii\n" \ -" st8 [r2] = sp\n" \ +" ld4 r3 = [r3]\n" \ " adds r10 = 16, sp /* Load the address of argc. */\n" \ " mov out2 = r11\n" \ " ;;\n" \ @@ -401,7 +398,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " br.call.sptk.many b0 = _dl_init_internal#\n" \ " ;;\n" \ " }\n" \ -" /* Pass our finializer function to the user,\n" \ +" /* Pass our finalizer function to the user,\n" \ " and jump to the user's entry point. */\n" \ " { .mmi\n" \ " ld8 r3 = [loc2], 8\n" \ diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 5ae53a457d..d3bc83a011 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -157,9 +157,6 @@ _start:\n\ _dl_start_user:\n\ | Save the user entry point address in %a4.\n\ move.l %d0, %a4\n\ - | Remember the highest stack address.\n\ - move.l __libc_stack_end@GOTPC(%pc), %a0\n\ - move.l %sp, (%a0)\n\ | See if we were run as a command with the executable file\n\ | name as an extra leading argument.\n\ move.l _dl_skip_args(%pc), %d0\n\ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 3b3d5bf36e..9eb04192c2 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -262,9 +262,6 @@ _dl_start_user:\n\ # Point %r12 at the GOT.\n\ l %r12,.Ladr0-.Llit(%r13)\n\ ar %r12,%r13\n\ - # Store the highest stack address\n\ - l %r1,__libc_stack_end@GOT(%r12)\n\ - st %r15, 0(%r1)\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ l %r1,_dl_skip_args@GOT12(0,%r12)\n\ diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 0e98226ad9..2d9e63a2a7 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -235,10 +235,6 @@ _dl_start_user:\n\ lgr %r8,%r2\n\ # Point %r12 at the GOT.\n\ larl %r12,_GLOBAL_OFFSET_TABLE_\n\ - # Store the highest stack address\n\ - lghi %r1,__libc_stack_end@GOT\n\ - lg %r1,0(%r1,%r12)\n\ - stg %r15, 0(%r1)\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ lghi %r1,_dl_skip_args@GOT\n\ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 5403c3c62d..304fbf98f7 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -334,11 +334,7 @@ _dl_start_user:\n\ add r0,r12\n\ .align 2\n\ 1: .long _GLOBAL_OFFSET_TABLE_\n\ -2: ! Store the highest stack address\n\ - mov.l .L_stack_end,r0\n\ - mov.l @(r0,r12),r0\n\ - mov.l r15,@r0\n\ - ! See if we were run as a command with the executable file\n\ +2: ! See if we were run as a command with the executable file\n\ ! name as an extra leading argument.\n\ mov.l .L_dl_skip_args,r0\n\ mov.l @(r0,r12),r0\n\ @@ -381,8 +377,6 @@ _dl_start_user:\n\ .align 2\n\ .L_dl_start:\n\ .long _dl_start@PLT\n\ -.L_stack_end:\n\ - .long __libc_stack_end@GOT\n\ .L_dl_skip_args:\n\ .long _dl_skip_args@GOT\n\ .L_dl_init:\n\ diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index f43b4788ef..cd409ae57c 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -248,6 +248,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) /* The SPARC overlaps DT_RELA and DT_PLTREL. */ #define ELF_MACHINE_PLTREL_OVERLAP 1 +/* Undo the sub %sp, 6*4, %sp; add %sp, 22*4, %o0 below to get at the + value we want in __libc_stack_end. */ +#define DL_STACK_END(cookie) \ + ((void *) (((long) (cookie)) - (22 - 6) * 4)) + /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ @@ -274,16 +279,10 @@ _dl_start_user:\n\ add %l7, %o7, %l7\n\ /* Save the user entry point address in %l0 */\n\ mov %o0, %l0\n\ - /* Store the highest stack address. */\n\ - sethi %hi(__libc_stack_end), %g2\n\ - or %g2, %lo(__libc_stack_end), %g2\n\ - ld [%l7 + %g2], %l1\n\ - sethi %hi(_dl_skip_args), %g2\n\ - add %sp, 6*4, %l2\n\ - or %g2, %lo(_dl_skip_args), %g2\n\ - st %l2, [%l1]\n\ /* See if we were run as a command with the executable file name as an\n\ extra leading argument. If so, adjust the contents of the stack. */\n\ + sethi %hi(_dl_skip_args), %g2\n\ + or %g2, %lo(_dl_skip_args), %g2\n\ ld [%l7+%g2], %i0\n\ ld [%i0], %i0\n\ tst %i0\n\ diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 5d87b4cb67..ad27e732bf 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -666,6 +666,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) /* The PLT uses Elf64_Rela relocs. */ #define elf_machine_relplt elf_machine_rela +/* Undo the sub %sp, 6*8, %sp; add %sp, STACK_BIAS + 22*8, %o0 below + to get at the value we want in __libc_stack_end. */ +#define DL_STACK_END(cookie) \ + ((void *) (((long) (cookie)) - (22 - 6) * 8 - STACK_BIAS)) + /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ @@ -694,20 +699,14 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) "1: call 11f\n" \ " sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n" \ "11: or %l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n" \ -" /* Store the highest stack address. */\n" \ -" sethi %hi(__libc_stack_end), %g5\n" \ +" sethi %hi(_dl_skip_args), %g5\n" \ " add %l7, %o7, %l7\n" \ -" or %g5, %lo(__libc_stack_end), %g5\n" \ +" or %g5, %lo(_dl_skip_args), %g5\n" \ " /* Save the user entry point address in %l0. */\n" \ " mov %o0, %l0\n" \ -" ldx [%l7 + %g5], %l1\n" \ -" sethi %hi(_dl_skip_args), %g5\n" \ -" add %sp, 6*8, %l2\n" \ " /* See if we were run as a command with the executable file name as an\n" \ " extra leading argument. If so, we must shift things around since we\n" \ " must keep the stack doubleword aligned. */\n" \ -" or %g5, %lo(_dl_skip_args), %g5\n" \ -" stx %l2, [%l1]\n" \ " ldx [%l7 + %g5], %i0\n" \ " ld [%i0], %i0\n" \ " brz,pt %i0, 2f\n" \ diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 3920f02e0f..6a60315ee4 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -110,7 +110,7 @@ libc { epoll_create; epoll_ctl; epoll_wait; } GLIBC_2.3.3 { - major; minor; makedev; + gnu_dev_major; gnu_dev_minor; gnu_dev_makedev; } GLIBC_PRIVATE { # needed by libpthread. diff --git a/sysdeps/unix/sysv/linux/makedev.c b/sysdeps/unix/sysv/linux/makedev.c index 4708e6d419..93b7012da5 100644 --- a/sysdeps/unix/sysv/linux/makedev.c +++ b/sysdeps/unix/sysv/linux/makedev.c @@ -21,19 +21,19 @@ #include unsigned int -major (unsigned long long int dev) +gnu_dev_major (unsigned long long int dev) { return ((dev >> 8) & 0xfff) | ((unsigned int) (dev >> 32) & ~0xfff); } unsigned int -minor (unsigned long long int dev) +gnu_dev_minor (unsigned long long int dev) { return (dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff); } unsigned long long int -makedev (unsigned int major, unsigned int minor) +gnu_dev_makedev (unsigned int major, unsigned int minor) { return ((minor & 0xff) | ((major & 0xfff) << 8) | (((unsigned long long int) (minor & ~0xff)) << 12) diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h index ca1e0d40dc..b3ac83b007 100644 --- a/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -26,26 +26,29 @@ not going to hack weird hacks to support the dev_t representation they need. */ #ifdef __GLIBC_HAVE_LONG_LONG -extern unsigned int inline major (unsigned long long int __dev) __THROW; -extern unsigned int inline minor (unsigned long long int __dev) __THROW; -extern unsigned long long int inline makedev (unsigned int __major, - unsigned int __minor) __THROW; +extern unsigned int inline gnu_dev_major (unsigned long long int __dev) + __THROW; +extern unsigned int inline gnu_dev_minor (unsigned long long int __dev) + __THROW; +extern unsigned long long int inline gnu_dev_makedev (unsigned int __major, + unsigned int __minor) + __THROW; # if defined __GNUC__ && __GNUC__ >= 2 extern inline unsigned int -major (unsigned long long int __dev) +gnu_dev_major (unsigned long long int __dev) __THROW { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } extern inline unsigned int -minor (unsigned long long int __dev) +gnu_dev_minor (unsigned long long int __dev) __THROW { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } extern inline unsigned long long int -makedev (unsigned int __major, unsigned int __minor) +gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) @@ -54,11 +57,10 @@ makedev (unsigned int __major, unsigned int __minor) # endif -/* Historically the three symbols were macros. In case some programs - use #ifdef to check for definition provide some dummy macros. */ -# define major(dev) major (dev) -# define minor(dev) minor (dev) -# define makedev(maj, min) makedev (maj, min) +/* Access the functions with their traditional names. */ +# define major(dev) gnu_dev_major (dev) +# define minor(dev) gnu_dev_minor (dev) +# define makedev(maj, min) gnu_dev_makedev (maj, min) #endif #endif /* sys/sysmacros.h */ diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 2c497f6942..472070c9d5 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -260,8 +260,6 @@ _dl_runtime_profile:\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ - # Store the highest stack address\n\ - movq %rsp, __libc_stack_end(%rip)\n\ movq %rsp, %rdi\n\ call _dl_start\n\ _dl_start_user:\n\