The package-notes functionality is currently disabled if a non-bfd linker is used (_package_note_linker). Opening this issue to track LLD support. I believe the relevant upstream lld patches for this are: * https://reviews.llvm.org/D118490 for marking .note as SHT_NOTE * https://reviews.llvm.org/D118491 for READONLY support However, MaskRay suggests that READONLY is entirely unnecessary (used to work around a bug that was fixed in the meantime) and suggests adding a way to explicitly specify the section type: https://sourceware.org/pipermail/binutils/2022-February/119600.html So it's likely that the necessary features will not be added in the form they are currently used, but will be available in a different from (that should hopefully be both in ld.bfd and lld).
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle. Changing version to 36.
The situation has changed. ld.bfd and ld.gold added --package-metadata. That approach is much cleaner than the linker scripts… But there are other usability problems (in particular unquoting in libtool makes it nearly impossible to pass json which is full of commas and quotes in a way that does not result in the json string being split into a series of bare words), but bluca managed to work around the issue by using a compiler configuration file. So right now the goal would be for lld to add --package-metadata too. I looked at the list of packages that BuildRequire lld, and it was 19 packages. This includes clang in two versions, and the kernel and probably some other packages where we would not attach the notes anyway. This number is sufficiently small that I decided to not to try to support lld for now. https://src.fedoraproject.org/rpms/package-notes/pull-request/4 conditionalizes on linker!=lld.
lld support for --package-metadata landed recently: https://github.com/llvm/llvm-project/commit/dbd04b853b680b0a383e5f58edf3643364f67bdf
LLVM 15 backport request in https://github.com/llvm/llvm-project/issues/56959. The patch looks very simple, so I think it may be preferable to create a new lld build with it, and then have package notes work uniformly for all linkers?
I've prepared a backport for lld-14 at https://src.fedoraproject.org/rpms/lld/pull-request/60.
New lld builds with --package-metadata support are done.
https://src.fedoraproject.org/rpms/package-notes/c/9f2cdc9ab43b642e714c3caca18fee0a4b9a059a?branch=rawhide enabled use of --package-metadata with lld as well, so closing this issue.