From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by sourceware.org (Postfix) with ESMTPS id 847F03858C50 for ; Tue, 12 Jul 2022 13:22:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 847F03858C50 Received: by mail-qk1-x72b.google.com with SMTP id v6so6186577qkh.2 for ; Tue, 12 Jul 2022 06:22:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FIb1k8zi3YiTkAmbgtePwanl9I/hVUjoDH7K+PmL18g=; b=L2uJkcEua9JNMXulBH8f2XXBer91K/W42B75q9mYCFgpqdKAqP0tUSmBgKBPjvc296 vRXu9tQYNEOlHrK56+eShqTmqDnU4pEHcHwT5IUwo/9ocihypeQM6EdKuoYIlKF3EyB9 5HG8o7ajusMEEFcqSapOtS/kNb8/XyhW4accP1c0NZ+ffxRJ3GFHx9UkMKAU4GJUoyls rex6TYZ2v4UvDo9EMJSCIOHvTHWbXJgLhblRWt2v17zr2XRveUoeXYNOUI+NhnAcEB1a 2oMY5h6rcCFsJGbefDOhKuJ3+IGVEHT3MLTfl+L5QzBgSaV/O+CLyY/wsebDZ1nUcI+l bggQ== X-Gm-Message-State: AJIora+CVjx1J1lKkcrC3KetA3u2VNL15I7vidyaDBLZugCMcDlLE+Gk dYPM/GiVzku8V3d/ov5UOV2au/E2ixLtO1jqOYI= X-Google-Smtp-Source: AGRyM1uaqpHJy7Jy2DA41FcsEXoSWUPd3JSLVjAQkKkcbVFlphUEws8tavrsXE+Ane6Vmc53mYvhFhGs02eu7YKL3qA= X-Received: by 2002:a05:620a:190f:b0:6b5:9bf7:60d with SMTP id bj15-20020a05620a190f00b006b59bf7060dmr3746848qkb.627.1657632129504; Tue, 12 Jul 2022 06:22:09 -0700 (PDT) MIME-Version: 1.0 References: <803a0290-3909-b9c5-2461-b1740a00c63a@suse.cz> <37b52d36-d1dd-f291-0baa-0cf670493692@suse.cz> <4e3df681-9523-4781-d324-9a6e230f495a@suse.cz> <3dc13790-a22d-c4d6-6cfe-ab9b567968ff@suse.cz> <862b4381-c377-ac7a-476c-e7ced3c29c2c@ispras.ru> <3bde5aa4-f3d7-63e8-8b4f-29b29f00293f@suse.cz> <41751c29-5b9b-671d-de47-e1c13ea78b7@ispras.ru> <461c4c4f-57f1-e689-f41d-fb4f68d638c8@suse.cz> In-Reply-To: From: Richard Biener Date: Tue, 12 Jul 2022 15:21:58 +0200 Message-ID: Subject: Re: [PATCH 3/3] lto-plugin: implement LDPT_GET_API_VERSION To: Rui Ueyama Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , Alexander Monakov , GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Tue, 12 Jul 2022 13:22:12 -0000 On Tue, Jul 12, 2022 at 1:50 PM Rui Ueyama wrote: > > I'm fine, though I don't think I have a right to sign off. > > On Tue, Jul 12, 2022 at 3:36 PM Martin Li=C5=A1ka wrote: > > > > On 7/12/22 08:28, Richard Biener wrote: > > > On Mon, Jul 11, 2022 at 6:35 PM Alexander Monakov wrote: > > >> > > >> On Mon, 11 Jul 2022, Martin Li=C5=A1ka wrote: > > >> > > >>> I've clarified that linker should return a value that is in range > > >>> [minimal_api_supported, maximal_api_supported] and added an abort > > >>> if it's not the case. > > >> > > >> I noticed that we are placing a trap for C++ consumers such as mold > > >> by passing min/max_api_supported as enum values. Unlike C, C++ disal= lows > > >> out-of-range enum values, so when mold does > > >> > > >> enum PluginLinkerAPIVersion { > > >> LAPI_V0 =3D 0, > > >> LAPI_V1, > > >> }; > > >> > > >> get_api_version(const char *plugin_identifier, > > >> unsigned plugin_version, > > >> PluginLinkerAPIVersion minimal_api_supported, > > >> PluginLinkerAPIVersion maximal_api_supported, > > >> const char **linker_identifier, > > >> const char **linker_version) { > > >> > > >> checks such as 'min_api_supported > LAPI_V1' can be optimized out. A= lso, > > >> if a future tool passes LAPI_V2, it will trigger Clang's UBSan (GCC > > >> -fsanitize-undefined=3Denum instruments loads but not retrieval of f= unction > > >> arguments). > > >> > > >> I'd suggest to fix this on both sides by changing the arguments to p= lain > > >> integer types. > > > > > > That's a good point - the enum itself is then also somewhat redundant > > > if it just specifies symbolic names for 0, 1, ... but we can keep it = for > > > documentation purposes. > > > > All right, here we go with the integer types. > > > > May I install the version now? OK. Thanks, Richard. > > Thanks, > > Martin > > > > > > > >> > > >> Alexander