Fix wrong binary fields on big endian

Sync with https://github.com/systemd/package-notes/pull/31

On big endian machines we need to swap the first three fields, which
are binary and thus need to match endianess.
Just use LONG() instead of BYTE sequences.
This commit is contained in:
Luca Boccassi 2022-03-26 17:47:31 +00:00
parent d26d18e6f4
commit 58ec8a67f5

View File

@ -35,11 +35,13 @@ write_script() {
printf 'SECTIONS\n{\n'
printf ' .note.package %s: ALIGN(4) {\n' "$readonly_attr"
printf ' BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Owner including NUL */\n'
printf ' BYTE(0x%02x) BYTE(0x%02x) BYTE(0x00) BYTE(0x00) /* Length of Value including NUL */\n' \
$((value_len % 256)) $((value_len / 256))
# Note that for the binary fields we use the native 4 bytes type, to avoid
# endianness issues.
printf ' LONG(0x0004) /* Length of Owner including NUL */\n'
printf ' LONG(0x%04x) /* Length of Value including NUL */\n' \
${value_len}
printf ' LONG(0xcafe1a7e) /* Note ID */\n'
printf ' BYTE(0x7e) BYTE(0x1a) BYTE(0xfe) BYTE(0xca) /* Note ID */\n'
printf " BYTE(0x46) BYTE(0x44) BYTE(0x4f) BYTE(0x00) /* Owner: 'FDO' */\n"
write_string "$1" ' ' 'Value' "$value_len"