From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-relay-3.sys.kth.se (smtp-relay-3.sys.kth.se [IPv6:2001:6b0:1:1200:250:56ff:fead:700c]) by sourceware.org (Postfix) with ESMTPS id 1BE7D3858D1E; Sat, 19 Feb 2022 15:17:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1BE7D3858D1E Received: from exdb5.ug.kth.se (exdb5.ug.kth.se [192.168.32.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-relay-3.sys.kth.se (Postfix) with ESMTPS id 4K1Bxv21MtzPNPv; Sat, 19 Feb 2022 16:17:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp-relay-3.sys.kth.se 4K1Bxv21MtzPNPv Received: from exdb6.ug.kth.se (192.168.32.61) by exdb5.ug.kth.se (192.168.32.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Sat, 19 Feb 2022 16:17:22 +0100 Received: from exdb6.ug.kth.se ([192.168.32.61]) by exdb6.ug.kth.se ([192.168.32.61]) with mapi id 15.02.0986.015; Sat, 19 Feb 2022 16:17:22 +0100 From: Petter Tomner To: "jit@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" Subject: JIT: Update docs Thread-Topic: Update docs Thread-Index: AQHYJaJo+y1sM8Nd0EC5I5iC89BsSw== Date: Sat, 19 Feb 2022 15:17:22 +0000 Message-ID: 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=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Sat, 19 Feb 2022 15:17:28 -0000 Hi! I messed up some formatting in the doc rts-files in the constructor commit. Here is a patch fixing that, adding the ABI key in compability, and also ch= anging a comment about linking not being possible, that is not true since drive op= tions were added. I built the docs to verify it looks nice. The patch only touches docs. Regards, Petter >From 450c90fce5b6c5a9522345b65a53057d3d7201b3 Mon Sep 17 00:00:00 2001 From: Petter Tomner Date: Sat, 19 Feb 2022 16:01:54 +0100 Subject: [PATCH] jit: Update docs Update docs concerning linking and fix formating errors. gcc/jit/docs/topics/ * compatibility.rst: Add 19 tag * compilation.rst: Linking * contexts.rst: Linking example * expressions.rst: Fix formating and dropped 's' Signed-off-by: 2022-02-19 Petter Tomner --- gcc/jit/docs/topics/compatibility.rst | 12 ++++++++++++ gcc/jit/docs/topics/compilation.rst | 8 ++------ gcc/jit/docs/topics/contexts.rst | 5 +++++ gcc/jit/docs/topics/expressions.rst | 15 ++++++++++----- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/gcc/jit/docs/topics/compatibility.rst b/gcc/jit/docs/topics/co= mpatibility.rst index 16cebe31a10..030e72165b7 100644 --- a/gcc/jit/docs/topics/compatibility.rst +++ b/gcc/jit/docs/topics/compatibility.rst @@ -302,3 +302,15 @@ thread-local storage model of a variable: section of a variable: =20 * :func:`gcc_jit_lvalue_set_link_section` + +.. _LIBGCCJIT_ABI_19: + +``LIBGCCJIT_ABI_19`` +----------------------- +``LIBGCCJIT_ABI_19`` covers the addition of an API entrypoint to set the l= ink +section of a variable: + + * :func:`gcc_jit_context_new_array_constructor` + * :func:`gcc_jit_context_new_struct_constructor` + * :func:`gcc_jit_context_new_union_constructor` + * :func:`gcc_jit_global_set_initializer_rvalue` diff --git a/gcc/jit/docs/topics/compilation.rst b/gcc/jit/docs/topics/comp= ilation.rst index 0f90db3b70e..9b1eed2dede 100644 --- a/gcc/jit/docs/topics/compilation.rst +++ b/gcc/jit/docs/topics/compilation.rst @@ -146,6 +146,8 @@ can also be used for implementing more traditional ahea= d-of-time compilers, via the :c:func:`gcc_jit_context_compile_to_file` API entrypoint. =20 +For linking in object files, use :c:func:`gcc_jit_context_add_driver_optio= n`. + .. function:: void \ gcc_jit_context_compile_to_file (gcc_jit_context *ctxt, \ enum gcc_jit_output_kind ou= tput_kind,\ @@ -188,12 +190,6 @@ Output kind Typica= l suffix =20 Compile the context to a dynamic library. =20 - There is currently no support for specifying other libraries to link - against. - .. c:macro:: GCC_JIT_OUTPUT_KIND_EXECUTABLE =20 Compile the context to an executable. - - There is currently no support for specifying libraries to link - against. diff --git a/gcc/jit/docs/topics/contexts.rst b/gcc/jit/docs/topics/context= s.rst index 68ab7ab1321..14ee57e2e54 100644 --- a/gcc/jit/docs/topics/contexts.rst +++ b/gcc/jit/docs/topics/contexts.rst @@ -569,6 +569,11 @@ Additional command-line options gcc_jit_context_add_driver_option (ctxt, "-lm"); gcc_jit_context_add_driver_option (ctxt, "-fuse-linker-plugin"); =20 + gcc_jit_context_add_driver_option (ctxt, "obj.o"); + + gcc_jit_context_add_driver_option (ctxt, "-L."); + gcc_jit_context_add_driver_option (ctxt, "-lwhatever"); + Note that only some options are likely to be meaningful; there is no "frontend" within libgccjit, so typically only those affecting assembler and linker are likely to be useful. diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/expr= essions.rst index 791a20398ca..9267b6d2ad6 100644 --- a/gcc/jit/docs/topics/expressions.rst +++ b/gcc/jit/docs/topics/expressions.rst @@ -152,6 +152,7 @@ Constructor expressions their presence using: =20 .. code-block:: c + #ifdef LIBGCCJIT_HAVE_CTORS =20 .. function:: gcc_jit_rvalue *\ @@ -186,6 +187,7 @@ Constructor expressions presence using: =20 .. code-block:: c + #ifdef LIBGCCJIT_HAVE_CTORS =20 .. function:: gcc_jit_rvalue *\ @@ -194,7 +196,7 @@ Constructor expressions gcc_jit_type *type,\ size_t num_values,\ gcc_jit_field **fields,\ - gcc_jit_rvalue **value) + gcc_jit_rvalue **values) =20 =20 Create a constructor for a struct as an rvalue. @@ -235,6 +237,7 @@ Constructor expressions presence using: =20 .. code-block:: c + #ifdef LIBGCCJIT_HAVE_CTORS =20 .. function:: gcc_jit_rvalue *\ @@ -265,6 +268,7 @@ Constructor expressions presence using: =20 .. code-block:: c + #ifdef LIBGCCJIT_HAVE_CTORS =20 Vector expressions @@ -803,14 +807,14 @@ Global variables #ifdef LIBGCCJIT_HAVE_gcc_jit_global_set_initializer =20 .. function:: gcc_jit_lvalue *\ - gcc_jit_global_set_initializer_rvalue (gcc_jit_lvalue *global, + gcc_jit_global_set_initializer_rvalue (gcc_jit_lvalue *global,\ gcc_jit_rvalue *init_value) =20 Set the initial value of a global with an rvalue. =20 The rvalue needs to be a constant expression, e.g. no function calls. =20 - The global can't have the ``kind`` :ref:`GCC_JIT_GLOBAL_IMPORTED`. + The global can't have the ``kind`` :c:macro:`GCC_JIT_GLOBAL_IMPORTED`. =20 As a non-comprehensive example it is OK to do the equivalent of: =20 @@ -822,8 +826,9 @@ Global variables const int baz =3D 3; /* rvalue from gcc_jit_context_rvalue_from_int= . */ int boz =3D baz; /* rvalue from gcc_jit_lvalue_as_rvalue. */ =20 - Use together with :ref:`gcc_jit_context_new_constructor` to - initialize structs, unions and arrays. + Use together with :c:func:`gcc_jit_context_new_struct_constructor`, + :c:func:`gcc_jit_context_new_union_constructor`, :c:func:`gcc_jit_conte= xt_new_array_constructor` + to initialize structs, unions and arrays. =20 On success, returns the ``global`` parameter unchanged. Otherwise, ``NU= LL``. =20 --=20 2.34.1