00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "config.h"
00023 #include "system.h"
00024 #include "coretypes.h"
00025 #include "tree.h"
00026 #include "tm.h"
00027 #include "rtl.h"
00028 #include "tm_p.h"
00029 #include "toplev.h"
00030 #include "ggc.h"
00031
00032 tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
00033
00034
00035
00036
00037
00038
00039
00040 void
00041 solaris_insert_attributes (tree decl, tree *attributes)
00042 {
00043 tree *x, next;
00044
00045 if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
00046 for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
00047 {
00048 tree name = TREE_PURPOSE (*x);
00049 tree value = TREE_VALUE (*x);
00050 if (DECL_NAME (decl) == name)
00051 {
00052 if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
00053 || lookup_attribute ("aligned", *attributes))
00054 warning ("%Jignoring %<#pragma align%> for explicitly "
00055 "aligned %<%D%>", decl, decl);
00056 else
00057 *attributes = tree_cons (get_identifier ("aligned"), value,
00058 *attributes);
00059 next = TREE_CHAIN (*x);
00060 ggc_free (*x);
00061 *x = next;
00062 break;
00063 }
00064 }
00065
00066 if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
00067 for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
00068 {
00069 tree name = TREE_PURPOSE (*x);
00070 if (DECL_NAME (decl) == name)
00071 {
00072 *attributes = tree_cons (get_identifier ("init"), NULL,
00073 *attributes);
00074 *attributes = tree_cons (get_identifier ("used"), NULL,
00075 *attributes);
00076 next = TREE_CHAIN (*x);
00077 ggc_free (*x);
00078 *x = next;
00079 break;
00080 }
00081 }
00082
00083 if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
00084 for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
00085 {
00086 tree name = TREE_PURPOSE (*x);
00087 if (DECL_NAME (decl) == name)
00088 {
00089 *attributes = tree_cons (get_identifier ("fini"), NULL,
00090 *attributes);
00091 *attributes = tree_cons (get_identifier ("used"), NULL,
00092 *attributes);
00093 next = TREE_CHAIN (*x);
00094 ggc_free (*x);
00095 *x = next;
00096 break;
00097 }
00098 }
00099 }
00100
00101
00102
00103 void
00104 solaris_output_init_fini (FILE *file, tree decl)
00105 {
00106 if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
00107 {
00108 fprintf (file, "\t.pushsection\t\".init\"\n");
00109 ASM_OUTPUT_CALL (file, decl);
00110 fprintf (file, "\t.popsection\n");
00111 }
00112
00113 if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
00114 {
00115 fprintf (file, "\t.pushsection\t\".fini\"\n");
00116 ASM_OUTPUT_CALL (file, decl);
00117 fprintf (file, "\t.popsection\n");
00118 }
00119 }
00120