diff options
Diffstat (limited to 'sysdeps')
135 files changed, 1143 insertions, 431 deletions
diff --git a/sysdeps/alpha/div_libc.h b/sysdeps/alpha/div_libc.h index 62b4470355..b731b02e25 100644 --- a/sysdeps/alpha/div_libc.h +++ b/sysdeps/alpha/div_libc.h @@ -34,6 +34,12 @@ #define RV t12 #define RA t9 +/* The secureplt format does not allow the division routines to be called + via plt; there aren't enough registers free to be clobbered. Avoid + setting the symbol type to STT_FUNC, so that the linker won't be tempted + to create a plt entry. */ +#define funcnoplt notype + /* None of these functions should use implicit anything. */ .set nomacro .set noat diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S index 408d66db00..9bac0450d0 100644 --- a/sysdeps/alpha/divl.S +++ b/sysdeps/alpha/divl.S @@ -36,7 +36,7 @@ .text .align 4 .globl __divl - .type __divl, @function + .type __divl, @funcnoplt .usepv __divl, no cfi_startproc diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S index 7f245ac056..d2ed2c5af6 100644 --- a/sysdeps/alpha/divq.S +++ b/sysdeps/alpha/divq.S @@ -43,7 +43,7 @@ .text .align 4 .globl __divq - .type __divq, @function + .type __divq, @funcnoplt .usepv __divq, no cfi_startproc diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S index fc00fa133c..f2a8a4d533 100644 --- a/sysdeps/alpha/divqu.S +++ b/sysdeps/alpha/divqu.S @@ -43,7 +43,7 @@ .text .align 4 .globl __divqu - .type __divqu, @function + .type __divqu, @funcnoplt .usepv __divqu, no cfi_startproc diff --git a/sysdeps/alpha/dl-dtprocnum.h b/sysdeps/alpha/dl-dtprocnum.h new file mode 100644 index 0000000000..67845cdd62 --- /dev/null +++ b/sysdeps/alpha/dl-dtprocnum.h @@ -0,0 +1,3 @@ +/* Number of extra dynamic section entries for this architecture. By + default there are none. */ +#define DT_THISPROCNUM DT_ALPHA_NUM diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 173a4111f8..88c357ea07 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -33,6 +33,9 @@ where the dynamic linker should not map anything. */ #define ELF_MACHINE_USER_ADDRESS_MASK 0x120000000UL +/* Translate a processor specific dynamic tag to the index in l_info array. */ +#define DT_ALPHA(x) (DT_ALPHA_##x - DT_LOPROC + DT_NUM) + /* Return nonzero iff ELF header is compatible with the running host. */ static inline int elf_machine_matches_host (const Elf64_Ehdr *ehdr) @@ -55,105 +58,74 @@ elf_machine_dynamic (void) } /* Return the run-time load address of the shared object. */ + static inline Elf64_Addr elf_machine_load_address (void) { - /* NOTE: While it is generally unfriendly to put data in the text - segment, it is only slightly less so when the "data" is an - instruction. While we don't have to worry about GLD just yet, an - optimizing linker might decide that our "data" is an unreachable - instruction and throw it away -- with the right switches, DEC's - linker will do this. What ought to happen is we should add - something to GAS to allow us access to the new GPREL_HI32/LO32 - relocation types stolen from OSF/1 3.0. */ - /* This code relies on the fact that BRADDR relocations do not - appear in dynamic relocation tables. Not that that would be very - useful anyway -- br/bsr has a 4MB range and the shared libraries - are usually many many terabytes away. */ - - Elf64_Addr dot; - long int zero_disp; - - asm("br %0, 1f\n" - "0:\n\t" - "br $0, 2f\n" - "1:\n\t" - ".section\t.data\n" - "2:\n\t" - ".quad 0b\n\t" - ".previous" - : "=r"(dot)); - - zero_disp = *(int *) dot; - zero_disp = (zero_disp << 43) >> 41; - - return dot - *(Elf64_Addr *) (dot + 4 + zero_disp); + /* This relies on the compiler using gp-relative addresses for static symbols. */ + static void *dot = ˙ + return (void *)&dot - dot; } /* Set up the loaded object described by L so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) { - Elf64_Addr plt; - extern void _dl_runtime_resolve (void); - extern void _dl_runtime_profile (void); + extern char _dl_runtime_resolve_new[] attribute_hidden; + extern char _dl_runtime_profile_new[] attribute_hidden; + extern char _dl_runtime_resolve_old[] attribute_hidden; + extern char _dl_runtime_profile_old[] attribute_hidden; + + struct pltgot { + char *resolve; + struct link_map *link; + }; + + struct pltgot *pg; + long secureplt; + char *resolve; + + if (map->l_info[DT_JMPREL] == 0 || !lazy) + return lazy; + + /* Check to see if we're using the read-only plt form. */ + secureplt = map->l_info[DT_ALPHA(PLTRO)] != 0; + + /* If the binary uses the read-only secure plt format, PG points to + the .got.plt section, which is the right place for ld.so to place + its hooks. Otherwise, PG is currently pointing at the start of + the plt; the hooks go at offset 16. */ + pg = (struct pltgot *) D_PTR (map, l_info[DT_PLTGOT]); + pg += !secureplt; + + /* This function will be called to perform the relocation. They're + not declared as functions to convince the compiler to use gp + relative relocations for them. */ + if (secureplt) + resolve = _dl_runtime_resolve_new; + else + resolve = _dl_runtime_resolve_old; - if (l->l_info[DT_JMPREL] && lazy) + if (__builtin_expect (profile, 0)) { - /* The GOT entries for the functions in the PLT have not been - filled in yet. Their initial contents are directed to the - PLT which arranges for the dynamic linker to be called. */ - plt = D_PTR (l, l_info[DT_PLTGOT]); - - /* This function will be called to perform the relocation. */ - if (__builtin_expect (profile, 0)) - { - *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile; - - if (GLRO(dl_profile) != NULL - && _dl_name_match_p (GLRO(dl_profile), l)) - { - /* This is the object we are looking for. Say that we really - want profiling and the timers are started. */ - GL(dl_profile_map) = l; - } - } + if (secureplt) + resolve = _dl_runtime_profile_new; else - *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_resolve; - - /* Identify this shared object */ - *(Elf64_Addr *)(plt + 24) = (Elf64_Addr) l; + resolve = _dl_runtime_profile_old; - /* If the first instruction of the plt entry is not - "br $28, plt0", we have to reinitialize .plt for lazy relocation. */ - if (*(unsigned int *)(plt + 32) != 0xc39ffff7) + if (GLRO(dl_profile) && _dl_name_match_p (GLRO(dl_profile), map)) { - unsigned int val = 0xc39ffff7; - unsigned int *slot, *end; - const Elf64_Rela *rela = (const Elf64_Rela *) - D_PTR (l, l_info[DT_JMPREL]); - Elf64_Addr l_addr = l->l_addr; - - /* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */ - *(unsigned long *)plt = 0xa77b000cc3600000; - *(unsigned long *)(plt + 8) = 0x6b7b000047ff041f; - slot = (unsigned int *)(plt + 32); - end = (unsigned int *)(plt + 32 - + l->l_info[DT_PLTRELSZ]->d_un.d_val / 2); - while (slot < end) - { - /* br at,.plt+0 */ - *slot = val; - *(Elf64_Addr *) rela->r_offset = (Elf64_Addr) slot - l_addr; - val -= 3; - slot += 3; - ++rela; - } + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + GL(dl_profile_map) = map; } } + pg->resolve = resolve; + pg->link = map; + return lazy; } @@ -280,7 +252,7 @@ $fixup_stack: \n\ /* Fix up the instructions of a PLT entry to invoke the function rather than the dynamic linker. */ static inline Elf64_Addr -elf_machine_fixup_plt (struct link_map *l, lookup_t t, +elf_machine_fixup_plt (struct link_map *map, lookup_t t, const Elf64_Rela *reloc, Elf64_Addr *got_addr, Elf64_Addr value) { @@ -291,10 +263,16 @@ elf_machine_fixup_plt (struct link_map *l, lookup_t t, /* Store the value we are going to load. */ *got_addr = value; + /* If this binary uses the read-only secure plt format, we're done. */ + if (map->l_info[DT_ALPHA(PLTRO)]) + return value; + + /* Otherwise we have to modify the plt entry in place to do the branch. */ + /* Recover the PLT entry address by calculating reloc's index into the .rela.plt, and finding that entry in the .plt. */ - rela_plt = (void *) D_PTR (l, l_info[DT_JMPREL]); - plte = (void *) (D_PTR (l, l_info[DT_PLTGOT]) + 32); + rela_plt = (const Elf64_Rela *) D_PTR (map, l_info[DT_JMPREL]); + plte = (Elf64_Word *) (D_PTR (map, l_info[DT_PLTGOT]) + 32); plte += 3 * (reloc - rela_plt); /* Find the displacement from the plt entry to the function. */ diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S index 42350836ef..c52efbb3bc 100644 --- a/sysdeps/alpha/dl-trampoline.S +++ b/sysdeps/alpha/dl-trampoline.S @@ -21,13 +21,202 @@ .set noat - .globl _dl_runtime_resolve - .ent _dl_runtime_resolve +.macro savei regno, offset + stq $\regno, \offset($30) + cfi_rel_offset(\regno, \offset) +.endm + +.macro savef regno, offset + stt $f\regno, \offset($30) + cfi_rel_offset(\regno+32, \offset) +.endm + + .align 4 + .globl _dl_runtime_resolve_new + .ent _dl_runtime_resolve_new + +#undef FRAMESIZE +#define FRAMESIZE 14*8 + +_dl_runtime_resolve_new: + .frame $30, FRAMESIZE, $26, 0 + .mask 0x4000000, 0 + + ldah $29, 0($27) !gpdisp!1 + lda $30, -FRAMESIZE($30) + stq $26, 0*8($30) + stq $16, 2*8($30) + + stq $17, 3*8($30) + lda $29, 0($29) !gpdisp!1 + stq $18, 4*8($30) + mov $28, $16 /* link_map from .got.plt */ + + stq $19, 5*8($30) + mov $25, $17 /* offset of reloc entry */ + stq $20, 6*8($30) + mov $26, $18 /* return address */ + + stq $21, 7*8($30) + stt $f16, 8*8($30) + stt $f17, 9*8($30) + stt $f18, 10*8($30) + + stt $f19, 11*8($30) + stt $f20, 12*8($30) + stt $f21, 13*8($30) + .prologue 2 + + bsr $26, _dl_fixup !samegp + mov $0, $27 + + ldq $26, 0*8($30) + ldq $16, 2*8($30) + ldq $17, 3*8($30) + ldq $18, 4*8($30) + ldq $19, 5*8($30) + ldq $20, 6*8($30) + ldq $21, 7*8($30) + ldt $f16, 8*8($30) + ldt $f17, 9*8($30) + ldt $f18, 10*8($30) + ldt $f19, 11*8($30) + ldt $f20, 12*8($30) + ldt $f21, 13*8($30) + lda $30, FRAMESIZE($30) + jmp $31, ($27), 0 + .end _dl_runtime_resolve_new + + .globl _dl_runtime_profile_new + .type _dl_runtime_profile_new, @function + +#undef FRAMESIZE +#define FRAMESIZE 20*8 + + /* We save the registers in a different order than desired by + .mask/.fmask, so we have to use explicit cfi directives. */ + cfi_startproc + +_dl_runtime_profile_new: + ldah $29, 0($27) !gpdisp!2 + lda $30, -FRAMESIZE($30) + savei 26, 0*8 + stq $16, 2*8($30) + + stq $17, 3*8($30) + lda $29, 0($29) !gpdisp!2 + stq $18, 4*8($30) + lda $1, FRAMESIZE($30) /* incoming sp value */ + + stq $1, 1*8($30) + stq $19, 5*8($30) + stq $20, 6*8($30) + mov $28, $16 /* link_map from .got.plt */ + + stq $21, 7*8($30) + mov $25, $17 /* offset of reloc entry */ + stt $f16, 8*8($30) + mov $26, $18 /* return address */ + + stt $f17, 9*8($30) + mov $30, $19 /* La_alpha_regs address */ + stt $f18, 10*8($30) + lda $20, 14*8($30) /* framesize address */ + + stt $f19, 11*8($30) + stt $f20, 12*8($30) + stt $f21, 13*8($30) + stq $28, 16*8($30) + stq $25, 17*8($30) + + bsr $26, _dl_profile_fixup !samegp + mov $0, $27 + + /* Discover if we're wrapping this call. */ + ldq $18, 14*8($30) + bge $18, 1f + + ldq $26, 0*8($30) + ldq $16, 2*8($30) + ldq $17, 3*8($30) + ldq $18, 4*8($30) + ldq $19, 5*8($30) + ldq $20, 6*8($30) + ldq $21, 7*8($30) + ldt $f16, 8*8($30) + ldt $f17, 9*8($30) + ldt $f18, 10*8($30) + ldt $f19, 11*8($30) + ldt $f20, 12*8($30) + ldt $f21, 13*8($30) + lda $30, FRAMESIZE($30) + jmp $31, ($27), 0 + +1: + /* Create a frame pointer and allocate a new argument frame. */ + savei 15, 15*8 + mov $30, $15 + cfi_def_cfa_register (15) + addq $18, 15, $18 + bic $18, 15, $18 + subq $30, $18, $30 + + /* Save the call destination around memcpy. */ + stq $0, 14*8($30) + + /* Copy the stack arguments into place. */ + lda $16, 0($30) + lda $17, FRAMESIZE($15) + jsr $26, memcpy + ldgp $29, 0($26) + + /* Reload the argument registers. */ + ldq $27, 14*8($30) + ldq $16, 2*8($15) + ldq $17, 3*8($15) + ldq $18, 4*8($15) + ldq $19, 5*8($15) + ldq $20, 6*8($15) + ldq $21, 7*8($15) + ldt $f16, 8*8($15) + ldt $f17, 9*8($15) + ldt $f18, 10*8($15) + ldt $f19, 11*8($15) + ldt $f20, 12*8($15) + ldt $f21, 13*8($15) + + jsr $26, ($27), 0 + ldgp $29, 0($26) + + /* Set up for call to _dl_call_pltexit. */ + ldq $16, 16*8($15) + ldq $17, 17*8($15) + stq $0, 16*8($15) + lda $18, 0($15) + stq $1, 17*8($15) + lda $19, 16*8($15) + stt $f0, 18*8($15) + stt $f1, 19*8($15) + bsr $26, _dl_call_pltexit !samegp + + mov $15, $30 + cfi_def_cfa_register (30) + ldq $26, 0($30) + ldq $15, 15*8($30) + lda $30, FRAMESIZE($30) + ret + + cfi_endproc + .size _dl_runtime_profile_new, .-_dl_runtime_profile_new + + .align 4 + .globl _dl_runtime_resolve_old + .ent _dl_runtime_resolve_old #undef FRAMESIZE #define FRAMESIZE 44*8 -_dl_runtime_resolve: +_dl_runtime_resolve_old: lda $30, -FRAMESIZE($30) .frame $30, FRAMESIZE, $26 /* Preserve all registers that C normally doesn't. */ @@ -146,30 +335,21 @@ _dl_runtime_resolve: lda $30, FRAMESIZE($30) jmp $31, ($27) - .end _dl_runtime_resolve + .end _dl_runtime_resolve_old - .globl _dl_runtime_profile - .usepv _dl_runtime_profile, no - .type _dl_runtime_profile, @function + .globl _dl_runtime_profile_old + .usepv _dl_runtime_profile_old, no + .type _dl_runtime_profile_old, @function /* We save the registers in a different order than desired by .mask/.fmask, so we have to use explicit cfi directives. */ cfi_startproc -.macro savei regno, offset - stq $\regno, \offset($30) - cfi_rel_offset(\regno, \offset) -.endm - -.macro savef regno, offset - stt $f\regno, \offset($30) - cfi_rel_offset(\regno+32, \offset) -.endm - #undef FRAMESIZE #define FRAMESIZE 50*8 -_dl_runtime_profile: + .align 4 +_dl_runtime_profile_old: lda $30, -FRAMESIZE($30) cfi_adjust_cfa_offset (FRAMESIZE) @@ -340,8 +520,8 @@ _dl_runtime_profile: ldgp $29, 0($26) /* Set up for call to _dl_call_pltexit. */ - ldq $16, 48($15) - ldq $17, 49($15) + ldq $16, 48*8($15) + ldq $17, 49*8($15) stq $0, 46*8($15) lda $18, 0($15) stq $1, 47*8($15) @@ -358,4 +538,4 @@ _dl_runtime_profile: ret cfi_endproc - .size _dl_runtime_profile, .-_dl_runtime_profile + .size _dl_runtime_profile_old, .-_dl_runtime_profile_old diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S index 3c2bc59adc..ebe14b4c8e 100644 --- a/sysdeps/alpha/elf/start.S +++ b/sysdeps/alpha/elf/start.S @@ -77,7 +77,7 @@ _start: .end _start /* For ECOFF backwards compatibility. */ -weak_alias(_start, __start) +weak_alias (_start, __start) /* Define a symbol for the first piece of initialized data. */ .data diff --git a/sysdeps/alpha/htonl.S b/sysdeps/alpha/htonl.S index eb4fbd2ab4..ef2a575995 100644 --- a/sysdeps/alpha/htonl.S +++ b/sysdeps/alpha/htonl.S @@ -41,4 +41,4 @@ ENTRY(htonl) END(htonl) -weak_alias(htonl, ntohl) +weak_alias (htonl, ntohl) diff --git a/sysdeps/alpha/htons.S b/sysdeps/alpha/htons.S index f1ef754814..7c6270226d 100644 --- a/sysdeps/alpha/htons.S +++ b/sysdeps/alpha/htons.S @@ -37,4 +37,4 @@ ENTRY(htons) END(htons) -weak_alias(htons, ntohs) +weak_alias (htons, ntohs) diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S index bfc3be5c3f..ae291b0505 100644 --- a/sysdeps/alpha/reml.S +++ b/sysdeps/alpha/reml.S @@ -38,7 +38,7 @@ .text .align 4 .globl __reml - .type __reml, @function + .type __reml, @funcnoplt .usepv __reml, no cfi_startproc diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S index 645a834453..64e958bb95 100644 --- a/sysdeps/alpha/remq.S +++ b/sysdeps/alpha/remq.S @@ -43,7 +43,7 @@ .text .align 4 .globl __remq - .type __remq, @function + .type __remq, @funcnoplt .usepv __remq, no cfi_startproc diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S index bfa78dff57..dcc1c88b3c 100644 --- a/sysdeps/alpha/remqu.S +++ b/sysdeps/alpha/remqu.S @@ -43,7 +43,7 @@ .text .align 4 .globl __remqu - .type __remqu, @function + .type __remqu, @funcnoplt .usepv __remqu, no cfi_startproc diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c index 6a3336c6d2..f2d52372d5 100644 --- a/sysdeps/generic/backtrace.c +++ b/sysdeps/generic/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. Generic version. - Copyright (C) 1998, 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -91,3 +91,4 @@ __backtrace (array, size) return cnt; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/generic/backtracesymsfd.c b/sysdeps/generic/backtracesymsfd.c index c704362ec7..b01f8b0094 100644 --- a/sysdeps/generic/backtracesymsfd.c +++ b/sysdeps/generic/backtracesymsfd.c @@ -1,5 +1,5 @@ /* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -61,3 +61,4 @@ __backtrace_symbols_fd (array, size, fd) } } weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd) +libc_hidden_def (__backtrace_symbols_fd) diff --git a/sysdeps/generic/elf/backtracesymsfd.c b/sysdeps/generic/elf/backtracesymsfd.c index 16df53883c..6754d145b0 100644 --- a/sysdeps/generic/elf/backtracesymsfd.c +++ b/sysdeps/generic/elf/backtracesymsfd.c @@ -1,5 +1,5 @@ /* Write formatted list with names for addresses in backtrace to a file. - Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -107,3 +107,4 @@ __backtrace_symbols_fd (array, size, fd) } } weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd) +libc_hidden_def (__backtrace_symbols_fd) diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 2e3254356b..a24c2ff58e 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -674,7 +674,7 @@ struct rtld_global_ro void (*_dl_debug_printf) (const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); int (internal_function *_dl_catch_error) (const char **, const char **, - void (*) (void *), void *); + bool *, void (*) (void *), void *); void (internal_function *_dl_signal_error) (int, const char *, const char *, const char *); void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc); @@ -754,10 +754,6 @@ extern char **_dl_argv_internal attribute_hidden # define rtld_progname _dl_argv[0] #endif -/* The array with message we print as a last resort. */ -extern const char _dl_out_of_memory[]; -rtld_hidden_proto (_dl_out_of_memory) - /* Flag set at startup and cleared when the last initializer has run. */ extern int _dl_starting_up; weak_extern (_dl_starting_up) diff --git a/sysdeps/generic/strnlen.c b/sysdeps/generic/strnlen.c index c83520e349..454257b2bc 100644 --- a/sysdeps/generic/strnlen.c +++ b/sysdeps/generic/strnlen.c @@ -1,5 +1,5 @@ /* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 1991, 1993, 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1991,1993,1997,2000,2001,2005 Free Software Foundation, Inc. Contributed by Jakub Jelinek <jakub@redhat.com>. Based on strlen written by Torbjorn Granlund (tege@sics.se), @@ -158,3 +158,4 @@ __strnlen (const char *str, size_t maxlen) return char_ptr - str; } weak_alias (__strnlen, strnlen) +libc_hidden_def (strnlen) diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c index cb7530396b..8b61913dde 100644 --- a/sysdeps/i386/backtrace.c +++ b/sysdeps/i386/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -141,3 +141,4 @@ __backtrace (array, size) return arg.cnt != -1 ? arg.cnt : 0; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 727d7a0ab8..8b11adb2e3 100644 --- a/sysdeps/i386/i386-mcount.S +++ b/sysdeps/i386/i386-mcount.S @@ -52,4 +52,4 @@ C_LABEL(_mcount) ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount -weak_alias(_mcount, mcount) +weak_alias (_mcount, mcount) diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index 56ba304328..2739cb00b3 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -131,6 +131,33 @@ lose: SYSCALL_PIC_SETUP \ 0: popl %ebx; \ cfi_adjust_cfa_offset (-4); \ addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx; + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG(reg) \ + call 1f; \ + .subsection 1; \ +1:movl (%esp), %e##reg; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG(reg) \ + .ifndef __i686.get_pc_thunk.reg; \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \ + .globl __i686.get_pc_thunk.reg; \ + .hidden __i686.get_pc_thunk.reg; \ + .type __i686.get_pc_thunk.reg,@function; \ +__i686.get_pc_thunk.reg: \ + movl (%esp), %e##reg; \ + ret; \ + .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg; \ + .previous; \ + .endif; \ + call __i686.get_pc_thunk.reg +# endif + +# define LOAD_PIC_REG(reg) \ + SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg + #else #define JUMPTARGET(name) name #define SYSCALL_PIC_SETUP /* Nothing. */ diff --git a/sysdeps/ia64/backtrace.c b/sysdeps/ia64/backtrace.c index efacccce15..3f2b75ec03 100644 --- a/sysdeps/ia64/backtrace.c +++ b/sysdeps/ia64/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. @@ -90,3 +90,4 @@ __backtrace (array, size) return arg.cnt != -1 ? arg.cnt : 0; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/ia64/fpu/e_lgamma_r.c b/sysdeps/ia64/fpu/e_lgamma_r.c index ebc90fc8f3..cb9efbfe02 100644 --- a/sysdeps/ia64/fpu/e_lgamma_r.c +++ b/sysdeps/ia64/fpu/e_lgamma_r.c @@ -60,12 +60,12 @@ double __ieee754_lgamma_r(double x, int* signgam) { return __libm_lgamma(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_lgamma_r, lgamma_r) +weak_alias (__ieee754_lgamma_r, lgamma_r) #ifndef _LIBC double __ieee754_gamma_r(double x, int* signgam) { return __libm_lgamma(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_gamma_r, gamma_r) +weak_alias (__ieee754_gamma_r, gamma_r) #endif diff --git a/sysdeps/ia64/fpu/e_lgammaf_r.c b/sysdeps/ia64/fpu/e_lgammaf_r.c index 4efa84064c..44911aeabd 100644 --- a/sysdeps/ia64/fpu/e_lgammaf_r.c +++ b/sysdeps/ia64/fpu/e_lgammaf_r.c @@ -60,12 +60,12 @@ float __ieee754_lgammaf_r(float x, int* signgam) { return __libm_lgammaf(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_lgammaf_r, lgammaf_r) +weak_alias (__ieee754_lgammaf_r, lgammaf_r) #ifndef _LIBC float __ieee754_gammaf_r(float x, int* signgam) { return __libm_lgammaf(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_gammaf_r, gammaf_r) +weak_alias (__ieee754_gammaf_r, gammaf_r) #endif diff --git a/sysdeps/ia64/fpu/e_lgammal_r.c b/sysdeps/ia64/fpu/e_lgammal_r.c index 3fbea703c8..4451201b77 100644 --- a/sysdeps/ia64/fpu/e_lgammal_r.c +++ b/sysdeps/ia64/fpu/e_lgammal_r.c @@ -59,12 +59,12 @@ long double __ieee754_lgammal_r(long double x, int* signgam) { return __libm_lgammal(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_lgammal_r, lgammal_r) +weak_alias (__ieee754_lgammal_r, lgammal_r) #ifndef _LIBC long double __ieee754_gammal_r(long double x, int* signgam) { return __libm_lgammal(x, signgam, sizeof(*signgam)); } -weak_alias(__ieee754_gammal_r, gammal_r) +weak_alias (__ieee754_gammal_r, gammal_r) #endif diff --git a/sysdeps/ia64/fpu/w_lgamma.c b/sysdeps/ia64/fpu/w_lgamma.c index f16256ee1b..2006d3e806 100644 --- a/sysdeps/ia64/fpu/w_lgamma.c +++ b/sysdeps/ia64/fpu/w_lgamma.c @@ -66,7 +66,7 @@ double __ieee754_lgamma(double x) #endif return __libm_lgamma(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_lgamma, lgamma) +weak_alias (__ieee754_lgamma, lgamma) double __ieee754_gamma(double x) { @@ -77,4 +77,4 @@ double __ieee754_gamma(double x) #endif return __libm_lgamma(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_gamma, gamma) +weak_alias (__ieee754_gamma, gamma) diff --git a/sysdeps/ia64/fpu/w_lgammaf.c b/sysdeps/ia64/fpu/w_lgammaf.c index 5ac3b82278..cd0b4f6666 100644 --- a/sysdeps/ia64/fpu/w_lgammaf.c +++ b/sysdeps/ia64/fpu/w_lgammaf.c @@ -66,7 +66,7 @@ float __ieee754_lgammaf(float x) #endif return __libm_lgammaf(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_lgammaf, lgammaf) +weak_alias (__ieee754_lgammaf, lgammaf) float __ieee754_gammaf(float x) { @@ -77,4 +77,4 @@ float __ieee754_gammaf(float x) #endif return __libm_lgammaf(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_gammaf, gammaf) +weak_alias (__ieee754_gammaf, gammaf) diff --git a/sysdeps/ia64/fpu/w_lgammal.c b/sysdeps/ia64/fpu/w_lgammal.c index 8ddbb749ce..e3885296eb 100644 --- a/sysdeps/ia64/fpu/w_lgammal.c +++ b/sysdeps/ia64/fpu/w_lgammal.c @@ -65,7 +65,7 @@ long double __ieee754_lgammal(long double x) #endif return __libm_lgammal(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_lgammal, lgammal) +weak_alias (__ieee754_lgammal, lgammal) long double __ieee754_gammal(long double x) { @@ -76,4 +76,4 @@ long double __ieee754_gammal(long double x) #endif return __libm_lgammal(x, &signgam, sizeof(signgam)); } -weak_alias(__ieee754_gammal, gammal) +weak_alias (__ieee754_gammal, gammal) diff --git a/sysdeps/ia64/strchr.S b/sysdeps/ia64/strchr.S index 258562796a..63db7ff7e5 100644 --- a/sysdeps/ia64/strchr.S +++ b/sysdeps/ia64/strchr.S @@ -108,5 +108,5 @@ ENTRY(strchr) br.cond.sptk .back END(strchr) -weak_alias(strchr, index) +weak_alias (strchr, index) libc_hidden_builtin_def (strchr) diff --git a/sysdeps/mach/hurd/readdir64_r.c b/sysdeps/mach/hurd/readdir64_r.c index c26b35bb70..5b5a7fe362 100644 --- a/sysdeps/mach/hurd/readdir64_r.c +++ b/sysdeps/mach/hurd/readdir64_r.c @@ -109,4 +109,4 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result) return dp ? 0 : err ? errno : 0; } -weak_alias(__readdir64_r, readdir64_r) +weak_alias (__readdir64_r, readdir64_r) diff --git a/sysdeps/mach/hurd/sigaltstack.c b/sysdeps/mach/hurd/sigaltstack.c index ea3e07d26b..5b2f06561b 100644 --- a/sysdeps/mach/hurd/sigaltstack.c +++ b/sysdeps/mach/hurd/sigaltstack.c @@ -60,4 +60,4 @@ __sigaltstack (argss, oss) return 0; } -weak_alias(__sigaltstack, sigaltstack) +weak_alias (__sigaltstack, sigaltstack) diff --git a/sysdeps/mach/i386/syscall.S b/sysdeps/mach/i386/syscall.S index 9e718f354d..ff50e971cc 100644 --- a/sysdeps/mach/i386/syscall.S +++ b/sysdeps/mach/i386/syscall.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1997, 2005 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,3 +24,4 @@ ENTRY (syscall) pushl %ecx /* Push back return address. */ .byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- gas bug */ ret +END (syscall) diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c index 91e71b74ac..64ca9ae83d 100644 --- a/sysdeps/posix/posix_fallocate64.c +++ b/sysdeps/posix/posix_fallocate64.c @@ -76,7 +76,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) if (offset < st.st_size) { unsigned char c; - ssize_t rsize = __pread64 (fd, &c, 1, offset); + ssize_t rsize = __libc_pread64 (fd, &c, 1, offset); if (rsize < 0) return errno; @@ -86,7 +86,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) continue; } - if (__pwrite64 (fd, "", 1, offset) != 1) + if (__libc_pwrite64 (fd, "", 1, offset) != 1) return errno; } diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c index 361a19e0dc..9787e8d234 100644 --- a/sysdeps/posix/sigignore.c +++ b/sysdeps/posix/sigignore.c @@ -1,5 +1,5 @@ /* Set the disposition of SIG to SIG_IGN. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -22,6 +22,8 @@ #define __need_NULL #include <stddef.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ + int sigignore (sig) diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c index 9a8efee043..9fc514c729 100644 --- a/sysdeps/posix/signal.c +++ b/sysdeps/posix/signal.c @@ -1,5 +1,6 @@ /* BSD-like signal function. - Copyright (C) 1991,1992,1996,1997,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1996,1997,2000,2002,2005 + 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 @@ -19,6 +20,7 @@ #include <errno.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c index 873c1cb1e6..31e39d78b5 100644 --- a/sysdeps/posix/sigset.c +++ b/sysdeps/posix/sigset.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2005 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 @@ -20,6 +20,7 @@ #define __need_NULL #include <stddef.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ /* Set the disposition for SIG. */ diff --git a/sysdeps/posix/sysv_signal.c b/sysdeps/posix/sysv_signal.c index ca2e84f372..16fcd2c2ab 100644 --- a/sysdeps/posix/sysv_signal.c +++ b/sysdeps/posix/sysv_signal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996, 1997, 2005 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 @@ -18,6 +18,8 @@ #include <errno.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ + /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps index 6dd3940d22..850a10746c 100644 --- a/sysdeps/powerpc/fpu/libm-test-ulps +++ b/sysdeps/powerpc/fpu/libm-test-ulps @@ -226,9 +226,9 @@ idouble: 2 ifloat: 3 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": double: 1 -float: 4 +float: 5 idouble: 1 -ifloat: 4 +ifloat: 5 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": float: 2 ifloat: 2 @@ -351,6 +351,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 Test "j0 (10.0) == -0.245935764451348335197760862485328754": double: 2 float: 1 @@ -382,6 +385,9 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": double: 2 float: 1 @@ -418,8 +424,8 @@ Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": float: 1 ifloat: 1 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": -float: 3 -ifloat: 3 +float: 4 +ifloat: 4 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": double: 1 float: 1 @@ -435,9 +441,9 @@ idouble: 3 ifloat: 1 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 # lgamma Test "lgamma (0.7) == 0.260867246531666514385732417016759578": @@ -730,9 +736,9 @@ ifloat: 1 Function: Real part of "cpow": double: 2 -float: 4 +float: 5 idouble: 2 -ifloat: 4 +ifloat: 5 Function: Imaginary part of "cpow": double: 2 @@ -800,9 +806,9 @@ ifloat: 1 Function: "j0": double: 2 -float: 1 +float: 2 idouble: 2 -ifloat: 1 +ifloat: 2 Function: "j1": double: 1 @@ -812,9 +818,9 @@ ifloat: 2 Function: "jn": double: 3 -float: 3 +float: 4 idouble: 3 -ifloat: 3 +ifloat: 4 Function: "lgamma": double: 1 diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S index 157ef09507..ab9a3a99bb 100644 --- a/sysdeps/powerpc/fpu/s_fabs.S +++ b/sysdeps/powerpc/fpu/s_fabs.S @@ -25,13 +25,13 @@ ENTRY(__fabs) blr END(__fabs) -weak_alias(__fabs,fabs) +weak_alias (__fabs,fabs) /* It turns out that it's safe to use this code even for single-precision. */ strong_alias(__fabs,__fabsf) -weak_alias(__fabs,fabsf) +weak_alias (__fabs,fabsf) #ifdef NO_LONG_DOUBLE -weak_alias(__fabs,__fabsl) -weak_alias(__fabs,fabsl) +weak_alias (__fabs,__fabsl) +weak_alias (__fabs,fabsl) #endif diff --git a/sysdeps/powerpc/fpu/s_fmax.S b/sysdeps/powerpc/fpu/s_fmax.S index 5666cdd079..8502c863b2 100644 --- a/sysdeps/powerpc/fpu/s_fmax.S +++ b/sysdeps/powerpc/fpu/s_fmax.S @@ -31,13 +31,13 @@ ENTRY(__fmax) blr END(__fmax) -weak_alias(__fmax,fmax) +weak_alias (__fmax,fmax) /* It turns out that it's safe to use this code even for single-precision. */ strong_alias(__fmax,__fmaxf) -weak_alias(__fmax,fmaxf) +weak_alias (__fmax,fmaxf) #ifdef NO_LONG_DOUBLE -weak_alias(__fmax,__fmaxl) -weak_alias(__fmax,fmaxl) +weak_alias (__fmax,__fmaxl) +weak_alias (__fmax,fmaxl) #endif diff --git a/sysdeps/powerpc/fpu/s_fmin.S b/sysdeps/powerpc/fpu/s_fmin.S index 96387d9ae1..5f788d06f3 100644 --- a/sysdeps/powerpc/fpu/s_fmin.S +++ b/sysdeps/powerpc/fpu/s_fmin.S @@ -31,13 +31,13 @@ ENTRY(__fmin) blr END(__fmin) -weak_alias(__fmin,fmin) +weak_alias (__fmin,fmin) /* It turns out that it's safe to use this code even for single-precision. */ strong_alias(__fmin,__fminf) -weak_alias(__fmin,fminf) +weak_alias (__fmin,fminf) #ifdef NO_LONG_DOUBLE -weak_alias(__fmin,__fminl) -weak_alias(__fmin,fminl) +weak_alias (__fmin,__fminl) +weak_alias (__fmin,fminl) #endif diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c index 118f0d6175..e7e12544c5 100644 --- a/sysdeps/powerpc/powerpc32/backtrace.c +++ b/sysdeps/powerpc/powerpc32/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2005 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 @@ -64,3 +64,4 @@ __backtrace (void **array, int size) return count; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/powerpc/powerpc32/configure b/sysdeps/powerpc/powerpc32/configure new file mode 100644 index 0000000000..9ebac38b57 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/configure @@ -0,0 +1,33 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/powerpc/powerpc32. + +# See whether gas has R_PPC_REL16 relocs. +echo "$as_me:$LINENO: checking for R_PPC_REL16 gas support" >&5 +echo $ECHO_N "checking for R_PPC_REL16 gas support... $ECHO_C" >&6 +if test "${libc_cv_ppc_rel16+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.s <<\EOF + .text + addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha +EOF +if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + libc_cv_ppc_rel16=yes +else + libc_cv_ppc_rel16=no +fi +rm -f conftest* +fi +echo "$as_me:$LINENO: result: $libc_cv_ppc_rel16" >&5 +echo "${ECHO_T}$libc_cv_ppc_rel16" >&6 +if test $libc_cv_ppc_rel16 = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_ASM_PPC_REL16 1 +_ACEOF + +fi diff --git a/sysdeps/powerpc/powerpc32/configure.in b/sysdeps/powerpc/powerpc32/configure.in new file mode 100644 index 0000000000..6d2c41cb9a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/configure.in @@ -0,0 +1,18 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/powerpc/powerpc32. + +# See whether gas has R_PPC_REL16 relocs. +AC_CACHE_CHECK(for R_PPC_REL16 gas support, libc_cv_ppc_rel16, [dnl +cat > conftest.s <<\EOF + .text + addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha +EOF +if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_ppc_rel16=yes +else + libc_cv_ppc_rel16=no +fi +rm -f conftest*]) +if test $libc_cv_ppc_rel16 = yes; then + AC_DEFINE(HAVE_ASM_PPC_REL16) +fi diff --git a/sysdeps/powerpc/powerpc32/dl-dtprocnum.h b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h new file mode 100644 index 0000000000..7fe2be7939 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h @@ -0,0 +1,3 @@ +/* Number of extra dynamic section entries for this architecture. By + default there are none. */ +#define DT_THISPROCNUM DT_PPC_NUM diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index 545c19b300..496fa71ecc 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -25,6 +25,10 @@ #include <assert.h> #include <dl-tls.h> +/* Translate a processor specific dynamic tag to the index + in l_info array. */ +#define DT_PPC(x) (DT_PPC_##x - DT_LOPROC + DT_NUM) + /* Return nonzero iff ELF header is compatible with the running host. */ static inline int elf_machine_matches_host (const Elf32_Ehdr *ehdr) @@ -32,24 +36,38 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr) return ehdr->e_machine == EM_PPC; } +/* Return the value of the GOT pointer. */ +static inline Elf32_Addr * __attribute__ ((const)) +ppc_got (void) +{ + Elf32_Addr *got; +#ifdef HAVE_ASM_PPC_REL16 + asm ("bcl 20,31,1f\n" + "1: mflr %0\n" + " addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n" + " addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n" + : "=b" (got) : : "lr"); +#else + asm (" bl _GLOBAL_OFFSET_TABLE_-4@local" + : "=l" (got)); +#endif + return got; +} /* Return the link-time address of _DYNAMIC, stored as the first value in the GOT. */ -static inline Elf32_Addr +static inline Elf32_Addr __attribute__ ((const)) elf_machine_dynamic (void) { - Elf32_Addr *got; - asm (" bl _GLOBAL_OFFSET_TABLE_-4@local" - : "=l"(got)); - return *got; + return *ppc_got (); } /* Return the run-time load address of the shared object. */ -static inline Elf32_Addr +static inline Elf32_Addr __attribute__ ((const)) elf_machine_load_address (void) { - unsigned int *got; - unsigned int *branchaddr; + Elf32_Addr *branchaddr; + Elf32_Addr runtime_dynamic; /* This is much harder than you'd expect. Possibly I'm missing something. The 'obvious' way: @@ -80,19 +98,17 @@ elf_machine_load_address (void) the address ourselves. That gives us the following code: */ /* Get address of the 'b _DYNAMIC@local'... */ - asm ("bl 0f ;" + asm ("bcl 20,31,0f;" "b _DYNAMIC@local;" "0:" - : "=l"(branchaddr)); - - /* ... and the address of the GOT. */ - asm (" bl _GLOBAL_OFFSET_TABLE_-4@local" - : "=l"(got)); + : "=l" (branchaddr)); /* So now work out the difference between where the branch actually points, and the offset of that location in memory from the start of the file. */ - return ((Elf32_Addr)branchaddr - *got - + ((int)(*branchaddr << 6 & 0xffffff00) >> 6)); + runtime_dynamic = ((Elf32_Addr) branchaddr + + ((Elf32_Sword) (*branchaddr << 6 & 0xffffff00) >> 6)); + + return runtime_dynamic - elf_machine_dynamic (); } #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) /* nothing */ @@ -144,13 +160,69 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, /* The PowerPC never uses REL relocations. */ #define ELF_MACHINE_NO_REL 1 -/* Set up the loaded object described by L so its unrelocated PLT +/* Set up the loaded object described by MAP so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. Also install a small trampoline to be used by entries that have been relocated to an address too far away for a single branch. */ extern int __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile); -#define elf_machine_runtime_setup __elf_machine_runtime_setup + +static inline int +elf_machine_runtime_setup (struct link_map *map, + int lazy, int profile) +{ + if (map->l_info[DT_JMPREL] == 0) + return lazy; + + if (map->l_info[DT_PPC(GOT)] == 0) + /* Handle old style PLT. */ + return __elf_machine_runtime_setup (map, lazy, profile); + + /* New style non-exec PLT consisting of an array of addresses. */ + map->l_info[DT_PPC(GOT)]->d_un.d_ptr += map->l_addr; + if (lazy) + { + Elf32_Addr *plt, *got, glink; + Elf32_Word num_plt_entries; + void (*dlrr) (void); + extern void _dl_runtime_resolve (void); + extern void _dl_prof_resolve (void); + + if (__builtin_expect (!profile, 1)) + dlrr = _dl_runtime_resolve; + else + { + if (GLRO(dl_profile) != NULL + &&_dl_name_match_p (GLRO(dl_profile), map)) + GL(dl_profile_map) = map; + dlrr = _dl_prof_resolve; + } + got = (Elf32_Addr *) map->l_info[DT_PPC(GOT)]->d_un.d_ptr; + glink = got[1]; + got[1] = (Elf32_Addr) dlrr; + got[2] = (Elf32_Addr) map; + + /* Relocate everything in .plt by the load address offset. */ + plt = (Elf32_Addr *) D_PTR (map, l_info[DT_PLTGOT]); + num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val + / sizeof (Elf32_Rela)); + + /* If a library is prelinked but we have to relocate anyway, + we have to be able to undo the prelinking of .plt section. + The prelinker saved us at got[1] address of .glink + section's start. */ + if (glink) + { + glink += map->l_addr; + while (num_plt_entries-- != 0) + *plt++ = glink, glink += 4; + } + else + while (num_plt_entries-- != 0) + *plt++ += map->l_addr; + } + return lazy; +} /* Change the PLT entry whose reloc is 'reloc' to call the actual routine. */ extern Elf32_Addr __elf_machine_fixup_plt (struct link_map *map, @@ -163,7 +235,12 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t, const Elf32_Rela *reloc, Elf32_Addr *reloc_addr, Elf64_Addr finaladdr) { - return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr); + if (map->l_info[DT_PPC(GOT)] == 0) + /* Handle old style PLT. */ + return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr); + + *reloc_addr = finaladdr; + return finaladdr; } /* Return the final value of a plt relocation. */ @@ -286,11 +363,16 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, break; #endif /* USE_TLS etc. */ -#ifdef RESOLVE_CONFLICT_FIND_MAP case R_PPC_JMP_SLOT: +#ifdef RESOLVE_CONFLICT_FIND_MAP RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr); - /* FALLTHROUGH */ #endif + if (map->l_info[DT_PPC(GOT)] != 0) + { + *reloc_addr = value; + break; + } + /* FALLTHROUGH */ default: __process_machine_rela (map, reloc, sym_map, sym, refsym, diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S index d72202d4a4..e1f7f6e24a 100644 --- a/sysdeps/powerpc/powerpc32/dl-start.S +++ b/sysdeps/powerpc/powerpc32/dl-start.S @@ -47,8 +47,15 @@ ENTRY(_dl_start_user) passed by value!). */ /* Put our GOT pointer in r31, */ +#ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r31 + addis r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l +#else bl _GLOBAL_OFFSET_TABLE_-4@local mflr r31 +#endif /* the address of _start in r30, */ mr r30,r3 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */ diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S index 7827357a6c..bafd2ae001 100644 --- a/sysdeps/powerpc/powerpc32/elf/start.S +++ b/sysdeps/powerpc/powerpc32/elf/start.S @@ -52,7 +52,7 @@ L(start_addresses): ASM_SIZE_DIRECTIVE(L(start_addresses)) .section ".text" -#ifdef PIC +#if defined PIC && !defined HAVE_ASM_PPC_REL16 L(start_addressesp): .long L(start_addresses)-L(branch) #endif @@ -73,11 +73,19 @@ L(branch): mtlr r0 stw r0,0(r1) /* Set r13 to point at the 'small data area', and put the address of - start_addresses in r8... */ + start_addresses in r8. Also load the GOT pointer so that new PLT + calls work, like the one to __libc_start_main. */ #ifdef PIC +# ifdef HAVE_ASM_PPC_REL16 + addis r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha + addis r8,r13,L(start_addresses)-L(branch)@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l + lwzu r13,L(start_addresses)-L(branch)@l(r8) +# else lwz r8,L(start_addressesp)-L(branch)(r13) add r8,r13,r8 lwz r13,0(r8) +# endif #else lis r8,L(start_addresses)@ha lwzu r13,L(start_addresses)@l(r8) diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S index a2415b9542..73cc8181f9 100644 --- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S +++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S @@ -34,14 +34,21 @@ ENTRY (BP_SYM (__longjmp)) #ifndef __NO_VMX__ # ifdef PIC mflr r6 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 +# endif # ifdef SHARED lwz r5,_rtld_global_ro@got(r5) mtlr r6 lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5) # else - lwz r5,_rtld_global_ro@got(r5) + lwz r5,_dl_hwcap@got(r5) mtlr r6 lwz r5,0(r5) # endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S index 7924e34648..13afba88f0 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S @@ -29,11 +29,19 @@ ENTRY (__ceil) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S index 9315d8d2df..f8ca1de08c 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S @@ -20,7 +20,7 @@ #include <sysdep.h> .section .rodata.cst4,"aM",@progbits,4 - .align 2 + .align 2 .LC0: /* 2**23 */ .long 0x4b000000 @@ -29,11 +29,19 @@ ENTRY (__ceilf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S index 933435da3d..ee2c09cba8 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S @@ -38,13 +38,13 @@ L(0): fnabs fp1,fp1 blr END (__copysign) -weak_alias(__copysign,copysign) +weak_alias (__copysign,copysign) /* It turns out that it's safe to use this code even for single-precision. */ -weak_alias(__copysign,copysignf) +weak_alias (__copysign,copysignf) strong_alias(__copysign,__copysignf) #ifdef NO_LONG_DOUBLE -weak_alias(__copysign,copysignl) +weak_alias (__copysign,copysignl) strong_alias(__copysign,__copysignl) #endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S index c8f59c24a6..5dfe8f2d9a 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S @@ -29,11 +29,19 @@ ENTRY (__floor) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S index 8ee0644ac9..31b71ad229 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S @@ -20,7 +20,7 @@ #include <sysdep.h> .section .rodata.cst4,"aM",@progbits,4 - .align 2 + .align 2 .LC0: /* 2**23 */ .long 0x4b000000 @@ -29,11 +29,19 @@ ENTRY (__floorf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S index 72fd49ba46..a85743164c 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S @@ -41,9 +41,16 @@ ENTRY (__lround) #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 lfs fp12,0(r9) #else diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S index 4abdcedfe8..1cfcd78b5c 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S @@ -31,11 +31,19 @@ ENTRY (__rint) #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S index d02bd066b8..93c02667fe 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S @@ -20,7 +20,7 @@ #include <sysdep.h> .section .rodata.cst4,"aM",@progbits,4 - .align 2 + .align 2 .LC0: /* 2**23 */ .long 0x4b000000 @@ -28,11 +28,19 @@ ENTRY (__rintf) #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S index 96fc2984fd..53b45916d1 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_round.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S @@ -41,9 +41,16 @@ ENTRY (__round) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 lfs fp13,0(r9) #else diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S index 87965dea80..39ba08655a 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S @@ -41,9 +41,16 @@ ENTRY (__roundf ) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 lfs fp13,0(r9) #else diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S index 7a3e705a81..827e8cb940 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S @@ -36,11 +36,19 @@ ENTRY (__trunc) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S index 5275c69d29..55e7a74b41 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S @@ -20,7 +20,7 @@ #include <sysdep.h> .section .rodata.cst4,"aM",@progbits,4 - .align 2 + .align 2 .LC0: /* 2**23 */ .long 0x4b000000 @@ -36,11 +36,19 @@ ENTRY (__truncf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + mtlr r11 + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) mtlr r11 lfs fp13,0(r9) +# endif #else lis r9,.LC0@ha lfs fp13,.LC0@l(r9) diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S index e0c0606da4..cf3f215f2d 100644 --- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S +++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S @@ -74,20 +74,27 @@ ENTRY (BP_SYM (__sigsetjmp)) stw r31,((JB_GPRS+17)*4)(3) stfd fp31,((JB_FPRS+17*2)*4)(3) #ifndef __NO_VMX__ -#ifdef PIC +# ifdef PIC mflr r6 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 -#ifdef SHARED +# endif +# ifdef SHARED lwz r5,_rtld_global_ro@got(r5) mtlr r6 lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5) -#else - lwz r5,_rtld_global_ro@got(r5) +# else + lwz r5,_dl_hwcap@got(r5) mtlr r6 lwz r5,0(r5) -#endif -#else +# endif +# else lis r5,_dl_hwcap@ha lwz r5,_dl_hwcap@l(r5) #endif diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S index 4c0edc8e45..f09c294674 100644 --- a/sysdeps/powerpc/powerpc32/memset.S +++ b/sysdeps/powerpc/powerpc32/memset.S @@ -264,10 +264,17 @@ L(checklinesize): beq L(medium) /* Establishes GOT addressability so we can load __cache_line_size from static. This value was set from the aux vector during startup. */ +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr rGOT + addis rGOT,rGOT,__cache_line_size-1b@ha + lwz rCLS,__cache_line_size-1b@l(rGOT) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr rGOT lwz rGOT,__cache_line_size@got(rGOT) lwz rCLS,0(rGOT) +# endif mtlr rTMP #else /* Load __cache_line_size from static. This value was set from the diff --git a/sysdeps/powerpc/powerpc32/ppc-mcount.S b/sysdeps/powerpc/powerpc32/ppc-mcount.S index 314c8ee703..c1a08d379c 100644 --- a/sysdeps/powerpc/powerpc32/ppc-mcount.S +++ b/sysdeps/powerpc/powerpc32/ppc-mcount.S @@ -1,5 +1,5 @@ /* PowerPC-specific implementation of profiling support. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2005 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,25 +24,19 @@ #include <sysdep.h> -/* We do profiling as described in the SYSV ELF ABI, _mcount is called - with the address of a data word in r0 (that is different for every - routine, initialised to 0, and otherwise unused). The caller has put - the address the caller will return to in the usual place on the stack, - 4(r1). _mcount is responsible for ensuring that when it returns no - argument-passing registers are disturbed, and that the LR is set back - to (what the caller sees as) 4(r1). +/* We do profiling as described in the SYSV ELF ABI, except that glibc + _mcount manages its own counters. The caller has put the address the + caller will return to in the usual place on the stack, 4(r1). _mcount + is responsible for ensuring that when it returns no argument-passing + registers are disturbed, and that the LR is set back to (what the + caller sees as) 4(r1). This is intended so that the following code can be inserted at the front of any routine without changing the routine: .data - .align 2 - 0: .long 0 - .previous mflr r0 - lis r11,0b@ha stw r0,4(r1) - addi r0,r11,0b@l bl _mcount */ diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h index 775073f325..552f595a10 100644 --- a/sysdeps/powerpc/powerpc32/sysdep.h +++ b/sysdeps/powerpc/powerpc32/sysdep.h @@ -29,31 +29,10 @@ /* The mcount code relies on a the return address being on the stack to locate our caller and so it can restore it; so store one just for its benefit. */ -# ifdef PIC -# define CALL_MCOUNT \ - .pushsection; \ - .section ".data"; \ - .align ALIGNARG(2); \ -0:.long 0; \ - .previous; \ - mflr r0; \ - stw r0,4(r1); \ - bl _GLOBAL_OFFSET_TABLE_@local-4; \ - mflr r11; \ - lwz r0,0b@got(r11); \ - bl JUMPTARGET(_mcount); -# else /* PIC */ -# define CALL_MCOUNT \ - .section ".data"; \ - .align ALIGNARG(2); \ -0:.long 0; \ - .previous; \ +# define CALL_MCOUNT \ mflr r0; \ - lis r11,0b@ha; \ stw r0,4(r1); \ - addi r0,r11,0b@l; \ bl JUMPTARGET(_mcount); -# endif /* PIC */ #else /* PROF */ # define CALL_MCOUNT /* Do nothing. */ #endif /* PROF */ diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c index 8669b6a689..9c8ebbb18d 100644 --- a/sysdeps/powerpc/powerpc64/backtrace.c +++ b/sysdeps/powerpc/powerpc64/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2002, 2005 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 @@ -67,3 +67,4 @@ __backtrace (void **array, int size) return count; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S index a43ed12cf0..f083d2b7ea 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S @@ -39,13 +39,13 @@ L(0): fnabs fp1,fp1 blr END (__copysign) -weak_alias(__copysign,copysign) +weak_alias (__copysign,copysign) /* It turns out that it's safe to use this code even for single-precision. */ -weak_alias(__copysign,copysignf) +weak_alias (__copysign,copysignf) strong_alias(__copysign,__copysignf) #ifdef NO_LONG_DOUBLE -weak_alias(__copysign,copysignl) +weak_alias (__copysign,copysignl) strong_alias(__copysign,__copysignl) #endif diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c index 7a632572b5..6adc3bc3d1 100644 --- a/sysdeps/s390/s390-32/backtrace.c +++ b/sysdeps/s390/s390-32/backtrace.c @@ -1,6 +1,6 @@ /* Return backtrace of current program state. - Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -142,3 +142,4 @@ __backtrace (void **array, int size) } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S index 8ecdd0edae..6d11f9bbdb 100644 --- a/sysdeps/s390/s390-32/s390-mcount.S +++ b/sysdeps/s390/s390-32/s390-mcount.S @@ -81,4 +81,4 @@ C_LABEL(_mcount) ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount -weak_alias(_mcount, mcount) +weak_alias (_mcount, mcount) diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c index 05321349ca..7ba195cb7a 100644 --- a/sysdeps/s390/s390-64/backtrace.c +++ b/sysdeps/s390/s390-64/backtrace.c @@ -1,6 +1,6 @@ /* Return backtrace of current program state. 64 bit S/390 version. - Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -141,3 +141,4 @@ __backtrace (void **array, int size) } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390-64/s390x-mcount.S index 5e3890b4f6..0fa614cbf4 100644 --- a/sysdeps/s390/s390-64/s390x-mcount.S +++ b/sysdeps/s390/s390-64/s390x-mcount.S @@ -69,4 +69,4 @@ C_LABEL(_mcount) ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount -weak_alias(_mcount, mcount) +weak_alias (_mcount, mcount) diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S index 8e91e998bf..e6204e8ac9 100644 --- a/sysdeps/sparc/sparc32/memset.S +++ b/sysdeps/sparc/sparc32/memset.S @@ -152,4 +152,4 @@ ENTRY(memset) END(memset) libc_hidden_builtin_def (memset) -weak_alias(__bzero, bzero) +weak_alias (__bzero, bzero) diff --git a/sysdeps/sparc/sparc32/stpcpy.S b/sysdeps/sparc/sparc32/stpcpy.S index 937fed35f8..e6688a9b21 100644 --- a/sysdeps/sparc/sparc32/stpcpy.S +++ b/sysdeps/sparc/sparc32/stpcpy.S @@ -160,6 +160,6 @@ ENTRY(__stpcpy) nop END(__stpcpy) -weak_alias(__stpcpy, stpcpy) +weak_alias (__stpcpy, stpcpy) libc_hidden_def (__stpcpy) libc_hidden_builtin_def (stpcpy) diff --git a/sysdeps/sparc/sparc32/strchr.S b/sysdeps/sparc/sparc32/strchr.S index b5be3adf60..6120ecd6a3 100644 --- a/sysdeps/sparc/sparc32/strchr.S +++ b/sysdeps/sparc/sparc32/strchr.S @@ -278,7 +278,7 @@ ENTRY(strrchr) mov %o5, %o0 END(strrchr) -weak_alias(strchr, index) -weak_alias(strrchr, rindex) +weak_alias (strchr, index) +weak_alias (strrchr, rindex) libc_hidden_builtin_def (strchr) libc_hidden_builtin_def (strrchr) diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S index 074767b983..f9502d63f5 100644 --- a/sysdeps/sparc/sparc64/memcmp.S +++ b/sysdeps/sparc/sparc64/memcmp.S @@ -139,5 +139,5 @@ ENTRY(memcmp) END(memcmp) #undef bcmp -weak_alias(memcmp, bcmp) +weak_alias (memcmp, bcmp) libc_hidden_builtin_def (memcmp) diff --git a/sysdeps/sparc/sparc64/memcpy.S b/sysdeps/sparc/sparc64/memcpy.S index 3742573248..a3f7b96a91 100644 --- a/sysdeps/sparc/sparc64/memcpy.S +++ b/sysdeps/sparc/sparc64/memcpy.S @@ -914,8 +914,8 @@ ENTRY(memmove) END(memmove) #ifdef USE_BPR -weak_alias(memcpy, __align_cpy_1) -weak_alias(memcpy, __align_cpy_2) +weak_alias (memcpy, __align_cpy_1) +weak_alias (memcpy, __align_cpy_2) #endif libc_hidden_builtin_def (memcpy) libc_hidden_builtin_def (memmove) diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S index b34ccc8869..99624ba9d7 100644 --- a/sysdeps/sparc/sparc64/memset.S +++ b/sysdeps/sparc/sparc64/memset.S @@ -312,4 +312,4 @@ ENTRY(__bzero) mov %o5, %o0 END(__bzero) -weak_alias(__bzero, bzero) +weak_alias (__bzero, bzero) diff --git a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S index 8b70b0a932..760d526630 100644 --- a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S +++ b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S @@ -600,11 +600,11 @@ ENTRY(memmove) END(memmove) #ifdef USE_BPR -weak_alias(memcpy, __align_cpy_1) -weak_alias(memcpy, __align_cpy_2) -weak_alias(memcpy, __align_cpy_4) -weak_alias(memcpy, __align_cpy_8) -weak_alias(memcpy, __align_cpy_16) +weak_alias (memcpy, __align_cpy_1) +weak_alias (memcpy, __align_cpy_2) +weak_alias (memcpy, __align_cpy_4) +weak_alias (memcpy, __align_cpy_8) +weak_alias (memcpy, __align_cpy_16) #endif libc_hidden_builtin_def (memcpy) libc_hidden_builtin_def (memmove) diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c index 3a1717daf3..8f82ac848d 100644 --- a/sysdeps/unix/clock_gettime.c +++ b/sysdeps/unix/clock_gettime.c @@ -93,6 +93,7 @@ int clock_gettime (clockid_t clock_id, struct timespec *tp) { int retval = -1; + struct timeval tv; switch (clock_id) { @@ -102,7 +103,9 @@ clock_gettime (clockid_t clock_id, struct timespec *tp) #ifndef HANDLED_REALTIME case CLOCK_REALTIME: - HANDLE_REALTIME; + retval = gettimeofday (&tv, NULL); + if (retval == 0) + TIMEVAL_TO_TIMESPEC (&tv, tp); break; #endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h index ce4a5da37f..c4a9b77e2e 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-1999, 2000, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2004, 2005 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,9 +44,9 @@ #define O_ASYNC 020000 /* fcntl, for BSD compatibility */ #ifdef __USE_GNU -# define O_DIRECT 040000 /* Direct disk access. */ # define O_DIRECTORY 0100000 /* Must be a directory. */ # define O_NOFOLLOW 0200000 /* Do not follow links. */ +# define O_DIRECT 02000000 /* Direct disk access. */ # define O_NOATIME 04000000 /* Do not set atime. */ #endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h index 54d6819412..8bbd301dd9 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Alpha/Linux version. - Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004 + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -89,7 +89,18 @@ enum __rlimit_resource __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE - __RLIMIT_NLIMITS = 13, + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO _RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S index 1c450d1737..5e0b21ea15 100644 --- a/sysdeps/unix/sysv/linux/alpha/clone.S +++ b/sysdeps/unix/sysv/linux/alpha/clone.S @@ -146,4 +146,4 @@ thread_start: .end thread_start -weak_alias(__clone, clone) +weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/alpha/getcontext.S b/sysdeps/unix/sysv/linux/alpha/getcontext.S index 3566890cf9..bf9820ac73 100644 --- a/sysdeps/unix/sysv/linux/alpha/getcontext.S +++ b/sysdeps/unix/sysv/linux/alpha/getcontext.S @@ -41,7 +41,7 @@ ENTRY (__getcontext) ret END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) /* An internal routine used by getcontext and setcontext. diff --git a/sysdeps/unix/sysv/linux/alpha/getrusage.S b/sysdeps/unix/sysv/linux/alpha/getrusage.S index 2c34e98ce6..46797aa83b 100644 --- a/sysdeps/unix/sysv/linux/alpha/getrusage.S +++ b/sysdeps/unix/sysv/linux/alpha/getrusage.S @@ -145,5 +145,5 @@ strong_alias(__getrusage_tv64, ____getrusage_tv64) default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1) default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1) #else -weak_alias(__getrusage, getrusage) +weak_alias (__getrusage, getrusage) #endif diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.S index 7d443d41c7..27abfd0c12 100644 --- a/sysdeps/unix/sysv/linux/alpha/setcontext.S +++ b/sysdeps/unix/sysv/linux/alpha/setcontext.S @@ -32,4 +32,4 @@ PSEUDO(__setcontext, sigreturn, 1) ret PSEUDO_END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S index e5de55faeb..48c3f271c7 100644 --- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S +++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S @@ -29,5 +29,5 @@ PSEUDO(__sigsuspend, sigsuspend, 1) ret PSEUDO_END(__sigsuspend) libc_hidden_def (__sigsuspend) -weak_alias(__sigsuspend, sigsuspend) +weak_alias (__sigsuspend, sigsuspend) strong_alias (__sigsuspend, __libc_sigsuspend) diff --git a/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/sysdeps/unix/sysv/linux/alpha/swapcontext.S index 5f6615e0b6..1221f67f78 100644 --- a/sysdeps/unix/sysv/linux/alpha/swapcontext.S +++ b/sysdeps/unix/sysv/linux/alpha/swapcontext.S @@ -48,4 +48,4 @@ ENTRY(__swapcontext) #endif END(__swapcontext) -weak_alias(__swapcontext, swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/alpha/syscall.S b/sysdeps/unix/sysv/linux/alpha/syscall.S index 10a32d5dc8..0c4081363a 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscall.S +++ b/sysdeps/unix/sysv/linux/alpha/syscall.S @@ -74,4 +74,4 @@ $error: END(__syscall) -weak_alias(__syscall, syscall) +weak_alias (__syscall, syscall) diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h index c186a3a5d0..115739d439 100644 --- a/sysdeps/unix/sysv/linux/bits/resource.h +++ b/sysdeps/unix/sysv/linux/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux version. - Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004 + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -89,7 +89,18 @@ enum __rlimit_resource __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE - __RLIMIT_NLIMITS = 13, + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO _RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S index 4f3bb9e206..f497bca13d 100644 --- a/sysdeps/unix/sysv/linux/hppa/clone.S +++ b/sysdeps/unix/sysv/linux/hppa/clone.S @@ -96,4 +96,4 @@ thread_start: PSEUDO_END(__clone) -weak_alias(__clone, clone) +weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S index 76ba6047c1..fe28f1e0e1 100644 --- a/sysdeps/unix/sysv/linux/i386/getcontext.S +++ b/sysdeps/unix/sysv/linux/i386/getcontext.S @@ -82,4 +82,4 @@ L(pseudo_end): ret PSEUDO_END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S index 03dc648c59..12ba4e2d67 100644 --- a/sysdeps/unix/sysv/linux/i386/makecontext.S +++ b/sysdeps/unix/sysv/linux/i386/makecontext.S @@ -114,4 +114,4 @@ L(exitcode): cfi_startproc END(__makecontext) -weak_alias(__makecontext, makecontext) +weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S index c493cf9798..bf2d7d2bad 100644 --- a/sysdeps/unix/sysv/linux/i386/setcontext.S +++ b/sysdeps/unix/sysv/linux/i386/setcontext.S @@ -94,4 +94,4 @@ L(pseudo_end): ret PSEUDO_END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S index d909e659e4..27c16200b2 100644 --- a/sysdeps/unix/sysv/linux/i386/swapcontext.S +++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S @@ -109,4 +109,4 @@ L(pseudo_end): ret PSEUDO_END(__swapcontext) -weak_alias(__swapcontext, swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index a9637be33d..99f9bf1edf 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -109,32 +109,6 @@ # define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ #else -# ifndef HAVE_HIDDEN -# define SETUP_PIC_REG(reg) \ - call 1f; \ - .subsection 1; \ -1:movl (%esp), %e##reg; \ - ret; \ - .previous -# else -# define SETUP_PIC_REG(reg) \ - .ifndef __i686.get_pc_thunk.reg; \ - .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \ - .globl __i686.get_pc_thunk.reg; \ - .hidden __i686.get_pc_thunk.reg; \ - .type __i686.get_pc_thunk.reg,@function; \ -__i686.get_pc_thunk.reg: \ - movl (%esp), %e##reg; \ - ret; \ - .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg; \ - .previous; \ - .endif; \ - call __i686.get_pc_thunk.reg -# endif - -# define LOAD_PIC_REG(reg) \ - SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg - # if RTLD_PRIVATE_ERRNO # define SYSCALL_ERROR_HANDLER \ 0:SETUP_PIC_REG(cx); \ diff --git a/sysdeps/unix/sysv/linux/ia64/getcontext.S b/sysdeps/unix/sysv/linux/ia64/getcontext.S index 0f9cc5db19..4e18bace2d 100644 --- a/sysdeps/unix/sysv/linux/ia64/getcontext.S +++ b/sysdeps/unix/sysv/linux/ia64/getcontext.S @@ -155,4 +155,4 @@ ENTRY(__getcontext) ret END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/ia64/setcontext.S b/sysdeps/unix/sysv/linux/ia64/setcontext.S index e18c40fa4c..ef0a93c0c0 100644 --- a/sysdeps/unix/sysv/linux/ia64/setcontext.S +++ b/sysdeps/unix/sysv/linux/ia64/setcontext.S @@ -150,4 +150,4 @@ ENTRY(__setcontext) ret END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 377ccf5199..66f0ac1317 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 + 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 @@ -188,12 +189,8 @@ if_nameindex_netlink (void) /* Tell the kernel that we wish to get a list of all - active interfaces. */ - if (__netlink_sendreq (&nh, RTM_GETLINK) < 0) - goto exit_close; - - /* Collect all data for every interface. */ - if (__netlink_receive (&nh) < 0) + active interfaces. Collect all data for every interface. */ + if (__netlink_request (&nh, RTM_GETLINK) < 0) goto exit_free; /* Count the interfaces. */ @@ -290,7 +287,6 @@ if_nameindex_netlink (void) exit_free: __netlink_free_handle (&nh); - exit_close: __netlink_close (&nh); return idx; diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index 8a052e212d..f743f702f0 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -1,5 +1,5 @@ /* getifaddrs -- get names and addresses of all network interfaces - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 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 @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <alloca.h> #include <assert.h> #include <errno.h> #include <ifaddrs.h> @@ -24,6 +25,7 @@ #include <netinet/in.h> #include <netpacket/packet.h> #include <stdbool.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> @@ -84,7 +86,7 @@ __netlink_free_handle (struct netlink_handle *h) } -int +static int __netlink_sendreq (struct netlink_handle *h, int type) { struct @@ -114,15 +116,39 @@ __netlink_sendreq (struct netlink_handle *h, int type) int -__netlink_receive (struct netlink_handle *h) +__netlink_request (struct netlink_handle *h, int type) { struct netlink_res *nlm_next; - char buf[4096]; - struct iovec iov = { buf, sizeof (buf) }; + struct netlink_res **new_nlm_list; + static volatile size_t buf_size = 4096; + char *buf; struct sockaddr_nl nladdr; struct nlmsghdr *nlmh; - int read_len; + ssize_t read_len; bool done = false; + bool use_malloc = false; + + if (__netlink_sendreq (h, type) < 0) + return -1; + + size_t this_buf_size = buf_size; + if (__libc_use_alloca (this_buf_size)) + buf = alloca (this_buf_size); + else + { + buf = malloc (this_buf_size); + if (buf != NULL) + use_malloc = true; + else + goto out_fail; + } + + struct iovec iov = { buf, this_buf_size }; + + if (h->nlm_list != NULL) + new_nlm_list = &h->end_ptr->next; + else + new_nlm_list = &h->nlm_list; while (! done) { @@ -136,33 +162,66 @@ __netlink_receive (struct netlink_handle *h) read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0)); if (read_len < 0) - return -1; + goto out_fail; - if (msg.msg_flags & MSG_TRUNC) - return -1; + if (nladdr.nl_pid != 0) + continue; - nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res) - + read_len); - if (nlm_next == NULL) - return -1; - nlm_next->next = NULL; - nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len); - nlm_next->size = read_len; - nlm_next->seq = h->seq; - if (h->nlm_list == NULL) - h->nlm_list = nlm_next; - else - h->end_ptr->next = nlm_next; - h->end_ptr = nlm_next; + if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0)) + { + if (this_buf_size >= SIZE_MAX / 2) + goto out_fail; + + nlm_next = *new_nlm_list; + while (nlm_next != NULL) + { + struct netlink_res *tmpptr; + + tmpptr = nlm_next->next; + free (nlm_next); + nlm_next = tmpptr; + } + *new_nlm_list = NULL; + + if (__libc_use_alloca (2 * this_buf_size)) + buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size); + else + { + this_buf_size *= 2; + + char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size); + if (new_buf == NULL) + goto out_fail; + new_buf = buf; + use_malloc = true; + } + buf_size = this_buf_size; + + iov.iov_base = buf; + iov.iov_len = this_buf_size; + + /* Increase sequence number, so that we can distinguish + between old and new request messages. */ + h->seq++; + + if (__netlink_sendreq (h, type) < 0) + goto out_fail; + + continue; + } + + size_t count = 0; + size_t remaining_len = read_len; for (nlmh = (struct nlmsghdr *) buf; - NLMSG_OK (nlmh, (size_t) read_len); - nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len)) + NLMSG_OK (nlmh, remaining_len); + nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len)) { - if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid + if ((pid_t) nlmh->nlmsg_pid != h->pid || nlmh->nlmsg_seq != h->seq) continue; + ++count; if (nlmh->nlmsg_type == NLMSG_DONE) { /* We found the end, leave the loop. */ @@ -176,11 +235,38 @@ __netlink_receive (struct netlink_handle *h) errno = EIO; else errno = -nlerr->error; - return -1; + goto out_fail; } } + + /* If there was nothing with the expected nlmsg_pid and nlmsg_seq, + there is no point to record it. */ + if (count == 0) + continue; + + nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res) + + read_len); + if (nlm_next == NULL) + goto out_fail; + nlm_next->next = NULL; + nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len); + nlm_next->size = read_len; + nlm_next->seq = h->seq; + if (h->nlm_list == NULL) + h->nlm_list = nlm_next; + else + h->end_ptr->next = nlm_next; + h->end_ptr = nlm_next; } + + if (use_malloc) + free (buf); return 0; + +out_fail: + if (use_malloc) + free (buf); + return -1; } @@ -268,7 +354,7 @@ getifaddrs (struct ifaddrs **ifap) unsigned int i, newlink, newaddr, newaddr_idx; int *map_newlink_data; size_t ifa_data_size = 0; /* Size to allocate for all ifa_data. */ - char *ifa_data_ptr; /* Pointer to the unused part of memory for + char *ifa_data_ptr; /* Pointer to the unused part of memory for ifa_data. */ int result = 0; @@ -288,28 +374,20 @@ getifaddrs (struct ifaddrs **ifap) #endif /* Tell the kernel that we wish to get a list of all - active interfaces. */ - if (__netlink_sendreq (&nh, RTM_GETLINK) < 0) - { - result = -1; - goto exit_close; - } - /* Collect all data for every interface. */ - if (__netlink_receive (&nh) < 0) + active interfaces, collect all data for every interface. */ + if (__netlink_request (&nh, RTM_GETLINK) < 0) { result = -1; goto exit_free; } - /* Now ask the kernel for all addresses which are assigned - to an interface. Since we store the addresses after the - interfaces in the list, we will later always find the - interface before the corresponding addresses. */ + to an interface and collect all data for every interface. + Since we store the addresses after the interfaces in the + list, we will later always find the interface before the + corresponding addresses. */ ++nh.seq; - if (__netlink_sendreq (&nh, RTM_GETADDR) < 0 - /* Collect all data for every interface. */ - || __netlink_receive (&nh) < 0) + if (__netlink_request (&nh, RTM_GETADDR) < 0) { result = -1; goto exit_free; @@ -327,7 +405,7 @@ getifaddrs (struct ifaddrs **ifap) continue; /* Walk through all entries we got from the kernel and look, which - message type they contain. */ + message type they contain. */ for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size)) { /* Check if the message is what we want. */ @@ -423,7 +501,7 @@ getifaddrs (struct ifaddrs **ifap) /* Interfaces are stored in the first "newlink" entries of our list, starting in the order as we got from the kernel. */ - ifa_index = map_newlink (ifim->ifi_index - 1, ifas, + ifa_index = map_newlink (ifim->ifi_index - 1, ifas, map_newlink_data, newlink); ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags; @@ -767,8 +845,6 @@ getifaddrs (struct ifaddrs **ifap) exit_free: __netlink_free_handle (&nh); - - exit_close: __netlink_close (&nh); return result; diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h index 2b6c887fd0..7e7152935b 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/resource.h +++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/MIPS version. - Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004 + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -89,7 +89,18 @@ enum __rlimit_resource __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE - __RLIMIT_NLIMITS = 13, + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO _RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S index 8b8e0072f5..f521df1771 100644 --- a/sysdeps/unix/sysv/linux/mips/clone.S +++ b/sysdeps/unix/sysv/linux/mips/clone.S @@ -163,4 +163,4 @@ L(gotpid): END(__thread_start) -weak_alias(__clone, clone) +weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/mips/vfork.S b/sysdeps/unix/sysv/linux/mips/vfork.S index 1383ddc6a7..38b6195282 100644 --- a/sysdeps/unix/sysv/linux/mips/vfork.S +++ b/sysdeps/unix/sysv/linux/mips/vfork.S @@ -95,4 +95,4 @@ L(error): END(__vfork) libc_hidden_def(__vfork) -weak_alias(__vfork, vfork) +weak_alias (__vfork, vfork) diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h index 1a7bc68c98..45c39115f3 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_tr.h +++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2005 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,13 +21,83 @@ #include <sys/cdefs.h> #include <sys/types.h> -#include <asm/types.h> -#include <linux/if_tr.h> +/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble + and FCS/CRC (frame check sequence). */ +#define TR_ALEN 6 /* Octets in one token-ring addr */ +#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) +#define AC 0x10 +#define LLC_FRAME 0x40 + +/* LLC and SNAP constants */ +#define EXTENDED_SAP 0xAA +#define UI_CMD 0x03 + +/* This is an Token-Ring frame header. */ +struct trh_hdr +{ + u_int8_t ac; /* access control field */ + u_int8_t fc; /* frame control field */ + u_int8_t daddr[TR_ALEN]; /* destination address */ + u_int8_t saddr[TR_ALEN]; /* source address */ + u_int16_t rcf; /* route control field */ + u_int16_t rseg[8]; /* routing registers */ +}; + +/* This is an Token-Ring LLC structure */ +struct trllc +{ + u_int8_t dsap; /* destination SAP */ + u_int8_t ssap; /* source SAP */ + u_int8_t llc; /* LLC control field */ + u_int8_t protid[3]; /* protocol id */ + u_int16_t ethertype; /* ether type field */ +}; + +/* Token-Ring statistics collection data. */ +struct tr_statistics +{ + unsigned long rx_packets; /* total packets received */ + unsigned long tx_packets; /* total packets transmitted */ + unsigned long rx_bytes; /* total bytes received */ + unsigned long tx_bytes; /* total bytes transmitted */ + unsigned long rx_errors; /* bad packets received */ + unsigned long tx_errors; /* packet transmit problems */ + unsigned long rx_dropped; /* no space in linux buffers */ + unsigned long tx_dropped; /* no space available in linux */ + unsigned long multicast; /* multicast packets received */ + unsigned long transmit_collision; + + /* detailed Token-Ring errors. See IBM Token-Ring Network + Architecture for more info */ + + unsigned long line_errors; + unsigned long internal_errors; + unsigned long burst_errors; + unsigned long A_C_errors; + unsigned long abort_delimiters; + unsigned long lost_frames; + unsigned long recv_congest_count; + unsigned long frame_copied_errors; + unsigned long frequency_errors; + unsigned long token_errors; + unsigned long dummy1; +}; + +/* source routing stuff */ +#define TR_RII 0x80 +#define TR_RCF_DIR_BIT 0x80 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ +#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ +#define TR_RCF_FRAME2K 0x20 +#define TR_RCF_BROADCAST_MASK 0xC000 +#define TR_MAXRIFLEN 18 #ifdef __USE_BSD -struct trn_hdr { +struct trn_hdr +{ u_int8_t trn_ac; /* access control field */ u_int8_t trn_fc; /* field control field */ u_int8_t trn_dhost[TR_ALEN]; /* destination host */ diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h index 6672e714ff..6b2d858c9d 100644 --- a/sysdeps/unix/sysv/linux/netlinkaccess.h +++ b/sysdeps/unix/sysv/linux/netlinkaccess.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005 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 @@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden; extern int __netlink_open (struct netlink_handle *h); extern void __netlink_close (struct netlink_handle *h); extern void __netlink_free_handle (struct netlink_handle *h); -extern int __netlink_sendreq (struct netlink_handle *h, int type); -extern int __netlink_receive (struct netlink_handle *h); +extern int __netlink_request (struct netlink_handle *h, int type); #endif /* netlinkaccess.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S index a737322e2a..21ad98e501 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S @@ -34,11 +34,19 @@ ENTRY (BP_SYM (__brk)) lwz r6,8(r1) #ifdef PIC mflr r4 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,__curbrk-1b@ha + mtlr r4 + stw r3,__curbrk-1b@l(r5) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 lwz r5,__curbrk@got(r5) mtlr r4 stw r3,0(r5) +# endif #else lis r4,__curbrk@ha stw r3,__curbrk@l(r4) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c index e79d74cb75..069f94bd9d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1997-2002, 2005 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,7 +28,7 @@ #ifdef __NR_ftruncate64 #ifndef __ASSUME_TRUNCATE64_SYSCALL /* The variable is shared between all wrappers around *truncate64 calls. */ -extern int have_no_truncate64; +extern int __have_no_truncate64; #endif @@ -39,7 +39,7 @@ __ftruncate64 (fd, length) off64_t length; { #ifndef __ASSUME_TRUNCATE64_SYSCALL - if (! have_no_truncate64) + if (! __have_no_truncate64) #endif { #ifndef __ASSUME_TRUNCATE64_SYSCALL @@ -57,7 +57,7 @@ __ftruncate64 (fd, length) #ifndef __ASSUME_TRUNCATE64_SYSCALL __set_errno (saved_errno); - have_no_truncate64 = 1; + __have_no_truncate64 = 1; #endif } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S index 4e6cf4b352..10211458d5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S @@ -129,8 +129,15 @@ ENTRY(__getcontext) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S index b7a82a0182..eff60f9bbf 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S @@ -58,8 +58,15 @@ ENTRY(__setcontext) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S index c52ad9babf..72170c95c0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S @@ -39,6 +39,8 @@ #define NARGS 3 #endif +/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used + for temp saves. 44(r1) is used to save r30. */ #define stackblock 20 #ifndef __socket @@ -69,12 +71,6 @@ ENTRY(__socket) stw r8,20+stackblock(r1) #endif #if NARGS >= 7 - stw r9,24+stackblock(r1) -#endif -#if NARGS >= 8 - stw r10,28+stackblock(r1) -#endif -#if NARGS >= 9 #error too many arguments! #endif @@ -94,6 +90,7 @@ ENTRY(__socket) mflr r9 stw r9,52(r1) cfi_offset (lr, 4) + CGOTSETUP CENABLE stw r3,16(r1) li r3,P(SOCKOP_,socket) @@ -107,6 +104,7 @@ ENTRY(__socket) lwz r4,52(r1) lwz r0,12(r1) lwz r3,8(r1) + CGOTRESTORE mtlr r4 mtcr r0 addi r1,r1,48 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S index 0c84d48d10..6e46abadb0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S @@ -130,8 +130,15 @@ ENTRY(__swapcontext) stfd fp0,_UC_FREGS+(32*8)(r3) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 @@ -272,8 +279,15 @@ L(no_vec): #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c index ce8ebc2a97..ee1b50c04b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2005 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 @@ -29,7 +29,7 @@ #ifdef __NR_truncate64 #ifndef __ASSUME_TRUNCATE64_SYSCALL /* The variable is shared between all wrappers around *truncate64 calls. */ -int have_no_truncate64; +int __have_no_truncate64; #endif @@ -40,7 +40,7 @@ truncate64 (path, length) off64_t length; { #ifndef __ASSUME_TRUNCATE64_SYSCALL - if (! have_no_truncate64) + if (! __have_no_truncate64) #endif { #ifndef __ASSUME_TRUNCATE64_SYSCALL @@ -58,7 +58,7 @@ truncate64 (path, length) #ifndef __ASSUME_TRUNCATE64_SYSCALL __set_errno (saved_errno); - have_no_truncate64 = 1; + __have_no_truncate64 = 1; #endif } @@ -68,7 +68,7 @@ truncate64 (path, length) __set_errno (EINVAL); return -1; } - return truncate (path, (off_t) length); + return __truncate (path, (off_t) length); #endif } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S index 8034559200..cf71a6df19 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S @@ -180,4 +180,4 @@ L(gotexitcodeaddr): #endif END(__makecontext) -weak_alias(__makecontext, makecontext) +weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c index fa815e9581..e2c5002390 100644 --- a/sysdeps/unix/sysv/linux/readdir64.c +++ b/sysdeps/unix/sysv/linux/readdir64.c @@ -4,4 +4,4 @@ #include <sysdeps/unix/readdir.c> -weak_alias(__readdir64, readdir64) +weak_alias (__readdir64, readdir64) diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c index d63680bf9a..bce56124ef 100644 --- a/sysdeps/unix/sysv/linux/readdir64_r.c +++ b/sysdeps/unix/sysv/linux/readdir64_r.c @@ -4,4 +4,4 @@ #include <sysdeps/unix/readdir_r.c> -weak_alias(__readdir64_r, readdir64_r) +weak_alias (__readdir64_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S index 2578b3ddc0..3b38d19488 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S @@ -72,4 +72,4 @@ ENTRY(__getcontext) br %r14 END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S index 7ad360a3a0..cce8d29735 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S @@ -69,4 +69,4 @@ ENTRY(__setcontext) br %r14 END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S index d9abb62c0b..bf70f11cc7 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S @@ -105,4 +105,4 @@ ENTRY(__swapcontext) /* Return. */ br %r14 END(__swapcontext) -weak_alias(__swapcontext, swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S index 5a0d7eca5d..8889b5359e 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S @@ -72,4 +72,4 @@ ENTRY(__getcontext) br %r14 END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S index 268f36e713..7beca847c2 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S @@ -69,4 +69,4 @@ ENTRY(__setcontext) br %r14 END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S index ef2a862c55..cb96fd3b6a 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S @@ -105,4 +105,4 @@ ENTRY(__swapcontext) /* Return. */ br %r14 END(__swapcontext) -weak_alias(__swapcontext, swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c index d94e4f62fd..0e41a11338 100644 --- a/sysdeps/unix/sysv/linux/sleep.c +++ b/sysdeps/unix/sysv/linux/sleep.c @@ -1,5 +1,5 @@ /* Implementation of the POSIX sleep function using nanosleep. - Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -21,6 +21,7 @@ #include <errno.h> #include <time.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ #include <unistd.h> #include <sys/param.h> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h index ed31b0e89c..8e7b64f996 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux/SPARC version. - Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004 + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -89,7 +89,18 @@ enum __rlimit_resource __RLIMIT_MSGQUEUE = 12, #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE - __RLIMIT_NLIMITS = 13, + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO _RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, __RLIM_NLIMITS = __RLIMIT_NLIMITS #define RLIMIT_NLIMITS __RLIMIT_NLIMITS #define RLIM_NLIMITS __RLIM_NLIMITS diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S index 4d8fdb8200..95106d149f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S @@ -104,4 +104,4 @@ __thread_start: .size __thread_start, .-__thread_start -weak_alias(__clone, clone) +weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S index f6134599e2..0e1025ff6a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S @@ -114,4 +114,4 @@ __thread_start: nop .size __thread_start, .-__thread_start -weak_alias(__clone, clone) +weak_alias (__clone, clone) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S index ea18a9ae4e..e6f5b55d6f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S @@ -62,4 +62,4 @@ ENTRY(__getcontext) END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S index 435bf99acb..88dc54e852 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S @@ -47,6 +47,6 @@ END(__libc_siglongjmp) strong_alias(__libc_siglongjmp, __longjmp) strong_alias(__libc_siglongjmp, __libc_longjmp) libc_hidden_def (__libc_longjmp) -weak_alias(__libc_siglongjmp, longjmp) -weak_alias(__libc_siglongjmp, _longjmp) -weak_alias(__libc_siglongjmp, siglongjmp) +weak_alias (__libc_siglongjmp, longjmp) +weak_alias (__libc_siglongjmp, _longjmp) +weak_alias (__libc_siglongjmp, siglongjmp) diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h index a8baf40a91..be2810e0c7 100644 --- a/sysdeps/unix/sysv/linux/sys/quota.h +++ b/sysdeps/unix/sysv/linux/sys/quota.h @@ -41,6 +41,14 @@ #include <sys/types.h> /* + * Select between different incompatible quota versions. + * Default to the version used by Linux kernel version 2.4.22 + * or later. */ +#ifndef _LINUX_QUOTA_VERSION +# define _LINUX_QUOTA_VERSION 2 +#endif + +/* * Convert diskblocks to blocks and the other way around. * currently only to fool the BSD source. :-) */ @@ -94,21 +102,33 @@ #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) -#define Q_QUOTAON 0x0100 /* enable quotas */ -#define Q_QUOTAOFF 0x0200 /* disable quotas */ -#define Q_GETQUOTA 0x0300 /* get limits and usage */ -#define Q_SETQUOTA 0x0400 /* set limits and usage */ -#define Q_SETUSE 0x0500 /* set usage */ -#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ -#define Q_SETQLIM 0x0700 /* set limits */ -#define Q_GETSTATS 0x0800 /* get collected stats */ -#define Q_RSQUASH 0x1000 /* set root_squash option */ +#if _LINUX_QUOTA_VERSION < 2 +# define Q_QUOTAON 0x0100 /* enable quotas */ +# define Q_QUOTAOFF 0x0200 /* disable quotas */ +# define Q_GETQUOTA 0x0300 /* get limits and usage */ +# define Q_SETQUOTA 0x0400 /* set limits and usage */ +# define Q_SETUSE 0x0500 /* set usage */ +# define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ +# define Q_SETQLIM 0x0700 /* set limits */ +# define Q_GETSTATS 0x0800 /* get collected stats */ +# define Q_RSQUASH 0x1000 /* set root_squash option */ +#else +# define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ +# define Q_QUOTAON 0x800002 /* turn quotas on */ +# define Q_QUOTAOFF 0x800003 /* turn quotas off */ +# define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ +# define Q_GETINFO 0x800005 /* get information about quota files */ +# define Q_SETINFO 0x800006 /* set information about quota files */ +# define Q_GETQUOTA 0x800007 /* get user quota structure */ +# define Q_SETQUOTA 0x800008 /* set user quota structure */ +#endif /* * The following structure defines the format of the disk quota file * (as it appears on disk) - the file is an array of these structures * indexed by user or group number. */ +#if _LINUX_QUOTA_VERSION < 2 struct dqblk { u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ @@ -120,13 +140,45 @@ struct dqblk time_t dqb_btime; /* time limit for excessive disk use */ time_t dqb_itime; /* time limit for excessive files */ }; +#else + +/* Flags that indicate which fields in dqblk structure are valid. */ +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct dqblk + { + u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ + u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */ + u_int64_t dqb_curspace; /* current quota block count */ + u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int64_t dqb_isoftlimit; /* preferred inode limit */ + u_int64_t dqb_curinodes; /* current # allocated inodes */ + u_int64_t dqb_btime; /* time limit for excessive disk use */ + u_int64_t dqb_itime; /* time limit for excessive files */ + u_int32_t dqb_valid; /* bitmask of QIF_* constants */ + }; +#endif /* * Shorthand notation. */ #define dq_bhardlimit dq_dqb.dqb_bhardlimit #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit -#define dq_curblocks dq_dqb.dqb_curblocks +#if _LINUX_QUOTA_VERSION < 2 +# define dq_curblocks dq_dqb.dqb_curblocks +#else +# define dq_curspace dq_dqb.dqb_curspace +# define dq_valid dq_dqb.dqb_valid +#endif #define dq_ihardlimit dq_dqb.dqb_ihardlimit #define dq_isoftlimit dq_dqb.dqb_isoftlimit #define dq_curinodes dq_dqb.dqb_curinodes @@ -135,6 +187,7 @@ struct dqblk #define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk))) +#if _LINUX_QUOTA_VERSION < 2 struct dqstats { u_int32_t lookups; @@ -147,6 +200,22 @@ struct dqstats u_int32_t free_dquots; u_int32_t syncs; }; +#else + +/* Flags that indicate which fields in dqinfo structure are valid. */ +# define IIF_BGRACE 1 +# define IIF_IGRACE 2 +# define IIF_FLAGS 4 +# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct dqinfo + { + u_int64_t dqi_bgrace; + u_int64_t dqi_igrace; + u_int32_t dqi_flags; + u_int32_t dqi_valid; + }; +#endif __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c index 7e601acf2c..637fca5968 100644 --- a/sysdeps/unix/sysv/linux/sysctl.c +++ b/sysdeps/unix/sysv/linux/sysctl.c @@ -1,5 +1,5 @@ /* Read or write system information. Linux version. - Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1996-2000,2002,2003,2005 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 @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <errno.h> +#include <string.h> /* For the real memset prototype. */ #include <sys/sysctl.h> #include <sysdep.h> diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c index 3fdff04c22..c5b389ea29 100644 --- a/sysdeps/unix/sysv/linux/system.c +++ b/sysdeps/unix/sysv/linux/system.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005 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 @@ -18,6 +18,7 @@ #include <sched.h> #include <signal.h> +#include <string.h> /* For the real memset prototype. */ #include <sysdep.h> #include <unistd.h> #include <sys/wait.h> diff --git a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c index 491fa9dfb2..5ea4c572a3 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c +++ b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c @@ -1,4 +1,4 @@ #define __getdents64 __no___getdents64_decl #include <sysdeps/unix/sysv/linux/getdents.c> #undef __getdents64 -weak_alias(__getdents, __getdents64); +weak_alias (__getdents, __getdents64); diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S index d19c9f0d09..4bbc7a4d2e 100644 --- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S +++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S @@ -85,4 +85,4 @@ L(pseudo_end): ret PSEUDO_END(__getcontext) -weak_alias(__getcontext, getcontext) +weak_alias (__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c index 6597d8980b..5deea7d1b2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c +++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c @@ -110,4 +110,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) } -weak_alias(__makecontext, makecontext) +weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S index 51e4a50712..61fc07f44f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S +++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S @@ -102,4 +102,4 @@ L(pseudo_end): ret PSEUDO_END(__setcontext) -weak_alias(__setcontext, setcontext) +weak_alias (__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S index 8d48d3bd5e..fc7996ccdc 100644 --- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S @@ -120,4 +120,4 @@ L(pseudo_end): ret PSEUDO_END(__swapcontext) -weak_alias(__swapcontext, swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S index 1cc4e3065b..c005932c0c 100644 --- a/sysdeps/x86_64/_mcount.S +++ b/sysdeps/x86_64/_mcount.S @@ -64,4 +64,4 @@ C_LABEL(_mcount) ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount -weak_alias(_mcount, mcount) +weak_alias (_mcount, mcount) |