Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650458 - media-video/mplayer-1.3.0-r4 fails to build with -flto: undefined reference to `sse_int32_map_factor', `sse_int32_80h'
Summary: media-video/mplayer-1.3.0-r4 fails to build with -flto: undefined reference t...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: media-video herd
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2018-03-14 02:17 UTC by Alexander Miller
Modified: 2018-03-20 04:55 UTC (History)
1 user (show)

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


Attachments
mplayer-1.3.0-fix-lto-linking.patch (mplayer-1.3.0-fix-lto-linking.patch,1.74 KB, patch)
2018-03-14 02:17 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 2018-03-14 02:17:33 UTC
Created attachment 523834 [details, diff]
mplayer-1.3.0-fix-lto-linking.patch

With LTO, building mplayer fails during the final link. Here's the relevant part of the build log:

x86_64-pc-linux-gnu-gcc -o mplayer [...many objects, libs, and options...]
[...unrelated warnings...]
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: warning: relocation against `sse_int32_map_factor' in readonly section `.text'
/tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: In function `render_frame_yuv420p_sse4':
<artificial>:(.text+0xb1b): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xb24): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xb2d): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xb36): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xb3e): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xb46): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xb4e): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xb56): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xc93): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xc9c): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xca5): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xcae): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0xcb6): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xcbe): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xcc6): undefined reference to `sse_int32_80h'
<artificial>:(.text+0xcce): undefined reference to `sse_int32_80h'
/tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: In function `render_frame_yuv422_sse4':
<artificial>:(.text+0x1143): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0x114c): undefined reference to `sse_int32_map_factor'
<artificial>:(.text+0x1154): undefined reference to `sse_int32_80h'
<artificial>:(.text+0x115c): undefined reference to `sse_int32_80h'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in a shared object.
collect2: error: ld returned 1 exit status
make: *** [Makefile:747: mplayer] Error 1
 * ERROR: media-video/mplayer-1.3.0-r4::gentoo failed (compile phase):
 *   emake failed

This is due to some inline assembler which uses direct symbol references. Because gcc doesn't parse asm statements, it doesn't know these variables are referenced from the code, and when partitioning it may omit them from the units where they're needed.

The attached patch disables direct references and adds named constraints where missing. That fixes the build for me.