Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 763612 - media-sound/timidity++-2.15.0: alsa backend segfaults at runtime when built with LTO
Summary: media-sound/timidity++-2.15.0: alsa backend segfaults at runtime when built w...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2021-01-04 23:49 UTC by Alexander Miller
Modified: 2021-12-22 03:57 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
timidity++-alsa-symver-lto.patch (timidity++-alsa-symver-lto.patch,288 bytes, patch)
2021-01-04 23:49 UTC, Alexander Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2021-01-04 23:49:47 UTC
Created attachment 681067 [details, diff]
timidity++-alsa-symver-lto.patch

When built with link time optimization, timidity binds to the wrong version of some symbols in libasound.so.2. 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):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6f0728398f6fe33bfcab8ff6d79a1bbf6b13a10

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

    media-sound/timidity++: add LTO workaround patch
    
    Closes: https://bugs.gentoo.org/763612
    Thanks-to: Alexander Miller <alex.miller@gmx.de>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../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(+)