Created attachment 206567 [details]
FreeBSD doesn't support getauxval(), it has elf_aux_info() instead. Use this to fix build on powerpc64.
Since flac seems to add VSX by default on POWER9, add a non-default option to enable VSX.
I agree with the libFLAC/cpu.c diff.
I don't understand the intended purpose of the VSX option. In libFLAC/stream_encoder.c, the POWER9 and POWER8 routines are only called if cpuinfo.ppc.arch_3_00 and cpuinfo.ppc.arch_2_07, respectively, are true. So the VSX code is compiled on all powerpc64 machines, but only called at runtime on those that support the VSX extensions.
(In reply to Christian Weisgerber from comment #1)
Ah, you're right about VSX.
BTW, the patch for elf_aux_info is being upstreamed now (in a slightly better version).
(In reply to Piotr Kubaj from comment #2)
I approve the cpu.c change if you want to go ahead and unbreak the build.
Ah, I forgot, -mvsx is necessary:
lpc_intrin_vsx.c: In function 'FLAC__lpc_compute_autocorrelation_intrin_power8_vsx_lag_16':
lpc_intrin_vsx.c:94:7: warning: implicit declaration of function 'vec_vsx_ld'; did you mean 'vec_vslh'? [-Wimplicit-function-declaration]
94 | d0 = vec_vsx_ld(0, base);
(In reply to Piotr Kubaj from comment #4)
Well, if -mvsx is required, an option doesn't make sense either since the build would fail with it off.
So should -mvsx be added on powerpc64? Or does this cause the compiler to produce VSX code outside of the intrinsics that would then fail to run on some powerpc64 machines?
I can simply disable assembly optimizations on powerpc64. It is far more important for the port to build (as a dependency) than to be tuned for speed. Also, I just tried it without asm on amd64 and encoding is plenty fast.