Date: Thu, 14 Nov 2024 13:44:38 +0100 From: Michal Meloun <mmel@FreeBSD.org> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: llvm19 lld issue Message-ID: <192a3da4-6765-401a-a669-0359f8ac9487@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
While searching for the cause of armv7 kernel corruption after updating to llvm19 lld, I came across an interesting problem. - The linker script does not list all generated sections. Specifically, the data sections created by the linker set are not listed. - The linker can place these orphaned sections in any location (OK, with some restrictions). See https://maskray.me/blog/2024-06-02-understanding-orphan-sections. - Creating symbols outside a section is fragile and subject to error; the linker may place an orphaned section between the symbol definition and the following section. We ran into this problem many years ago, see https://github.com/freebsd/freebsd-src/commit/6e764e36da019837d90e3b4b712871ee4442637a. Unfortunately, we didn't fix it completely then, and we have to address the same corruption again. I think we should be strict in this area and use '--orphan-handling=error' for kernel linking. However, I'm not sure we can handle linker sets gracefully. Any comments, contrary opinion or better solution ? Does anyone know how to properly list all linker sets (mainly but not only 'set_<foo>_set') in linker script and which section is appropriate for them ? .rodata? Thanks, Michal
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?192a3da4-6765-401a-a669-0359f8ac9487>