[llvm-dev] lld suspect behavior .group/rela/text input sections

Moshtaghi, Alireza via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 28 11:01:50 PDT 2021


Hi
Can you help me to understand if I’m doing anything wrong or the problem is with lld?
I need to use linker-script (below link) for linking freebsd kernel modules and pass -r to ld.lld (version 10) to make these modules relocatable.

Some of the modules that I build are very big and also have .group sections on rela.text.<mangledname> and .text.<mangledname>

Per ELF specification these sections should be treated as one and either all merged or none. But I think lld is not respecting that spec and merges all .text.<mangledname> sections while leaving the .group and .rela.text.<mangledname> sections in the output, which results in broken elf (when I try to load it into gdb, I get Bad Value error)

Alternatively, when I link with ld.bfd, the .text.<manglenames> remain in the output and I’m able to load the object into gdb without error.

Linker-script:
https://github.com/freebsd/freebsd-src/blob/098dbd7ff7f3da9dda03802cdb2d8755f816eada/sys/conf/ldscript.amd64
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210428/e305f092/attachment-0001.html>


More information about the llvm-dev mailing list