From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1499) id 6C6883858D35; Thu, 5 Jan 2023 14:15:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C6883858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672928156; bh=PvJILcblK8Swugdg0mL2HhGgW0COD5eI6CRN/Ee8JZM=; h=From:To:Subject:Date:From; b=n2lnHtV5wxX/HH0+2NgyVjAdZGagVykJXLCN9jAQjkGKiwdvzoaOxOPhM5msJrsIf IrIBvjVFL+70X0OkYZ2UagwTm+bbGXji56KQj2c42KoS9rf1Lrc6vJqbUEaLXrE0y3 LwsDkHcUEwS3mfov2IyMo4YjFMwXS5PlBje0GRrI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Gaius Mulley To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5009] Add missing declarations to gcc/m2/gm2-libs-min/M2RTS.{def, mod} X-Act-Checkin: gcc X-Git-Author: Gaius Mulley X-Git-Refname: refs/heads/master X-Git-Oldrev: dd77b04999534f61825cc810a5bc428707b8106b X-Git-Newrev: a24888388bab339cf8a8726ca67a0b4947a2d9ce Message-Id: <20230105141556.6C6883858D35@sourceware.org> Date: Thu, 5 Jan 2023 14:15:56 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a24888388bab339cf8a8726ca67a0b4947a2d9ce commit r13-5009-ga24888388bab339cf8a8726ca67a0b4947a2d9ce Author: Gaius Mulley Date: Thu Jan 5 14:13:43 2023 +0000 Add missing declarations to gcc/m2/gm2-libs-min/M2RTS.{def,mod} This patch adds two missing procedures to gcc/m2/gm2-libs-min/M2RTS.{def,mod} required for linking. 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. * gm2-libs-min/M2RTS.mod (ConstructModules): New procedure dummy implementation. (DeconstructModules): New procedure dummy implementation. 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. Signed-off-by: Gaius Mulley Diff: --- gcc/m2/gm2-libs-min/M2RTS.def | 4 +++ gcc/m2/gm2-libs-min/M2RTS.mod | 12 +++++++ gcc/testsuite/gm2/link/min/pass/link-min-pass.exp | 37 +++++++++++++++++++++ gcc/testsuite/gm2/link/min/pass/tiny.mod | 7 ++++ gcc/testsuite/lib/gm2.exp | 39 +++++++++++++++++++++++ 5 files changed, 99 insertions(+) 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/m2/gm2-libs-min/M2RTS.mod b/gcc/m2/gm2-libs-min/M2RTS.mod index 643156d3101..8400567e4bd 100644 --- a/gcc/m2/gm2-libs-min/M2RTS.mod +++ b/gcc/m2/gm2-libs-min/M2RTS.mod @@ -30,6 +30,18 @@ IMPORT libc, SYSTEM ; (* we reference these to ensure they are dragged in to the link *) +PROCEDURE ConstructModules (applicationmodule: ADDRESS; + argc: INTEGER; argv, envp: ADDRESS) ; +BEGIN +END ConstructModules ; + + +PROCEDURE DeconstructModules (applicationmodule: ADDRESS; + argc: INTEGER; argv, envp: ADDRESS) ; +BEGIN +END DeconstructModules ; + + (* all these procedures do nothing except satisfy the linker. *) PROCEDURE ExecuteTerminationProcedures ; 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..6a6051ff787 --- /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. 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}; +}