diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-28 21:40:51 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-29 22:10:00 +0100 |
commit | 4dce3b05ec96a5f76adec23dbe92b014f9db8554 (patch) | |
tree | f1fab3a9ae5dd99563196f40134f9d337b28b8e4 /gcc/d/modules.cc | |
parent | 2fdf75cb70d6bedd855205d6b05bbf6afac46730 (diff) | |
download | gcc-4dce3b05ec96a5f76adec23dbe92b014f9db8554.zip gcc-4dce3b05ec96a5f76adec23dbe92b014f9db8554.tar.gz gcc-4dce3b05ec96a5f76adec23dbe92b014f9db8554.tar.bz2 |
d: Add darwin support for D language front-end
gcc/ChangeLog:
* config.gcc (*-*-darwin*): Set d_target_objs and target_has_targetdm.
* config/elfos.h (TARGET_D_MINFO_SECTION): New macro.
(TARGET_D_MINFO_START_NAME): New macro.
(TARGET_D_MINFO_END_NAME): New macro.
* config/t-darwin: Add darwin-d.o.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_MINFO_SECTION, TARGET_D_MINFO_START_NAME, and
TARGET_D_MINFO_END_NAME.
* config/darwin-d.c: New file.
gcc/d/ChangeLog:
* d-target.def (d_minfo_section): New hook.
(d_minfo_start_name): New hook.
(d_minfo_end_name): New hook.
* modules.cc: Include d-target.h.
(register_moduleinfo): Update to use new targetdm hooks.
Diffstat (limited to 'gcc/d/modules.cc')
-rw-r--r-- | gcc/d/modules.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index 4b48c19..742a24f 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "d-tree.h" +#include "d-target.h" /* D generates module information to inform the runtime library which modules @@ -405,6 +406,10 @@ build_dso_registry_var (const char * name, tree type) static void register_moduleinfo (Module *decl, tree minfo) { + /* No defined minfo section for target. */ + if (targetdm.d_minfo_section == NULL) + return; + if (!targetm_common.have_named_sections) sorry ("%<-fmoduleinfo%> is not supported on this target"); @@ -420,7 +425,8 @@ register_moduleinfo (Module *decl, tree minfo) DECL_EXTERNAL (mref) = 0; DECL_PRESERVE_P (mref) = 1; - set_decl_section_name (mref, "minfo"); + set_decl_section_name (mref, targetdm.d_minfo_section); + symtab_node::get (mref)->implicit_section = true; d_pushdecl (mref); rest_of_decl_compilation (mref, 1, 0); @@ -431,10 +437,12 @@ register_moduleinfo (Module *decl, tree minfo) if (!first_module) return; - start_minfo_node = build_dso_registry_var ("__start_minfo", ptr_type_node); + start_minfo_node = build_dso_registry_var (targetdm.d_minfo_start_name, + ptr_type_node); rest_of_decl_compilation (start_minfo_node, 1, 0); - stop_minfo_node = build_dso_registry_var ("__stop_minfo", ptr_type_node); + stop_minfo_node = build_dso_registry_var (targetdm.d_minfo_end_name, + ptr_type_node); rest_of_decl_compilation (stop_minfo_node, 1, 0); /* Declare dso_slot and dso_initialized. */ |