Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 179872 - media-video/ffmpeg-* TEXTRELs
Summary: media-video/ffmpeg-* TEXTRELs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL: https://lists.mplayerhq.hu/pipermail/...
Whiteboard:
Keywords:
: 115568 252613 263954 265398 267570 337571 401729 (view as bug list)
Depends on:
Blocks: 170860 299047
  Show dependency tree
 
Reported: 2007-05-26 12:24 UTC by Samuli Suominen (RETIRED)
Modified: 2012-02-02 10:11 UTC (History)
21 users (show)

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


Attachments
textrel fix for ffmpeg-0.4.9_p20070616 (ffmpeg-0.4.9_p20070616-pic.patch,91.28 KB, patch)
2007-10-06 01:32 UTC, PaX Team
Details | Diff
ebuild patch (ffmpeg-0.4.9_p20070616-r2.ebuild.patch,953 bytes, patch)
2008-05-24 02:56 UTC, Timo Breitner
Details | Diff
Textrel fix for libavcodec on amd64 (ffmpeg-0.4.9_p20090201-amd64-textrel.patch,1.24 KB, patch)
2009-02-18 20:03 UTC, Ralph Sennhauser (RETIRED)
Details | Diff
Fix TEXTREL in STORE_BGR24_MMX and rgb24tobgr24 (libswscals_textrel.patch,3.94 KB, patch)
2010-07-30 18:01 UTC, Magnus Granberg
Details | Diff
Fix TEXTREL in libswscale.so (libswscale_textrel.patch,10.94 KB, patch)
2010-07-31 19:13 UTC, Magnus Granberg
Details | Diff
patch for ffmpeg-0.6.ebuild (ffmpeg-0.6-pic.patch,1.47 KB, patch)
2010-09-18 12:43 UTC, Xake
Details | Diff
patch for ffmpeg-ebuild (ffmpeg-0.6.ebuild-patch,446 bytes, patch)
2010-09-19 12:47 UTC, Xake
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Samuli Suominen (RETIRED) gentoo-dev 2007-05-26 12:24:34 UTC
Tested as requested, doesn't build on x86.

[ebuild     U ] media-video/ffmpeg-0.4.9_p20070525 [0.4.9_p20070330] USE="X a52 aac encode mmx ogg sdl theora truetype v4l vorbis xvid zlib (-altivec) -amr -debug -doc -dts -ieee1394 -imlib -network -oss -test -threads -x264" 0 kB 

i686-pc-linux-gnu-gcc -O2 -march=athlon-xp -pipe -fomit-frame-pointer -fomit-frame-pointer -fomit-frame-pointer -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libavutil -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libavcodec -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libavformat -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libswscale -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libswscale -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libavcodec  -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg"/libavutil -O2 -march=athlon-xp -pipe -fomit-frame-pointer -fomit-frame-pointer -fomit-frame-pointer -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -fPIC -DPIC -c -o cabac.o cabac.c
cabac.h: In function ‘get_cabac_noinline’:
cabac.h:526: error: PIC register ‘%ebx’ clobbered in ‘asm’
cabac.h: In function ‘get_cabac’:
cabac.h:526: error: PIC register ‘%ebx’ clobbered in ‘asm’
cabac.h:113: warning: ‘put_cabac_static’ defined but not used
cabac.h:159: warning: ‘put_cabac_terminate’ defined but not used
cabac.h:187: warning: ‘put_cabac_u’ defined but not used
cabac.h:222: warning: ‘put_cabac_ueg’ defined but not used
cabac.h:274: warning: ‘refill2’ defined but not used
cabac.h:582: warning: ‘get_cabac_noinline’ defined but not used
cabac.h:688: warning: ‘decode_significance_x86’ defined but not used
cabac.h:738: warning: ‘decode_significance_8x8_x86’ defined but not used
cabac.h:799: warning: ‘get_cabac_terminate’ defined but not used
cabac.h:812: warning: ‘get_cabac_u’ defined but not used
cabac.h:828: warning: ‘get_cabac_ueg’ defined but not used
make[1]: *** [h264.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg/libavcodec'
make: *** [lib] Error 2

Portage 2.1.2.7 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.5-r2, 2.6.21-rc7-git4 i686)
=================================================================
System uname: 2.6.21-rc7-git4 i686 AMD Athlon(tm) XP 2200+
Gentoo Base System release 2.0.0_alpha3
dev-java/java-config: 1.3.7, 2.0.32
dev-lang/python:     2.5.1-r2
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="-O2 -march=athlon-xp -pipe"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1,--as-needed"
MAKEOPTS="-j2"
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-05-26 13:05:56 UTC
Bug 172845 again; where did the fix go?
Comment 2 David Pufer 2007-05-26 13:10:13 UTC
Also, the new ebuild 20070525 doesnt configure with option "--enable-libdts".

