<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>200670</bug_id>
          
          <creation_ts>2007-11-28 18:05 0000</creation_ts>
          <short_desc>media-video/libtheora-1.0_beta2 - TEXTRELs</short_desc>
          <delta_ts>2007-12-07 20:01:07 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>ssuominen@gentoo.org</reporter>
          <assigned_to>media-video@gentoo.org</assigned_to>
          <cc>cla@gentoo.org</cc>
    
    <cc>flameeyes@gentoo.org</cc>
    
    <cc>pageexec@freemail.hu</cc>
    
    <cc>solar@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>ssuominen@gentoo.org</who>
            <bug_when>2007-11-28 18:05:09 0000</bug_when>
            <thetext>&lt;snip&gt;

  libtheora.so.0.3.1: (memory/data?) [0xCB76] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCB80] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCC30] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCC3A] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCD2B] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCD32] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCD3F] in (optimized out: previous
theora_decode_init) [0x33A0]
  libtheora.so.0.3.1: (memory/data?) [0xCD46] in (optimized out: previous
theora_decode_init) [0x33A0]
  /usr/lib/libtheora.so.0.3.1

&lt;/snip&gt;

media-libs/libtheora-1.0_beta2 has USE pic to work this around for hardened, but it should be fixed instead.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>solar@gentoo.org</who>
            <bug_when>2007-11-28 18:14:16 0000</bug_when>
            <thetext>For the moment if the problems are limited to x86 then the ebuild should be changed as follows.

-use pic &amp;&amp; myconf=&quot;--disable-asm&quot;
+use pic &amp;&amp; use x86 &amp;&amp; myconf=&quot;--disable-asm&quot;

Please don&apos;t even think about ever package use masking the pic flag in any profile. Hopefully we can find a better solution in which we can give 
everybody the best of all worlds.

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>flameeyes@gentoo.org</who>
            <bug_when>2007-11-28 19:02:59 0000</bug_when>
            <thetext>Well, if the pic USE flag is limited to x86 it makes sense to package.use.mask it in base/ and then unmask it on x86-based profiles, don&apos;t you think so? It makes no sense for other profiles to ever see that flag, but as we can&apos;t hide it we are left with masking it for the single ebuild involved.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>solar@gentoo.org</who>
            <bug_when>2007-11-28 19:16:21 0000</bug_when>
            <thetext>pic is not limited to x86 in any such way. There is no reason to limit it to any such profile.. We fix ebuilds at gentoo. Lets continue doing that..</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>flameeyes@gentoo.org</who>
            <bug_when>2007-11-28 19:26:16 0000</bug_when>
            <thetext>Err when did I say it was limited to x86? I was proposing to let the USE flag be a no-op for any other profile, because the _textrel_ problem is limited to x86, no need to get other profiles to care about that USE flag.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>solar@gentoo.org</who>
            <bug_when>2007-11-28 19:53:36 0000</bug_when>
            <thetext>Diego,
