[Issue 1508] New: dmd/linux template symbol issues

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 16 16:56:40 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1508

           Summary: dmd/linux template symbol issues
           Product: D
           Version: 1.021
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: braddr at puremagic.com


I think I've reduced this as much as I can, sorry, it's four files.

main.d
----
module main;
void main() {}
----

a.d
----
module a;

private import c;

interface I
{
    void anything();
}

class A : I
{
    private C!(char) c;
    this() { c = new C!(char) (); }
    void anything() {}
}
----

b.d
----
module b;

private import c;

class B
{
    private C!(char) c;
    this() { c = new C!(char); }
}
----

c.d
----
module c;

class C(T)
{
    void foo() { }
} 
----

build instructions:
$ for x in a b c d main; do dmd -c $x; done
$ gcc main.o b.o a.o c.o -o main -m32 -Xlinker
-L/home/braddr/sandbox/d/dmd/1.021/dmd/bin/../lib -lphobos -lpthread -lm

error message: `.gnu.linkonce.t_D1c8__T1CTaZ1C3fooMFZv' referenced in section
`.data' of a.o: defined in discarded section
`.gnu.linkonce.t_D1c8__T1CTaZ1C3fooMFZv' of a.o

$ echo "_D1c8__T1CTaZ1C3fooMFZv" | ../../demangle/demangle 
void c.C!(char).C.foo(void*)

$ nm a.o | ../../demangle/demangle 
00000060 D Z a.__ModuleInfo
00000000 T class a.A a.A._ctor(void*)
0000005c R Z a.A.__init
00000070 R Z a.A.__vtbl
00000000 D Z a.A.__Class
00000000 T void a.A.anything(void*)
00000004 R Z a.I.__Interface
00000000 T void c.C!(char).C.foo(void*)
00000000 D Z c.C!(char).C.__init
00000000 D Z c.C!(char).C.__vtbl
00000000 D Z c.C!(char).C.__Class
         U Z Object.__Class
         U int object.Object.opCmp(class Object, void*)
         U void object.Object.print(void*)
         U uint object.Object.toHash(void*)
         U int object.Object.opEquals(class Object, void*)
         U char[] object.Object.toString(void*)
         U Z ClassInfo.__vtbl
         U void invariant._d_invariant(class Object)
         U _Dmodule_ref
0000000c t _TMP0
         U _d_newclass
00000000 t gcc2_compiled.

$ nm b.o | ../../demangle/demangle  
00000048 D Z b.__ModuleInfo
00000000 T class b.B b.B._ctor(void*)
00000010 R Z b.B.__init
00000020 R Z b.B.__vtbl
00000000 D Z b.B.__Class
00000000 T void c.C!(char).C.foo(void*)
00000000 D Z c.C!(char).C.__init
00000000 D Z c.C!(char).C.__vtbl
00000000 D Z c.C!(char).C.__Class
         U Z Object.__Class
         U int object.Object.opCmp(class Object, void*)
         U void object.Object.print(void*)
         U uint object.Object.toHash(void*)
         U int object.Object.opEquals(class Object, void*)
         U char[] object.Object.toString(void*)
         U Z ClassInfo.__vtbl
         U void invariant._d_invariant(class Object)
         U _Dmodule_ref
         U _d_newclass
00000000 t gcc2_compiled.

$ nm c.o | ../../demangle/demangle  
00000000 D Z c.__ModuleInfo
00000000 T Z c.__array
00000000 T void c.__assert(int)
         U _Dmodule_ref
00000008 r _TMP0
         U _d_array_bounds
         U _d_assert
00000000 t gcc2_compiled.


-- 



More information about the Digitalmars-d-bugs mailing list