The configure error on x86 is as follows:

ebuild media-video/ffmpeg-0.4.9_p20070525 USE="X a52 aac dts encode ieee1394
mmx network ogg sdl theora threads truetype vorbis x264 xvid zlib (-altivec)
-amr -debug -doc -imlib -oss -test -v4l"



>>> Unpacking ffmpeg-0.4.9-p20070525.tar.bz2 to /var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work
 * Applying ffmpeg-libdir-2007.patch ...                                       
                                                    [ ok ]
 * Applying ffmpeg-shared-gcc4.1.patch ...                                     
                                                    [ ok ]
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/work/ffmpeg ...
true
Unknown option "--enable-libdts".
See ./configure --help for available options.

!!! ERROR: media-video/ffmpeg-0.4.9_p20070525 failed.
Call stack:
  ebuild.sh, line 1615:   Called dyn_compile
  ebuild.sh, line 972:   Called qa_call 'src_compile'
  ebuild.sh, line 44:   Called src_compile
  ffmpeg-0.4.9_p20070525.ebuild, line 140:   Called die

!!! configure failed
!!! If you need support, post the topmost build error, and the call stack if
relevant.
!!! A complete build log is located at
'/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/temp/build.log'.


In my opinion, there should be just one bug tracing all the configure and
compile errors for this package.


David Pufer
Comment 3 Alexis Ballier gentoo-dev 2007-05-26 13:28:17 UTC
probably why it's still masked...


adding -DBROKEN_RELOCATIONS to cflags should fix the build
or appending "-fPIC -DPIC" to cflags should teach configure checks that ebx is cloberred (and wont break policy more as it uses the same objects for shared libs and static ones iirc)


