Skip to content

[libc] Annex K: strcpy_s#197709

Open
vhscampos wants to merge 1 commit into
users/vhscampos/libc-annex-k-constraint_handler_checking_test_unitfrom
users/vhscampos/libc-annex-k-strcpy_s
Open

[libc] Annex K: strcpy_s#197709
vhscampos wants to merge 1 commit into
users/vhscampos/libc-annex-k-constraint_handler_checking_test_unitfrom
users/vhscampos/libc-annex-k-strcpy_s

Conversation

@vhscampos
Copy link
Copy Markdown
Member

This patch adds Annex K's strcpy_s.

This patch adds Annex K's `strcpy_s`.
@llvmorg-github-actions
Copy link
Copy Markdown

@llvm/pr-subscribers-libc

Author: Victor Campos (vhscampos)

Changes

This patch adds Annex K's strcpy_s.


Full diff: https://github.com/llvm/llvm-project/pull/197709.diff

11 Files Affected:

  • (modified) libc/config/baremetal/aarch64/entrypoints.txt (+1)
  • (modified) libc/config/baremetal/arm/entrypoints.txt (+1)
  • (modified) libc/config/linux/aarch64/entrypoints.txt (+1)
  • (modified) libc/config/linux/arm/entrypoints.txt (+1)
  • (modified) libc/config/linux/x86_64/entrypoints.txt (+1)
  • (modified) libc/include/string.yaml (+9)
  • (modified) libc/src/string/CMakeLists.txt (+19)
  • (added) libc/src/string/strcpy_s.cpp (+71)
  • (added) libc/src/string/strcpy_s.h (+22)
  • (modified) libc/test/src/string/CMakeLists.txt (+13)
  • (added) libc/test/src/string/strcpy_s_test.cpp (+122)
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 452abd985b3a5..110538f8b6be5 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -75,6 +75,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.strcmp
     libc.src.string.strcoll
     libc.src.string.strcpy
+    libc.src.string.strcpy_s
     libc.src.string.strcspn
     libc.src.string.strdup
     libc.src.string.strerror
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 41c80efc64227..69d13fa293e6e 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -75,6 +75,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.strcmp
     libc.src.string.strcoll
     libc.src.string.strcpy
+    libc.src.string.strcpy_s
     libc.src.string.strcspn
     libc.src.string.strdup
     libc.src.string.strerror
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index b7c9cabd934b4..30c3034fa7f28 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -68,6 +68,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.strcmp
     libc.src.string.strcoll
     libc.src.string.strcpy
+    libc.src.string.strcpy_s
     libc.src.string.strcspn
     libc.src.string.strdup
     libc.src.string.strerror
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 906f36d45e337..f006c5476a6e0 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -41,6 +41,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.strchrnul
     libc.src.string.strcmp
     libc.src.string.strcpy
+    libc.src.string.strcpy_s
     libc.src.string.strcspn
     libc.src.string.strlcat
     libc.src.string.strlcpy
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 9970f079abc08..dab5062d18d0c 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -70,6 +70,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.strcmp
     libc.src.string.strcoll
     libc.src.string.strcpy
+    libc.src.string.strcpy_s
     libc.src.string.strcspn
     libc.src.string.strdup
     libc.src.string.strerror
diff --git a/libc/include/string.yaml b/libc/include/string.yaml
index c0a96e58dbc94..234cc6e77cfd4 100644
--- a/libc/include/string.yaml
+++ b/libc/include/string.yaml
@@ -169,6 +169,15 @@ functions:
     arguments:
       - type: char *__restrict
       - type: const char *__restrict
+  - name: strcpy_s
+    standards:
+      - stdc
+    return_type: errno_t
+    arguments:
+      - type: char *__restrict
+      - type: rsize_t
+      - type: const char *__restrict
+    guard: LIBC_HAS_ANNEX_K
   - name: strcspn
     standards:
       - stdc
diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt
index e28fe7af8cf25..accf30e865ad9 100644
--- a/libc/src/string/CMakeLists.txt
+++ b/libc/src/string/CMakeLists.txt
@@ -172,6 +172,25 @@ add_entrypoint_object(
     .string_utils
 )
 
