From: | Mathew Heard <mat999(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar |
Date: | 2025-03-14 03:12:35 |
Message-ID: | CAE5sJtRk6KcjfwPfi_r2h3iCyihBdkBamR74-MJqevp9qnnyYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Tom,
When the configure test is running its forcing armv8-a+crc+simd (has
__crc32cb, etc) rather than testing for the feature against target
architecture (no __crc32cb, etc). While make is compiling for the target
architecture armv7ve+simd (no __crc32cb, etc). During the make it is of
course failing to find __crc32cb etc, they only existed during the
configure test due to the custom cflags used for that feature test (march
armv8-a+crc+simd).
Regardless of if CFLAGS are provided or not to make - make is
targeting ARMv7, not what was used specifically within that specific
configure test.
I'm not really sure what's so confusing about this situation. It seems like
a configure feature test that will always detect CRC support on any ARM gcc
(that supports those functions). I'm mostly surprised your arm build
environment is passing.
armv7 target (no crc) does not generate functions __crc32cb etc.
armv8-a+crc+simd does, but that isnt what make is using. Make is (as it
should be) building a binary for armv7 not armv8-a+crc+simd. Neither does
armv8-a without crc either.
# gcc -march=armv8-a+simd test.c
test.c: In function ‘main’:
test.c:10:10: warning: implicit declaration of function ‘__crc32cb’
[-Wimplicit-function-declaration]
10 | crc = __crc32cb(crc, 0);
| ^~~~~~~~~
test.c:11:10: warning: implicit declaration of function ‘__crc32ch’
[-Wimplicit-function-declaration]
11 | crc = __crc32ch(crc, 0);
| ^~~~~~~~~
test.c:12:10: warning: implicit declaration of function ‘__crc32cw’
[-Wimplicit-function-declaration]
12 | crc = __crc32cw(crc, 0);
| ^~~~~~~~~
test.c:13:10: warning: implicit declaration of function ‘__crc32cd’
[-Wimplicit-function-declaration]
13 | crc = __crc32cd(crc, 0);
| ^~~~~~~~~
/usr/bin/ld: /tmp/cccXuWKB.o: in function `main':
test.c:(.text+0xe): undefined reference to `__crc32cb'
/usr/bin/ld: test.c:(.text+0x26): undefined reference to `__crc32ch'
/usr/bin/ld: test.c:(.text+0x3e): undefined reference to `__crc32cw'
/usr/bin/ld: test.c:(.text+0x56): undefined reference to `__crc32cd'
collect2: error: ld returned 1 exit status
It seems like an appropriate fix would be that test should be always no
feature support unless detected march contains crc if armv8 or lower. All
the feature test is currently doing is detecting GCC support for CRC. Its
not detecting if those functions will exist at build time for the target
architecture which is why the build fails.
On Fri, 14 Mar 2025 at 13:18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Mathew Heard <mat999(at)gmail(dot)com> writes:
> > I don't think its constant folding. It looks like the configure test is
> > doing what you are asking for, compiling for a different target
> > architecture than the target. ARMv7 GCC knows about ARMv8
>
> Right, that's what we want. What we are expecting is that the calls
> to __crc32cb() will compile to machine instructions given the right
> -march flag, and then we can build pg_crc32c_armv8.c that way too.
> At runtime we'll probe to see if the target is ARMv8+CRC and if so
> we'll call the pg_crc32c_armv8.c code to do CRC, instead of doing it
> the hard way (see pg_crc32c_armv8_choose.c).
>
> What seems to be happening for you is that the configure test succeeds
> --- presumably by generating machine instructions --- but then when
> we try to do the very same thing to compile pg_crc32c_armv8.c,
> suddenly the compiler disclaims knowledge of these functions.
> That doesn't make a lot of sense, unless you've modified the build
> process or injected some relevant CFLAGS post-configure. So I'm
> casting about for other explanations.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-03-14 03:46:10 | Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar |
Previous Message | Amit Langote | 2025-03-14 02:48:29 | Re: BUG #18830: ExecInitMerge Segfault on MERGE |