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: 137635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2964496vqo; Thu, 7 Sep 2023 06:42:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZI2KFiRirNaHCJ1MlJZio4oE/xauRnZ7Fc5d5TR5YK592XmZiwFLrPtEyFFacotmHXTjK X-Received: by 2002:a17:906:3297:b0:9a5:7759:19c0 with SMTP id 23-20020a170906329700b009a5775919c0mr5301018ejw.64.1694094141728; Thu, 07 Sep 2023 06:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694094141; cv=none; d=google.com; s=arc-20160816; b=cm9K82rMLD6V+XqAsegwQcGyoFB1sbIV3XC44rmP/BfZJ/20Ot9zkue9Pm7xF21A1A 5r93PgGpZGcBUnoVKOOy2orNOvR5nW1vhzM4Jb7h6cM19KwtEoc1wyHgAd2jmhU7NL2h x8pbRMrWmBGWHZKaVtTeaW56HwPZNhzcbH3dGabqnuI1oMyqm+Ibf/srBKBZBvIxVzT2 UPMqlruzKe6PAokah15RZHQ0I7Zd2DKsl1EzaWgIwarJ5w2rNnJqzjQMydDH8TbPJRwJ 7d8XzXnDyfqzzimekqMeHgLCVR6PgYKToW/T3uwqcQRSmKOg/4pFDpJhxYlXbyE+Eb/h S+wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature:dmarc-filter :delivered-to; bh=Aip0rlE4sWGFecy6xTNUZTW/wVlmF9m1bFlkk9a60Bs=; fh=wFq7tT6aDoWtju83L9lDAhBMEFwd5hWtfnM+XVolLD0=; b=oj5ve+FEs5qEp2gBBJikUBzQrlimH2Ucrfwly8cHubk+BgNrEruMtqNuD8QlonBart 78NYnAwTgOfp4EH5hAuor0yQYXtZ6txVKNdDAJ02XXlWyejpe64KglfKV58qJS09HbZv 8g+1DQdNHHjEgy9riHuEXIOQvosc8VOz7Sqtb0X+WFIOStkO5RmVNx50PuoonXIdbQVq mHC1HbtJWfmbXZCJNhdm5maVxkbxJmJVcfPckX/hQ05W16439D6YHlicugYOPPQgQwg7 9PcTP/A8MQ/KxRb6BJWmUawXd9cOrFIl6iSxXTzR5anIDrLl+VDLwesvtFEzcoR/QAfx IxSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embecosm.com header.s=google header.b=X3Lz19tj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k3-20020a1709061c0300b00993d5cdf483si72825ejg.807.2023.09.07.06.42.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@embecosm.com header.s=google header.b=X3Lz19tj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F39E63885503 for ; Thu, 7 Sep 2023 13:39:40 +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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776386458575685798 X-GMAIL-MSGID: 1776386458575685798 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)