llvm/libc/src/signal/linux/CMakeLists.txt

add_header_library(
  signal_utils
  HDRS
    signal_utils.h
  DEPENDS
    libc.hdr.types.sigset_t
    libc.include.signal
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
)

add_entrypoint_object(
  kill
  SRCS
    kill.cpp
  HDRS
    ../kill.h
  DEPENDS
    libc.include.signal
    libc.src.errno.errno
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
)

add_entrypoint_object(
  raise
  SRCS
    raise.cpp
  HDRS
    ../raise.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
)

add_object_library(
  __restore
  SRCS
    __restore.cpp
  COMPILE_OPTIONS
    -fomit-frame-pointer
    -O3
    -Wframe-larger-than=0
    -Wno-attributes
    # asan creates asan.module_ctor which uses stack space, causing warnings.
    -fno-sanitize=address
  DEPENDS
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
)

add_entrypoint_object(
  sigaction
  SRCS
    sigaction.cpp
  HDRS
    ../sigaction.h
  DEPENDS
    .__restore
    libc.hdr.types.sigset_t
    libc.hdr.types.struct_sigaction
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
    libc.src.errno.errno
)

add_entrypoint_object(
  sigaltstack
  SRCS
    sigaltstack.cpp
  HDRS
    ../sigaltstack.h
  DEPENDS
    libc.include.signal
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
    libc.src.errno.errno
    libc.hdr.types.stack_t
)

add_entrypoint_object(
  sigprocmask
  SRCS
    sigprocmask.cpp
  HDRS
    ../sigprocmask.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.include.sys_syscall
    libc.src.__support.OSUtil.osutil
    libc.src.errno.errno
)

add_entrypoint_object(
  sigemptyset
  SRCS
    sigemptyset.cpp
  HDRS
    ../sigemptyset.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.src.errno.errno
)

add_entrypoint_object(
  sigaddset
  SRCS
    sigaddset.cpp
  HDRS
    ../sigaddset.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.src.errno.errno
)

add_entrypoint_object(
  signal
  SRCS
    signal.cpp
  HDRS
    ../signal.h
  DEPENDS
    .sigaction
    libc.hdr.signal_macros
    libc.hdr.types.sighandler_t
)

add_entrypoint_object(
  sigfillset
  SRCS
    sigfillset.cpp
  HDRS
    ../sigfillset.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.src.errno.errno
)

add_entrypoint_object(
  sigdelset
  SRCS
    sigdelset.cpp
  HDRS
    ../sigdelset.h
  DEPENDS
    .signal_utils
    libc.hdr.types.sigset_t
    libc.src.errno.errno
)