remove static constuctors/destructors

This commit is contained in:
YamaArashi 2016-02-12 11:35:04 -08:00
parent 166e94b61c
commit fb95ff91be
6 changed files with 0 additions and 210 deletions

View File

@ -388,8 +388,6 @@ init_attributes ()
add_attribute (A_UNUSED, "unused", 0, 0, 0);
add_attribute (A_CONST, "const", 0, 0, 1);
add_attribute (A_T_UNION, "transparent_union", 0, 0, 0);
add_attribute (A_CONSTRUCTOR, "constructor", 0, 0, 1);
add_attribute (A_DESTRUCTOR, "destructor", 0, 0, 1);
add_attribute (A_MODE, "mode", 1, 1, 1);
add_attribute (A_SECTION, "section", 1, 1, 1);
add_attribute (A_ALIGNED, "aligned", 0, 1, 0);
@ -556,30 +554,6 @@ decl_attributes (node, attributes, prefix_attributes)
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
case A_CONSTRUCTOR:
if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (type) == FUNCTION_TYPE
&& decl_function_context (decl) == 0)
{
DECL_STATIC_CONSTRUCTOR (decl) = 1;
TREE_USED (decl) = 1;
}
else
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
case A_DESTRUCTOR:
if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (type) == FUNCTION_TYPE
&& decl_function_context (decl) == 0)
{
DECL_STATIC_DESTRUCTOR (decl) = 1;
TREE_USED (decl) = 1;
}
else
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
case A_MODE:
if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));

View File

@ -417,10 +417,6 @@ static int keep_next_if_subblocks;
static struct binding_level *label_level_chain;
/* Functions called automatically at the beginning and end of execution. */
tree static_ctors, static_dtors;
/* Forward declarations. */
static struct binding_level * make_binding_level PROTO((void));
@ -1993,9 +1989,6 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
DECL_NO_CHECK_MEMORY_USAGE (newdecl)
@ -7338,25 +7331,6 @@ finish_function (nested)
DECL_ARGUMENTS (fndecl) = 0;
}
if (DECL_STATIC_CONSTRUCTOR (fndecl))
{
#ifndef ASM_OUTPUT_CONSTRUCTOR
if (! flag_gnu_linker)
static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors);
else
#endif
assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
}
if (DECL_STATIC_DESTRUCTOR (fndecl))
{
#ifndef ASM_OUTPUT_DESTRUCTOR
if (! flag_gnu_linker)
static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors);
else
#endif
assemble_destructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
}
if (! nested)
{
/* Let the error reporting routines know that we're outside a

View File

@ -160,54 +160,4 @@ build_objc_string (len, str)
void
finish_file ()
{
#ifndef ASM_OUTPUT_CONSTRUCTOR
extern tree static_ctors;
#endif
#ifndef ASM_OUTPUT_DESTRUCTOR
extern tree static_dtors;
#endif
extern tree build_function_call PROTO((tree, tree));
#if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
#endif
#ifndef ASM_OUTPUT_CONSTRUCTOR
if (static_ctors)
{
tree fnname = get_file_function_name ('I');
start_function (void_list_node,
build_parse_node (CALL_EXPR, fnname, void_list_node,
NULL_TREE),
NULL_TREE, NULL_TREE, 0);
fnname = DECL_ASSEMBLER_NAME (current_function_decl);
store_parm_decls ();
for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
NULL_TREE));
finish_function (0);
assemble_constructor (IDENTIFIER_POINTER (fnname));
}
#endif
#ifndef ASM_OUTPUT_DESTRUCTOR
if (static_dtors)
{
tree fnname = get_file_function_name ('D');
start_function (void_list_node,
build_parse_node (CALL_EXPR, fnname, void_list_node,
NULL_TREE),
NULL_TREE, NULL_TREE, 0);
fnname = DECL_ASSEMBLER_NAME (current_function_decl);
store_parm_decls ();
for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
NULL_TREE));
finish_function (0);
assemble_destructor (IDENTIFIER_POINTER (fnname));
}
#endif
}

View File

@ -213,21 +213,6 @@ extern void assemble_alias PROTO((tree, tree));
for an `asm' keyword used between functions. */
extern void assemble_asm PROTO((tree));
/* Record an element in the table of global destructors.
How this is done depends on what sort of assembler and linker
are in use.
NAME should be the name of a global function to be called
at exit time. This name is output using assemble_name. */
extern void assemble_destructor PROTO((char *));
/* Likewise for global constructors. */
extern void assemble_constructor PROTO((char *));
/* Likewise for entries we want to record for garbage collection.
Garbage collection is still under development. */
extern void assemble_gc_entry PROTO((char *));
/* Output assembler code for the constant pool of a function and associated
with defining the name of the function. DECL describes the function.
NAME is the function's name. For the constant pool, we use the current
@ -480,13 +465,6 @@ extern int current_function_uses_const_pool;
/* Language-specific reason why the current function cannot be made inline. */
extern char *current_function_cannot_inline;
/* The line number of the beginning of the current function.
sdbout.c needs this so that it can output relative linenumbers. */
#ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */
extern int sdb_begin_function_line;
#endif
/* File in which assembler code is being written. */
#ifdef BUFSIZ

View File

@ -1233,11 +1233,6 @@ struct tree_type
alternative would be passed. */
#define DECL_TRANSPARENT_UNION(NODE) (DECL_CHECK (NODE)->decl.transparent_union)
/* Used in FUNCTION_DECLs to indicate that they should be run automatically
at the beginning or end of execution. */
#define DECL_STATIC_CONSTRUCTOR(NODE) (DECL_CHECK (NODE)->decl.static_ctor_flag)
#define DECL_STATIC_DESTRUCTOR(NODE) (DECL_CHECK (NODE)->decl.static_dtor_flag)
/* Used to indicate that this DECL represents a compiler-generated entity. */
#define DECL_ARTIFICIAL(NODE) (DECL_CHECK (NODE)->decl.artificial_flag)

View File

@ -49,10 +49,6 @@ Boston, MA 02111-1307, USA. */
#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
#endif
#ifndef ASM_STABS_OP
#define ASM_STABS_OP ".stabs"
#endif
/* Define the prefix to use when check_memory_usage_flag is enable. */
#ifdef NO_DOLLAR_IN_LABEL
#ifdef NO_DOT_IN_LABEL
@ -854,83 +850,6 @@ assemble_asm (string)
fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string));
}
#if 0 /* This should no longer be needed, because
flag_gnu_linker should be 0 on these systems,
which should prevent any output
if ASM_OUTPUT_CONSTRUCTOR and ASM_OUTPUT_DESTRUCTOR are absent. */
#ifndef ASM_OUTPUT_CONSTRUCTOR
#define ASM_OUTPUT_CONSTRUCTOR(file, name)
#endif
#ifndef ASM_OUTPUT_DESTRUCTOR
#define ASM_OUTPUT_DESTRUCTOR(file, name)
#endif
#endif /* 0 */
/* Record an element in the table of global destructors.
How this is done depends on what sort of assembler and linker
are in use.
NAME should be the name of a global function to be called
at exit time. This name is output using assemble_name. */
void
assemble_destructor (name)
char *name;
{
#ifdef ASM_OUTPUT_DESTRUCTOR
ASM_OUTPUT_DESTRUCTOR (asm_out_file, name);
#else
if (flag_gnu_linker)
{
/* Now tell GNU LD that this is part of the static destructor set. */
/* This code works for any machine provided you use GNU as/ld. */
fprintf (asm_out_file, "%s \"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP);
assemble_name (asm_out_file, name);
fputc ('\n', asm_out_file);
}
#endif
}
/* Likewise for global constructors. */
void
assemble_constructor (name)
char *name;
{
#ifdef ASM_OUTPUT_CONSTRUCTOR
ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name);
#else
if (flag_gnu_linker)
{
/* Now tell GNU LD that this is part of the static constructor set. */
/* This code works for any machine provided you use GNU as/ld. */
fprintf (asm_out_file, "%s \"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP);
assemble_name (asm_out_file, name);
fputc ('\n', asm_out_file);
}
#endif
}
/* Likewise for entries we want to record for garbage collection.
Garbage collection is still under development. */
void
assemble_gc_entry (name)
char *name;
{
#ifdef ASM_OUTPUT_GC_ENTRY
ASM_OUTPUT_GC_ENTRY (asm_out_file, name);
#else
if (flag_gnu_linker)
{
/* Now tell GNU LD that this is part of the static constructor set. */
fprintf (asm_out_file, "%s \"___PTR_LIST__\",22,0,0,", ASM_STABS_OP);
assemble_name (asm_out_file, name);
fputc ('\n', asm_out_file);
}
#endif
}
/* CONSTANT_POOL_BEFORE_FUNCTION may be defined as an expression with
a non-zero value if the constant pool should be output before the
start of the function, or a zero value if the pool should output