llvm19 lld issue
- Reply: Dimitry Andric : "Re: llvm19 lld issue"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Nov 2024 12:44:38 UTC
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