From d8354f79287f9b7d7fd544bc744e0ae582d2bae5 Mon Sep 17 00:00:00 2001 From: Niranjan Yardi Date: Mon, 13 Jan 2025 17:30:33 -0800 Subject: [PATCH] More semantic cleanup --- base/BUILD.gn | 12 +++++++++--- base/allocator/partition_allocator/BUILD.gn | 3 --- .../partition_allocator/partition_alloc_config.h | 2 -- .../shim/allocator_shim_override_libc_symbols.h | 1 + cobalt/build/configs/linux-x64x11-evergreen/args.gn | 1 + .../abseil-cpp/absl/base/internal/raw_logging.cc | 6 +++--- .../absl/debugging/internal/address_is_readable.cc | 3 ++- .../abseil-cpp/absl/synchronization/internal/futex.h | 5 +++-- third_party/boringssl/BUILD.gn | 5 ++++- third_party/llvm-project/libcxx/BUILD.gn | 2 +- third_party/llvm-project/libcxxabi/BUILD.gn | 2 +- 11 files changed, 25 insertions(+), 17 deletions(-) diff --git a/base/BUILD.gn b/base/BUILD.gn index 1a3732e8f123..a344386cd90d 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1024,6 +1024,7 @@ component("base") { ] } + # TODO: b/384652502 - Cobalt: Add source files after fixing compiler errors. if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "debug/proc_maps_linux.cc", @@ -1118,6 +1119,7 @@ component("base") { ] if (is_cobalt && is_cobalt_hermetic_build) { + # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. deps -= [ "//base/allocator/partition_allocator:raw_ptr" ] deps += [ "//starboard:starboard_group" ] } @@ -1147,6 +1149,7 @@ component("base") { "allocator/partition_allocator/shim/allocator_shim_internals.h", ] + # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. # loc.cc -o obj/base/base/allocator_shim_default_dispatch_to_partition_alloc.o # ../../base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc:748:36: error: incomplete result type 'struct mallinfo' in function definition if (use_partition_alloc) { @@ -1186,6 +1189,8 @@ component("base") { ] } + # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. + # Ask yavor if these files need to be excluded, as the symbols are coming from musl. # SHIM_ALWAYS_EXPORT size_t malloc_usable_size(void* address) __THROW { # ^ # ../../third_party/musl/include/malloc.h:19:8: note: previous declaration is here @@ -1732,6 +1737,7 @@ component("base") { ] } + # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "process/process_metrics_posix.cc", @@ -1739,9 +1745,6 @@ component("base") { ] } - # ../../base/process/launch_posix.cc:145:18: error: use of undeclared identifier 'SYS_rt_sigaction' - # return syscall(SYS_rt_sigaction, sig, act, oact, sizeof(kernel_sigset_t)); - if (is_posix && !is_apple) { sources += [ "native_library_posix.cc", @@ -1758,6 +1761,9 @@ component("base") { ] } + # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. + # ../../base/process/launch_posix.cc:145:18: error: use of undeclared identifier 'SYS_rt_sigaction' + # return syscall(SYS_rt_sigaction, sig, act, oact, sizeof(kernel_sigset_t)); if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "native_library_posix.cc", diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn index 37d188ab7163..e6742c05ffb6 100644 --- a/base/allocator/partition_allocator/BUILD.gn +++ b/base/allocator/partition_allocator/BUILD.gn @@ -330,9 +330,6 @@ component("partition_alloc") { deps += [ "//third_party/android_ndk:cpu_features" ] } - if (is_cobalt && is_cobalt_hermetic_build) { - deps += [ "//starboard:starboard_group" ] - } if (is_fuchsia) { public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/fit", diff --git a/base/allocator/partition_allocator/partition_alloc_config.h b/base/allocator/partition_allocator/partition_alloc_config.h index b2a21be2ba66..c09df1f09e2c 100644 --- a/base/allocator/partition_allocator/partition_alloc_config.h +++ b/base/allocator/partition_allocator/partition_alloc_config.h @@ -64,7 +64,6 @@ static_assert(sizeof(void*) != 8, ""); #define PA_CONFIG_GLUE_CORE_POOLS() 0 #endif -// Cobalt comment: Avoid including Linux headers when OS is starboard. #if BUILDFLAG(HAS_64_BIT_POINTERS) && \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)) && !BUILDFLAG(IS_STARBOARD) #include @@ -104,7 +103,6 @@ static_assert(sizeof(void*) != 8, ""); // POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific // features such as futex(2). -// Cobalt comment: Avoid including Linux headers when OS is starboard. #define PA_CONFIG_HAS_LINUX_KERNEL() \ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)) && !BUILDFLAG(IS_STARBOARD) diff --git a/base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h b/base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h index 0d0154f784bc..ff2ac20b18fb 100644 --- a/base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h +++ b/base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h @@ -14,6 +14,7 @@ #include "build/build_config.h" +// TODO: b/384652502 - Cobalt: Add source files after fixing compiler errors. // /arch/generic --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -c ../../base/allocator/partition_allocator/shim/allocator_shim.cc -o obj/base/base/allocator_shim.o // In file included from ../../base/allocator/partition_allocator/shim/allocator_shim.cc:409: // ../../base/allocator/partition_allocator/shim/allocator_shim_override_libc_symbols.h:36:26: error: exception specification in declaration does not match previous declaration diff --git a/cobalt/build/configs/linux-x64x11-evergreen/args.gn b/cobalt/build/configs/linux-x64x11-evergreen/args.gn index 6ea166e55e13..46ef71191c10 100644 --- a/cobalt/build/configs/linux-x64x11-evergreen/args.gn +++ b/cobalt/build/configs/linux-x64x11-evergreen/args.gn @@ -2,6 +2,7 @@ import("//cobalt/build/configs/linux-x64x11/args.gn") use_custom_libc = true +# TODO: b/384652502 - Cobalt: Stop overriding enable_pkeys. # ../../base/allocator/partition_allocator/pkey.cc:35:18: error: use of undeclared identifier 'SYS_pkey_mprotect' # return syscall(SYS_pkey_mprotect, addr, len, prot, pkey); enable_pkeys = false diff --git a/third_party/abseil-cpp/absl/base/internal/raw_logging.cc b/third_party/abseil-cpp/absl/base/internal/raw_logging.cc index 4ee1b13254f0..3dc0c89dabd4 100644 --- a/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +++ b/third_party/abseil-cpp/absl/base/internal/raw_logging.cc @@ -53,13 +53,13 @@ #else #undef ABSL_HAVE_POSIX_WRITE #endif -#endif // defined(STARBOARD) +#endif // BUILDFLAG(IS_STARBOARD) && defined(_LIBCPP_HAS_MUSL_LIBC // ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall // syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len); // for low level operations that want to avoid libc. #if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && \ - !defined(__ANDROID__) && !defined(STARBOARD) + !defined(__ANDROID__) && !BUILDFLAG(IS_STARBOARD) #include #define ABSL_HAVE_SYSCALL_WRITE 1 #define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1 @@ -217,7 +217,7 @@ void AsyncSignalSafeWriteToStderr(const char* s, size_t len) { write(STDERR_FILENO, s, len); #elif defined(ABSL_HAVE_RAW_IO) _write(/* stderr */ 2, s, static_cast(len)); -#elif defined(STARBOARD) +#elif BUILDFLAG(IS_STARBOARD) SbLog(kSbLogPriorityError, s); #else // stderr logging unsupported on this platform diff --git a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc index f3eb490a8ad9..28eb039041e9 100644 --- a/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +++ b/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc @@ -16,8 +16,9 @@ // without faulting. #include "absl/debugging/internal/address_is_readable.h" +#include "build/build_config.h" -#if !defined(__linux__) || defined(__ANDROID__) || defined(OS_STARBOARD) +#if !defined(__linux__) || defined(__ANDROID__) || BUILDFLAG(IS_STARBOARD) namespace absl { ABSL_NAMESPACE_BEGIN diff --git a/third_party/abseil-cpp/absl/synchronization/internal/futex.h b/third_party/abseil-cpp/absl/synchronization/internal/futex.h index 9785ac7d62c6..daedd4e1ecb1 100644 --- a/third_party/abseil-cpp/absl/synchronization/internal/futex.h +++ b/third_party/abseil-cpp/absl/synchronization/internal/futex.h @@ -15,18 +15,19 @@ #define ABSL_SYNCHRONIZATION_INTERNAL_FUTEX_H_ #include "absl/base/config.h" +#include "build/build_config.h" #ifndef _WIN32 #include #include #endif -#if !defined(OS_STARBOARD) +#if !BUILDFLAG(IS_STARBOARD) #ifdef __linux__ #include #include #endif -#endif +#endif // !BUILDFLAG(IS_STARBOARD) #include #include diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn index e45861dc736d..d5d94864ff79 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn @@ -169,7 +169,10 @@ component("boringssl") { # requires it. public_deps = [ ":boringssl_asm" ] if (is_cobalt && is_cobalt_hermetic_build) { - public_deps += [ "//starboard/common", "//starboard:starboard_headers_only" ] + public_deps += [ + "//starboard:starboard_headers_only", + "//starboard/common", + ] } public_configs = [ ":external_config" ] diff --git a/third_party/llvm-project/libcxx/BUILD.gn b/third_party/llvm-project/libcxx/BUILD.gn index 9e1f257fbb47..d40ed65b7670 100644 --- a/third_party/llvm-project/libcxx/BUILD.gn +++ b/third_party/llvm-project/libcxx/BUILD.gn @@ -39,7 +39,7 @@ config("cxx_config") { "_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION", "_LIBCPP_HAS_MUSL_LIBC", - # "_LIBCPP_HAS_THREAD_API_EXTERNAL", + "_LIBCPP_HAS_THREAD_API_EXTERNAL", # Let the library headers know they are currently being used to build the # library. diff --git a/third_party/llvm-project/libcxxabi/BUILD.gn b/third_party/llvm-project/libcxxabi/BUILD.gn index b533aa578b5c..c014ca01076d 100644 --- a/third_party/llvm-project/libcxxabi/BUILD.gn +++ b/third_party/llvm-project/libcxxabi/BUILD.gn @@ -44,7 +44,7 @@ config("cxxabi_config") { "_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION", "_LIBCPP_HAS_MUSL_LIBC", - # "_LIBCPP_HAS_THREAD_API_EXTERNAL", + "_LIBCPP_HAS_THREAD_API_EXTERNAL", # Let the library headers know they are currently being used to build the # library.