+add_entrypoint_object(
+  strcpy_s
+  SRCS
+    strcpy_s.cpp
+  HDRS
+    strcpy_s.h
+  DEPENDS
+    .memory_utils.inline_memcpy
+    .string_utils
+    .strnlen_s
+    libc.src.__support.common
+    libc.src.__support.constraint_handler
+    libc.src.__support.macros.config
+    libc.hdr.types.constraint_handler_t
+    libc.hdr.types.errno_t
+    libc.hdr.types.rsize_t
+    libc.hdr.stdint_proxy
+)
+
 add_entrypoint_object(
   strcspn
   SRCS
diff --git a/libc/src/string/strcpy_s.cpp b/libc/src/string/strcpy_s.cpp
new file mode 100644
index 0000000000000..7553d2284d906
--- /dev/null
+++ b/libc/src/string/strcpy_s.cpp
@@ -0,0 +1,71 @@
+//===-- Implementation of strcpy_s ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// For RSIZE_MAX
+#define __STDC_WANT_LIB_EXT1__ 1
+#include "hdr/stdint_proxy.h"
+#undef __STDC_WANT_LIB_EXT1__
+
+#include "hdr/types/constraint_handler_t.h"
+#include "hdr/types/errno_t.h"
+#include "hdr/types/rsize_t.h"
+#include "src/__support/common.h"
+#include "src/__support/constraint_handler.h"
+#include "src/__support/macros/config.h"
+#include "src/string/memory_utils/inline_memcpy.h"
+#include "src/string/strcpy_s.h"
+#include "src/string/string_utils.h"
+#include "src/string/strnlen_s.h"
+
+#define ERRNO_T_FAIL 1
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(errno_t, strcpy_s,
+                   (char *__restrict s1, rsize_t s1max,
+                    const char *__restrict s2)) {
+  const char *constraint_violation_msg = 0;
+  size_t count;
+
+  if (s1 == 0) {
+    constraint_violation_msg = "strcpy_s: s1 is null";
+  } else if (s2 == 0) {
+    constraint_violation_msg = "strcpy_s: s2 is null";
+  } else if (s1max > RSIZE_MAX) {
+    constraint_violation_msg = "strcpy_s: s1max exceeds RSIZE_MAX";
+  } else if (s1max == 0) {
+    constraint_violation_msg = "strcpy_s: s1max is 0";
+  } else if (count = strnlen_s(s2, s1max);
+             s1max == count) { // count can't be greater than s1max by
+                               // definition, so no need to check for this case
+    constraint_violation_msg = "strcpy_s: s1max is too small for s2";
+  }
+  // Check overlap using the full regions defined by the standard, including the
+  // terminating null byte:
+  //   destination: [s1, s1 + s1max)
+  //   source:      [s2, s2 + count + 1)
+  // Use s1max for the destination's length, not count + 1, because the
+  // standard allows for overwriting the entire destination region, even if
+  // s2's length is smaller than s1max.
+  else if (s2 < (s1 + s1max) && s1 < (s2 + count + 1)) {
+    constraint_violation_msg = "strcpy_s: s1 and s2 overlap";
+  }
+
+  if (constraint_violation_msg) {
+    if (s1 != 0 && s1max > 0 && s1max <= RSIZE_MAX) {
+      s1[0] = '\0';
+    }
+    libc_global_constraint_handler(constraint_violation_msg, 0, ERRNO_T_FAIL);
+    return ERRNO_T_FAIL;
+  }
+
+  inline_memcpy(s1, s2, count + 1);
+  return 0;
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/string/strcpy_s.h b/libc/src/string/strcpy_s.h
new file mode 100644
index 0000000000000..7a38f8dbbf890
--- /dev/null
+++ b/libc/src/string/strcpy_s.h
@@ -0,0 +1,22 @@
+//===-- Implementation header for strcpy_s ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_STRING_STRCPY_S_H
+#define LLVM_LIBC_SRC_STRING_STRCPY_S_H
+
+#include "hdr/types/errno_t.h"
+#include "hdr/types/rsize_t.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+errno_t strcpy_s(char *__restrict s1, rsize_t s1max, const char *__restrict s2);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_STRING_STRCPY_S_H
diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt
index 17927ea93ed1e..e79d8e6257f5d 100644
--- a/libc/test/src/string/CMakeLists.txt
+++ b/libc/test/src/string/CMakeLists.txt
@@ -149,6 +149,19 @@ add_libc_test(
     libc.src.string.strcpy
 )
 
+add_libc_test(
+  strcpy_s_test
+  SUITE
+    libc-string-tests
+  SRCS
+    strcpy_s_test.cpp
+  DEPENDS
+    libc.src.string.strcpy_s
+    libc.hdr.stdint_proxy
+    libc.hdr.types.errno_t
+    libc.test.UnitTest.ConstraintHandlerCheckingTest
+)
+
 add_libc_test(
   strcspn_test
   SUITE
diff --git a/libc/test/src/string/strcpy_s_test.cpp b/libc/test/src/string/strcpy_s_test.cpp
new file mode 100644
index 0000000000000..40625337b001f
--- /dev/null
+++ b/libc/test/src/string/strcpy_s_test.cpp
@@ -0,0 +1,122 @@
+//===-- Unittests for strcpy_s --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#define __STDC_WANT_LIB_EXT1__ 1
+#include "hdr/stdint_proxy.h"
+#undef __STDC_WANT_LIB_EXT1__
+
+#include "hdr/types/errno_t.h"
+#include "src/string/strcpy_s.h"
+#include "test/UnitTest/ConstraintHandlerCheckingTest.h"
+
+using LlvmLibcStrCpySTest =
+    LIBC_NAMESPACE::testing::ConstraintHandlerCheckingTest;
+
+// Success cases
+TEST_F(LlvmLibcStrCpySTest, SuccessfulCopy) {
+  char s1[8];
+  const char *s2 = "abc";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, sizeof(s1), s2);
+  ASSERT_EQ(result, 0);
+  ASSERT_STREQ(s1, s2);
+  ASSERT_STREQ(buffer, "");
+}
+
+TEST_F(LlvmLibcStrCpySTest, ExactFitSuccessfulCopy) {
+  char s1[4];
+  const char *s2 = "abc";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, sizeof(s1), s2);
+  ASSERT_EQ(result, 0);
+  ASSERT_STREQ(s1, s2);
+  ASSERT_STREQ(buffer, "");
+}
+
+TEST_F(LlvmLibcStrCpySTest, AdjacentObjectsDoNotOverlap) {
+  char s[8] = {'a', 'b', 'c', '\0', '?', '?', '?', '?'};
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s + 4, 4, s);
+  ASSERT_EQ(result, 0);
+  ASSERT_STREQ(s + 4, "abc");
+  ASSERT_STREQ(buffer, "");
+}
+
+TEST_F(LlvmLibcStrCpySTest, EmptySourceString) {
+  char s1[4];
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, sizeof(s1), "");
+  ASSERT_EQ(result, 0);
+  ASSERT_EQ(s1[0], '\0');
+  ASSERT_STREQ(buffer, "");
+}
+
+// Failure cases
+TEST_F(LlvmLibcStrCpySTest, NullS1) {
+  const char *s2 = "abc";
+  char *s1 = 0;
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, 4, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_STREQ(buffer, "strcpy_s: s1 is null");
+}
+
+TEST_F(LlvmLibcStrCpySTest, NullS2) {
+  char s1[4];
+  const char *s2 = 0;
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, 4, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_EQ(s1[0], '\0');
+  ASSERT_STREQ(buffer, "strcpy_s: s2 is null");
+}
+
+TEST_F(LlvmLibcStrCpySTest, S1MaxGreaterThanRSizeMax) {
+  char s1[4];
+  const char *s2 = "abc";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, RSIZE_MAX + 1, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_STREQ(buffer, "strcpy_s: s1max exceeds RSIZE_MAX");
+}
+
+TEST_F(LlvmLibcStrCpySTest, S1MaxIsZero) {
+  char s1[4];
+  const char *s2 = "abc";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, 0, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_STREQ(buffer, "strcpy_s: s1max is 0");
+}
+
+TEST_F(LlvmLibcStrCpySTest, S1MaxTooSmallForS2) {
+  char s1[3];
+  const char *s2 = "abc";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s1, 3, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_EQ(s1[0], '\0');
+  ASSERT_STREQ(buffer, "strcpy_s: s1max is too small for s2");
+
+  s2 = "abcd";
+  s1[0] = '?';
+  buffer[0] = '\0';
+  result = LIBC_NAMESPACE::strcpy_s(s1, 3, s2);
+  ASSERT_NE(result, 0);
+  ASSERT_EQ(s1[0], '\0');
+  ASSERT_STREQ(buffer, "strcpy_s: s1max is too small for s2");
+}
+
+TEST_F(LlvmLibcStrCpySTest, OverlappingObjects) {
+  char s[10] = "123456789";
+
+  errno_t result = LIBC_NAMESPACE::strcpy_s(s, 6, s + 4);
+  ASSERT_NE(result, 0);
+  ASSERT_EQ(s[0], '\0');
+  ASSERT_STREQ(buffer, "strcpy_s: s1 and s2 overlap");
+}

