From patchwork Sun Mar 21 12:00:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1456284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=eRE/JA9X; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F3GRf3vmGz9sRf for ; Sun, 21 Mar 2021 23:00:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 454883857C6F; Sun, 21 Mar 2021 12:00:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 454883857C6F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1616328044; bh=b2NTzYGseBaUq+6ifq8UnKTeY9N0xKNuBQezrc9phwE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eRE/JA9X1/Fb261Dmf87+IiAxXVoG7pVhn2xqx8pB6F7U15wYzZTFp+mGgpwAthnn xyabG33GpvKkreP76XIXsn4byasGCir6pnWsWsGBXCXQQczVVc4ZNJyWEUkR4Oc9LC geNVJsxwbYO1kPj7k0li8scf1PS7cJr7utkhndr4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by sourceware.org (Postfix) with ESMTPS id 36EA73858C27 for ; Sun, 21 Mar 2021 12:00:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 36EA73858C27 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4F3GRW4MgPzQjmm; Sun, 21 Mar 2021 13:00:39 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id Nxn7Tj2W0MV3; Sun, 21 Mar 2021 13:00:33 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] d: Add openbsd support for D compiler (PR99691) Date: Sun, 21 Mar 2021 13:00:29 +0100 Message-Id: <20210321120029.106855-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: X-Rspamd-Score: -0.07 / 15.00 / 15.00 X-Rspamd-Queue-Id: 4D9DA25C X-Rspamd-UID: 40cb5e X-Spam-Status: No, score=-15.6 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch adds necessary backend support for OpenBSD targets so that all relevant predefined version conditions are available, a prerequesite for building most parts of libphobos. Tested gdc by building x86_64-pc-openbsd as a cross compiler, and I've been doing some preliminary testing on an OpenBSD VM - libphobos specific patches will come later - before I commit it to mainline, is there anything glaringly missing in the configure file changes? Regards Iain --- gcc/ChangeLog: PR d/99691 * config.gcc (*-*-openbsd*): Add openbsd-d.o. * config/t-openbsd: Add openbsd-d.o. * config/openbsd-d.c: New file. --- gcc/config.gcc | 2 ++ gcc/config/openbsd-d.c | 38 ++++++++++++++++++++++++++++++++++++++ gcc/config/t-openbsd | 5 +++++ 3 files changed, 45 insertions(+) create mode 100644 gcc/config/openbsd-d.c diff --git a/gcc/config.gcc b/gcc/config.gcc index b3b84374fd0..3394f1191f6 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -917,6 +917,8 @@ case ${target} in default_use_cxa_atexit=yes ;; esac + d_target_objs="${d_target_objs} openbsd-d.o" + target_has_targetdm=yes ;; *-*-phoenix*) gas=yes diff --git a/gcc/config/openbsd-d.c b/gcc/config/openbsd-d.c new file mode 100644 index 00000000000..d9c8160e24a --- /dev/null +++ b/gcc/config/openbsd-d.c @@ -0,0 +1,38 @@ +/* Functions for generic OpenBSD as target machine for GNU D compiler. + Copyright (C) 2021 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_p.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +static void +openbsd_d_os_builtins (void) +{ + d_add_builtin_version ("Posix"); + d_add_builtin_version ("OpenBSD"); +} + +#undef TARGET_D_OS_VERSIONS +#define TARGET_D_OS_VERSIONS openbsd_d_os_builtins + +struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; diff --git a/gcc/config/t-openbsd b/gcc/config/t-openbsd index 7637da073b2..27a419d6093 100644 --- a/gcc/config/t-openbsd +++ b/gcc/config/t-openbsd @@ -1,2 +1,7 @@ # We don't need GCC's own include files. USER_H = $(EXTRA_HEADERS) + +# OpenBSD-specific D support. +openbsd-d.o: $(srcdir)/config/openbsd-d.c + $(COMPILE) $< + $(POSTCOMPILE)