Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 763612

Summary: media-sound/timidity++-2.15.0: alsa backend segfaults at runtime when built with LTO
Product: Gentoo Linux Reporter: Alexander Miller <alex.miller>
Component: Current packagesAssignee: Gentoo Sound Team <sound>
Severity: normal CC: ionen, sam
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: timidity++-alsa-symver-lto.patch

Description Alexander Miller 2021-01-04 23:49:47 UTC
Created attachment 681067 [details, diff]

When built with link time optimization, timidity binds to the wrong version of some symbols in This happens because it uses the old 0.9 API (it defines ALSA_PCM_OLD_HW_PARAMS_API), and in this case the alsa headers emit some global asm statements with .symver directives to make the linker bind to the old versions. That doesn't work with LTO, though: the asm statements and the code referencing the affected symbols may end up in different partitions, making the .symver statements ineffective.

So the real problem is in the alsa headers, but there's no easy way to fix it (at least for gcc before version 10). So I think we should fix the issue in timidity.

The attached patch contains a workaround for timidity; it disables LTO for the alsa backend. With the patch applied, timidity uses the correct version of the symbols and no longer causes segmentation faults in my tests.
Comment 1 Larry the Git Cow gentoo-dev 2021-12-22 03:57:11 UTC
The bug has been closed via the following commit(s):

commit a6f0728398f6fe33bfcab8ff6d79a1bbf6b13a10
Author:     Sam James <>
AuthorDate: 2021-12-22 02:46:37 +0000
Commit:     Sam James <>
CommitDate: 2021-12-22 02:46:37 +0000

    media-sound/timidity++: add LTO workaround patch
    Thanks-to: Alexander Miller <>
    Signed-off-by: Sam James <>

 .../timidity++/files/timidity++-2.15.0-lto-workaround.patch    | 10 ++++++++++
 media-sound/timidity++/timidity++-2.15.0-r2.ebuild             |  1 +
 2 files changed, 11 insertions(+)