www.digitalmars.com         C & C++   DMDScript  

D.gnu - Help! arm-wince-pe undefined references.

reply Chad J <gamerChad _spamIsBad_gmail.com> writes:
Since the thread about arm-wince-pe-gdc when I had a bunch of undefined 
references, I've managed to work it down to a remaining few.  This all 
happens when linking a small helloworld type app.  These are the ones I 
don't know how to fix:

/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/li
gphobos.a(boxer.o): 
In function 
`_D3std5boxer3Box13findTypeClassFC8TypeInfoZE3std5boxer9TypeClass':
/root/gcc/gdc-4.0.3/libphobos/std/boxer.d:192: undefined reference to 
`_init_19TypeInfo_C8TypeInfo'
/root/gcc/gdc-4.0.3/libphobos/std/boxer.d:192: undefined reference to 
`_init_24TypeInfo_S3std5boxer3Box'
/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/li
gphobos.a(win32.o): 
In function `_D5win3222os_query_staticdatasegFPPvPkZv':
/root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
reference to `_data_start__'
/root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
reference to `_bss_end__'

For the std.boxer stuff, I grepped around for that _init_ typeinfo 
stuff, but didn't have any success.  Here is what that part of the file 
looks like:

private static TypeClass findTypeClass(TypeInfo type)
{
     if (cast(TypeInfo_Class) type)
         return TypeClass.Class;
     if (cast(TypeInfo_Pointer) type)
         return TypeClass.Pointer;
     if (isArrayTypeInfo(type))
         return TypeClass.Array;

     version (DigitalMars_TypeInfo)
     {
         /* Depend upon the name of the base type classes. */
         if (type.classinfo.name.length != "TypeInfo_?".length)
             return TypeClass.Other;
         switch (type.classinfo.name[9])
         {
             //case 'b': return TypeClass.Bit;
             case 'x': return TypeClass.Bool;
             case 'g', 'h', 's', 't', 'i', 'k', 'l', 'm': return 
TypeClass.Integer;
             case 'f', 'd', 'e': return TypeClass.Float;
             case 'q', 'r', 'c': return TypeClass.Complex;
             case 'o', 'p', 'j': return TypeClass.Imaginary;
/*ln 192*/  default: return TypeClass.Other;                  // Line 192
         }
     }
     else
     {
         /* Use the name returned from toString, which might (but 
hopefully doesn't) include an allocation. */
         switch (type.toString)
         {
             case "bool": return TypeClass.Bool;
             case "byte", "ubyte", "short", "ushort", "int", "uint", 
"long", "ulong": return TypeClass.Integer;
             case "float", "real", "double": return TypeClass.Float;
             case "cfloat", "cdouble", "creal": return TypeClass.Complex;
             case "ifloat", "idouble", "ireal": return TypeClass.Imaginary;
             default: return TypeClass.Other;
         }
     }
}

If I comment out that line then the error just moves to another place 
where TypeInfo was used.


As for

`_D5win3222os_query_staticdatasegFPPvPkZv':
/root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
reference to `_data_start__'
/root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
reference to `_bss_end__'

it comes from here:

version (GNU)
{
// This is MinGW specific
extern (C)
{
     // TODO: skip the .rdata between .data and .bss?
     extern int _data_start__;
     extern int _bss_end__;
}

void os_query_staticdataseg(void **base, uint *nbytes)
{
     *base = cast(void *)&_data_start__;
     *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char 
*)&_data_start__);
}

}
else
{

extern (C)
{
     extern int _xi_a;   // &_xi_a just happens to be start of data segment
     extern int _edata;  // &_edata is start of BSS segment
     extern int _end;    // &_end is past end of BSS
}

void os_query_staticdataseg(void **base, uint *nbytes)
{
     *base = cast(void *)&_xi_a;
     *nbytes = cast(uint)(cast(char *)&_end - cast(char *)&_xi_a);
}

}

I have also made it use the non-GNU version, which then yields the error

/usr/local/arm-wince-pe/lib/gcc/arm-wince-pe/4.0.3/../../../../arm-wince-pe/lib/li
gphobos.a(win32.o): 
In function `_D5win3222os_query_staticdatasegFPPvPkZv':
/root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:150: undefined 
reference to `_xi_a'

I could really use some help fixing these errors.  They are stopping me 
from creating a wince executable in D.

Also, what does os_query_staticdataseg do?
Jul 28 2006
parent reply pedro alves <pedro.alves domatica.pt> writes:
Hi Chad,

Chad J wrote:

 As for
 
 `_D5win3222os_query_staticdatasegFPPvPkZv':
 /root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
 reference to `_data_start__'
 /root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
 reference to `_bss_end__'
 
 it comes from here:
 
 version (GNU)
 {
 // This is MinGW specific
 extern (C)
 {
     // TODO: skip the .rdata between .data and .bss?
     extern int _data_start__;
     extern int _bss_end__;
 }
 
 void os_query_staticdataseg(void **base, uint *nbytes)
 {
     *base = cast(void *)&_data_start__;
     *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char 
 *)&_data_start__);
 }
 
