From patchwork Mon Oct 10 15:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaius Mulley X-Patchwork-Id: 1873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1641661wrs; Mon, 10 Oct 2022 08:34:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RQSLJhJ0/BNCxBDT0tx4JREuTmUbujGJS8ApF2gSj3Q/me9H0xkLWLe6zkSQV48YCTQGz X-Received: by 2002:a17:907:271a:b0:78d:cdd7:5a23 with SMTP id w26-20020a170907271a00b0078dcdd75a23mr1279279ejk.556.1665416042685; Mon, 10 Oct 2022 08:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665416042; cv=none; d=google.com; s=arc-20160816; b=t/UcOeIBgXQLbfUEj1hjNQsMdrR6jACLr5v//YJM6D5KZ/HeHDXaz+KSUQgyq6QX99 KpBcY342DbSJRcUF/KmNZOoQPZK1RDWd3VMG6SllfrjTkntFj9G09Wj1+iqec+uLWXph dBdHrPwtZldPv08Yqef1Rym0tfyRUR8D19LX4zFzZ0TuPvBiyfRlZ6cPQNQ+QB2yWZyB UJosza/7Gigf1woup7fFYIakpTK0Ox1utjvROo3nubmvuUrWWX7ptH9INuKnCvJTk9mo 2JadcJDm4ejKJcn2WK3vY5Tn4/UnN6DBmqGjW7kGdhKfQ29mj5AK+AfdhwmAiM7CeasV uXQA== 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:date:message-id:to :subject:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ycJICvUjq7Fcp8Y/n7MPf27MzTb5jZLFHhzcSsuwovM=; b=v1Zn3GGOfm2kT6ic7aqXFSAFcpTDSra7eWJklBod0dml9E7YZg/xh/US1LneVmLqAl 7OPUhwsmSWKiu09OCkBCUOBrTaqhqbzcrOT+W04lhweLcAbee1g0LlkWK7ni390XWY2o 3wM5Y0aKNXsNHVjmp4RdOXi5FjJVxPWSqJdQJi1aXfsaQHW2UPtJh4daP7bagXPGtLQX hQpWfwaDXCo9bDp8dy8WHtFugrOxI61TUdxQP8BsZJR6Ctosmd93369kYQ82+oBaP0pg SvIT+8Zz4CqXtYzim2MvvQu/Bk59zS2/xexSn/yoFz3T8Devqucqhjk6KEuATKt0Xbh+ JxTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YSXkrAR7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sb42-20020a1709076daa00b0078dcbd7d244si1513805ejc.376.2022.10.10.08.34.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 08:34:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YSXkrAR7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 C94263952528 for ; Mon, 10 Oct 2022 15:33:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C94263952528 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665416006; bh=ycJICvUjq7Fcp8Y/n7MPf27MzTb5jZLFHhzcSsuwovM=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YSXkrAR7JEmH3BVa1gQUhbPTysmvjZDljb4SfbAn2ZeHd7ct5rh+Fp/C8f9y7eq81 DOrIFfb3xAPWjoxV32hURs9PAgSUpSbF8U/Z84N/WyRzneIaICkSQOGVtCssQZywrC 5GUfFQbwiFtwSBDxeYVbN1kIV2R7Kd1LTOJ8sFBU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 7347D385380F for ; Mon, 10 Oct 2022 15:31:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7347D385380F Received: by mail-wr1-x42f.google.com with SMTP id u10so17599830wrq.2 for ; Mon, 10 Oct 2022 08:31:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=date:message-id:to:subject:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ycJICvUjq7Fcp8Y/n7MPf27MzTb5jZLFHhzcSsuwovM=; b=xGiyr2+38BeOiE5aNZFtT6jqmFH5gScR4vl3S8Gr2cP5qQPpoHhekhYjSdk6HmiIdK tL57tm9uz47nmg0rCnXWElIqJkRmzhf6oq0mJ5bFmo7Sp5E9rnsJhQoyR8R9lpibxdFp PuMIEG8oOCCmd/f87UTKaD2xslhYemvgmwOrKLcU3JvrJCERhP3JewLI3X0EwfBLfSOd TsvWJga4RB4cBop+014RpmFoFEpUPhbOjNwZzVjIGyCAJMCqBHgI8KmnLLGPERvhrvqU bE7A4zBk7SGR5BEC+gVu169+JjSqpSNDcoLTiIrNcQzCBPOMbI4TIzrAmJdFgC5ig0Fq 8sLA== X-Gm-Message-State: ACrzQf0XhATn2SVe7/wpQ356Fl+DHx8l2Lif6MufyAIrKvXW5Gc78axS rIbRGUMl0C8Da/rekjO6kTz0QykEcZM= X-Received: by 2002:a05:6000:15c3:b0:230:f9fb:c7d with SMTP id y3-20020a05600015c300b00230f9fb0c7dmr1892131wry.250.1665415882256; Mon, 10 Oct 2022 08:31:22 -0700 (PDT) Received: from lancelot ([195.147.220.46]) by smtp.gmail.com with ESMTPSA id x15-20020a5d444f000000b0022e035a4e93sm8849469wrr.87.2022.10.10.08.31.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 08:31:21 -0700 (PDT) X-Google-Original-From: Gaius Mulley Received: from gaius by lancelot with local (Exim 4.94.2) (envelope-from ) id 1ohukS-00Bm0n-FL for gcc-patches@gcc.gnu.org; Mon, 10 Oct 2022 16:31:20 +0100 Subject: [PATCH] 6/19 modula2 front end: libgm2/libm2min contents To: X-Mailer: mail (GNU Mailutils 3.10) Message-Id: Date: Mon, 10 Oct 2022 16:31:20 +0100 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, 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?1746315292231987942?= X-GMAIL-MSGID: =?utf-8?q?1746315292231987942?= This patch set consists of the makefiles, autoconf and a few C sources to build the libgm2/libm2min libraries. ------8<----------8<----------8<----------8<----------8<----------8<---- diff -ruw /dev/null gcc-git-devel-modula2/libgm2/libm2min/Makefile.am --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/libgm2/libm2min/Makefile.am 2022-10-07 20:21:18.738098020 +0100 @@ -0,0 +1,147 @@ +# Makefile for libm2min. +# Copyright 2013-2022 Free Software Foundation, Inc. +# +# This file 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 this program; see the file COPYING3. If not see +# . + +SUFFIXES = .c .mod .def .o .obj .lo .a .la + +ACLOCAL_AMFLAGS = -I . -I .. -I ../config + +VPATH = . @srcdir@/../../gcc/m2/gm2-libs-min + +# Multilib support. +MAKEOVERRIDES= + +version := $(shell $(CC) -dumpversion) + +# Directory in which the compiler finds libraries etc. +libsubdir = $(libdir)/gcc/$(target_alias)/$(version) +# Used to install the shared libgcc. +slibdir = @slibdir@ + +toolexeclibdir=@toolexeclibdir@ +toolexecdir=@toolexecdir@ +GM2_FOR_TARGET=@GM2_FOR_TARGET@ + +MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory) +MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory) + +MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi) +inst_libdir = $(libsubdir)$(MULTISUBDIR) +inst_slibdir = $(slibdir)$(MULTIOSSUBDIR) + + +# Work around what appears to be a GNU make bug handling MAKEFLAGS +# values defined in terms of make variables, as is the case for CC and +# friends when we are called from the top level Makefile. +AM_MAKEFLAGS = \ + "GCC_DIR=$(GCC_DIR)" \ + "GM2_SRC=$(GM2_SRC)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ + "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ + "GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \ + "CFLAGS=$(CFLAGS)" \ + "CXXFLAGS=$(CXXFLAGS)" \ + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ + "MAKE=$(MAKE)" \ + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ + "MULTISUBDIR=$(MULTISUBDIR)" \ + "MULTIOSDIR=$(MULTIOSDIR)" \ + "MULTIBUILDTOP=$(MULTIBUILDTOP)" \ + "MULTIFLAGS=$(MULTIFLAGS)" \ + "PICFLAG=$(PICFLAG)" \ + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ + "SHELL=$(SHELL)" \ + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ + "exec_prefix=$(exec_prefix)" \ + "infodir=$(infodir)" \ + "libdir=$(libdir)" \ + "includedir=$(includedir)" \ + "prefix=$(prefix)" \ + "tooldir=$(tooldir)" \ + "AR=$(AR)" \ + "AS=$(AS)" \ + "LD=$(LD)" \ + "RANLIB=$(RANLIB)" \ + "NM=$(NM)" \ + "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ + "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ + "DESTDIR=$(DESTDIR)" \ + "WERROR=$(WERROR)" \ + "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" + +# Subdir rules rely on $(FLAGS_TO_PASS) +FLAGS_TO_PASS = $(AM_MAKEFLAGS) + +M2DEFS = libc.def M2RTS.def \ + SYSTEM.def + +M2MODS = M2RTS.mod SYSTEM.mod + +libm2mindir = libm2min +toolexeclib_LTLIBRARIES = libm2min.la +libm2min_la_SOURCES = $(M2MODS) libc.c +libm2min_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2min_la_SOURCES))) +libm2min_la_CFLAGS = -I. -I$(GM2_SRC)/gm2-libs-min -I$(GM2_SRC)/gm2-libs +libm2min_la_M2FLAGS = -I. -I$(GM2_SRC)/gm2-libs-min -I$(GM2_SRC)/gm2-libs -fno-exceptions \ + -fno-m2-plugin -fno-scaffold-dynamic -fno-scaffold-main +libm2min_la_LINK = $(LINK) -version-info $(libtool_VERSION) +BUILT_SOURCES = SYSTEM.def +CLEANFILES = SYSTEM.def + +M2LIBDIR = /m2/m2min/ + +.mod.lo: + $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(GM2_FOR_TARGET) -c $(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2min_la_M2FLAGS) $< -o $@ + +libc.o: $(GM2_SRC)/gm2-libs-min/libc.c + + +SYSTEM.def: Makefile + echo "CC = $(CC_FOR_BUILD) CC_FOR_TARGET = $(CC_FOR_TARGET) GM2 = $(GM2) GM2_FOR_TARGET = $(GM2_FOR_TARGET) GM2_FOR_BUILD = $(GM2_FOR_BUILD)" + bash $(GM2_SRC)/tools-src/makeSystem -fpim \ + $(GM2_SRC)/gm2-libs-min/SYSTEM.def \ + $(GM2_SRC)/gm2-libs-min/SYSTEM.mod \ + -I$(GM2_SRC)/gm2-libs-min:$(GM2_SRC)/gm2-libs \ + "$(GM2_FOR_TARGET) -fno-exceptions" $@ + +install-data-local: force + mkdir -p $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) + $(INSTALL_DATA) .libs/libm2min.la $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) + chmod 644 $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)libm2min.la + $(INSTALL_DATA) .libs/libm2min.a $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR) + chmod 644 $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)libm2min.a + $(RANLIB) $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)libm2min.a + for i in $(M2DEFS) $(M2MODS) ; do \ + if [ -f $$i ] ; then \ + $(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)'; \ + elif [ -f @srcdir@/../../gcc/m2/gm2-libs-min/$$i ] ; then \ + $(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs-min/$$i '$(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)'; \ + else \ + echo "cannot find $$i" ; exit 1 ; \ + fi ; \ + chmod 644 $(DESTDIR)$(inst_libdir)/$(MULTIDIR)$(M2LIBDIR)$$i ; \ + done + +force: diff -ruw /dev/null gcc-git-devel-modula2/libgm2/libm2min/libc.c --- /dev/null 2022-08-24 16:22:16.888000070 +0100 +++ gcc-git-devel-modula2/libgm2/libm2min/libc.c 2022-10-07 20:21:18.738098020 +0100 @@ -0,0 +1,40 @@ +/* libc.c provides minimal stubs for expected symbols used by the rts. + +Copyright (C) 2010-2022 Free Software Foundation, Inc. +Contributed by Gaius Mulley . + +This file is part of GNU Modula-2. + +GNU Modula-2 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. + +GNU Modula-2 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. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +void abort (void) __attribute__ ((noreturn)); +void exit (int) __attribute__ ((noreturn)); + +void abort (void) +{ + /* you should add your system dependant code here. */ + __builtin_unreachable (); +} + +void exit (int i) +{ + /* you should add your system dependant code here. */ + __builtin_unreachable (); +}