Skip to content

[libclc] Make library output directories explicit #146833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 4, 2025

Conversation

frasercrmck
Copy link
Contributor

These changes were split off from #146503.

This commit makes the output directories of libclc artefacts explicit. It creates a variable for the final output directory - LIBCLC_OUTPUT_LIBRARY_DIR - which has not changed. This allows future changes to alter the output directory more simply, such as by pointing it to somewhere inside clang's resource directory.

This commit also changes the output directory of each target's intermediate builtins.*.bc files. They are now placed into each respective libclc target's object directory, rather than the top-level libclc binary directory. This should help keep the binary directory a bit tidier.

These changes were split off from llvm#146503.

This commit makes the output directories of libclc artefacts explicit.
It creates a variable for the final output directory -
LIBCLC_OUTPUT_LIBRARY_DIR - which has not changed. This allows future
changes to alter the output directory more simply, such as by pointing
it to somewhere inside clang's resource directory.

This commit also changes the output directory of each target's
intermediate builtins.*.bc files. They are now placed into each
respective libclc target's object directory, rather than the top-level
libclc binary directory. This should help keep the binary directory a
bit tidier.
@frasercrmck frasercrmck requested review from arsenm and wenju-he July 3, 2025 08:33
@frasercrmck frasercrmck added the libclc libclc OpenCL library label Jul 3, 2025
Copy link
Contributor

@wenju-he wenju-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@frasercrmck frasercrmck merged commit 81e6552 into llvm:main Jul 4, 2025
9 checks passed
@frasercrmck frasercrmck deleted the libclc-output-dir branch July 4, 2025 09:35
@mgorny
Copy link
Member

mgorny commented Jul 19, 2025

This change broke installing symlinks. Now all symlinks are installed pointing to the build directory, i.e.:

-rw-r--r-- 1 root root  13M Jul 19 16:18 amdgcn--amdhsa.bc
lrwxrwxrwx 1 root root   82 Jul 19 16:18 bonaire-amdgcn--.bc -> /var/tmp/portage/llvm-core/libclc-22.0.0.9999/work/libclc_build/tahiti-amdgcn--.bc
lrwxrwxrwx 1 root root   92 Jul 19 16:18 bonaire-amdgcn-mesa-mesa3d.bc -> /var/tmp/portage/llvm-core/libclc-22.0.0.9999/work/libclc_build/tahiti-amdgcn-mesa-mesa3d.bc
lrwxrwxrwx 1 root root   82 Jul 19 16:18 carrizo-amdgcn--.bc -> /var/tmp/portage/llvm-core/libclc-22.0.0.9999/work/libclc_build/tahiti-amdgcn--.bc
lrwxrwxrwx 1 root root   92 Jul 19 16:18 carrizo-amdgcn-mesa-mesa3d.bc -> /var/tmp/portage/llvm-core/libclc-22.0.0.9999/work/libclc_build/tahiti-amdgcn-mesa-mesa3d.bc

and so on.

mgorny added a commit to mgorny/llvm-project that referenced this pull request Jul 20, 2025
This reverts commit 81e6552. This
change caused libclc to start installing broken symlinks that contain
absolute paths to the build directory rather than relative paths
within the install directory.
mgorny added a commit to mgorny/llvm-project that referenced this pull request Jul 20, 2025
Fix the symlink creation logic to use relative paths instead
of absolute, in order to ensure that the installed symlinks actually
refer to the installed .bc files rather than the ones from the build
directory.  This was broken in llvm#146833.  The change is a bit roundabout
but it attempts to preserve the spirit of llvm#146833, that is the ability
to use multiple output directories (provided they all resides
in `${LIBCLC_OUTPUT_LIBRARY_DIR}` and preserve the same structure
in the installed tree).

Signed-off-by: Michał Górny <[email protected]>
mgorny added a commit that referenced this pull request Jul 21, 2025
Fix the symlink creation logic to use relative paths instead of
absolute, in order to ensure that the installed symlinks actually refer
to the installed .bc files rather than the ones from the build
directory. This was broken in #146833. The change is a bit roundabout
but it attempts to preserve the spirit of #146833, that is the ability
to use multiple output directories (provided they all resides in
`${LIBCLC_OUTPUT_LIBRARY_DIR}` and preserve the same structure in the
installed tree).

Signed-off-by: Michał Górny <[email protected]>
tru pushed a commit to mgorny/llvm-project that referenced this pull request Jul 22, 2025
This reverts commit 81e6552. This
change caused libclc to start installing broken symlinks that contain
absolute paths to the build directory rather than relative paths
within the install directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libclc libclc OpenCL library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants