diff options
author | Greg McGary <greg@mcgary.org> | 2000-07-21 07:43:25 +0000 |
---|---|---|
committer | Greg McGary <greg@mcgary.org> | 2000-07-21 07:43:25 +0000 |
commit | df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734 (patch) | |
tree | 87acdf8e6dc9683089c6e79467adea259d105f9d /sysdeps/powerpc | |
parent | 137bca87e71138610a5b57e64b5e2619d6889853 (diff) | |
download | glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.tar.gz glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.tar.xz glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.zip |
* sysdeps/powerpc/bp-asm.h (DISCARD_BOUNDS): Rename from UNCHECK_BOUNDS.
* sysdeps/powerpc/bits/setjmp.h (JB_SIZE): New constant. * sysdeps/powerpc/elf/libc-start.c (__libc_start_main): Wrap bounds around argv & envp and each of their string members. * sysdeps/powerpc/elf/start.S: Designate BP symbols. * sysdeps/unix/sysv/linux/powerpc/brk.S: Wrap entry-point symbol in BP_SYM (). Discard bounds of address arg. * sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Discard bounds on address arg, add bounds to return value. 2000-07-21 Greg McGary <greg@mcgary.org> * sysdeps/powerpc/bp-asm.h (DISCARD_BOUNDS): Rename from UNCHECK_BOUNDS. * sysdeps/powerpc/bits/setjmp.h (JB_SIZE): New constant. * sysdeps/powerpc/elf/libc-start.c (__libc_start_main): Wrap bounds around argv & envp and each of their string members. * sysdeps/powerpc/elf/start.S: Designate BP symbols. * sysdeps/unix/sysv/linux/powerpc/brk.S: Wrap entry-point symbol in BP_SYM (). Discard bounds of address arg. * sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Discard bounds on address arg, add bounds to return value.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r-- | sysdeps/powerpc/bits/setjmp.h | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/bp-asm.h | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/elf/libc-start.c | 38 | ||||
-rw-r--r-- | sysdeps/powerpc/elf/start.S | 7 |
4 files changed, 32 insertions, 20 deletions
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h index 040a2443a3..da3f4379d2 100644 --- a/sysdeps/powerpc/bits/setjmp.h +++ b/sysdeps/powerpc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000 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 @@ -34,6 +34,7 @@ # define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ # define JB_CR 21 /* Condition code registers. */ # define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ +# define JB_SIZE (58*4) #endif #ifndef _ASM diff --git a/sysdeps/powerpc/bp-asm.h b/sysdeps/powerpc/bp-asm.h index e7a364007c..5ae4d77e6a 100644 --- a/sysdeps/powerpc/bp-asm.h +++ b/sysdeps/powerpc/bp-asm.h @@ -30,7 +30,7 @@ /* Don't check bounds, just convert the BP register to its simple pointer value. */ -# define UNCHECK_BOUNDS(rBP) \ +# define DISCARD_BOUNDS(rBP) \ lwz rBP, oVALUE(rBP) /* Check low bound, with the side effect that the BP register is converted @@ -99,7 +99,7 @@ #else -# define UNCHECK_BOUNDS(rBP) +# define DISCARD_BOUNDS(rBP) # define CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH) # define CHECK_BOUNDS_HIGH(rVALUE, rHIGH, TWLcc) # define CHECK_BOUNDS_HIGH_RTN(rVALUE, rHIGH, TWLcc) diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c index 31b3d050be..6a80bc7ee4 100644 --- a/sysdeps/powerpc/elf/libc-start.c +++ b/sysdeps/powerpc/elf/libc-start.c @@ -19,6 +19,8 @@ #include <stdlib.h> #include <unistd.h> #include <ldsodefs.h> +#include <bp-start.h> +#include <bp-sym.h> extern void __libc_init_first (int argc, char **argv, char **envp); @@ -29,18 +31,27 @@ extern void *__libc_stack_end; struct startup_info { - void *sda_base; + void *__unbounded sda_base; int (*main) (int, char **, char **, void *); int (*init) (int, char **, char **, void *); void (*fini) (void); }; int -__libc_start_main (int argc, char **argv, char **envp, - void *auxvec, void (*rtld_fini) (void), - struct startup_info *stinfo, - char **stack_on_entry) +/* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the + BPs in the arglist of startup_info.main and startup_info.init. */ +BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av, + char *__unbounded *__unbounded ubp_ev, + void *__unbounded auxvec, void (*rtld_fini) (void), + struct startup_info *__unbounded stinfo, + char *__unbounded *__unbounded stack_on_entry) { +#if __BOUNDED_POINTERS__ + char **argv; +#else +# define argv ubp_av +#endif + #ifndef SHARED /* The next variable is only here to work around a bug in gcc <= 2.7.2.2. If the address would be taken inside the expression the optimizer @@ -58,23 +69,22 @@ __libc_start_main (int argc, char **argv, char **envp, /* ...in which case, we have argc as the top thing on the stack, followed by argv (NULL-terminated), envp (likewise), and the auxilary vector. */ - argc = *(int *) stack_on_entry; - argv = stack_on_entry + 1; - envp = argv + argc + 1; - auxvec = envp; - while (*(char **) auxvec != NULL) + argc = *(int *__unbounded) stack_on_entry; + ubp_av = stack_on_entry + 1; + ubp_ev = ubp_av + argc + 1; + auxvec = ubp_ev; + while (*(char *__unbounded *__unbounded) auxvec != NULL) ++auxvec; ++auxvec; rtld_fini = NULL; } + INIT_ARGV_and_ENVIRON; + /* Store something that has some relationship to the end of the stack, for backtraces. This variable should be thread-specific. */ __libc_stack_end = stack_on_entry + 4; - /* Set the global _environ variable correctly. */ - __environ = envp; - /* Register the destructor of the dynamic linker if there is any. */ if (rtld_fini != NULL) atexit (rtld_fini); @@ -84,7 +94,7 @@ __libc_start_main (int argc, char **argv, char **envp, if (_dl_debug_impcalls) _dl_debug_message (1, "\ninitialize libc\n\n", NULL); #endif - __libc_init_first (argc, argv, envp); + __libc_init_first (argc, argv, __environ); /* Register the destructor of the program, if any. */ if (stinfo->fini) diff --git a/sysdeps/powerpc/elf/start.S b/sysdeps/powerpc/elf/start.S index 63a4979059..632505f13e 100644 --- a/sysdeps/powerpc/elf/start.S +++ b/sysdeps/powerpc/elf/start.S @@ -1,5 +1,5 @@ /* Startup code for programs linked with GNU libc. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 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 @@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include "bp-sym.h" /* These are the various addresses we require. */ .section ".rodata" @@ -35,7 +36,7 @@ weak_extern(_fini) L(start_addresses): .long _SDA_BASE_ - .long JUMPTARGET(main) + .long JUMPTARGET(BP_SYM (main)) .long JUMPTARGET(_init) .long JUMPTARGET(_fini) ASM_SIZE_DIRECTIVE(L(start_addresses)) @@ -55,7 +56,7 @@ ENTRY(_start) lis r8,L(start_addresses)@ha lwzu r13,L(start_addresses)@l(r8) /* and continue in libc-start, in glibc. */ - b JUMPTARGET(__libc_start_main) + b JUMPTARGET(BP_SYM (__libc_start_main)) END(_start) /* Define a symbol for the first piece of initialized data. */ |