On Mon, Mar 31, 2025 at 3:07 PM John Naylor <johncnaylo...@gmail.com> wrote:
>
> On Mon, Mar 31, 2025 at 2:18 PM John Naylor <johncnaylo...@gmail.com> wrote:
>
> > Hmm, skimmer doesn't like this, and it's one of the animals that
> > builds with -msse4.2:
> >
> > https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=skimmer&dt=2025-03-31%2007%3A00%3A27&stg=configure
> >
> > "checking which CRC-32C implementation to use... SSE 4.2"
> >
> >  I'm now looking for clues as to what could be causing the build failure.
>
> Looking at the configure output, I don't see -msee4.2 (or equivalent),
> so it shouldn't be reporting that it's targeting SSE 4.2.

Another clue: A few RHEL 9 x86_64 machines have reported in (webworm,
shikra) with successful builds, and they also report targeting SSE 4.2
and also don't have special CFLAG's. We do know RHEL 9 has a policy of
always targeting x86_64-v2, and it seems that they don't require
user/packager intervention to achieve that, so I imagine their
packaged compiler always defines __SSE4_2__ etc.

The two problem systems are CentOS stream 9 (apparently using LTO),
and Rocky Linux 9 (still awaiting details). Both of these are supposed
to be like RHEL 9.

I found these old gcc bug reports for a similar symptom when using LTO:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71991
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84926

...so one theory is that the OS's with failing builds have let a
similar bug back in.

A possible workaround would be add a normally-superfluous
"pg_attribute_target("sse4.2")" to the inlined function, as in the
attached.

--
John Naylor
Amazon Web Services
diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h
index 0ab7513f523..b4198975fa6 100644
--- a/src/include/port/pg_crc32c.h
+++ b/src/include/port/pg_crc32c.h
@@ -53,6 +53,7 @@ typedef uint32 pg_crc32c;
 extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
 
 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)

Reply via email to