On 02/10/17 10:00, Iain Buclaw wrote:
> This patch add D language support to targets of GCC itself.
>
> Changes since previous are just removing patches for untested target
> configurations, these can be re-added later on an as-per basis.
>
> ---
>
>
> 07-v3-d-gcc-target.patch
>
>
> gcc/ChangeLog
>
> * gcc/Makefile.in (tm_d_file_list, tm_d_include_list,
> TM_D_H, D_TARGET_DEF, D_TARGET_H, D_TARGET_OBJS): New variables.
> (tm_d.h, cs-tm_d.h, default-d.o, d/d-target-hooks-def.h,
> s-d-target-hooks-def-h): New rules.
> (s-tm-texi): Also check timestamp on d-target.def.
> (generated_files): Add TM_D_H and d-target-hooks-def.h.
> (build/genhooks.o): Also depend on D_TARGET_DEF.
> * gcc/config.gcc (tm_d_file, d_target_objs, target_has_targetdm):
> New variables.
> * config/aarch64/aarch64-d.c: New file.
> * config/aarch64/aarch64-linux.h (GNU_USER_TARGET_D_CRITSEC_SIZE):
> Define.
> * config/aarch64/aarch64-protos.h (aarch64_d_target_versions): New
> prototype.
> * config/aarch64/aarch64.h (TARGET_D_CPU_VERSIONS): Define.
> * config/aarch64/t-aarch64 (aarch64-d.o): New rule.
> * config/arm/arm-d.c: New file.
> * config/arm/arm-protos.h (arm_d_target_versions): New prototype.
> * config/arm/arm.h (TARGET_D_CPU_VERSIONS): Define.
> * config/arm/linux-eabi.h (EXTRA_TARGET_D_OS_VERSIONS): Define.
> * config/arm/t-arm (arm-d.o): New rule.
> * config/default-d.c: New file.
> * config/glibc-d.c: New file.
> * config/gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/i386/i386-d.c: New file.
> * config/i386/i386-protos.h (ix86_d_target_versions): New prototype.
> * config/i386/i386.h (TARGET_D_CPU_VERSIONS): Define.
> * config/i386/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS,
> GNU_USER_TARGET_D_CRITSEC_SIZE): Define.
> * config/i386/t-i386 (i386-d.o): New rule.
> * config/kfreebsd-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/kopensolaris-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/linux-android.h (ANDROID_TARGET_D_OS_VERSIONS): Define.
> * config/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/mips/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Define.
> * config/mips/mips-d.c: New file.
> * config/mips/mips-protos.h (mips_d_target_versions): New prototype.
> * config/mips/mips.h (TARGET_D_CPU_VERSIONS): Define.
> * config/mips/t-mips (mips-d.o): New rule.
> * config/powerpcspe/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/powerpcspe/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/powerpcspe/powerpcspe-d.c: New file.
> * config/powerpcspe/powerpcspe-protos.h (rs6000_d_target_versions):
> New prototype.
> * config/powerpcspe/powerpcspe.h (TARGET_D_CPU_VERSIONS): Define.
> * config/powerpcspe/t-powerpcspe (powerpcspe-d.o): New rule.
> * config/rs6000/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/rs6000/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define.
> * config/rs6000/rs6000-d.c: New file.
> * config/rs6000/rs6000-protos.h (rs6000_d_target_versions): New
> prototype.
> * config/rs6000/t-rs6000 (rs6000-d.o): New rule.
> * config/s390/s390-d.c: New file.
> * config/s390/s390-protos.h (s390_d_target_versions): New prototype.
> * config/s390/s390.h (TARGET_D_CPU_VERSIONS): Define.
> * config/s390/t-s390 (s390-d.o): New rule.
> * config/sparc/sparc-d.c: New file.
> * config/sparc/sparc-protos.h (sparc_d_target_versions): New prototype.
> * config/sparc/sparc.h (TARGET_D_CPU_VERSIONS): Define.
> * config/sparc/t-sparc (sparc-d.o): New rule.
> * config/t-glibc (glibc-d.o): New rule.
> * gcc/configure.ac (tm_d_file): New variable.
> (tm_d_file_list, tm_d_include_list, d_target_objs): Add substitute.
> * gcc/configure: Regenerated.
> * doc/tm.texi.in: Add @node for D language, and @hook for
> TARGET_D_CPU_VERSIONS, TARGET_D_OS_VERSIONS, and TARGET_D_CRITSEC_SIZE.
> * doc/tm.texi: Regenerated.
> * gcc/genhooks.c: Include d/d-target.def.
I've not reviewed all of this, but a couple of observations.
1) We don't use the ARM64 in gcc. Please change them to AArch64.
2) The documentation for TARGET_D_CRITSEC_SIZE should probably be
explicit that the size is in bytes (it's implied by the examples). Some
hooks/macros in GCC return a size in bits, so it's best to be explicit.
I can't see any other obvious issues with the ARM and AArch64 code.
R.
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 0bde7acf914..c8b58bb8d23 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -546,6 +546,8 @@ tm_include_list=@tm_include_list@
> tm_defines=@tm_defines@
> tm_p_file_list=@tm_p_file_list@
> tm_p_include_list=@tm_p_include_list@
> +tm_d_file_list=@tm_d_file_list@
> +tm_d_include_list=@tm_d_include_list@
> build_xm_file_list=@build_xm_file_list@
> build_xm_include_list=@build_xm_include_list@
> build_xm_defines=@build_xm_defines@
> @@ -840,6 +842,7 @@ BCONFIG_H = bconfig.h $(build_xm_file_list)
> CONFIG_H = config.h $(host_xm_file_list)
> TCONFIG_H = tconfig.h $(xm_file_list)
> TM_P_H = tm_p.h $(tm_p_file_list)
> +TM_D_H = tm_d.h $(tm_d_file_list)
> GTM_H = tm.h $(tm_file_list) insn-constants.h
> TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
>
> @@ -897,9 +900,11 @@ EXCEPT_H = except.h $(HASHTAB_H)
> TARGET_DEF = target.def target-hooks-macros.h target-insns.def
> C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h
> COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h
> +D_TARGET_DEF = d/d-target.def target-hooks-macros.h
> TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h
> C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
> COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF)
> +D_TARGET_H = d/d-target.h $(D_TARGET_DEF)
> MACHMODE_H = machmode.h mode-classes.def
> HOOKS_H = hooks.h
> HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
> @@ -1174,6 +1179,9 @@ C_TARGET_OBJS=@c_target_objs@
> # Target specific, C++ specific object file
> CXX_TARGET_OBJS=@cxx_target_objs@
>
> +# Target specific, D specific object file
> +D_TARGET_OBJS=@d_target_objs@
> +
> # Target specific, Fortran specific object file
> FORTRAN_TARGET_OBJS=@fortran_target_objs@
>
> @@ -1762,6 +1770,7 @@ bconfig.h: cs-bconfig.h ; @true
> tconfig.h: cs-tconfig.h ; @true
> tm.h: cs-tm.h ; @true
> tm_p.h: cs-tm_p.h ; @true
> +tm_d.h: cs-tm_d.h ; @true
>
> cs-config.h: Makefile
> TARGET_CPU_DEFAULT="" \
> @@ -1788,6 +1797,11 @@ cs-tm_p.h: Makefile
> HEADERS="$(tm_p_include_list)" DEFINES="" \
> $(SHELL) $(srcdir)/mkconfig.sh tm_p.h
>
> +cs-tm_d.h: Makefile
> + TARGET_CPU_DEFAULT="" \
> + HEADERS="$(tm_d_include_list)" DEFINES="" \
> + $(SHELL) $(srcdir)/mkconfig.sh tm_d.h
> +
> # Don't automatically run autoconf, since configure.ac might be accidentally
> # newer than configure. Also, this writes into the source directory which
> # might be on a read-only file system. If configured for maintainer mode
> @@ -2151,6 +2165,12 @@ default-c.o: config/default-c.c
> CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
> prefix.o: $(BASEVER)
>
> +# Files used by the D language front end.
> +
> +default-d.o: config/default-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> # Language-independent files.
>
> DRIVER_DEFINES = \
> @@ -2446,6 +2466,15 @@ s-common-target-hooks-def-h:
> build/genhooks$(build_exeext)
> common/common-target-hooks-def.h
> $(STAMP) s-common-target-hooks-def-h
>
> +d/d-target-hooks-def.h: s-d-target-hooks-def-h; @true
> +
> +s-d-target-hooks-def-h: build/genhooks$(build_exeext)
> + $(RUN_GEN) build/genhooks$(build_exeext) "D Target Hook" \
> + > tmp-d-target-hooks-def.h
> + $(SHELL) $(srcdir)/../move-if-change tmp-d-target-hooks-def.h \
> + d/d-target-hooks-def.h
> + $(STAMP) s-d-target-hooks-def-h
> +
> # check if someone mistakenly only changed tm.texi.
> # We use a different pathname here to avoid a circular dependency.
> s-tm-texi: $(srcdir)/doc/../doc/tm.texi
> @@ -2469,6 +2498,7 @@ s-tm-texi: build/genhooks$(build_exeext)
> $(srcdir)/doc/tm.texi.in
> && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \
> || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \
> || test $(srcdir)/doc/tm.texi -nt
> $(srcdir)/common/common-target.def \
> + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \
> ); then \
> echo >&2 ; \
> echo You should edit $(srcdir)/doc/tm.texi.in rather than
> $(srcdir)/doc/tm.texi . >&2 ; \
> @@ -2607,14 +2637,15 @@ s-gtype: build/gengtype$(build_exeext) $(filter-out
> [%], $(GTFILES)) \
> -r gtype.state
> $(STAMP) s-gtype
>
> -generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
> +generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
> $(simple_generated_h) specs.h \
> tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
> tm-preds.h tm-constrs.h \
> $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
> options.h target-hooks-def.h insn-opinit.h \
> common/common-target-hooks-def.h pass-instances.def \
> - c-family/c-target-hooks-def.h params.list params.options
> case-cfn-macros.h \
> + c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
> + params.list params.options case-cfn-macros.h \
> cfn-operators.pd
>
> #
> @@ -2757,7 +2788,7 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H)
> $(BCONFIG_H) $(SYSTEM_H) \
> $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
> \
> $(HASH_TABLE_H) inchash.h
> build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) \
> - $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
> + $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
> build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)
> \
> $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
> build/genmatch.o : genmatch.c $(BCONFIG_H) $(SYSTEM_H) \
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 7a2e2cfffe5..e01c65a4c08 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -86,6 +86,9 @@
> # tm_p_file Location of file with declarations for functions
> # in $out_file.
> #
> +# tm_d_file A list of headers with definitions of target hook
> +# macros for the D compiler.
> +#
> # out_file The name of the machine description C support
> # file, if different from "$cpu_type/$cpu_type.c".
> #
> @@ -139,6 +142,9 @@
> # cxx_target_objs List of extra target-dependent objects that be
> # linked into the C++ compiler only.
> #
> +# d_target_objs List of extra target-dependent objects that be
> +# linked into the D compiler only.
> +#
> # fortran_target_objs List of extra target-dependent objects that be
> # linked into the fortran compiler only.
> #
> @@ -191,6 +197,9 @@
> #
> # target_has_targetm_common Set to yes or no depending on whether the
> # target has its own definition of targetm_common.
> +#
> +# target_has_targetdm Set to yes or no depending on whether the target
> +# has its own definition of targetdm.
>
> out_file=
> common_out_file=
> @@ -206,9 +215,11 @@ extra_gcc_objs=
> extra_options=
> c_target_objs=
> cxx_target_objs=
> +d_target_objs=
> fortran_target_objs=
> target_has_targetcm=no
> target_has_targetm_common=yes
> +target_has_targetdm=no
> tm_defines=
> xm_defines=
> # Set this to force installation and use of collect2.
> @@ -303,6 +314,7 @@ aarch64*-*-*)
> extra_headers="arm_fp16.h arm_neon.h arm_acle.h"
> c_target_objs="aarch64-c.o"
> cxx_target_objs="aarch64-c.o"
> + d_target_objs="aarch64-d.o"
> extra_objs="aarch64-builtins.o aarch-common.o cortex-a57-fma-steering.o"
> target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.c"
> target_has_targetm_common=yes
> @@ -328,6 +340,7 @@ arm*-*-*)
> target_type_format_char='%'
> c_target_objs="arm-c.o"
> cxx_target_objs="arm-c.o"
> + d_target_objs="arm-d.o"
> extra_options="${extra_options} arm/arm-tables.opt"
> target_gtfiles="\$(srcdir)/config/arm/arm-builtins.c"
> ;;
> @@ -360,6 +373,7 @@ i[34567]86-*-*)
> cpu_type=i386
> c_target_objs="i386-c.o"
> cxx_target_objs="i386-c.o"
> + d_target_objs="i386-d.o"
> extra_options="${extra_options} fused-madd.opt"
> extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
> pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
> @@ -383,6 +397,7 @@ x86_64-*-*)
> cpu_type=i386
> c_target_objs="i386-c.o"
> cxx_target_objs="i386-c.o"
> + d_target_objs="i386-d.o"
> extra_options="${extra_options} fused-madd.opt"
> extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
> pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
> @@ -426,6 +441,7 @@ microblaze*-*-*)
> ;;
> mips*-*-*)
> cpu_type=mips
> + d_target_objs="mips-d.o"
> extra_headers="loongson.h msa.h"
> extra_objs="frame-header-opt.o"
> extra_options="${extra_options} g.opt fused-madd.opt
> mips/mips-tables.opt"
> @@ -480,6 +496,7 @@ sparc*-*-*)
> cpu_type=sparc
> c_target_objs="sparc-c.o"
> cxx_target_objs="sparc-c.o"
> + d_target_objs="sparc-d.o"
> extra_headers="visintrin.h"
> ;;
> spu*-*-*)
> @@ -487,6 +504,7 @@ spu*-*-*)
> ;;
> s390*-*-*)
> cpu_type=s390
> + d_target_objs="s390-d.o"
> extra_options="${extra_options} fused-madd.opt"
> extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
> ;;
> @@ -516,10 +534,13 @@ tilepro*-*-*)
> esac
>
> tm_file=${cpu_type}/${cpu_type}.h
> +tm_d_file=${cpu_type}/${cpu_type}.h
> if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h
> then
> tm_p_file=${cpu_type}/${cpu_type}-protos.h
> + tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-protos.h"
> fi
> +
> extra_modes=
> if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def
> then
> @@ -788,8 +809,10 @@ case ${target} in
> esac
> c_target_objs="${c_target_objs} glibc-c.o"
> cxx_target_objs="${cxx_target_objs} glibc-c.o"
> + d_target_objs="${d_target_objs} glibc-d.o"
> tmake_file="${tmake_file} t-glibc"
> target_has_targetcm=yes
> + target_has_targetdm=yes
> ;;
> *-*-netbsd*)
> tm_p_file="${tm_p_file} netbsd-protos.h"
> @@ -3130,6 +3153,10 @@ if [ "$common_out_file" = "" ]; then
> fi
> fi
>
> +if [ "$target_has_targetdm" = "no" ]; then
> + d_target_objs="$d_target_objs default-d.o"
> +fi
> +
> # Support for --with-cpu and related options (and a few unrelated options,
> # too).
> case ${with_cpu} in
> @@ -4608,6 +4635,7 @@ case ${target} in
> out_file="${cpu_type}/${cpu_type}.c"
> c_target_objs="${c_target_objs} ${cpu_type}-c.o"
> cxx_target_objs="${cxx_target_objs} ${cpu_type}-c.o"
> + d_target_objs="${d_target_objs} ${cpu_type}-d.o"
> tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
> ;;
>
> diff --git a/gcc/config/aarch64/aarch64-d.c b/gcc/config/aarch64/aarch64-d.c
> new file mode 100644
> index 00000000000..80045f4641f
> --- /dev/null
> +++ b/gcc/config/aarch64/aarch64-d.c
> @@ -0,0 +1,31 @@
> +/* Subroutines for the D front end on the ARM64 architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for ARM64 targets. */
> +
> +void
> +aarch64_d_target_versions (void)
> +{
> + d_add_builtin_version ("AArch64");
> + d_add_builtin_version ("D_HardFloat");
> +}
> diff --git a/gcc/config/aarch64/aarch64-linux.h
> b/gcc/config/aarch64/aarch64-linux.h
> index 2103344a47c..16dfbc4a1ec 100644
> --- a/gcc/config/aarch64/aarch64-linux.h
> +++ b/gcc/config/aarch64/aarch64-linux.h
> @@ -81,6 +81,8 @@
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_CRITSEC_SIZE 48
> +
> #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
>
> /* Uninitialized common symbols in non-PIE executables, even with
> diff --git a/gcc/config/aarch64/aarch64-protos.h
> b/gcc/config/aarch64/aarch64-protos.h
> index e67c2ed5e80..286bc8e88d7 100644
> --- a/gcc/config/aarch64/aarch64-protos.h
> +++ b/gcc/config/aarch64/aarch64-protos.h
> @@ -482,6 +482,9 @@ enum aarch64_parse_opt_result aarch64_parse_extension
> (const char *,
> std::string aarch64_get_extension_string_for_isa_flags (unsigned long,
> unsigned long);
>
> +/* Defined in aarch64-d.c */
> +extern void aarch64_d_target_versions (void);
> +
> rtl_opt_pass *make_pass_fma_steering (gcc::context *ctxt);
>
> #endif /* GCC_AARCH64_PROTOS_H */
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 0786b283719..e85c7e29fcc 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -26,6 +26,9 @@
> #define TARGET_CPU_CPP_BUILTINS() \
> aarch64_cpu_cpp_builtins (pfile)
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS aarch64_d_target_versions
> +
>
>
> #define REGISTER_TARGET_PRAGMAS() aarch64_register_pragmas ()
> diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64
> index 32532864cae..cae6a061b30 100644
> --- a/gcc/config/aarch64/t-aarch64
> +++ b/gcc/config/aarch64/t-aarch64
> @@ -56,6 +56,10 @@ aarch64-c.o: $(srcdir)/config/aarch64/aarch64-c.c
> $(CONFIG_H) $(SYSTEM_H) \
> $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> $(srcdir)/config/aarch64/aarch64-c.c
>
> +aarch64-d.o: $(srcdir)/config/aarch64/aarch64-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> PASSES_EXTRA += $(srcdir)/config/aarch64/aarch64-passes.def
>
> cortex-a57-fma-steering.o:
> $(srcdir)/config/aarch64/cortex-a57-fma-steering.c \
> diff --git a/gcc/config/arm/arm-d.c b/gcc/config/arm/arm-d.c
> new file mode 100644
> index 00000000000..e2bec6e36ec
> --- /dev/null
> +++ b/gcc/config/arm/arm-d.c
> @@ -0,0 +1,53 @@
> +/* Subroutines for the D front end on the ARM architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "tm_p.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for ARM targets. */
> +
> +void
> +arm_d_target_versions (void)
> +{
> + d_add_builtin_version ("ARM");
> +
> + if (TARGET_THUMB || TARGET_THUMB2)
> + {
> + d_add_builtin_version ("Thumb");
> + d_add_builtin_version ("ARM_Thumb");
> + }
> +
> + if (TARGET_HARD_FLOAT_ABI)
> + d_add_builtin_version ("ARM_HardFloat");
> + else
> + {
> + if (TARGET_SOFT_FLOAT)
> + d_add_builtin_version ("ARM_SoftFloat");
> + else if (TARGET_HARD_FLOAT)
> + d_add_builtin_version ("ARM_SoftFP");
> + }
> +
> + if (TARGET_SOFT_FLOAT)
> + d_add_builtin_version ("D_SoftFloat");
> + else if (TARGET_HARD_FLOAT)
> + d_add_builtin_version ("D_HardFloat");
> +}
> diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
> index 4538078fe60..56c854fbad6 100644
> --- a/gcc/config/arm/arm-protos.h
> +++ b/gcc/config/arm/arm-protos.h
> @@ -352,6 +352,9 @@ extern void arm_lang_object_attributes_init (void);
> extern void arm_register_target_pragmas (void);
> extern void arm_cpu_cpp_builtins (struct cpp_reader *);
>
> +/* Defined in arm-d.c */
> +extern void arm_d_target_versions (void);
> +
> extern bool arm_is_constant_pool_ref (rtx);
>
> /* The bits in this mask specify which instruction scheduling options should
> diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
> index a3ca800f7a5..de965026207 100644
> --- a/gcc/config/arm/arm.h
> +++ b/gcc/config/arm/arm.h
> @@ -47,6 +47,9 @@ extern char arm_arch_name[];
> /* Target CPU builtins. */
> #define TARGET_CPU_CPP_BUILTINS() arm_cpu_cpp_builtins (pfile)
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS arm_d_target_versions
> +
> #include "config/arm/arm-opts.h"
>
> /* The processor for which instructions should be scheduled. */
> diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
> index a08cfb34377..ad217c48e9b 100644
> --- a/gcc/config/arm/linux-eabi.h
> +++ b/gcc/config/arm/linux-eabi.h
> @@ -30,6 +30,9 @@
> } \
> while (false)
>
> +#define EXTRA_TARGET_D_OS_VERSIONS() \
> + ANDROID_TARGET_D_OS_VERSIONS();
> +
> /* We default to a soft-float ABI so that binaries can run on all
> target hardware. If you override this to use the hard-float ABI then
> change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */
> diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm
> index d9ff654ba41..7f669668bdb 100644
> --- a/gcc/config/arm/t-arm
> +++ b/gcc/config/arm/t-arm
> @@ -144,4 +144,8 @@ arm-c.o: $(srcdir)/config/arm/arm-c.c $(CONFIG_H)
> $(SYSTEM_H) \
> $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> $(srcdir)/config/arm/arm-c.c
>
> +arm-d.o: $(srcdir)/config/arm/arm-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> arm-common.o: arm-cpu-cdata.h
> diff --git a/gcc/config/default-d.c b/gcc/config/default-d.c
> new file mode 100644
> index 00000000000..935ae4f6091
> --- /dev/null
> +++ b/gcc/config/default-d.c
> @@ -0,0 +1,25 @@
> +/* Default D language target hooks initializer.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify it under
> +the terms of the GNU General Public License as published by the Free
> +Software Foundation; either version 3, or (at your option) any later
> +version.
> +
> +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
> +WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> +for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm_d.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
> diff --git a/gcc/config/glibc-d.c b/gcc/config/glibc-d.c
> new file mode 100644
> index 00000000000..6f31f8215cb
> --- /dev/null
> +++ b/gcc/config/glibc-d.c
> @@ -0,0 +1,73 @@
> +/* Glibc support needed only by D front-end.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify it under
> +the terms of the GNU General Public License as published by the Free
> +Software Foundation; either version 3, or (at your option) any later
> +version.
> +
> +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
> +WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
> +for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "memmodel.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +#include "tm_p.h"
> +
> +/* Implement TARGET_D_OS_VERSIONS for Glibc targets. */
> +
> +static void
> +glibc_d_os_builtins (void)
> +{
> + if (OPTION_GLIBC)
> + d_add_builtin_version ("CRuntime_Glibc");
> + else if (OPTION_UCLIBC)
> + d_add_builtin_version ("CRuntime_UClibc");
> + else if (OPTION_BIONIC)
> + d_add_builtin_version ("CRuntime_Bionic");
> + else if (OPTION_MUSL)
> + d_add_builtin_version ("CRuntime_Musl");
> +
> + d_add_builtin_version ("Posix");
> +
> +#define builtin_version(TXT) d_add_builtin_version (TXT)
> +
> +#ifdef GNU_USER_TARGET_D_OS_VERSIONS
> + GNU_USER_TARGET_D_OS_VERSIONS ();
> +#endif
> +
> +#ifdef EXTRA_TARGET_D_OS_VERSIONS
> + EXTRA_TARGET_D_OS_VERSIONS ();
> +#endif
> +}
> +
> +/* Implement TARGET_D_CRITSEC_SIZE for Glibc targets. */
> +
> +static unsigned
> +glibc_d_critsec_size (void)
> +{
> + /* This is the sizeof pthread_mutex_t. */
> +#ifdef GNU_USER_TARGET_D_CRITSEC_SIZE
> + return GNU_USER_TARGET_D_CRITSEC_SIZE;
> +#else
> + return (POINTER_SIZE == 64) ? 40 : 24;
> +#endif
> +}
> +
> +#undef TARGET_D_OS_VERSIONS
> +#define TARGET_D_OS_VERSIONS glibc_d_os_builtins
> +
> +#undef TARGET_D_CRITSEC_SIZE
> +#define TARGET_D_CRITSEC_SIZE glibc_d_critsec_size
> +
> +struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
> diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h
> index 42be8952337..b6c2fbde84c 100644
> --- a/gcc/config/gnu.h
> +++ b/gcc/config/gnu.h
> @@ -31,3 +31,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
> builtin_assert ("system=unix"); \
> builtin_assert ("system=posix"); \
> } while (0)
> +
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("Hurd")
> diff --git a/gcc/config/i386/i386-d.c b/gcc/config/i386/i386-d.c
> new file mode 100644
> index 00000000000..2a1790178e2
> --- /dev/null
> +++ b/gcc/config/i386/i386-d.c
> @@ -0,0 +1,44 @@
> +/* Subroutines for the D front end on the x86 architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for x86 targets. */
> +
> +void
> +ix86_d_target_versions (void)
> +{
> + if (TARGET_64BIT)
> + {
> + d_add_builtin_version ("X86_64");
> +
> + if (TARGET_X32)
> + d_add_builtin_version ("D_X32");
> + }
> + else
> + d_add_builtin_version ("X86");
> +
> + if (TARGET_80387)
> + d_add_builtin_version ("D_HardFloat");
> + else
> + d_add_builtin_version ("D_SoftFloat");
> +}
> diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
> index fbe9f271434..b9bf720e202 100644
> --- a/gcc/config/i386/i386-protos.h
> +++ b/gcc/config/i386/i386-protos.h
> @@ -243,6 +243,9 @@ extern bool ix86_bnd_prefixed_insn_p (rtx);
> extern void ix86_target_macros (void);
> extern void ix86_register_pragmas (void);
>
> +/* In i386-d.c */
> +extern void ix86_d_target_versions (void);
> +
> /* In winnt.c */
> extern void i386_pe_unique_section (tree, int);
> extern void i386_pe_declare_function_type (FILE *, const char *, int);
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index 899ba8b3706..38b03a72a6b 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -668,6 +668,9 @@ extern const char *host_detect_local_cpu (int argc, const
> char **argv);
> /* Target Pragmas. */
> #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas ()
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS ix86_d_target_versions
> +
> #ifndef CC1_SPEC
> #define CC1_SPEC "%(cc1_cpu) "
> #endif
> diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
> index 6380639b204..ad4e2518217 100644
> --- a/gcc/config/i386/linux-common.h
> +++ b/gcc/config/i386/linux-common.h
> @@ -27,6 +27,12 @@ along with GCC; see the file COPYING3. If not see
> } \
> while (0)
>
> +#define EXTRA_TARGET_D_OS_VERSIONS() \
> + ANDROID_TARGET_D_OS_VERSIONS();
> +
> +#define GNU_USER_TARGET_D_CRITSEC_SIZE \
> + (TARGET_64BIT ? (POINTER_SIZE == 64 ? 40 : 32) : 24)
> +
> #undef CC1_SPEC
> #define CC1_SPEC \
> LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
> diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
> index 0a8524bfbe2..1587c8930e7 100644
> --- a/gcc/config/i386/t-i386
> +++ b/gcc/config/i386/t-i386
> @@ -24,6 +24,10 @@ i386-c.o: $(srcdir)/config/i386/i386-c.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> +i386-d.o: $(srcdir)/config/i386/i386-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> i386.o: i386-builtin-types.inc
>
> i386-builtin-types.inc: s-i386-bt ; @true
> diff --git a/gcc/config/kfreebsd-gnu.h b/gcc/config/kfreebsd-gnu.h
> index 26a8cef8753..3fe857c6394 100644
> --- a/gcc/config/kfreebsd-gnu.h
> +++ b/gcc/config/kfreebsd-gnu.h
> @@ -29,6 +29,9 @@ along with GCC; see the file COPYING3. If not see
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("FreeBSD")
> +
> #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
> #define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32
> #define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64
> diff --git a/gcc/config/kopensolaris-gnu.h b/gcc/config/kopensolaris-gnu.h
> index 67150eb0cba..fbb5a83505a 100644
> --- a/gcc/config/kopensolaris-gnu.h
> +++ b/gcc/config/kopensolaris-gnu.h
> @@ -30,5 +30,8 @@ along with GCC; see the file COPYING3. If not see
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("Solaris")
> +
> #undef GNU_USER_DYNAMIC_LINKER
> #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h
> index 19c55c3a5c7..8dbe7ea5ed1 100644
> --- a/gcc/config/linux-android.h
> +++ b/gcc/config/linux-android.h
> @@ -25,6 +25,12 @@
> builtin_define ("__ANDROID__"); \
> } while (0)
>
> +#define ANDROID_TARGET_D_OS_VERSIONS() \
> + do { \
> + if (TARGET_ANDROID) \
> + builtin_version ("Android"); \
> + } while (0)
> +
> #if ANDROID_DEFAULT
> # define NOANDROID "mno-android"
> #else
> diff --git a/gcc/config/linux.h b/gcc/config/linux.h
> index b3a9e85e77f..950f3a557b1 100644
> --- a/gcc/config/linux.h
> +++ b/gcc/config/linux.h
> @@ -53,6 +53,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.
> If not, see
> builtin_assert ("system=posix"); \
> } while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("linux")
> +
> /* Determine which dynamic linker to use depending on whether GLIBC or
> uClibc or Bionic or musl is the default C library and whether
> -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
> diff --git a/gcc/config/mips/linux-common.h b/gcc/config/mips/linux-common.h
> index 6c8fda7184e..2035ef29d22 100644
> --- a/gcc/config/mips/linux-common.h
> +++ b/gcc/config/mips/linux-common.h
> @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see
> ANDROID_TARGET_OS_CPP_BUILTINS(); \
> } while (0)
>
> +#define EXTRA_TARGET_D_OS_VERSIONS() \
> + ANDROID_TARGET_D_OS_VERSIONS();
> +
> #undef LINK_SPEC
> #define LINK_SPEC \
> LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
> diff --git a/gcc/config/mips/mips-d.c b/gcc/config/mips/mips-d.c
> new file mode 100644
> index 00000000000..7e940d1499f
> --- /dev/null
> +++ b/gcc/config/mips/mips-d.c
> @@ -0,0 +1,56 @@
> +/* Subroutines for the D front end on the MIPS architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for MIPS targets. */
> +
> +void
> +mips_d_target_versions (void)
> +{
> + if (TARGET_64BIT)
> + d_add_builtin_version ("MIPS64");
> + else
> + d_add_builtin_version ("MIPS32");
> +
> + if (mips_abi == ABI_32)
> + d_add_builtin_version ("MIPS_O32");
> + else if (mips_abi == ABI_EABI)
> + d_add_builtin_version ("MIPS_EABI");
> + else if (mips_abi == ABI_N32)
> + d_add_builtin_version ("MIPS_N32");
> + else if (mips_abi == ABI_64)
> + d_add_builtin_version ("MIPS_N64");
> + else if (mips_abi == ABI_O64)
> + d_add_builtin_version ("MIPS_O64");
> +
> + if (TARGET_HARD_FLOAT_ABI)
> + {
> + d_add_builtin_version ("MIPS_HardFloat");
> + d_add_builtin_version ("D_HardFloat");
> + }
> + else if (TARGET_SOFT_FLOAT_ABI)
> + {
> + d_add_builtin_version ("MIPS_SoftFloat");
> + d_add_builtin_version ("D_SoftFloat");
> + }
> +}
> diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
> index 1c4167a836a..8741e5c2f9b 100644
> --- a/gcc/config/mips/mips-protos.h
> +++ b/gcc/config/mips/mips-protos.h
> @@ -386,4 +386,7 @@ extern mulsidi3_gen_fn mips_mulsidi3_gen_fn (enum
> rtx_code);
> extern void mips_register_frame_header_opt (void);
> extern void mips_expand_vec_cond_expr (machine_mode, machine_mode, rtx *);
>
> +/* Routines implemented in mips-d.c */
> +extern void mips_d_target_versions (void);
> +
> #endif /* ! GCC_MIPS_PROTOS_H */
> diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
> index a2d8c7c1350..f9a4e30c98d 100644
> --- a/gcc/config/mips/mips.h
> +++ b/gcc/config/mips/mips.h
> @@ -644,6 +644,9 @@ struct mips_cpu_info {
> }
> \
> while (0)
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS mips_d_target_versions
> +
> /* Default target_flags if no switches are specified */
>
> #ifndef TARGET_DEFAULT
> diff --git a/gcc/config/mips/t-mips b/gcc/config/mips/t-mips
> index 774506e3279..79f27227851 100644
> --- a/gcc/config/mips/t-mips
> +++ b/gcc/config/mips/t-mips
> @@ -24,3 +24,7 @@ $(srcdir)/config/mips/mips-tables.opt:
> $(srcdir)/config/mips/genopt.sh \
> frame-header-opt.o: $(srcdir)/config/mips/frame-header-opt.c
> $(COMPILE) $<
> $(POSTCOMPILE)
> +
> +mips-d.o: $(srcdir)/config/mips/mips-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> diff --git a/gcc/config/powerpcspe/linux.h b/gcc/config/powerpcspe/linux.h
> index 684afd6c190..390a1182d6a 100644
> --- a/gcc/config/powerpcspe/linux.h
> +++ b/gcc/config/powerpcspe/linux.h
> @@ -57,6 +57,9 @@
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("linux")
> +
> #undef CPP_OS_DEFAULT_SPEC
> #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
>
> diff --git a/gcc/config/powerpcspe/linux64.h b/gcc/config/powerpcspe/linux64.h
> index 88cbeca6fe9..54bd279c736 100644
> --- a/gcc/config/powerpcspe/linux64.h
> +++ b/gcc/config/powerpcspe/linux64.h
> @@ -391,6 +391,9 @@ extern int dot_symbols;
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("linux")
> +
> #undef CPP_OS_DEFAULT_SPEC
> #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
>
> diff --git a/gcc/config/powerpcspe/powerpcspe-d.c
> b/gcc/config/powerpcspe/powerpcspe-d.c
> new file mode 100644
> index 00000000000..3f7c4e1807d
> --- /dev/null
> +++ b/gcc/config/powerpcspe/powerpcspe-d.c
> @@ -0,0 +1,45 @@
> +/* Subroutines for the D front end on the PowerPC architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for PowerPC targets. */
> +
> +void
> +rs6000_d_target_versions (void)
> +{
> + if (TARGET_64BIT)
> + d_add_builtin_version ("PPC64");
> + else
> + d_add_builtin_version ("PPC");
> +
> + if (TARGET_HARD_FLOAT)
> + {
> + d_add_builtin_version ("PPC_HardFloat");
> + d_add_builtin_version ("D_HardFloat");
> + }
> + else if (TARGET_SOFT_FLOAT)
> + {
> + d_add_builtin_version ("PPC_SoftFloat");
> + d_add_builtin_version ("D_SoftFloat");
> + }
> +}
> diff --git a/gcc/config/powerpcspe/powerpcspe-protos.h
> b/gcc/config/powerpcspe/powerpcspe-protos.h
> index 78baeecad38..a0678a297d4 100644
> --- a/gcc/config/powerpcspe/powerpcspe-protos.h
> +++ b/gcc/config/powerpcspe/powerpcspe-protos.h
> @@ -233,6 +233,9 @@ extern void rs6000_target_modify_macros (bool,
> HOST_WIDE_INT, HOST_WIDE_INT);
> extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT,
> HOST_WIDE_INT);
>
> +/* Declare functions in powerpcspe-d.c */
> +extern void rs6000_d_target_versions (void);
> +
> #if TARGET_MACHO
> char *output_call (rtx_insn *, rtx *, int, int);
> #endif
> diff --git a/gcc/config/powerpcspe/powerpcspe.h
> b/gcc/config/powerpcspe/powerpcspe.h
> index 8381785067c..69ff0cb1561 100644
> --- a/gcc/config/powerpcspe/powerpcspe.h
> +++ b/gcc/config/powerpcspe/powerpcspe.h
> @@ -822,6 +822,9 @@ extern unsigned char rs6000_recip_bits[];
> #define TARGET_CPU_CPP_BUILTINS() \
> rs6000_cpu_cpp_builtins (pfile)
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS rs6000_d_target_versions
> +
> /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order
> we're compiling for. Some configurations may need to override it. */
> #define RS6000_CPU_CPP_ENDIAN_BUILTINS() \
> diff --git a/gcc/config/powerpcspe/t-powerpcspe
> b/gcc/config/powerpcspe/t-powerpcspe
> index fba99508757..8cc0f14969d 100644
> --- a/gcc/config/powerpcspe/t-powerpcspe
> +++ b/gcc/config/powerpcspe/t-powerpcspe
> @@ -26,6 +26,10 @@ powerpcspe-c.o: $(srcdir)/config/powerpcspe/powerpcspe-c.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> +powerpcspe-d.o: $(srcdir)/config/powerpcspe/powerpcspe-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> $(srcdir)/config/powerpcspe/powerpcspe-tables.opt:
> $(srcdir)/config/powerpcspe/genopt.sh \
> $(srcdir)/config/powerpcspe/powerpcspe-cpus.def
> $(SHELL) $(srcdir)/config/powerpcspe/genopt.sh
> $(srcdir)/config/powerpcspe > \
> diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
> index e4158d26abb..e751c09856a 100644
> --- a/gcc/config/rs6000/linux.h
> +++ b/gcc/config/rs6000/linux.h
> @@ -57,6 +57,9 @@
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("linux")
> +
> #undef CPP_OS_DEFAULT_SPEC
> #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
>
> diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
> index 13b769211b1..336aeab2aa4 100644
> --- a/gcc/config/rs6000/linux64.h
> +++ b/gcc/config/rs6000/linux64.h
> @@ -391,6 +391,9 @@ extern int dot_symbols;
> } \
> while (0)
>
> +#define GNU_USER_TARGET_D_OS_VERSIONS() \
> + builtin_version ("linux")
> +
> #undef CPP_OS_DEFAULT_SPEC
> #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
>
> diff --git a/gcc/config/rs6000/rs6000-d.c b/gcc/config/rs6000/rs6000-d.c
> new file mode 100644
> index 00000000000..3f7c4e1807d
> --- /dev/null
> +++ b/gcc/config/rs6000/rs6000-d.c
> @@ -0,0 +1,45 @@
> +/* Subroutines for the D front end on the PowerPC architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for PowerPC targets. */
> +
> +void
> +rs6000_d_target_versions (void)
> +{
> + if (TARGET_64BIT)
> + d_add_builtin_version ("PPC64");
> + else
> + d_add_builtin_version ("PPC");
> +
> + if (TARGET_HARD_FLOAT)
> + {
> + d_add_builtin_version ("PPC_HardFloat");
> + d_add_builtin_version ("D_HardFloat");
> + }
> + else if (TARGET_SOFT_FLOAT)
> + {
> + d_add_builtin_version ("PPC_SoftFloat");
> + d_add_builtin_version ("D_SoftFloat");
> + }
> +}
> diff --git a/gcc/config/rs6000/rs6000-protos.h
> b/gcc/config/rs6000/rs6000-protos.h
> index 781349b850e..b4cfd56c341 100644
> --- a/gcc/config/rs6000/rs6000-protos.h
> +++ b/gcc/config/rs6000/rs6000-protos.h
> @@ -234,6 +234,9 @@ extern void rs6000_target_modify_macros (bool,
> HOST_WIDE_INT, HOST_WIDE_INT);
> extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT,
> HOST_WIDE_INT);
>
> +/* Declare functions in rs6000-d.c */
> +extern void rs6000_d_target_versions (void);
> +
> #if TARGET_MACHO
> char *output_call (rtx_insn *, rtx *, int, int);
> #endif
> diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
> index 304f322f435..7bd4bef9f80 100644
> --- a/gcc/config/rs6000/t-rs6000
> +++ b/gcc/config/rs6000/t-rs6000
> @@ -26,6 +26,10 @@ rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> +rs6000-d.o: $(srcdir)/config/rs6000/rs6000-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> +
> rs6000-string.o: $(srcdir)/config/rs6000/rs6000-string.c
> $(COMPILE) $<
> $(POSTCOMPILE)
> diff --git a/gcc/config/s390/s390-d.c b/gcc/config/s390/s390-d.c
> new file mode 100644
> index 00000000000..477982fd5d0
> --- /dev/null
> +++ b/gcc/config/s390/s390-d.c
> @@ -0,0 +1,41 @@
> +/* Subroutines for the D front end on the IBM S/390 and zSeries
> architectures.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for S/390 and zSeries targets. */
> +
> +void
> +s390_d_target_versions (void)
> +{
> + if (TARGET_ZARCH)
> + d_add_builtin_version ("SystemZ");
> + else if (TARGET_64BIT)
> + d_add_builtin_version ("S390X");
> + else
> + d_add_builtin_version ("S390");
> +
> + if (TARGET_SOFT_FLOAT)
> + d_add_builtin_version ("D_SoftFloat");
> + else if (TARGET_HARD_FLOAT)
> + d_add_builtin_version ("D_HardFloat");
> +}
> diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
> index 84b30704d9e..b8d84900f72 100644
> --- a/gcc/config/s390/s390-protos.h
> +++ b/gcc/config/s390/s390-protos.h
> @@ -153,3 +153,6 @@ extern void s390_register_target_pragmas (void);
>
> /* Routines for s390-c.c */
> extern bool s390_const_operand_ok (tree, int, int, tree);
> +
> +/* Routines for s390-d.c */
> +extern void s390_d_target_versions (void);
> diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
> index 52eee948bdf..6d995ceda78 100644
> --- a/gcc/config/s390/s390.h
> +++ b/gcc/config/s390/s390.h
> @@ -194,6 +194,9 @@ enum processor_flags
> /* Target CPU builtins. */
> #define TARGET_CPU_CPP_BUILTINS() s390_cpu_cpp_builtins (pfile)
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS s390_d_target_versions
> +
> #ifdef DEFAULT_TARGET_64BIT
> #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP \
> | MASK_OPT_HTM | MASK_OPT_VX)
> diff --git a/gcc/config/s390/t-s390 b/gcc/config/s390/t-s390
> index 69ce684669a..ee11f482561 100644
> --- a/gcc/config/s390/t-s390
> +++ b/gcc/config/s390/t-s390
> @@ -25,3 +25,7 @@ s390-c.o: $(srcdir)/config/s390/s390-c.c \
> $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H)
> $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
> $(srcdir)/config/s390/s390-c.c
> +
> +s390-d.o: $(srcdir)/config/s390/s390-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> diff --git a/gcc/config/sparc/sparc-d.c b/gcc/config/sparc/sparc-d.c
> new file mode 100644
> index 00000000000..59de10a02c8
> --- /dev/null
> +++ b/gcc/config/sparc/sparc-d.c
> @@ -0,0 +1,48 @@
> +/* Subroutines for the D front end on the SPARC architecture.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +GNU General Public License for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3. If not see
> +<http://www.gnu.org/licenses/>. */
> +
> +#include "config.h"
> +#include "system.h"
> +#include "coretypes.h"
> +#include "tm.h"
> +#include "d/d-target.h"
> +#include "d/d-target-def.h"
> +
> +/* Implement TARGET_D_CPU_VERSIONS for SPARC targets. */
> +
> +void
> +sparc_d_target_versions (void)
> +{
> + if (TARGET_64BIT)
> + d_add_builtin_version ("SPARC64");
> + else
> + d_add_builtin_version ("SPARC");
> +
> + if (TARGET_V8PLUS)
> + d_add_builtin_version ("SPARC_V8Plus");
> +
> + if (TARGET_FPU)
> + {
> + d_add_builtin_version ("D_HardFloat");
> + d_add_builtin_version ("SPARC_HardFloat");
> + }
> + else
> + {
> + d_add_builtin_version ("D_SoftFloat");
> + d_add_builtin_version ("SPARC_SoftFloat");
> + }
> +}
> diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
> index 507f0b1bd41..bbd65ebc0c0 100644
> --- a/gcc/config/sparc/sparc-protos.h
> +++ b/gcc/config/sparc/sparc-protos.h
> @@ -111,4 +111,7 @@ unsigned int sparc_regmode_natural_size (machine_mode);
>
> extern rtl_opt_pass *make_pass_work_around_errata (gcc::context *);
>
> +/* Routines implemented in sparc-d.c */
> +extern void sparc_d_target_versions (void);
> +
> #endif /* __SPARC_PROTOS_H__ */
> diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
> index 9ac741f569b..91caeb23a4e 100644
> --- a/gcc/config/sparc/sparc.h
> +++ b/gcc/config/sparc/sparc.h
> @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see
>
> #define TARGET_CPU_CPP_BUILTINS() sparc_target_macros ()
>
> +/* Target CPU versions for D. */
> +#define TARGET_D_CPU_VERSIONS sparc_d_target_versions
> +
> /* Specify this in a cover file to provide bi-architecture (32/64) support.
> */
> /* #define SPARC_BI_ARCH */
>
> diff --git a/gcc/config/sparc/t-sparc b/gcc/config/sparc/t-sparc
> index f512937cfa9..6883649b797 100644
> --- a/gcc/config/sparc/t-sparc
> +++ b/gcc/config/sparc/t-sparc
> @@ -23,3 +23,7 @@ PASSES_EXTRA += $(srcdir)/config/sparc/sparc-passes.def
> sparc-c.o: $(srcdir)/config/sparc/sparc-c.c
> $(COMPILE) $<
> $(POSTCOMPILE)
> +
> +sparc-d.o: $(srcdir)/config/sparc/sparc-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> diff --git a/gcc/config/t-glibc b/gcc/config/t-glibc
> index 99094f8d020..25bb4fea3fd 100644
> --- a/gcc/config/t-glibc
> +++ b/gcc/config/t-glibc
> @@ -19,3 +19,7 @@
> glibc-c.o: config/glibc-c.c
> $(COMPILE) $<
> $(POSTCOMPILE)
> +
> +glibc-d.o: config/glibc-d.c
> + $(COMPILE) $<
> + $(POSTCOMPILE)
> diff --git a/gcc/configure b/gcc/configure
> index 13f97cd3663..ef5b9385804 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -612,6 +612,7 @@ ISLLIBS
> GMPINC
> GMPLIBS
> target_cpu_default
> +d_target_objs
> fortran_target_objs
> cxx_target_objs
> c_target_objs
> @@ -619,6 +620,8 @@ use_gcc_stdint
> xm_defines
> xm_include_list
> xm_file_list
> +tm_d_include_list
> +tm_d_file_list
> tm_p_include_list
> tm_p_file_list
> tm_defines
> @@ -11802,6 +11805,7 @@ fi
>
> tm_file="${tm_file} defaults.h"
> tm_p_file="${tm_p_file} tm-preds.h"
> +tm_d_file="${tm_d_file} defaults.h"
> host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
> build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
> # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
> @@ -12171,6 +12175,21 @@ for f in $tm_p_file; do
> esac
> done
>
> +tm_d_file_list=
> +tm_d_include_list="options.h insn-constants.h"
> +for f in $tm_d_file; do
> + case $f in
> + defaults.h )
> + tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f"
> + tm_d_include_list="${tm_d_include_list} $f"
> + ;;
> + * )
> + tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f"
> + tm_d_include_list="${tm_d_include_list} config/$f"
> + ;;
> + esac
> +done
> +
> xm_file_list=
> xm_include_list=
> for f in $xm_file; do
> @@ -18440,7 +18459,7 @@ else
> lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
> lt_status=$lt_dlunknown
> cat > conftest.$ac_ext <<_LT_EOF
> -#line 18443 "configure"
> +#line 18462 "configure"
> #include "confdefs.h"
>
> #if HAVE_DLFCN_H
> @@ -18546,7 +18565,7 @@ else
> lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
> lt_status=$lt_dlunknown
> cat > conftest.$ac_ext <<_LT_EOF
> -#line 18549 "configure"
> +#line 18568 "configure"
> #include "confdefs.h"
>
> #if HAVE_DLFCN_H
> @@ -29541,6 +29560,9 @@ fi
>
>
>
> +
> +
> +
> # Echo link setup.
> if test x${build} = x${host} ; then
> if test x${host} = x${target} ; then
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 82711389281..88dc0bd57e5 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -1724,6 +1724,7 @@ AC_SUBST(build_subdir)
>
> tm_file="${tm_file} defaults.h"
> tm_p_file="${tm_p_file} tm-preds.h"
> +tm_d_file="${tm_d_file} defaults.h"
> host_xm_file="auto-host.h ansidecl.h ${host_xm_file}"
> build_xm_file="${build_auto} ansidecl.h ${build_xm_file}"
> # We don't want ansidecl.h in target files, write code there in ISO/GNU C.
> @@ -1946,6 +1947,21 @@ for f in $tm_p_file; do
> esac
> done
>
> +tm_d_file_list=
> +tm_d_include_list="options.h insn-constants.h"
> +for f in $tm_d_file; do
> + case $f in
> + defaults.h )
> + tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f"
> + tm_d_include_list="${tm_d_include_list} $f"
> + ;;
> + * )
> + tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f"
> + tm_d_include_list="${tm_d_include_list} config/$f"
> + ;;
> + esac
> +done
> +
> xm_file_list=
> xm_include_list=
> for f in $xm_file; do
> @@ -6211,6 +6227,8 @@ AC_SUBST(tm_include_list)
> AC_SUBST(tm_defines)
> AC_SUBST(tm_p_file_list)
> AC_SUBST(tm_p_include_list)
> +AC_SUBST(tm_d_file_list)
> +AC_SUBST(tm_d_include_list)
> AC_SUBST(xm_file_list)
> AC_SUBST(xm_include_list)
> AC_SUBST(xm_defines)
> @@ -6218,6 +6236,7 @@ AC_SUBST(use_gcc_stdint)
> AC_SUBST(c_target_objs)
> AC_SUBST(cxx_target_objs)
> AC_SUBST(fortran_target_objs)
> +AC_SUBST(d_target_objs)
> AC_SUBST(target_cpu_default)
>
> AC_SUBST_FILE(language_hooks)
> diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
> index 8f503e1904e..a9470d0452f 100644
> --- a/gcc/doc/tm.texi
> +++ b/gcc/doc/tm.texi
> @@ -52,6 +52,7 @@ through the macros defined in the @file{.h} file.
> * MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
> * PCH Target:: Validity checking for precompiled headers.
> * C++ ABI:: Controlling C++ ABI changes.
> +* D Language and ABI:: Controlling D ABI changes.
> * Named Address Spaces:: Adding support for named address spaces
> * Misc:: Everything else.
> @end menu
> @@ -106,6 +107,14 @@ documented as ``Common Target Hook''. This is declared
> in
> @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a
> default definition is used.
>
> +Similarly, there is a @code{targetdm} variable for hooks that are
> +specific to the D language front end, documented as ``D Target Hook''.
> +This is declared in @file{d/d-target.h}, the initializer
> +@code{TARGETDM_INITIALIZER} in @file{d/d-target-def.h}. If targets
> +initialize @code{targetdm} themselves, they should set
> +@code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default
> +definition is used.
> +
> @node Driver
> @section Controlling the Compilation Driver, @file{gcc}
> @cindex driver
> @@ -10501,6 +10510,22 @@ unloaded. The default is to return false.
> Return target-specific mangling context of @var{decl} or @code{NULL_TREE}.
> @end deftypefn
>
> +@node D Language and ABI
> +@section D ABI parameters
> +@cindex parameters, d abi
> +
> +@deftypefn {D Target Hook} void TARGET_D_CPU_VERSIONS (void)
> +Declare all environmental version identifiers relating to the target CPU
> using the function @code{builtin_version}, which takes a string representing
> the name of the version. Version identifiers predefined by this hook apply
> to all modules and being compiled and imported.
> +@end deftypefn
> +
> +@deftypefn {D Target Hook} void TARGET_D_OS_VERSIONS (void)
> +Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions relating
> to the target operating system.
> +@end deftypefn
> +
> +@deftypefn {D Target Hook} unsigned TARGET_D_CRITSEC_SIZE (void)
> +Returns the size of the data structure used by the targeted operating system
> for critical sections and monitors. For example, on Microsoft Windows this
> would return the @code{sizeof(CRITICAL_SECTION)}, while other platforms that
> implement pthreads would return @code{sizeof(pthread_mutex_t)}.
> +@end deftypefn
> +
> @node Named Address Spaces
> @section Adding support for named address spaces
> @cindex named address spaces
> diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
> index 15b3f1f6771..77748cc182b 100644
> --- a/gcc/doc/tm.texi.in
> +++ b/gcc/doc/tm.texi.in
> @@ -52,6 +52,7 @@ through the macros defined in the @file{.h} file.
> * MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
> * PCH Target:: Validity checking for precompiled headers.
> * C++ ABI:: Controlling C++ ABI changes.
> +* D Language and ABI:: Controlling D ABI changes.
> * Named Address Spaces:: Adding support for named address spaces
> * Misc:: Everything else.
> @end menu
> @@ -106,6 +107,14 @@ documented as ``Common Target Hook''. This is declared
> in
> @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a
> default definition is used.
>
> +Similarly, there is a @code{targetdm} variable for hooks that are
> +specific to the D language front end, documented as ``D Target Hook''.
> +This is declared in @file{d/d-target.h}, the initializer
> +@code{TARGETDM_INITIALIZER} in @file{d/d-target-def.h}. If targets
> +initialize @code{targetdm} themselves, they should set
> +@code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default
> +definition is used.
> +
> @node Driver
> @section Controlling the Compilation Driver, @file{gcc}
> @cindex driver
> @@ -7277,6 +7286,16 @@ floating-point support; they are not included in this
> mechanism.
>
> @hook TARGET_CXX_DECL_MANGLING_CONTEXT
>
> +@node D Language and ABI
> +@section D ABI parameters
> +@cindex parameters, d abi
> +
> +@hook TARGET_D_CPU_VERSIONS
> +
> +@hook TARGET_D_OS_VERSIONS
> +
> +@hook TARGET_D_CRITSEC_SIZE
> +
> @node Named Address Spaces
> @section Adding support for named address spaces
> @cindex named address spaces
> diff --git a/gcc/genhooks.c b/gcc/genhooks.c
> index fb380c586ff..cefe0a14831 100644
> --- a/gcc/genhooks.c
> +++ b/gcc/genhooks.c
> @@ -34,6 +34,7 @@ static struct hook_desc hook_array[] = {
> #include "target.def"
> #include "c-family/c-target.def"
> #include "common/common-target.def"
> +#include "d/d-target.def"
> #undef DEFHOOK
> };
>
>