From patchwork Wed Jan 4 23:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaius Mulley X-Patchwork-Id: 39157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp18681wrt; Wed, 4 Jan 2023 15:25:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsG44FnnRHwy5yNdOO9vy+Ql1idUR6VN68WuL9LowknY26gYN3v63h7GIo2e4/m1ZPURdJz X-Received: by 2002:a17:907:8dc6:b0:84c:f9b1:f46e with SMTP id tg6-20020a1709078dc600b0084cf9b1f46emr2899969ejc.31.1672874711048; Wed, 04 Jan 2023 15:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672874711; cv=none; d=google.com; s=arc-20160816; b=R0OjK5XEi7CR7mr3VTOZatucPFSMPrY+2KqZJuhKlSfX7W7uGZNjc8Ii5iObQ8vk5o XrPQfltt2OB78nFE6AN2j+gwMa/meYBt8uUgNPgSf8ppQ71rcpEgtZMHInCLRLOJuQli JnKalyIB5XO0FdFbR+8phyzLX7R9XVeMEy8rSzFiBI9QAwDaw3p4/NtyVGp0xCDjdlSA wplahlIH1Vf53BR31U31hSo8nWY6JSsC8BXON3aMEF2IzUN7w5XBut7lIRWyV9TXl3nO Of26VGbGdjXZpnJLPFRaBvNR8i2HO2kcY7BEneV7Blpfo//fmSwzjUJv5ia+q6rLD4Ex xv/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:message-id:date:subject:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=M12IwbZZ4wVFD5g+dSyrdoYULvSNUYqxdzDNqyqmerc=; b=McyNCTSYs/91rUzRrLdpPKy+YBcpn8dPJd3+0eTDIY/ZTkR0k7Y19lTnSZHhXANPrZ FTUcjsHUifaO3JnkL++TpxO44PHvysouVDCf8joZTF4vMr0Yz1OXkT3/KXcIYBixyv81 UCC3A2NUT3e41XPGAFHI11HtO20gpECPCCgsTVCppGLrD32ghqMGRj2R/ZsSrCnUe1dr bGQAg1xGhtFoRKXYyoh8EjXxGYc18WHxfYXOJ/ZxzVQaPBdQf+NHFMyHtheCjkZwe6Kx FrRzsVfLWezZAJcBmDz0BjVuo+suhSLRANz+tsQ1QMGI6DzlWY2DtB8D/bSBYkUT7hYT a5RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rHdyDg0j; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hv15-20020a17090760cf00b0079800b81747si32577806ejc.735.2023.01.04.15.25.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 15:25:11 -0800 (PST) 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=pass header.i=@gcc.gnu.org header.s=default header.b=rHdyDg0j; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D59E63858408 for ; Wed, 4 Jan 2023 23:25:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D59E63858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672874709; bh=M12IwbZZ4wVFD5g+dSyrdoYULvSNUYqxdzDNqyqmerc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rHdyDg0jhrBuPzPTHqC5xRjMBe0sa2aryvgX4yTcPDQuWXOLSbLzI6FXe/kR6CyHy jcV0GkGuBgGRIJJFddCj3WIWAwEN/juRKY3/w53zFKrXkKV4jnzFhv40omQ0IyN8cv 8m9kUcWuF914wJutQRyCq8UwWYDEL+1pQCW+QDTs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 36F8F3858C53 for ; Wed, 4 Jan 2023 23:24:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36F8F3858C53 Received: by mail-wm1-x330.google.com with SMTP id b24-20020a05600c4a9800b003d21efdd61dso85368wmp.3 for ; Wed, 04 Jan 2023 15:24:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M12IwbZZ4wVFD5g+dSyrdoYULvSNUYqxdzDNqyqmerc=; b=wEK36om2eUAr088QOMbFkDTENpWo0UPvYHrfhtvR1GHE4dwv8jdvIweYDE4MKzd9mP LapLwRN6GdbnymuYr8vV4l0REfsJ6tCDDBlgmZzizNwpxrQuwIH59k/fgF41ALil6qf4 NkOYBGPx2cGkav4A8ef58UobvzSJ8cV+Ic0Zxi6Zbhq9oAutLU9aID+YJ4QJ4UGL69kT UkIyYejAOwJX4t5d5bw7z+U0yvtPy1qwoEyIGLGV22tSqmXySXbb9Oxgtzwy9qhuv1eh HodpLsYDYrKzRE3Jr6yszaHTetv+BsHYwGjxVYj3J9dFDHjFE3JZM4pD0Zicag8U4S5J DgjQ== X-Gm-Message-State: AFqh2koiVKe4TbH6NdpSrmiA9qh61OSDcoYUubiNRE0cEPBNk7S9x19+ hhnd70BTf4njSv52E3IPrzI0iG15RGY= X-Received: by 2002:a05:600c:3789:b0:3d1:f234:12cc with SMTP id o9-20020a05600c378900b003d1f23412ccmr36247931wmr.33.1672874660749; Wed, 04 Jan 2023 15:24:20 -0800 (PST) Received: from lancelot ([195.147.220.46]) by smtp.gmail.com with ESMTPSA id b22-20020a05600c4e1600b003d34faca949sm271368wmq.39.2023.01.04.15.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 15:24:20 -0800 (PST) Received: from gaius by lancelot with local (Exim 4.94.2) (envelope-from ) id 1pDD7L-00Bam7-1W; Wed, 04 Jan 2023 23:24:19 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH modula2] Add missing declarations to gcc/m2/gm2-libs-min/M2RTS.def Date: Wed, 04 Jan 2023 23:24:18 +0000 Message-ID: <87y1qhq3x9.fsf@debian> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, 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 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: Gaius Mulley via Gcc-patches From: Gaius Mulley Reply-To: Gaius Mulley Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754136272865582349?= X-GMAIL-MSGID: =?utf-8?q?1754136272865582349?= Bootstrapped on gnu/linux x86_64 Ok for trunk? thanks Gaius --------- o< --------- o< --------- o< --------- o< --------- o< Add missing declarations to gcc/m2/gm2-libs-min/M2RTS.def This patch adds two missing procedures to gcc/m2/gm2-libs-min/M2RTS.def required for linking (the procedures are already present in the pim and iso M2RTS.def). The patch also includes test code, changes to gcc/testsuite/lib/gm2.exp and an expect tcl script to test the min libraries. gcc/m2/ChangeLog: * gm2-libs-min/M2RTS.def (ConstructModules): New procedure declaration. (DeconstructModules): New procedure declaration. gcc/testsuite: * lib/gm2.exp (gm2_init_minx): New procedure. (gm2_init_min): New procedure calls gm2_init_min with dialect flags. * gm2/link/min/pass/tiny.mod: New test case. * gm2/link/min/pass/link-min-pass.exp: New file. diff --git a/gcc/m2/gm2-libs-min/M2RTS.def b/gcc/m2/gm2-libs-min/M2RTS.def index e3e13b7b554..147024ebe78 100644 --- a/gcc/m2/gm2-libs-min/M2RTS.def +++ b/gcc/m2/gm2-libs-min/M2RTS.def @@ -38,6 +38,10 @@ TYPE all these procedures do nothing except satisfy the linker. *) +PROCEDURE ConstructModules (applicationmodule: ADDRESS; + argc: INTEGER; argv, envp: ADDRESS) ; +PROCEDURE DeconstructModules (applicationmodule: ADDRESS; + argc: INTEGER; argv, envp: ADDRESS) ; PROCEDURE RegisterModule (name: ADDRESS; init, fini: ArgCVEnvP; dependencies: PROC) ; diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp index 450cb4c2d35..9eba195291a 100644 --- a/gcc/testsuite/lib/gm2.exp +++ b/gcc/testsuite/lib/gm2.exp @@ -496,3 +496,42 @@ proc gm2_init_cor { {path ""} args } { gm2_link_lib "m2cor m2pim m2iso" gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args}; } + + +# +# gm2_init_minx - set the default libraries to choose MIN library and +# choose Modula-2, dialect. +# +# + +proc gm2_init_minx { dialect {path ""} args } { + global srcdir; + global gccpath; + + set gm2src ${srcdir}/../m2; + + send_log "srcdir is $srcdir\n" + send_log "gccpath is $gccpath\n" + send_log "gm2src is $gm2src\n" + + set minIpath "${gccpath}/libgm2/libm2min"; + set minLpath "${gccpath}/libgm2/libm2min/.libs"; + + set theIpath "-I${minIpath}"; + set theLpath "-L${minLpath}"; + + if { $path != "" } then { + append theIpath " -I" + append theIpath ${path} + } + gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args}; +} + +# +# gm2_init_min - set the default libraries to choose MIN libraries +# and pim dialect. +# + +proc gm2_init_min { {path ""} args } { + gm2_init_minx -fpim {*}${path} {*}${args}; +} diff --git a/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp b/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp new file mode 100644 index 00000000000..88d180ec31e --- /dev/null +++ b/gcc/testsuite/gm2/link/min/pass/link-min-pass.exp @@ -0,0 +1,37 @@ +# Expect driver script for GCC Regression Tests +# Copyright (C) 2023 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 +# . + +# This file was written by Gaius Mulley (gaiusmod2@gmail.com) +# for GNU Modula-2. + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib gm2-torture.exp + +gm2_init_min "${srcdir}/gm2/min/pass" + +foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $testcase] then { + continue + } + + gm2-torture $testcase +} diff --git a/gcc/testsuite/gm2/link/min/pass/tiny.mod b/gcc/testsuite/gm2/link/min/pass/tiny.mod new file mode 100644 index 00000000000..e1165edbe4a --- /dev/null +++ b/gcc/testsuite/gm2/link/min/pass/tiny.mod @@ -0,0 +1,7 @@ +MODULE tiny ; + +(* Does nothing at all, but it should link if -flibs=min is used. *) + +BEGIN + +END tiny.