From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id EEC4D3856087 for ; Thu, 26 May 2022 03:55:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEC4D3856087 Received: by mail-pg1-x52c.google.com with SMTP id a9so321106pgv.12 for ; Wed, 25 May 2022 20:55:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ls9oEEzAmgFUi/bdPtQy6Bo0u5XpQIZVT1Xy4xsv87M=; b=imLMOtsmZVihhMNDMZ2W5XbKedGiJcK2Lj6mEQiGR66QxDZi9BEf2qI1uKUfYx33ra r/lEeSS87u7mnYIpcKGqZ75nBKmk7d5BdZGqUC9MU6mlSoGBBVyFide73RpgAwCLlV6E 2gK4hwRGzN9dbcn0fI3sFppi4OWEpseEf6YBhP1LWtSjXvd9Zp5As/LVSAVYUrhRUtQ1 +/cbctvNH13UeqdC+/2j9tl8P8+Ln+/GVx00FrX5PraPO0EpQXZdC5TkrINSNAM+/hKp nVggJ3ICkBLIFOXZJDf2w2y0BUtrJ2ls59Wit71IsFy8o4G/r0mQ+SVxpYb69XazzAi2 96VQ== X-Gm-Message-State: AOAM532TxDkRb4TP4te0oVTKLW1UaKzrYgOilOuPBX1CdKFQuSUwFVPc qyQhJXwmRbWlvBej42flO0s= X-Google-Smtp-Source: ABdhPJyObR1tzzfTpYxPwpXeWN5493kdu9b4WNFmke4Ew4JUy88AcP+HRUtUpW4aKBJKx/j5wqhErA== X-Received: by 2002:a05:6a00:1ac9:b0:518:a48a:d8f6 with SMTP id f9-20020a056a001ac900b00518a48ad8f6mr17866873pfv.16.1653537322838; Wed, 25 May 2022 20:55:22 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id d10-20020aa797aa000000b0051826824d90sm188875pfq.177.2022.05.25.20.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 20:55:22 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id C45E01140248; Thu, 26 May 2022 13:25:19 +0930 (ACST) Date: Thu, 26 May 2022 13:25:19 +0930 From: Alan Modra To: luca.boccassi@gmail.com Cc: binutils@sourceware.org, nickc@redhat.com Subject: Re: [PATCH v3] ld: add --package-metadata Message-ID: References: <20220515191846.114257-1-luca.boccassi@gmail.com> <20220525134147.2470281-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220525134147.2470281-1-luca.boccassi@gmail.com> X-Spam-Status: No, score=-3031.2 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2022 03:55:25 -0000 On Wed, May 25, 2022 at 02:41:47PM +0100, luca.boccassi@gmail.com wrote: > From: Luca Boccassi > > Generate a .note.package FDO package metadata ELF note, following > the spec: https://systemd.io/ELF_PACKAGE_METADATA/ > > If the jansson library is available at build time (and it is explicitly > enabled), link ld to it, and use it to validate that the input is > correct JSON, to avoid writing garbage to the file. The > configure option --enable-jansson has to be used to explicitly enable > it (error out when not found). This allows bootstrappers (or others who > are not interested) to seamlessly skip it without issues. > --- > v2: fix style issues > fix ASAN issue: note storage is rounded up, but that size > was used to read the json input, which is fixed > add entry to NEWS > add note about json validation to docs > v3: switch libjansson support to disabled-by-default even if > the library is available in the build environment > update new test to account for old/new readelf, which > might or might not pretty-print the FDO note > update bootstrap test to link with jansson if the object > files being linked were built with it > remove dead code I'm about to commit this with a few formatting fixes, and with a working bootstrap.exp change. That one was obviously not tested. The idea was good but ld config.h is not in $srcdir/.., and besides that it's on the build machine not the host (*), and plain grep is more likely to exist than fgrep. *) build vs host doesn't matter much in bootstrap.exp since those tests are only run when native, but I'd like to get it correct for someone doing copy/paste for a future config.h test. -- Alan Modra Australia Development Lab, IBM