Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mathew Heard <mat999@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-03-14T01:45:39Z
Lists: pgsql-bugs
Attachments
- prevent-constant-folding-in-CRC-probes.patch (text/x-diff) patch
I wrote: > The configure script isn't "identifying" anything. It's just seeing > whether references to __crc32cb() etc will compile with different > -march flags. It's not apparent why a successful test of that sort > would not lead to a successful compilation with the same flags later > on. Actually ... looking harder at the test code, perhaps I see a way. We're testing this: unsigned int crc = 0; crc = __crc32cb(crc, 0); crc = __crc32ch(crc, 0); crc = __crc32cw(crc, 0); crc = __crc32cd(crc, 0); /* return computed value, to prevent the above being optimized away */ return crc == 0; but that "prevent the above being optimized away" looks mighty leaky. Specifically, there's nothing stopping the compiler from folding all these CRC calls to constants, since the input is constant. So in an environment where the compiler knows these functions but glibc doesn't have them, perhaps we could get a false pass --- and then the real code with non-constant inputs could fail? I'm not very convinced of this theory, because I checked with gcc 12.2.0 and it wouldn't do that even at max -O level. But maybe your compiler is different. Could you try the attached patch for configure and see if it arrives at the right conclusions? regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Update configure probes for CFLAGS needed for ARM CRC instructions.
- 5980f1884fc9 18.0 cited