summaryrefslogtreecommitdiff
path: root/libc/cmake/modules/LLVMLibCLibraryRules.cmake
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2023-03-02 05:53:38 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2023-03-03 06:59:19 +0000
commit4052bc86745ab50965846329fdd3eaa500c31520 (patch)
tree17ddc7941b880ce47a55e131b854cf1daa28d84a /libc/cmake/modules/LLVMLibCLibraryRules.cmake
parent8aa9ab336889ae2eb8e4188036faeb151379ab7b (diff)
downloadllvm-4052bc86745ab50965846329fdd3eaa500c31520.tar.gz
[libc] Make errno an entrypoint.
The entrypoint has been added to the various entrypoint lists. The libc code style doc has been updated with information on how errno should be set from the libc runtime code. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D145179
Diffstat (limited to 'libc/cmake/modules/LLVMLibCLibraryRules.cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCLibraryRules.cmake18
1 files changed, 17 insertions, 1 deletions
diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
index 279e15b82fa3..6d37232c8ae5 100644
--- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -1,4 +1,6 @@
function(collect_object_file_deps target result)
+ # NOTE: This function does add entrypoint targets to |result|.
+ # It is expected that the caller adds them separately.
set(all_deps "")
get_target_property(target_type ${target} "TARGET_TYPE")
if(NOT target_type)
@@ -28,7 +30,6 @@ function(collect_object_file_deps target result)
endif()
set(entrypoint_target ${aliasee})
endif()
- list(APPEND all_deps ${entrypoint_target})
get_target_property(deps ${target} "DEPS")
foreach(dep IN LISTS deps)
collect_object_file_deps(${dep} dep_targets)
@@ -80,6 +81,21 @@ function(add_entrypoint_library target_name)
endif()
collect_object_file_deps(${dep} recursive_deps)
list(APPEND all_deps ${recursive_deps})
+ # Add the entrypoint object target explicitly as collect_object_file_deps
+ # only collects object files from non-entrypoint targets.
+ if(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
+ set(entrypoint_target ${dep})
+ get_target_property(is_alias ${entrypoint_target} "IS_ALIAS")
+ if(is_alias)
+ get_target_property(aliasee ${entrypoint_target} "DEPS")
+ if(NOT aliasee)
+ message(FATAL_ERROR
+ "Entrypoint alias ${entrypoint_target} does not have an aliasee.")
+ endif()
+ set(entrypoint_target ${aliasee})
+ endif()
+ endif()
+ list(APPEND all_deps ${entrypoint_target})
endforeach(dep)
list(REMOVE_DUPLICATES all_deps)
set(objects "")