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: 137641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp2966323vqo; Thu, 7 Sep 2023 06:45:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHh8FFSIC0YrKP77kWt4DVVVl+60T4mXbFcIBAL+jZ1EEHQpnAbWOIopakpbBA+zB5nnMYf X-Received: by 2002:a17:906:1090:b0:99d:f056:5d6b with SMTP id u16-20020a170906109000b0099df0565d6bmr5051853eju.20.1694094357134; Thu, 07 Sep 2023 06:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694094357; cv=none; d=google.com; s=arc-20160816; b=PgQxuMDTFo/G7QHSrhNGo4HBqMG+OAHFm2wvkkWVlIAB09nn3FjFX9umSjBsbALKgS hrREuEUQd4pzPMUvykSH5XcsOxg7uAmfK2GVPwJmK/PzrY0DbNFBgidQDZhskEZ2LacX 52MMqzMgjPnO7nv+NiWXKRGkJCr9kCix4ZFjrSn5cm6Q06UdbMEUPzUd+xQlM/ihRExa vFkJ28dNd1TeoGMfVhNRTjsED2VXY5yGe9nywt63dcFnoVrQoCXihEayjyGrciRvORUz aShQG2F+YnlYeVuV5z2xDb+qwxH25a8yrd44UwYvevqiJqY+04o+X2gd7sj683hoysAo udPg== 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=h4lcXVCPlxtcEEIiaxtOVv/ouBEgvVBTG0TvcnGKs7U=; fh=wFq7tT6aDoWtju83L9lDAhBMEFwd5hWtfnM+XVolLD0=; b=lqd4SU69OtWF2wo7AdloqyUdiuJJYMN1SduaKkeDUoJwo9M77Y8uW60o+2nDJT7gp1 VvGFulJvz/5/9g6MsH6SX2G3bino+sDzNK0gMGajzkubRGGgWpi13TOcz+2IZamb1AVi wwRZMdomgdhjvzvxgGxSvK2PUnTGUcpjXsOIcAU1UkjH3WLLOyOHJhpgIPwNqeCwnqN4 xzjGQUKc6JLzrcO1RJvdleFX2umimYr4+TLS29DKCRX91e7vz2hZt063YEihBQHmwlt4 iC0/1b5wWRb9ALJWI5Bplx+tLY+kxUZcRpMYRKVxK+wC/RAEdJZR1fw1hqiOOgkEGibE 6PgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embecosm.com header.s=google header.b="Qyork/ki"; 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 l25-20020a1709061c5900b009a633d5a4ccsi7567322ejg.140.2023.09.07.06.45.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:45:57 -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="Qyork/ki"; 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 8AC053882055 for ; Thu, 7 Sep 2023 13:40:52 +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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776386684911447616 X-GMAIL-MSGID: 1776386684911447616 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)