OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [frv/] [frvbegin.c] - Diff between revs 38 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 154
/* Frv initialization file linked before all user modules
/* Frv initialization file linked before all user modules
   Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
   Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
    Contributed by Red Hat, Inc.
 
 
   This file is part of GCC.
   This file is part of GCC.
 
 
   GCC is free software ; you can redistribute it and/or modify
   GCC is free software ; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation * either version 2, or (at your option)
   the Free Software Foundation * either version 2, or (at your option)
   any later version.
   any later version.
 
 
   GCC is distributed in the hope that it will be useful,
   GCC is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY ; without even the implied warranty of
   but WITHOUT ANY WARRANTY ; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with GCC; see the file COPYING.  If not, write to
   along with GCC; see the file COPYING.  If not, write to
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
   Boston, MA 02110-1301, USA.
 
 
   This file was originally taken from the file crtstuff.c in the
   This file was originally taken from the file crtstuff.c in the
   main compiler directory, and simplified.  */
   main compiler directory, and simplified.  */
 
 
/* As a special exception, if you link this library with other files,
/* As a special exception, if you link this library with other files,
   some of which are compiled with GCC, to produce an executable,
   some of which are compiled with GCC, to produce an executable,
   this library does not by itself cause the resulting executable
   this library does not by itself cause the resulting executable
   to be covered by the GNU General Public License.
   to be covered by the GNU General Public License.
   This exception does not however invalidate any other reasons why
   This exception does not however invalidate any other reasons why
   the executable file might be covered by the GNU General Public License.  */
   the executable file might be covered by the GNU General Public License.  */
 
 
#include "defaults.h"
#include "defaults.h"
#include <stddef.h>
#include <stddef.h>
#include "unwind-dw2-fde.h"
#include "unwind-dw2-fde.h"
#include "gbl-ctors.h"
#include "gbl-ctors.h"
 
 
/*  Declare a pointer to void function type.  */
/*  Declare a pointer to void function type.  */
#define STATIC static
#define STATIC static
 
 
#ifdef __FRV_UNDERSCORE__
#ifdef __FRV_UNDERSCORE__
#define UNDERSCORE "_"
#define UNDERSCORE "_"
#else
#else
#define UNDERSCORE ""
#define UNDERSCORE ""
#endif
#endif
 
 
#define INIT_SECTION_NEG_ONE(SECTION, FLAGS, NAME)                      \
#define INIT_SECTION_NEG_ONE(SECTION, FLAGS, NAME)                      \
__asm__ (".section " SECTION "," FLAGS "\n\t"                           \
__asm__ (".section " SECTION "," FLAGS "\n\t"                           \
         ".globl   " UNDERSCORE NAME "\n\t"                             \
         ".globl   " UNDERSCORE NAME "\n\t"                             \
         ".type    " UNDERSCORE NAME ",@object\n\t"                     \
         ".type    " UNDERSCORE NAME ",@object\n\t"                     \
         ".p2align  2\n"                                                \
         ".p2align  2\n"                                                \
         UNDERSCORE NAME ":\n\t"                                        \
         UNDERSCORE NAME ":\n\t"                                        \
         ".word     -1\n\t"                                             \
         ".word     -1\n\t"                                             \
         ".previous")
         ".previous")
 
 
#define INIT_SECTION(SECTION, FLAGS, NAME)                              \
#define INIT_SECTION(SECTION, FLAGS, NAME)                              \
__asm__ (".section " SECTION "," FLAGS "\n\t"                           \
__asm__ (".section " SECTION "," FLAGS "\n\t"                           \
         ".globl   " UNDERSCORE NAME "\n\t"                             \
         ".globl   " UNDERSCORE NAME "\n\t"                             \
         ".type    " UNDERSCORE NAME ",@object\n\t"                     \
         ".type    " UNDERSCORE NAME ",@object\n\t"                     \
         ".p2align  2\n"                                                \
         ".p2align  2\n"                                                \
         UNDERSCORE NAME ":\n\t"                                        \
         UNDERSCORE NAME ":\n\t"                                        \
         ".previous")
         ".previous")
 
 
/* Beginning of .ctor/.dtor sections that provides a list of constructors and
/* Beginning of .ctor/.dtor sections that provides a list of constructors and
   destructors to run.  */
   destructors to run.  */
 
 
INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__");
INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__");
INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__");
INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__");
 
 
/* Beginning of .eh_frame section that provides all of the exception handling
/* Beginning of .eh_frame section that provides all of the exception handling
   tables.  */
   tables.  */
 
 
