Skip to content

Create symlinks via llvm_add_tool_symlink/llvm_install_symlink#738

Merged
quic-seaswara merged 1 commit intoqualcomm:mainfrom
jonathonpenix:llvm_symlink
Feb 2, 2026
Merged

Create symlinks via llvm_add_tool_symlink/llvm_install_symlink#738
quic-seaswara merged 1 commit intoqualcomm:mainfrom
jonathonpenix:llvm_symlink

Conversation

@jonathonpenix
Copy link
Copy Markdown
Contributor

@jonathonpenix jonathonpenix commented Jan 25, 2026

eld's symlink creation currently has a few issues/quirks in how it interacts with CPack and where symlinks are placed in builds [1][2].

I think the easiest way to fix these issues is just to leverage LLVM's cmake utilities llvm_add_tool_symlink and llvm_install_symlink. Also, I think there's a few other advantages:

  • The end result (created symlinks or copied/renamed binaries) should be the same as before while allowing us to simplify eld's cmake. We are already tightly coupled to LLVM/LLVM's cmake anyway
  • eld should behave a bit more consistently to other LLVM tools now--for example, if someone does want to force symlinks on Windows in LLVM, eld will do the same

The one (maybe negative, intended) functional change here is that the symlinks now won't have their own targets. But:

  • It isn't clear to me how helpful that it is to have per-symlink targets (any/all symlinks will be built/installed with ld.eld)
  • This should be similar to how ex: lld's symlinks work
  • Worst case, I think we can add them back without reverting any of this if needed So, I omitted them for now.

[1] #737
[2] #710

@jonathonpenix
Copy link
Copy Markdown
Contributor Author

jonathonpenix commented Jan 25, 2026

Is there a Windows builder that I can test this on/check that things look as expected? Local Linux builds look ok, but I don't have a local setup for Windows builds

jonathonpenix added a commit to jonathonpenix/eld that referenced this pull request Jan 25, 2026
ELDExpected.test looks for ELDExpectedUsage in an `%llvmobjroot`-
relative dir (which IIUC boils down to a `LLVM_BINARY_DIR`-relative dir).
ELDExpectedUsage is currently installed in a `CMAKE_BINARY_DIR`-relative
dir. `LLVM_BINARY_DIR` and `CMAKE_BINARY_DIR` aren't always the same--they
can be different when llvm is added as a subdirectory. When this is the
case, we see test failures due to the mismatched location--see [1] for
details.

To fix this, just place ELDExpectedUsage in a `LLVM_BINARY_DIR`-relative
location as that is what the tests expect and it matches the behavior
when `LLVM_BINARY_DIR == CMAKE_BINARY_DIR`.

This partially fixes [1], the symlink/wrapper part is handled in [2].

[1] qualcomm#710
[2] qualcomm#738

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
eld's symlink creation currently has a few issues/quirks in how it
interacts with CPack and where symlinks are placed in builds [1][2].

I think the easiest way to fix these issues is just to leverage LLVM's
cmake utilities `llvm_add_tool_symlink` and `llvm_install_symlink`. Also,
I think there's a few other advantages:
- The end result (created symlinks or copied/renamed binaries) should be the
  same as before while allowing us to simplify eld's cmake. We are already
  tightly coupled to LLVM/LLVM's cmake anyway
- eld should behave a bit more consistently to other LLVM tools now--for
  example, if someone does want to force symlinks on Windows in LLVM, eld
  will do the same

The one (maybe negative, intended) functional change here is that the symlinks
now won't have their own targets. But:
- It isn't clear to me how helpful it is to have per-symlink targets
  (any/all symlinks will be built/installed with ld.eld)
- This should be similar to how ex: lld's symlinks work
- Worst case, I think we can add them back without reverting any of this if
  needed
So, I omitted them for now.

[1] qualcomm#737
[2] qualcomm#710

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
@jonathonpenix
Copy link
Copy Markdown
Contributor Author

FWIW, we have been testing cpullvm with this (and the other open cmake-y patches) for a little bit now. If you want, you can check out a builds with these applied here: https://github.com/qualcomm/cpullvm-toolchain/actions/runs/21575041496

@quic-seaswara quic-seaswara merged commit b3a44fb into qualcomm:main Feb 2, 2026
3 checks passed
quic-seaswara pushed a commit that referenced this pull request Feb 2, 2026
ELDExpected.test looks for ELDExpectedUsage in an `%llvmobjroot`-
relative dir (which IIUC boils down to a `LLVM_BINARY_DIR`-relative dir).
ELDExpectedUsage is currently installed in a `CMAKE_BINARY_DIR`-relative
dir. `LLVM_BINARY_DIR` and `CMAKE_BINARY_DIR` aren't always the same--they
can be different when llvm is added as a subdirectory. When this is the
case, we see test failures due to the mismatched location--see [1] for
details.

To fix this, just place ELDExpectedUsage in a `LLVM_BINARY_DIR`-relative
location as that is what the tests expect and it matches the behavior
when `LLVM_BINARY_DIR == CMAKE_BINARY_DIR`.

This partially fixes [1], the symlink/wrapper part is handled in [2].

[1] #710
[2] #738

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
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.

2 participants