2001-12-31  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Always use C
	locale to parse /proc/loadavg.

2001-12-31  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-conflict.c: Include sys/param.h.
	(RESOLVE_CONFLICT_FIND_MAP): Cast r_offset to ElfW(Addr).
	* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Avoid
	warning.
	(TRAMPOLINE_TEMPLATE, RTLD_START): Don't use multi-line string
	literals to avoid warnings.

	* configure.in: Don't check for gsed since we do not use it anywhere.
This commit is contained in:
Ulrich Drepper 2001-12-31 17:46:59 +00:00
parent f8580b753a
commit 84fb7c8c26
4 changed files with 226 additions and 208 deletions

View File

@ -1,7 +1,20 @@
2001-12-31 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Always use C
locale to parse /proc/loadavg.
2001-12-31 Jakub Jelinek <jakub@redhat.com>
* elf/dl-conflict.c: Include sys/param.h.
(RESOLVE_CONFLICT_FIND_MAP): Cast r_offset to ElfW(Addr).
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Avoid
warning.
(TRAMPOLINE_TEMPLATE, RTLD_START): Don't use multi-line string
literals to avoid warnings.
2001-12-31 Andreas Jaeger <aj@suse.de> 2001-12-31 Andreas Jaeger <aj@suse.de>
* configure.in: Don't check for gsed since we do not use it * configure.in: Don't check for gsed since we do not use it anywhere.
anywhere.
2001-12-25 Dmitry V. Levin <ldv@alt-linux.org> 2001-12-25 Dmitry V. Levin <ldv@alt-linux.org>

8
configure vendored
View File

