diff options
Diffstat (limited to 'absl')
-rw-r--r-- | absl/BUILD.bazel | 2 | ||||
-rw-r--r-- | absl/base/internal/raw_logging.h | 10 | ||||
-rw-r--r-- | absl/container/internal/btree.h | 30 | ||||
-rw-r--r-- | absl/debugging/internal/stack_consumption.cc | 3 | ||||
-rw-r--r-- | absl/debugging/internal/stack_consumption.h | 5 | ||||
-rw-r--r-- | absl/flags/flag.h | 8 | ||||
-rw-r--r-- | absl/flags/flag_test.cc | 11 | ||||
-rw-r--r-- | absl/flags/flag_test_defs.cc | 2 | ||||
-rw-r--r-- | absl/flags/internal/registry.h | 2 |
9 files changed, 40 insertions, 33 deletions
diff --git a/absl/BUILD.bazel b/absl/BUILD.bazel index 1019ab5e..0b772df4 100644 --- a/absl/BUILD.bazel +++ b/absl/BUILD.bazel @@ -21,7 +21,7 @@ load( package(default_visibility = ["//visibility:public"]) -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) create_llvm_config( name = "llvm_compiler", diff --git a/absl/base/internal/raw_logging.h b/absl/base/internal/raw_logging.h index 51551baf..2508f3cf 100644 --- a/absl/base/internal/raw_logging.h +++ b/absl/base/internal/raw_logging.h @@ -72,10 +72,12 @@ // // The API is a subset of the above: each macro only takes two arguments. Use // StrCat if you need to build a richer message. -#define ABSL_INTERNAL_LOG(severity, message) \ - do { \ - ::absl::raw_logging_internal::internal_log_function( \ - ABSL_RAW_LOGGING_INTERNAL_##severity, __FILE__, __LINE__, message); \ +#define ABSL_INTERNAL_LOG(severity, message) \ + do { \ + constexpr const char* absl_raw_logging_internal_filename = __FILE__; \ + ::absl::raw_logging_internal::internal_log_function( \ + ABSL_RAW_LOGGING_INTERNAL_##severity, \ + absl_raw_logging_internal_filename, __LINE__, message); \ } while (0) #define ABSL_INTERNAL_CHECK(condition, message) \ diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index ab85f7da..293e5771 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -817,12 +817,16 @@ class btree_node { } } + static void transfer(slot_type *dest, slot_type *src, allocator_type *alloc) { + absl::container_internal::SanitizerUnpoisonObject(dest); + params_type::transfer(alloc, dest, src); + absl::container_internal::SanitizerPoisonObject(src); + } + // Transfers value from slot `src_i` in `src_node` to slot `dest_i` in `this`. void transfer(const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonObject(slot(dest_i)); - params_type::transfer(alloc, slot(dest_i), src_node->slot(src_i)); - absl::container_internal::SanitizerPoisonObject(src_node->slot(src_i)); + transfer(slot(dest_i), src_node->slot(src_i), alloc); } // Transfers `n` values starting at value `src_i` in `src_node` into the @@ -830,19 +834,11 @@ class btree_node { void transfer_n(const size_type n, const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonMemoryRegion( - slot(dest_i), n * sizeof(slot_type)); for (slot_type *src = src_node->slot(src_i), *end = src + n, *dest = slot(dest_i); src != end; ++src, ++dest) { - params_type::transfer(alloc, dest, src); + transfer(dest, src, alloc); } - // We take care to avoid poisoning transferred-to nodes in case of overlap. - const size_type overlap = - this == src_node ? (std::max)(src_i, dest_i + n) - src_i : 0; - assert(n >= overlap); - absl::container_internal::SanitizerPoisonMemoryRegion( - src_node->slot(src_i + overlap), (n - overlap) * sizeof(slot_type)); } // Same as above, except that we start at the end and work our way to the @@ -850,19 +846,11 @@ class btree_node { void transfer_n_backward(const size_type n, const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonMemoryRegion( - slot(dest_i), n * sizeof(slot_type)); for (slot_type *src = src_node->slot(src_i + n - 1), *end = src - n, *dest = slot(dest_i + n - 1); src != end; --src, --dest) { - params_type::transfer(alloc, dest, src); + transfer(dest, src, alloc); } - // We take care to avoid poisoning transferred-to nodes in case of overlap. - assert(this != src_node || dest_i >= src_i); - const size_type num_to_poison = - this == src_node ? (std::min)(n, dest_i - src_i) : n; - absl::container_internal::SanitizerPoisonMemoryRegion( - src_node->slot(src_i), num_to_poison * sizeof(slot_type)); } template <typename P> diff --git a/absl/debugging/internal/stack_consumption.cc b/absl/debugging/internal/stack_consumption.cc index 875ca6d9..e3dd51c3 100644 --- a/absl/debugging/internal/stack_consumption.cc +++ b/absl/debugging/internal/stack_consumption.cc @@ -42,7 +42,8 @@ namespace { // one of them is null, the results of p<q, p>q, p<=q, and p>=q are // unspecified. Therefore, instead we hardcode the direction of the // stack on platforms we know about. -#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \ + defined(__aarch64__) constexpr bool kStackGrowsDown = true; #else #error Need to define kStackGrowsDown diff --git a/absl/debugging/internal/stack_consumption.h b/absl/debugging/internal/stack_consumption.h index 5e60ec42..2b5e7151 100644 --- a/absl/debugging/internal/stack_consumption.h +++ b/absl/debugging/internal/stack_consumption.h @@ -24,8 +24,9 @@ // Use this feature test macro to detect its availability. #ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION #error ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION cannot be set directly -#elif !defined(__APPLE__) && !defined(_WIN32) && \ - (defined(__i386__) || defined(__x86_64__) || defined(__ppc__)) +#elif !defined(__APPLE__) && !defined(_WIN32) && \ + (defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \ + defined(__aarch64__)) #define ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION 1 namespace absl { diff --git a/absl/flags/flag.h b/absl/flags/flag.h index e1707252..cdac545b 100644 --- a/absl/flags/flag.h +++ b/absl/flags/flag.h @@ -381,8 +381,10 @@ ABSL_NAMESPACE_END // unused. // TODO(rogeeff): replace RETIRED_FLAGS with FLAGS once forward declarations of // retired flags are cleaned up. -#define ABSL_RETIRED_FLAG(type, name, default_value, explanation) \ - ABSL_ATTRIBUTE_UNUSED static const absl::flags_internal::RetiredFlag<type> \ - RETIRED_FLAGS_##name(#name) +#define ABSL_RETIRED_FLAG(type, name, default_value, explanation) \ + static absl::flags_internal::RetiredFlag<type> RETIRED_FLAGS_##name; \ + ABSL_ATTRIBUTE_UNUSED static const auto RETIRED_FLAGS_REG_##name = \ + (RETIRED_FLAGS_##name.Retire(#name), \ + ::absl::flags_internal::FlagRegistrarEmpty{}) #endif // ABSL_FLAGS_FLAG_H_ diff --git a/absl/flags/flag_test.cc b/absl/flags/flag_test.cc index 2eb2ba71..654c8122 100644 --- a/absl/flags/flag_test.cc +++ b/absl/flags/flag_test.cc @@ -812,6 +812,17 @@ ABSL_RETIRED_FLAG(bool, old_bool_flag, true, "old descr"); ABSL_RETIRED_FLAG(int, old_int_flag, (int)std::sqrt(10), "old descr"); ABSL_RETIRED_FLAG(std::string, old_str_flag, "", absl::StrCat("old ", "descr")); +bool initializaion_order_fiasco_test = [] { + // Iterate over all the flags during static initialization. + // This should not trigger ASan's initialization-order-fiasco. + auto* handle1 = absl::FindCommandLineFlag("flag_on_separate_file"); + auto* handle2 = absl::FindCommandLineFlag("retired_flag_on_separate_file"); + if (handle1 != nullptr && handle2 != nullptr) { + return handle1->Name() == handle2->Name(); + } + return true; +}(); + namespace { TEST_F(FlagTest, TestRetiredFlagRegistration) { diff --git a/absl/flags/flag_test_defs.cc b/absl/flags/flag_test_defs.cc index 3366c580..4e1693cd 100644 --- a/absl/flags/flag_test_defs.cc +++ b/absl/flags/flag_test_defs.cc @@ -20,3 +20,5 @@ ABSL_FLAG(int, mistyped_int_flag, 0, ""); ABSL_FLAG(std::string, mistyped_string_flag, "", ""); +ABSL_FLAG(bool, flag_on_separate_file, false, ""); +ABSL_RETIRED_FLAG(bool, retired_flag_on_separate_file, false, ""); diff --git a/absl/flags/internal/registry.h b/absl/flags/internal/registry.h index 5f85ded5..1df2db79 100644 --- a/absl/flags/internal/registry.h +++ b/absl/flags/internal/registry.h @@ -83,7 +83,7 @@ constexpr size_t kRetiredFlagObjAlignment = alignof(void*); template <typename T> class RetiredFlag { public: - explicit RetiredFlag(const char* flag_name) { + void Retire(const char* flag_name) { flags_internal::Retire(flag_name, base_internal::FastTypeId<T>(), buf_); } |