On Thu, 2022-05-26 at 13:25 +0930, Alan Modra wrote: > 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. Thanks for fixing it! I did test it, and it was working on my machine, both with and without the new build flag: Running /home/bluca/git/binutils-gdb/ld/testsuite/ld-bootstrap/bootstrap.exp ... Running /home/bluca/git/binutils-gdb/ld/testsuite/ld-bpf/bpf.exp ... I imagine this is because I was running 'make check' from the ld/ directory? I took '$srcdir' and 'fgrep' from existing scripts in other tests in ld/testsuite. Anyway, the important thing is that it's all good now. Thanks again! -- Kind regards, Luca Boccassi