Skip to content

Commit

Permalink
tweak alignment fix to __cxa_exception replica under libstdc++
Browse files Browse the repository at this point in the history
Summary: Best to use `[[gnu::aligned]]` exactly since that is precisely what libstdc++ uses internally. Attempting to use `max_align_t` instead is an approximation but may not work exactly.

Reviewed By: skrueger

Differential Revision: D68520433

fbshipit-source-id: c74e41b6ab576838b06ee4db87230e9a86b90c09
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 23, 2025
1 parent 568b3f5 commit 6d6811c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion third-party/folly/src/folly/lang/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ namespace __cxxabiv1 {
static constexpr size_t __folly_unwind_exception_align = 8;
#else
// https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/libgcc/unwind-generic.h#L106
static constexpr size_t __folly_unwind_exception_align = alignof(max_align_t);
struct __folly_unwind_exception_align_t {
[[gnu::aligned]] int data;
};
static constexpr size_t __folly_unwind_exception_align =
alignof(__folly_unwind_exception_align_t);
#endif

static constexpr uint64_t __gxx_primary_exception_class =
Expand Down

0 comments on commit 6d6811c

Please sign in to comment.