<div class="gmail_quote">On 6 February 2012 09:40, Johannes Pfau <span dir="ltr"><<a href="mailto:nospam@example.com" target="_blank">nospam@example.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am Mon, 6 Feb 2012 03:07:31 +0200<br>
schrieb Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>>:<br>
<div><br>
> On 6 February 2012 02:25, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>> wrote:<br>
><br>
</div><div><div>> > On 6 February 2012 00:04, Johannes Pfau <<a href="mailto:nospam@example.com" target="_blank">nospam@example.com</a>> wrote:<br>
> ><br>
> >> Am Sun, 5 Feb 2012 18:04:12 +0100<br>
> >> schrieb Johannes Pfau <<a href="mailto:nospam@example.com" target="_blank">nospam@example.com</a>>:<br>
> >><br>
> >> > I will probably need some more time to get this working...<br>
> >> ><br>
> >><br>
> >> I have some good news:<br>
> >> <a href="http://www.mediafire.com/?107we120sh3xx" target="_blank">http://www.mediafire.com/?107we120sh3xx</a><br>
> >><br>
> >> I fixed that problem and then the whole build worked fine. I'll<br>
> >> post build instructions soon, but the binaries are ready. I only<br>
> >> did a simple gdc -c test.d to check the compiler, but it seems to<br>
> >> work.<br>
> >><br>
> >> Linking against druntime fails, as it uses functions which are not<br>
> >> available on Android (backtrace, signal stuff).<br>
> >><br>
> >> I also built a simple hello world on linux (printf, no runtime)<br>
> >> and ran it on my android phone, and it worked!<br>
> >><br>
> >> In case you haven't used GDC without runtime before, a short<br>
> >> introduction:<br>
> >><br>
> >> * use gdc -nophoboslib to make gdc not link against phobos (and<br>
> >> afaik, druntime)<br>
> >> * theres also -nostdlib in case you need it<br>
> >> * complex code may require -fno-section-anchors because of bug #120<br>
> >> * You'll get an error about a missing _Dmodule_ref symbol. That<br>
> >> symbol is used by module constructors and not generated by gdc if<br>
> >> -nophoboslib was passed. As long as you don't run the module<br>
> >> constructors, you can add a fake _Dmodule_ref in a .c file:<br>
> >><br>
> >> ------------<br>
> >> void* _Dmodule_ref;<br>
> >> ------------<br>
> >><br>
> >> * The compiler defines version(Android)<br>
> >><br>
> >> Here's my hello world:<br>
> >> ------------<br>
> >> version(Android)<br>
> >> {<br>
> >> pragma(msg, "Hello Android!");<br>
> >> }<br>
> >><br>
> >> extern(C)<br>
> >> {<br>
> >> int printf(in char* format, ...);<br>
> >> }<br>
> >><br>
> >> extern(C) void main()<br>
> >> {<br>
> >> printf("Hello, %s!\n".ptr, "Android".ptr);<br>
> >> }<br>
> >> ------------<br>
> >><br>
> >> compile the _Dmodule_ref into hack.o, then use<br>
> >> gdc -nophoboslib hello.d hack.o<br>
> >><br>
> ><br>
> > Amazing! You sir, are a genius!<br>
> > I'm gonna have to have some fun with that after work tomorrow :)<br>
> ><br>
> > I reckon this binary distro should be put on d-p-l somewhere<br>
> > obvious.<br>
> ><br>
><br>
</div></div><div>> I just tried with -mfpu=neon, which should allow GCC to generate neon<br>
> opcodes for the simd stuff, but it didn't seem to want to do that. In<br>
> fact it generates really horrible code where it CALLS an intrinsic<br>
> for each float in the vector...<br>
> Any idea why this wouldn't work out of the box?<br>
<br>
</div>The android toolchain configures gcc with: += --with-float=soft<br>
--with-fpu=vfp --with-arch=armv5te<br>
<br>
I could try to build an optimized build, but then you'll have to tell<br>
me what processor you're using. Cortex A8?<br>
<br>
I'm not sure if you can override that at runtime. You could probably<br>
try:<br>
-mfloat-abi=hard -mcpu=cortex-a8 -march=armv7-a -mfpu=neon<br></blockquote><div><br></div><div>That's interesting. I seem to recall in a recent NDK noticing that they had changed to armv7 by default... but looking at the R6 NDK, it looks like it's configured basically identical to your toolchain.</div>
<div>I must just be missing a whole function of compile options, but I can't see any option in the standard build scripts to enable hardware fpu :/</div><div>The options I see that are supplied are: -ffast-math -mfloat-abi=softfp -march=armv7-a</div>
<div><br></div><div>I imagine all android 2+ devices have at least armv7's with a hardware fpu...</div><div><br></div><div>Interesting that NEON is not supported on all hardware. Annoying to do runtime detection to take advantage of stuff like that >_<</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>> I wanted to add ARM support to my std.simd work here as a better<br>
> proof of concept.<br>
><br>
> Iain: was there anything particularly special you needed to do to<br>
> hook the x86 SSE stuff to GDC which would need to be duplicated for<br>
> ARM? gcc.builtins doesn't seen to have any ARM intrinsics in there<br>
> either...<br>
><br>
<br>
</div></div></blockquote></div><br>