aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2023-03-24 13:29:19 -0400
committerGitHub <[email protected]>2023-03-24 10:29:19 -0700
commit0ad5f4344238b548e2240a405d418f7af9290623 (patch)
tree17dd3ad03ca6edbcb56ac581661706476f6cc836 /include
parent460d887c439079422b642da87a77dbb896f5e64a (diff)
Drop lying to the compiler in the fletcher4 code
This is probably the uncontroversial part of #13631, which fixes a real problem people are having. There's still things to improve in our code after this is merged, but it should stop the breakage that people have reported, where we lie about a type always being aligned and then pass in stack objects with no alignment requirement and hope for the best. Of course, our SIMD code was written with unaligned accesses, so it doesn't care if we drop this...but some auto-vectorized code that gcc emits sure does, since we told it it can assume they're aligned. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #14649
Diffstat (limited to 'include')
-rw-r--r--include/zfs_fletcher.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/include/zfs_fletcher.h b/include/zfs_fletcher.h
index e913a0bd7..ca1a09292 100644
--- a/include/zfs_fletcher.h
+++ b/include/zfs_fletcher.h
@@ -76,19 +76,19 @@ typedef struct zfs_fletcher_superscalar {
} zfs_fletcher_superscalar_t;
typedef struct zfs_fletcher_sse {
- uint64_t v[2] __attribute__((aligned(16)));
+ uint64_t v[2];
} zfs_fletcher_sse_t;
typedef struct zfs_fletcher_avx {
- uint64_t v[4] __attribute__((aligned(32)));
+ uint64_t v[4];
} zfs_fletcher_avx_t;
typedef struct zfs_fletcher_avx512 {
- uint64_t v[8] __attribute__((aligned(64)));
+ uint64_t v[8];
} zfs_fletcher_avx512_t;
typedef struct zfs_fletcher_aarch64_neon {
- uint64_t v[2] __attribute__((aligned(16)));
+ uint64_t v[2];
} zfs_fletcher_aarch64_neon_t;
@@ -161,20 +161,4 @@ _ZFS_FLETCHER_H const fletcher_4_ops_t fletcher_4_aarch64_neon_ops;
}
#endif
-#if defined(ZFS_UBSAN_ENABLED)
-#if defined(__has_attribute)
-#if __has_attribute(no_sanitize_undefined)
-#define ZFS_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
-#elif __has_attribute(no_sanitize)
-#define ZFS_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
-#else
-#error "Compiler has to support attribute "
- "`no_sanitize_undefined` or `no_sanitize(\"undefined\")`"
- "when compiling with UBSan enabled"
-#endif /* __has_attribute(no_sanitize_undefined) */
-#endif /* defined(__has_attribute) */
-#else
-#define ZFS_NO_SANITIZE_UNDEFINED
-#endif /* defined(ZFS_UBSAN_ENABLED) */
-
#endif /* _ZFS_FLETCHER_H */