alsa-project/alsa-lib issue #281 was opened from kkofler:
Applications using `ALSA_PCM_OLD_HW_PARAMS_API` and/or `ALSA_PCM_OLD_SW_PARAMS_API` get miscompiled if they are compiled with `-flto` (GCC link-time optimization (LTO)). See https://bugzilla.redhat.com/show_bug.cgi?id=1910437 and in particular https://bugzilla.redhat.com/show_bug.cgi?id=1910437#c23 .
The issue is that the `pcm_old.h` header uses constructs like: ```c asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9"); ``` which do not seem to work with LTO enabled. Maybe this needs to use the `symver` attribute instead?
In any case, what happens is that the caller in the application attempts to call the new function `snd_pcm_hw_params_set_rate_near@ALSA_0.9.0rc4` with the ABI of the old one `snd_pcm_hw_params_set_rate_near@ALSA_0.9`, so an integer is passed where ALSA expects a pointer, leading to a segfault (or worse).
The workaround is to compile the application without LTO enabled (which makes it work fine), but I believe that this is an upstream ALSA issue and should be fixed in the ALSA header files.
Issue URL : https://github.com/alsa-project/alsa-lib/issues/281 Repository URL: https://github.com/alsa-project/alsa-lib