From: Luca Boccassi Date: Thu, 16 Mar 2023 00:17:50 +0000 (+0000) Subject: doc: update ELF_PACKAGE_METADATA to use linker flag instead of manual script X-Git-Tag: v254-rc1~1003 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0b8bbbdbece50e7c58b09c633e0ebe6e47c99e7;p=thirdparty%2Fsystemd.git doc: update ELF_PACKAGE_METADATA to use linker flag instead of manual script bfd/gold/mold/lld support this flag, so document it explicitly, and drop the manually written linker script which is no longer necessary --- diff --git a/docs/ELF_PACKAGE_METADATA.md b/docs/ELF_PACKAGE_METADATA.md index fd2099f8e0a..bbc77ec85d5 100644 --- a/docs/ELF_PACKAGE_METADATA.md +++ b/docs/ELF_PACKAGE_METADATA.md @@ -82,55 +82,11 @@ these JSON objects are thus permitted to encode numeric values from these ranges as JSON numbers, and should not use numeric values not covered by these types and ranges. -A reference implementations of a [build-time tool is provided](https://github.com/systemd/package-notes) -and can be used to generate a linker script, which can then be used at build time via -```LDFLAGS="-Wl,-T,/path/to/generated/script"``` to include the note in the binary. - -Generator: -```console -$ ./generate-package-notes.py --rpm systemd-248~rc2-1.fc33.arm32 --cpe cpe:/o:fedoraproject:fedora:33 -SECTIONS -{ - .note.package (READONLY) : ALIGN(4) { - LONG(0x0004) /* Length of Owner including NUL */ - LONG(0x007b) /* Length of Value including NUL */ - LONG(0xcafe1a7e) /* Note ID */ - BYTE(0x46) BYTE(0x44) BYTE(0x4f) BYTE(0x00) /* Owner: 'FDO\x00' */ - BYTE(0x7b) BYTE(0x22) BYTE(0x74) BYTE(0x79) /* Value: '{"type":"rpm","name":"systemd","version":"248~rc2-1.fc33","architecture":"arm32","osCpe":"cpe:/o:fedoraproject:fedora:33"}\x00\x00' */ - BYTE(0x70) BYTE(0x65) BYTE(0x22) BYTE(0x3a) - BYTE(0x22) BYTE(0x72) BYTE(0x70) BYTE(0x6d) - BYTE(0x22) BYTE(0x2c) BYTE(0x22) BYTE(0x6e) - BYTE(0x61) BYTE(0x6d) BYTE(0x65) BYTE(0x22) - BYTE(0x3a) BYTE(0x22) BYTE(0x73) BYTE(0x79) - BYTE(0x73) BYTE(0x74) BYTE(0x65) BYTE(0x6d) - BYTE(0x64) BYTE(0x22) BYTE(0x2c) BYTE(0x22) - BYTE(0x76) BYTE(0x65) BYTE(0x72) BYTE(0x73) - BYTE(0x69) BYTE(0x6f) BYTE(0x6e) BYTE(0x22) - BYTE(0x3a) BYTE(0x22) BYTE(0x32) BYTE(0x34) - BYTE(0x38) BYTE(0x7e) BYTE(0x72) BYTE(0x63) - BYTE(0x32) BYTE(0x2d) BYTE(0x31) BYTE(0x2e) - BYTE(0x66) BYTE(0x63) BYTE(0x33) BYTE(0x33) - BYTE(0x22) BYTE(0x2c) BYTE(0x22) BYTE(0x61) - BYTE(0x72) BYTE(0x63) BYTE(0x68) BYTE(0x69) - BYTE(0x74) BYTE(0x65) BYTE(0x63) BYTE(0x74) - BYTE(0x75) BYTE(0x72) BYTE(0x65) BYTE(0x22) - BYTE(0x3a) BYTE(0x22) BYTE(0x61) BYTE(0x72) - BYTE(0x6d) BYTE(0x33) BYTE(0x32) BYTE(0x22) - BYTE(0x2c) BYTE(0x22) BYTE(0x6f) BYTE(0x73) - BYTE(0x43) BYTE(0x70) BYTE(0x65) BYTE(0x22) - BYTE(0x3a) BYTE(0x22) BYTE(0x63) BYTE(0x70) - BYTE(0x65) BYTE(0x3a) BYTE(0x2f) BYTE(0x6f) - BYTE(0x3a) BYTE(0x66) BYTE(0x65) BYTE(0x64) - BYTE(0x6f) BYTE(0x72) BYTE(0x61) BYTE(0x70) - BYTE(0x72) BYTE(0x6f) BYTE(0x6a) BYTE(0x65) - BYTE(0x63) BYTE(0x74) BYTE(0x3a) BYTE(0x66) - BYTE(0x65) BYTE(0x64) BYTE(0x6f) BYTE(0x72) - BYTE(0x61) BYTE(0x3a) BYTE(0x33) BYTE(0x33) - BYTE(0x22) BYTE(0x7d) BYTE(0x00) BYTE(0x00) - } -} -INSERT AFTER .note.gnu.build-id; -``` +Reference implementations of [packaging tools for .deb and .rpm](https://github.com/systemd/package-notes) +are available, and provide macros/helpers to include the note in binaries built +by the package build system. They make use of the new `--package-metadata` flag that +is available in the bfd, gold, mold and lld linkers (versions 2.39, 1.3.0 and 15.0 +respectively). This linker flag takes a JSON payload as parameter. ## Well-known keys