android x86 assembly / ads2gas

368 views
Skip to first unread message

Ben Siroshton

unread,
Aug 29, 2011, 6:57:44 PM8/29/11
to WebM Discussion
Hi.

I have succesfully compiled and am using libvpx for android on the arm
platforms and am now trying to compile for the newly NDK supported x86
platform but am running into trouble compiling the x86 assembly files.

I am using ads2gas to convert the .asm's to .s's however when the
android build system goes to compile them I get many errors, here is a
sampling:

Compile x86 : vpx <= idctllm_mmx.s
vp8/common/x86/idctllm_mmx.s: Assembler messages:
vp8/common/x86/idctllm_mmx.s:1: Error: junk at end of line, first
unrecognized character is `@'
vp8/common/x86/idctllm_mmx.s:2: Error: junk at end of line, first
unrecognized character is `@'
vp8/common/x86/idctllm_mmx.s:4: Error: junk at end of line, first
unrecognized character is `@'
.. and so on.

Looking in the ads2gas script it says "Convert ARM Developer Suite
1.0.1 syntax assembly source to GNU as format". Which leads me to
believe this will not work for the x86 side of things.

I appreciate any advice to help me move forward.

Thanks.

Fritz Koenig

unread,
Aug 29, 2011, 7:20:44 PM8/29/11
to webm-d...@webmproject.org
Correct, ads2gas is for arm to convert from RVCT format to GAS format.
The x86 asm files can be compiled with yasm right out of the box.

> --
> You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
> To post to this group, send email to webm-d...@webmproject.org.
> To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
> For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.
>
>

Ben Siroshton

unread,
Aug 29, 2011, 7:27:45 PM8/29/11
to WebM Discussion
Except I am compiling for Android, I can't use yasm for that can I?

Fritz Koenig

unread,
Aug 29, 2011, 7:47:24 PM8/29/11
to webm-d...@webmproject.org
I haven't done this myself. But my thought is that you should be able
to configure and build outside of android, and then add
LOCAL_STATIC_LIBRARIES := libvpx to the Android.mk file.

Ben Siroshton

unread,
Aug 30, 2011, 12:00:17 PM8/30/11
to WebM Discussion
Is there a similar process for converting the x86 asm files to GAS
format?

On Aug 29, 4:20 pm, Fritz Koenig <frkoe...@google.com> wrote:

Fritz Koenig

unread,
Aug 30, 2011, 12:28:47 PM8/30/11
to webm-d...@webmproject.org
We use yasm predominantly to compile, which uses intel format. A
quick search for intel2gas shows that there are utilities. I can't
speak for how well/if the do work on our code base.

Ben Siroshton

unread,
Aug 30, 2011, 12:38:08 PM8/30/11
to WebM Discussion
I found that tool as well, but I am concerned; it is listed as having
"some mmx support" and libvpx is using mmx, sse, etc.. Chances are it
will fail when it hits these other instructions, but I am not an
assembly guru and probably don't know what I am talking about. :)

On Aug 30, 9:28 am, Fritz Koenig <frkoe...@google.com> wrote:
> We use yasm predominantly to compile, which uses intel format.  A
> quick search for intel2gas shows that there are utilities.  I can't
> speak for how well/if the do work on our code base.
>
>
>
>
>
>
>
> On Tue, Aug 30, 2011 at 9:00 AM, Ben Siroshton <mirsw...@gmail.com> wrote:
> > Is there a similar process for converting the x86 asm files to GAS
> > format?
>
> > On Aug 29, 4:20 pm, Fritz Koenig <frkoe...@google.com> wrote:
> >> Correct, ads2gas is for arm to convert from RVCT format to GAS format.
> >>  The x86 asm files can be compiled with yasm right out of the box.
>
> > --
> > You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
> > To post to this group, send email to webm-disc...@webmproject.org.
> > To unsubscribe from this group, send email to webm-discuss+unsubscr...@webmproject.org.

Ben Siroshton

unread,
Aug 30, 2011, 12:45:04 PM8/30/11
to WebM Discussion
Looking at "i686-android-linux-as --help" I see it has:

-mmnemonic=[att|intel] use AT&T/Intel mnemonic
-msyntax=[att|intel] use AT&T/Intel syntax

Which makes me think intel format is supported (that is what libvpx is
using right?). However using this args do not seem to make any
difference. I just get a bunch of errors (trying directly against
the .asm files).

Ben Siroshton

unread,
Aug 30, 2011, 4:28:16 PM8/30/11
to WebM Discussion
Hey Fritz, looks like I was able to use yasm. I now have a preprocess
that compiles all the x86 asm files into .o files then I include these
in my Android.mk on the ld flags param, so far so good. Now to test
it. :)

Johann Koenig

unread,
Aug 30, 2011, 4:38:57 PM8/30/11
to webm-d...@webmproject.org
Hi Ben, could you share that? I had posted something earlier this week
using transform-generated-sources, but it doesn't appear to work with
the NDK

> --
> You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
> To post to this group, send email to webm-d...@webmproject.org.
> To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
> For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.
>
>

--
- johann koenig
  google

Ben Siroshton

unread,
Aug 30, 2011, 5:15:39 PM8/30/11
to WebM Discussion
Sure, it's just a simple perl script that performs some action on all
the .asm files it finds in the libvpx tree. If the path does not have
"arm" and not "ppc" as a substring then I call yasm to generate a .o
file or if the file does not have "x86" and not "ppc" then I call
ads2gas.pl on the file.

Here is my yasm call:
my $inc = "-I ../inc-x86 -I ../ -I ../.. -I ../../vpx_ports -I ../../
vp8/common -I ../../vp8 -I ../../vp8/encoder -I ../../vp8/decoder";
system("yasm $inc -f elf32 -m x86 -o $dest.o $src");

Then in the android.mk I added:

LOCAL_LDFLAGS += \
../obj/local/x86/vp8/common/x86/idctllm_mmx.o \
../obj/local/x86/vp8/common/x86/idctllm_sse2.o \
../obj/local/x86/vp8/common/x86/iwalsh_mmx.o \
../obj/local/x86/vp8/common/x86/iwalsh_sse2.o \
../obj/local/x86/vp8/common/x86/loopfilter_mmx.o \
../obj/local/x86/vp8/common/x86/loopfilter_sse2.o \
../obj/local/x86/vp8/common/x86/postproc_mmx.o \
../obj/local/x86/vp8/common/x86/postproc_sse2.o \
../obj/local/x86/vp8/common/x86/recon_mmx.o \
../obj/local/x86/vp8/common/x86/recon_sse2.o \
../obj/local/x86/vp8/common/x86/subpixel_mmx.o \
../obj/local/x86/vp8/common/x86/subpixel_sse2.o \
../obj/local/x86/vp8/common/x86/subpixel_ssse3.o \
../obj/local/x86/vp8/decoder/x86/dequantize_mmx.o \
../obj/local/x86/vpx_ports/emms.o \
../obj/local/x86/vpx_ports/x86_abi_support.o

I'd be happy to send you the perl script or is there a good way to
share it here?

Ben Siroshton

unread,
Aug 30, 2011, 5:18:49 PM8/30/11
to WebM Discussion
Oh. I also had to create a file to expose rand to the assembly, for
some reason the link was not finding it. To fix this I created an x86-
fix.cpp file with the contents:


namespace x86fix
{
#include <stdlib.h>
}

extern "C"
{
int rand()
{
return x86fix::rand();
}
}


and added this to my Android.mk sources.

Johann Koenig

unread,
Aug 30, 2011, 5:22:04 PM8/30/11
to webm-d...@webmproject.org
Ah, I thought you had found a way to do it within the android make
file. It's an interesting solution though.

As to sharing it, you can attach it a message or include it inline.

Ben Siroshton

unread,
Aug 31, 2011, 6:21:40 PM8/31/11
to WebM Discussion
Just wanted to share that the binaries created by using yasm work just
fine for those of you who run into this same issue.
Reply all
Reply to author
Forward
0 new messages