Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package aws-c-common for openSUSE:Factory 
checked in at 2024-04-07 22:10:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/aws-c-common (Old)
 and      /work/SRC/openSUSE:Factory/.aws-c-common.new.1905 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "aws-c-common"

Sun Apr  7 22:10:30 2024 rev:4 rq:1165448 version:0.9.15

Changes:
--------
--- /work/SRC/openSUSE:Factory/aws-c-common/aws-c-common.changes        
2024-03-18 16:46:47.579903120 +0100
+++ /work/SRC/openSUSE:Factory/.aws-c-common.new.1905/aws-c-common.changes      
2024-04-07 22:12:45.457437874 +0200
@@ -1,0 +2,12 @@
+Thu Apr  4 15:35:28 UTC 2024 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- Update to version 0.9.15
+  * Claim range for aws-crt-kotlin by @aajtodd in (#1095)
+  * Remove unused external headers by @TingDaoK in (#1097)
+  * Best Effort Thread Pinning to CPU_ID by @waahm7 in (#1096)
+  * Add support for WIN ARM64 by @alfred2g in (#1092)
+  * Better vectorization and crc64. Cleaned up cmake and
+    added better runtime cpu detection by @JonathanHenson in (#1083)
+  * Avoid overallocating for strings by @DmitriyMusatkin in (#1099)
+
+-------------------------------------------------------------------

Old:
----
  v0.9.14.tar.gz

New:
----
  v0.9.15.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ aws-c-common.spec ++++++
--- /var/tmp/diff_new_pack.6WgArI/_old  2024-04-07 22:12:45.877453257 +0200
+++ /var/tmp/diff_new_pack.6WgArI/_new  2024-04-07 22:12:45.877453257 +0200
@@ -19,7 +19,7 @@
 %define library_version 1.0.0
 %define library_soversion 1
 Name:           aws-c-common
-Version:        0.9.14
+Version:        0.9.15
 Release:        0
 Summary:        Core C99 package for AWS SDK for C
 License:        Apache-2.0

++++++ v0.9.14.tar.gz -> v0.9.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/CMakeLists.txt 
new/aws-c-common-0.9.15/CMakeLists.txt
--- old/aws-c-common-0.9.14/CMakeLists.txt      2024-03-05 18:16:27.000000000 
+0100
+++ new/aws-c-common-0.9.15/CMakeLists.txt      2024-04-03 00:36:01.000000000 
+0200
@@ -36,9 +36,6 @@
         "include/aws/common/*.inl"
         )
 
-file (GLOB AWS_COMMON_EXTERNAL_HEADERS
-        "include/aws/common/external/*.h")
-
 file (GLOB AWS_COMMON_EXTERNAL_INSTALLED_HEADERS
         "include/aws/common/external/ittnotify.h")
 
@@ -82,7 +79,7 @@
 
     list(APPEND PLATFORM_DEFINES WINDOWS_KERNEL_LIB=${WINDOWS_KERNEL_LIB})
     # PSAPI_VERSION=1 is needed to support GetProcessMemoryInfo on both pre and
-    # post Win7 OS's. 
+    # post Win7 OS's.
     list(APPEND PLATFORM_DEFINES PSAPI_VERSION=1)
     list(APPEND PLATFORM_LIBS bcrypt ${WINDOWS_KERNEL_LIB} ws2_32 shlwapi 
psapi)
 else ()
@@ -155,13 +152,17 @@
                 )
         endif()
     elseif (AWS_ARCH_ARM64 OR AWS_ARCH_ARM32)
-        if (MSVC)
+        if (WINDOWS)
             file(GLOB AWS_COMMON_ARCH_SRC
-                "source/arch/arm/msvc/*.c"
+                "source/arch/arm/windows/*.c"
                 )
-        elseif (AWS_HAVE_AUXV)
+        elseif(APPLE)
+            file(GLOB AWS_COMMON_ARCH_SRC
+                    "source/arch/arm/darwin/*.c"
+                    )
+        else()
             file(GLOB AWS_COMMON_ARCH_SRC
-                "source/arch/arm/asm/*.c"
+                "source/arch/arm/auxv/*.c"
                 )
         endif()
     endif()
@@ -173,7 +174,6 @@
         ${AWS_COMMON_HEADERS}
         ${AWS_COMMON_OS_HEADERS}
         ${AWS_COMMON_PRIV_HEADERS}
-        ${AWS_COMMON_EXTERNAL_HEADERS}
         ${AWS_TEST_HEADERS}
         )
 
@@ -225,7 +225,7 @@
 
 if (AWS_HAVE_AVX2_INTRINSICS)
     target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_SIMD_ENCODING)
-    simd_add_source_avx(${PROJECT_NAME} "source/arch/intel/encoding_avx2.c")
+    simd_append_source_and_features(${PROJECT_NAME} 
"source/arch/intel/encoding_avx2.c" ${AWS_AVX2_FLAG})
     message(STATUS "Building SIMD base64 decoder")
 endif()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/README.md 
new/aws-c-common-0.9.15/README.md
--- old/aws-c-common-0.9.14/README.md   2024-03-05 18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/README.md   2024-04-03 00:36:01.000000000 +0200
@@ -121,7 +121,7 @@
 | [0x3400, 0x3800) | aws-c-iot |
 | [0x3800, 0x3C00) | aws-c-s3 |
 | [0x3C00, 0x4000) | aws-c-sdkutils |
-| [0x4000, 0x4400) | (reserved for future project) |
+| [0x4000, 0x4400) | aws-crt-kotlin |
 | [0x4400, 0x4800) | (reserved for future project) |
 
 Each library should begin its error and log subject values at the beginning of 
its range and follow in sequence (don't skip codes). Upon
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/aws-c-common-0.9.14/bin/system_info/print_system_info.c 
new/aws-c-common-0.9.15/bin/system_info/print_system_info.c
--- old/aws-c-common-0.9.14/bin/system_info/print_system_info.c 2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/bin/system_info/print_system_info.c 2024-04-03 
00:36:01.000000000 +0200
@@ -3,6 +3,7 @@
 #include <aws/common/byte_buf.h>
 #include <aws/common/logging.h>
 #include <aws/common/system_info.h>
+#include <aws/common/cpuid.h>
 
 int main(void) {
     struct aws_allocator *allocator = aws_default_allocator();
@@ -39,6 +40,19 @@
         fprintf(stdout, "  'numa architecture': 'false'\n");
     }
 
+    fprintf(stdout, "   'cpu_capabilities': {\n");
+    fprintf(stdout, "       'arm_crc': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_CRC) ? "true" : "false");
+    fprintf(stdout, "       'arm_pmull': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_PMULL) ? "true" : "false");
+    fprintf(stdout, "       'arm_crypto': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_CRYPTO) ? "true" : "false");
+    fprintf(stdout, "       'amd_sse4_1': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_1) ? "true" : "false");
+    fprintf(stdout, "       'amd_sse4_2': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_2) ? "true" : "false");
+    fprintf(stdout, "       'amd_clmul': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_CLMUL) ? "true" : "false");
+    fprintf(stdout, "       'amd_vpclmulqdq': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_VPCLMULQDQ) ? "true" : "false");
+    fprintf(stdout, "       'amd_avx2': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_AVX2) ? "true" : "false");
+    fprintf(stdout, "       'amd_avx512': %s,\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_AVX512) ? "true" : "false");
+    fprintf(stdout, "       'amd_bmi2': %s\n", 
aws_cpu_has_feature(AWS_CPU_FEATURE_BMI2) ? "true" : "false");
+    fprintf(stdout, "   }\n");
+
     fprintf(stdout, "}\n");
     aws_system_environment_release(env);
     aws_logger_clean_up(&logger);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/cmake/AwsFeatureTests.cmake 
new/aws-c-common-0.9.15/cmake/AwsFeatureTests.cmake
--- old/aws-c-common-0.9.14/cmake/AwsFeatureTests.cmake 2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/cmake/AwsFeatureTests.cmake 2024-04-03 
00:36:01.000000000 +0200
@@ -17,6 +17,10 @@
     set(USE_CPU_EXTENSIONS OFF)
 endif()
 
+if (USE_CPU_EXTENSIONS)
+    set(AWS_USE_CPU_EXTENSIONS ON)
+endif()
+
 if(NOT CMAKE_CROSSCOMPILING)
     check_c_source_runs("
     #include <stdbool.h>
@@ -56,6 +60,15 @@
 
 check_c_source_compiles("
     int main() {
+#if !(defined(__x86_64__) || defined(_M_X64))
+#    error \"not intel\"
+#endif
+        return 0;
+    }
+" AWS_ARCH_INTEL_X64)
+
+check_c_source_compiles("
+    int main() {
 #if !(defined(__aarch64__) || defined(_M_ARM64))
 #    error \"not arm64\"
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/cmake/AwsSIMD.cmake 
new/aws-c-common-0.9.15/cmake/AwsSIMD.cmake
--- old/aws-c-common-0.9.14/cmake/AwsSIMD.cmake 2024-03-05 18:16:27.000000000 
+0100
+++ new/aws-c-common-0.9.15/cmake/AwsSIMD.cmake 2024-04-03 00:36:01.000000000 
+0200
@@ -4,35 +4,39 @@
 include(CheckCCompilerFlag)
 include(CheckIncludeFile)
 
+if (MSVC)
+    set(AWS_AVX2_FLAG "/arch:AVX2")
+    set(AWS_AVX512_FLAG "/arch:AVX512")
+    set(AWS_AVX512vL_FLAG "")
+    set(AWS_CLMUL_FLAG "")
+    set(AWS_SSE4_2_FLAG "")
+    set(AWS_ARMv8_1_FLAG "/arch:arm8.1")
+    set(WERROR_FLAG "")
+else()
+    set(AWS_AVX2_FLAG "-mavx -mavx2")
+    set(AWS_AVX512_FLAG "-mavx512f -mvpclmulqdq")
+    set(AWS_AVX512vL_FLAG "-mavx512vl")
+    set(AWS_CLMUL_FLAG "-mpclmul")
+    set(AWS_SSE4_2_FLAG "-msse4.2")
+    set(AWS_ARMv8_1_FLAG "-march=armv8-a+crc+crypto -mtune=neoverse-v1")
+    set(WERROR_FLAG "-Werror")
+endif()
+
 if (USE_CPU_EXTENSIONS)
-    if (MSVC)
-        check_c_compiler_flag("/arch:AVX2" HAVE_M_AVX2_FLAG)
-        if (HAVE_M_AVX2_FLAG)
-            set(AVX_CFLAGS "/arch:AVX2")
-        endif()
-    else()
-        check_c_compiler_flag(-mavx2 HAVE_M_AVX2_FLAG)
-        if (HAVE_M_AVX2_FLAG)
-            set(AVX_CFLAGS "-mavx -mavx2")
-        endif()
+    set(AVX_CFLAGS ${AWS_SSE4_2_FLAG})
+
+    check_c_compiler_flag(${AWS_AVX2_FLAG} HAVE_M_AVX2_FLAG)
+    if (HAVE_M_AVX2_FLAG)
+        set(AVX_CFLAGS "${AWS_AVX2_FLAG} ${AVX_CFLAGS}")
     endif()
 
-    if (MSVC)
-        check_c_compiler_flag("/arch:AVX512" HAVE_M_AVX512_FLAG)
-        if (HAVE_M_AVX512_FLAG)
-            # docs imply AVX512 brings in AVX2. And it will compile, but it 
will break at runtime on
-            # instructions such as _mm256_load_si256(). Leave it on.
-            set(AVX_CFLAGS "/arch:AVX512 /arch:AVX2")
-        endif()
-    else()
-        check_c_compiler_flag("-mavx512f -mvpclmulqdq" HAVE_M_AVX512_FLAG)
-        if (HAVE_M_AVX512_FLAG)
-            set(AVX_CFLAGS "-mavx512f -mvpclmulqdq -mpclmul -mavx -mavx2 
-msse4.2")
-        endif()
+    check_c_compiler_flag("${AWS_AVX512_FLAG} ${AWS_CLMUL_FLAG}" 
HAVE_M_AVX512_FLAG)
+    if (HAVE_M_AVX512_FLAG)
+        set(AVX_CFLAGS "${AWS_AVX512_FLAG} ${AWS_CLMUL_FLAG} ${AVX_CFLAGS}")
     endif()
 
     set(old_flags "${CMAKE_REQUIRED_FLAGS}")
-    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${AVX_CFLAGS}")
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${AVX_CFLAGS} 
${WERROR_FLAG}")
 
     check_c_source_compiles("
         #include <immintrin.h>
@@ -68,7 +72,35 @@
             return (int)_mm256_extract_epi64(vec, 2);
         }" AWS_HAVE_MM256_EXTRACT_EPI64)
 
+    check_c_source_compiles("
+        #include <wmmintrin.h>
+        #include <emmintrin.h>
+        int main() {
+            __m128i a = _mm_setzero_si128();
+            __m128i b = _mm_setzero_si128();
+            __m128i result = _mm_clmulepi64_si128(a, b, 0x00);
+            (void)result;
+            return 0;
+        }" AWS_HAVE_CLMUL)
+
+    set(CMAKE_REQUIRED_FLAGS "${old_flags} ${AWS_ARMv8_1_FLAG} ${WERROR_FLAG}")
+    check_c_source_compiles("
+            #include <arm_acle.h>
+            int main() {
+                int crc = __crc32d(0, 1);
+                return 0;
+            }" AWS_HAVE_ARM32_CRC)
+
+    check_c_source_compiles("
+        #include <stdatomic.h>
+        int main() {
+            _Atomic int var = 0;
+            atomic_fetch_add_explicit(&var, 1, memory_order_relaxed);
+            return 0;
+    }" AWS_HAVE_ARMv8_1)
+
     set(CMAKE_REQUIRED_FLAGS "${old_flags}")
+
 endif() # USE_CPU_EXTENSIONS
 
 # The part where the definition is added to the compiler flags has been moved 
to config.h.in
@@ -80,6 +112,23 @@
 function(simd_add_source_avx target)
     foreach(file ${ARGN})
         target_sources(${target} PRIVATE ${file})
-        set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS 
"${AVX_CFLAGS}")
+        set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS " 
${AVX_CFLAGS}")
     endforeach()
 endfunction(simd_add_source_avx)
+
+# The part where the definition is added to the compiler flags has been moved 
to config.h.in
+# see git history for more details.
+
+# Adds compiler flags to the source and adds the source to target.
+# Unfortunately the flags have to be passed as strings. Predefined flags are
+# at the top of this file.
+# Usage: simd_append_source_and_features(target file1.c ${AWS_AVX512_FLAG} 
${AWS_AVX2_FLAG} ...)
+function(simd_append_source_and_features target file)
+    set(CC_FLAGS "")
+    foreach(flag ${ARGN})
+        set(CC_FLAGS "${CC_FLAGS} ${flag}")
+    endforeach()
+
+    target_sources(${target} PRIVATE ${file})
+    set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS " 
${CC_FLAGS}")
+endfunction(simd_append_source_and_features)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/aws-c-common-0.9.14/include/aws/common/atomics_msvc.inl 
new/aws-c-common-0.9.15/include/aws/common/atomics_msvc.inl
--- old/aws-c-common-0.9.14/include/aws/common/atomics_msvc.inl 2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/include/aws/common/atomics_msvc.inl 2024-04-03 
00:36:01.000000000 +0200
@@ -20,8 +20,8 @@
 
 AWS_EXTERN_C_BEGIN
 
-#if !(defined(_M_IX86) || defined(_M_X64))
-#    error Atomics are not currently supported for non-x86 MSVC platforms
+#if !(defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))
+#    error Atomics are not currently supported for non-x86 or ARM64 MSVC 
platforms
 
 /*
  * In particular, it's not clear that seq_cst will work properly on non-x86
@@ -63,6 +63,24 @@
  * this use case.
  */
 
+/**
+ * Some general notes about ARM environments:
+ * ARM processors uses a weak memory model as opposed to the strong memory 
model used by Intel processors
+ * This means more permissible memory ordering allowed between stores and 
loads.
+ *
+ * Thus ARM port will need more hardware fences/barriers to assure developer 
intent.
+ * Memory barriers will prevent reordering stores and loads accross them 
depending on their type
+ * (read write, write only, read only ...)
+ *
+ * For more information about ARM64 memory ordering,
+ * see https://developer.arm.com/documentation/102336/0100/Memory-ordering
+ * For more information about Memory barriers,
+ * see https://developer.arm.com/documentation/102336/0100/Memory-barriers
+ * For more information about Miscosoft Interensic ARM64 APIs,
+ * see 
https://learn.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=msvc-170
+ * Note: wrt _Interlocked[Op]64 is the same for ARM64 and x64 processors
+ */
+
 #ifdef _M_IX86
 #    define AWS_INTERLOCKED_INT(x) _Interlocked##x
 typedef long aws_atomic_impl_int_t;
@@ -71,6 +89,32 @@
 typedef long long aws_atomic_impl_int_t;
 #endif
 
+#ifdef _M_ARM64
+/* Hardware Read Write barrier, prevents all memory operations to cross the 
barrier in both directions */
+#    define AWS_RW_BARRIER() __dmb(_ARM64_BARRIER_SY)
+/* Hardware Read barrier, prevents all memory operations to cross the barrier 
upwards */
+#    define AWS_R_BARRIER() __dmb(_ARM64_BARRIER_LD)
+/* Hardware Write barrier, prevents all memory operations to cross the barrier 
downwards */
+#    define AWS_W_BARRIER() __dmb(_ARM64_BARRIER_ST)
+/* Software barrier, prevents the compiler from reodering the operations 
across the barrier */
+#    define AWS_SW_BARRIER() _ReadWriteBarrier();
+#else
+/* hardware barriers, do nothing on x86 since it has a strong memory model
+ * as described in the section above: some general notes
+ */
+#    define AWS_RW_BARRIER()
+#    define AWS_R_BARRIER()
+#    define AWS_W_BARRIER()
+/*
+ * x86: only a compiler barrier is required. For seq_cst, we must use some 
form of interlocked operation for
+ * writes, but that's the caller's responsibility.
+ *
+ * Volatile ops may or may not imply this barrier, depending on the /volatile: 
switch, but adding an extra
+ * barrier doesn't hurt.
+ */
+#    define AWS_SW_BARRIER() _ReadWriteBarrier(); /* software barrier */
+#endif
+
 static inline void aws_atomic_priv_check_order(enum aws_memory_order order) {
 #ifndef NDEBUG
     switch (order) {
@@ -107,14 +151,8 @@
         return;
     }
 
-    /*
-     * x86: only a compiler barrier is required. For seq_cst, we must use some 
form of interlocked operation for
-     * writes, but that's the caller's responsibility.
-     *
-     * Volatile ops may or may not imply this barrier, depending on the 
/volatile: switch, but adding an extra
-     * barrier doesn't hurt.
-     */
-    _ReadWriteBarrier();
+    AWS_RW_BARRIER();
+    AWS_SW_BARRIER();
 }
 
 static inline void aws_atomic_priv_barrier_after(enum aws_memory_order order, 
enum aws_atomic_mode_priv mode) {
@@ -131,11 +169,8 @@
         return;
     }
 
-    /*
-     * x86: only a compiler barrier is required. For seq_cst, we must use some 
form of interlocked operation for
-     * writes, but that's the caller's responsibility.
-     */
-    _ReadWriteBarrier();
+    AWS_RW_BARRIER();
+    AWS_SW_BARRIER();
 }
 
 /**
@@ -344,9 +379,16 @@
             AWS_INTERLOCKED_INT(Exchange)(&x, 1);
             break;
         case aws_memory_order_release:
+            AWS_W_BARRIER();
+            AWS_SW_BARRIER();
+            break;
         case aws_memory_order_acquire:
+            AWS_R_BARRIER();
+            AWS_SW_BARRIER();
+            break;
         case aws_memory_order_acq_rel:
-            _ReadWriteBarrier();
+            AWS_RW_BARRIER();
+            AWS_SW_BARRIER();
             break;
         case aws_memory_order_relaxed:
             /* no-op */
@@ -354,6 +396,12 @@
     }
 }
 
+/* prevent conflicts with other files that might pick the same names */
+#undef AWS_RW_BARRIER
+#undef AWS_R_BARRIER
+#undef AWS_W_BARRIER
+#undef AWS_SW_BARRIER
+
 #define AWS_ATOMICS_HAVE_THREAD_FENCE
 AWS_EXTERN_C_END
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/include/aws/common/config.h.in 
new/aws-c-common-0.9.15/include/aws/common/config.h.in
--- old/aws-c-common-0.9.14/include/aws/common/config.h.in      2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/include/aws/common/config.h.in      2024-04-03 
00:36:01.000000000 +0200
@@ -22,5 +22,12 @@
 #cmakedefine AWS_HAVE_AVX2_INTRINSICS
 #cmakedefine AWS_HAVE_AVX512_INTRINSICS
 #cmakedefine AWS_HAVE_MM256_EXTRACT_EPI64
+#cmakedefine AWS_HAVE_CLMUL
+#cmakedefine AWS_HAVE_ARM32_CRC
+#cmakedefine AWS_HAVE_ARMv8_1
+#cmakedefine AWS_ARCH_ARM64
+#cmakedefine AWS_ARCH_INTEL
+#cmakedefine AWS_ARCH_INTEL_X64
+#cmakedefine AWS_USE_CPU_EXTENSIONS
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/include/aws/common/cpuid.h 
new/aws-c-common-0.9.15/include/aws/common/cpuid.h
--- old/aws-c-common-0.9.14/include/aws/common/cpuid.h  2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/include/aws/common/cpuid.h  2024-04-03 
00:36:01.000000000 +0200
@@ -18,6 +18,8 @@
     AWS_CPU_FEATURE_ARM_CRC,
     AWS_CPU_FEATURE_BMI2,
     AWS_CPU_FEATURE_VPCLMULQDQ,
+    AWS_CPU_FEATURE_ARM_PMULL,
+    AWS_CPU_FEATURE_ARM_CRYPTO,
     AWS_CPU_FEATURE_COUNT,
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/include/aws/common/package.h 
new/aws-c-common-0.9.15/include/aws/common/package.h
--- old/aws-c-common-0.9.14/include/aws/common/package.h        2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/include/aws/common/package.h        2024-04-03 
00:36:01.000000000 +0200
@@ -10,7 +10,7 @@
  * Preliminary cap on the number of possible aws-c-libraries participating in 
shared enum ranges for
  * errors, log subjects, and other cross-library enums. Expandable as needed
  */
-#define AWS_PACKAGE_SLOTS 16
+#define AWS_PACKAGE_SLOTS 32
 
 /*
  * Each aws-c-* and aws-crt-* library has a unique package id starting from 
zero.  These are used to macro-calculate
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/arm/asm/cpuid.c 
new/aws-c-common-0.9.15/source/arch/arm/asm/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/arm/asm/cpuid.c 2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/arm/asm/cpuid.c 1970-01-01 
01:00:00.000000000 +0100
@@ -1,80 +0,0 @@
-/*
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- *  http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-#include <aws/common/cpuid.h>
-#include <stdlib.h>
-
-#if defined(__linux__) || defined(__FreeBSD__)
-#    include <sys/auxv.h>
-
-static unsigned long s_hwcap[2];
-static bool s_hwcap_cached;
-
-struct cap_bits {
-    unsigned long cap;
-    unsigned long bit;
-};
-
-#    if (defined(__aarch64__))
-struct cap_bits s_check_cap[AWS_CPU_FEATURE_COUNT] = {
-    [AWS_CPU_FEATURE_ARM_CRC] = {0, 1 << 7 /* HWCAP_CRC */},
-};
-#    else
-struct cap_bits s_check_cap[AWS_CPU_FEATURE_COUNT] = {
-    [AWS_CPU_FEATURE_ARM_CRC] = {1, 1 << 4 /* HWCAP_CRC */},
-};
-#    endif
-
-#    if (defined(__linux__))
-static void s_cache_hwcap(void) {
-    s_hwcap[0] = getauxval(AT_HWCAP);
-    s_hwcap[1] = getauxval(AT_HWCAP2);
-    s_hwcap_cached = true;
-}
-#    elif (defined(__FreeBSD__))
-static void s_cache_hwcap(void) {
-    int ret;
-
-    ret = elf_aux_info(AT_HWCAP, &s_hwcap[0], sizeof(unsigned long));
-    if (ret)
-        s_hwcap[0] = 0;
-
-    ret = elf_aux_info(AT_HWCAP2, &s_hwcap[1], sizeof(unsigned long));
-    if (ret)
-        s_hwcap[1] = 0;
-    s_hwcap_cached = true;
-}
-#    else
-#        error "Unknown method"
-#    endif
-
-bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
-
-    if (!s_hwcap_cached)
-        s_cache_hwcap();
-
-    switch (feature_name) {
-        case AWS_CPU_FEATURE_ARM_CRC:
-            return s_hwcap[s_check_cap[feature_name].cap] & 
s_check_cap[feature_name].bit;
-        default:
-            return false;
-    }
-}
-
-#else  /* defined(__linux__) || defined(__FreeBSD__) */
-bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
-    return false;
-}
-#endif /* defined(__linux__) || defined(__FreeBSD__) */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/arm/auxv/cpuid.c 
new/aws-c-common-0.9.15/source/arch/arm/auxv/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/arm/auxv/cpuid.c        1970-01-01 
01:00:00.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/arm/auxv/cpuid.c        2024-04-03 
00:36:01.000000000 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ *  http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+#include <aws/common/cpuid.h>
+#include <stdlib.h>
+
+#if defined(__linux__) || defined(__FreeBSD__)
+#    include <sys/auxv.h>
+
+static unsigned long s_hwcap[2];
+static bool s_hwcap_cached;
+
+struct cap_bits {
+    unsigned long cap;
+    unsigned long bit;
+};
+
+#    if (defined(__aarch64__))
+struct cap_bits s_check_cap[AWS_CPU_FEATURE_COUNT] = {
+    [AWS_CPU_FEATURE_ARM_CRC] = {0, 1 << 7 /* HWCAP_CRC32 */},
+    [AWS_CPU_FEATURE_ARM_PMULL] = {0, 1 << 4 /* HWCAP_PMULL */},
+    [AWS_CPU_FEATURE_ARM_CRYPTO] = {0, 1 << 3 /* HWCAP_AES */},
+};
+#    else
+struct cap_bits s_check_cap[AWS_CPU_FEATURE_COUNT] = {
+    [AWS_CPU_FEATURE_ARM_CRC] = {1, 1 << 4 /* HWCAP_CRC */},
+};
+#    endif
+
+#    if (defined(__linux__))
+static void s_cache_hwcap(void) {
+    s_hwcap[0] = getauxval(AT_HWCAP);
+    s_hwcap[1] = getauxval(AT_HWCAP2);
+    s_hwcap_cached = true;
+}
+#    elif (defined(__FreeBSD__))
+static void s_cache_hwcap(void) {
+    int ret;
+
+    ret = elf_aux_info(AT_HWCAP, &s_hwcap[0], sizeof(unsigned long));
+    if (ret)
+        s_hwcap[0] = 0;
+
+    ret = elf_aux_info(AT_HWCAP2, &s_hwcap[1], sizeof(unsigned long));
+    if (ret)
+        s_hwcap[1] = 0;
+    s_hwcap_cached = true;
+}
+#    else
+#        error "Unknown method"
+#    endif
+
+bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
+
+    if (!s_hwcap_cached)
+        s_cache_hwcap();
+
+    switch (feature_name) {
+        case AWS_CPU_FEATURE_ARM_CRC:
+#    if (defined(__aarch64__))
+        case AWS_CPU_FEATURE_ARM_PMULL:
+        case AWS_CPU_FEATURE_ARM_CRYPTO:
+#    endif // (defined(__aarch64__))
+            return s_hwcap[s_check_cap[feature_name].cap] & 
s_check_cap[feature_name].bit;
+        default:
+            return false;
+    }
+}
+
+#else  /* defined(__linux__) || defined(__FreeBSD__) */
+bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
+    return false;
+}
+#endif /* defined(__linux__) || defined(__FreeBSD__) */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/arm/darwin/cpuid.c 
new/aws-c-common-0.9.15/source/arch/arm/darwin/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/arm/darwin/cpuid.c      1970-01-01 
01:00:00.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/arm/darwin/cpuid.c      2024-04-03 
00:36:01.000000000 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ *  http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+#include <aws/common/cpuid.h>
+
+#include <sys/sysctl.h>
+
+bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
+    int64_t ret = 0;
+    size_t size = sizeof(ret);
+
+    switch (feature_name) {
+        case AWS_CPU_FEATURE_ARM_PMULL:
+            if (sysctlbyname("hw.optional.arm.FEAT_PMULL", &ret, &size, NULL, 
0) != -1) {
+                return ret == 1;
+            }
+        case AWS_CPU_FEATURE_ARM_CRC:
+            if (sysctlbyname("hw.optional.armv8_crc32", &ret, &size, NULL, 0) 
!= -1) {
+                return ret == 1;
+            }
+        case AWS_CPU_FEATURE_ARM_CRYPTO:
+            if (sysctlbyname("hw.optional.arm.FEAT_AES", &ret, &size, NULL, 0) 
!= -1) {
+                return ret == 1;
+            }
+        default:
+            return false;
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/arm/msvc/cpuid.c 
new/aws-c-common-0.9.15/source/arch/arm/msvc/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/arm/msvc/cpuid.c        2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/arm/msvc/cpuid.c        1970-01-01 
01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-/*
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- *  http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-#include <aws/common/cpuid.h>
-#include <stdlib.h>
-
-bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
-    return false;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/arm/windows/cpuid.c 
new/aws-c-common-0.9.15/source/arch/arm/windows/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/arm/windows/cpuid.c     1970-01-01 
01:00:00.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/arm/windows/cpuid.c     2024-04-03 
00:36:01.000000000 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ *  http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+#include <Windows.h>
+#include <aws/common/cpuid.h>
+
+bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) {
+    switch (feature_name) {
+        case AWS_CPU_FEATURE_ARM_CRC:
+            return 
IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) != 0;
+        // this is the best we've got on windows as they don't separate PMULL 
and AES from each other.
+        case AWS_CPU_FEATURE_ARM_PMULL:
+        case AWS_CPU_FEATURE_ARM_CRYPTO:
+            return 
IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) != 0;
+        default:
+            return false;
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/arch/intel/cpuid.c 
new/aws-c-common-0.9.15/source/arch/intel/cpuid.c
--- old/aws-c-common-0.9.14/source/arch/intel/cpuid.c   2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/source/arch/intel/cpuid.c   2024-04-03 
00:36:01.000000000 +0200
@@ -116,8 +116,8 @@
 static bool s_has_vpclmulqdq(void) {
     uint32_t abcd[4];
     /* Check VPCLMULQDQ:
-     * CPUID.(EAX=07H, ECX=0H):ECX.VPCLMULQDQ[bit 20]==1 */
-    uint32_t vpclmulqdq_mask = (1 << 20);
+     * CPUID.(EAX=07H, ECX=0H):ECX.VPCLMULQDQ[bit 10]==1 */
+    uint32_t vpclmulqdq_mask = (1 << 10);
     aws_run_cpuid(7, 0, abcd);
     if ((abcd[2] & vpclmulqdq_mask) != vpclmulqdq_mask) {
         return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/posix/thread.c 
new/aws-c-common-0.9.15/source/posix/thread.c
--- old/aws-c-common-0.9.14/source/posix/thread.c       2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/source/posix/thread.c       2024-04-03 
00:36:01.000000000 +0200
@@ -296,9 +296,9 @@
             attr_return = pthread_attr_setaffinity_np(attributes_ptr, 
sizeof(cpuset), &cpuset);
 
             if (attr_return) {
-                AWS_LOGF_ERROR(
+                AWS_LOGF_WARN(
                     AWS_LS_COMMON_THREAD,
-                    "id=%p: pthread_attr_setaffinity_np() failed with %d.",
+                    "id=%p: pthread_attr_setaffinity_np() failed with %d. 
Continuing without cpu affinity",
                     (void *)thread,
                     attr_return);
                 goto cleanup;
@@ -382,7 +382,20 @@
 
     if (attr_return) {
         s_thread_wrapper_destroy(wrapper);
-
+        if (options && options->cpu_id >= 0) {
+            /*
+             * `pthread_create` can fail with an `EINVAL` error or `EDEADLK` 
on freebasd if the `cpu_id` is
+             * restricted/invalid. Since the pinning to a particular `cpu_id` 
is supposed to be best-effort, try to
+             * launch a thread again without pinning to a specific cpu_id.
+             */
+            AWS_LOGF_INFO(
+                AWS_LS_COMMON_THREAD,
+                "id=%p: Attempting to launch the thread again without pinning 
to a cpu_id",
+                (void *)thread);
+            struct aws_thread_options new_options = *options;
+            new_options.cpu_id = -1;
+            return aws_thread_launch(thread, func, arg, &new_options);
+        }
         switch (attr_return) {
             case EINVAL:
                 return aws_raise_error(AWS_ERROR_THREAD_INVALID_SETTINGS);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/source/string.c 
new/aws-c-common-0.9.15/source/string.c
--- old/aws-c-common-0.9.14/source/string.c     2024-03-05 18:16:27.000000000 
+0100
+++ new/aws-c-common-0.9.15/source/string.c     2024-04-03 00:36:01.000000000 
+0200
@@ -189,11 +189,8 @@
 struct aws_string *aws_string_new_from_array(struct aws_allocator *allocator, 
const uint8_t *bytes, size_t len) {
     AWS_PRECONDITION(allocator);
     AWS_PRECONDITION(AWS_MEM_IS_READABLE(bytes, len));
-    size_t malloc_size;
-    if (aws_add_size_checked(sizeof(struct aws_string) + 1, len, 
&malloc_size)) {
-        return NULL;
-    }
-    struct aws_string *str = aws_mem_acquire(allocator, malloc_size);
+
+    struct aws_string *str = aws_mem_acquire(allocator, offsetof(struct 
aws_string, bytes[len + 1]));
     if (!str) {
         return NULL;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/tests/CMakeLists.txt 
new/aws-c-common-0.9.15/tests/CMakeLists.txt
--- old/aws-c-common-0.9.14/tests/CMakeLists.txt        2024-03-05 
18:16:27.000000000 +0100
+++ new/aws-c-common-0.9.15/tests/CMakeLists.txt        2024-04-03 
00:36:01.000000000 +0200
@@ -40,6 +40,7 @@
 add_test_case(aws_assume_compiles_test)
 
 add_test_case(thread_creation_join_test)
+add_test_case(thread_creation_join_invalid_cpu_id_test)
 add_test_case(thread_atexit_test)
 add_test_case(test_managed_thread_join)
 add_test_case(test_managed_thread_join_timeout)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aws-c-common-0.9.14/tests/thread_test.c 
new/aws-c-common-0.9.15/tests/thread_test.c
--- old/aws-c-common-0.9.14/tests/thread_test.c 2024-03-05 18:16:27.000000000 
+0100
+++ new/aws-c-common-0.9.15/tests/thread_test.c 2024-04-03 00:36:01.000000000 
+0200
@@ -70,6 +70,40 @@
 
 AWS_TEST_CASE(thread_creation_join_test, s_test_thread_creation_join_fn)
 
+static int s_test_thread_creation_join_invalid_cpu_id_fn(struct aws_allocator 
*allocator, void *ctx) {
+    (void)ctx;
+    aws_common_library_init(allocator);
+    struct thread_test_data test_data = {.allocator = allocator};
+
+    struct aws_thread thread;
+    aws_thread_init(&thread, allocator);
+
+    struct aws_thread_options thread_options = *aws_default_thread_options();
+    /* invalid cpu_id. Ensure that the cpu_id is best-effort based. */
+    thread_options.cpu_id = 4096;
+
+    ASSERT_SUCCESS(
+        aws_thread_launch(&thread, s_thread_fn, (void *)&test_data, 
&thread_options), "thread creation failed");
+    ASSERT_INT_EQUALS(
+        AWS_THREAD_JOINABLE, aws_thread_get_detach_state(&thread), "thread 
state should have returned JOINABLE");
+    ASSERT_SUCCESS(aws_thread_join(&thread), "thread join failed");
+    ASSERT_TRUE(
+        aws_thread_thread_id_equal(test_data.thread_id, 
aws_thread_get_id(&thread)),
+        "get_thread_id should have returned the same id as the thread calling 
current_thread_id");
+    ASSERT_INT_EQUALS(
+        AWS_THREAD_JOIN_COMPLETED,
+        aws_thread_get_detach_state(&thread),
+        "thread state should have returned JOIN_COMPLETED");
+
+    aws_string_destroy(test_data.thread_name);
+    aws_thread_clean_up(&thread);
+    aws_common_library_clean_up();
+
+    return 0;
+}
+
+AWS_TEST_CASE(thread_creation_join_invalid_cpu_id_test, 
s_test_thread_creation_join_invalid_cpu_id_fn)
+
 static uint32_t s_atexit_call_count = 0;
 static void s_thread_atexit_fn(void *user_data) {
     (void)user_data;

Reply via email to