From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 5C7B13856DC0 for ; Thu, 7 Sep 2023 13:38:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C7B13856DC0 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-x32b.google.com with SMTP id 5b1f17b1804b1-401bbfc05fcso11035155e9.3 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=agsGhjOvqUqyJ//o1XT+QgtOnCNwoc0OJT9dQ3nXNpSvyao07c9kvGKTTTrFHx+6AJ fQBlMuVYkPlhmLtMbSIwMNP9tCcW4xekvTU7SYvfkPXyhrkrl3TC3IGyoVdPHdLO0jM/ Ix06Zgz8A6q84qcmfLsCeKNjWNGkHoNXg3xeoSCMdRye896sbFM7mF0eWVhHqjX+prI/ UiQLEF5rQFJ8areEP/b+OTBR+FkmLbXodYqI0r9fUmgwOSo3OaVO0vfA4Q2wKcMt2edS 0x96T0ReO71ptiZmlKw4adLZ5+prNC+jzwRmQxW+gdcyciDUyIZscFHAIcZ4ykH530wC F4aA== X-Gm-Message-State: AOJu0Ywp9f/6oCGENXzOj2P+QT1PsDXaIPuuyhBBoquWr6J63yPkn+3I Iq8FArWo74+1FIvFwf2F97BU+9mCEVSOaQrsDg== 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 Cc: gcc-rust@gcc.gnu.org, ibuclaw@gdcproject.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> 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 (*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) -- 2.42.0