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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [config/] [sol2.c] - Diff between revs 816 and 826

Only display areas with differences | Details | Blame | View Log

Rev 816 Rev 826
/* General Solaris system support.
/* General Solaris system support.
   Copyright (C) 2004, 2005 , 2007, 2010 Free Software Foundation, Inc.
   Copyright (C) 2004, 2005 , 2007, 2010 Free Software Foundation, Inc.
   Contributed by CodeSourcery, LLC.
   Contributed by CodeSourcery, LLC.
 
 
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 3, or (at your option)
the Free Software Foundation; either version 3, 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 COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "tree.h"
#include "tree.h"
#include "output.h"
#include "output.h"
#include "tm.h"
#include "tm.h"
#include "rtl.h"
#include "rtl.h"
#include "tm_p.h"
#include "tm_p.h"
#include "toplev.h"
#include "toplev.h"
#include "ggc.h"
#include "ggc.h"
 
 
tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
 
 
/* Attach any pending attributes for DECL to the list in *ATTRIBUTES.
/* Attach any pending attributes for DECL to the list in *ATTRIBUTES.
   Pending attributes come from #pragma or _Pragma, so this code is
   Pending attributes come from #pragma or _Pragma, so this code is
   only useful in the C family front ends, but it is included in
   only useful in the C family front ends, but it is included in
   all languages to avoid changing the target machine initializer
   all languages to avoid changing the target machine initializer
   depending on the language.  */
   depending on the language.  */
 
 
void
void
solaris_insert_attributes (tree decl, tree *attributes)
solaris_insert_attributes (tree decl, tree *attributes)
{
{
  tree *x, next;
  tree *x, next;
 
 
  if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
  if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
    for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
    for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
      {
      {
        tree name = TREE_PURPOSE (*x);
        tree name = TREE_PURPOSE (*x);
        tree value = TREE_VALUE (*x);
        tree value = TREE_VALUE (*x);
        if (DECL_NAME (decl) == name)
        if (DECL_NAME (decl) == name)
          {
          {
            if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
            if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
                || lookup_attribute ("aligned", *attributes))
                || lookup_attribute ("aligned", *attributes))
              warning (0, "ignoring %<#pragma align%> for explicitly "
              warning (0, "ignoring %<#pragma align%> for explicitly "
                       "aligned %q+D", decl);
                       "aligned %q+D", decl);
            else
            else
              *attributes = tree_cons (get_identifier ("aligned"), value,
              *attributes = tree_cons (get_identifier ("aligned"), value,
                                       *attributes);
                                       *attributes);
            next = TREE_CHAIN (*x);
            next = TREE_CHAIN (*x);
            ggc_free (*x);
            ggc_free (*x);
            *x = next;
            *x = next;
            break;
            break;
          }
          }
      }
      }
 
 
  if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
  if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
    for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
    for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
      {
      {
        tree name = TREE_PURPOSE (*x);
        tree name = TREE_PURPOSE (*x);
        if (DECL_NAME (decl) == name)
        if (DECL_NAME (decl) == name)
          {
          {
            *attributes = tree_cons (get_identifier ("init"), NULL,
            *attributes = tree_cons (get_identifier ("init"), NULL,
                                     *attributes);
                                     *attributes);
            TREE_USED (decl) = 1;
            TREE_USED (decl) = 1;
            DECL_PRESERVE_P (decl) = 1;
            DECL_PRESERVE_P (decl) = 1;
            next = TREE_CHAIN (*x);
            next = TREE_CHAIN (*x);
            ggc_free (*x);
            ggc_free (*x);
            *x = next;
            *x = next;
            break;
            break;
          }
          }
      }
      }
 
 
  if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
  if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
    for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
    for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
      {
      {
        tree name = TREE_PURPOSE (*x);
        tree name = TREE_PURPOSE (*x);
        if (DECL_NAME (decl) == name)
        if (DECL_NAME (decl) == name)
          {
          {
            *attributes = tree_cons (get_identifier ("fini"), NULL,
            *attributes = tree_cons (get_identifier ("fini"), NULL,
                                     *attributes);
                                     *attributes);
            TREE_USED (decl) = 1;
            TREE_USED (decl) = 1;
            DECL_PRESERVE_P (decl) = 1;
            DECL_PRESERVE_P (decl) = 1;
            next = TREE_CHAIN (*x);
            next = TREE_CHAIN (*x);
            ggc_free (*x);
            ggc_free (*x);
            *x = next;
            *x = next;
            break;
            break;
          }
          }
      }
      }
}
}
 
 
/* Output initializer or finalizer entries for DECL to FILE.  */
/* Output initializer or finalizer entries for DECL to FILE.  */
 
 
void
void
solaris_output_init_fini (FILE *file, tree decl)
solaris_output_init_fini (FILE *file, tree decl)
{
{
  if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
  if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
    {
    {
      fprintf (file, PUSHSECTION_FORMAT, ".init");
      fprintf (file, PUSHSECTION_FORMAT, ".init");
      ASM_OUTPUT_CALL (file, decl);
      ASM_OUTPUT_CALL (file, decl);
      fprintf (file, "\t.popsection\n");
      fprintf (file, "\t.popsection\n");
    }
    }
 
 
  if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
  if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
    {
    {
      fprintf (file, PUSHSECTION_FORMAT, ".fini");
      fprintf (file, PUSHSECTION_FORMAT, ".fini");
      ASM_OUTPUT_CALL (file, decl);
      ASM_OUTPUT_CALL (file, decl);
      fprintf (file, "\t.popsection\n");
      fprintf (file, "\t.popsection\n");
    }
    }
}
}
 
 
/* Emit an assembler directive to set symbol for DECL visibility to
/* Emit an assembler directive to set symbol for DECL visibility to
   the visibility type VIS, which must not be VISIBILITY_DEFAULT.  */
   the visibility type VIS, which must not be VISIBILITY_DEFAULT.  */
 
 
