Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2225411/?format=api
{ "id": 2225411, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2225411/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260421020056.1516544-1-gaiusmod2@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260421020056.1516544-1-gaiusmod2@gmail.com>", "date": "2026-04-21T02:00:55", "name": "[pushed] PR modula2/120189 Bugfix to documentation and fix prototypes in m2rts.h", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5fe47df85df6feb6159c22a230561d23257f672f", "submitter": { "id": 80961, "url": "http://patchwork.ozlabs.org/api/1.1/people/80961/?format=api", "name": "Gaius Mulley", "email": "gaiusmod2@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260421020056.1516544-1-gaiusmod2@gmail.com/mbox/", "series": [ { "id": 500707, "url": "http://patchwork.ozlabs.org/api/1.1/series/500707/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500707", "date": "2026-04-21T02:00:55", "name": "[pushed] PR modula2/120189 Bugfix to documentation and fix prototypes in m2rts.h", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500707/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225411/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225411/checks/", "tags": {}, "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=AS1R5+zd;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=AS1R5+zd", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.43" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g05FD4CZlz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 12:01:35 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 2CBFA4CCCA34\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 02:01:33 +0000 (GMT)", "from mail-wm1-f43.google.com (mail-wm1-f43.google.com\n [209.85.128.43])\n by sourceware.org (Postfix) with ESMTPS id 8FF804BA23D4\n for <gcc-patches@gcc.gnu.org>; Tue, 21 Apr 2026 02:01:04 +0000 (GMT)", "by mail-wm1-f43.google.com with SMTP id\n 5b1f17b1804b1-48a3e9862f0so8059035e9.1\n for <gcc-patches@gcc.gnu.org>; Mon, 20 Apr 2026 19:01:04 -0700 (PDT)", "from gawain ([82.153.81.102]) by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43fe4cb135asm37573413f8f.6.2026.04.20.19.01.01\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 20 Apr 2026 19:01:02 -0700 (PDT)", "from gaius by gawain with local (Exim 4.98.2)\n (envelope-from <gaius@gawain>) id 1wF0Q9-00000006MWb-1IvW;\n Tue, 21 Apr 2026 03:01:01 +0100" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 2CBFA4CCCA34", "OpenDKIM Filter v2.11.0 sourceware.org 8FF804BA23D4" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 8FF804BA23D4", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 8FF804BA23D4", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776736864; cv=none;\n b=W9qRdz44QIYbHYCvnGSYYjXnbjCmCjr5F2+YhTgVWiubr8hCpjt5lcjQmr8ZCH7LsJOvLd1L+00mcXKhUXK02v2yw+39uAnvg1XeALZRqprihgrnOlYOHQZfyMhWpVXjATXXF2P/cJ9mm+7lcEBopPwuDrf2MK6D8usO7eKlIIg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776736864; c=relaxed/simple;\n bh=7FgnpIvycuQcw6go27J5LLdQ+7HR7VnPzEPv8+pTBnw=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=c+enxB/gwvnG+CbuC3YhLmmohhKH6uUd0qyTfGDJBSsA7VSkLicxmWhp8rgkOKGW7SV+nfUrZq5md3E9FcvLfg1+zJslMZnu+aUh139jun7eXrq8lF3zrdrq12h5ii7THNY/DbP2dhab/l4kcUJNs42QTf/l186Kr27IZiLcm9c=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776736863; x=1777341663; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=lK22rNbAogu4tswgvAy2immAnArjunbXTWtfkrVNSkM=;\n b=AS1R5+zdRKIeAyfpRzNG2rtOSYuP7WhKCGzb3i0YtDq9AgRsLzznxnJiS0VoKAJJ3V\n ARDDnCFaUVBNo1r9KMsRqE3h2/1Y4w5gKfByvkw2QdImFQHvWQabii+z1MD9PcTeKU32\n j3NGdhPxK3F7X5KAw0/SAFblcRJHVEeQAzNRVN7cpEScax5impa+FSvklBEuakWJPhyz\n jhEH/3CxvfNcyTam8WWJvK65qe8W9qG7PDm83H+SVNctf6kTrTiXtsPAQo4NuXLKPmTx\n 80g/7fyOxCAD90WbVa2c/Moy2mN7NsmKZyeN3LKxd5DgIyAJJVVMzOu1TqKAgU3qhtOh\n e7/w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776736863; x=1777341663;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=lK22rNbAogu4tswgvAy2immAnArjunbXTWtfkrVNSkM=;\n b=FCIXRIZKqzy69WtkeG5l4LvS9Ro6XfvJkaTUqSEtIFtj1hCJxmXdfemwS73BCGKKgD\n D/14nVW4oOON7d9L9nnwvtPuzGDU1uGryqkpWLT94METL4Nb1Mqp9iiXG6CTrU9tFUKx\n 2SWzSNXiGLBwUUFj2PN36b8TquZa5465VrjQ9epkCSi3Xu528ORtxv7UZbg7QYqWm+Mj\n P+ss5PAcNB6i5cd3yyU9Y6pAZxkCic5ICBZOBDLUKYB+nDa2cSBVmoqloap3lbboWrzp\n BqrQ8dibSfg2+Ir9+RHSIwVam5MymbP4EIg5+zkLgR3YdNgkSMw/ibn/TOddxTiZ+qQG\n PZsw==", "X-Gm-Message-State": "AOJu0YzHQyTmOXIpqQKULHIopbfpy/G/QBX4XuoCrsomSUaTXxwf9N/V\n z3Bmtm6wVMkPodHGziOv7zMzp+Xj/nQN3TxBA4yuN4dg3mBNduupaltTgU7hDQ==", "X-Gm-Gg": "AeBDietU/T0cb9O75xiD9xcyxHMiWxteFLoUe/benmg7lE5K73g3fH4oMKwQN5pXiiR\n qwZNqHrwwEaWQhv24rF0NxCawXNV6cE0ZXwVQexHhRavTk74QWexwF7pm2FML/I1cTRjfpdR65A\n Y82KHTfNd5FLPz+CuIhppvJeOtRJI23zm1W5C2SHtScbQYWYaMXLAgA+ot18TMeXXH06aEKxKFX\n UJS0esrpVEINL6HfH1IENAXFhJhYPT8QQZBKyymzlhcMZ97BoMwiRGKG/1nI8FWDKYy2gObdW42\n sCMog90VHKHXJrbM6FSyaTCGTtiMg3GXZr9h0WBR1Yjb5MJWu/rdqlM7zOqUhCLJFCc7j+qx6mK\n cnI6c6MrnJAOv4SmtL7u7ksq+96s9N+yD/9f2h1ZjdY5pIfTDDzCENYT45yWiLGe1I3R18hopB6\n 8hlgtRKoWy7bIjsnk=", "X-Received": "by 2002:a05:600c:5946:b0:486:fcc7:6811 with SMTP id\n 5b1f17b1804b1-488fb8af4b0mr174648625e9.10.1776736863196;\n Mon, 20 Apr 2026 19:01:03 -0700 (PDT)", "From": "Gaius Mulley <gaiusmod2@gmail.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Gaius Mulley <gaiusmod2@gmail.com>", "Subject": "[pushed]PR modula2/120189 Bugfix to documentation and fix prototypes\n in m2rts.h", "Date": "Tue, 21 Apr 2026 03:00:55 +0100", "Message-ID": "<20260421020056.1516544-1-gaiusmod2@gmail.com>", "X-Mailer": "git-send-email 2.47.3", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "This patch rewrites the Building a shared library section in the\ngm2.texi. The new content addresses the default dynamic module\nscaffold and also provides an example of C++ calling the m2 shared\nlibrary. Bootstrapped using lto on amd64.\n\ngcc/ChangeLog:\n\n\tPR modula2/120189\n\t* doc/gm2.texi (Building a shared library): Rewrite.\n\nlibgm2/ChangeLog:\n\n\tPR modula2/120189\n\t* libm2iso/m2rts.h (m2iso_M2RTS_RequestDependant): Correct\n\tparameters.\n\t(m2iso_M2RTS_ConstructModules): Ditto.\n\t(m2iso_M2RTS_DeconstructModules): Ditto.\n\nSigned-off-by: Gaius Mulley <gaiusmod2@gmail.com>\n---\n gcc/doc/gm2.texi | 113 ++++++++++++++++++++++++++++++++++------\n libgm2/libm2iso/m2rts.h | 8 ++-\n 2 files changed, 104 insertions(+), 17 deletions(-)", "diff": "diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi\nindex 53d96b5a00a..74bd858abf6 100644\n--- a/gcc/doc/gm2.texi\n+++ b/gcc/doc/gm2.texi\n@@ -2304,8 +2304,8 @@ intersect.\n \n This section describes building a tiny shared library implemented in\n Modula-2 and built with @file{libtool}. Suppose a project consists of\n-two definition modules and two implementation modules and a program\n-module @file{a.def}, @file{a.mod}, @file{b.def}, @file{b.mod} and\n+three definition modules and three implementation modules\n+@file{a.def}, @file{a.mod}, @file{b.def}, @file{b.mod} and\n @file{c.mod}. The first step is to compile the modules using position\n independent code. This can be achieved by the following three\n commands:\n@@ -2316,27 +2316,110 @@ libtool --tag=CC --mode=compile gm2 -g -c b.mod -o b.lo\n libtool --tag=CC --mode=compile gm2 -g -c c.mod -o c.lo\n @end example\n \n-The second step is to generate the shared library initialization and\n-finalization routines. We can do this by asking gm2 to generate a\n-list of dependent modules and then use this to generate the scaffold.\n-We also must compile the scaffold.\n+The second step is to link these objects into a shared library.\n \n @example\n-gm2 -c -g -fmakelist c.mod\n-gm2 -c -g -fmakeinit -fshared c.mod\n-libtool --tag=CC --mode=compile g++ -g -c c_m2.cpp -o c_m2.lo\n+export LIBDIR=$(gm2 -print-file-name=)../../../../lib64\n+\n+libtool --tag=CC --mode=link gcc -g a.lo b.lo c.lo \\\n+ -L$@{LIBDIR@} -rpath `pwd` -lm2pim -lm2iso -lstdc++ \\\n+ -lm -o libabc.la\n @end example\n \n-The third step is to link all these @file{.lo} files.\n+At this point the shared library @file{libabc.so} will have been\n+created inside the directory @file{.libs}.\n+\n+This library can be called from C using the following technique.\n+The define @code{INIT_ORDER} should not be changed as it defines the\n+initialization order of the core base modules.\n+The define @code{USER_LIB} is the name of the library dialect and\n+maybe changed if required.\n \n @example\n-libtool --mode=link gcc -g c_m2.lo a.lo b.lo c.lo \\\n- -L$(prefix)/lib64 \\\n- -rpath `pwd` -lgm2 -lstdc++ -lm -o libabc.la\n+#include <stdio.h>\n+#include <m2rts.h>\n+\n+#define INIT_ORDER \"m2iso:RTentity,m2iso:Storage,\" \\\n+ \"m2iso:SYSTEM,m2iso:M2RTS,\" \\\n+ \"m2iso:RTExceptions,m2iso:IOLink\"\n+\n+#define USER_LIB NULL\n+\n+/* Add the runtime dependency for this file on modules a, b and c. */\n+\n+void\n+dep (void)\n+@{\n+ m2iso_M2RTS_RequestDependant (__FILE__, USER_LIB, \"c\", USER_LIB);\n+ m2iso_M2RTS_RequestDependant (__FILE__, USER_LIB, \"b\", USER_LIB);\n+ m2iso_M2RTS_RequestDependant (__FILE__, USER_LIB, \"a\", USER_LIB);\n+@}\n+\n+void\n+init (int, char *[], char *[])\n+@{\n+ printf (\"test.c:init\\n\");\n+@}\n+\n+void\n+fini (int, char *[], char *[])\n+@{\n+ printf (\"test.c:fini\\n\");\n+@}\n+\n+void\n+construct_scaffold (int argc, char *argv[], char *envp[])\n+@{\n+ m2iso_M2RTS_RegisterModule (__FILE__, USER_LIB,\n+ init, fini, dep);\n+ m2iso_M2RTS_ConstructModules (__FILE__, USER_LIB,\n+ INIT_ORDER, argc, argv, envp);\n+@}\n+\n+void\n+deconstruct_scaffold (int argc, char *argv[], char *envp[])\n+@{\n+ m2iso_M2RTS_DeconstructModules (__FILE__, USER_LIB,\n+ argc, argv, envp);\n+@}\n+\n+int\n+main (int argc, char *argv[], char *envp[])\n+@{\n+ printf (\"main starts\\n\");\n+ construct_scaffold (argc, argv, envp);\n+ printf (\"main application goes here\\n\");\n+ deconstruct_scaffold (argc, argv, envp);\n+ printf (\"main tidying up\\n\");\n+ return 0;\n+@}\n @end example\n \n-At this point the shared library @file{libabc.so} will have been\n-created inside the directory @file{.libs}.\n+This source file can be compiled and linked using the following\n+command:\n+\n+@example\n+export INCLUDE=$(gm2 -print-file-name=)/m2/m2iso\n+g++ -I$@{INCLUDE@} -g test.c -L. -l:.libs/libabc.so -L$@{LIBDIR@} -lm2iso\n+@end example\n+\n+and finally run using:\n+\n+@example\n+LD_LIBRARY_PATH=.libs:$@{LIBDIR@} ./a.out\n+\n+main starts\n+init: module a\n+init: module b\n+init: module c\n+test.c:init\n+main application goes here\n+test.c:fini\n+finish: module c\n+finish: module b\n+finish: module a\n+main tidying up\n+@end example\n \n @node Interface for Python, Producing a Python module, Building a shared library, Using\n @section How to produce swig interface files\ndiff --git a/libgm2/libm2iso/m2rts.h b/libgm2/libm2iso/m2rts.h\nindex 481df9be685..fbeae51b7ae 100644\n--- a/libgm2/libm2iso/m2rts.h\n+++ b/libgm2/libm2iso/m2rts.h\n@@ -30,7 +30,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n typedef void (*proc_con) (int, char **, char **);\n typedef void (*proc_dep) (void);\n \n-extern \"C\" void m2iso_M2RTS_RequestDependant (const char *modulename, const char *libname, const char *dependancy);\n+extern \"C\" void m2iso_M2RTS_RequestDependant (const char *modulename, const char *libname,\n+\t\t\t\t\t const char *dependantmodule,\n+\t\t\t\t\t const char *dependantlibname);\n extern \"C\" void m2iso_M2RTS_RegisterModule (const char *modulename, const char *libname,\n \t\t\t\t\t proc_con init, proc_con fini, proc_dep dependencies);\n extern \"C\" void m2pim_M2RTS_RegisterModule (const char *modulename, const char *libname,\n@@ -40,9 +42,11 @@ extern \"C\" void M2RTS_RegisterModule (const char *modulename, const char *libnam\n extern \"C\" void m2iso_M2_M2RTS_init (void);\n \n extern \"C\" void m2iso_M2RTS_ConstructModules (const char *modulename, const char *libname,\n+\t\t\t\t\t const char *overrideliborder,\n \t\t\t\t\t int argc, char *argv[], char *envp[]);\n extern \"C\" void m2iso_M2RTS_Terminate (void);\n-extern \"C\" void m2iso_M2RTS_DeconstructModules (void);\n+extern \"C\" void m2iso_M2RTS_DeconstructModules (const char *modulename, const char *libname,\n+\t\t\t\t\t\tint argc, char *argv[], char *envp[]);\n \n extern \"C\" void m2iso_M2RTS_HaltC (const char *desc, const char *filename,\n \t\t\t\t const char *functionname, int line) __attribute__ ((noreturn));\n", "prefixes": [ "pushed" ] }