From 02c7a165ee37fc38490c50947380017098f75907 Mon Sep 17 00:00:00 2001 From: wangguokun Date: Tue, 19 Mar 2024 03:00:50 +0000 Subject: [PATCH] lib/absl: port lib-absl to tenonos Signed-off-by: wangguokun --- Config.uk | 4 + Makefile.uk | 229 ++++++++++++++++++ README.md | 20 ++ patches/0000-Add_SYS_futex_syscall.patch | 22 ++ ...-Change_syscall_to_uk_syscall_static.patch | 140 +++++++++++ 5 files changed, 415 insertions(+) create mode 100644 Config.uk create mode 100644 Makefile.uk create mode 100644 README.md create mode 100644 patches/0000-Add_SYS_futex_syscall.patch create mode 100644 patches/0001-Change_syscall_to_uk_syscall_static.patch diff --git a/Config.uk b/Config.uk new file mode 100644 index 0000000..a6db4a3 --- /dev/null +++ b/Config.uk @@ -0,0 +1,4 @@ +menuconfig LIBABSL + bool "absl: Abseil Common Libraries (C++)" + select LIBMUSL + default n diff --git a/Makefile.uk b/Makefile.uk new file mode 100644 index 0000000..2249395 --- /dev/null +++ b/Makefile.uk @@ -0,0 +1,229 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 The TenonOS Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. + +################################################################################ +# Library registration +################################################################################ +$(eval $(call addlib_s,libabsl,$(CONFIG_LIBABSL))) + +################################################################################ +# Sources +################################################################################ +LIBABSL_COMMIT=fb3621f4f897824c0dbe0615fa94543df6192f30 +LIBABSL_URL=https://github.com/abseil/abseil-cpp/archive/$(LIBABSL_COMMIT).tar.gz +LIBABSL_PATCHDIR=$(LIBABSL_BASE)/patches +LIBABSL_DIRNAME=abseil-cpp-$(LIBABSL_COMMIT) + +ifeq ($(CONFIG_LIBABSL), y) +$(eval $(call fetch,libabsl,$(LIBABSL_URL))) +$(eval $(call patch,libabsl,$(LIBABSL_PATCHDIR),$(LIBABSL_DIRNAME))) +endif + +################################################################################ +# Helpers +################################################################################ +LIBABSL_SRC = $(LIBABSL_ORIGIN)/$(LIBABSL_DIRNAME) + +################################################################################ +# Library includes +################################################################################ +CINCLUDES-$(CONFIG_LIBABSL) += -I$(LIBABSL_SRC) +CXXINCLUDES-$(CONFIG_LIBABSL) += -I$(LIBABSL_SRC) + +################################################################################ +# Global flags +################################################################################ +LIBABSL_CONFIG_FLAGS += -DCONFIG_CXX_THREADS \ + -Wno-sign-compare + +GCC_INSTALLDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -e '/^COLLECT_LTO_WRAPPER=\(.*\)\/lto-wrapper/!d' -e 's//\1/')/include + +ifneq ($(CONFIG_CROSS_COMPILE),"") +GCC_INCLUDEDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -n -e 's/.*--includedir=\([^ ]*\).*/\1/p') +else +GCC_INCLUDEDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -n -e 's/.*--prefix=\([^ ]*\).*/\1/p')/include +endif + +ifdef CONFIG_ARCH_X86_64 +LIBABSL_CFLAGS-$(CONFIG_ARCH_X86_64) += $(GCC_INSTALLDIR_FLAGS) $(GCC_INCLUDEDIR_FLAGS) +LIBABSL_CXXFLAGS-$(CONFIG_ARCH_X86_64) += $(GCC_INSTALLDIR_FLAGS) $(GCC_INCLUDEDIR_FLAGS) +endif + +ifdef CONFIG_ARCH_ARM_64 +LIBABSL_CFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) $(GCC_INCLUDEDIR_FLAGS) +LIBABSL_CXXFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) $(GCC_INCLUDEDIR_FLAGS) +endif + +LIBABSL_CXXFLAGS-y += $(LIBABSL_CONFIG_FLAGS) +LIBABSL_CFLAGS-y += $(LIBABSL_CONFIG_FLAGS) +################################################################################ +# Library sources +################################################################################ +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/gaussian_distribution.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/discrete_distribution.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/randen_detect.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/randen_round_keys.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/randen_hwaes.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/seed_material.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/randen.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/pool_urbg.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/randen_slow.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/distribution_test_util.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/internal/chi_square.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/seed_sequences.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/random/seed_gen_exception.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/container/internal/hashtablez_sampler.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/container/internal/raw_hash_set.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/hash/internal/low_level_hash.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/hash/internal/hash.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/hash/internal/city.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/clock.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_if.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_impl.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/civil_time_detail.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_libc.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_format.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_fixed.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/zone_info_source.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_posix.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_lookup.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/cctz/src/time_zone_info.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/internal/test_util.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/format.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/time.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/civil_time.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/time/duration.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/proto.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/nullguard.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/conditions.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/log_format.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/globals.cc|internal +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/check_op.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/log_message.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/internal/log_sink_set.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/die_if_null.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/initialize.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/globals.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/flags.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/log_entry.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/log/log_sink.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc_memcpy_fallback.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc_non_temporal_memcpy.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc_memcpy_x86_64.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc_x86_arm_combined.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/cpu_detect.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/internal/crc_cord_state.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/crc/crc32c.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/types/bad_any_cast.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/types/bad_variant_access.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/types/bad_optional_access.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/profiling/internal/exponential_biased.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/profiling/internal/periodic_sampler.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/usage_config.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/internal/commandlineflag.cc|internal +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/internal/private_handle_accessor.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/internal/program_name.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/internal/usage.cc|internal +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/internal/flag.cc|internal +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/commandlineflag.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/usage.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/flag.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/reflection.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/marshalling.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/flags/parse.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/numeric/int128.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/status/status_payload_printer.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/status/status.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/status/statusor.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/demangle.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/examine_stack.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/stack_consumption.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/address_is_readable.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/elf_mem_image.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/internal/vdso_support.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/symbolize.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/leak_check.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/stacktrace.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/debugging/failure_signal_handler.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/cord.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/numbers.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/pow10_helper.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/charconv_bigint.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_btree_navigator.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_internal.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/escaping.cc|internal +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/ostringstream.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/charconv_parse.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cordz_functions.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_crc.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/arg.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/output.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/float_conversion.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/bind.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/extension.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/str_format/parser.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/damerau_levenshtein_distance.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_consume.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cordz_info.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/memutil.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/utf8.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cordz_handle.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cordz_sample_token.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_btree_reader.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_ring.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/cord_rep_btree.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/internal/stringify_sink.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/string_view.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/match.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/str_replace.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/escaping.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/str_cat.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/cord_analysis.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/substitute.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/charconv.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/str_split.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/ascii.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/strings/cord_buffer.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/spinlock_wait.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/low_level_alloc.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/strerror.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/spinlock.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/raw_logging.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/cycleclock.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/unscaledcycleclock.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/throw_delegate.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/scoped_set_env.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/thread_identity.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/internal/sysinfo.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/base/log_severity.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/notification.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/waiter_base.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/stdcpp_waiter.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/win32_waiter.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/sem_waiter.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/create_thread_identity.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/kernel_timeout.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/graphcycles.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/pthread_waiter.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/per_thread_sem.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/internal/futex_waiter.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/barrier.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/mutex.cc +LIBABSL_SRCS-y += $(LIBABSL_SRC)/absl/synchronization/blocking_counter.cc diff --git a/README.md b/README.md new file mode 100644 index 0000000..15c8bc1 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# lib-absl + +## 微库提供的功能与说明 + +abseil-cpp是Abseil项目中的C++库部分,它由Google开发并开源,旨在提供一套高质量的、经过实战测试的通用C++库,以补充和增强C++标准库的功能。Abseil-cpp的设计理念是在不替代标准库的前提下,提供那些在标准库中尚未包含的实用功能,或者为特殊需求提供标准库的替代方案。 + +abseil-cpp支持的详细特性可见其官方文档: https://github.com/abseil/abseil-cpp + +本仓库将abseil-cpp作为微库移植到TenonOS,目录结构如下: + +```powershell +. +├── Config.uk ------ 维护微库配置 +├── Makefile.uk ------ 用于微库构建 +└── patches ------ 维护对abseil-cpp源码的修改 +``` + +## 编译构建与配置说明 + +absl不依赖与其他微库,默认不启用 diff --git a/patches/0000-Add_SYS_futex_syscall.patch b/patches/0000-Add_SYS_futex_syscall.patch new file mode 100644 index 0000000..fc2eaec --- /dev/null +++ b/patches/0000-Add_SYS_futex_syscall.patch @@ -0,0 +1,22 @@ +diff --git a/absl/synchronization/internal/futex.h b/absl/synchronization/internal/futex.h +index 573c01b..e74ad14 100644 +--- a/absl/synchronization/internal/futex.h ++++ b/absl/synchronization/internal/futex.h +@@ -56,7 +56,7 @@ namespace synchronization_internal { + + // Some Android headers are missing these definitions even though they + // support these futex operations. +-#ifdef __BIONIC__ ++// #ifdef __BIONIC__ + #ifndef SYS_futex + #define SYS_futex __NR_futex + #endif +@@ -72,7 +72,7 @@ namespace synchronization_internal { + #ifndef FUTEX_BITSET_MATCH_ANY + #define FUTEX_BITSET_MATCH_ANY 0xFFFFFFFF + #endif +-#endif ++// #endif + + #if defined(__NR_futex_time64) && !defined(SYS_futex_time64) + #define SYS_futex_time64 __NR_futex_time64 diff --git a/patches/0001-Change_syscall_to_uk_syscall_static.patch b/patches/0001-Change_syscall_to_uk_syscall_static.patch new file mode 100644 index 0000000..95cad98 --- /dev/null +++ b/patches/0001-Change_syscall_to_uk_syscall_static.patch @@ -0,0 +1,140 @@ +diff --git a/absl/base/internal/spinlock_linux.inc b/absl/base/internal/spinlock_linux.inc +index fe8ba67..5114d64 100644 +--- a/absl/base/internal/spinlock_linux.inc ++++ b/absl/base/internal/spinlock_linux.inc +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -60,12 +61,12 @@ ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(AbslInternalSpinLockDelay)( + std::atomic *w, uint32_t value, int, + absl::base_internal::SchedulingMode) { + absl::base_internal::ErrnoSaver errno_saver; +- syscall(SYS_futex, w, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, value, nullptr); ++ uk_syscall_static(SYS_futex, w, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, value, nullptr); + } + + ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(AbslInternalSpinLockWake)( + std::atomic *w, bool all) { +- syscall(SYS_futex, w, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, all ? INT_MAX : 1, 0); ++ uk_syscall_static(SYS_futex, w, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, all ? INT_MAX : 1, 0); + } + + } // extern "C" +diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h +index 1beb2ee..f3afde4 100644 +--- a/absl/base/internal/direct_mmap.h ++++ b/absl/base/internal/direct_mmap.h +@@ -33,6 +33,7 @@ + #include + #endif + ++#include + #include + #include + #include +@@ -101,7 +102,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + static_cast(offset / pagesize)); + #else + return reinterpret_cast( +- syscall(SYS_mmap2, start, length, prot, flags, fd, ++ uk_syscall_static(SYS_mmap2, start, length, prot, flags, fd, + static_cast(offset / pagesize))); // NOLINT + #endif + #elif defined(__s390x__) +@@ -112,7 +113,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + static_cast(flags), // NOLINT + static_cast(fd), // NOLINT + static_cast(offset)}; // NOLINT +- return reinterpret_cast(syscall(SYS_mmap, buf)); ++ return reinterpret_cast(uk_syscall_static(SYS_mmap, buf)); + #elif defined(__x86_64__) + // The x32 ABI has 32 bit longs, but the syscall interface is 64 bit. + // We need to explicitly cast to an unsigned 64 bit type to avoid implicit +@@ -122,19 +123,19 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + // isn't truncated to 32-bits under x32. + #define MMAP_SYSCALL_ARG(x) ((uint64_t)(uintptr_t)(x)) + return reinterpret_cast( +- syscall(SYS_mmap, MMAP_SYSCALL_ARG(start), MMAP_SYSCALL_ARG(length), ++ uk_syscall_static(SYS_mmap, MMAP_SYSCALL_ARG(start), MMAP_SYSCALL_ARG(length), + MMAP_SYSCALL_ARG(prot), MMAP_SYSCALL_ARG(flags), + MMAP_SYSCALL_ARG(fd), static_cast(offset))); + #undef MMAP_SYSCALL_ARG + #else // Remaining 64-bit aritectures. + static_assert(sizeof(unsigned long) == 8, "Platform is not 64-bit"); + return reinterpret_cast( +- syscall(SYS_mmap, start, length, prot, flags, fd, offset)); ++ uk_syscall_static(SYS_mmap, start, length, prot, flags, fd, offset)); + #endif + } + + inline int DirectMunmap(void* start, size_t length) { +- return static_cast(syscall(SYS_munmap, start, length)); ++ return static_cast(uk_syscall_static(SYS_munmap, start, length)); + } + + } // namespace base_internal +diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc +index 4c922cc..3d39197 100644 +--- a/absl/base/internal/raw_logging.cc ++++ b/absl/base/internal/raw_logging.cc +@@ -59,6 +59,7 @@ + #if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && \ + !defined(__ANDROID__) + #include ++#include + #define ABSL_HAVE_SYSCALL_WRITE 1 + #define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1 + #else +@@ -235,7 +236,7 @@ void AsyncSignalSafeWriteError(const char* s, size_t len) { + #elif defined(ABSL_HAVE_SYSCALL_WRITE) + // We prefer calling write via `syscall` to minimize the risk of libc doing + // something "helpful". +- syscall(SYS_write, STDERR_FILENO, s, len); ++ uk_syscall_static(SYS_write, STDERR_FILENO, s, len); + #elif defined(ABSL_HAVE_POSIX_WRITE) + write(STDERR_FILENO, s, len); + #elif defined(ABSL_HAVE_RAW_IO) +diff --git a/absl/synchronization/internal/futex.h b/absl/synchronization/internal/futex.h +index e74ad14..bd89250 100644 +--- a/absl/synchronization/internal/futex.h ++++ b/absl/synchronization/internal/futex.h +@@ -24,6 +24,7 @@ + #ifdef __linux__ + #include + #include ++#include + #endif + + #include +@@ -109,7 +110,7 @@ class FutexImpl { + FutexTimespec ts; + // https://locklessinc.com/articles/futex_cheat_sheet/ + // Unlike FUTEX_WAIT, FUTEX_WAIT_BITSET uses absolute time. +- auto err = syscall( ++ auto err = uk_syscall_static( + SYS_futex, reinterpret_cast(v), + FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME, val, + ToFutexTimespec(abs_timeout, &ts), nullptr, FUTEX_BITSET_MATCH_ANY); +@@ -127,7 +128,7 @@ class FutexImpl { + // Atomically check that the futex value is still 0, and if it + // is, sleep until abs_timeout or until woken by FUTEX_WAKE. + auto err = +- syscall(SYS_futex, reinterpret_cast(v), FUTEX_PRIVATE_FLAG, ++ uk_syscall_static(SYS_futex, reinterpret_cast(v), FUTEX_PRIVATE_FLAG, + val, ToFutexTimespec(rel_timeout, &ts)); + if (err != 0) { + return -errno; +@@ -137,7 +138,7 @@ class FutexImpl { + + // Wakes at most `count` waiters that have entered the sleep state on `v`. + static int Wake(std::atomic* v, int32_t count) { +- auto err = syscall(SYS_futex, reinterpret_cast(v), ++ auto err = uk_syscall_static(SYS_futex, reinterpret_cast(v), + FUTEX_WAKE | FUTEX_PRIVATE_FLAG, count); + if (ABSL_PREDICT_FALSE(err < 0)) { + return -errno; -- Gitee