Skip to content

Commit

Permalink
[nsan] Swap alignas and visibility order (NFC) (llvm#98933)
Browse files Browse the repository at this point in the history
Use `alignas(16) SANITIZER_INTERFACE_ATTRIBUTE` instead of
`SANITIZER_INTERFACE_ATTRIBUTE alignas(16)`, as the former is not
supported prior to clang 16. See https://clang.godbolt.org/z/Wj1193xWK.

This was broken by llvm#96142 as
part of other style changes.
  • Loading branch information
nikic authored and sgundapa committed Jul 23, 2024
1 parent a1c1c26 commit f63856e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions compiler-rt/lib/nsan/nsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,24 +390,23 @@ __nsan_dump_shadow_mem(const u8 *addr, size_t size_bytes, size_t bytes_per_line,
}
}

SANITIZER_INTERFACE_ATTRIBUTE
alignas(16) thread_local uptr __nsan_shadow_ret_tag = 0;
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE
thread_local uptr __nsan_shadow_ret_tag = 0;

SANITIZER_INTERFACE_ATTRIBUTE
alignas(16) thread_local char __nsan_shadow_ret_ptr[kMaxVectorWidth *
sizeof(__float128)];
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE
thread_local char __nsan_shadow_ret_ptr[kMaxVectorWidth *
sizeof(__float128)];

SANITIZER_INTERFACE_ATTRIBUTE
alignas(16) thread_local uptr __nsan_shadow_args_tag = 0;
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE
thread_local uptr __nsan_shadow_args_tag = 0;

// Maximum number of args. This should be enough for anyone (tm). An alternate
// scheme is to have the generated code create an alloca and make
// __nsan_shadow_args_ptr point ot the alloca.
constexpr const int kMaxNumArgs = 128;
SANITIZER_INTERFACE_ATTRIBUTE
alignas(
16) thread_local char __nsan_shadow_args_ptr[kMaxVectorWidth * kMaxNumArgs *
sizeof(__float128)];
alignas(16) SANITIZER_INTERFACE_ATTRIBUTE
thread_local char __nsan_shadow_args_ptr[kMaxVectorWidth * kMaxNumArgs *
sizeof(__float128)];

enum ContinuationType { // Keep in sync with instrumentation pass.
kContinueWithShadow = 0,
Expand Down

0 comments on commit f63856e

Please sign in to comment.