main.exe is a simple hello world type app. [~]>arm-wince-pe-nm main.exe | grep data_start 00012000 D __data_start__ [~]>arm-wince-pe-nm main.exe | grep data_end 00012004 D __data_end__ Looks like underscoring strikes again. Try: extern int __data_start__; extern int __bss_end__; Cheers, Pedro Alves
Jul 29 2006
parent reply Chad J <gamerChad _spamIsBad_gmail.com> writes:
pedro alves wrote:
 Hi Chad,
 
 Chad J wrote:
 
 As for

 `_D5win3222os_query_staticdatasegFPPvPkZv':
 /root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
 reference to `_data_start__'
 /root/gcc/gdc-4.0.3/libphobos/internal/gc/win32.d:134: undefined 
 reference to `_bss_end__'

 it comes from here:

 version (GNU)
 {
 // This is MinGW specific
 extern (C)
 {
     // TODO: skip the .rdata between .data and .bss?
     extern int _data_start__;
     extern int _bss_end__;
 }

 void os_query_staticdataseg(void **base, uint *nbytes)
 {
     *base = cast(void *)&_data_start__;
     *nbytes = cast(uint)(cast(char *)&_bss_end__ - cast(char 
 *)&_data_start__);
 }
main.exe is a simple hello world type app. [~]>arm-wince-pe-nm main.exe | grep data_start 00012000 D __data_start__ [~]>arm-wince-pe-nm main.exe | grep data_end 00012004 D __data_end__ Looks like underscoring strikes again. Try: extern int __data_start__; extern int __bss_end__; Cheers, Pedro Alves
That worked, fixed the os_query_staticdataseg thing. Strange! It was fixed in all other cases, but here it misbehaves. Thanks Unfortunately the same trick didn't work for the boxer stuff, so that still needs help :(
Aug 01 2006
parent reply kris <foo bar.com> writes:
Chad J wrote:
 That worked, fixed the os_query_staticdataseg thing.  Strange!  It was 
 fixed in all other cases, but here it misbehaves.
 Thanks
 
 Unfortunately the same trick didn't work for the boxer stuff, so that 
 still needs help :(
Why not just leave boxer out? I don't think it is used internally?
Aug 01 2006
parent reply Chad J <gamerChad _spamIsBad_gmail.com> writes:
kris wrote:
 Chad J wrote:
 
 That worked, fixed the os_query_staticdataseg thing.  Strange!  It was 
 fixed in all other cases, but here it misbehaves.
 Thanks

 Unfortunately the same trick didn't work for the boxer stuff, so that 
 still needs help :(
Why not just leave boxer out? I don't think it is used internally?
Ah yes. I was thinking it was needed because it was being linked in, but then I am probably wrong because I don't fully understand how this stuff gets linked. So I just left boxer out, and it got me an executable. A 1.5 megabyte executable :o Unfortunately the executable hits some kind of error when I run it on my PDA, so I'll have to dig in with GDB. FYI the error is as follows: Error: circular initialization dependency with module date
Aug 02 2006
parent kris <foo bar.com> writes:
Chad J wrote:
 kris wrote:
 
 Chad J wrote:

 That worked, fixed the os_query_staticdataseg thing.  Strange!  It 
 was fixed in all other cases, but here it misbehaves.
 Thanks

 Unfortunately the same trick didn't work for the boxer stuff, so that 
 still needs help :(
Why not just leave boxer out? I don't think it is used internally?
Ah yes. I was thinking it was needed because it was being linked in, but then I am probably wrong because I don't fully understand how this stuff gets linked. So I just left boxer out, and it got me an executable. A 1.5 megabyte executable :o Unfortunately the executable hits some kind of error when I run it on my PDA, so I'll have to dig in with GDB. FYI the error is as follows: Error: circular initialization dependency with module date
This means that there are (at least) two modules with static ctors, and they wind up importing each other either directly or via some circuitous route. 1.5MB? That's huge; I sure hope you've got every debug flag in the world enabled there :) Oh, and congratulations! That's pretty freaking awesome :D
Aug 02 2006