<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62394>62394</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Wrong alignment of __sanitizer_siginfo for x32
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hjl-tools
</td>
</tr>
</table>
<pre>
When building x32 libsanitizer in GCC master branch with
```
commit d53b3d94aaf211ffb2159614f5aaaf03ceb861cc
Author: Martin Liska <mliska@suse.cz>
Date: Wed Apr 26 09:42:29 2023 +0200
libsanitizer: merge from upstream (3185e47b5a8444e9fd).
```
I got
```
/export/gnu/import/git/sources/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:1146:35: error: static assertion failed
1146 | COMPILER_CHECK(alignof(siginfo_t) == alignof(__sanitizer_siginfo));
```
This is caused by ed9ef9b4f248c62022bb1bebe5e2597cb4f9d209
```
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 2146daf7b119..fdc69b8a5fba 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -586,11 +586,31 @@ struct __sanitizer_sigset_t {
};
#endif
-struct __sanitizer_siginfo {
- // The size is determined by looking at sizeof of real siginfo_t on linux.
- u64 opaque[128 / sizeof(u64)];
+struct __sanitizer_siginfo_pad {
+ // Require uptr, because siginfo_t is always pointer-size aligned on Linux.
+ uptr pad[128 / sizeof(uptr)];
};
...
```
X32 siginfo_t is aligned to 8 bytes, not 4 bytes.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVUGP2zgP_TXKhbBhU7LHPuSQyTTfV2yLXRQFurdAsqhErW25ktzO9NcvZGcmnSJ7WRQ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