void
void
solaris_assemble_visibility (tree decl ATTRIBUTE_UNUSED,
solaris_assemble_visibility (tree decl ATTRIBUTE_UNUSED,
                             int vis ATTRIBUTE_UNUSED)
                             int vis ATTRIBUTE_UNUSED)
{
{
#ifdef HAVE_GAS_HIDDEN
#ifdef HAVE_GAS_HIDDEN
  /* Sun as uses .symbolic for STV_PROTECTED.  STV_INTERNAL is marked as
  /* Sun as uses .symbolic for STV_PROTECTED.  STV_INTERNAL is marked as
     `currently reserved', but the linker treats it like STV_HIDDEN.  Sun
     `currently reserved', but the linker treats it like STV_HIDDEN.  Sun
     Studio 12.1 cc emits .hidden instead.
     Studio 12.1 cc emits .hidden instead.
 
 
     There are 3 Sun extensions GCC doesn't yet know about: STV_EXPORTED,
     There are 3 Sun extensions GCC doesn't yet know about: STV_EXPORTED,
     STV_SINGLETON, and STV_ELIMINATE.
     STV_SINGLETON, and STV_ELIMINATE.
 
 
     See Linker and Libraries Guide, Ch. 2, Link-Editor, Defining
     See Linker and Libraries Guide, Ch. 2, Link-Editor, Defining
     Additional Symbols with a mapfile,
     Additional Symbols with a mapfile,
     http://docs.sun.com/app/docs/doc/819-0690/gdzmc?a=view
     http://docs.sun.com/app/docs/doc/819-0690/gdzmc?a=view
     and Ch. 7, Object-File Format, Symbol Table Section,
     and Ch. 7, Object-File Format, Symbol Table Section,
     http://docs.sun.com/app/docs/doc/819-0690/chapter6-79797?a=view  */
     http://docs.sun.com/app/docs/doc/819-0690/chapter6-79797?a=view  */
 
 
  static const char * const visibility_types[] = {
  static const char * const visibility_types[] = {
    NULL, "symbolic", "hidden", "hidden"
    NULL, "symbolic", "hidden", "hidden"
  };
  };
 
 
  const char *name, *type;
  const char *name, *type;
 
 
  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
  type = visibility_types[vis];
  type = visibility_types[vis];
 
 
  fprintf (asm_out_file, "\t.%s\t", type);
  fprintf (asm_out_file, "\t.%s\t", type);
  assemble_name (asm_out_file, name);
  assemble_name (asm_out_file, name);
  fprintf (asm_out_file, "\n");
  fprintf (asm_out_file, "\n");
#else
#else
  warning (OPT_Wattributes, "visibility attribute not supported "
  warning (OPT_Wattributes, "visibility attribute not supported "
           "in this configuration; ignored");
           "in this configuration; ignored");
#endif
#endif
}
}
 
 

powered by: WebSVN 2.1.0

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