From patchwork Thu Sep 7 13:36:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=glnkgWuA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL1M58cGz1ygR for ; Thu, 7 Sep 2023 23:38:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A572038555A9 for ; Thu, 7 Sep 2023 13:38:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 741DD385841A for ; Thu, 7 Sep 2023 13:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 741DD385841A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31f6ddb3047so835569f8f.1 for ; Thu, 07 Sep 2023 06:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093906; x=1694698706; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=5HsKNrzMU9P/826DiSpKVPte2DI+FYeQKq9oQw58P0w=; b=glnkgWuAKtufzkN/Bp8Nj+PTbVDRLMVR74zMJ53A3x7UdXlVmK/tfnG58rI1Q/NgO5 qE8Inv1NCycqvgoW/7QDx8/CWziE4B+KFCnsdrgBJaGURwSWmrSgW+9XV5jmjzacxFWQ CfFe2GHTLPxliEiUZgLFwc7Cvcyp00DaX3F+MWgW60zUHLT4e6k14LpOj3g1eRp8H8gI NysvkDUckJIbHr/41kF0TRG+xdsNoxcjCL7lwTZSIbGUwrXQ0AxkPOftjJyir8sNyIcL +XKXmhKDYk0QoSg3WEktYCnTAxiJI0WF/1EFXNxJwWCsc3Tg0NTIxI51iLbApVSTv6hj LqxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093906; x=1694698706; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5HsKNrzMU9P/826DiSpKVPte2DI+FYeQKq9oQw58P0w=; b=cLcvwRUyt+aGKs2UVOtL1HTsh4EXLRjYkTt99CEysGq6l4YJG2FY7eAuXoMI56enxz 9UfPMGxeOD2B1uxKmU1ff8lh/+ENROgVZeXuKEs8NjFSCrWw7odJ+QWZEg+wIZckAsw+ fFlJC2sGGwRCJKxLgALM4kaUV2MnrxGVTKXXGx+D1g0cXCccM6Q78L1L8+fWQ8r7UaEY XFYH4SRkj4jy02hGLOOcyLo1x8ANLrlh0TihB1uG3MAZEN/nWkSLKiNx0uKpFXKzEsDB Z1BmD9t9vKcwbhm66rjMr7x29dy0n3X2FbHJPnUhK5VmljdSTlH1u/V1aahAtH6IOXG4 nmEA== X-Gm-Message-State: AOJu0Ywtrl27NnXSg1rxg4PMGpIpWT68eWYiSN4LLkoy6sSMDtVCUxA8 plCUvl83uC1+WFHyQImhDKRlDCEG0ibrxa6s+Q== X-Google-Smtp-Source: AGHT+IEyWw3ZU8uCU6EIDNkaJwuWXzd0AbvnUTj/iVWr3nP+3AMDsga3zN76F6JqxAbxELXh2LzSRw== X-Received: by 2002:adf:f749:0:b0:319:785a:fce5 with SMTP id z9-20020adff749000000b00319785afce5mr4768849wrp.38.1694093905494; Thu, 07 Sep 2023 06:38:25 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:25 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 01/14] rust: Add skeleton support and documentation for targetrustm hooks. Date: Thu, 7 Sep 2023 15:36:27 +0200 Message-ID: <20230907133729.2518969-2-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LINEPADDING, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * Makefile.in (tm_rust_file_list, tm_rust_include_list, TM_RUST_H, RUST_TARGET_DEF, RUST_TARGET_H, RUST_TARGET_OBJS): New variables. (tm_rust.h, cs-tm_rust.h, default-rust.o, rust/rust-target-hooks-def.h, s-rust-target-hooks-def-h): New rules. (s-tm-texi): Also check timestamp on rust-target.def. (generated_files): Add TM_RUST_H and rust-target-hooks-def.h. (build/genhooks.o): Also depend on RUST_TARGET_DEF. * config.gcc (tm_rust_file, rust_target_objs, target_has_targetrustm): New variables. * configure: Regenerate. * configure.ac (tm_rust_file_list, tm_rust_include_list, rust_target_objs): Add substitutes. * doc/tm.texi: Regenerate. * doc/tm.texi.in (targetrustm): Document. (target_has_targetrustm): Document. * genhooks.cc: Include rust/rust-target.def. * config/default-rust.cc: New file. gcc/rust/ChangeLog: * rust-target-def.h: New file. * rust-target.def: New file. * rust-target.h: New file. --- gcc/Makefile.in | 34 +++++++++++++++++++++++++++++++++- gcc/config.gcc | 25 +++++++++++++++++++++++++ gcc/config/default-rust.cc | 29 +++++++++++++++++++++++++++++ gcc/configure | 21 +++++++++++++++++++-- gcc/configure.ac | 14 ++++++++++++++ gcc/doc/tm.texi | 8 ++++++++ gcc/doc/tm.texi.in | 8 ++++++++ gcc/genhooks.cc | 1 + gcc/rust/rust-target-def.h | 20 ++++++++++++++++++++ gcc/rust/rust-target.def | 32 ++++++++++++++++++++++++++++++++ gcc/rust/rust-target.h | 31 +++++++++++++++++++++++++++++++ 11 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 gcc/config/default-rust.cc create mode 100644 gcc/rust/rust-target-def.h create mode 100644 gcc/rust/rust-target.def create mode 100644 gcc/rust/rust-target.h diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6d608db4dd2..9cc16268abf 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -600,6 +600,8 @@ 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@ +tm_rust_file_list=@tm_rust_file_list@ +tm_rust_include_list=@tm_rust_include_list@ build_xm_file_list=@build_xm_file_list@ build_xm_include_list=@build_xm_include_list@ build_xm_defines=@build_xm_defines@ @@ -898,6 +900,7 @@ TCONFIG_H = tconfig.h $(xm_file_list) # Some $(target)-protos.h depends on tree.h TM_P_H = tm_p.h $(tm_p_file_list) $(TREE_H) TM_D_H = tm_d.h $(tm_d_file_list) +TM_RUST_H = tm_rust.h $(tm_rust_file_list) GTM_H = tm.h $(tm_file_list) insn-constants.h TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) @@ -956,10 +959,12 @@ 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 +RUST_TARGET_DEF = rust/rust-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) +RUST_TARGET_H = rust/rust-target.h $(RUST_TARGET_DEF) MACHMODE_H = machmode.h mode-classes.def HOOKS_H = hooks.h HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H) @@ -1268,6 +1273,9 @@ D_TARGET_OBJS=@d_target_objs@ # Target specific, Fortran specific object file FORTRAN_TARGET_OBJS=@fortran_target_objs@ +# Target specific, Rust specific object file +RUST_TARGET_OBJS=@rust_target_objs@ + # Object files for gcc many-languages driver. GCC_OBJS = gcc.o gcc-main.o ggc-none.o @@ -1999,6 +2007,7 @@ 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 +tm_rust.h: cs-tm_rust.h ; @true cs-config.h: Makefile TARGET_CPU_DEFAULT="" \ @@ -2030,6 +2039,11 @@ cs-tm_d.h: Makefile HEADERS="$(tm_d_include_list)" DEFINES="" \ $(SHELL) $(srcdir)/mkconfig.sh tm_d.h +cs-tm_rust.h: Makefile + TARGET_CPU_DEFAULT="" \ + HEADERS="$(tm_rust_include_list)" DEFINES="" \ + $(SHELL) $(srcdir)/mkconfig.sh tm_rust.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 @@ -2366,6 +2380,12 @@ default-d.o: config/default-d.cc $(COMPILE) $< $(POSTCOMPILE) +# Files used by the Rust language front end. + +default-rust.o: config/default-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + # Language-independent files. DRIVER_DEFINES = \ @@ -2672,6 +2692,15 @@ s-d-target-hooks-def-h: build/genhooks$(build_exeext) d/d-target-hooks-def.h $(STAMP) s-d-target-hooks-def-h +rust/rust-target-hooks-def.h: s-rust-target-hooks-def-h; @true + +s-rust-target-hooks-def-h: build/genhooks$(build_exeext) + $(RUN_GEN) build/genhooks$(build_exeext) "Rust Target Hook" \ + > tmp-rust-target-hooks-def.h + $(SHELL) $(srcdir)/../move-if-change tmp-rust-target-hooks-def.h \ + rust/rust-target-hooks-def.h + $(STAMP) s-rust-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 @@ -2696,6 +2725,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in || 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 \ + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/rust/rust-target.def \ ); then \ echo >&2 ; \ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \ @@ -2872,6 +2902,7 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \ $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \ gimple-match-auto.h generic-match-auto.h \ c-family/c-target-hooks-def.h d/d-target-hooks-def.h \ + $(TM_RUST_H) rust/rust-target-hooks-def.h \ case-cfn-macros.h \ cfn-operators.pd omp-device-properties.h @@ -3006,7 +3037,8 @@ build/genrecog.o : genrecog.cc $(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.cc $(TARGET_DEF) $(C_TARGET_DEF) \ - $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h + $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(RUST_TARGET_DEF) $(BCONFIG_H) \ + $(SYSTEM_H) errors.h build/genmddump.o : genmddump.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) build/genmatch.o : genmatch.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) \ diff --git a/gcc/config.gcc b/gcc/config.gcc index b2fe7c7ceef..13c575839ef 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -90,6 +90,9 @@ # tm_d_file A list of headers with definitions of target hook # macros for the D compiler. # +# tm_rust_file list of headers with definitions of target hook +# macros for the Rust compiler. +# # out_file The name of the machine description C support # file, if different from "$cpu_type/$cpu_type.c". # @@ -149,6 +152,9 @@ # fortran_target_objs List of extra target-dependent objects that be # linked into the fortran compiler only. # +# rust_target_objs List of extra target-dependent objects that be +# linked into the Rust compiler only. +# # target_gtfiles List of extra source files with type information. # # xm_defines List of macros to define when compiling for the @@ -201,6 +207,9 @@ # # target_has_targetdm Set to yes or no depending on whether the target # has its own definition of targetdm. +# +# target_has_targetrustm Set to yes or no depending on whether the target +# has its own definition of targetrustm. out_file= common_out_file= @@ -218,9 +227,11 @@ c_target_objs= cxx_target_objs= d_target_objs= fortran_target_objs= +rust_target_objs= target_has_targetcm=no target_has_targetm_common=yes target_has_targetdm=no +target_has_targetrustm=no tm_defines= xm_defines= # Set this to force installation and use of collect2. @@ -590,6 +601,16 @@ then tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-d.h" fi +tm_rust_file= +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.h +then + tm_rust_file="${cpu_type}/${cpu_type}-rust.h" +fi +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.cc +then + rust_target_objs="${rust_target_objs} ${cpu_type}-rust.o" +fi + extra_modes= if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def then @@ -3606,6 +3627,10 @@ if [ "$target_has_targetdm" = "no" ]; then d_target_objs="$d_target_objs default-d.o" fi +if [ "$target_has_targetrustm" = "no" ]; then + rust_target_objs="$rust_target_objs default-rust.o" +fi + # Support for --with-cpu and related options (and a few unrelated options, # too). case ${with_cpu} in diff --git a/gcc/config/default-rust.cc b/gcc/config/default-rust.cc new file mode 100644 index 00000000000..aa098cbb806 --- /dev/null +++ b/gcc/config/default-rust.cc @@ -0,0 +1,29 @@ +/* Default Rust language target hooks initializer. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Do not include tm.h or tm_p.h here; definitions needed by the target + architecture to initialize targetrustm should instead be added to tm_rust.h. + */ + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/configure b/gcc/configure index 07e8a64afbb..53a32373a18 100755 --- a/gcc/configure +++ b/gcc/configure @@ -645,6 +645,7 @@ ISLLIBS GMPINC GMPLIBS target_cpu_default +rust_target_objs d_target_objs fortran_target_objs cxx_target_objs @@ -653,6 +654,8 @@ use_gcc_stdint xm_defines xm_include_list xm_file_list +tm_rust_include_list +tm_rust_file_list tm_d_include_list tm_d_file_list tm_p_include_list @@ -13562,6 +13565,17 @@ for f in $tm_d_file; do esac done +tm_rust_file_list= +tm_rust_include_list= +for f in $tm_rust_file; do + case $f in + * ) + tm_rust_file_list="${tm_rust_file_list} \$(srcdir)/config/$f" + tm_rust_include_list="${tm_rust_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -19886,7 +19900,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19889 "configure" +#line 19903 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19992,7 +20006,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19995 "configure" +#line 20009 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -31903,6 +31917,9 @@ fi + + + diff --git a/gcc/configure.ac b/gcc/configure.ac index cb4be11facd..c193c96452a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2405,6 +2405,17 @@ for f in $tm_d_file; do esac done +tm_rust_file_list= +tm_rust_include_list= +for f in $tm_rust_file; do + case $f in + * ) + tm_rust_file_list="${tm_rust_file_list} \$(srcdir)/config/$f" + tm_rust_include_list="${tm_rust_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -7381,6 +7392,8 @@ 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(tm_rust_file_list) +AC_SUBST(tm_rust_include_list) AC_SUBST(xm_file_list) AC_SUBST(xm_include_list) AC_SUBST(xm_defines) @@ -7389,6 +7402,7 @@ AC_SUBST(c_target_objs) AC_SUBST(cxx_target_objs) AC_SUBST(fortran_target_objs) AC_SUBST(d_target_objs) +AC_SUBST(rust_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 ff69207fb9f..69123f00298 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -115,6 +115,14 @@ initialize @code{targetdm} themselves, they should set @code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetrustm} variable for hooks that are +specific to the Rust language front end, documented as ``Rust Target +Hook''. This is declared in @file{rust/rust-target.h}, the initializer +@code{TARGETRUSTM_INITIALIZER} in @file{rust/rust-target-def.h}. +If targets initialize @code{targetrustm} themselves, they should set +@code{target_has_targetrustm=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index cad6308a87c..9bac02b9b66 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -115,6 +115,14 @@ initialize @code{targetdm} themselves, they should set @code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetrustm} variable for hooks that are +specific to the Rust language front end, documented as ``Rust Target +Hook''. This is declared in @file{rust/rust-target.h}, the initializer +@code{TARGETRUSTM_INITIALIZER} in @file{rust/rust-target-def.h}. +If targets initialize @code{targetrustm} themselves, they should set +@code{target_has_targetrustm=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver diff --git a/gcc/genhooks.cc b/gcc/genhooks.cc index 8bcf9929207..49414eca531 100644 --- a/gcc/genhooks.cc +++ b/gcc/genhooks.cc @@ -35,6 +35,7 @@ static struct hook_desc hook_array[] = { #include "c-family/c-target.def" #include "common/common-target.def" #include "d/d-target.def" +#include "rust/rust-target.def" #undef DEFHOOK }; diff --git a/gcc/rust/rust-target-def.h b/gcc/rust/rust-target-def.h new file mode 100644 index 00000000000..8534c4b68c3 --- /dev/null +++ b/gcc/rust/rust-target-def.h @@ -0,0 +1,20 @@ +/* Default initializers for Rust target hooks. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +#include "rust/rust-target-hooks-def.h" +#include "tree.h" +#include "hooks.h" diff --git a/gcc/rust/rust-target.def b/gcc/rust/rust-target.def new file mode 100644 index 00000000000..c800eefcfaa --- /dev/null +++ b/gcc/rust/rust-target.def @@ -0,0 +1,32 @@ +/* Target hook definitions for the Rust front end. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +/* See target-hooks-macros.h for details of macros that should be + provided by the including file, and how to use them here. */ + +#include "target-hooks-macros.h" + +#undef HOOK_TYPE +#define HOOK_TYPE "Rust Target Hook" + +HOOK_VECTOR (TARGETRUSTM_INITIALIZER, gcc_targetrustm) + +#undef HOOK_PREFIX +#define HOOK_PREFIX "TARGET_" + +/* Close the 'struct gcc_targetrustm' definition. */ +HOOK_VECTOR_END (C90_EMPTY_HACK) diff --git a/gcc/rust/rust-target.h b/gcc/rust/rust-target.h new file mode 100644 index 00000000000..79edd786cdd --- /dev/null +++ b/gcc/rust/rust-target.h @@ -0,0 +1,31 @@ +/* Data structure definitions for target-specific Rust behavior. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +#ifndef GCC_RUST_TARGET_H +#define GCC_RUST_TARGET_H + +#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; +#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (*NAME) PARAMS; +#define DEFHOOK_UNDOC DEFHOOK +#define HOOKSTRUCT(FRAGMENT) FRAGMENT + +#include "rust-target.def" + +/* Each target can provide their own. */ +extern struct gcc_targetrustm targetrustm; + +#endif /* GCC_RUST_TARGET_H */ From patchwork Thu Sep 7 13:36:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830927 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=g7m5d2oy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL1Q2ykcz1ygR for ; Thu, 7 Sep 2023 23:38:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D428385E02A for ; Thu, 7 Sep 2023 13:38:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id B58813858408 for ; Thu, 7 Sep 2023 13:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B58813858408 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31c5a2e8501so943072f8f.0 for ; Thu, 07 Sep 2023 06:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093906; x=1694698706; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=r4sdw/c9etMvKXu3HvRjXr9mkLMbRpQW/WLQa47OZ+c=; b=g7m5d2oynzPxGVl6ZIKjrXPYHiU4ncEvNP7FDCmJqc3+JNqm9ZqwRHDwXGphqmyAl+ a/GxD1HrWJqkc1iVWw3GhY6IHS0uIeNtMXXtwWYVP2wweCl/z9BUFc2EwskQpR4kHTVF uUdZmAURhXcYoloMRNaUZCNU+Um75WQR52STRpXesvxkbyo7lQSow59ZhlyUNjZfwGbB NI1TCDYoZEO7pF1mAZDZwj1gv2gy+JYs1WBJVi8+4sZ/xPPMDbfSXhsf41VhA+lcwYx2 57U7l+7/qt80K6yDPmB7hWtr+VXkRKIKJyzBh2N4OlTlJrHVYkKzYh/9VfCRGfkcTlNU IduQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093906; x=1694698706; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=r4sdw/c9etMvKXu3HvRjXr9mkLMbRpQW/WLQa47OZ+c=; b=gufJkcEPKUgCoJsIaRNRzouucqNwtV4n8kEF+kFPPHTQ92OrXp7zjcM58D3n3hXxIA FtzHZZpZNPjZ8V5nZnVVEusrJcLeEv+2E1OhHrz7lkBOlv58L9V2bNbZE8S9spN7fcfn tewPMuYES7IVVWZrKk3+4oGbYO2HXdRCgkIg165Q5dDG+Vyry39FAAMvZtTADUohGnWD gveT11Z+uL9/0kmUuvJrkZZ1n4TgZhkW9Rt2xpjdY8XZVqrUvQ/z0Kpc7Axd2O6fCY2b prau+pNEucF7cL9IdqzgQ/CLJ3oZ5a8ptram8i7+h8Xbadr+uy+6rXUKe5lktCN2fYYi +r7w== X-Gm-Message-State: AOJu0YxYE224JL2h8dQAnYC/xieP1vJBMP6BD11z2G8m7b4aOO/dNwtx RGEDRgT5AyKDykst1AkXlhf24IfIhBH/sn4Czw== X-Google-Smtp-Source: AGHT+IGpS2BZy5BeLscBk+JyJXuuXm7oNpQsML+H287GJhnJQ5EzRPKr1Zxo42846URyAA0iAkofXA== X-Received: by 2002:a5d:45d0:0:b0:313:f395:f5a3 with SMTP id b16-20020a5d45d0000000b00313f395f5a3mr4754637wrs.38.1694093906029; Thu, 07 Sep 2023 06:38:26 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:25 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 02/14] rust: Reintroduce TARGET_RUST_CPU_INFO hook Date: Thu, 7 Sep 2023 15:36:28 +0200 Message-ID: <20230907133729.2518969-3-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * doc/tm.texi: Regenerate. * doc/tm.texi.in: Add @node for Rust language and ABI, and document TARGET_RUST_CPU_INFO. gcc/rust/ChangeLog: * rust-lang.cc (rust_add_target_info): Remove sorry. * rust-session-manager.cc: Replace include of target.h with include of tm.h and rust-target.h. (Session::init): Call targetrustm.rust_cpu_info. * rust-target.def (rust_cpu_info): New hook. * rust-target.h (rust_add_target_info): Declare. --- gcc/doc/tm.texi | 13 +++++++++++++ gcc/doc/tm.texi.in | 7 +++++++ gcc/rust/rust-lang.cc | 2 -- gcc/rust/rust-session-manager.cc | 7 ++++++- gcc/rust/rust-target.def | 12 ++++++++++++ gcc/rust/rust-target.h | 4 ++++ 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 69123f00298..f7a2f8be542 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -53,6 +53,7 @@ through the macros defined in the @file{.h} file. * PCH Target:: Validity checking for precompiled headers. * C++ ABI:: Controlling C++ ABI changes. * D Language and ABI:: Controlling D ABI changes. +* Rust Language and ABI:: Controlling Rust ABI changes. * Named Address Spaces:: Adding support for named address spaces * Misc:: Everything else. @end menu @@ -10962,6 +10963,18 @@ if they have external linkage. If this flag is false, then instantiated decls will be emitted as weak symbols. The default is @code{false}. @end deftypevr +@node Rust Language and ABI +@section Rust ABI parameters +@cindex parameters, rust abi + +@deftypefn {Rust Target Hook} void TARGET_RUST_CPU_INFO (void) +Declare all environmental CPU info and features relating to the target CPU +using the function @code{rust_add_target_info}, which takes a string +representing the feature key and a string representing the feature value. +Configuration pairs predefined by this hook apply to all files that are being +compiled. +@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 9bac02b9b66..cd4e687aea1 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -53,6 +53,7 @@ through the macros defined in the @file{.h} file. * PCH Target:: Validity checking for precompiled headers. * C++ ABI:: Controlling C++ ABI changes. * D Language and ABI:: Controlling D ABI changes. +* Rust Language and ABI:: Controlling Rust ABI changes. * Named Address Spaces:: Adding support for named address spaces * Misc:: Everything else. @end menu @@ -7143,6 +7144,12 @@ floating-point support; they are not included in this mechanism. @hook TARGET_D_TEMPLATES_ALWAYS_COMDAT +@node Rust Language and ABI +@section Rust ABI parameters +@cindex parameters, rust abi + +@hook TARGET_RUST_CPU_INFO + @node Named Address Spaces @section Adding support for named address spaces @cindex named address spaces diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index 1fb1c25da7a..978b8b9ead2 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -101,8 +101,6 @@ struct GTY (()) language_function void rust_add_target_info (const char *key, const char *value) { - sorry ("TODO"); - Rust::Session::get_instance ().options.target_data.insert_key_value_pair ( key, value); } diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 074bad9c5d7..112960ad3c0 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -44,7 +44,8 @@ #include "diagnostic.h" #include "input.h" #include "selftest.h" -#include "target.h" +#include "tm.h" +#include "rust-target.h" extern bool saw_errors (void); @@ -137,6 +138,10 @@ validate_crate_name (const std::string &crate_name, Error &error) void Session::init () { + // initialize target hooks + targetrustm.rust_cpu_info (); + + // target-independent values that should exist in all targets options.target_data.insert_key_value_pair ("target_pointer_width", std::to_string (POINTER_SIZE)); options.target_data.insert_key_value_pair ("target_endian", BYTES_BIG_ENDIAN diff --git a/gcc/rust/rust-target.def b/gcc/rust/rust-target.def index c800eefcfaa..285b7503528 100644 --- a/gcc/rust/rust-target.def +++ b/gcc/rust/rust-target.def @@ -28,5 +28,17 @@ HOOK_VECTOR (TARGETRUSTM_INITIALIZER, gcc_targetrustm) #undef HOOK_PREFIX #define HOOK_PREFIX "TARGET_" +/* Environmental CPU info and features (e.g. endianness, pointer size) relating + to the target CPU. */ +DEFHOOK +(rust_cpu_info, + "Declare all environmental CPU info and features relating to the target CPU\n\ +using the function @code{rust_add_target_info}, which takes a string\n\ +representing the feature key and a string representing the feature value.\n\ +Configuration pairs predefined by this hook apply to all files that are being\n\ +compiled.", + void, (void), + hook_void_void) + /* Close the 'struct gcc_targetrustm' definition. */ HOOK_VECTOR_END (C90_EMPTY_HACK) diff --git a/gcc/rust/rust-target.h b/gcc/rust/rust-target.h index 79edd786cdd..7fcdfc99b81 100644 --- a/gcc/rust/rust-target.h +++ b/gcc/rust/rust-target.h @@ -25,6 +25,10 @@ #include "rust-target.def" +/* Used by target to add target-related info. */ +extern void +rust_add_target_info (const char *, const char *); + /* Each target can provide their own. */ extern struct gcc_targetrustm targetrustm; From patchwork Thu Sep 7 13:36:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=hqQHz7k3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL1R0LyWz1yh8 for ; Thu, 7 Sep 2023 23:38:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E956A3853559 for ; Thu, 7 Sep 2023 13:38:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 8626B3858410 for ; Thu, 7 Sep 2023 13:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8626B3858410 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31f7638be6eso216583f8f.3 for ; Thu, 07 Sep 2023 06:38:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093907; x=1694698707; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=O3ESbbjJGuCLOZ+lKD0smOJZNgNyq9wBq2S2V+ukR88=; b=hqQHz7k3C/2JeRXh7csLe6CqUS7G7tIE8o7u0aK+tVZp4fFeLWzNtXuctyqGykYQs+ YOvndlyWsk5voWqptDQyuzS9ZSR+7Hp9OJJPe3zvfdxOvM1pPyo0Hmx4B8inXXZFS6sh 8MLjtLy8QsROBw4rlOf/Ls/wwgCRjQSKwRDwV3JrCsxr85AOffZi5HBjuro572ZHKtpY zmx9b/OOBXDQpjFwAA0ZX446hXcDFFme1Auoq20hE8T+uA0nfOsZjFbC541TpgnUxyiL Vwm3skcKlA3E7h+6MjoTyt2bioyiZroctFaqCZPJGjFQWTil6dvcaM08RTGV8D9i1gax RTSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093907; x=1694698707; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O3ESbbjJGuCLOZ+lKD0smOJZNgNyq9wBq2S2V+ukR88=; b=lbVJ3rtY4SttNS0TVzN8wmjmAGHxkIdDb7QS5OnfX7IEAk6wsqchbx6alB/qMfll09 hFy8NW9hUzpMtRxw4BadCWnWS5m36j2ovIZ+nqHzPQaNP4OIktAzeEaOznjTgJs8Le3o pDIgzD6hsRaQrkR4gijAqU6f6x2sVWGQOC7RZTiP1TeeoqDBezBGSdygWRoyhbgLGMZD +OGGNXjhAaK9/LBkHvop0TAcNlhYN8AWmAELUuJYNQlQ/UldXYSpg4whdZP9HSU+cxsl u7Yk8I1wezye9XxAnx68hnFh3KFlmIRCxMU0/5J97ijxWYpFTOHPo5tOdo1FpcVm/aYP zVmw== X-Gm-Message-State: AOJu0YxRxf3vLBBIDjQl9MxzAKMZ7KdL+BD0CvmSy2qMuldGOZC0rkUb P9gnmLSKICZL2GkrW3WauWYFST9TZiBSTW4ypQ== X-Google-Smtp-Source: AGHT+IEJjLdz0ISMEO+HZgd20BvahLrjGjIep8a7muguIequE31qOaKGdRqHxtHJkajiZc/SySiKAw== X-Received: by 2002:a5d:43c2:0:b0:31f:4173:2ac8 with SMTP id v2-20020a5d43c2000000b0031f41732ac8mr4859841wrr.18.1694093906911; Thu, 07 Sep 2023 06:38:26 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:26 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 03/14] rust: Reintroduce TARGET_RUST_OS_INFO hook Date: Thu, 7 Sep 2023 15:36:29 +0200 Message-ID: <20230907133729.2518969-4-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * doc/tm.texi: Regenerate. * doc/tm.texi.in: Document TARGET_RUST_OS_INFO. gcc/rust/ChangeLog: * rust-session-manager.cc (Session::init): Call targetrustm.rust_os_info. * rust-target.def (rust_os_info): New hook. --- gcc/doc/tm.texi | 5 +++++ gcc/doc/tm.texi.in | 2 ++ gcc/rust/rust-session-manager.cc | 1 + gcc/rust/rust-target.def | 8 ++++++++ 4 files changed, 16 insertions(+) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f7a2f8be542..b0779724d30 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -10975,6 +10975,11 @@ Configuration pairs predefined by this hook apply to all files that are being compiled. @end deftypefn +@deftypefn {Rust Target Hook} void TARGET_RUST_OS_INFO (void) +Similar to @code{TARGET_RUST_CPU_INFO}, but is used for configuration info +relating to the target operating system. +@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 cd4e687aea1..d3e18955628 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7150,6 +7150,8 @@ floating-point support; they are not included in this mechanism. @hook TARGET_RUST_CPU_INFO +@hook TARGET_RUST_OS_INFO + @node Named Address Spaces @section Adding support for named address spaces @cindex named address spaces diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 112960ad3c0..ce1fdbb02af 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -140,6 +140,7 @@ Session::init () { // initialize target hooks targetrustm.rust_cpu_info (); + targetrustm.rust_os_info (); // target-independent values that should exist in all targets options.target_data.insert_key_value_pair ("target_pointer_width", diff --git a/gcc/rust/rust-target.def b/gcc/rust/rust-target.def index 285b7503528..9c72c1c86d3 100644 --- a/gcc/rust/rust-target.def +++ b/gcc/rust/rust-target.def @@ -40,5 +40,13 @@ compiled.", void, (void), hook_void_void) +/* Environmental OS info relating to the target OS. */ +DEFHOOK +(rust_os_info, + "Similar to @code{TARGET_RUST_CPU_INFO}, but is used for configuration info\n\ +relating to the target operating system.", + void, (void), + hook_void_void) + /* Close the 'struct gcc_targetrustm' definition. */ HOOK_VECTOR_END (C90_EMPTY_HACK) From patchwork Thu Sep 7 13:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=TNnY3r3g; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL290pqDz1ygR for ; Thu, 7 Sep 2023 23:39:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA89D3839403 for ; Thu, 7 Sep 2023 13:39:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id F2AA63858422 for ; Thu, 7 Sep 2023 13:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2AA63858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31ad9155414so899868f8f.3 for ; Thu, 07 Sep 2023 06:38:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093907; x=1694698707; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=e70MoCq7qUHP1GHQpBdTh5qXfWgp4wGIIStEmlDRbWo=; b=TNnY3r3gAIE9r4RHa98wLzWG7anhVE9qaYslCZYqWdsactdNonPYTouJd9OwnKr2sF 9jKpeLFbPxaLa2FaZw47569rZvFJlgLbRtzjk0ACJyghy6KkjqZUz2v6nhxLNXOMTvKL w48rV9MoJIOqth8Qg9C6yFLdRLxDna+k6gX4BFtBYvAcx3dK1cvP14Fh8NtwP0R9PqlL n2OzwDoxagNXLitLvV9HRxTstEWkapJ6NViaLwbiCXLpW/vs0fKW1uFXnXHg5ThkhZmx crgKj6ViGpTRVElXmT8gLrAzjLxl548b4LJMcf/0FeEPtKIG3Do9nTXzHEjBR4QABoTU RU4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093907; x=1694698707; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e70MoCq7qUHP1GHQpBdTh5qXfWgp4wGIIStEmlDRbWo=; b=B2HDmGLGYcas5vb3PuFrSMGO5wQ+b2adXUuICUkSXtOK8sxrBWfSeP+6FTAtl/FSDZ /TUH9npUnj6ZDmvdaR6LP/EffxQCf+k8lNQFy/1fABMIWze+vV+/IlIeH4Eh80yTLe7N 1agPt5aI7vcnU28xmAhIyCSyw0Qbjhf0j47SLrJ8jygjyVbOBG4dYY7scumJXBwYvTzX KXYoX9MUSGdnuG0tBCslJIKwdwxcq4hfsvGHq9rWaF2pdDHn048jp/IZrB/2PR9q+5IV XnFJXzYIXe+junea7SDA9m/baRal7xMFM80UE5NB1uuRq8sjU1eqXWWwHIFUW/7RF69N vRLA== X-Gm-Message-State: AOJu0Yx+OdWt/8u/HXevU7o8KQL2VG2gIKy5lv2ZO41pZWkiaQFow8D2 oR23hNU/+zzIhl1FVCDa59whyjMfIzd8kza9Og== X-Google-Smtp-Source: AGHT+IGc4tWWvDgS6xHb8g4bX5kzhrVBj8V2S6v3qZZafMH97onk7BbVWIQWT6bQ/8p+s12qCj4+hQ== X-Received: by 2002:adf:f149:0:b0:313:e456:e64a with SMTP id y9-20020adff149000000b00313e456e64amr4487327wro.21.1694093907425; Thu, 07 Sep 2023 06:38:27 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:27 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 04/14] rust: Implement TARGET_RUST_CPU_INFO for i[34567]86-*-* and x86_64-*-* Date: Thu, 7 Sep 2023 15:36:30 +0200 Message-ID: <20230907133729.2518969-5-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw There are still quite a lot of the previously reverted i386-rust.cc missing, so it's only a partial reimplementation. gcc/ChangeLog: * config/i386/t-i386 (i386-rust.o): New rule. * config/i386/i386-rust.cc: New file. * config/i386/i386-rust.h: New file. --- gcc/config/i386/i386-rust.cc | 129 +++++++++++++++++++++++++++++++++++ gcc/config/i386/i386-rust.h | 22 ++++++ gcc/config/i386/t-i386 | 4 ++ 3 files changed, 155 insertions(+) create mode 100644 gcc/config/i386/i386-rust.cc create mode 100644 gcc/config/i386/i386-rust.h diff --git a/gcc/config/i386/i386-rust.cc b/gcc/config/i386/i386-rust.cc new file mode 100644 index 00000000000..a00c4f8cee1 --- /dev/null +++ b/gcc/config/i386/i386-rust.cc @@ -0,0 +1,129 @@ +/* Subroutines for the Rust front end on the x86 architecture. + Copyright (C) 2022 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 +. */ + +#define IN_TARGET_CODE 1 + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" + +/* Implement TARGET_RUST_CPU_INFO for x86 targets. */ + +void +ix86_rust_target_cpu_info (void) +{ + if (TARGET_64BIT) + rust_add_target_info ("target_arch", "x86_64"); + else + rust_add_target_info ("target_arch", "x86"); + + // features officially "stabilised" in rustc + if (TARGET_MMX) + rust_add_target_info ("target_feature", "mmx"); + if (TARGET_SSE) + rust_add_target_info ("target_feature", "sse"); + if (TARGET_SSE2) + rust_add_target_info ("target_feature", "sse2"); + if (TARGET_SSE3) + rust_add_target_info ("target_feature", "sse3"); + if (TARGET_SSSE3) + rust_add_target_info ("target_feature", "ssse3"); + if (TARGET_SSE4_1) + rust_add_target_info ("target_feature", "sse4.1"); + if (TARGET_SSE4_2) + rust_add_target_info ("target_feature", "sse4.2"); + if (TARGET_AES) + rust_add_target_info ("target_feature", "aes"); + if (TARGET_SHA) + rust_add_target_info ("target_feature", "sha"); + if (TARGET_AVX) + rust_add_target_info ("target_feature", "avx"); + if (TARGET_AVX2) + rust_add_target_info ("target_feature", "avx2"); + if (TARGET_AVX512F) + rust_add_target_info ("target_feature", "avx512f"); + if (TARGET_AVX512ER) + rust_add_target_info ("target_feature", "avx512er"); + if (TARGET_AVX512CD) + rust_add_target_info ("target_feature", "avx512cd"); + if (TARGET_AVX512PF) + rust_add_target_info ("target_feature", "avx512pf"); + if (TARGET_AVX512DQ) + rust_add_target_info ("target_feature", "avx512dq"); + if (TARGET_AVX512BW) + rust_add_target_info ("target_feature", "avx512bw"); + if (TARGET_AVX512VL) + rust_add_target_info ("target_feature", "avx512vl"); + if (TARGET_AVX512VBMI) + rust_add_target_info ("target_feature", "avx512vbmi"); + if (TARGET_AVX512IFMA) + rust_add_target_info ("target_feature", "avx512ifma"); + if (TARGET_AVX512VPOPCNTDQ) + rust_add_target_info ("target_feature", "avx512vpopcntdq"); + if (TARGET_FMA) + rust_add_target_info ("target_feature", "fma"); + if (TARGET_RTM) + rust_add_target_info ("target_feature", "rtm"); + if (TARGET_SSE4A) + rust_add_target_info ("target_feature", "sse4a"); + if (TARGET_BMI) + { + rust_add_target_info ("target_feature", "bmi1"); + rust_add_target_info ("target_feature", "bmi"); + } + if (TARGET_BMI2) + rust_add_target_info ("target_feature", "bmi2"); + if (TARGET_LZCNT) + rust_add_target_info ("target_feature", "lzcnt"); + if (TARGET_TBM) + rust_add_target_info ("target_feature", "tbm"); + if (TARGET_POPCNT) + rust_add_target_info ("target_feature", "popcnt"); + if (TARGET_RDRND) + { + rust_add_target_info ("target_feature", "rdrand"); + rust_add_target_info ("target_feature", "rdrnd"); + } + if (TARGET_F16C) + rust_add_target_info ("target_feature", "f16c"); + if (TARGET_RDSEED) + rust_add_target_info ("target_feature", "rdseed"); + if (TARGET_ADX) + rust_add_target_info ("target_feature", "adx"); + if (TARGET_FXSR) + rust_add_target_info ("target_feature", "fxsr"); + if (TARGET_XSAVE) + rust_add_target_info ("target_feature", "xsave"); + if (TARGET_XSAVEOPT) + rust_add_target_info ("target_feature", "xsaveopt"); + if (TARGET_XSAVEC) + rust_add_target_info ("target_feature", "xsavec"); + if (TARGET_XSAVES) + rust_add_target_info ("target_feature", "xsaves"); + if (TARGET_VPCLMULQDQ) + { + rust_add_target_info ("target_feature", "pclmulqdq"); + rust_add_target_info ("target_feature", "vpclmulqdq"); + } + if (TARGET_CMPXCHG16B) + rust_add_target_info ("target_feature", "cmpxchg16b"); + if (TARGET_MOVBE) + rust_add_target_info ("target_feature", "movbe"); +} diff --git a/gcc/config/i386/i386-rust.h b/gcc/config/i386/i386-rust.h new file mode 100644 index 00000000000..a837e2f1c74 --- /dev/null +++ b/gcc/config/i386/i386-rust.h @@ -0,0 +1,22 @@ +/* Definitions for the Rust front end on the x86 architecture. + Copyright (C) 2022 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 +. */ + +/* In i386-rust.cc */ +extern void ix86_rust_target_cpu_info (void); + +/* Target CPU info for Rust. */ +#define TARGET_RUST_CPU_INFO ix86_rust_target_cpu_info diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386 index b417c7f17ec..f85817d698c 100644 --- a/gcc/config/i386/t-i386 +++ b/gcc/config/i386/t-i386 @@ -46,6 +46,10 @@ i386-d.o: $(srcdir)/config/i386/i386-d.cc $(COMPILE) $< $(POSTCOMPILE) +i386-rust.o: $(srcdir)/config/i386/i386-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + i386-options.o: $(srcdir)/config/i386/i386-options.cc $(COMPILE) $< $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=X3Lz19tj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL2Q19plz1yh8 for ; Thu, 7 Sep 2023 23:39:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B06A2382C119 for ; Thu, 7 Sep 2023 13:39:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 91CD93858D37 for ; Thu, 7 Sep 2023 13:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91CD93858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31f737b8b69so440976f8f.3 for ; Thu, 07 Sep 2023 06:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093908; x=1694698708; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Aip0rlE4sWGFecy6xTNUZTW/wVlmF9m1bFlkk9a60Bs=; b=X3Lz19tjX+57xoDlU5Ir/CzrOZj5qgoX9kbCEtjWBQRvOwhKdPUShMnmL8BSnPbddy /Cm4QJkRTKJ65aAoHE7NNWot28wlC0zHBllmFG5pxlCPJr6VDR21j4NFc9OCU6dClFOV DXIEdlQbLYze9j1iPZnNcg097bpqqkgTQj80QkHt4eBRXQ+dlbfi37NXZT917hPKOCv1 Agk+Y5gReW30ZybA6j/6ZwwWJYMPwiTL10t/kEkXwaYJdTcjvuC0AX/ZBzUiR/BD9yui 7Yj2kR9PSggIwToIbZFsbvVmth/OyqnRvXbXlIZc/lwBEjx2DxWHzi3aL/3b3Op8tSAH vwXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093908; x=1694698708; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Aip0rlE4sWGFecy6xTNUZTW/wVlmF9m1bFlkk9a60Bs=; b=NUwK2vfDmUwuQOQJV5mMMiSK1OyHO28bLkJpCbhpkuJfSCos8S6pqUeL5HvKjndefa QnJjQ3nyJ7YHQjtPlhhZMoDOwnUSHtbs3R48zYYJcUaAesb9LMcl4iSt8rZwoaXbQWEi ok64LIwyXKVozje7ojSDAcd46wDAOn5xspZoWqLnG493rSKBZ3xSl5a7oO8EKMtDnAze 1UL6bUHooR6SLpbJwk8yQWKPa/OoRRJVjtdQBhgpaL4EDA86qukKeHwZ/XkhN8XQt09B rcG8+ocIrLVmGvRgcyBkv5Wkgu9ok6BSDC71MKJ1v9gf/ORTpShoRM+eZiTNOQPy250j W1sA== X-Gm-Message-State: AOJu0Yw9+LUy9sM0TLYbrlFTuMuk+vaf9ktrPmvo84X2gl6Kv2yfQxRf YLfvLVHIazPGI4OQ5zAEgMJ0cBm4SJuGEw7pZA== X-Google-Smtp-Source: AGHT+IEyVT8olqreZzm/SnFMqKEhBdUa2rpYIW4Bmjznu3djQettI3aNOZ9HcQc4cXVsuvtj4NTy2w== X-Received: by 2002:adf:ed4e:0:b0:31a:dbd8:95d4 with SMTP id u14-20020adfed4e000000b0031adbd895d4mr5221890wro.12.1694093908137; Thu, 07 Sep 2023 06:38:28 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:27 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 05/14] rust: Implement TARGET_RUST_OS_INFO for *-*-darwin* Date: Thu, 7 Sep 2023 15:36:31 +0200 Message-ID: <20230907133729.2518969-6-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-darwin*): Set rust_target_objs and target_has_targetrustm. * config/t-darwin (darwin-rust.o): New rule. * config/darwin-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/darwin-rust.cc | 44 +++++++++++++++++++++++++++++++++++++++ gcc/config/t-darwin | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 gcc/config/darwin-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index 13c575839ef..a654c7c5a83 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -779,8 +779,10 @@ case ${target} in cxx_target_objs="${cxx_target_objs} darwin-c.o" d_target_objs="${d_target_objs} darwin-d.o" fortran_target_objs="darwin-f.o" + rust_target_objs="${rust_target_objs} darwin-rust.o" target_has_targetcm=yes target_has_targetdm=yes + target_has_targetrustm=yes extra_objs="${extra_objs} darwin.o" extra_gcc_objs="darwin-driver.o" default_use_cxa_atexit=yes diff --git a/gcc/config/darwin-rust.cc b/gcc/config/darwin-rust.cc new file mode 100644 index 00000000000..4b014b88c52 --- /dev/null +++ b/gcc/config/darwin-rust.cc @@ -0,0 +1,44 @@ +/* Darwin support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for Darwin targets. */ + +static void +darwin_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + + /* TODO: rust actually has "macos", "ios", and "tvos" for darwin targets, but + gcc seems to have no current support for them, so assuming that target_os + is always macos for now. */ + rust_add_target_info ("target_os", "macos"); + rust_add_target_info ("target_vendor", "apple"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO darwin_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin index e22a579e951..52b6d89b6d4 100644 --- a/gcc/config/t-darwin +++ b/gcc/config/t-darwin @@ -34,6 +34,10 @@ darwin-f.o: $(srcdir)/config/darwin-f.cc $(COMPILE) $< $(POSTCOMPILE) +darwin-rust.o: $(srcdir)/config/darwin-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + darwin-driver.o: $(srcdir)/config/darwin-driver.cc $(COMPILE) $< $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=ZiAd4SJX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL3C4kxKz1ygc for ; Thu, 7 Sep 2023 23:40:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B5DD382799D for ; Thu, 7 Sep 2023 13:39:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 76E3E3858C66 for ; Thu, 7 Sep 2023 13:38:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76E3E3858C66 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fef56f7248so10528195e9.3 for ; Thu, 07 Sep 2023 06:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093909; x=1694698709; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Hdi0TTbPXLL2KofkGjlaE+Q4TIaQM2y/B4wvDfWj3RM=; b=ZiAd4SJXxA8Lc2zm2TfLhy76EA+TicxChytukt6MPUhD8wNPYQrTQLUu7VOWVFb8LS zfAS43FQPLT5FurGnp8hKpMTkQ3Swh08IP8qPAYqRwVlQsF/vBtV4QES5lDlyDV9VRsF 1TgoTjewpptXbfrCEPR1+848SbAEju7JoXhROtH9Jx8Hu/1HTPMNZkMXpMrWMjLvOVWJ GMSU08Ud2EsvBdzsNopSEd+f2RdpRSJz8Dtv5To/s4VVY1HlXP2vG1+c624ds9sUw1yx Eg0jDoMo9Y29kHHQWxTw6Nb4Xa3JInbtVju77sNQjn7hSUC21KMqvezi5QkDsiHmC905 m3Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093909; x=1694698709; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Hdi0TTbPXLL2KofkGjlaE+Q4TIaQM2y/B4wvDfWj3RM=; b=j4II71MfnT6/kWfg+H6mUpAaQ+mlKIJ8/I8jcUC9pqSJlFW9dd81zS3DJz/aHI/pTs DWvSCOh2z5I/au8lVWNSUDTOWfsic34q67oKmLEH06m7f0dDrmBorzC5cDvMVnmKExXf TT11aMcrvLfT8D56/z9IeyAt0h63Z4tNoKPjGhXxUH0/AQh2n2cs0cTWBPmXOaRDGyEd q+UeyaoQS6yhb4nQnvl4a8aPUxsUzwbBcmPC6S1GMkt3+3jmh91+S/EqUqkg3cNW6Qxn WChNHbAB7WDQl8YV3jQ9ffaT1ljWtvDccOG+PUwe7NK2mukuRnr+RUNUNVl4weNfCcgU x7UA== X-Gm-Message-State: AOJu0YxNgsJteQD0dRwU61xV8nAdzfNtoaq64kenM0+rbA+uqJ4rjoDn tuYrP9gziJSeeGE1vrnkes30XHxoRhbk0LnDIQ== X-Google-Smtp-Source: AGHT+IEDRsBTyXfwPl14KoY0hftMZG3yhyOE+LFemK/b6KyTjJYkU1SkJz8yrYqWmODFp2zA9HCWeg== X-Received: by 2002:a7b:c855:0:b0:3f8:fac0:ad40 with SMTP id c21-20020a7bc855000000b003f8fac0ad40mr4751810wml.29.1694093909014; Thu, 07 Sep 2023 06:38:29 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:28 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 06/14] rust: Implement TARGET_RUST_OS_INFO for *-*-freebsd* Date: Thu, 7 Sep 2023 15:36:32 +0200 Message-ID: <20230907133729.2518969-7-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-freebsd*): Set rust_target_objs and target_has_targetrustm. * config/t-freebsd (freebsd-rust.o): New rule. * config/freebsd-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/freebsd-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++ gcc/config/t-freebsd | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 gcc/config/freebsd-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index a654c7c5a83..61d77567bb6 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -864,6 +864,8 @@ case ${target} in d_target_objs="${d_target_objs} freebsd-d.o" tmake_file="${tmake_file} t-freebsd" target_has_targetdm=yes + rust_target_objs="${rust_target_objs} freebsd-rust.o" + target_has_targetrustm=yes ;; *-*-fuchsia*) native_system_header_dir=/include diff --git a/gcc/config/freebsd-rust.cc b/gcc/config/freebsd-rust.cc new file mode 100644 index 00000000000..1dbf2ed8ef9 --- /dev/null +++ b/gcc/config/freebsd-rust.cc @@ -0,0 +1,40 @@ +/* FreeBSD support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for FreeBSD targets. */ + +static void +freebsd_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "freebsd"); + rust_add_target_info ("target_vendor", "unknown"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO freebsd_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-freebsd b/gcc/config/t-freebsd index fb36685653a..d4b4615e567 100644 --- a/gcc/config/t-freebsd +++ b/gcc/config/t-freebsd @@ -19,3 +19,7 @@ freebsd-d.o: $(srcdir)/config/freebsd-d.cc $(COMPILE) $< $(POSTCOMPILE) + +freebsd-rust.o: $(srcdir)/config/freebsd-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=Fj2V1DvQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL3f72jJz1ygc for ; Thu, 7 Sep 2023 23:40:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CED29389839A for ; Thu, 7 Sep 2023 13:40:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 4D0263858D1E for ; Thu, 7 Sep 2023 13:38:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D0263858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31c5c06e8bbso964607f8f.1 for ; Thu, 07 Sep 2023 06:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093909; x=1694698709; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=4SnrvU23jdoUsZwk8bWxMc5AOO/QiPj3XCWJq2jcOeg=; b=Fj2V1DvQe+hu0tiH4rVR0gWQungSrYGbFaTtaZ2BqJ0hOTk677daA3P0gBqtM6prsD nFK34ObD4vH45uPjJJTTmXnWselQosegUMwJcAAMKC+YIOnKA8oF7LC6xOdMR2QGPegW SQRRCb0a7DhzQYtuU7VU0ieM6CSuAg+ivPwJ4j6sL0NxTMVf+nVbokM75n6QiG4hGmlv x9Xks2UH8xbTYrSfF1aBZ0PSbM995Dn1T/5GBOzoGLRkxS/mdyXrKEL/UndhR6x9PKIo ryQ7hvuT453Cba8qzLTP7hEsFtIR0AI9wUYBku0MJuyX3QPeBWXkZyLMs19h8mWNLR2J nwSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093909; x=1694698709; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4SnrvU23jdoUsZwk8bWxMc5AOO/QiPj3XCWJq2jcOeg=; b=C4N9/EBaDoLiQ50yM73gDBPfBlKIVY3USZCs3KPv2c4Mg7ETrHWH+JArFZclrOL6HU /fReHhIccAoGBWwXBKsoFUHonODN/jEHNAK4rQuJVK86UQba0tABRL+AbkuIolOHioGi bdtPnGV0hN/SP5Iv7xBVU3p2/0pJgwEiaTS5qw5p92OE3sWZRuXj9X1MtzQgfxA/tLU0 mgkjWoR3CTswB8Rr1SCDInGl26LiDl2cx3FA5L5xElHTnj/dQHZXTbco0Pm1ZRzLtLef te5Yz4X/hLwYJxumELFjOy2KNQAdq2mVpngHVIt9DFbwW0eMlF4MqWJ+vkryYbrq55gX LMMg== X-Gm-Message-State: AOJu0Yw57FqBIZhJJBDWt2yYYiSkRmt1yWjx+S2+UIfZqcjyiTlVRYzG dKrFy0Bx1SOkxiACRtpZnr9RgDJuK/jZ19+yFw== X-Google-Smtp-Source: AGHT+IFRioW236rLgb1JKqWOLhtMvEQGvqjwiCksXLF+WTTPY4GbBaF1DU4WICm2GrrNaqwG7KhC8g== X-Received: by 2002:adf:e912:0:b0:309:1532:8287 with SMTP id f18-20020adfe912000000b0030915328287mr4937322wrm.19.1694093909730; Thu, 07 Sep 2023 06:38:29 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:29 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 07/14] rust: Implement TARGET_RUST_OS_INFO for *-*-netbsd* Date: Thu, 7 Sep 2023 15:36:33 +0200 Message-ID: <20230907133729.2518969-8-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-netbsd*): Set rust_target_objs and target_has_targetrustm. * config/t-netbsd (netbsd-rust.o): New rule. * config/netbsd-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/netbsd-rust.cc | 40 +++++++++++++++++++++++++++++++++++++++ gcc/config/t-netbsd | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 gcc/config/netbsd-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index 61d77567bb6..ad4c01dfc89 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -973,6 +973,8 @@ case ${target} in default_gnu_indirect_function=yes ;; esac + rust_target_objs="${rust_target_objs} netbsd-rust.o" + target_has_targetrustm=yes ;; *-*-openbsd*) tmake_file="t-openbsd" diff --git a/gcc/config/netbsd-rust.cc b/gcc/config/netbsd-rust.cc new file mode 100644 index 00000000000..9395466cbbe --- /dev/null +++ b/gcc/config/netbsd-rust.cc @@ -0,0 +1,40 @@ +/* NetBSD support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for NetBSD targets. */ + +static void +netbsd_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "netbsd"); + rust_add_target_info ("target_vendor", "unknown"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO netbsd_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd index 1d9a8ce8c7b..fdbfda52412 100644 --- a/gcc/config/t-netbsd +++ b/gcc/config/t-netbsd @@ -23,3 +23,7 @@ netbsd.o: $(srcdir)/config/netbsd.cc netbsd-d.o: $(srcdir)/config/netbsd-d.cc $(COMPILE) $< $(POSTCOMPILE) + +netbsd-rust.o: $(srcdir)/config/netbsd-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=Qyork/ki; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL4K1MPCz1ygc for ; Thu, 7 Sep 2023 23:41:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 550933949F2B for ; Thu, 7 Sep 2023 13:40:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id E62B13858C2B for ; Thu, 7 Sep 2023 13:38:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E62B13858C2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-402d499580dso10997675e9.1 for ; Thu, 07 Sep 2023 06:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093910; x=1694698710; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=h4lcXVCPlxtcEEIiaxtOVv/ouBEgvVBTG0TvcnGKs7U=; b=Qyork/kiWH0jfNWdOP5DM5c77osoKJY3N7EC5pgwnPpbF/EDqbw7b1ctezygkM3xeV dG1nb+KrPJ4dqb3H5BoMLsDVLWbj9B9wPVQDw27R/0XskHmn4O05vYyciVRjCxcjJYvX lKYdDQOZfdXTSsDGnviai1Q7MVV/z9h+z5qBoksx482m6aRXiYvSGLy2HXTrNx2VHbXn O3rKIn6MuIRmr/LBcXwu4M0xNoZVrvTrNaeSvoXequ3QE7ns1croIx8/Z7HZ/oAARRIe kPvYZgtFUIdqVR+o5DNZUvWGQddZEz57ChCtBz3cC7XgUCZ4eg4oqbxeQ/dhzJJyCbD4 hy/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093910; x=1694698710; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=h4lcXVCPlxtcEEIiaxtOVv/ouBEgvVBTG0TvcnGKs7U=; b=CrqsIvGXJ1dPTexdtFJLy/IW3eb7okFI1gAdJLQzaONJR2c7+H8Z8Sszlk1x/T0Rxo keFFJwjGZ7COnCqQv+PxUlN4PoylUYro4lDR+R5pmopVz+cMGIho3T0QDpei+dxUytXX FoHLSzyfa3oh0udZmIaiTLwRT6bhZgQonyqmI1uWmMDlkcFGK8lgeMKmzxBFR38ZPo3R L89dOpI1DZ9yq/RU9GLQrp86hSupDlIq2eDFAtn4D2AWBCt9iHqh4k0D6RnfWz+PiWqz ahH558YnWcTteQ0xWclFAy4AND298DrbPBKiIK4cGSaQH3ar7s+XVd82bllR21RRJKY7 yx+Q== X-Gm-Message-State: AOJu0YwRDFppRN+Vz+4PfRiQuvUe7+dSCr0uQpPqf0BEPzzrqWPcK3v5 nO8s/x4CqFCtX4z5EmuRUQQdjbAG82Q4APNIhw== X-Google-Smtp-Source: AGHT+IGN64SfL483O7g6xht5j/YzQBA7TMkF7pqzHT/oVYHeacyluzIQifbsJtHJZoMvruZp/OaJ/A== X-Received: by 2002:a05:600c:3793:b0:402:ceb:ca5b with SMTP id o19-20020a05600c379300b004020cebca5bmr4693869wmr.20.1694093910424; Thu, 07 Sep 2023 06:38:30 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:30 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 08/14] rust: Implement TARGET_RUST_OS_INFO for *-*-openbsd* Date: Thu, 7 Sep 2023 15:36:34 +0200 Message-ID: <20230907133729.2518969-9-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-openbsd*): Set rust_target_objs and target_has_targetrustm. * config/t-openbsd (openbsd-rust.o): New rule. * config/openbsd-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/openbsd-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++ gcc/config/t-openbsd | 5 +++++ 3 files changed, 47 insertions(+) create mode 100644 gcc/config/openbsd-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index ad4c01dfc89..f2b4381362c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -990,6 +990,8 @@ case ${target} in esac d_target_objs="${d_target_objs} openbsd-d.o" target_has_targetdm=yes + rust_target_objs="${rust_target_objs} openbsd-rust.o" + target_has_targetrustm=yes ;; *-*-phoenix*) gas=yes diff --git a/gcc/config/openbsd-rust.cc b/gcc/config/openbsd-rust.cc new file mode 100644 index 00000000000..c4721ea18e9 --- /dev/null +++ b/gcc/config/openbsd-rust.cc @@ -0,0 +1,40 @@ +/* OpenBSD support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for OpenBSD targets. */ + +static void +openbsd_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "openbsd"); + rust_add_target_info ("target_vendor", "unknown"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO openbsd_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-openbsd b/gcc/config/t-openbsd index 69643f521fb..3b625d62b30 100644 --- a/gcc/config/t-openbsd +++ b/gcc/config/t-openbsd @@ -5,3 +5,8 @@ USER_H = $(EXTRA_HEADERS) openbsd-d.o: $(srcdir)/config/openbsd-d.cc $(COMPILE) $< $(POSTCOMPILE) + +# OpenBSD-specific Rust support. +openbsd-rust.o: $(srcdir)/config/openbsd-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=aSH//mNW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL4q1kWXz1ygc for ; Thu, 7 Sep 2023 23:41:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C19EA388B683 for ; Thu, 7 Sep 2023 13:41:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 97D093858402 for ; Thu, 7 Sep 2023 13:38:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97D093858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31aeee69de0so923292f8f.2 for ; Thu, 07 Sep 2023 06:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093911; x=1694698711; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=TzdKy1DlavMs/r+cjN71Skpn9yKNySppa7x5Pzc5xGk=; b=aSH//mNWed3UqgOtaHmb89ha0J2IB1jbVah3+jelhvsSMHPAKv8nv8IzlglTvi64Cc NI5hCaWKzsAiSB0fsxRZ/O1dLuM3A+Kcot+8KMqsAia8nG+IIl3wUz7vvZAOIAQMu2MD QnnxtRv0d1dzL57R5NZsZUUAcRcpqp999154mQ5IGJwpDkh9HBsc7mv+ZJIYdlzku/J8 4KIrUnCZsahSvDvloLNqLCPalLWdEnRAr7En4as6OPKt1FkvlufHQ9G2FA79Rje9nTal R+neASST7Ltjx+5FC4XmC50yObluGrZ0MxQxks/Vh+JZEqU5Rjvr11mXEmw2j1i+8zO8 0A5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093911; x=1694698711; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TzdKy1DlavMs/r+cjN71Skpn9yKNySppa7x5Pzc5xGk=; b=R3H+xJQq1lhSgUJcFisyL8bpgd0LuAVPdQ+Pwme9TSvKIYZ+GkFbiyin+XJQf8Tl/t /88iij7oM1aoGRQGiGW0h7RTfuLV6VsVCuxe6MZgGmCJcMT50PPsvLOsLydx3TiLbOwC M3x4TDBGUxVwQ9b18mV0vI3UiT0FhvIBOJw4E/yvN8QIMU5I7mV2PiErIR2QMigxIkhj A2BFR00kLpiKPKaRZQ/wMTPKCU731/B9kXaq+98GD70FlMsWCdEbLApYEfCRzUhXqBBL pQpfTtmE/GmlkPTEViJlHtSwIleoaAbo1RW/BSL7t9eFfMEB6MX4JPbdVVMmKVi+rJnf pBng== X-Gm-Message-State: AOJu0YyGiMfEcZk1SavjUn/uQcmVC2DgaRmQkQtWSvQZjxvmUvOr3K4j 2xHn/1d52/DA8ZhHu0uRfS6sG2JP3pJTMyAXGQ== X-Google-Smtp-Source: AGHT+IESgB3WH+dkfoC5JJNsY0c9hicj60oUmhVx0cB7i9PMj2AoIH0HNKHhfnfATUrwIUE+SimuKQ== X-Received: by 2002:adf:fa82:0:b0:31d:366d:4961 with SMTP id h2-20020adffa82000000b0031d366d4961mr5474510wrr.25.1694093911175; Thu, 07 Sep 2023 06:38:31 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:30 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 09/14] rust: Implement TARGET_RUST_OS_INFO for *-*-solaris2*. Date: Thu, 7 Sep 2023 15:36:35 +0200 Message-ID: <20230907133729.2518969-10-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-solaris2*): Set rust_target_objs and target_has_targetrustm. * config/t-sol2 (sol2-rust.o): New rule. * config/sol2-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/sol2-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++++ gcc/config/t-sol2 | 5 +++++ 3 files changed, 47 insertions(+) create mode 100644 gcc/config/sol2-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index f2b4381362c..81142763ac2 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1056,6 +1056,8 @@ case ${target} in ;; esac target_has_targetdm=yes + rust_target_objs="${rust_target_objs} sol2-rust.o" + target_has_targetrustm=yes ;; *-*-*vms*) extra_options="${extra_options} vms/vms.opt" diff --git a/gcc/config/sol2-rust.cc b/gcc/config/sol2-rust.cc new file mode 100644 index 00000000000..e36bd450bcc --- /dev/null +++ b/gcc/config/sol2-rust.cc @@ -0,0 +1,40 @@ +/* Solaris support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for Solaris targets. */ + +static void +solaris_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "solaris"); + rust_add_target_info ("target_vendor", "sun"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO solaris_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2 index 83d4c85fdeb..d454409d346 100644 --- a/gcc/config/t-sol2 +++ b/gcc/config/t-sol2 @@ -31,6 +31,11 @@ sol2-d.o: $(srcdir)/config/sol2-d.cc $(COMPILE) $< $(POSTCOMPILE) +# Solaris-specific Rust support. +sol2-rust.o: $(srcdir)/config/sol2-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + # Corresponding stub routines. sol2-stubs.o: $(srcdir)/config/sol2-stubs.cc $(COMPILE) $< From patchwork Thu Sep 7 13:36:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=R8A1E9cY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL453mXhz1ygc for ; Thu, 7 Sep 2023 23:41:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 79DBD3943408 for ; Thu, 7 Sep 2023 13:40:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 73E5F3857C43 for ; Thu, 7 Sep 2023 13:38:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73E5F3857C43 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-307d58b3efbso923828f8f.0 for ; Thu, 07 Sep 2023 06:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093912; x=1694698712; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kqOU5lN5r+wR6NUXRSam3b2vkSF4erA7P5xTu1WF2b8=; b=R8A1E9cYpclX1fW66RAb1PbkEqNstQ85x2Pw5smHecIIjKZJ7ztv2+WnTxqtpcAGFV cBeZjzr+OLueSEADu3HygeZFfol4abFqlx+gzIrIFSNmB5Q4NgH9FW2RIDsI6LNvMPbD vyLbk4FNbmOoK/k1S9bEvGk/XYDxB/eiaovjranHBp5SGbd1RdFxV+tYF+TB7IoQVBaq c2+1NrS3EFpGhumdenhE2Fke1XPOuwkH7AKqAWe694mdLLB1x+KbocWGygCRDnEwW7Cx j3B9pq+ZYWLg/Noi5Ijrx99Ugxe5UZCTRkaoi1Ppjun99YIS2hI1RITfR2PdFjGslhY4 ndwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093912; x=1694698712; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kqOU5lN5r+wR6NUXRSam3b2vkSF4erA7P5xTu1WF2b8=; b=ZFvtk1Tl8MAFppPjpU9WrPrAQUqV/qZ/KjdE9NuFNYv7VWzpYzkFkKIyy18+ZHo6hs kjCjiMKkXxnXWOxgM2NprPaJrCeqM8bCSs38iv+pXfx21pFFV+3tz/BhMVrmyIuEncfg 40Ak7Bznr1lXVc0TrcuMVdsv07GQE0iy+dvI+xdMu10U5hZzmv1FG0UpIw5idY/wy248 agyMI9pCnTj+yIawPHxdTBMbKuaqxA8ZaqrBabBmJHGy95WWb+T9/mbn9wd1GiZ6o87h co3ujW2+MArdOJKP8HsB4HBk+IZMXzRRqRkstK7ChEtCrdSOVScOrqbaDv2rkMQX7289 KgHQ== X-Gm-Message-State: AOJu0Ywjsyp92o91LM7/NZubZSMYF2DK2M2fKdUQweoNX135VCHDK6aL wl9i9rPtPuv474CmrdLRLww6rIfwbcwpk13pRw== X-Google-Smtp-Source: AGHT+IGWdqJoOqLuMJvHmjdND4s9smIzSK1W4z6sO06g7mB+MZdHVj18b7Q3JsNL5thmVi3zGQif8w== X-Received: by 2002:a5d:6b49:0:b0:31a:ed75:75d6 with SMTP id x9-20020a5d6b49000000b0031aed7575d6mr4931005wrw.15.1694093911987; Thu, 07 Sep 2023 06:38:31 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:31 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 10/14] rust: Implement TARGET_RUST_OS_INFO for *-*-dragonfly* Date: Thu, 7 Sep 2023 15:36:36 +0200 Message-ID: <20230907133729.2518969-11-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-dragonfly*): Set rust_target_objs and target_has_targetrustm. * config/t-dragonfly (dragonfly-rust.o): New rule. * config/dragonfly-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/dragonfly-rust.cc | 40 ++++++++++++++++++++++++++++++++++++ gcc/config/t-dragonfly | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 gcc/config/dragonfly-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index 81142763ac2..9344e26a48e 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -813,6 +813,8 @@ case ${target} in d_target_objs="${d_target_objs} dragonfly-d.o" tmake_file="${tmake_file} t-dragonfly" target_has_targetdm=yes + rust_target_objs="${rust_target_objs} dragonfly-rust.o" + target_has_targetrustm=yes ;; *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later diff --git a/gcc/config/dragonfly-rust.cc b/gcc/config/dragonfly-rust.cc new file mode 100644 index 00000000000..ce501d1b6fd --- /dev/null +++ b/gcc/config/dragonfly-rust.cc @@ -0,0 +1,40 @@ +/* DragonFly support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for DragonFly targets. */ + +static void +dragonfly_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "dragonfly"); + rust_add_target_info ("target_vendor", "unknown"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO dragonfly_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-dragonfly b/gcc/config/t-dragonfly index b80587dd0d3..e60fa18f116 100644 --- a/gcc/config/t-dragonfly +++ b/gcc/config/t-dragonfly @@ -19,3 +19,7 @@ dragonfly-d.o: $(srcdir)/config/dragonfly-d.cc $(COMPILE) $< $(POSTCOMPILE) + +dragonfly-rust.o: $(srcdir)/config/dragonfly-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830930 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=MsY5xuWw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL2P5J65z1ygR for ; Thu, 7 Sep 2023 23:39:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52B44388551E for ; Thu, 7 Sep 2023 13:39:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 591A53857732 for ; Thu, 7 Sep 2023 13:38:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 591A53857732 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31c5c06e8bbso964677f8f.1 for ; Thu, 07 Sep 2023 06:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093913; x=1694698713; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kj/SMz1nEQ/oehb1jKfyY/MJ28i9npIUeSjpM1sPWL8=; b=MsY5xuWwnbfDtR0zlJr+qDXKzqw4oGJoFPDwhZOYKbL/BwN8zHWAGtsC7EpvaIIkV2 vkVyDCWTqrgllvsiO4fU9gcT40bCpKX9koXhdYeHkVF0NG8cYkzVGz/fJBkoFYvi+4hX mrOkrzHL1dhmUKmtSkAfjE+4vSDDhQwNEoM6uIsgM3UdVA2ysPw6Bhj+aeCDCoqqTfGX Fb/Futc/kQ3f+blZVuFkG6F6JB/xqaDHPmQUs3zsr+xqrfD40E+LKPQo6ql0KLKKxF1R zQYWirgJ2rHaZsENHuRHkQpggIldUBs661nEhDN0RhH1VvsiJy18zTYdtD09muIxzsPe LRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093913; x=1694698713; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kj/SMz1nEQ/oehb1jKfyY/MJ28i9npIUeSjpM1sPWL8=; b=A+YIdObYgaQajWXgKtANxF9sZJFiV2y2BPUSUgoUJGwVazB/V942xO466y2GTtRwW9 IZNrzcz4LUXeS0rUSFYek4b1I4o9s66LluaNHGGz+hOLnNUO25EheQDB2Sb5QWUwXeU6 DDqUo9tGmsQ3gGbgwkykf/l8g3DhhVvw8sBPpwk9X7RLgSk1Ili4VTQU95wG0OF2Ks1b EdZz1jo64x45PGa137Zwls7AcC+GweTXW0875mGKc5KxF2nVIZUxZmNSbO2bLWOL9yCQ NkrSJnw/iA3xL5dk6fyaDpZ7AdBsIzFL5gQ+v+fz79RNSEwzX1WGyBZUYAIYLb/A5Kqy dMnA== X-Gm-Message-State: AOJu0YxXyeLmXVC+Jf1MntfZsP2/wAfsafiMYscu0HKt5P5d6zjoEUiP nj3+6mRyFqQycu3RotTZXbSgwfEzTpPXgO04Ng== X-Google-Smtp-Source: AGHT+IFtXWqgwQonhOC0MbYvty7ahESPa00xF2cl5UsMBZPgTr89GdEPjbgyCk57ks+DGg3FTIE81g== X-Received: by 2002:a5d:50c9:0:b0:31a:d450:c513 with SMTP id f9-20020a5d50c9000000b0031ad450c513mr5357181wrt.26.1694093912821; Thu, 07 Sep 2023 06:38:32 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:32 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 11/14] rust: Implement TARGET_RUST_OS_INFO for *-*-vxworks* Date: Thu, 7 Sep 2023 15:36:37 +0200 Message-ID: <20230907133729.2518969-12-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-vxworks*): Set rust_target_objs and target_has_targetrustm. * config/t-vxworks (vxworks-rust.o): New rule. * config/vxworks-rust.cc: New file. --- gcc/config.gcc | 3 +++ gcc/config/t-vxworks | 4 ++++ gcc/config/vxworks-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 gcc/config/vxworks-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index 9344e26a48e..da59fa3eecd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1092,6 +1092,9 @@ case ${target} in extra_headers="${extra_headers} ../vxworks/vxworks-predef.h" target_has_targetcm="yes" + rust_target_objs="${rust_target_objs} vxworks-rust.o" + target_has_targetrustm=yes + extra_gcc_objs="vxworks-driver.o" # This private header exposes a consistent interface for checks on diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks index 164869a7bf0..639b2fd7a21 100644 --- a/gcc/config/t-vxworks +++ b/gcc/config/t-vxworks @@ -28,6 +28,10 @@ vxworks-c.o: $(srcdir)/config/vxworks-c.cc $(COMPILE) $< $(POSTCOMPILE) +vxworks-rust.o: $(srcdir)/config/vxworks-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + # We leverage $sysroot to find target system headers only, distributed # in a VxWorks (a)typical fashion with a different set of headers for # rtp vs kernel mode. We setup SYSROOT_HEADERS_SUFFIX_SPEC to handle diff --git a/gcc/config/vxworks-rust.cc b/gcc/config/vxworks-rust.cc new file mode 100644 index 00000000000..76d618cdcd1 --- /dev/null +++ b/gcc/config/vxworks-rust.cc @@ -0,0 +1,40 @@ +/* VxWorks support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for VxWorks targets. */ + +static void +vxworks_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "vxworks"); + rust_add_target_info ("target_vendor", "wrs"); + rust_add_target_info ("target_env", "gnu"); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO vxworks_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; From patchwork Thu Sep 7 13:36:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=eHz38/Sr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL3N5Rl8z1ygc for ; Thu, 7 Sep 2023 23:40:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA9443893660 for ; Thu, 7 Sep 2023 13:39:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 4E66F3857353 for ; Thu, 7 Sep 2023 13:38:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E66F3857353 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31c479ede21so986300f8f.2 for ; Thu, 07 Sep 2023 06:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093914; x=1694698714; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kNgIupn1HABzgFIxPXpLsoEBn38A8a/9a9GhPDbma/0=; b=eHz38/SrDN6lXCjyZ98WlMW2fbme9a4yq19spVGGrBdbxc0k1llJpdHcERxz4JubQe OFWg2rRaXP0lBuum3yrjiHNTOz7TBhbLPhTxdqYE9uZOXyUUPseiainei5gVIwDv8w3Y aHNFQ8YK4FAyvPnwSfkAUMKu0xktlKRDTW4y0sd7Zv4QlyXSLhuzEPIihwVuitjjMhU9 1nvlVjOrqgxfXNZqfKGLSWv2zOyNF7GTx+xcsWevLtei/FFJnymqe/lFnaXJeBA1jLqq ulpi8rBmJyvSrOToz94g0ygRBTYh+SL70BTIhrr7p7jHEB27OJFNkyaL1tfQ5TF5+G8c DitA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093914; x=1694698714; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kNgIupn1HABzgFIxPXpLsoEBn38A8a/9a9GhPDbma/0=; b=OS8ubHOwdif2zRokJJ5BaPMSM/6uz2Qtm+ERze7goO03z3ETSMGqBzY27MI5eYkwVd lVzh7g50xQk3NMZs/gLzCRxVzdusX9rtbRcWxp2+/Hx3pvYEGwVdC5YVp2pZw2HMKmRf 9ZMw8ltHO7RjWhzTLv0G60IaNOrgV1+d+pMyd1zyAXaSl+ukkyFCHQEm233MYsXnAtRF gSBoIac5emwsltV7ecoTv7RQo3BiyNiV8BBbzd3RmbT6Aupzj/YN4Zqv+ZNDYJRXleRP 5S47dyq7wk1CEFVsPzCiRXhFUKFTsOuxPUWHXLj6VhqQ2ekxkyLPRaJ5PRvi7z7gX0Kz spng== X-Gm-Message-State: AOJu0YzvrCvI12t4SPKcUnG4hRxfq1pyJsFfQvF+sgLRIhAgP5W/sDSy XfgvHgRH9xLdIK27XeCMtf/xOz/IosWZG+YUTA== X-Google-Smtp-Source: AGHT+IE4cFPfc9+MlIMPcaNDn1bGiFGYe/wCS85ITf36HleJTW0+j6Ox2Q+kqOzXLbUZx2zHg9P41Q== X-Received: by 2002:adf:e5c7:0:b0:314:3e77:f210 with SMTP id a7-20020adfe5c7000000b003143e77f210mr4959896wrn.59.1694093913734; Thu, 07 Sep 2023 06:38:33 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:33 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 12/14] rust: Implement TARGET_RUST_OS_INFO for *-*-fuchsia*. Date: Thu, 7 Sep 2023 15:36:38 +0200 Message-ID: <20230907133729.2518969-13-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*-*-fuchsia): Set tmake_rule, rust_target_objs, and target_has_targetrustm. * config/fuchsia-rust.cc: New file. * config/t-fuchsia: New file. --- gcc/config.gcc | 3 +++ gcc/config/fuchsia-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++ gcc/config/t-fuchsia | 21 ++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 gcc/config/fuchsia-rust.cc create mode 100644 gcc/config/t-fuchsia diff --git a/gcc/config.gcc b/gcc/config.gcc index da59fa3eecd..a512eb37275 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -871,6 +871,9 @@ case ${target} in ;; *-*-fuchsia*) native_system_header_dir=/include + tmake_file="t-fuchsia" + rust_target_objs="${rust_target_objs} fuchsia-rust.o" + target_has_targetrustm=yes ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) extra_options="$extra_options gnu-user.opt" diff --git a/gcc/config/fuchsia-rust.cc b/gcc/config/fuchsia-rust.cc new file mode 100644 index 00000000000..86262504ac2 --- /dev/null +++ b/gcc/config/fuchsia-rust.cc @@ -0,0 +1,40 @@ +/* Fuchsia support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for Fuchsia targets. */ + +static void +fushsia_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_os", "fushsia"); + rust_add_target_info ("target_vendor", "unknown"); + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO fushsia_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-fuchsia b/gcc/config/t-fuchsia new file mode 100644 index 00000000000..55c884bcb2e --- /dev/null +++ b/gcc/config/t-fuchsia @@ -0,0 +1,21 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# 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 +# . + +fuchsia-rust.o: $(srcdir)/config/fuchsia-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) From patchwork Thu Sep 7 13:36:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=MjdnFLaP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL2q6Trqz1ygR for ; Thu, 7 Sep 2023 23:40:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6C053895FE6 for ; Thu, 7 Sep 2023 13:39:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id E42343857BB2 for ; Thu, 7 Sep 2023 13:38:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E42343857BB2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31768ce2e81so941694f8f.1 for ; Thu, 07 Sep 2023 06:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093914; x=1694698714; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=5OUb6XOi8LrUq/fON5R8EIZc/EGukvOJpN++0jE/FMY=; b=MjdnFLaPY0DKN2KJSQVjLhzLGX24h4FXLd8jOyRy6/Mb9wFNpEOaYbZTlY+RMSOnl0 fb9poUPoT5iPRKd0Dg+A3alrBxi7dVSeXx3ZPqOQwFQAYtSI51klw1VC2NLQoZJPxh5g HU8DgrVZpdJJ8SU76/TbW+jJsZTu9m0D43Q+uvVZFRZr3drBXUH7BzG9P2hDe/B8fW5m ObRFSIC3TSruluOijBUrEhPHI/DlaZ1viwipyD/fVeE8o5qaL4TVLbse19f0ES1xmyVV DAjwYARspxXr7AjkVyGie3rswbE5y3HJ5ushRjvd3Oyv2X11hsPmWQeUhxlDgDke5qgo EwJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093914; x=1694698714; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5OUb6XOi8LrUq/fON5R8EIZc/EGukvOJpN++0jE/FMY=; b=kaPc2vQcYZWxkwIXAkBhbtAMG2Px5lfl+v2XBdcODBmqEE9uSGztaoRVtZFs88h+cJ ZJzPpmR8fdhGHo4M+8VjYrc7RoaDuE+TS855vmkm3oj6QqOV+8N/1ydSYeBdQD5aZLfr nX89OPxfwQSa6TWWMcop1OCbHUGhE9izDH0VtKjLQ17PSkpzuWQyBsVPWSp56xUztpLe /mEmp1JTNvNQ5pBPquX5mFV/HBEETMfRR3sD8KBZgiOpRD5eLe7ngq2XxpMjooYuLq0g RW9+y+Ret6IQBeeJFrmQm9WYl8LfTpM/Kkl3sOFy3v9RrPttYB9cVo06Qdo6vfJIP3rs q5Xg== X-Gm-Message-State: AOJu0YxgeeDnVd97HEQOP6MWvwaHnA9FFH4kZq2CB+yLYbiLhS8psYUd w65/lvAuqNjNhU+cV/6UvLDQDzIWaOwNo3VRWg== X-Google-Smtp-Source: AGHT+IGuuARXIN/wBPdXOXdRrx+AIqxb0D0o6NSwW1+F6urzPvavsxX/q+hvWgJaK+e9tbyfDlcn1A== X-Received: by 2002:a5d:670d:0:b0:31c:887f:82f3 with SMTP id o13-20020a5d670d000000b0031c887f82f3mr4310589wru.40.1694093914467; Thu, 07 Sep 2023 06:38:34 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:34 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 13/14] rust: Implement TARGET_RUST_OS_INFO for i[34567]86-*-mingw* and x86_64-*-mingw*. Date: Thu, 7 Sep 2023 15:36:39 +0200 Message-ID: <20230907133729.2518969-14-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (i[34567]86-*-mingw* | x86_64-*-mingw*): Set rust_target_objs and target_has_targetrustm. * config/t-winnt (winnt-rust.o): New rule. * config/winnt-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/t-winnt | 4 ++++ gcc/config/winnt-rust.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 gcc/config/winnt-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index a512eb37275..a7a36fccd8d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2170,6 +2170,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) d_target_objs="${d_target_objs} winnt-d.o" target_has_targetcm="yes" target_has_targetdm="yes" + rust_target_objs="${rust_target_objs} winnt-rust.o" + target_has_targetrustm="yes" case ${target} in x86_64-*-* | *-w64-*) need_64bit_isa=yes diff --git a/gcc/config/t-winnt b/gcc/config/t-winnt index 73ce48af12b..b70c7f799e4 100644 --- a/gcc/config/t-winnt +++ b/gcc/config/t-winnt @@ -20,3 +20,7 @@ winnt-c.o: config/winnt-c.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(C_TARGET_H) $(C_TARGET_DEF_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $< $(OUTPUT_OPTION) + +winnt-rust.o: $(srcdir)/config/winnt-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/config/winnt-rust.cc b/gcc/config/winnt-rust.cc new file mode 100644 index 00000000000..190584d3961 --- /dev/null +++ b/gcc/config/winnt-rust.cc @@ -0,0 +1,40 @@ +/* Windows support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Implement TARGET_RUST_OS_INFO for Windows targets. */ + +static void +winnt_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "windows"); + rust_add_target_info ("target_os", "windows"); + rust_add_target_info ("target_vendor", "pc"); + rust_add_target_info ("target_env", "gnu"); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO winnt_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; From patchwork Thu Sep 7 13:36:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1830938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=OOWNeaWJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RhL4k4pz5z1ygc for ; Thu, 7 Sep 2023 23:41:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E765F385841A for ; Thu, 7 Sep 2023 13:41:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id A96373857438 for ; Thu, 7 Sep 2023 13:38:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A96373857438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-402c1407139so11197535e9.1 for ; Thu, 07 Sep 2023 06:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093915; x=1694698715; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Vl4L5kZzagtvQF6Pd/KEV9ilMkyzy+AuxRxxzKGH2gw=; b=OOWNeaWJ/aoSID3M3X+97+HadZq9uZJzkRLOhw8LowC0lUCrTllElrWkataUSwRM03 Gfenh62xjyXH++VMmXMUfS6cwWERWclBMIzT/Z1NsTfo2vrdhXmOQa8SwgnUhV+amh8u pt8ZsGVLSfArTS16BUYtkQlhqFDE5d0naf4LB9Pxxq4lMjO3tfIZOskCCku+Xzf319RY tmrQMdnj27Zp/mIwehZYN50VCy0xVYNIx2sajHUn3eyc+OfZoW++EyVob99zSNLuVQg+ WtEN4CLJXQYQ4hOQeZaU9fyHRD/hZ17XUOOWBD3pz4YeTrUZb3v7zwQhgABWsNRZ/iqS uQ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093915; x=1694698715; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Vl4L5kZzagtvQF6Pd/KEV9ilMkyzy+AuxRxxzKGH2gw=; b=fQRWRFNGKx0ODQcuaTp2qoFXn9iWWIj4GDfwk47cU36BE0hTdOiq+6DsdOEKkHAn5/ fbfu2dowhxb1yb4iUFD4bQrkTQgmJuc/uOqZY8pS9xvcXkwl2NF3SnbuBmwTThK2ylXS 8DbJOV15lj5vZCIs3jdHGn3WsjD4NXV8ICvg3ym+5uToK8KMvq4wqH+ECZEckP6poxo/ M37Wu06cllwQRo9E6bVE0EU1XKHCmCpqIwRO5rLqh8g/S7/SrKhSG11mvUZb+6ulE/MA WCj991qEfNAki4DYT+x6XNzZ8Luonio/9xPaTN6H9LZCeDt41foiViuSPIHjQxnI/TUZ FqZw== X-Gm-Message-State: AOJu0YzsyZeweojxWC16PTZyS1Hp3THLns4JLMbwWFoCuZcVM0UaFIr3 4Tud0ex8tyQcJZmLQ1PIPM+zYutTmYYr57eFKw== X-Google-Smtp-Source: AGHT+IHlxNmyLZWc633Sq7SSAeiBsYhlPoUV58VA0Dj+uy3rpJrSrV1eGM+TnZbS0eYPzyutGZK70Q== X-Received: by 2002:a5d:4a0e:0:b0:30e:19a8:4b0a with SMTP id m14-20020a5d4a0e000000b0030e19a84b0amr4950840wrq.2.1694093915215; Thu, 07 Sep 2023 06:38:35 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:34 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Subject: [PATCH 14/14] rust: Implement TARGET_RUST_OS_INFO for *-*-*linux*. Date: Thu, 7 Sep 2023 15:36:40 +0200 Message-ID: <20230907133729.2518969-15-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907133729.2518969-2-arthur.cohen@embecosm.com> References: <20230907133729.2518969-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Cc: gcc-rust@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Iain Buclaw gcc/ChangeLog: * config.gcc (*linux*): Set rust target_objs, and target_has_targetrustm, * config/t-linux (linux-rust.o): New rule. * config/linux-rust.cc: New file. --- gcc/config.gcc | 2 ++ gcc/config/linux-rust.cc | 57 ++++++++++++++++++++++++++++++++++++++++ gcc/config/t-linux | 4 +++ 3 files changed, 63 insertions(+) create mode 100644 gcc/config/linux-rust.cc diff --git a/gcc/config.gcc b/gcc/config.gcc index a7a36fccd8d..0c8d756a895 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -944,6 +944,8 @@ case ${target} in *-*-*linux*) d_target_objs="${d_target_objs} linux-d.o" target_has_targetdm=yes + rust_target_objs="${rust_target_objs} linux-rust.o" + target_has_targetrustm=yes ;; *-*-kfreebsd*-gnu) d_target_objs="${d_target_objs} kfreebsd-d.o" diff --git a/gcc/config/linux-rust.cc b/gcc/config/linux-rust.cc new file mode 100644 index 00000000000..3eaa91818ff --- /dev/null +++ b/gcc/config/linux-rust.cc @@ -0,0 +1,57 @@ +/* Linux support needed only by Rust front-end. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* `-mandroid' is not available as an command-line option. */ +#ifndef TARGET_ANDROID +#define TARGET_ANDROID 0 +#endif + +/* Implement TARGET_RUST_OS_INFO for Linux targets. */ + +static void +linux_rust_target_os_info (void) +{ + rust_add_target_info ("target_family", "unix"); + rust_add_target_info ("target_vendor", "unknown"); + + if (TARGET_ANDROID) + rust_add_target_info ("target_os", "android"); + else + rust_add_target_info ("target_os", "linux"); + + if (OPTION_GLIBC) + rust_add_target_info ("target_env", "gnu"); + else if (OPTION_MUSL) + rust_add_target_info ("target_env", "musl"); + else if (OPTION_UCLIBC) + rust_add_target_info ("target_env", "uclibc"); + else + rust_add_target_info ("target_env", ""); +} + +#undef TARGET_RUST_OS_INFO +#define TARGET_RUST_OS_INFO linux_rust_target_os_info + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/config/t-linux b/gcc/config/t-linux index 03966d5ce96..96593fbf27f 100644 --- a/gcc/config/t-linux +++ b/gcc/config/t-linux @@ -23,3 +23,7 @@ linux.o: $(srcdir)/config/linux.cc linux-d.o: $(srcdir)/config/linux-d.cc $(COMPILE) $< $(POSTCOMPILE) + +linux-rust.o: $(srcdir)/config/linux-rust.cc + $(COMPILE) $< + $(POSTCOMPILE)