@github-actions
Copy link
Copy Markdown

🐧 Linux x64 Test Results

The build failed before running any tests. Click on a failure below to see the details.

runtimes/runtimes-stamps/runtimes-configure /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-stamps/runtimes-configure
Not searching for unused variables given on the command line.
loading initial cache file /home/gha/actions-runner/_work/llvm-project/llvm-project/build/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Performing bootstrapping runtimes build.
-- The C compiler identification is Clang 23.0.0
-- The CXX compiler identification is Clang 23.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.3")
-- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG
-- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG - Success
-- Performing Test C_SUPPORTS_START_NO_UNUSED_ARGUMENTS
-- Performing Test C_SUPPORTS_START_NO_UNUSED_ARGUMENTS - Success
-- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG
-- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG - Success
-- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG
-- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG - Success
-- Linker detection: LLD
-- Performing Test SUPPORTS_LIBCXX_HARDENING_MODE
-- Performing Test SUPPORTS_LIBCXX_HARDENING_MODE - Failed
-- Performing Test LLVM_USES_LIBSTDCXX
-- Performing Test LLVM_USES_LIBSTDCXX - Failed
-- Performing Test LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI
-- Performing Test LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI - Failed
-- Performing Test _CAN_LINK_EXECUTABLE
-- Performing Test _CAN_LINK_EXECUTABLE - Success
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Success
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Success
-- Precompiled headers enabled.
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Looking for flock
-- Looking for flock - found
-- Found Python3: /usr/bin/python3 (found version "3.12.3") found components: Interpreter
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Doxygen disabled.
-- Setting LIBC_NAMESPACE namespace to '__llvm_libc_23_0_0_git'
-- Set COMPILER_RESOURCE_DIR to /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23 using --print-resource-dir
-- Building libc for x86_64 on linux with LIBC_COMPILE_OPTIONS_DEFAULT:
-- LIBC_COPT_USE_C_ASSERT: OFF
-- LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR: ON
-- LIBC_CONF_KEEP_FRAME_POINTER: ON
-- LIBC_CONF_CTYPE_SMALLER_ASCII: OFF
-- LIBC_CONF_ERRNO_MODE: LIBC_ERRNO_MODE_DEFAULT
-- LIBC_CONF_TRAP_ON_RAISE_FP_EXCEPT: OFF
-- LIBC_ADD_NULL_CHECKS: ON
-- LIBC_CONF_FREXP_INF_NAN_EXPONENT:
-- LIBC_CONF_MATH_OPTIMIZATIONS: 0
-- LIBC_CONF_MATH_USE_SYSTEM_FENV: OFF
-- LIBC_CONF_PRINTF_DISABLE_FIXED_POINT: OFF
-- LIBC_CONF_PRINTF_DISABLE_FLOAT: OFF
-- LIBC_CONF_PRINTF_DISABLE_INDEX_MODE: OFF
-- LIBC_CONF_PRINTF_DISABLE_STRERROR: OFF
-- LIBC_CONF_PRINTF_DISABLE_WIDE: OFF
-- LIBC_CONF_PRINTF_DISABLE_WRITE_INT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_NO_SPECIALIZE_LD: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_DYADIC_FLOAT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_FLOAT320: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE: OFF
-- LIBC_CONF_PRINTF_MODULAR: OFF
-- LIBC_CONF_PRINTF_RUNTIME_DISPATCH: ON
-- LIBC_COPT_PRINTF_DISABLE_BITINT: OFF
-- LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY: ON
-- LIBC_CONF_QSORT_IMPL: LIBC_QSORT_QUICK_SORT
-- LIBC_CONF_SCANF_DISABLE_FLOAT: OFF
-- LIBC_CONF_SCANF_DISABLE_INDEX_MODE: OFF
-- LIBC_CONF_SETJMP_AARCH64_RESTORE_PLATFORM_REGISTER: ON
-- LIBC_CONF_STRTOFLOAT_DISABLE_CLINGER_FAST_PATH: OFF
-- LIBC_CONF_STRTOFLOAT_DISABLE_EISEL_LEMIRE: OFF
-- LIBC_CONF_STRTOFLOAT_DISABLE_SIMPLE_DECIMAL_CONVERSION: OFF
-- LIBC_CONF_COPT_MEMCPY_X86_USE_NTA_STORES: OFF
-- LIBC_CONF_FIND_FIRST_CHARACTER_IMPL: element
-- LIBC_CONF_MEMSET_X86_USE_SOFTWARE_PREFETCHING: OFF
-- LIBC_CONF_STRING_LENGTH_IMPL: element
-- LIBC_CONF_THREAD_MODE: LIBC_THREAD_MODE_PLATFORM
-- LIBC_CONF_TIME_64BIT: OFF
-- LIBC_CONF_WCTYPE_MODE: LIBC_WCTYPE_MODE_ASCII
-- Writing config doc to /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-bins/libc/docs/configure.rst
-- Overriding - LIBC_CONF_FIND_FIRST_CHARACTER_IMPL: word (Previous value: element)
-- Overriding - LIBC_CONF_STRING_LENGTH_IMPL: clang_vector (Previous value: element)
-- Set CPU features: AVX;AVX2;AVX512BW;AVX512F;FMA;SSE2;SSE4_2
-- Compiler features available: builtin_fmax_fmin;builtin_isnan;cfloat128;cfloat16;ext_vector_type;fixed_point;float128;float16
-- Performing Test LIBC_CC_SUPPORTS_PATTERN_INIT
-- Performing Test LIBC_CC_SUPPORTS_PATTERN_INIT - Success
-- Performing Test LIBC_CC_SUPPORTS_NOSTDLIBPP
-- Performing Test LIBC_CC_SUPPORTS_NOSTDLIBPP - Success
-- Performing Test LIBC_CC_SUPPORTS_NOSTDLIBINC
-- Performing Test LIBC_CC_SUPPORTS_NOSTDLIBINC - Success
-- Looking for SYS_faccessat2
-- Looking for SYS_faccessat2 - found
-- Using getrandom for hashtable randomness
CMake Warning at /home/gha/actions-runner/_work/llvm-project/llvm-project/libc/utils/MPFRWrapper/CMakeLists.txt:28 (message):
Math tests using MPFR will be skipped.


