Back to index

glibc  2.9
Defines | Functions
initfini.c File Reference
#include <stdlib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define SECTION(x)   asm (".section " x )


 asm ("\n#include \"defs.h\"")
 asm ("\n/*@HEADER_ENDS*/")
 asm ("\n/*@TESTS_BEGIN*/")
void dummy (void(*foo)(void))
 asm ("\n/*@TESTS_END*/")
 asm ("\n/*@_init_PROLOG_BEGINS*/")
static void call_gmon_start (void)
 SECTION (".init")
void __attribute__ ((section(".init")))
 asm ("END_INIT")
 asm ("\n/*@_init_EPILOG_ENDS*/")
 asm ("\n/*@_fini_PROLOG_BEGINS*/")
 SECTION (".fini")
void __attribute__ ((section(".fini")))
 asm ("END_FINI")
 asm ("\n/*@_fini_EPILOG_ENDS*/")
 asm ("\n/*@TRAILER_BEGINS*/")

Define Documentation

#define SECTION (   x)    asm (".section " x )

Definition at line 51 of file initfini.c.

Function Documentation

void __attribute__ ( (section(".init"))  )

Definition at line 84 of file initfini.c.

  /* We cannot use the normal constructor mechanism in gcrt1.o because it
     appears before crtbegin.o in the link, so the header elt of .ctors
     would come after the elt for __gmon_start__.  One approach is for
     gcrt1.o to reference a symbol which would be defined by some library
     module which has a constructor; but then user code's constructors
     would come first, and not be profiled.  */
  call_gmon_start ();

  asm ("ALIGN");
  /* Now the epilog. */
  asm ("\n/*@_init_PROLOG_ENDS*/");
  asm ("\n/*@_init_EPILOG_BEGINS*/");

Here is the call graph for this function:

void __attribute__ ( (section(".fini"))  )

Definition at line 110 of file initfini.c.


  /* End of the _fini prolog. */
  asm ("ALIGN");
  asm ("END_FINI");
  asm ("\n/*@_fini_PROLOG_ENDS*/");

    /* Let GCC know that _fini is not a leaf function by having a dummy
       function call here.  We arrange for this call to be omitted from
       either crt file.  */
    extern void i_am_not_a_leaf (void);
    i_am_not_a_leaf ();

  /* Beginning of the _fini epilog. */
  asm ("\n/*@_fini_EPILOG_BEGINS*/");
  SECTION (".fini");
asm ( "\n#include \"defs.h\""  )
asm ( "\n/*@HEADER_ENDS*/"  )
asm ( "\n/*@TESTS_BEGIN*/"  )
asm ( "\n/*@TESTS_END*/"  )
asm ( "\n/*@_init_PROLOG_BEGINS*/"  )
asm ( "END_INIT"  )
asm ( "\n/*@_init_EPILOG_ENDS*/"  )
asm ( "\n/*@_fini_PROLOG_BEGINS*/"  )
asm ( "END_FINI"  )
asm ( "\n/*@_fini_EPILOG_ENDS*/"  )
asm ( "\n/*@TRAILER_BEGINS*/"  )
static void call_gmon_start ( void  ) [static]

Definition at line 74 of file initfini.c.

  extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
  void (*gmon_start) (void) = __gmon_start__;

  if (gmon_start)
    gmon_start ();

Here is the call graph for this function:

Here is the caller graph for this function:

void dummy ( void(*)(void)  foo)
SECTION ( ".init"  )
SECTION ( ".fini"  )