libdts support has been removed in favor to native ffmpeg dts decoder iirc
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2007-06-01 10:18:20 UTC
(In reply to comment #3)
> libdts support has been removed in favor to native ffmpeg dts decoder iirc

Removed USE dts from ebuild since there seems to be no option for dts or dca.
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2007-06-01 10:35:19 UTC
Appending -fPIC and -DPIC works, haven't tried -DBROKEN_RELOCATIONS. 

At least it builds.

 * QA Notice: The following files contain runtime text relocations
 *  Text relocations force the dynamic linker to perform extra
 *  work at startup, waste system resources, and may pose a security
 *  risk.  On some architectures, the code may not even function
 *  properly, if at all.
 *  For more information, see http://hardened.gentoo.org/pic-fix-guide.xml
 *  Please include this file in your report:
 *  /var/tmp/portage/media-video/ffmpeg-0.4.9_p20070525/temp/scanelf-textrel.log
 * TEXTREL usr/lib/libavcodec.so.51.40.4
TEXTREL usr/lib/libpostproc.so.51.1.0


 * QA Notice: Package has poor programming practices which may compile
 *            fine but exhibit random runtime failures.
 * dsputil.c:3397: warning: dereferencing type-punned pointer will break strict-aliasing rules
[..snip..]
i386/fdct_mmx.c:527: warning: dereferencing type-punned pointer will break strict-aliasing rules
[..snip..]
i386/h264dsp_mmx.c:1359: warning: dereferencing type-punned pointer will break strict-aliasing rules
[..snip..]
i386/simple_idct_mmx.c:213: warning: dereferencing type-punned pointer will break strict-aliasing rules
flicvideo.c:587: warning: dereferencing type-punned pointer will break strict-aliasing rules
h264.c:6713: warning: dereferencing type-punned pointer will break strict-aliasing rules
tscc.c:144: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:958: warning: dereferencing type-punned pointer will break strict-aliasing rules
[..snip..]
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2007-06-01 10:50:39 UTC
Builds with -DBROKEN_RELOCATIONS as well, same QA notices. TEXTREL ones needs to be fixed I suppose.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2007-06-01 11:21:38 UTC
If someone has a real fix that'd be great. I'm leaving this open for real solution and mentioned TEXTREL.

  01 Jun 2007; Samuli Suominen <drac@gentoo.org>
  ffmpeg-0.4.9_p20070525.ebuild:
  Append -DBROKEN_RELOCATIONS which is a hack to workaround bug 179872.
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2007-06-27 11:57:18 UTC
ffmpeg-20070616-r1,

/var/tmp/portage/media-video/ffmpeg-0.4.9_p20070616-r1/temp/scanelf-textrel.log
 * TEXTREL usr/lib/libswscale.so.0.5.0
TEXTREL usr/lib/libavcodec.so.51.40.4
TEXTREL usr/lib/libpostproc.so.51.1.0
Comment 9 PaX Team 2007-10-06 01:32:44 UTC
Created attachment 132693 [details, diff]
textrel fix for ffmpeg-0.4.9_p20070616

this is a forward port of my older patch, it fixes most textrels in asm code except for libavcodec/cabac.h which is kinda messy, so -DBROKEN_RELOCATIONS is still needed. it's compile tested, other than that it'll need a thorough review and testing.
Comment 10 Timo Breitner 2008-05-24 02:53:45 UTC
The Bug appeared again today, when I installed Gentoo on a new machine. Turns out that "-DBROKEN_RELOCATIONS", which is appended in "src_unpack()", disappears somehow in "src_compile()" and therefore the Bug is there again. A quick fix was moving the relevant "append-flag" commands into the rigth sections (a patch is attached).
Comment 11 Timo Breitner 2008-05-24 02:56:45 UTC
Created attachment 154103 [details, diff]
ebuild patch

solves the issue, when appended flags get lost between ebuild function calls
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2008-05-24 07:54:55 UTC
(In reply to comment #10)
> The Bug appeared again today, when I installed Gentoo on a new machine. Turns
> out that "-DBROKEN_RELOCATIONS", which is appended in "src_unpack()",
> disappears somehow in "src_compile()" and therefore the Bug is there again. A
> quick fix was moving the relevant "append-flag" commands into the rigth
> sections (a patch is attached).
> 

emerge --info, which version of portage this is?
Comment 13 Timo Breitner 2008-05-24 08:36:03 UTC
Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r8 i686)
=================================================================
System uname: 2.6.24-gentoo-r8 i686 AMD Athlon(tm) XP 2800+
Timestamp of tree: Fri, 23 May 2008 14:04:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.4-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/init.d /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://de-mirror.org/distro/gentoo/"
LANG="de_DE.utf8"
LC_ALL="de_DE.utf8"
LINGUAS="de en en_GB"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/myown"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa arts bash-completion berkdb bzip2 cdio cdr cli cracklib crypt cups dbus dri dvb dvd dvdr dvdread emboss encode evo fam ffmpeg firefox flac fontconfig fortran gdbm gif glibc-omitfp gnutls gpm gtk hal hddtemp iconv imagemagick iproute2 ipv6 isdnlog jpeg jpeg2k kde kdehiddenvisibility kerberos lame latex ldap lm_sensors logitech-mouse loop-aes mad midi mikmod mjpeg mmap mmx mmxext mng mp3 mpeg mplayer mudflap ncurses network-cron nls nptl nptlonly nsplugin nvidia ogg opengl openmp pam pcre pdf perl pic png ppds pppd pthreads python qt qt3 qt3support qt4 quicktime rar rdesktop readline real reflection resolvconf rtc samba sdl session sndfile speex spell spl srt sse ssl subtitles svg tcpd teletext theora threads tiff truetype udev unicode v4l v4l2 vcd vorbis win32codecs x264 x86 xcomposite xext xine xinerama xml xorg xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling statusunique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en en_GB" USERLAND="GNU" VIDEO_CARDS="nv vesa vga nvidia v4l"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 14 Davide Pesavento gentoo-dev 2008-06-29 21:50:03 UTC
TEXTRELs are still present with newer version 0.4.9_p20080326:

 * TEXTREL usr/lib/libswscale.so.0.5.1
 * TEXTREL usr/lib/libavfilter.so.0.0.0
 * TEXTREL usr/lib/libavcodec.so.51.53.0
 * TEXTREL usr/lib/libavutil.so.49.6.0
 * TEXTREL usr/lib/libavformat.so.52.12.0
 * TEXTREL usr/lib/libpostproc.so.51.1.0
 * TEXTREL usr/lib/libavdevice.so.52.0.0

Comment 15 PaX Team 2008-07-01 14:03:57 UTC
(In reply to comment #14)
> TEXTRELs are still present with newer version 0.4.9_p20080326:

not only that, but it seems that the same .o files are linked into both static and shared libs and since the former is non-pic, there're tons of text relocations. it seems that configure enables -fPIC only for amd64 (x86_64) and a few other archs, but not i386 (x86_32). is that intentional? really, this release seems like huge a step back for anyone bothered by textrels...

Comment 16 Samuli Suominen (RETIRED) gentoo-dev 2008-12-10 23:21:46 UTC
*** Bug 115568 has been marked as a duplicate of this bug. ***
Comment 17 Attila Tóth 2008-12-25 07:55:30 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > TEXTRELs are still present with newer version 0.4.9_p20080326:
> 
> not only that, but it seems that the same .o files are linked into both static
> and shared libs and since the former is non-pic, there're tons of text
> relocations. it seems that configure enables -fPIC only for amd64 (x86_64) and
> a few other archs, but not i386 (x86_32). is that intentional? really, this
> release seems like huge a step back for anyone bothered by textrels...
> 

The newer version of x264 library has TEXTRELs again. It's a huge disappointment for me to see these stepbacks.
Comment 18 Alexis Ballier gentoo-dev 2009-01-03 12:58:46 UTC
*** Bug 252613 has been marked as a duplicate of this bug. ***
Comment 19 Martin Walch 2009-02-04 20:15:59 UTC
This is not completely specific to x86. On amd64 with media-video/ffmpeg-0.4.9_p20090201:

TEXTREL usr/lib64/libavcodec.so.52.11.0
Comment 20 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-18 19:59:26 UTC
(In reply to comment #19)
> This is not completely specific to x86. On amd64 with
> media-video/ffmpeg-0.4.9_p20090201:
> 
> TEXTREL usr/lib64/libavcodec.so.52.11.0
> 

I've written a patch for this one as an exercise. Was big fun. Will attach the patch to this bug.
Comment 21 Ralph Sennhauser (RETIRED) gentoo-dev 2009-02-18 20:03:51 UTC
Created attachment 182465 [details, diff]
Textrel fix for libavcodec on amd64
Comment 22 Andrey 2009-03-07 23:16:39 UTC
> Textrel fix for libavcodec on amd64

patch works! it would be very good to see it into portage.
Comment 23 Alexis Ballier gentoo-dev 2009-03-11 10:41:28 UTC
(In reply to comment #21)
> Created an attachment (id=182465) [edit]
> Textrel fix for libavcodec on amd64

This patch should be submitted upstream; I will for sure not merge any asm patch for ffmpeg unless it's been reviewed & merged upstream.
Comment 24 Ralph Sennhauser (RETIRED) gentoo-dev 2009-03-13 18:33:48 UTC
(In reply to comment #23)
> (In reply to comment #21)
> > Created an attachment (id=182465) [edit]
> > Textrel fix for libavcodec on amd64
> 
> This patch should be submitted upstream; I will for sure not merge any asm
> patch for ffmpeg unless it's been reviewed & merged upstream.
> 

I did a few weeks ago. As this patch doesn't solve most QA concerns it doesn't change that much anyway.
Comment 25 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2009-03-27 13:15:25 UTC
*** Bug 263954 has been marked as a duplicate of this bug. ***
Comment 26 Samuli Suominen (RETIRED) gentoo-dev 2009-07-09 16:14:07 UTC
*** Bug 267570 has been marked as a duplicate of this bug. ***
Comment 27 Samuli Suominen (RETIRED) gentoo-dev 2009-07-09 16:15:40 UTC
*** Bug 265398 has been marked as a duplicate of this bug. ***
Comment 28 David J Cozatt 2009-09-29 01:42:07 UTC
*bump* --I do have x264 in 'USE' will try without and likely dts

 * QA Notice: The following files contain runtime text relocations
 *  Text relocations force the dynamic linker to perform extra
 *  work at startup, waste system resources, and may pose a security
 *  risk.  On some architectures, the code may not even function
 *  properly, if at all.
 *  For more information, see http://hardened.gentoo.org/pic-fix-guide.xml
 *  Please include the following list of files in your report:
 * TEXTREL usr/lib64/libavcodec.so.52.20.0

 *
 * ERROR: media-video/ffmpeg-0.5-r1 failed.
 * Call stack:
 *       misc-functions.sh, line 729:  Called install_qa_check
 *       misc-functions.sh, line 241:  Called die
 * The specific snippet of code:
 *                      die "Aborting due to QA concerns: ${die_msg}"
 *  The die message:
 *   Aborting due to QA concerns:  textrels,

Portage 2.1.6.13 (default/linux/amd64/10.0/developer, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.30-gentoo-r5 x86_64)

Comment 29 Doug Esanbock 2009-11-01 15:12:46 UTC
FYI - disabling the mmx flag for the ebuild makes it work fine on AMD64 hardened.  I'm using  media-video/ffmpeg-0.5-r1

This impacted my mediatomb installation.
Comment 30 Scott J 2010-01-08 02:06:35 UTC
(In reply to comment #29)
> FYI - disabling the mmx flag for the ebuild makes it work fine on AMD64
> hardened.  I'm using  media-video/ffmpeg-0.5-r1
> 
> This impacted my mediatomb installation.
> 

Compiling is not an issue for 0.5-r1 or _p20373 for me on amd64.
But using ffmpeg_p20373 I get this error everytime I start mediatomb: 

mediatomb[5992] trap divide error ip:7f23e73f98e5 sp:7f23ddb8de90 error:0 in libavformat.so.52.39.2[7f23e73bc000+ac000]

If I switch back to ffmpeg-0.5-r1 no problems. 

Compiling with -mmx made no difference.
Comment 31 Attila Stehr 2010-01-11 06:10:47 UTC
I'm not sure if this helps somehow, but on my _non-hardened_ amd64 system

USE="-mmx faad mp3 vorbis x264 xvid" emerge -v =ffmpeg-0.5-r1
works for me, while 
USE="faad mp3 vorbis x264 xvid" emerge -v =ffmpeg-0.5-r1
results in 

 * QA Notice: The following files contain runtime text relocations
[...]
 * TEXTREL usr/lib64/libavcodec.so.52.20.0
 * ERROR: media-video/ffmpeg-0.5-r1 failed.
[...]
 *  The die message:
 *   Aborting due to QA concerns:  textrels,

Is the TEXTREL-problem hardened specific or not?

Portage 12175-svn (default/linux/amd64/10.0/desktop, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.30-gentoo-r4 x86_64)
=================================================================
System uname: Linux-2.6.30-gentoo-r4-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4400+-with-gentoo-1.12.13
Timestamp of tree: Tue, 29 Dec 2009 19:20:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p35
dev-lang/python:     2.6.2-r1
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=athlon64"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=athlon64"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict stricter test unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext 7zip X acpi alsa amd64 applet archive bash-completion boundschecking bzip2 cairo cdinstall cdr clamav consolekit cracklib crypt cups cupsddk cxx dbus dga directfb dri dvd dvdnav dvdr eds esd evo fam fbcon fontconfig fuse glitz gmp gnome gnutls gpm gstreamer gtk gzip hal hddtemp icu ithreads libnotify lm_sensors logitech-mouse lzma lzo md5sum mem-scramble memlimit mmx mmxext modules mp4 mudflap multilib nautilus nls nocd nptl nptlonly offensive opengl openmp pam pda ppds pth rtc session smp spell sse sse2 ssl startup-notification symlink sysfs tcpd test threads threadsafe thunar truetype unicode usb videos xcb xml xorg xulrunner zlib" ALSA_CARDS="via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon fglrx"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

BTW: Why is -O3 one of the gcc arguments when I set -O2 in my CFLAGS?

x86_64-pc-linux-gnu-gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/var/tmp/portage/media-video/ffmpeg-0.5-r1/work/ffmpeg-0.5" -O2 -pipe -march=athlon64 -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -march=athlon64 -pthread -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros         -fPIC -DPIC -c -o libavcodec/vmnc.o libavcodec/vmnc.c
Comment 32 Pacho Ramos gentoo-dev 2010-01-29 23:07:46 UTC
I cannot test it now, but there is another textrel patch in:
http://cvs.rpmfusion.org/viewvc/rpms/ffmpeg/devel/ffmpeg-textrel.patch?revision=1.2&root=free&view=markup
Comment 33 Reimar Döffinger 2010-01-30 20:34:24 UTC
I couldn't get anyone to care about my patches and I didn't like them much (since they cause slowdown without solving anything I'd consider a real issue), but something similar to the patch in the previous comment is committed upstream now.
Comment 34 Magnus Granberg gentoo-dev 2010-07-30 17:48:53 UTC
* QA Notice: The following files contain runtime text relocations
 *  Text relocations force the dynamic linker to perform extra
 *  work at startup, waste system resources, and may pose a security
 *  risk.  On some architectures, the code may not even function
 *  properly, if at all.
 *  For more information, see http://hardened.gentoo.org/pic-fix-guide.xml
 *  Please include the following list of files in your report:
 * TEXTREL usr/lib/libswscale.so.0.11.0

media-video/ffmpeg-0.6  USE="3dnow 3dnowext encode hardcoded-tables mmx mmxext pic ssse3 zlib -X -alsa (-altivec) -amr -bindist -cpudetection -custom-cflags -debug -dirac -doc -faac -faad -gsm -ieee1394 -jack -jpeg2k -mp3 -network -oss -rtmp -schroedinger -sdl -speex -test -theora -threads -v4l -v4l2 -vaapi (-vdpau) -vorbis -vpx -x264 -xvid" VIDEO_CARDS="(-nvidia)"
Comment 35 Magnus Granberg gentoo-dev 2010-07-30 18:01:53 UTC
Created attachment 240741 [details, diff]
Fix TEXTREL in STORE_BGR24_MMX and rgb24tobgr24

This patch is for 0.6 and fix some of the TEXTREL
We still have TEXTREL left in rgb24toyv12

Portage 2.1.8.3 (hardened/linux/x86/10.0, gcc-4.4.4, glibc-2.11.2-r0, 2.6.34-hardened-r1 i686)
=================================================================
System uname: Linux-2.6.34-hardened-r1-i686-Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Sun, 25 Jul 2010 21:45:01 +0000
app-shells/bash:     4.1_p7
dev-lang/python:     2.6.5-r3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.65-r1
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
virtual/os-headers:  2.6.34
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=i686"
CHOST="i686-pc-linux-gnu"
Comment 36 Magnus Granberg gentoo-dev 2010-07-31 19:13:27 UTC
Created attachment 240869 [details, diff]
Fix TEXTREL in libswscale.so

This patch fix all the TEXTREL in libswscale.so
Comment 37 Reimar Döffinger 2010-07-31 22:23:25 UTC
Using more than 6 asm constraints will regularly cause compile issues.
Moving them is a good idea and at least should avoid useless GOT lookups for AMD64 when using "m" constraints, but I can't really see how there's much point in patches on this bugtracker, discussing them upstream has at least some (though admittedly not large) chance of improving things.
Comment 38 Magnus Granberg gentoo-dev 2010-08-01 00:41:24 UTC
Patch commited to the ffmpeg-devel ml. See the URL
Comment 39 Magnus Granberg gentoo-dev 2010-08-04 16:30:52 UTC
(In reply to comment #37)
> Using more than 6 asm constraints will regularly cause compile issues.
> Moving them is a good idea and at least should avoid useless GOT lookups for
> AMD64 when using "m" constraints, but I can't really see how there's much point
> in patches on this bugtracker, discussing them upstream has at least some
> (though admittedly not large) chance of improving things.
> 
Have posted the patch upstream but haven't got any comments on it yet.
Comment 40 Magnus Granberg gentoo-dev 2010-09-16 14:50:24 UTC
*** Bug 337571 has been marked as a duplicate of this bug. ***
Comment 41 Magnus Granberg gentoo-dev 2010-09-16 20:22:59 UTC
looks like it is fixed in upstream.
no textrel in the -9999 build
can we get new snapshot of ffmpeg?
and the asm stuff should be only disable on x86(hardened)
it compiles fine on amd64(hardened) 
Comment 42 Xake 2010-09-18 12:43:46 UTC
Created attachment 247841 [details, diff]
patch for ffmpeg-0.6.ebuild

Could we get something like this commited for 0.6 please?

Short description of changes:
* USE="pic" removed and --enable-pic set unconditionally if you run with PIE since amd64 breaks without it (try make check), and x86 seems to not differ (can be because of the lack of asm).
* disable asm compleatly since anything else seems to give textrels (til fixed code is released)
* only disable asm for hardened x86 since for amd64 works fine with asm and mmx* (as long as enable-pic is set)
Comment 43 Reimar Döffinger 2010-09-18 13:30:26 UTC
I recommend to investigate any failures properly and in-depth before adding hacks to the ebuild.
PIC is automatically enabled for AMD64 if shared libraries are built.
If the compiler is a PIE compiler, it should have PIC enabled anyway and FFmpeg's configure should detect that and set everything up correctly, if not this absolutely should be reported upstream.
I btw. think it is suboptimal for gcc-specs-pie to imply "no TEXTRELS" since even with TEXTRELS PIE allows address layout randomization and breaks exploits based on return-oriented programming. Having this feature only available together with a "no TEXTRELS" rule that costs massive amounts of speeds is pretty much blocking the way to ever enabling address layout randomization for more than a tiny minority of users.
Comment 44 Xake 2010-09-19 12:47:55 UTC
Created attachment 247992 [details, diff]
patch for ffmpeg-ebuild

So I cannot reproduce the problem with USE="-pic" on hardened amd64 anymore.
So this patch may work better.
Compiles, passes tests, and runs fine and fast on my amd64 system.;)
Comment 45 Xake 2010-09-19 12:52:28 UTC
(In reply to comment #43)
> I btw. think it is suboptimal for gcc-specs-pie to imply "no TEXTRELS" since
> even with TEXTRELS PIE allows address layout randomization and breaks exploits
> based on return-oriented programming.

The problem is that with a hardened kernel (which is recommended if using hardened gentoo) or using the pax patches the code will not run if it contains TEXTRELs. So in that case we should have yet another USE-flag to disable asm altogether for the pax-using x86-bounch?
Comment 46 Alexis Ballier gentoo-dev 2010-10-01 01:47:54 UTC
sync and try -9999: I've changed the code to disable mmx & co if pic is requested on x86
Comment 47 Rafał Mużyło 2010-12-13 16:15:47 UTC
Of note: I've just built ffmpeg-0.6_p25767 with that fix *disabled*.

The catch: gcc-4.5.1-r1 - my personal bet on patches 49 and 50 in 1.3 gcc tarball.

However, TEXTRELs are back, so looks like the fix will stay.

Well, at least the real bug was fixed.
Comment 48 Alexis Ballier gentoo-dev 2011-12-15 11:24:37 UTC
i've changed again to disable all asm with x86 + pic, this should be very slow but, at least, pic
improvements welcome, but lets try to keep the 'pic enabled gives pic libraries' behavior

closin
Comment 49 Alexis Ballier gentoo-dev 2011-12-15 11:36:17 UTC
btw:

(In reply to comment #48)
> i've changed again to disable all asm with x86 + pic, this should be very slow
> but, at least, pic

in -9999 and -0.9

> improvements welcome, but lets try to keep the 'pic enabled gives pic
> libraries' behavior
> 

improvements go to -9999

> closin
Comment 50 Pacho Ramos gentoo-dev 2012-02-02 10:11:27 UTC
*** Bug 401729 has been marked as a duplicate of this bug. ***