[libc] Fix install-libc to work with LLVM_LIBC_FULL_BUILD=OFF#197366
Merged
Conversation
Initialize variables that are conditionally set to avoid undefined references in install-libc and install-libc-stripped targets: - Initialize added_bitcode_targets to empty string (may be undefined when LIBC_TARGET_OS_IS_GPU=OFF) - Initialize startup_target to empty string and only set to "libc-startup" when both LLVM_LIBC_FULL_BUILD=ON and NOT baremetal (startup directory is only included in full builds) - Initialize header_install_target to empty string (may be undefined when LLVM_LIBC_FULL_BUILD=OFF)
|
@llvm/pr-subscribers-libc Author: Luca Barbato (lu-zero) ChangesInitialize variables that are conditionally set to avoid undefined references in install-libc and install-libc-stripped targets:
Full diff: https://github.com/llvm/llvm-project/pull/197366.diff 1 Files Affected:
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index 19751a9cc0736..08026e937be94 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -13,6 +13,7 @@ else()
endif()
set(added_archive_targets "")
+set(added_bitcode_targets "")
foreach(archive IN ZIP_LISTS
libc_archive_names libc_archive_targets libc_archive_entrypoint_lists)
if(NOT ${archive_2})
@@ -69,13 +70,15 @@ foreach(file ${added_bitcode_targets})
)
endforeach()
-if(NOT LIBC_TARGET_OS_IS_BAREMETAL)
+set(startup_target "")
+if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_BAREMETAL)
# For now we will disable libc-startup installation for baremetal. The
# correct way to do it would be to make a hookable startup for baremetal
# and install it as part of the libc installation.
set(startup_target "libc-startup")
endif()
+set(header_install_target "")
if(LLVM_LIBC_FULL_BUILD)
set(header_install_target install-libc-headers)
endif()
|
lntue
approved these changes
May 14, 2026
pedroMVicente
pushed a commit
to pedroMVicente/llvm-project
that referenced
this pull request
May 19, 2026
…97366) Initialize variables that are conditionally set to avoid undefined references in install-libc and install-libc-stripped targets: - Initialize added_bitcode_targets to empty string (may be undefined when LIBC_TARGET_OS_IS_GPU=OFF) - Initialize startup_target to empty string and only set to "libc-startup" when both LLVM_LIBC_FULL_BUILD=ON and NOT baremetal (startup directory is only included in full builds) - Initialize header_install_target to empty string (may be undefined when LLVM_LIBC_FULL_BUILD=OFF)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Initialize variables that are conditionally set to avoid undefined references in install-libc and install-libc-stripped targets: