From af0c248557aecb335462d980cb7319bdf85a5c66 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Tue, 1 Apr 2025 12:01:58 +0700 Subject: [PATCH] Use function attributes for SSE 4.2 even when targeting that extension On Red Hat 9 systems (or similar), the packaged gcc targets x86-64-v2, but clang does not. This has caused build failures in the wake of commit e2809e3a1 when building --with-llvm. The most expedient fix is to use the same function attributes for the inlined function as we do for the global function. Reported-by: Kyotaro Horiguchi (plus members skimmer and bumblebee) Diagnosed-by: Tom Lane Tested-by: Todd Cook Discussion: https://postgr.es/m/CANWCAZZSxs3a1YRKehkgk2OHKbrVn+xZ+AWW8Co2R_f70NqqmA@mail.gmail.com --- src/include/port/pg_crc32c.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h index 0ab7513f523..9376d223fef 100644 --- a/src/include/port/pg_crc32c.h +++ b/src/include/port/pg_crc32c.h @@ -52,7 +52,13 @@ typedef uint32 pg_crc32c; extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len); +/* + * We can only get here if the host compiler targets SSE 4.2, but on some + * systems gcc and clang don't have the same built-in targets, so we still + * must use a function attribute here to accommodate "--with-llvm" builds. + */ pg_attribute_no_sanitize_alignment() +pg_attribute_target("sse4.2") static inline pg_crc32c pg_comp_crc32c_dispatch(pg_crc32c crc, const void *data, size_t len) -- 2.39.5