]> git.baikalelectronics.ru Git - kernel.git/commit
arch: fix broken BuildID for arm64 and riscv
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 26 Dec 2022 18:45:37 +0000 (03:45 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Feb 2023 10:25:42 +0000 (11:25 +0100)
commitab91eb0090d377947106e58b75bfc920401ed239
tree341a3632062575180db26d85cec8c5677db487f7
parent6d9b32c5645e01e5b49f74dda0de686ee50f770f
arch: fix broken BuildID for arm64 and riscv

commit fe15ce495a511c71ffb78121ce0b6d8ca33dc5fd upstream.

Dennis Gilmore reports that the BuildID is missing in the arm64 vmlinux
since commit 47547576d4c3 ("arm64: remove special treatment for the
link order of head.o").

The issue is that the type of .notes section, which contains the BuildID,
changed from NOTES to PROGBITS.

Ard Biesheuvel figured out that whichever object gets linked first gets
to decide the type of a section. The PROGBITS type is the result of the
compiler emitting .note.GNU-stack as PROGBITS rather than NOTE.

While Ard provided a fix for arm64, I want to fix this globally because
the same issue is happening on riscv since commit 72506fddc7f8 ("riscv:
remove special treatment for the link order of head.o"). This problem
will happen in general for other architectures if they start to drop
unneeded entries from scripts/head-object-list.txt.

Discard .note.GNU-stack in include/asm-generic/vmlinux.lds.h.

Link: https://lore.kernel.org/lkml/CAABkxwuQoz1CTbyb57n0ZX65eSYiTonFCU8-LCQc=74D=xE=rA@mail.gmail.com/
Fixes: 47547576d4c3 ("arm64: remove special treatment for the link order of head.o")
Fixes: 72506fddc7f8 ("riscv: remove special treatment for the link order of head.o")
Reported-by: Dennis Gilmore <dennis@ausil.us>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Tom Saeger <tom.saeger@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/asm-generic/vmlinux.lds.h