CMake Warning at /home/gha/actions-runner/_work/llvm-project/llvm-project/libc/utils/MPFRWrapper/CMakeLists.txt:58 (message):
Math tests using MPFR will be skipped.


CMake Warning at /home/gha/actions-runner/_work/llvm-project/llvm-project/libc/utils/MPCWrapper/CMakeLists.txt:33 (message):
Math tests using MPC will be skipped.


CMake Error at /home/gha/actions-runner/_work/llvm-project/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:5 (get_target_property):
get_target_property() called with non-existent target
"libc.src.__support.constraint_handler".
Call Stack (most recent call first):
/home/gha/actions-runner/_work/llvm-project/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:35 (collect_object_file_deps)
/home/gha/actions-runner/_work/llvm-project/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:61 (collect_object_file_deps)
/home/gha/actions-runner/_work/llvm-project/llvm-project/libc/cmake/modules/LLVMLibCLibraryRules.cmake:144 (get_all_object_file_deps)
/home/gha/actions-runner/_work/llvm-project/llvm-project/libc/lib/CMakeLists.txt:22 (add_entrypoint_library)


-- TestLogger will use system libc's stdio to print.
-- Configuring incomplete, errors occurred!
FAILED: runtimes/runtimes-stamps/runtimes-configure /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-stamps/runtimes-configure
cd /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-bins && /usr/bin/cmake -DLLVM_EXTERNAL_LIBC_SOURCE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/runtimes/../../libc --no-warn-unused-cli -DCMAKE_C_COMPILER=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang -DCMAKE_LINKER=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/ld.lld -DCMAKE_AR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-ranlib -DCMAKE_NM=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-strip -DCMAKE_READELF=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_Fortran_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_ASM_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_INSTALL_PREFIX=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/install -DLLVM_BINARY_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build -DLLVM_CONFIG_PATH=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-config -DLLVM_ENABLE_WERROR=ON -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF "-DLLVM_LIT_ARGS=-v --xunit-xml-output /home/gha/actions-runner/_work/llvm-project/llvm-project/build/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct" -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=23.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=ON -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DLLVM_ENABLE_DOXYGEN=OFF -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_Fortran_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON -DCLANG_RESOURCE_DIR= -DLLVM_EXTERNAL_LIBC_SOURCE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/runtimes/../../libc -DCMAKE_PREFIX_PATH=/home/gha/.local -DCOMPILER_RT_TEST_EXTERNAL_BUILTINS=ON -DLLVM_ENABLE_RUNTIMES=libc -DLLVM_USE_LINKER=lld -DLIBCLANG_BUILD_STATIC=OFF -DLIBCLANG_LIBRARY_VERSION=23 -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_HARDENING_MODE=extensive -DLIBCXX_HARDENING_MODE_SPELLING=_LIBCPP_HARDENING_MODE_EXTENSIVE -DLIBC_GPU_BUILD=OFF -DLLVM_LIBCXX_USED=0 -DLIBC_GPU_BUILD=OFF -DRUNTIMES_CMAKE_ARGS=-DLLVM_EXTERNAL_LIBC_SOURCE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/runtimes/../../libc -GNinja -C/home/gha/actions-runner/_work/llvm-project/llvm-project/build/projects/runtimes/tmp/runtimes-cache-Release.cmake -S /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/runtimes/../../runtimes -B /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-bins && /usr/bin/cmake -E touch /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-stamps/runtimes-configure

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant