diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-03-14 18:11:14 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-03-28 14:47:35 +0200 |
commit | 65c001bfaf778e83ded451f94d2a0da528758dd8 (patch) | |
tree | 04d037e0ee151f92d1f9c47e2405ca8fe2fac994 /gcc/d | |
parent | d21001c793e97d88013d05226a8ea93a149726b1 (diff) | |
download | gcc-65c001bfaf778e83ded451f94d2a0da528758dd8.zip gcc-65c001bfaf778e83ded451f94d2a0da528758dd8.tar.gz gcc-65c001bfaf778e83ded451f94d2a0da528758dd8.tar.bz2 |
d: Don't generate per-module wrapper for calling DSO constructor/destructor.
The static constructor/destructor list only ever has one function to
call in it, so mark the gdc.dso_ctor and gdc.dso_dtor functions as
static ctor/dtor directly instead.
gcc/d/ChangeLog:
* config-lang.in (gtfiles): Remove modules.cc.
* modules.cc (struct module_info): Remove GTY marker.
(static_ctor_list): Remove variable.
(static_dtor_list): Remove variable.
(register_moduleinfo): Directly set DECL_STATIC_CONSTRUCTOR on
dso_ctor, and DECL_STATIC_DESTRUCTOR on dso_dtor.
(d_finish_compilation): Remove static ctor/dtor handling.
gcc/testsuite/ChangeLog:
* gdc.dg/gdc270a.d: Removed.
* gdc.dg/gdc270b.d: Removed.
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/config-lang.in | 2 | ||||
-rw-r--r-- | gcc/d/modules.cc | 36 |
2 files changed, 6 insertions, 32 deletions
diff --git a/gcc/d/config-lang.in b/gcc/d/config-lang.in index 66714ac..0568b8d 100644 --- a/gcc/d/config-lang.in +++ b/gcc/d/config-lang.in @@ -45,7 +45,7 @@ case "${noconfigdirs}" in ;; esac -gtfiles="\$(srcdir)/d/d-tree.h \$(srcdir)/d/d-builtins.cc \$(srcdir)/d/d-lang.cc \$(srcdir)/d/modules.cc \$(srcdir)/d/typeinfo.cc" +gtfiles="\$(srcdir)/d/d-tree.h \$(srcdir)/d/d-builtins.cc \$(srcdir)/d/d-lang.cc \$(srcdir)/d/typeinfo.cc" # Do not build by default. build_by_default="no" diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index f51277e..af69815 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -75,7 +75,7 @@ static tree stop_minfo_node; /* Record information about module initialization, termination, unit testing, and thread local storage in the compilation. */ -struct GTY(()) module_info +struct module_info { vec <tree, va_gc> *ctors; vec <tree, va_gc> *dtors; @@ -121,11 +121,6 @@ static module_info *current_testing_module; static Module *current_module_decl; -/* Static constructors and destructors (not D `static this'). */ - -static GTY(()) vec <tree, va_gc> *static_ctor_list; -static GTY(()) vec <tree, va_gc> *static_dtor_list; - /* Returns an internal function identified by IDENT. This is used by both module initialization and dso handlers. */ @@ -460,10 +455,12 @@ register_moduleinfo (Module *decl, tree minfo) /* Declare dso_ctor() and dso_dtor(). */ tree dso_ctor = build_dso_cdtor_fn (true); - vec_safe_push (static_ctor_list, dso_ctor); + DECL_STATIC_CONSTRUCTOR (dso_ctor) = 1; + decl_init_priority_insert (dso_ctor, DEFAULT_INIT_PRIORITY); tree dso_dtor = build_dso_cdtor_fn (false); - vec_safe_push (static_dtor_list, dso_dtor); + DECL_STATIC_DESTRUCTOR (dso_dtor) = 1; + decl_fini_priority_insert (dso_dtor, DEFAULT_INIT_PRIORITY); first_module = false; } @@ -908,27 +905,4 @@ d_finish_compilation (tree *vec, int len) tree decl = vec[i]; wrapup_global_declarations (&decl, 1); } - - /* If the target does not directly support static constructors, - static_ctor_list contains a list of all static constructors defined - so far. This routine will create a function to call all of those - and is picked up by collect2. */ - if (static_ctor_list) - { - tree decl = build_funcs_gates_fn (get_file_function_name ("I"), - static_ctor_list, NULL); - DECL_STATIC_CONSTRUCTOR (decl) = 1; - decl_init_priority_insert (decl, DEFAULT_INIT_PRIORITY); - } - - if (static_dtor_list) - { - tree decl = build_funcs_gates_fn (get_file_function_name ("D"), - static_dtor_list, NULL); - DECL_STATIC_DESTRUCTOR (decl) = 1; - decl_fini_priority_insert (decl, DEFAULT_INIT_PRIORITY); - } } - - -#include "gt-d-modules.h" |