Description of problem: For https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects , https://github.com/systemd/package-notes/blob/main/generate-package-notes.py uses a linker script like ``` SECTIONS { .note.package (READONLY) : ALIGN(4) { BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Owner including NUL */ ... } } INSERT AFTER .note.gnu.build-id; ``` to add a note section to a linked image. This makes use of a GNU ld behavior that a `.note` section automatically gets the SHT_NOTE type. Unfortunately this goes against ELF spirits (gold and ld.lld assign SHT_PROGBITS instead of SHT_NOTE to the output section, and it'd be hard to make ld.lld accept the ".note*" == SHT_NOTE idea) In ELF, attributes are identified as well known integers. The magic section prefix ".note" is contrary to this. (See how http://www.linker-aliens.org/blogs/ali/entry/elf_section_compression/ replaced ".zdebug" with a section flag). One suggestion is to add new syntax for specifying the output section type (pending patch attached in https://sourceware.org/pipermail/binutils/2022-February/119600.html) .note.package (TYPE=SHT_NOTE) : ALIGN(4) { Since the upstream binutils 2.38 does not support TYPE=, the Fedora package may need to backport this feature. (Ideally when the output section contains an input section of a different type, ld should report a type mismatch error to prevent misuse, but I do not know how to implement this in ld ...) About `READONLY`: it appears to be unneeded since GNU ld 2.36 (https://sourceware.org/bugzilla/show_bug.cgi?id=26378#c11) and is recommended to be removed (https://sourceware.org/pipermail/binutils/2022-February/119627.html). Version-Release number of selected component (if applicable): 2.38
There is a related issue: -dT probably should not be used (https://bugzilla.redhat.com/show_bug.cgi?id=2055458).
Fixed in binutils-2.38-2.fc37