Ehem, ARM

Joakim joakim at airpost.net
Sun Dec 15 20:58:21 PST 2013


On Monday, 2 December 2013 at 18:35:36 UTC, Rainer Schuetze wrote:
> On 02.12.2013 10:36, Joakim wrote:
>> Where is this "implicit include directive?"  It's confusing 
>> because "dmd
>> -v" shows the exact same linker command being run whether that 
>> "extern
>> (C)" is there before main or not.
>
> The compiler embeds it into the object file if code for "D 
> main" is generated. The respective code is around line 742, 
> glue.c.
Thanks, I see it.

> IIRC it is not possible to embed a linker directive into an ELF 
> object file, so it must always be specified on the command 
> line. Maybe the linker is looking for libphobos2.a in the wrong 
> directories?
The problem was that I was specifying libphobos2.a _before_ the 
object file that dmd compiled when linking and the linker order 
was biting me.  It worked fine with the wrong linker order as 
long as I didn't reference symbols like stderr from druntime, 
because it was getting stdc function symbols from libc anyway, 
but would crap out when the stderr symbol was needed from 
druntime.  As usual, the problem was user error. :)

I just got a basic D program running with a patched druntime on 
Android/x86. :) I was also able to compile and run sieve.d from 
the D samples, after replacing std.stdio.writefln with 
core.stdc.stdio.printf and moving the flags declaration inside 
main.  It would segfault at "flags[]=true" if I didn't move that 
declaration inside, so there are obviously still some scoping 
issues, perhaps because I haven't ported all of druntime to 
Android yet, only about halfway done.


More information about the Digitalmars-d mailing list