From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20804 invoked from network); 30 Jan 2021 21:00:10 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 30 Jan 2021 21:00:10 -0000 Received: (qmail 3172 invoked by uid 550); 30 Jan 2021 21:00:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3142 invoked from network); 30 Jan 2021 21:00:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuriev-ru.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DfEx0YYOwtzZAs5sqKWGABTCXbWa69RAoEMofzilJcE=; b=muyBNiHIyqdpHdPtwZto/yJWn5hF+OG2sQ6dX7+54oEItsncWJrdV3I3162bAyjqxX 90Om/nqECkS6/+wt4gLQErwtDhq/uiCACrB/RAphQXVcJAOM6OQb7yig/eluTwdwoaP7 5W8looSA89navf6+HTaUkAhOywc2ebqYjTa5YgY7Pb9gE77nod5Oaej2/kI670vmikbh c6j979R+wVbdzbDoFarlxeKCIXeLh/Otdy9RaZzy5JXfVzHLfDXzuRVxvaKZyJGYY9ow LmJNyTANZqt2g8vbex65+KhUUt3Esg+PSDnPNs9n+yXLE3ZyVmhZxmKFNLanbJMEOuuZ +y5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DfEx0YYOwtzZAs5sqKWGABTCXbWa69RAoEMofzilJcE=; b=PwafSol7NFFVXZkCGoF0Kgi+P9WSbOz4Q6vf4EdUqYDQdR/ntD+Ly+rxRq5fTOtxDh /qFeQD+p2Zvz9iFhNu1KQpuwxIFK9T1zNYYnbVE17evK+GZtouMRm7AHGNHuZzV2TDb3 sDxgg7HiwUkyftTr6L0PBN6ADAM4kNxf3i/9S3TSWKMTXtn8wO16J9emZxZzqDCeZX4p zkdR3NPchCD8tesVVQjEqENv1BErAuraKwQTD3BQJCn3CLfZ8aKe4LV/mE23nR0SUFSE Rt4Uv8rfkMcWblTpFLhKs0eHX1dDp1Vxjm1WvQYTC/hVKy/221pznfzERO3yfyuzJFab fh+Q== X-Gm-Message-State: AOAM533unUDj2iepd/bVYGa6IjLTU2J8vMQWi5L4hKtd3pgruMmiojWQ EaZu/z7mN/8UpVuB/0XLvM+sSYZL1Hz1uDUDI3hOv06xr1FFcg== X-Google-Smtp-Source: ABdhPJw7nzpds2cPWafccnJZvEj+TaWMvaZf6flfnhElbwn5RsbnJB2UHwvGnbYMyLhUrNqIQq9Sbv2ibol6ub2RJVk= X-Received: by 2002:a05:6e02:1311:: with SMTP id g17mr7561156ilr.47.1612040390123; Sat, 30 Jan 2021 12:59:50 -0800 (PST) MIME-Version: 1.0 References: <20210130201227.GP23432@brightrain.aerifal.cx> In-Reply-To: <20210130201227.GP23432@brightrain.aerifal.cx> From: =?UTF-8?B?0JvQtdC+0L3QuNC0INCu0YDRjNC10LIgKExlb25pZCBZdXJpZXYp?= Date: Sat, 30 Jan 2021 23:59:14 +0300 Message-ID: To: musl@lists.openwall.com Cc: Jiahao XU Content-Type: text/plain; charset="UTF-8" Subject: =?UTF-8?Q?Re=3A_=5Bmusl=5D_Can=E2=80=99t_build_musl_with_lto=3Dthin?= I have some experience in solving problems with LTO, including for embedded projects. Therefore, perhaps my thoughts and advice will be useful. In general, LTO almost always requires a little refinement of source code but problems arise only with really dirty code or due to ill-conceived modularity. For instance, the ODR must not be violated. On Sat, Jan 30, 2021 at 11:12 PM Rich Felker wrote: > The -fmerge-all-constants option gives non-conforming language > semantics and should not be used, but that's a separate issue. There are no problems with constants, unless it's addresses are used to distinguish ones (and even more so to change). But this is easily workarounded by placing such constants inside an instance of a single static structure, etc. > Otherwise, it's a known issue that LTO misses references from asm > (both top-level and in functions). I think dlstart.lo and a few other > files should just be built with LTO disabled; any LTO-type > optimization in code that runs at this stage is inherently invalid, > anyway. So something like (in config.mak): This is easily workarounded by adding __attribute__((__used__)) or __attribute__((__externally_visible__)) to the function/variable definition, but requires binutils version >= 2.36. Regards, Leonid.