Print this page
crt: Need a position-independent CRT for PIE
- Implement the greatest possible part of the crt1 in C
- Implement SPARC versions of the ASM sections of crt1
- Build crt1 position-independently, minor ASM updates to be position
  independent
- Implement crt1 with the hook expected by modern GCC to support
  profiling, make gcrt1 a symlink for source compatibility (older GCC
  initializes profiling at firsnt use of _mcount if necessary, so
  doesn't need the gcrt)
- Split the CRT out of developer/library/lint into a separate c-runtime package


  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #include "thr_uberdata.h"
  27 #include <procfs.h>
  28 #include <ucontext.h>
  29 #include <setjmp.h>
  30 
  31 /*
  32  * The stack needs to be 16-byte aligned with a 4-byte bias.  See comment in
  33  * lib/libc/i386/gen/makectxt.c.
  34  *
  35  * Note: If you change it, you need to change it in the following files as
  36  * well:
  37  *
  38  *  - lib/libc/i386/gen/makectxt.c
  39  *  - lib/common/i386/crti.s
  40  *  - lib/common/i386/crt1.s
  41  */
  42 #undef  STACK_ALIGN
  43 #define STACK_ALIGN     16
  44 
  45 extern int getlwpstatus(thread_t, lwpstatus_t *);
  46 extern int putlwpregs(thread_t, prgregset_t);
  47 
  48 void *
  49 setup_top_frame(void *stk, size_t stksize, ulwp_t *ulwp)
  50 {
  51         uint32_t *stack;
  52         struct {
  53                 uint32_t        rpc;
  54                 uint32_t        arg;
  55                 uint32_t        pad;
  56                 uint32_t        fp;
  57                 uint32_t        pc;
  58         } frame;
  59 
  60         /*




  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #include "thr_uberdata.h"
  27 #include <procfs.h>
  28 #include <ucontext.h>
  29 #include <setjmp.h>
  30 
  31 /*
  32  * The stack needs to be 16-byte aligned with a 4-byte bias.  See comment in
  33  * lib/libc/i386/gen/makectxt.c.
  34  *
  35  * Note: If you change it, you need to change it in the following files as
  36  * well:
  37  *
  38  *  - lib/libc/i386/gen/makectxt.c
  39  *  - lib/crt/i86/crti.s
  40  *  - lib/crt/i86/crt1.s
  41  */
  42 #undef  STACK_ALIGN
  43 #define STACK_ALIGN     16
  44 
  45 extern int getlwpstatus(thread_t, lwpstatus_t *);
  46 extern int putlwpregs(thread_t, prgregset_t);
  47 
  48 void *
  49 setup_top_frame(void *stk, size_t stksize, ulwp_t *ulwp)
  50 {
  51         uint32_t *stack;
  52         struct {
  53                 uint32_t        rpc;
  54                 uint32_t        arg;
  55                 uint32_t        pad;
  56                 uint32_t        fp;
  57                 uint32_t        pc;
  58         } frame;
  59 
  60         /*