[libc] Small improvements to libc cmake

This patch includes:
1. Better error message when cmake finds incompatible triple
2. Added missing header dependencies libc/include/CMakeLists.txt as per
   app.td
3. Removed unused $LLVM_LIBC_INCLUDE_DIRS cmake variable

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D145496
This commit is contained in:
Mikhail R. Gadelha 2023-03-07 09:53:34 -03:00
parent e510d0bda0
commit 0ffea21893
6 changed files with 44 additions and 32 deletions

View File

@ -178,8 +178,8 @@ if(explicit_target_triple AND
set(LIBC_CROSSBUILD TRUE)
if(CMAKE_COMPILER_IS_GNUCXX)
message(FATAL_ERROR
"GCC target triple and the explicity specified target triple do "
"not match.")
"GCC target triple (${libc_compiler_triple}) and the explicity "
"specified target triple (${explicit_target_triple}) do not match.")
else()
list(APPEND
LIBC_COMPILE_OPTIONS_DEFAULT "--target=${explicit_target_triple}")

View File

@ -108,9 +108,6 @@ def SchedAPI : PublicAPI<"sched.h"> {
def SysMManAPI : PublicAPI<"sys/mman.h"> {
let Types = ["off_t", "size_t"];
let Macros = [
];
}
def SignalAPI : PublicAPI<"signal.h"> {
@ -177,7 +174,8 @@ def DirentAPI : PublicAPI<"dirent.h"> {
}
def UniStdAPI : PublicAPI<"unistd.h"> {
let Types = ["__exec_argv_t", "__exec_envp_t", "off_t", "pid_t", "size_t", "ssize_t", "uid_t", "__getoptargv_t"];
let Types = ["__exec_argv_t", "__exec_envp_t", "off_t", "pid_t", "size_t",
"ssize_t", "uid_t", "__getoptargv_t"];
}
def SysRandomAPI : PublicAPI<"sys/random.h"> {
@ -185,7 +183,8 @@ def SysRandomAPI : PublicAPI<"sys/random.h"> {
}
def SysSelectAPI : PublicAPI<"sys/select.h"> {
let Types = ["fd_set", "sigset_t", "suseconds_t", "time_t", "struct timespec", "struct timeval"];
let Types = ["fd_set", "sigset_t", "suseconds_t", "time_t", "struct timespec",
"struct timeval"];
}
def SysResourceAPI : PublicAPI<"sys/resource.h"> {

View File

@ -24,8 +24,8 @@ add_gen_header(
GEN_HDR dirent.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.DIR
.llvm-libc-types.ino_t
.llvm-libc-types.DIR
.llvm-libc-types.struct_dirent
)
@ -124,12 +124,12 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.time_macros
.llvm-libc-types.time_t
.llvm-libc-types.clock_t
.llvm-libc-types.clockid_t
.llvm-libc-types.time_t
.llvm-libc-types.struct_tm
.llvm-libc-types.struct_timespec
.llvm-libc-types.struct_timeval
.llvm-libc-types.clockid_t
)
add_gen_header(
@ -139,11 +139,11 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.__call_once_func_t
.llvm-libc-types.once_flag
.llvm-libc-types.cnd_t
.llvm-libc-types.mtx_t
.llvm-libc-types.once_flag
.llvm-libc-types.thrd_start_t
.llvm-libc-types.thrd_t
.llvm-libc-types.thrd_start_t
.llvm-libc-types.tss_t
.llvm-libc-types.tss_dtor_t
)
@ -166,11 +166,12 @@ add_gen_header(
../config/${LIBC_TARGET_OS}/signal.h.in
DEPENDS
.llvm-libc-macros.signal_macros
.llvm-libc-types.__sighandler_t
.llvm-libc-types.sigset_t
.llvm-libc-types.sig_atomic_t
.llvm-libc-types.stack_t
.llvm-libc-types.sigset_t
.llvm-libc-types.struct_sigaction
.llvm-libc-types.union_sigval
.llvm-libc-types.siginfo_t
.llvm-libc-types.stack_t
.llvm-libc-types.pid_t
)
@ -182,10 +183,9 @@ add_gen_header(
.llvm_libc_common_h
.llvm-libc-macros.file_seek_macros
.llvm-libc-macros.stdio_macros
.llvm-libc-types.cookie_io_functions_t
.llvm-libc-types.FILE
.llvm-libc-types.off_t
.llvm-libc-types.size_t
.llvm-libc-types.FILE
.llvm-libc-types.cookie_io_functions_t
)
add_gen_header(
@ -195,12 +195,12 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.stdlib_macros
.llvm-libc-types.__bsearchcompare_t
.llvm-libc-types.__qsortcompare_t
.llvm-libc-types.div_t
.llvm-libc-types.ldiv_t
.llvm-libc-types.lldiv_t
.llvm-libc-types.size_t
.llvm-libc-types.__bsearchcompare_t
.llvm-libc-types.__qsortcompare_t
.llvm-libc-types.__atexithandler_t
)
@ -229,15 +229,15 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.__atfork_callback_t
.llvm-libc-types.__pthread_once_func_t
.llvm-libc-types.__pthread_start_t
.llvm-libc-types.__pthread_tss_dtor_t
.llvm-libc-types.pthread_attr_t
.llvm-libc-types.pthread_key_t
.llvm-libc-types.pthread_mutex_t
.llvm-libc-types.pthread_mutexattr_t
.llvm-libc-types.pthread_once_t
.llvm-libc-types.__pthread_once_func_t
.llvm-libc-types.pthread_t
.llvm-libc-types.pthread_key_t
.llvm-libc-types.pthread_once_t
)
add_gen_header(
@ -246,8 +246,10 @@ add_gen_header(
GEN_HDR sched.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.cpu_set_t
.llvm-libc-macros.sched_macros
.llvm-libc-types.pid_t
.llvm-libc-types.size_t
.llvm-libc-types.cpu_set_t
)
add_gen_header(
@ -291,9 +293,9 @@ add_gen_header(
GEN_HDR sys/mman.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_mman_macros
.llvm-libc-types.off_t
.llvm-libc-types.ssize_t
.llvm-libc-macros.sys_mman_macros
)
add_gen_header(
@ -311,8 +313,8 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_random_macros
.llvm-libc-types.ssize_t
.llvm-libc-types.size_t
.llvm-libc-types.ssize_t
)
add_gen_header(
@ -334,6 +336,16 @@ add_gen_header(
.llvm_libc_common_h
.llvm-libc-macros.sys_stat_macros
.llvm-libc-types.mode_t
.llvm-libc-types.dev_t
.llvm-libc-types.ino_t
.llvm-libc-types.nlink_t
.llvm-libc-types.uid_t
.llvm-libc-types.gid_t
.llvm-libc-types.off_t
.llvm-libc-types.struct_timespec
.llvm-libc-types.struct_timeval
.llvm-libc-types.blksize_t
.llvm-libc-types.blkcnt_t
.llvm-libc-types.struct_stat
)
@ -346,11 +358,10 @@ add_gen_header(
.llvm-libc-macros.sys_select_macros
.llvm-libc-types.fd_set
.llvm-libc-types.sigset_t
.llvm-libc-types.struct_timespec
.llvm-libc-types.struct_timeval
.llvm-libc-types.suseconds_t
.llvm-libc-types.time_t
.llvm-libc-types.ssize_t
.llvm-libc-types.struct_timespec
.llvm-libc-types.struct_timeval
)
add_gen_header(
@ -360,6 +371,7 @@ add_gen_header(
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.off_t
.llvm-libc-types.size_t
.llvm-libc-types.ssize_t
)
@ -449,6 +461,7 @@ add_gen_header(
.llvm_libc_common_h
.llvm-libc-macros.termios_macros
.llvm-libc-types.cc_t
.llvm-libc-types.pid_t
.llvm-libc-types.speed_t
.llvm-libc-types.struct_termios
.llvm-libc-types.tcflag_t

View File

@ -19,5 +19,5 @@ add_entrypoint_object(
DEPENDS
libc.include.stdlib
libc.src.signal.raise
._Exit
libc.src.stdlib._Exit
)

View File

@ -14,7 +14,7 @@ add_tablegen(libc-hdrgen LIBC
PublicAPICommand.h
)
target_include_directories(libc-hdrgen PRIVATE ${LIBC_SOURCE_DIR} ${LLVM_LIBC_INCLUDE_DIRS})
target_include_directories(libc-hdrgen PRIVATE ${LIBC_SOURCE_DIR})
target_link_libraries(libc-hdrgen PRIVATE LibcTableGenUtil)
add_subdirectory(PrototypeTestGen)

View File

@ -4,4 +4,4 @@ add_llvm_library(
APIIndexer.h
LINK_COMPONENTS Support TableGen
)
target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR} ${LLVM_LIBC_INCLUDE_DIRS})
target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR})