diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -23,9 +23,9 @@ include(LLVMLibCRules) include(LLVMLibCCheckCpuFeatures) -add_subdirectory(src) -add_subdirectory(config) add_subdirectory(include) +add_subdirectory(config) +add_subdirectory(src) add_subdirectory(utils) # The loader can potentially depend on the library components so add it diff --git a/libc/cmake/modules/LLVMLibCRules.cmake b/libc/cmake/modules/LLVMLibCRules.cmake --- a/libc/cmake/modules/LLVMLibCRules.cmake +++ b/libc/cmake/modules/LLVMLibCRules.cmake @@ -1,3 +1,4 @@ +include(LLVMLibCTargetNameUtils) # A rule for self contained header file targets. # This rule merely copies the header file from the current source directory to @@ -12,7 +13,7 @@ "ADD_HEADER" "" # No optional arguments "HDR" # Single value arguments - "DEPENDS" # No multi value arguments + "DEPENDS" ${ARGN} ) if(NOT ADD_HEADER_HDR) @@ -28,15 +29,17 @@ DEPENDS ${src_file} ) + get_fq_target_name(${target_name} fq_target_name) add_custom_target( - ${target_name} + ${fq_target_name} DEPENDS ${dest_file} ) if(ADD_HEADER_DEPENDS) - add_dependencies( - ${target_name} ${ADD_HEADER_DEPENDS} - ) + get_fq_deps_list(fq_deps_list ${ADD_HEADER_DEPENDS}) + add_dependencies( + ${fq_target_name} ${fq_deps_list} + ) endif() endfunction(add_header) @@ -88,9 +91,13 @@ DEPENDS ${in_file} ${fq_data_files} ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td libc-hdrgen ) + get_fq_target_name(${target_name} fq_target_name) + if(ADD_GEN_HDR_DEPENDS) + get_fq_deps_list(fq_deps_list ${ADD_GEN_HDR_DEPENDS}) + endif() add_custom_target( - ${target_name} - DEPENDS ${out_file} ${ADD_GEN_HDR_DEPENDS} + ${fq_target_name} + DEPENDS ${out_file} ${fq_deps_list} ) endfunction(add_gen_header) @@ -118,32 +125,34 @@ message(FATAL_ERROR "'add_object_library' rule requires SRCS to be specified.") endif() + get_fq_target_name(${target_name} fq_target_name) add_library( - ${target_name} + ${fq_target_name} OBJECT ${ADD_OBJECT_SRCS} ${ADD_OBJECT_HDRS} ) target_include_directories( - ${target_name} + ${fq_target_name} PRIVATE "${LIBC_BUILD_DIR}/include;${LIBC_SOURCE_DIR};${LIBC_BUILD_DIR}" ) if(ADD_OBJECT_COMPILE_OPTIONS) target_compile_options( - ${target_name} + ${fq_target_name} PRIVATE ${ADD_OBJECT_COMPILE_OPTIONS} ) endif() - set(all_object_files $) + set(all_object_files $) if(ADD_OBJECT_DEPENDS) + get_fq_deps_list(fq_deps_list ${ADD_OBJECT_DEPENDS}) add_dependencies( - ${target_name} - ${ADD_OBJECT_DEPENDS} + ${fq_target_name} + ${fq_deps_list} ) - foreach(obj_target IN LISTS ADD_OBJECT_DEPENDS) - if(NOT TARGET ${obj_target}) + foreach(obj_target IN LISTS fq_deps_list) + if(NOT TARGET obj_target) # Not all targets will be visible. So, we will ignore those which aren't # visible yet. continue() @@ -161,7 +170,7 @@ list(REMOVE_DUPLICATES all_object_files) set_target_properties( - ${target_name} + ${fq_target_name} PROPERTIES "TARGET_TYPE" ${OBJECT_LIBRARY_TARGET_TYPE} "OBJECT_FILES" "${all_object_files}" @@ -174,7 +183,7 @@ # Usage: # add_entrypoint_object( # -# [REDIRECTED] # Specified if the entrypoint is redirected. +# [ALIAS|REDIRECTED] # Specified if the entrypoint is redirected or an alias. # [NAME] # SRCS # HDRS @@ -185,11 +194,48 @@ function(add_entrypoint_object target_name) cmake_parse_arguments( "ADD_ENTRYPOINT_OBJ" - "REDIRECTED" # Optional argument + "ALIAS;REDIRECTED" # Optional argument "NAME" # Single value arguments "SRCS;HDRS;DEPENDS;COMPILE_OPTIONS" # Multi value arguments ${ARGN} ) + + get_fq_target_name(${target_name} fq_target_name) + + if(ADD_ENTRYPOINT_OBJ_ALIAS) + # Alias targets help one add aliases to other entrypoint object targets. + # One can use alias targets setup OS/machine independent entrypoint targets. + list(LENGTH ADD_ENTRYPOINT_OBJ_DEPENDS deps_size) + if(NOT (${deps_size} EQUAL "1")) + message(FATAL_ERROR "An entrypoint alias should have exactly one dependency.") + endif() + list(GET ADD_ENTRYPOINT_OBJ_DEPENDS 0 dep_target) + get_fq_dep_name(fq_dep_name ${dep_target}) + if(NOT TARGET ${fq_dep_name}) + message(WARNING "Aliasee ${fq_dep_name} for entrypoint alias ${target_name} missing; " + "Target ${target_name} will be ignored.") + return() + endif() + + get_target_property(obj_type ${fq_dep_name} "TARGET_TYPE") + if((NOT obj_type) OR (NOT (${obj_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}))) + message(FATAL_ERROR "The aliasee of an entrypoint alias should be an entrypoint.") + endif() + + add_custom_target(${fq_target_name}) + add_dependencies(${fq_target_name} ${fq_dep_name}) + get_target_property(all_objects ${fq_dep_name} "OBJECT_FILES") + get_target_property(all_objects_raw ${fq_dep_name} "OBJECT_FILES_RAW") + set_target_properties( + ${fq_target_name} + PROPERTIES + "TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE} + "OBJECT_FILES" "${all_objects}" + "OBJECT_FILES_RAW" "${all_objects_raw}" + ) + return() + endif() + if(NOT ADD_ENTRYPOINT_OBJ_SRCS) message(FATAL_ERROR "`add_entrypoint_object` rule requires SRCS to be specified.") endif() @@ -202,8 +248,10 @@ set(entrypoint_name ${ADD_ENTRYPOINT_OBJ_NAME}) endif() + set(objects_target_name "${fq_target_name}_objects") + add_library( - "${target_name}_objects" + ${objects_target_name} # We want an object library as the objects will eventually get packaged into # an archive (like libc.a). OBJECT @@ -211,27 +259,28 @@ ${ADD_ENTRYPOINT_OBJ_HDRS} ) target_compile_options( - ${target_name}_objects + ${objects_target_name} BEFORE PRIVATE -fpie ${LLVM_CXX_STD_default} ) target_include_directories( - ${target_name}_objects + ${objects_target_name} PRIVATE "${LIBC_BUILD_DIR}/include;${LIBC_SOURCE_DIR};${LIBC_BUILD_DIR}" ) add_dependencies( - ${target_name}_objects - support_common_h + ${objects_target_name} + libc.src.__support.common ) set(dep_objects "") if(ADD_ENTRYPOINT_OBJ_DEPENDS) + get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS}) add_dependencies( - ${target_name}_objects - ${ADD_ENTRYPOINT_OBJ_DEPENDS} + ${objects_target_name} + ${fq_deps_list} ) - foreach(dep_target IN LISTS ADD_ENTRYPOINT_OBJ_DEPENDS) + foreach(dep_target IN LISTS fq_deps_list) if(NOT TARGET ${dep_target}) # Not all targets will be visible. So, we will ignore those which aren't # visible yet. @@ -255,7 +304,7 @@ if(ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS) target_compile_options( - ${target_name}_objects + ${objects_target_name} PRIVATE ${ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS} ) endif() @@ -263,7 +312,7 @@ set(object_file_raw "${CMAKE_CURRENT_BINARY_DIR}/${target_name}_raw.o") set(object_file "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.o") - set(input_objects $) + set(input_objects $) add_custom_command( OUTPUT ${object_file_raw} DEPENDS ${input_objects} @@ -283,7 +332,7 @@ ) add_custom_target( - ${target_name} + ${fq_target_name} ALL DEPENDS ${object_file} ) @@ -292,7 +341,7 @@ set(all_objects_raw ${object_file_raw}) list(APPEND all_objects_raw ${dep_objects}) set_target_properties( - ${target_name} + ${fq_target_name} PROPERTIES "TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE} "OBJECT_FILES" "${all_objects}" @@ -432,7 +481,8 @@ endif() set(library_deps "") - foreach(dep IN LISTS LIBC_UNITTEST_DEPENDS) + get_fq_deps_list(fq_deps_list ${LIBC_UNITTEST_DEPENDS}) + foreach(dep IN LISTS fq_deps_list) get_target_property(dep_type ${dep} "TARGET_TYPE") if(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}) get_target_property(obj_files ${dep} "OBJECT_FILES_RAW") @@ -446,14 +496,15 @@ endforeach(dep) list(REMOVE_DUPLICATES library_deps) + get_fq_target_name(${target_name} fq_target_name) add_executable( - ${target_name} + ${fq_target_name} EXCLUDE_FROM_ALL ${LIBC_UNITTEST_SRCS} ${LIBC_UNITTEST_HDRS} ) target_include_directories( - ${target_name} + ${fq_target_name} PRIVATE ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR} @@ -467,27 +518,27 @@ endif() if(library_deps) - target_link_libraries(${target_name} PRIVATE ${library_deps}) + target_link_libraries(${fq_target_name} PRIVATE ${library_deps}) endif() - set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies( - ${target_name} - ${LIBC_UNITTEST_DEPENDS} + ${fq_target_name} + ${fq_deps_list} ) - target_link_libraries(${target_name} PRIVATE LibcUnitTest libc_test_utils) + target_link_libraries(${fq_target_name} PRIVATE LibcUnitTest libc_test_utils) add_custom_command( - TARGET ${target_name} + TARGET ${fq_target_name} POST_BUILD - COMMAND $ + COMMAND $ ) if(LIBC_UNITTEST_SUITE) add_dependencies( ${LIBC_UNITTEST_SUITE} - ${target_name} + ${fq_target_name} ) endif() endfunction(add_libc_unittest) @@ -520,8 +571,9 @@ message(FATAL_ERROR "'add_libc_fuzzer' target requires a DEPENDS list of 'add_entrypoint_object' targets.") endif() + get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS}) set(library_deps "") - foreach(dep IN LISTS LIBC_FUZZER_DEPENDS) + foreach(dep IN LISTS fq_deps_list) get_target_property(dep_type ${dep} "TARGET_TYPE") if (dep_type) string(COMPARE EQUAL ${dep_type} ${ENTRYPOINT_OBJ_TARGET_TYPE} dep_is_entrypoint) @@ -535,14 +587,15 @@ # to the list of library_deps. endforeach(dep) + get_fq_target_name(${target_name} fq_target_name) add_executable( - ${target_name} + ${fq_target_name} EXCLUDE_FROM_ALL ${LIBC_FUZZER_SRCS} ${LIBC_FUZZER_HDRS} ) target_include_directories( - ${target_name} + ${fq_target_name} PRIVATE ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR} @@ -550,16 +603,16 @@ ) if(library_deps) - target_link_libraries(${target_name} PRIVATE ${library_deps}) + target_link_libraries(${fq_target_name} PRIVATE ${library_deps}) endif() - set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies( - ${target_name} - ${LIBC_FUZZER_DEPENDS} + ${fq_target_name} + ${fq_deps_list} ) - add_dependencies(libc-fuzzer ${target_name}) + add_dependencies(libc-fuzzer ${fq_target_name}) endfunction(add_libc_fuzzer) # Rule to add header only libraries. @@ -582,6 +635,8 @@ message(FATAL_ERROR "'add_header_library' target requires a HDRS list of .h files.") endif() + get_fq_target_name(${target_name} fq_target_name) + set(FULL_HDR_PATHS "") # TODO: Remove this foreach block when we can switch to the new # version of the CMake policy CMP0076. @@ -589,18 +644,19 @@ list(APPEND FULL_HDR_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${hdr}) endforeach() - set(interface_target_name "${target_name}_header_library__") + set(interface_target_name "${fq_target_name}_header_library__") add_library(${interface_target_name} INTERFACE) target_sources(${interface_target_name} INTERFACE ${FULL_HDR_PATHS}) if(ADD_HEADER_DEPENDS) - add_dependencies(${interface_target_name} ${ADD_HEADER_DEPENDS}) + get_fq_deps_list(fq_deps_list ${ADD_HEADER_DEPENDS}) + add_dependencies(${interface_target_name} ${fq_deps_list}) endif() - add_custom_target(${target_name}) - add_dependencies(${target_name} ${interface_target_name}) + add_custom_target(${fq_target_name}) + add_dependencies(${fq_target_name} ${interface_target_name}) set_target_properties( - ${target_name} + ${fq_target_name} PROPERTIES "TARGET_TYPE" "HDR_LIBRARY" ) diff --git a/libc/cmake/modules/LLVMLibCTargetNameUtils.cmake b/libc/cmake/modules/LLVMLibCTargetNameUtils.cmake new file mode 100644 --- /dev/null +++ b/libc/cmake/modules/LLVMLibCTargetNameUtils.cmake @@ -0,0 +1,32 @@ +function(get_fq_target_name local_name target_name_var) + file(RELATIVE_PATH rel_path ${LIBC_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + string(REPLACE "/" "." fq_name "libc.${rel_path}.${local_name}") + set(${target_name_var} ${fq_name} PARENT_SCOPE) +endfunction(get_fq_target_name) + +function(is_relative_target_name target_name output_var) + string(FIND ${target_name} "." dot_loc) + string(COMPARE EQUAL "0" ${dot_loc} is_relative) + set(${output_var} ${is_relative} PARENT_SCOPE) +endfunction(is_relative_target_name) + +function(get_fq_dep_name fq_name name) + is_relative_target_name(${name} "is_relative") + if(is_relative) + # Skip over the first '.' character. + string(SUBSTRING ${name} 1 -1 local_name) + get_fq_target_name(${local_name} fully_qualified_name) + set(${fq_name} ${fully_qualified_name} PARENT_SCOPE) + else() + set(${fq_name} ${name} PARENT_SCOPE) + endif() +endfunction(get_fq_dep_name) + +function(get_fq_deps_list output_list) + set(fq_dep_name_list "") + foreach(dep IN LISTS ARGN) + get_fq_dep_name(fq_dep_name ${dep}) + list(APPEND fq_dep_name_list ${fq_dep_name}) + endforeach(dep) + set(${output_list} ${fq_dep_name_list} PARENT_SCOPE) +endfunction(get_fq_deps_list) diff --git a/libc/config/linux/CMakeLists.txt b/libc/config/linux/CMakeLists.txt --- a/libc/config/linux/CMakeLists.txt +++ b/libc/config/linux/CMakeLists.txt @@ -7,7 +7,7 @@ DATA_FILES ${LIBC_TARGET_MACHINE}/syscall.h.inc DEPENDS - support_common_h + libc.src.__support.common ) add_subdirectory(x86_64) diff --git a/libc/fuzzing/string/CMakeLists.txt b/libc/fuzzing/string/CMakeLists.txt --- a/libc/fuzzing/string/CMakeLists.txt +++ b/libc/fuzzing/string/CMakeLists.txt @@ -3,7 +3,7 @@ SRCS strcpy_fuzz.cpp DEPENDS - strcpy - strlen - memcpy + libc.src.string.memcpy + libc.src.string.strcpy + libc.src.string.strlen ) diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -6,25 +6,25 @@ ) add_header( - libc_posix_types_h + libc_posix_types HDR __posix-types.h ) add_header( - ctype_h + ctype HDR ctype.h DEPENDS - llvm_libc_common_h + .llvm_libc_common_h ) add_gen_header( - math_h + math DEF_FILE math.h.def GEN_HDR math.h DEPENDS - llvm_libc_common_h + .llvm_libc_common_h ) add_gen_header( @@ -32,31 +32,31 @@ DEF_FILE assert.h.def GEN_HDR assert.h DEPENDS - llvm_libc_common_h + .llvm_libc_common_h ) add_gen_header( - string_h + string DEF_FILE string.h.def GEN_HDR string.h DEPENDS - llvm_libc_common_h + .llvm_libc_common_h ) add_gen_header( - threads_h + threads DEF_FILE threads.h.def GEN_HDR threads.h PARAMS platform_threads=../config/${LIBC_TARGET_OS}/threads.h.in DEPENDS - llvm_libc_common_h + .llvm_libc_common_h DATA_FILES ../config/${LIBC_TARGET_OS}/threads.h.in ) add_gen_header( - errno_h + errno DEF_FILE errno.h.def PARAMS platform_errno=../config/${LIBC_TARGET_OS}/errno.h.in @@ -66,7 +66,7 @@ ) add_gen_header( - signal_h + signal DEF_FILE signal.h.def PARAMS platform_signal=../config/${LIBC_TARGET_OS}/signal.h.in @@ -76,11 +76,11 @@ ) add_gen_header( - stdlib_h + stdlib DEF_FILE stdlib.h.def GEN_HDR stdlib.h DEPENDS - llvm_libc_common_h + .llvm_libc_common_h ) # TODO: Not all platforms will have a include/sys directory. Add the sys @@ -89,16 +89,16 @@ file(MAKE_DIRECTORY "sys") add_gen_header( - sys_mman_h + sys_mman DEF_FILE sys/mman.h.def GEN_HDR sys/mman.h DEPENDS - libc_posix_types_h - llvm_libc_common_h + .libc_posix_types + .llvm_libc_common_h ) add_gen_header( - sys_syscall_h + sys_syscall DEF_FILE sys/syscall.h.def GEN_HDR sys/syscall.h PARAMS diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt --- a/libc/lib/CMakeLists.txt +++ b/libc/lib/CMakeLists.txt @@ -3,45 +3,45 @@ llvmlibc DEPENDS # assert.h entrypoints - __assert_fail + libc.src.assert.__assert_fail # errno.h entrypoints - __errno_location - - # string.h entrypoints - strcpy - strcat - memcpy - - # sys/mman.h entrypoints - mmap - munmap + libc.src.errno.__errno_location # signal.h entrypoints - raise - sigaction - sigaddset - sigemptyset - sigprocmask - signal + libc.src.signal.raise + libc.src.signal.sigaction + libc.src.signal.sigaddset + libc.src.signal.sigemptyset + libc.src.signal.sigprocmask + libc.src.signal.signal # stdlib.h entrypoints - _Exit - abort + libc.src.stdlib._Exit + libc.src.stdlib.abort + + # string.h entrypoints + libc.src.string.memcpy + libc.src.string.strcpy + libc.src.string.strcat + + # sys/mman.h entrypoints + libc.src.sys.mman.mmap + libc.src.sys.mman.munmap # threads.h entrypoints - mtx_init - mtx_lock - mtx_unlock - thrd_create - thrd_join + libc.src.threads.mtx_init + libc.src.threads.mtx_lock + libc.src.threads.mtx_unlock + libc.src.threads.thrd_create + libc.src.threads.thrd_join ) add_entrypoint_library( llvmlibm DEPENDS # math.h entrypoints - round + libc.src.math.round ) add_redirector_library( diff --git a/libc/loader/linux/CMakeLists.txt b/libc/loader/linux/CMakeLists.txt --- a/libc/loader/linux/CMakeLists.txt +++ b/libc/loader/linux/CMakeLists.txt @@ -1,13 +1,36 @@ function(add_loader_object name) cmake_parse_arguments( "ADD_LOADER_OBJECT" - "" # No option arguments - "SRC" # Single value arguments + "ALIAS" # Option argument + "SRC" # Single value arguments "DEPENDS;COMPILE_OPTIONS" # Multi value arguments ${ARGN} ) + + get_fq_target_name(${name} fq_target_name) + + if(ADD_LOADER_OBJECT_ALIAS) + list(LENGTH ADD_LOADER_OBJECT_DEPENDS deps_size) + if(NOT (${deps_size} EQUAL "1")) + message(FATAL_ERROR "A loader object alias should have exactly one dependency.") + endif() + list(GET ADD_LOADER_OBJECT_DEPENDS 0 dep) + get_fq_dep_name(fq_dep_name ${dep}) + + add_custom_target(${fq_target_name}) + add_dependencies(${fq_target_name} ${fq_dep_name}) + get_target_property(dep_objfile ${fq_dep_name} OBJECT_FILES) + set_target_properties( + ${fq_target_name} + PROPERTIES + "TARGET_TYPE" "LOADER_OBJECT" + "OBJECT_FILES" ${dep_objfile} + ) + return() + endif() + add_object_library( - ${name}_object + ${name}_objects SRCS ${ADD_LOADER_OBJECT_SRC} DEPENDS ${ADD_LOADER_OBJECT_DEPENDS} COMPILE_OPTIONS ${ADD_LOADER_OBJECT_COMPILE_OPTIONS} @@ -16,15 +39,15 @@ set(objfile ${LIBC_BUILD_DIR}/lib/${name}.o) add_custom_command( OUTPUT ${objfile} - COMMAND cp $ ${objfile} - DEPENDS $ + COMMAND cp $ ${objfile} + DEPENDS $ ) add_custom_target( - ${name} + ${fq_target_name} DEPENDS ${objfile} ) set_target_properties( - ${name} + ${fq_target_name} PROPERTIES "TARGET_TYPE" "LOADER_OBJECT" "OBJECT_FILES" ${objfile} @@ -32,3 +55,10 @@ endfunction() add_subdirectory(${LIBC_TARGET_MACHINE}) + +add_loader_object( + crt1 + ALIAS + DEPENDS + .${LIBC_TARGET_MACHINE}.crt1 +) diff --git a/libc/loader/linux/x86_64/CMakeLists.txt b/libc/loader/linux/x86_64/CMakeLists.txt --- a/libc/loader/linux/x86_64/CMakeLists.txt +++ b/libc/loader/linux/x86_64/CMakeLists.txt @@ -3,8 +3,8 @@ SRC start.cpp DEPENDS - linux_syscall_h - sys_syscall_h + libc.config.linux.linux_syscall_h + libc.include.sys_syscall COMPILE_OPTIONS -fno-omit-frame-pointer -ffreestanding # To avoid compiler warnings about calling the main function. diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -1,5 +1,5 @@ add_gen_header( - support_common_h + common DEF_FILE common.h.def PARAMS platform_defs=../../config/${LIBC_TARGET_OS}/platfrom_defs.h.inc diff --git a/libc/src/assert/CMakeLists.txt b/libc/src/assert/CMakeLists.txt --- a/libc/src/assert/CMakeLists.txt +++ b/libc/src/assert/CMakeLists.txt @@ -5,9 +5,9 @@ HDRS assert.h DEPENDS - abort # These two dependencies are temporary and should be replaced by fprintf # later. - sys_syscall_h - linux_syscall_h + libc.config.linux.linux_syscall_h + libc.include.sys_syscall + libc.src.stdlib.abort ) diff --git a/libc/src/signal/CMakeLists.txt b/libc/src/signal/CMakeLists.txt --- a/libc/src/signal/CMakeLists.txt +++ b/libc/src/signal/CMakeLists.txt @@ -1,4 +1,59 @@ - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) - add_subdirectory(${LIBC_TARGET_OS}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) endif() + +add_entrypoint_object( + raise + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.raise +) + +add_entrypoint_object( + sigaction + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigaction +) + +add_entrypoint_object( + sigprocmask + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigprocmask +) + +add_entrypoint_object( + sigemptyset + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigemptyset +) + +add_entrypoint_object( + sigaddset + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigaddset +) + +add_entrypoint_object( + signal + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.signal +) + +add_entrypoint_object( + sigfillset + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigfillset +) + +add_entrypoint_object( + sigdelset + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.sigdelset +) diff --git a/libc/src/signal/linux/CMakeLists.txt b/libc/src/signal/linux/CMakeLists.txt --- a/libc/src/signal/linux/CMakeLists.txt +++ b/libc/src/signal/linux/CMakeLists.txt @@ -7,9 +7,9 @@ signal.h ../raise.h DEPENDS - sys_syscall_h - linux_syscall_h - signal_h + libc.config.linux.linux_syscall_h + libc.include.signal + libc.include.sys_syscall ) add_object_library( @@ -25,8 +25,8 @@ # asan creates asan.module_ctor which uses stack space, causing warnings. -fno-sanitize=address DEPENDS - linux_syscall_h - sys_syscall_h + libc.config.linux.linux_syscall_h + libc.include.sys_syscall ) add_entrypoint_object( @@ -37,10 +37,10 @@ signal.h ../sigaction.h DEPENDS - __restore - sys_syscall_h - linux_syscall_h - signal_h + .__restore + libc.config.linux.linux_syscall_h + libc.include.signal + libc.include.sys_syscall ) add_entrypoint_object( @@ -51,10 +51,10 @@ signal.h ../sigprocmask.h DEPENDS - sys_syscall_h - linux_syscall_h - __errno_location - signal_h + libc.config.linux.linux_syscall_h + libc.include.signal + libc.include.sys_syscall + libc.src.errno.__errno_location ) add_entrypoint_object( @@ -65,9 +65,9 @@ signal.h ../sigemptyset.h DEPENDS - __errno_location - errno_h - signal_h + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location ) add_entrypoint_object( @@ -78,9 +78,9 @@ signal.h ../sigaddset.h DEPENDS - __errno_location - errno_h - signal_h + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location ) add_entrypoint_object( @@ -91,8 +91,8 @@ signal.h ../signal.h DEPENDS - sigaction - signal_h + .sigaction + libc.include.signal ) add_entrypoint_object( @@ -103,9 +103,9 @@ signal.h ../sigfillset.h DEPENDS - __errno_location - errno_h - signal_h + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location ) add_entrypoint_object( @@ -116,7 +116,7 @@ signal.h ../sigdelset.h DEPENDS - __errno_location - errno_h - signal_h + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location ) diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt --- a/libc/src/stdlib/CMakeLists.txt +++ b/libc/src/stdlib/CMakeLists.txt @@ -1,15 +1,22 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) - add_subdirectory(${LIBC_TARGET_OS}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) endif() add_entrypoint_object( + _Exit + ALIAS + DEPENDS + .${LIBC_TARGET_OS}._Exit +) + +add_entrypoint_object( abort SRCS abort.cpp HDRS abort.h DEPENDS - raise - _Exit - stdlib_h + libc.include.stdlib + libc.src.signal.raise + ._Exit ) diff --git a/libc/src/stdlib/linux/CMakeLists.txt b/libc/src/stdlib/linux/CMakeLists.txt --- a/libc/src/stdlib/linux/CMakeLists.txt +++ b/libc/src/stdlib/linux/CMakeLists.txt @@ -5,7 +5,7 @@ HDRS ../_Exit.h DEPENDS - sys_syscall_h - linux_syscall_h - stdlib_h + libc.include.sys_syscall + libc.config.linux.linux_syscall_h + libc.include.stdlib ) diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt --- a/libc/src/string/CMakeLists.txt +++ b/libc/src/string/CMakeLists.txt @@ -7,9 +7,9 @@ HDRS strcat.h DEPENDS - strcpy - string_h - strlen + .strcpy + .strlen + libc.include.string ) add_entrypoint_object( @@ -19,9 +19,9 @@ HDRS strcpy.h DEPENDS - string_h - strlen - memcpy + .memcpy + .strlen + libc.include.string ) add_entrypoint_object( @@ -31,7 +31,7 @@ HDRS strlen.h DEPENDS - string_h + libc.include.string ) # ------------------------------------------------------------------------------ @@ -79,18 +79,19 @@ SRCS ${LIBC_SOURCE_DIR}/src/string/memcpy.cpp HDRS ${LIBC_SOURCE_DIR}/src/string/memcpy.h DEPENDS - string_h - memory_utils - memcpy_arch_specific + .memory_utils.memory_utils + .memcpy_arch_specific + libc.include.string COMPILE_OPTIONS -fno-builtin-memcpy ${flags} ) - set_target_properties(${memcpy_name} PROPERTIES REQUIRE_CPU_FEATURES "${ADD_MEMCPY_REQUIRE}") + get_fq_target_name(${memcpy_name} fq_target_name) + set_target_properties(${fq_target_name} PROPERTIES REQUIRE_CPU_FEATURES "${ADD_MEMCPY_REQUIRE}") get_property(all GLOBAL PROPERTY memcpy_implementations) list(APPEND all ${memcpy_name}) set_property(GLOBAL PROPERTY memcpy_implementations "${all}") endfunction() -add_subdirectory(${LIBC_MEMCPY_IMPL_FOLDER}) +include(${LIBC_MEMCPY_IMPL_FOLDER}/CMakeLists.txt) add_memcpy(memcpy MARCH native) diff --git a/libc/src/string/memory_utils/CMakeLists.txt b/libc/src/string/memory_utils/CMakeLists.txt --- a/libc/src/string/memory_utils/CMakeLists.txt +++ b/libc/src/string/memory_utils/CMakeLists.txt @@ -16,5 +16,5 @@ utils.h memcpy_utils.h DEPENDS - cacheline_size + .cacheline_size ) diff --git a/libc/src/sys/mman/CMakeLists.txt b/libc/src/sys/mman/CMakeLists.txt --- a/libc/src/sys/mman/CMakeLists.txt +++ b/libc/src/sys/mman/CMakeLists.txt @@ -1,3 +1,17 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) - add_subdirectory(${LIBC_TARGET_OS}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) endif() + +add_entrypoint_object( + mmap + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.mmap +) + +add_entrypoint_object( + munmap + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.munmap +) diff --git a/libc/src/sys/mman/linux/CMakeLists.txt b/libc/src/sys/mman/linux/CMakeLists.txt --- a/libc/src/sys/mman/linux/CMakeLists.txt +++ b/libc/src/sys/mman/linux/CMakeLists.txt @@ -5,10 +5,10 @@ HDRS ../mmap.h DEPENDS - sys_mman_h - sys_syscall_h - linux_syscall_h - __errno_location + libc.config.linux.linux_syscall_h + libc.include.sys_mman + libc.include.sys_syscall + libc.src.errno.__errno_location ) add_entrypoint_object( @@ -18,8 +18,8 @@ HDRS ../munmap.h DEPENDS - sys_mman_h - sys_syscall_h - linux_syscall_h - __errno_location + libc.config.linux.linux_syscall_h + libc.include.sys_mman + libc.include.sys_syscall + libc.src.errno.__errno_location ) diff --git a/libc/src/threads/CMakeLists.txt b/libc/src/threads/CMakeLists.txt --- a/libc/src/threads/CMakeLists.txt +++ b/libc/src/threads/CMakeLists.txt @@ -1,3 +1,38 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) add_subdirectory(${LIBC_TARGET_OS}) endif() + +add_entrypoint_object( + thrd_create + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.thrd_create +) + +add_entrypoint_object( + thrd_join + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.thrd_join +) + +add_entrypoint_object( + mtx_init + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.mtx_init +) + +add_entrypoint_object( + mtx_lock + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.mtx_lock +) + +add_entrypoint_object( + mtx_unlock + ALIAS + DEPENDS + .${LIBC_TARGET_OS}.mtx_unlock +) diff --git a/libc/src/threads/linux/CMakeLists.txt b/libc/src/threads/linux/CMakeLists.txt --- a/libc/src/threads/linux/CMakeLists.txt +++ b/libc/src/threads/linux/CMakeLists.txt @@ -13,7 +13,7 @@ HDRS thread_utils.h DEPENDS - thread_start_args_h + .thread_start_args_h ) add_entrypoint_object( @@ -23,14 +23,14 @@ HDRS ../thrd_create.h DEPENDS - errno_h - linux_syscall_h - mmap - support_common_h - sys_syscall_h - threads_h - threads_utils - __errno_location + .threads_utils + libc.config.linux.linux_syscall_h + libc.include.errno + libc.include.sys_syscall + libc.include.threads + libc.src.__support.common + libc.src.errno.__errno_location + libc.src.sys.mman.mmap COMPILE_OPTIONS -fno-omit-frame-pointer # This allows us to sniff out the thread args from # the new thread's stack reliably. @@ -43,12 +43,12 @@ HDRS ../thrd_join.h DEPENDS - linux_syscall_h - munmap - support_common_h - sys_syscall_h - threads_h - threads_utils + .threads_utils + libc.config.linux.linux_syscall_h + libc.include.sys_syscall + libc.include.threads + libc.src.sys.mman.mmap + libc.src.__support.common ) add_entrypoint_object( @@ -58,8 +58,8 @@ HDRS ../mtx_init.h DEPENDS - threads_h - threads_utils + .threads_utils + libc.include.threads ) add_entrypoint_object( @@ -69,10 +69,10 @@ HDRS ../mtx_lock.h DEPENDS - linux_syscall_h - sys_syscall_h - threads_h - threads_utils + .threads_utils + libc.config.linux.linux_syscall_h + libc.include.sys_syscall + libc.include.threads ) add_entrypoint_object( @@ -82,8 +82,8 @@ HDRS ../mtx_unlock.h DEPENDS - linux_syscall_h - sys_syscall_h - threads_h - threads_utils + .threads_utils + libc.config.linux.linux_syscall_h + libc.include.sys_syscall + libc.include.threads ) diff --git a/libc/test/config/linux/x86_64/CMakeLists.txt b/libc/test/config/linux/x86_64/CMakeLists.txt --- a/libc/test/config/linux/x86_64/CMakeLists.txt +++ b/libc/test/config/linux/x86_64/CMakeLists.txt @@ -3,6 +3,5 @@ SUITE libc_linux_tests SRCS syscall_test.cpp DEPENDS - linux_syscall_h - support_common_h + libc.config.linux.linux_syscall_h ) diff --git a/libc/test/loader/CMakeLists.txt b/libc/test/loader/CMakeLists.txt --- a/libc/test/loader/CMakeLists.txt +++ b/libc/test/loader/CMakeLists.txt @@ -20,18 +20,20 @@ ${ARGN} ) + get_fq_target_name(${target_name} fq_target_name) add_executable( - ${target_name} + ${fq_target_name} EXCLUDE_FROM_ALL ${ADD_LOADER_TEST_SRC} ) - set_target_properties(${target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(dep_objects "") if(ADD_LOADER_TEST_DEPENDS) - add_dependencies(${target_name} ${ADD_LOADER_TEST_DEPENDS}) - foreach(dep IN LISTS ADD_LOADER_TEST_DEPENDS) + get_fq_deps_list(fq_deps_list ${ADD_LOADER_TEST_DEPENDS}) + add_dependencies(${fq_target_name} ${fq_deps_list}) + foreach(dep IN LISTS fq_deps_list) get_target_property(objfile ${dep} "OBJECT_FILES") if(NOT objfile) message( @@ -45,28 +47,28 @@ endif() target_include_directories( - ${target_name} + ${fq_target_name} PRIVATE ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR} ${LIBC_BUILD_DIR}/include ) - target_link_libraries(${target_name} ${dep_objects}) + target_link_libraries(${fq_target_name} ${dep_objects}) target_link_options( - ${target_name} + ${fq_target_name} BEFORE PRIVATE -nostdlib ) add_custom_command( - TARGET ${target_name} + TARGET ${fq_target_name} POST_BUILD - COMMAND ${ADD_LOADER_TEST_ENV} $ ${ADD_LOADER_TEST_ARGS} + COMMAND ${ADD_LOADER_TEST_ENV} $ ${ADD_LOADER_TEST_ARGS} ) - add_dependencies(libc_loader_tests ${target_name}) + add_dependencies(libc_loader_tests ${fq_target_name}) endfunction(add_loader_test) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) diff --git a/libc/test/loader/linux/CMakeLists.txt b/libc/test/loader/linux/CMakeLists.txt --- a/libc/test/loader/linux/CMakeLists.txt +++ b/libc/test/loader/linux/CMakeLists.txt @@ -3,11 +3,11 @@ SRC args_test.cpp DEPENDS - __assert_fail - _Exit - abort - crt1 - raise + libc.loader.linux.crt1 + libc.src.assert.__assert_fail + libc.src.signal.raise + libc.src.stdlib._Exit + libc.src.stdlib.abort ARGS 1 2 3 ENV @@ -20,7 +20,7 @@ SRC main_without_envp.cpp DEPENDS - crt1 + libc.loader.linux.crt1 ) add_loader_test( @@ -28,5 +28,5 @@ SRC main_without_args.cpp DEPENDS - crt1 + libc.loader.linux.crt1 ) diff --git a/libc/test/src/assert/CMakeLists.txt b/libc/test/src/assert/CMakeLists.txt --- a/libc/test/src/assert/CMakeLists.txt +++ b/libc/test/src/assert/CMakeLists.txt @@ -7,9 +7,9 @@ SRCS assert_test.cpp DEPENDS - __assert_fail + libc.src.assert.__assert_fail # These are necessary for now because dependencies are not properly added. - abort - raise - _Exit + libc.src.signal.raise + libc.src.stdlib._Exit + libc.src.stdlib.abort ) diff --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt --- a/libc/test/src/errno/CMakeLists.txt +++ b/libc/test/src/errno/CMakeLists.txt @@ -7,5 +7,5 @@ SRCS errno_test.cpp DEPENDS - __errno_location + libc.src.errno.__errno_location ) diff --git a/libc/test/src/signal/CMakeLists.txt b/libc/test/src/signal/CMakeLists.txt --- a/libc/test/src/signal/CMakeLists.txt +++ b/libc/test/src/signal/CMakeLists.txt @@ -7,8 +7,8 @@ SRCS raise_test.cpp DEPENDS - raise - signal_h + libc.include.signal + libc.src.signal.raise ) add_libc_unittest( @@ -18,11 +18,11 @@ SRCS sigaction_test.cpp DEPENDS - sigaction - raise - signal_h - errno_h - __errno_location + libc.src.signal.sigaction + libc.src.signal.raise + libc.include.signal + libc.include.errno + libc.src.errno.__errno_location ) add_libc_unittest( @@ -32,12 +32,12 @@ SRCS sigprocmask_test.cpp DEPENDS - raise - sigprocmask - sigaddset - sigemptyset - signal_h - __errno_location + libc.include.signal + libc.src.errno.__errno_location + libc.src.signal.raise + libc.src.signal.sigprocmask + libc.src.signal.sigaddset + libc.src.signal.sigemptyset ) add_libc_unittest( @@ -47,9 +47,9 @@ SRCS sigaddset_test.cpp DEPENDS - sigaddset - signal_h - __errno_location + libc.include.signal + libc.src.errno.__errno_location + libc.src.signal.sigaddset ) add_libc_unittest( @@ -59,12 +59,12 @@ SRCS signal_test.cpp DEPENDS - signal - signal_h - sigaction - raise - __errno_location - errno_h + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location + libc.src.signal.raise + libc.src.signal.sigaction + libc.src.signal.signal ) add_libc_unittest( @@ -74,12 +74,12 @@ SRCS sigfillset_test.cpp DEPENDS - sigfillset - sigprocmask - signal_h - raise - errno_h - __errno_location + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location + libc.src.signal.raise + libc.src.signal.sigfillset + libc.src.signal.sigprocmask ) add_libc_unittest( @@ -89,11 +89,11 @@ SRCS sigdelset_test.cpp DEPENDS - sigdelset - sigfillset - sigprocmask - signal_h - raise - errno_h - __errno_location + libc.include.errno + libc.include.signal + libc.src.errno.__errno_location + libc.src.signal.raise + libc.src.signal.sigdelset + libc.src.signal.sigfillset + libc.src.signal.sigprocmask ) diff --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt --- a/libc/test/src/stdlib/CMakeLists.txt +++ b/libc/test/src/stdlib/CMakeLists.txt @@ -7,8 +7,8 @@ SRCS _Exit_test.cpp DEPENDS - stdlib_h - _Exit + libc.include.stdlib + libc.src.stdlib._Exit ) add_libc_unittest( @@ -18,9 +18,9 @@ SRCS abort_test.cpp DEPENDS - stdlib_h - signal_h - abort - _Exit - raise + libc.include.stdlib + libc.include.signal + libc.src.stdlib.abort + libc.src.stdlib._Exit + libc.src.signal.raise ) diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt --- a/libc/test/src/string/CMakeLists.txt +++ b/libc/test/src/string/CMakeLists.txt @@ -9,11 +9,11 @@ SRCS strcat_test.cpp DEPENDS - strcat - strcpy - strlen -# TODO (sivachandra): remove redundant deps. - memcpy + # TODO (sivachandra): remove redundant deps. + libc.src.string.memcpy + libc.src.string.strcat + libc.src.string.strcpy + libc.src.string.strlen ) add_libc_unittest( @@ -23,10 +23,10 @@ SRCS strcpy_test.cpp DEPENDS - strcpy - strlen -# TODO (sivachandra): remove redundant deps. - memcpy + # TODO (sivachandra): remove redundant deps. + libc.src.string.memcpy + libc.src.string.strcpy + libc.src.string.strlen ) add_libc_unittest( @@ -36,13 +36,13 @@ SRCS strlen_test.cpp DEPENDS - strlen + libc.src.string.strlen ) # Tests all implementations of memcpy that can run on the host. get_property(memcpy_implementations GLOBAL PROPERTY memcpy_implementations) foreach(memcpy_config_name IN LISTS memcpy_implementations) - get_target_property(require_cpu_features ${memcpy_config_name} REQUIRE_CPU_FEATURES) + get_target_property(require_cpu_features libc.src.string.${memcpy_config_name} REQUIRE_CPU_FEATURES) host_supports(can_run "${require_cpu_features}") if(can_run) add_libc_unittest( @@ -52,7 +52,7 @@ SRCS memcpy_test.cpp DEPENDS - ${memcpy_config_name} + libc.src.string.${memcpy_config_name} ) else() message(STATUS "Skipping test for '${memcpy_config_name}' insufficient host cpu features") diff --git a/libc/test/src/string/memory_utils/CMakeLists.txt b/libc/test/src/string/memory_utils/CMakeLists.txt --- a/libc/test/src/string/memory_utils/CMakeLists.txt +++ b/libc/test/src/string/memory_utils/CMakeLists.txt @@ -6,12 +6,12 @@ utils_test.cpp memcpy_utils_test.cpp DEPENDS - memory_utils - standalone_cpp + libc.src.string.memory_utils.memory_utils + libc.utils.CPP.standalone_cpp ) target_compile_definitions( - utils_test + libc.test.src.string.memory_utils.utils_test PRIVATE LLVM_LIBC_MEMCPY_MONITOR=memcpy_monitor ) diff --git a/libc/test/src/sys/mman/linux/CMakeLists.txt b/libc/test/src/sys/mman/linux/CMakeLists.txt --- a/libc/test/src/sys/mman/linux/CMakeLists.txt +++ b/libc/test/src/sys/mman/linux/CMakeLists.txt @@ -7,9 +7,9 @@ SRCS mmap_test.cpp DEPENDS - errno_h - sys_mman_h - mmap - munmap - __errno_location + libc.include.errno + libc.include.sys_mman + libc.src.errno.__errno_location + libc.src.sys.mman.mmap + libc.src.sys.mman.munmap ) diff --git a/libc/test/src/threads/CMakeLists.txt b/libc/test/src/threads/CMakeLists.txt --- a/libc/test/src/threads/CMakeLists.txt +++ b/libc/test/src/threads/CMakeLists.txt @@ -7,12 +7,12 @@ SRCS thrd_test.cpp DEPENDS - __errno_location - mmap - munmap - threads_h - thrd_create - thrd_join + libc.include.threads + libc.src.errno.__errno_location + libc.src.sys.mman.munmap + libc.src.sys.mman.mmap + libc.src.threads.thrd_create + libc.src.threads.thrd_join ) add_libc_unittest( @@ -22,13 +22,13 @@ SRCS mtx_test.cpp DEPENDS - __errno_location - mmap - munmap - mtx_init - mtx_lock - mtx_unlock - thrd_create - thrd_join - threads_h + libc.include.threads + libc.src.errno.__errno_location + libc.src.sys.mman.mmap + libc.src.sys.mman.munmap + libc.src.threads.mtx_init + libc.src.threads.mtx_lock + libc.src.threads.mtx_unlock + libc.src.threads.thrd_create + libc.src.threads.thrd_join ) diff --git a/libc/utils/UnitTest/CMakeLists.txt b/libc/utils/UnitTest/CMakeLists.txt --- a/libc/utils/UnitTest/CMakeLists.txt +++ b/libc/utils/UnitTest/CMakeLists.txt @@ -6,5 +6,5 @@ LINK_COMPONENTS Support ) target_include_directories(LibcUnitTest PUBLIC ${LIBC_SOURCE_DIR}) -add_dependencies(LibcUnitTest standalone_cpp) +add_dependencies(LibcUnitTest libc.utils.CPP.standalone_cpp) target_link_libraries(LibcUnitTest PUBLIC libc_test_utils)