Loren Merritt | 1 Apr 2007 01:42

Re: Re: [PATCH] Fix compilation when using --disable-opts

On Sat, 31 Mar 2007, Reimar Döffinger wrote:
> On Sat, Mar 31, 2007 at 11:01:08PM +0300, Uoti Urpala wrote:
>
>> Your compilation problems might be caused by CONFIG_EBX_AVAILABLE not
>> being set correctly. How are you creating the nonstandard build which
>> uses -fPIC on x86-32? Is that hack done by the Gentoo package by
>> default? Is it done by setting configure flags, and if so, only --cflags
>> or something else?
>
> Not motivated to fix it, but on AMD64 at least with the gentoo package
> PIC has a different problem - somehow MANGLE(ff_h264_lps_range) gets
> substituted to "ff_h264_lps_range(%rip)", which then gets combined to
> something like "movzbl ff_h264_lps_range(%rip)(%rax, %ebx, 2), %esi".
> I guess I should try compiling shared libs from clean source some
> time and see if that's really the problem and how it could be
> fixed/detected...

So how does it work on x86_32? In both archs, pic adds a register offset 
to the address, the only difference is which register (%rip vs %ebx) and 
how it's initialized.
... Looking at the dissasembly of a x86_32 pic build of ffmpeg, it works 
by not actually using pic. e.g. in dsputil_mmx I see a mixture of
     paddw ff_pw_16 <at> GOTOFF(%ebx), %mm4
and
     movq ff_pw_20, %mm4
depending on whether it's accessed by "m" asm constraint or by MANGLE.

The reason you didn't run into this problem before is that all instances 
of MANGLE in dsputil just refer to a single variable, none of them use any 
complex addressing modes, so appending (%rip) leaves a legal addressing 
(Continue reading)

Uoti Urpala | 1 Apr 2007 01:57
Picon
Picon

Re: Re: [PATCH] Fix compilation when using --disable-opts

On Sat, 2007-03-31 at 17:42 -0600, Loren Merritt wrote:
> whether ebx is actually being the pic register). So the ebx_available 
> check in configure returns true even with pic. Attached patch fixes(?) 
> it. I say (?) because ffmpeg compiles and runs even with pic and 
> ebx_available. Does it just not encounter the failure case?
> 
> (tested with gcc 3.3.5 and 4.1.1 if it matters)

If I run FFmpeg configure (without patch) with --extra-cflags=-fpic then
CONFIG_EBX_AVAILABLE is not set. Tested with gcc 4.1.2 from Debian
unstable and 4.2 prerelease from experimental.
Alexis Ballier | 1 Apr 2007 15:27
Picon

Re: Re: [PATCH] Fix compilation when using --disable-opts

> If I run FFmpeg configure (without patch) with --extra-cflags=-fpic then
> CONFIG_EBX_AVAILABLE is not set. Tested with gcc 4.1.2 from Debian
> unstable and 4.2 prerelease from experimental.

confirmed here also on 32 bits, but not on 64.
[the compiler failing with a different output doesnt mean the reason
is different : enabling asm that gcc doesnt want to build with pic; as
far as my understanding goes this apparently can be fixed on x86_64
but this doesnt seem to be possible on 32]

and why do you want to add fPIC to cflags ? it's needed only for
shared libs (here I really mean needed : I'm talking about e.g.
x86_64).
Wouldn't that be better to build non pic static libs and pic shared
libs when --enable-shared is given ? (see attachment)

--

-- 
Alexis Ballier.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel <at> mplayerhq.hu
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
Uoti Urpala | 1 Apr 2007 16:08
Picon
Picon

Re: Re: [PATCH] Fix compilation when using --disable-opts

On Sun, 2007-04-01 at 15:27 +0200, Alexis Ballier wrote:
> > If I run FFmpeg configure (without patch) with --extra-cflags=-fpic then
> > CONFIG_EBX_AVAILABLE is not set. Tested with gcc 4.1.2 from Debian
> > unstable and 4.2 prerelease from experimental.
> 
> confirmed here also on 32 bits, but not on 64.
> [the compiler failing with a different output doesnt mean the reason
> is different : enabling asm that gcc doesnt want to build with pic; as

It fails for different reasons.

> and why do you want to add fPIC to cflags ? it's needed only for

I don't. Read the context of my post again.
MÄns RullgÄrd | 1 Apr 2007 16:00

Re: Re: [PATCH] Fix compilation when using --disable-opts

"Alexis Ballier" <alexis.ballier <at> gmail.com> writes:

>> If I run FFmpeg configure (without patch) with --extra-cflags=-fpic then
>> CONFIG_EBX_AVAILABLE is not set. Tested with gcc 4.1.2 from Debian
>> unstable and 4.2 prerelease from experimental.
>
> confirmed here also on 32 bits, but not on 64.
> [the compiler failing with a different output doesnt mean the reason
> is different : enabling asm that gcc doesnt want to build with pic; as
> far as my understanding goes this apparently can be fixed on x86_64
> but this doesnt seem to be possible on 32]
>
> and why do you want to add fPIC to cflags ? it's needed only for
> shared libs (here I really mean needed : I'm talking about e.g.
> x86_64).
> Wouldn't that be better to build non pic static libs and pic shared
> libs when --enable-shared is given ? (see attachment)

The patch is wrong.

--

-- 
MÄns RullgÄrd
mans <at> mansr.com

Re: Re: [PATCH] Fix compilation when using --disable-opts

On Sunday, 01 April 2007 at 01:57, Uoti Urpala wrote:
> On Sat, 2007-03-31 at 17:42 -0600, Loren Merritt wrote:
> > whether ebx is actually being the pic register). So the ebx_available 
> > check in configure returns true even with pic. Attached patch fixes(?) 
> > it. I say (?) because ffmpeg compiles and runs even with pic and 
> > ebx_available. Does it just not encounter the failure case?
> > 
> > (tested with gcc 3.3.5 and 4.1.1 if it matters)
> 
> If I run FFmpeg configure (without patch) with --extra-cflags=-fpic then
> CONFIG_EBX_AVAILABLE is not set. Tested with gcc 4.1.2 from Debian
> unstable and 4.2 prerelease from experimental.

Shouldn't it be "-fPIC"?

Regards,
R.

--

-- 
MPlayer developer and RPMs maintainer: http://mplayerhq.hu http://rpm.livna.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
	-- from "Collected Sayings of Muad'Dib" by the Princess Irulan

Gmane