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: UNCONFIRMED
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-01-05 00:17 UTC (History)
1 user (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.