Skip to content

Conversation

@jonathonpenix
Copy link

@jonathonpenix jonathonpenix commented Jan 7, 2026

I'm not an expert here/not 100% sure on the exact requirements of
LLVM_DISTRIBUTION_COMPONENTS, but this seems to work well enough in
that ld.eld and the linker wrappers (riscv-link, etc.) will be installed
as expected either through ex: install-distribution or install-ld.eld.

There's three parts here:

  • install-ld.eld and install-ld.eld-stripped needed to be valid targets--I
    think add_llvm_install_targets is the easiest (and a recommended) way
    to do this.
  • Without adding the COMPONENT ld.eld bits to the install commands,
    ld.eld and the linker wrappers weren't installed.
  • Without declaring the dependency on LW for the install targets, ld.eld
    would be installed when using ex: ninja install-ld.eld, but would
    always fail with errors about missing the LW library. Which, that
    doesn't seem great, so make sure LW is installed first if we're
    installing eld.

Poking at this code a bit, it might be possible to simplify things by
using ex: llvm_add_tool_symlink, but the code added here seems
sufficient and less intrusive, so I didn't go that route.

Fixes #693

@quic-k
Copy link
Contributor

quic-k commented Jan 7, 2026

will this patch allow me to do ninja install-ld.eld same as ninja install-clang?

@jonathonpenix
Copy link
Author

Yep!

Playing with this a bit though now that you mention it, it looks like doing just a ninja install-ld.eld doesn't also install LW which kind of breaks things (errors when running eld unless ninja install-LW is also run). Will look at that and see if that can be changed.

@quic-k
Copy link
Contributor

quic-k commented Jan 7, 2026

Yep!

great, this is useful

Playing with this a bit though now that you mention it, it looks like doing just a ninja install-ld.eld doesn't also install LW which kind of breaks things (errors when running eld unless ninja install-LW is also run). Will look at that and see if that can be changed.

probably need to add LW as ld.eld's dependency

@jonathonpenix jonathonpenix marked this pull request as ready for review January 7, 2026 23:56
@jonathonpenix
Copy link
Author

probably need to add LW as ld.eld's dependency

Yep! I think that works

I'm not an expert here/not 100% sure on the exact requirements of
LLVM_DISTRIBUTION_COMPONENTS, but this seems to work well enough in
that ld.eld and the linker wrappers (riscv-link, etc.) will be installed
as expected either through ex: install-distribution or install-ld.eld.

There's three parts here:
- install-ld.eld and install-ld.eld-stripped needed to be valid targets--I
  think `add_llvm_install_targets` is the easiest (and a recommended) way
  to do this.
- Without adding the `COMPONENT ld.eld` bits to the `install` commands,
  ld.eld and the linker wrappers weren't installed.
- Without declaring the dependency on LW for the install targets, ld.eld
  would be installed when using ex: `ninja install-ld.eld`, but would
  always fail with errors about missing the LW library. Which, that
  doesn't seem great, so make sure LW is installed first if we're
  installing eld.

Poking at this code a bit, it *might* be possible to simplify things by
using ex: `llvm_add_tool_symlink`, but the code added here seems
sufficient and less intrusive, so I didn't go that route.

Fixes qualcomm#693

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
@quic-seaswara
Copy link
Contributor

quic-seaswara commented Jan 8, 2026

The header files for linker plugin API need to be in the distribution too. How will that work ?

The header files are installed from llvm/tools/eld/include/eld

@jonathonpenix
Copy link
Author

Oh, whoops. It should just be adding the relevant install targets again (llvm projects do similar things, ex: https://github.com/llvm/llvm-project/blob/de3e9b04178cc8fca77ef6396ba604f47ffdeb6f/clang/CMakeLists.txt#L408-L414) then ex: -DLLVM_DISTRIBUTION_COMPONENTS='...;ld.eld;LW;PluginAPIHeaders'. So, I think that shouldn't be much of an issue/I'll make that change.

As a more general question though, does it make sense that these should all be installed/listed separately? Seems like LW is essentially required by eld and the plugin headers are basically always enabled as far as I can tell (the cache var is FORCE'ed to be on)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compatibility with LLVM_DISTRIBUTION_COMPONENTS

3 participants