aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-11-28 21:40:51 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2020-11-29 22:10:00 +0100
commit4dce3b05ec96a5f76adec23dbe92b014f9db8554 (patch)
treef1fab3a9ae5dd99563196f40134f9d337b28b8e4 /gcc/d
parent2fdf75cb70d6bedd855205d6b05bbf6afac46730 (diff)
downloadgcc-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')
-rw-r--r--gcc/d/d-target.def25
-rw-r--r--gcc/d/modules.cc14
2 files changed, 36 insertions, 3 deletions
diff --git a/gcc/d/d-target.def b/gcc/d/d-target.def
index 41b3172..728cba7 100644
--- a/gcc/d/d-target.def
+++ b/gcc/d/d-target.def
@@ -46,5 +46,30 @@ relating to the target operating system.",
void, (void),
hook_void_void)
+/* ModuleInfo section name and brackets. */
+DEFHOOKPOD
+(d_minfo_section,
+ "Contains the name of the section in which module info references should be\n\
+placed. This section is expected to be bracketed by two symbols to indicate\n\
+the start and end address of the section, so that the runtime library can\n\
+collect all modules for each loaded shared library and executable. The\n\
+default value of @code{NULL} disables the use of sections altogether.",
+ const char *, NULL)
+
+DEFHOOKPOD
+(d_minfo_start_name,
+ "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
+as the name of the symbol indicating the start address of the module info\n\
+section",
+ const char *, NULL)
+
+/* The name of the ModuleInfo section. */
+DEFHOOKPOD
+(d_minfo_end_name,
+ "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
+as the name of the symbol indicating the end address of the module info\n\
+section",
+ const char *, NULL)
+
/* Close the 'struct gcc_targetdm' definition. */
HOOK_VECTOR_END (C90_EMPTY_HACK)
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. */