I know you want to be helpful and all but in this case, I&apos;m asking you to please 
let it go. The pic flag has it&apos;s uses. We like how it&apos;s used. Adding crap to 
profiles vs ebuilds where they belong over complicates the issue and makes 
it harder to find and fix at a later time. If you want to mask it in *BSD profiles. Then by all means go for it. But please leave base/* hardened/* default-linux/* selinux/* uclibc/* alone.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ssuominen@gentoo.org</who>
            <bug_when>2007-11-28 20:37:24 0000</bug_when>
            <thetext>pageexec, could you take a look at this? thanks!</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aballier@gentoo.org</who>
            <bug_when>2007-11-28 21:38:59 0000</bug_when>
            <thetext>Created an attachment (id=137278)
pic fix

it&apos;s probably possible to also gain one register in their inline asm so that compiling without -fomit-frame-pointer won&apos;t fail.

please someone with real x86 hardware (not just a chroot like me) test this, and please someone with better experience than me with such fixes (not difficult to find) review the patch ;)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pageexec@freemail.hu</who>
            <bug_when>2007-11-29 00:02:59 0000</bug_when>
            <thetext>just a few comments:

1. textrels are not at all specific to x86, they can happen on any arch. in practice you see them most on x86 because that&apos;s where people write asm code most of the time *and* not take care of proper PIC.

2. the proposed fix looks correct but i haven&apos;t checked the whole environment, so please make sure that whatever register is used as the PIC base register (probably ebx) is not used in any way in the rest of the asm() block.

PS: speaking of textrels, would you guys take a look at bug #135326 please?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aballier@gentoo.org</who>
            <bug_when>2007-11-29 11:29:24 0000</bug_when>
            <thetext>(In reply to comment #8)
&gt; 2. the proposed fix looks correct but i haven&apos;t checked the whole environment,
&gt; so please make sure that whatever register is used as the PIC base register
&gt; (probably ebx) is not used in any way in the rest of the asm() block.

ebx is not used, but anyway, if it was used and not in the clobber list that would be a much more serious issue than a textrel imho. And if it was used and in the clobber list gcc would be ranting a lot, wouldn&apos;t it ?


&gt; PS: speaking of textrels, would you guys take a look at bug #135326 please?

yes I was planning to jump on this one very soonish, but I need to find a moment where I have a few hours free as the patch is huge and I want to review it and test it entirely before commiting it.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ssuominen@gentoo.org</who>
            <bug_when>2007-11-29 19:26:54 0000</bug_when>
            <thetext>Unfortunately, I don&apos;t have x86 hardware to test this (CC x86?)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pageexec@freemail.hu</who>
            <bug_when>2007-12-01 14:08:12 0000</bug_when>
            <thetext>(In reply to comment #9)
&gt; ebx is not used, but anyway, if it was used and not in the clobber list that
&gt; would be a much more serious issue than a textrel imho.

it&apos;s just that i saw in the past PIC &apos;fixes&apos; where instead of getting rid of ebx, it was simply pushed/popped around the rest of the code. the problem with this is that it obviously changes the stack pointer which in turn will ruin gcc&apos;s internal tracking logic and manifests in bad asm when you have an &quot;m&quot; constraint for a variable that happens to be on the stack and is not addressed via the frame pointer.

&gt; And if it was used and in the clobber list gcc would be ranting a lot, wouldn&apos;t it ?

yes.

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>cla@gentoo.org</who>
            <bug_when>2007-12-03 17:15:59 0000</bug_when>
            <thetext>(In reply to comment #7)
&gt; please someone with real x86 hardware (not just a chroot like me) test this,
&gt; and please someone with better experience than me with such fixes (not
&gt; difficult to find) review the patch ;)
&gt; 
Applying fine on my x86, ffmpeg2theora also works fine w/ that.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>aballier@gentoo.org</who>
            <bug_when>2007-12-07 20:01:07 0000</bug_when>
            <thetext>applied</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>137278</attachid>
            <date>2007-11-28 21:38 0000</date>
            <desc>pic fix</desc>
            <filename>asm.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">SW5kZXg6IGxpYnRoZW9yYS0xLjBiZXRhMi9saWIvZW5jL3g4Nl8zMi9kY3RfZGVjb2RlX21teC5j
Cj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT0KLS0tIGxpYnRoZW9yYS0xLjBiZXRhMi5vcmlnL2xpYi9lbmMveDg2XzMyL2Rj
dF9kZWNvZGVfbW14LmMKKysrIGxpYnRoZW9yYS0xLjBiZXRhMi9saWIvZW5jL3g4Nl8zMi9kY3Rf
ZGVjb2RlX21teC5jCkBAIC01Nyw5ICs1Nyw5IEBAIHN0YXRpYyB2b2lkIEZpbHRlckhvcml6X19t
bXgodW5zaWduZWQgY2gKICAgICAicHN1YncgJSVtbTMsJSVtbTFcbiIgICAgICAgLyogbW0xID0g
cGl4WzBdLXBpeFszXSBtbTEgLSBtbTMgKi8gICAgIFwKICAgICAibW92cSAlJW1tMCwlJW1tN1xu
IiAgICAgICAgLyogbW03ID0gcGl4WzJdKi8gICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAi
cHN1YncgJSVtbTUsJSVtbTBcbiIgICAgICAgLyogbW0wID0gcGl4WzJdLXBpeFsxXSBtbTAgLSBt
bTUqLyAgICAgIFwKLSAgICAiUE1VTExXICJNQU5HTEUoVjMpIiwlJW1tMFxuIiAvKiAqMyAqLyAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAiUE1VTExXICUzLCUlbW0wXG4iIC8q
ICozICovICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICJwYWRkdyAlJW1tMCwl
JW1tMVxuIiAgICAgICAgIC8qIG1tMSBoYXMgZlswXSAuLi4gZls0XSovICAgICAgICAgICAgXAot
ICAgICJwYWRkdyAiTUFOR0xFKFY4MDQpIiwlJW1tMVxuIi8qIGFkZCA0ICovIC8qIGFkZCAyNTYg
YWZ0ZXIgc2hpZnQgKi8gXAorICAgICJwYWRkdyAlNCwlJW1tMVxuIi8qIGFkZCA0ICovIC8qIGFk
ZCAyNTYgYWZ0ZXIgc2hpZnQgKi8gXAogICAgICJwc3JhdyAkMywlJW1tMVxuIiAgICAgICAgICAv
KiA+PjMgKi8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICIgcGV4dHJ3ICQw
LCUlbW0xLCUlZXNpXG4iICAvKiBJbiBNTTEgd2UgaGF2ZSA0IGYgY29lZnMgKDE2Yml0cykgKi8g
XAogICAgICIgcGV4dHJ3ICQxLCUlbW0xLCUlZWRpXG4iICAvKiBub3cgcGVyZm9ybSBNTTQgPSAq
KF9idisgZikgKi8gICAgICAgXApAQCAtODcsNyArODcsNyBAQCBzdGF0aWMgdm9pZCBGaWx0ZXJI
b3Jpel9fbW14KHVuc2lnbmVkIGNoCiAgICAgIiBzaHJsICQxNiwlJWVheFxuIiAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgIiBtb3Z3ICUlYXgs
MSglMCwlJWVzaSlcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBc
CiAgICAgOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICBcCi0gICAgOiAiciIgKFBpeGVsUHRyKSwgInIiIChMaW5lTGVuZ3Ro
KSwgInIiIChCb3VuZGluZ1ZhbHVlUHRyLTI1NikgICAgICBcCisgICAgOiAiciIgKFBpeGVsUHRy
KSwgInIiIChMaW5lTGVuZ3RoKSwgInIiIChCb3VuZGluZ1ZhbHVlUHRyLTI1NiksICJtIiAoVjMp
LCAibSIgKFY4MDQpIFwKICAgICA6ICJlc2kiLCAiZWRpIiAsICJtZW1vcnkiLCAiZWF4IiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICApOwogCkBAIC0xMjYsMTIgKzEy
NiwxMiBAQCBzdGF0aWMgdm9pZCBGaWx0ZXJWZXJ0X19tbXgodW5zaWduZWQgY2hhCiAgICAgInBz
dWJ3ICUlbW01LCUlbW0zXG4iCiAgICAgInBzdWJ3ICUlbW00LCUlbW0yXG4iCi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0YXRpYyB2b2lkIEZpbHRlclZlcnRfX21teCh1bnNpZ25lZCBjaGEKICAgICAi
bW92cSAlJW1tNCwoJTAsJTEpXG4iICAgICAgLyogcGl4W3lzdHJpZGVdPSAqLwogICAgICJlbW1z
XG4iCiAgICAgOgotICAgIDogInIiIChQaXhlbFB0ci0yKkxpbmVMZW5ndGgpLCAiciIgKExpbmVM
ZW5ndGgpLCAiciIgKEJvdW5kaW5nVmFsdWVQdHItMjU2KQorICAgIDogInIiIChQaXhlbFB0ci0y
KkxpbmVMZW5ndGgpLCAiciIgKExpbmVMZW5ndGgpLCAiciIgKEJvdW5kaW5nVmFsdWVQdHItMjU2
KSwgIm0iIChWMyksICJtIiAoVjgwNCkKICAgICA6ICJlc2kiLCAiZWRpIiAsICJtZW1vcnkiCiAg
ICAgKTsKIH0K
</data>        

          </attachment>
    </bug>

</bugzilla>