Fix the runtime crash described in #34881.
Upstream already disables ASan instrumentation for sha256_sse4::Transform() under Clang. This extends the same workaround to GCC by adding an #elif branch for __GNUC__ / __SANITIZE_ADDRESS__ that applies the same no_sanitize("address") attribute.
Testing:
- reproduced the crash before the fix with GCC 13, 14, and 15 on Haswell-class machines / guests without SHA-NI (including by forcing the SSE4 implementation on GitHub CI)
- SEGV in debug builds regardless of optimization level (tested
-O0,-O1,-O2,-O3) - verified that the GCC + ASan debug configurations that previously crashed pass with this change
Issue #34881 has more details about the issue.
Note: the original Clang code placed the __attribute__ between the function declarator and the opening brace. GCC’s Attribute Syntax documentation notes that this position in a function definition “may, in future, be permitted,” so it is not currently supported. Placing the attribute at the start of the function definition is valid form for both GCC and Clang.