From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-4.sys.kth.se (smtp-4.sys.kth.se [IPv6:2001:6b0:1:1300:250:56ff:fea6:2de3]) by sourceware.org (Postfix) with ESMTPS id 943DC385802D; Sun, 8 Aug 2021 15:07:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 943DC385802D Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id A6EE32842; Sun, 8 Aug 2021 17:07:38 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Gpv_z2bvhKky; Sun, 8 Aug 2021 17:07:38 +0200 (CEST) Received: from exdb6.ug.kth.se (exdb6.ug.kth.se [192.168.32.61]) by smtp-4.sys.kth.se (Postfix) with ESMTPS id E5EE12782; Sun, 8 Aug 2021 17:07:37 +0200 (CEST) Received: from exdb6.ug.kth.se (192.168.32.61) by exdb6.ug.kth.se (192.168.32.61) 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:07:37 +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:07:37 +0200 From: Petter Tomner To: "jit@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" Subject: [PATCH 0/3] jit: Add support for weak linkage Thread-Topic: [PATCH 0/3] jit: Add support for weak linkage Thread-Index: AQHXjGUW+1AXCEIET0qDrZSx7PlGOA== Date: Sun, 8 Aug 2021 15:07:37 +0000 Message-ID: <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=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS 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:07:44 -0000 Hi, To implement generics/C++ template-ish with libgccjit it would be very usef= ul to have the possibility to declare functions and variables with weak lin= kage, to be able to have independent AOT compilation of object files withou= t needing to keep track of what is "instantiated" where to prevent collisio= ns. I implemented this by giving 'gcc_jit_context_new_function()' and 'gcc_jit= _context_new_global()' one new enum value EXPORTED_WEAK each that specifies= an exported symbol with weak linkage. The variable or function is accessib= le from a 'result' as would it be EXPORTED. I split the code up for it to be easier to read: Patch 1 is the implementation. Patch 2 is a test case. Patch 3 is documentation updates. I ran 'make check-jit' successfully on a x64-pc-gnu linux. I didn't make an= y ABI tag and the docs need regeneration in path 3. Regards, Petter Tomner