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

Moshtaghi, Alireza via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 28 15:19:54 PDT 2021


It is not easy to produce an minimal example. But I will try
I was hoping that you may have solved it before.
I will come back with an example

Thanks
A

From: Fāng-ruì Sòng <maskray at google.com>
Date: Wednesday, April 28, 2021 at 3:11 PM
To: Moshtaghi, Alireza <Alireza.Moshtaghi at netapp.com>
Cc: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] lld suspect behavior .group/rela/text input sections
NetApp Security WARNING: This is an external email. Do not click links or open attachments unless you recognize the sender and know the content is safe.




On Wed, Apr 28, 2021 at 11:02 AM Moshtaghi, Alireza via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> 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.

Hi, do you have a minimal reproducible example
(https://stackoverflow.com/help/minimal-reproducible-example)?

Freebsd is not build-friendly when the user is not using FreeBSD ;-)

>
>
> 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/fcabcb51/attachment.html>


More information about the llvm-dev mailing list