[Issue 9044] dmd sometimes produces object files with multiple definitions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 20 06:13:09 PDT 2013


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


Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de


--- Comment #25 from Rainer Schuetze <r.sagitario at gmx.de> 2013-05-20 06:13:05 PDT ---
I very much suspect that this is caused by the generated internal object file
names of a library or other generated identifiers that are assumed to be
unique, but clearly this is not guaranteed when building libraries in separate
build steps.

I tried to generate a small test on that suspicion some time ago, but it didn't
trigger a linker error then. I have figured it out now:

////////////////////////
module ab;

struct AB
{
     int a;
    int len() { return (new AB).a; }
}

unittest
{
}

////////////////////////
module ba;

struct BA
{
    int b;
    int len() { return (new BA).b; }
}

unittest
{
}

////////////////////////
import ab;
import ba;

int main()
{
    AB ab;
    BA ba;
    return ab.len() + ba.len();
}
////////////////////////

now building with dmd 2.062:

dmd -lib -of"alib.lib" ab.d
dmd -lib -of"blib.lib" ba.d
dmd -c main.d
dmd main.obj alib.lib blib.lib

yields:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
blib.lib(object)  Offset 013AEH Record Type 0091
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.412__ModuleInfoZ
blib.lib(object)  Offset 0143CH Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.47__arrayZ
blib.lib(object)  Offset 01469H Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.48__assertFiZv
blib.lib(object)  Offset 01496H Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.415__unittest_failFiZv
blib.lib(object)  Offset 00F6EH Record Type 0091
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.312__ModuleInfoZ
blib.lib(object)  Offset 0103BH Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.37__arrayZ
blib.lib(object)  Offset 01068H Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.38__assertFiZv
blib.lib(object)  Offset 01095H Record Type 00C3
 Error 1: Previous Definition Different :
_D59c:\l\dmd2\windows\bin\..\..\src\druntime\import\object.di.315__unittest_failFiZv

also happens with current git-head.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list