yuvi/gas-preprocessor

error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31

hsleedevelop opened this issue · 30 comments

CC libavcodec/audioconvert.o
error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31
mvnne $1, #1<<31
eorne $0, $1, ${2:R}, asr #31
'
make: *** [libavcodec/audioconvert.o] Error 1

iOS5 sdk, LION-10.7.2

using LLVM-GCC4.2 compiler,,

I now have exactly the same problem!
evercry, have you figured it out? I'll appreciate it if you share your solution.
I googled, but found no answer.

Edwin- have you tried disabling asm support when configuring ffmpeg? This was sufficient to solve the issue for me, and the ffmpeg libraries still work fine without it.

Thank you, wobbles, disabling asm does work fine. But I should mention that I want to use NEON optimization of ffmpeg, so if disable-asm, the neon support is not possible.

Hi Edwin, any luck with this issue ?

I have also the same problem with Lion and iOS 5.0.

Looking for fix ....

Well, just for a quick work, I did this:

  1. find the error source, that is "av_clipl_int32_arm" in libavutil/arm/intmath.h;
  2. avoid it. (I simply comment out "#define av_clipl_int32 av_clipl_int32_arm", so don't use NEON for just that one function)

Hope to know a more professional fix :-)

Hi Edwin,

Thanks for the fix. That error gone away but unfortunately, I got another error,

libavformat/asfcrypt.o
error: invalid operand in inline asm: 'ldr ${0:Q}, $1
ldr ${0:R}, $2

What is the ffmpeg version you are using ?

Thanks

I am using kind of old version - 0.6.1, and have disabled a lot of encoders/decoders (in my application).

Anyway, what I did is only "扬汤止沸", we may all need a better fix.

Yes, we may need a proper fix.

If you don't mind, can I have the ffmpeg configure command options that you are using at terminal ?

I also don't want a lot of encoders and decoders.

Thanks,

It should be all right. myconfig.sh:

#!/bin/bash

./configure
--disable-doc
--disable-ffmpeg
--disable-ffplay
--disable-ffprobe
--disable-ffserver
--disable-avdevice
--disable-avfilter

--disable-everything
--enable-decoder=h264
--enable-decoder=mp3
--enable-decoder=mp2
--enable-decoder=mpegaudio
--enable-parser=h264
--enable-parser=mpegaudio
--enable-demuxer=h264
--enable-demuxer=rtsp
--enable-demuxer=rtp
--enable-protocol=rtsp
--enable-protocol=rtp
--enable-protocol=udp
--enable-protocol=tcp

--enable-cross-compile
--arch=arm
--target-os=darwin
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
--as="gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
--extra-cflags="-w -arch armv7 -mfpu=neon "
--extra-ldflags="-arch armv7 -mfpu=neon -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
--enable-pic \

Thanks A lot :)

Hi Edwin,

Have you built librtmp with ffmpeg and arm ?

I am having trouble with building ffmpeg with librtmp :(

I am always getting "librtmp" not found. I set the PKG_PATH to point librtmp.c but no luck.

any Idea ?

Thanks

No, I know little about using librtmp.
I googled and it seems some one has the similar problem with you. you can go do more searching.

Good luck!

I met this problem too.

So… any update on a fix for this?

This error is due to that current version of gnu assembler does not support
64bit instructions.
My suggestion is to replace those 64bit assembly functions to 32bit.

2012/2/17 David Cairns <
reply@reply.github.com

So any update on a fix for this?


Reply to this email directly or view it on GitHub:
#16 (comment)

I had also this issue. How can we replace 64 bit assembly functions to 32bit ones?

Is there meanwhile a solution for that problem?

Yes; turn the optimizations off for your target architecture. ffmpeg runs just fine without them.

But this will slow down the performance. Other solutions?

I confirm it slown down performances. Impossible to decode correctly a 1080p video encoded in H264 on a iPad 2... It runs at two or three frame by seconds.

Any solution?

If you feel you must have optimizations turned on, simply disable the defines for all 64-bit inline assembly declarations, as per the instructions I linked early in the thread. Here's a diff to get you started:

danger:FFmpeg charley$ git diff
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h
index 52af66e..219e18f 100644
--- a/libavutil/arm/intmath.h
+++ b/libavutil/arm/intmath.h
@@ -97,7 +97,7 @@ static av_always_inline av_const int FASTDIV(int a, int b)

 #endif /* HAVE_ARMV6 */

-#define av_clipl_int32 av_clipl_int32_arm
+//#define av_clipl_int32 av_clipl_int32_arm
 static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
 {
     int x, y;
diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h
index 0292aab..3e19cf3 100644
--- a/libavutil/arm/intreadwrite.h
+++ b/libavutil/arm/intreadwrite.h
@@ -52,7 +52,7 @@ static av_always_inline void AV_WN32(void *p, uint32_t v)
     __asm__ ("str  %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
 }

-#define AV_RN64 AV_RN64
+//#define AV_RN64 AV_RN64
 static av_always_inline uint64_t AV_RN64(const void *p)
 {
     uint64_t v;
@@ -63,7 +63,7 @@ static av_always_inline uint64_t AV_RN64(const void *p)
     return v;
 }

-#define AV_WN64 AV_WN64
+//#define AV_WN64 AV_WN64
 static av_always_inline void AV_WN64(void *p, uint64_t v)
 {
     __asm__ ("str  %Q2, %0  \n\t"

Does anybody found a better fix?
Disable the defines, will also disable neon optimizations!
I tried configure with llvm-gcc, but ended with the same result.

Thanks mansr!
Works like a charm.

It seems that another issue happens after applying libav fix :S I'm using this configuration

./configure --extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system --disable-bzlib --disable-doc --enable-cross-compile --arch=arm --target-os=darwin --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7' --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic --disable-zlib --disable-bzlib --enable-decoder=h264 --enable-demuxer=h264 --enable-parser=h264

Already did the Libavcodec fixes (thanks mansr) but still shows me this error (copy/paste of the last lines in console)
CC libavcodec/arm/aacpsdsp_init_arm.o
AS libavcodec/arm/aacpsdsp_neon.o
AS libavcodec/arm/ac3dsp_arm.o
AS libavcodec/arm/ac3dsp_armv6.o
./libavutil/arm/asm.S:178:garbage following instruction -- ldr r4,.Lpicoff\' ./libavutil/arm/asm.S:179:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:179:Rest of line ignored. 1st junk character valued 92 (\). ./libavutil/arm/asm.S:181:Unknown pseudo-op: .altmacro ./libavutil/arm/asm.S:182:Unknown pseudo-op: .noaltmacro ./libavutil/arm/asm.S:185:Unknown pseudo-op: .Lpic ./libavutil/arm/asm.S:185:Rest of line ignored. 1st junk character valued 92 (\). ./libavutil/arm/asm.S:178:garbage following instruction --ldr lr,.Lpicoff'
./libavutil/arm/asm.S:179:Unknown pseudo-op: .Lpic
./libavutil/arm/asm.S:179:Rest of line ignored. 1st junk character valued 92 ().
./libavutil/arm/asm.S:181:Unknown pseudo-op: .altmacro
./libavutil/arm/asm.S:182:Unknown pseudo-op: .noaltmacro
./libavutil/arm/asm.S:185:Unknown pseudo-op: .Lpic
./libavutil/arm/asm.S:185:Rest of line ignored. 1st junk character valued 92 ().
make: *** [libavcodec/arm/ac3dsp_armv6.o] Error 1

I can only make it using --disable-asm flag, do you have any guess what could happen with this error?

Woooo! It works!
Thanks man!