[llvm-dev] [lld] avoid emitting PLT entries for ifuncs

Ed Maste via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 22 07:11:00 PDT 2018


On 22 August 2018 at 04:27, Rui Ueyama via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> However, if you pass the -emit-relocs option to the linker, lld keeps all
> relocations that have already been resolved in an output executable. By
> analyzing a relocation table in a resulting executable, you could find all
> locations where the ifunc PLT is called. Then, you can construct a new table
> for your linker, embed it to the executable using objcopy or something like
> that, and then let the kernel loader interpret it.
>
> Have you considered that?

I've thought about alternative ways to achieve the same thing,
including something like the above. My concern with that approach is
that it's rather cumbersome and can be error-prone, and introduces a
requirement for awkward multi-stage linking. In comparison Mark's
patch is a relatively tiny tweak in lld.

Despite the disadvantages I much prefer the proposed approach.

On 22 August 2018 at 09:20, Joerg Sonnenberger via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> On the linker side, it is a custom hack for
> something that is generally considered very bad nowadays: text
> relocations.

True, although the argument against .text relocations doesn't hold for
our kernel use case.


More information about the llvm-dev mailing list