Skip to content

Commit

Permalink
More semantic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
niranjanyardi committed Jan 14, 2025
1 parent 0930a4b commit d8354f7
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 17 deletions.
12 changes: 9 additions & 3 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" ]
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1732,16 +1737,14 @@ component("base") {
]
}

# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
if (is_cobalt && is_cobalt_hermetic_build) {
sources -= [
"process/process_metrics_posix.cc",
"sync_socket_posix.cc",
]
}

# ../../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",
Expand All @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions base/allocator/partition_allocator/partition_alloc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <linux/version.h>
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cobalt/build/configs/linux-x64x11-evergreen/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions third_party/abseil-cpp/absl/base/internal/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/syscall.h>
#define ABSL_HAVE_SYSCALL_WRITE 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
Expand Down Expand Up @@ -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<unsigned>(len));
#elif defined(STARBOARD)
#elif BUILDFLAG(IS_STARBOARD)
SbLog(kSbLogPriorityError, s);
#else
// stderr logging unsupported on this platform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions third_party/abseil-cpp/absl/synchronization/internal/futex.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
#define ABSL_SYNCHRONIZATION_INTERNAL_FUTEX_H_

#include "absl/base/config.h"
#include "build/build_config.h"

#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
#endif

#if !defined(OS_STARBOARD)
#if !BUILDFLAG(IS_STARBOARD)
#ifdef __linux__
#include <linux/futex.h>
#include <sys/syscall.h>
#endif
#endif
#endif // !BUILDFLAG(IS_STARBOARD)

#include <errno.h>
#include <stdio.h>
Expand Down
5 changes: 4 additions & 1 deletion third_party/boringssl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project/libcxx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project/libcxxabi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d8354f7

Please sign in to comment.