From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 60E7F3858430 for ; Thu, 7 Sep 2023 13:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60E7F3858430 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-31ad779e6b3so955764f8f.2 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=D0VV9rEvoC3eU0k34XxY+MkcwwzjkqwIWHTtECJB4fOdPzCI5G8rCOxRM7DkIHxDRx YsWZawwN+0ES58IPWRor/AmRDjshTT/ahYnxAkHGfYQmE8Fuh5/sz2gCXJrJQXvV5mTH F/slUfYdX6artP1LPAJO4GbhWzf1AMgmljs2Y4xyvTPF2cWOBU+3GdVvxP2N9MdBod76 Cs7GapL6KS4BVfljHhg78b7ds2QATzQeDgZrSSnDkFrfcRAAzPDrWOKZzevtuYycEUUj gU2caeS3hUmCdz33GUdtKM1AwzPvxlgY6SNyaS87tECAw4+8bIrs2NrOIFr1D6l6pFJO cnkQ== X-Gm-Message-State: AOJu0Yz/nO5gSHHS8+icRKO01n8RVA5DdKb+rLwFbhanIrCbtBolrpdx 0SclKjw+hkDV58OC1B0bCnoKZokJqGR9fXoiyw== 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 Cc: gcc-rust@gcc.gnu.org, ibuclaw@gdcproject.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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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) -- 2.42.0