From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-3.sys.kth.se (smtp-3.sys.kth.se [IPv6:2001:6b0:1:1300:250:56ff:fea6:2de2]) by sourceware.org (Postfix) with ESMTPS id 217CA385802D; Sun, 8 Aug 2021 15:21:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 217CA385802D Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id 3A45C320B; Sun, 8 Aug 2021 17:21:58 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id FzLewX0gFFQc; Sun, 8 Aug 2021 17:21:57 +0200 (CEST) Received: from exdb3.ug.kth.se (exdb3.ug.kth.se [192.168.32.58]) by smtp-3.sys.kth.se (Postfix) with ESMTPS id 511C327E2; Sun, 8 Aug 2021 17:21:57 +0200 (CEST) Received: from exdb6.ug.kth.se (192.168.32.61) by exdb3.ug.kth.se (192.168.32.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Sun, 8 Aug 2021 17:21:56 +0200 Received: from exdb6.ug.kth.se ([192.168.32.61]) by exdb6.ug.kth.se ([192.168.32.61]) with mapi id 15.02.0858.015; Sun, 8 Aug 2021 17:21:56 +0200 From: Petter Tomner To: "gcc-patches@gcc.gnu.org" , Petter Tomner , "jit@gcc.gnu.org" Subject: [PATCH 3/3] jit: Add support for weak linkage Thread-Topic: [PATCH 3/3] jit: Add support for weak linkage Thread-Index: AQHXjGkgAIfWl9D8B0SoVuJsiEepMQ== Date: Sun, 8 Aug 2021 15:21:56 +0000 Message-ID: <52a93e6eea764dd191e56539b77ddefb@kth.se> References: <44423472d36e42f1a6e3612b704ba513@kth.se> In-Reply-To: <44423472d36e42f1a6e3612b704ba513@kth.se> Accept-Language: sv-SE, en-US Content-Language: sv-SE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.32.250] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 15:22:00 -0000 This patch updates the documentation concerning the addition of weak linkag= e for 'gcc_jit_context_new_function()' and 'gcc_jit_context_new_global()'.= The documentation needs regeneration. gcc/jit/docs/topics/ * compilation.rst * expressions.rst * functions.rst --- gcc/jit/docs/topics/compilation.rst | 3 ++- gcc/jit/docs/topics/expressions.rst | 13 +++++++++++++ gcc/jit/docs/topics/functions.rst | 20 +++++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/gcc/jit/docs/topics/compilation.rst b/gcc/jit/docs/topics/comp= ilation.rst index b6ace12120f..67c7ac5f7f3 100644 --- a/gcc/jit/docs/topics/compilation.rst +++ b/gcc/jit/docs/topics/compilation.rst @@ -57,7 +57,8 @@ In-memory compilation with a name matching `funcname` must have been created on `result`'s context (or a parent context) via a call to :func:`gcc_jit_context_new_function` with `kind` - :macro:`GCC_JIT_FUNCTION_EXPORTED`: + :macro:`GCC_JIT_FUNCTION_EXPORTED` or=20 + :macro:`GCC_JIT_FUNCTION_EXPORTED_WEAK`: =20 .. code-block:: c =20 diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/expr= essions.rst index 396259ef07e..e3a57264732 100644 --- a/gcc/jit/docs/topics/expressions.rst +++ b/gcc/jit/docs/topics/expressions.rst @@ -582,6 +582,19 @@ Global variables referring to it. Analogous to using an "extern" global from a header file. =20 + .. c:macro:: GCC_JIT_GLOBAL_EXPORTED_WEAK + + Global is defined by the client code with weak linkage and is visibl= e + by name outside of this JIT context via + :c:func:`gcc_jit_result_get_global`. Analogous to declaring a varia= ble + with ``__attribute__((weak))``. + + When compiled to file weak linkage allow multiple definitions + of the same symbol name in different files all being linked=20 + together. Note that child contexts include their parent and=20 + can't have more than one variable with the same name no matter + if weak or not. + .. function:: gcc_jit_lvalue *\ gcc_jit_global_set_initializer (gcc_jit_lvalue *global,\ const void *blob,\ diff --git a/gcc/jit/docs/topics/functions.rst b/gcc/jit/docs/topics/functi= ons.rst index b2d9239aa0a..31de2147e10 100644 --- a/gcc/jit/docs/topics/functions.rst +++ b/gcc/jit/docs/topics/functions.rst @@ -90,9 +90,8 @@ Functions Function is defined by the client code and visible by name outside of the JIT. =20 - This value is required if you want to extract machine code - for this function from a :type:`gcc_jit_result` via - :func:`gcc_jit_result_get_code`. + With this value you can extract machine code for this function + from a :type:`gcc_jit_result` via :func:`gcc_jit_result_get_code`= . =20 .. macro:: GCC_JIT_FUNCTION_INTERNAL =20 @@ -117,6 +116,21 @@ Functions above 0; when optimization is off, this is essentially the same as GCC_JIT_FUNCTION_INTERNAL. =20 + .. macro:: GCC_JIT_FUNCTION_EXPORTED_WEAK + + Function is defined by the client code with weak linkage and=20 + is visible by name outside of the JIT. Analogous to a function + with ``__attribute__((weak))``. + + When compiled to file weak linkage allow multiple definitions + of the same symbol name in different files all being linked=20 + together. Note that child contexts include their parent and=20 + can't have more than one function with the same name no matter + if weak or not. + + With this value you can extract machine code for this function + from a :type:`gcc_jit_result` via :func:`gcc_jit_result_get_code`= . + The parameter ``name`` must be non-NULL. The call takes a copy of the underlying string, so it is valid to pass in a pointer to an on-stack buffer. --=20 2.20.1