[FFmpeg-devel] [RFC]Disable inline_asm_direct_symbol_refs for lto

Matt Oliver protogonoi at gmail.com
Wed Mar 19 06:22:51 CET 2014


On 19 March 2014 14:52, Michael Niedermayer <michaelni at gmx.at> wrote:

> On Wed, Mar 19, 2014 at 03:02:47AM +0000, Carl Eugen Hoyos wrote:
> > Michael Niedermayer <michaelni <at> gmx.at> writes:
> >
> > > > +++ b/configure
> > > >  <at>  <at>  -4838,6 +4838,7  <at>  <at>  if enabled lto; then
> >
> > > > +    disable inline_asm_direct_symbol_refs
> > >
> > > i would be slightly nicer if the inline_asm_direct_symbol_refs
> > > test could be improved to disable it automatically if it fails
> > > at link stage
> >
> > I agree.
> >
> > Would it be ok to include libavutil/x86/asm.h (or a new
> > libavutil/x86/mangle.h) from configure?
>
> this is a bit trcky because headers could use config.h and that
> is created by configure
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I have often repented speaking, but never of holding my tongue.
> -- Xenocrates
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
I agree as currently asm.h defines MANGLE based on the value of
inline_asm_direct_symbol_refs which is included from config.h so I can see
how that would be a problem to include from within configure. But that said
the only way I can think of to have the inline_asm_direct_symbol_refs test
pick this up automatically would be to change it from check_asm to
check_ld. Something like this:

check_ld "cc" <<EOF && enable inline_asm_direct_symbol_refs
int main(void){ int test; __asm__ volatile("movl MANGLE(test), %eax"); }
EOF

But that obviously requires MANGLE. Given the %%rip stuff from pic is not
needed for the test all we actually need is the EXTERN_PREFIX. Which is
actually already defined in the configure file. So something like this
works:

check_ld "cc" <<EOF && enable inline_asm_direct_symbol_refs
#define EXTERN_PREFIX "$extern_prefix"
#define MANGLE(a) EXTERN_PREFIX #a
int test;
int main(void){ __asm__ volatile("movl "MANGLE(test)", %eax"); }
EOF

It just needs the lto compiler options passed to it (which i believe havnt
been set until later in the configure script).


More information about the ffmpeg-devel mailing list