INIT_SECTION (".eh_frame", "\"aw\"", "__EH_FRAME_BEGIN__");
INIT_SECTION (".eh_frame", "\"aw\"", "__EH_FRAME_BEGIN__");
 
 
#if ! __FRV_FDPIC__
#if ! __FRV_FDPIC__
/* In FDPIC, the linker itself generates this.  */
/* In FDPIC, the linker itself generates this.  */
/* Beginning of .rofixup section that provides a list of pointers that we
/* Beginning of .rofixup section that provides a list of pointers that we
   need to adjust.  */
   need to adjust.  */
 
 
INIT_SECTION (".rofixup", "\"a\"", "__ROFIXUP_LIST__");
INIT_SECTION (".rofixup", "\"a\"", "__ROFIXUP_LIST__");
#endif /* __FRV_FDPIC__ */
#endif /* __FRV_FDPIC__ */
 
 
extern void __frv_register_eh(void) __attribute__((__constructor__));
extern void __frv_register_eh(void) __attribute__((__constructor__));
extern void __frv_deregister_eh(void) __attribute__((__destructor__));
extern void __frv_deregister_eh(void) __attribute__((__destructor__));
 
 
extern func_ptr __EH_FRAME_BEGIN__[];
extern func_ptr __EH_FRAME_BEGIN__[];
 
 
/* Register the exception handling table as the first constructor.  */
/* Register the exception handling table as the first constructor.  */
void
void
__frv_register_eh (void)
__frv_register_eh (void)
{
{
  static struct object object;
  static struct object object;
  if (__register_frame_info)
  if (__register_frame_info)
    __register_frame_info (__EH_FRAME_BEGIN__, &object);
    __register_frame_info (__EH_FRAME_BEGIN__, &object);
}
}
 
 
/* Note, do not declare __{,de}register_frame_info weak as it seems
/* Note, do not declare __{,de}register_frame_info weak as it seems
   to interfere with the pic support.  */
   to interfere with the pic support.  */
 
 
/* Unregister the exception handling table as a deconstructor.  */
/* Unregister the exception handling table as a deconstructor.  */
void
void
__frv_deregister_eh (void)
__frv_deregister_eh (void)
{
{
  static int completed = 0;
  static int completed = 0;
 
 
  if (completed)
  if (completed)
    return;
    return;
 
 
  if (__deregister_frame_info)
  if (__deregister_frame_info)
    __deregister_frame_info (__EH_FRAME_BEGIN__);
    __deregister_frame_info (__EH_FRAME_BEGIN__);
 
 
  completed = 1;
  completed = 1;
}
}
 
 
/* Run the global destructors.  */
/* Run the global destructors.  */
void
void
__do_global_dtors (void)
__do_global_dtors (void)
{
{
  static func_ptr *p = __DTOR_LIST__ + 1;
  static func_ptr *p = __DTOR_LIST__ + 1;
  while (*p)
  while (*p)
    {
    {
      p++;
      p++;
      (*(p-1)) ();
      (*(p-1)) ();
    }
    }
}
}
 
 
/* Run the global constructors.  */
/* Run the global constructors.  */
void
void
__do_global_ctors (void)
__do_global_ctors (void)
{
{
  unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
  unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
  unsigned i;
  unsigned i;
 
 
  if (nptrs == (unsigned long)-1)
  if (nptrs == (unsigned long)-1)
    for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
    for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
 
 
  for (i = nptrs; i >= 1; i--)
  for (i = nptrs; i >= 1; i--)
    __CTOR_LIST__[i] ();
    __CTOR_LIST__[i] ();
 
 
  atexit (__do_global_dtors);
  atexit (__do_global_dtors);
}
}
 
 
/* Subroutine called automatically by `main'.
/* Subroutine called automatically by `main'.
   Compiling a global function named `main'
   Compiling a global function named `main'
   produces an automatic call to this function at the beginning.
   produces an automatic call to this function at the beginning.
 
 
   For many systems, this routine calls __do_global_ctors.
   For many systems, this routine calls __do_global_ctors.
   For systems which support a .init section we use the .init section
   For systems which support a .init section we use the .init section
   to run __do_global_ctors, so we need not do anything here.  */
   to run __do_global_ctors, so we need not do anything here.  */
 
 
void
void
__main (void)
__main (void)
{
{
  /* Support recursive calls to `main': run initializers just once.  */
  /* Support recursive calls to `main': run initializers just once.  */
  static int initialized;
  static int initialized;
  if (! initialized)
  if (! initialized)
    {
    {
      initialized = 1;
      initialized = 1;
      __do_global_ctors ();
      __do_global_ctors ();
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.