@ -2277,7 +2277,7 @@ else
fi fi
for ac_prog in mawk gawk nawk awk for ac_prog in gawk mawk nawk awk
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
@ -3455,12 +3455,12 @@ else
#line 3456 "configure" #line 3456 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
main() int main()
{ {
FILE *f=fopen("conftestval", "w"); FILE *f=fopen("conftestval", "w");
if (!f) exit(1); if (!f) return(1);
fprintf(f, "%d\n", sizeof(long double)); fprintf(f, "%d\n", sizeof(long double));
exit(0); return(0);
} }
EOF EOF
if { (eval echo configure:3467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:3467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null

View File

@ -127,7 +127,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{ {
unsigned int val = 0xc39ffff7; unsigned int val = 0xc39ffff7;
unsigned int *slot, *end; unsigned int *slot, *end;
const Elf64_Rela *rela = D_PTR (l, l_info[DT_JMPREL]); const Elf64_Rela *rela = (const Elf64_Rela *)
D_PTR (l, l_info[DT_JMPREL]);
Elf64_Addr l_addr = l->l_addr; Elf64_Addr l_addr = l->l_addr;
/* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */ /* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */
@ -156,125 +157,126 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name, IMB) \ #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name, IMB) \
extern void tramp_name (void); \ extern void tramp_name (void); \
asm ( "\ asm ( "\
.globl " #tramp_name " .globl " #tramp_name " \n\
.ent " #tramp_name " .ent " #tramp_name " \n\
" #tramp_name ": " #tramp_name ": \n\
lda $sp, -44*8($sp) lda $sp, -44*8($sp) \n\
.frame $sp, 44*8, $26 .frame $sp, 44*8, $26 \n\
/* Preserve all integer registers that C normally doesn't. */ /* Preserve all integer registers that C normally \n\
stq $26, 0*8($sp) doesn't. */ \n\
stq $0, 1*8($sp) stq $26, 0*8($sp) \n\
stq $1, 2*8($sp) stq $0, 1*8($sp) \n\
stq $2, 3*8($sp) stq $1, 2*8($sp) \n\
stq $3, 4*8($sp) stq $2, 3*8($sp) \n\
stq $4, 5*8($sp) stq $3, 4*8($sp) \n\
stq $5, 6*8($sp) stq $4, 5*8($sp) \n\
stq $6, 7*8($sp) stq $5, 6*8($sp) \n\
stq $7, 8*8($sp) stq $6, 7*8($sp) \n\
stq $8, 9*8($sp) stq $7, 8*8($sp) \n\
stq $16, 10*8($sp) stq $8, 9*8($sp) \n\
stq $17, 11*8($sp) stq $16, 10*8($sp) \n\
stq $18, 12*8($sp) stq $17, 11*8($sp) \n\
stq $19, 13*8($sp) stq $18, 12*8($sp) \n\
stq $20, 14*8($sp) stq $19, 13*8($sp) \n\
stq $21, 15*8($sp) stq $20, 14*8($sp) \n\
stq $22, 16*8($sp) stq $21, 15*8($sp) \n\
stq $23, 17*8($sp) stq $22, 16*8($sp) \n\
stq $24, 18*8($sp) stq $23, 17*8($sp) \n\
stq $25, 19*8($sp) stq $24, 18*8($sp) \n\
stq $29, 20*8($sp) stq $25, 19*8($sp) \n\
stt $f0, 21*8($sp) stq $29, 20*8($sp) \n\
stt $f1, 22*8($sp) stt $f0, 21*8($sp) \n\
stt $f10, 23*8($sp) stt $f1, 22*8($sp) \n\
stt $f11, 24*8($sp) stt $f10, 23*8($sp) \n\
stt $f12, 25*8($sp) stt $f11, 24*8($sp) \n\
stt $f13, 26*8($sp) stt $f12, 25*8($sp) \n\
stt $f14, 27*8($sp) stt $f13, 26*8($sp) \n\
stt $f15, 28*8($sp) stt $f14, 27*8($sp) \n\
stt $f16, 29*8($sp) stt $f15, 28*8($sp) \n\
stt $f17, 30*8($sp) stt $f16, 29*8($sp) \n\
stt $f18, 31*8($sp) stt $f17, 30*8($sp) \n\
stt $f19, 32*8($sp) stt $f18, 31*8($sp) \n\
stt $f20, 33*8($sp) stt $f19, 32*8($sp) \n\
stt $f21, 34*8($sp) stt $f20, 33*8($sp) \n\
stt $f22, 35*8($sp) stt $f21, 34*8($sp) \n\
stt $f23, 36*8($sp) stt $f22, 35*8($sp) \n\
stt $f24, 37*8($sp) stt $f23, 36*8($sp) \n\
stt $f25, 38*8($sp) stt $f24, 37*8($sp) \n\
stt $f26, 39*8($sp) stt $f25, 38*8($sp) \n\
stt $f27, 40*8($sp) stt $f26, 39*8($sp) \n\
stt $f28, 41*8($sp) stt $f27, 40*8($sp) \n\
stt $f29, 42*8($sp) stt $f28, 41*8($sp) \n\
stt $f30, 43*8($sp) stt $f29, 42*8($sp) \n\
.mask 0x27ff01ff, -44*8 stt $f30, 43*8($sp) \n\
.fmask 0xfffffc03, -(44-21)*8 .mask 0x27ff01ff, -44*8 \n\
/* Set up our $gp */ .fmask 0xfffffc03, -(44-21)*8 \n\
br $gp, .+4 /* Set up our $gp */ \n\
ldgp $gp, 0($gp) br $gp, .+4 \n\
.prologue 0 ldgp $gp, 0($gp) \n\
/* Set up the arguments for fixup: */ .prologue 0 \n\
/* $16 = link_map out of plt0 */ /* Set up the arguments for fixup: */ \n\
/* $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 */ /* $16 = link_map out of plt0 */ \n\
/* $18 = return address */ /* $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 */\n\
subq $28, $27, $17 /* $18 = return address */ \n\
ldq $16, 8($27) subq $28, $27, $17 \n\
subq $17, 20, $17 ldq $16, 8($27) \n\
mov $26, $18 subq $17, 20, $17 \n\
addq $17, $17, $17 mov $26, $18 \n\
/* Do the fixup */ addq $17, $17, $17 \n\
bsr $26, " ASM_ALPHA_NG_SYMBOL_PREFIX #fixup_name "..ng /* Do the fixup */ \n\
/* Move the destination address into position. */ bsr $26, " ASM_ALPHA_NG_SYMBOL_PREFIX #fixup_name "..ng\n\
mov $0, $27 /* Move the destination address into position. */ \n\
/* Restore program registers. */ mov $0, $27 \n\
ldq $26, 0*8($sp) /* Restore program registers. */ \n\
ldq $0, 1*8($sp) ldq $26, 0*8($sp) \n\
ldq $1, 2*8($sp) ldq $0, 1*8($sp) \n\
ldq $2, 3*8($sp) ldq $1, 2*8($sp) \n\
ldq $3, 4*8($sp) ldq $2, 3*8($sp) \n\
ldq $4, 5*8($sp) ldq $3, 4*8($sp) \n\
ldq $5, 6*8($sp) ldq $4, 5*8($sp) \n\
ldq $6, 7*8($sp) ldq $5, 6*8($sp) \n\
ldq $7, 8*8($sp) ldq $6, 7*8($sp) \n\
ldq $8, 9*8($sp) ldq $7, 8*8($sp) \n\
ldq $16, 10*8($sp) ldq $8, 9*8($sp) \n\
ldq $17, 11*8($sp) ldq $16, 10*8($sp) \n\
ldq $18, 12*8($sp) ldq $17, 11*8($sp) \n\
ldq $19, 13*8($sp) ldq $18, 12*8($sp) \n\
ldq $20, 14*8($sp) ldq $19, 13*8($sp) \n\
ldq $21, 15*8($sp) ldq $20, 14*8($sp) \n\
ldq $22, 16*8($sp) ldq $21, 15*8($sp) \n\
ldq $23, 17*8($sp) ldq $22, 16*8($sp) \n\
ldq $24, 18*8($sp) ldq $23, 17*8($sp) \n\
ldq $25, 19*8($sp) ldq $24, 18*8($sp) \n\
ldq $29, 20*8($sp) ldq $25, 19*8($sp) \n\
ldt $f0, 21*8($sp) ldq $29, 20*8($sp) \n\
ldt $f1, 22*8($sp) ldt $f0, 21*8($sp) \n\
ldt $f10, 23*8($sp) ldt $f1, 22*8($sp) \n\
ldt $f11, 24*8($sp) ldt $f10, 23*8($sp) \n\
ldt $f12, 25*8($sp) ldt $f11, 24*8($sp) \n\
ldt $f13, 26*8($sp) ldt $f12, 25*8($sp) \n\
ldt $f14, 27*8($sp) ldt $f13, 26*8($sp) \n\
ldt $f15, 28*8($sp) ldt $f14, 27*8($sp) \n\
ldt $f16, 29*8($sp) ldt $f15, 28*8($sp) \n\
ldt $f17, 30*8($sp) ldt $f16, 29*8($sp) \n\
ldt $f18, 31*8($sp) ldt $f17, 30*8($sp) \n\
ldt $f19, 32*8($sp) ldt $f18, 31*8($sp) \n\
ldt $f20, 33*8($sp) ldt $f19, 32*8($sp) \n\
ldt $f21, 34*8($sp) ldt $f20, 33*8($sp) \n\
ldt $f22, 35*8($sp) ldt $f21, 34*8($sp) \n\
ldt $f23, 36*8($sp) ldt $f22, 35*8($sp) \n\
ldt $f24, 37*8($sp) ldt $f23, 36*8($sp) \n\
ldt $f25, 38*8($sp) ldt $f24, 37*8($sp) \n\
ldt $f26, 39*8($sp) ldt $f25, 38*8($sp) \n\
ldt $f27, 40*8($sp) ldt $f26, 39*8($sp) \n\
ldt $f28, 41*8($sp) ldt $f27, 40*8($sp) \n\
ldt $f29, 42*8($sp) ldt $f28, 41*8($sp) \n\
ldt $f30, 43*8($sp) ldt $f29, 42*8($sp) \n\
/* Flush the Icache after having modified the .plt code. */ ldt $f30, 43*8($sp) \n\
" #IMB " /* Flush the Icache after having modified the .plt code. */\n\
/* Clean up and turn control to the destination */ " #IMB " \n\
lda $sp, 44*8($sp) /* Clean up and turn control to the destination */ \n\
jmp $31, ($27) lda $sp, 44*8($sp) \n\
jmp $31, ($27) \n\
.end " #tramp_name) .end " #tramp_name)
#ifndef PROF #ifndef PROF
@ -292,85 +294,87 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START asm ("\ #define RTLD_START asm ("\
.text .text \n\
.set at .set at \n\
.globl _start .globl _start \n\
.ent _start .ent _start \n\
_start: _start: \n\
br $gp, 0f br $gp, 0f \n\
0: ldgp $gp, 0($gp) 0: ldgp $gp, 0($gp) \n\
.prologue 0 .prologue 0 \n\
/* Pass pointer to argument block to _dl_start. */ /* Pass pointer to argument block to _dl_start. */ \n\
mov $sp, $16 mov $sp, $16 \n\
bsr $26, "ASM_ALPHA_NG_SYMBOL_PREFIX"_dl_start..ng bsr $26, "ASM_ALPHA_NG_SYMBOL_PREFIX"_dl_start..ng \n\
.end _start .end _start \n\
/* FALLTHRU */ /* FALLTHRU */ \n\
.globl _dl_start_user .globl _dl_start_user \n\
.ent _dl_start_user .ent _dl_start_user \n\
_dl_start_user: _dl_start_user: \n\
.frame $30,0,$31,0 .frame $30,0,$31,0 \n\
.prologue 0 .prologue 0 \n\
/* Save the user entry point address in s0. */ /* Save the user entry point address in s0. */ \n\
mov $0, $9 mov $0, $9 \n\
/* Store the highest stack address. */ /* Store the highest stack address. */ \n\
stq $30, __libc_stack_end stq $30, __libc_stack_end \n\
/* See if we were run as a command with the executable file /* See if we were run as a command with the executable \n\
name as an extra leading argument. */ file name as an extra leading argument. */ \n\
ldl $1, _dl_skip_args ldl $1, _dl_skip_args \n\
bne $1, $fixup_stack bne $1, $fixup_stack \n\
$fixup_stack_ret: $fixup_stack_ret: \n\
/* The special initializer gets called with the stack just /* The special initializer gets called with the stack \n\
as the application's entry point will see it; it can just as the application's entry point will see it; \n\
switch stacks if it moves these contents over. */ it can switch stacks if it moves these contents \n\
" RTLD_START_SPECIAL_INIT " over. */ \n\
/* Call _dl_init(_dl_loaded, argc, argv, envp) to run initializers. */ " RTLD_START_SPECIAL_INIT " \n\
ldq $16, _dl_loaded /* Call _dl_init(_dl_loaded, argc, argv, envp) to run \n\
ldq $17, 0($sp) initializers. */ \n\
lda $18, 8($sp) ldq $16, _dl_loaded \n\
s8addq $17, 8, $19 ldq $17, 0($sp) \n\
addq $19, $18, $19 lda $18, 8($sp) \n\
jsr $26, _dl_init s8addq $17, 8, $19 \n\
/* Pass our finalizer function to the user in $0. */ addq $19, $18, $19 \n\
lda $0, _dl_fini jsr $26, _dl_init \n\
/* Jump to the user's entry point. */ /* Pass our finalizer function to the user in $0. */ \n\
mov $9, $27 lda $0, _dl_fini \n\
jmp ($9) /* Jump to the user's entry point. */ \n\
$fixup_stack: mov $9, $27 \n\
/* Adjust the stack pointer to skip _dl_skip_args words. This jmp ($9) \n\
involves copying everything down, since the stack pointer must $fixup_stack: \n\
always be 16-byte aligned. */ /* Adjust the stack pointer to skip _dl_skip_args words.\n\
ldq $2, 0($sp) This involves copying everything down, since the \n\
ldq $5, _dl_argv stack pointer must always be 16-byte aligned. */ \n\
subq $31, $1, $6 ldq $2, 0($sp) \n\
subq $2, $1, $2 ldq $5, _dl_argv \n\
s8addq $6, $5, $5 subq $31, $1, $6 \n\
mov $sp, $4 subq $2, $1, $2 \n\
s8addq $1, $sp, $3 s8addq $6, $5, $5 \n\
stq $2, 0($sp) mov $sp, $4 \n\
stq $5, _dl_argv s8addq $1, $sp, $3 \n\
/* Copy down argv. */ stq $2, 0($sp) \n\
0: ldq $5, 8($3) stq $5, _dl_argv \n\
addq $4, 8, $4 /* Copy down argv. */ \n\
addq $3, 8, $3 0: ldq $5, 8($3) \n\
stq $5, 0($4) addq $4, 8, $4 \n\
bne $5, 0b addq $3, 8, $3 \n\
/* Copy down envp. */ stq $5, 0($4) \n\
1: ldq $5, 8($3) bne $5, 0b \n\
addq $4, 8, $4 /* Copy down envp. */ \n\
addq $3, 8, $3 1: ldq $5, 8($3) \n\
stq $5, 0($4) addq $4, 8, $4 \n\
bne $5, 1b addq $3, 8, $3 \n\
/* Copy down auxiliary table. */ stq $5, 0($4) \n\
2: ldq $5, 8($3) bne $5, 1b \n\
ldq $6, 16($3) /* Copy down auxiliary table. */ \n\
addq $4, 16, $4 2: ldq $5, 8($3) \n\
addq $3, 16, $3 ldq $6, 16($3) \n\
stq $5, -8($4) addq $4, 16, $4 \n\
stq $6, 0($4) addq $3, 16, $3 \n\
bne $5, 2b stq $5, -8($4) \n\
br $fixup_stack_ret stq $6, 0($4) \n\
.end _dl_start_user bne $5, 2b \n\
.set noat br $fixup_stack_ret \n\
.end _dl_start_user \n\
.set noat \n\
.previous"); .previous");
#ifndef RTLD_START_SPECIAL_INIT #ifndef RTLD_START_SPECIAL_INIT

View File

@ -18,9 +18,10 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <locale.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
/* Put the 1 minute, 5 minute and 15 minute load averages /* Put the 1 minute, 5 minute and 15 minute load averages
into the first NELEM elements of LOADAVG. into the first NELEM elements of LOADAVG.
@ -53,8 +54,8 @@ getloadavg (double loadavg[], int nelem)
for (i = 0; i < nelem; ++i) for (i = 0; i < nelem; ++i)
{ {
char *endp; char *endp;
loadavg[i] = strtod (p, &endp); loadavg[i] = __strtod_l (p, &endp, &_nl_C_locobj);
if (!endp || endp == p) if (endp == NULL || endp == p)
/* This should not happen. The format of /proc/loadavg /* This should not happen. The format of /proc/loadavg
must have changed. Don't return with what we have, must have changed. Don't return with what we have,
signal an error. */ signal an error. */