Skip to content

Commit

Permalink
Disable ABSL_ATTRIBUTE_TRIVIAL_ABI in open-source builds (#1606)
Browse files Browse the repository at this point in the history
Since compiler support for this attribute differs, if for example
system libraries compiled with GCC are mixed with libraries compiled
with Clang, types will have different ideas about their ABI.

PiperOrigin-RevId: 600467146
  • Loading branch information
derekmauro authored Jan 22, 2024
1 parent ad73c6d commit 4a2c633
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions absl/base/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,11 @@
// See also the upstream documentation:
// https://clang.llvm.org/docs/AttributeReference.html#trivial-abi
//
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::trivial_abi)
#define ABSL_ATTRIBUTE_TRIVIAL_ABI [[clang::trivial_abi]]
#define ABSL_HAVE_ATTRIBUTE_TRIVIAL_ABI 1
#elif ABSL_HAVE_ATTRIBUTE(trivial_abi)
#define ABSL_ATTRIBUTE_TRIVIAL_ABI __attribute__((trivial_abi))
#define ABSL_HAVE_ATTRIBUTE_TRIVIAL_ABI 1
#else
// b/321691395 - This is currently disabled in open-source builds since
// compiler support differs. If system libraries compiled with GCC are mixed
// with libraries compiled with Clang, types will have different ideas about
// their ABI, leading to hard to debug crashes.
#define ABSL_ATTRIBUTE_TRIVIAL_ABI
#endif

// ABSL_ATTRIBUTE_NO_UNIQUE_ADDRESS
//
Expand Down

0 comments on commit 4a2c633

Please sign in to comment.