www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Repost: Linker bug still causing headaches (many test cases)

reply Daniel Horn <hellcatv hotmail.com> writes:
Too many functions or too many member functions or too many template
instantiations of a single class crash the linker (Unexpected OPTLINK 
Termination at EIP=0044C37B)

In this case merely increasing the number of template instantiations 
breaks the linker--so I could have my vector definition in one file then 
instantiate it too many places in another file, and it would not let me 
compile my (tiny) instantiator file and crash.

The program I'm trying to compile is a Cg compatability lib, and when I 
add a new instantiation I have to always make sure my program doesn use 
one of the other instantiations, and it's really depressing to be 
required disable doubles just to be able to use rationals to maintain 
dmd compatability (gdc always works):

http://graphics.stanford.edu/~danielrh/vec.d

you can stop the crash by taking out useful aliases by setting

dmd -version=DontCrash vec.d


the following is the most simple crash:
http://graphics.stanford.edu/~danielrh/manyfuncs.d

the following one is a struct with only a few thousand member functions 
(my last post showed that member functions and normal functions can both 
cause such a linker crash--so it's not just because I have a heinous 
number of members).
http://graphics.stanford.edu/~danielrh/close.d

setting version=DontCrash on the following one will stop the crash
http://graphics.stanford.edu/~danielrh/sclass.d
in sclass you can move the int main() into another file and watch it 
crash depending on how many of the template instantiations you make.
May 27 2004
parent reply "Walter" <newshound digitalmars.com> writes:
This happens when there are more than 16,000 fixups in a single .obj.
Unfortunately, this isn't fixable at the moment.
May 30 2004
parent reply hellcatv hotmail.com writes:
In article <c9eajd$1sgn$2 digitaldaemon.com>, Walter says...
This happens when there are more than 16,000 fixups in a single .obj.
Unfortunately, this isn't fixable at the moment.

(i.e. for multiple template instantiations) I suspect mixins would have the same problem... basically I want to generate too much code per struct
May 30 2004
parent reply Andy Friesen <andy ikagames.com> writes:
hellcatv hotmail.com wrote:
 In article <c9eajd$1sgn$2 digitaldaemon.com>, Walter says...
 
This happens when there are more than 16,000 fixups in a single .obj.
Unfortunately, this isn't fixable at the moment.

is there a way you could make the compiler generate more than 1 obj per file (i.e. for multiple template instantiations) I suspect mixins would have the same problem... basically I want to generate too much code per struct

Maybe try using the OpenWatcom linker instead. http://cmeerw.org/prog/owtools/ -- andy
May 30 2004
parent hellcatv hotmail.com writes:
In article <c9ejdd$297m$1 digitaldaemon.com>, Andy Friesen says...
hellcatv hotmail.com wrote:
 In article <c9eajd$1sgn$2 digitaldaemon.com>, Walter says...
 
This happens when there are more than 16,000 fixups in a single .obj.
Unfortunately, this isn't fixable at the moment.

is there a way you could make the compiler generate more than 1 obj per file (i.e. for multiple template instantiations) I suspect mixins would have the same problem... basically I want to generate too much code per struct

Maybe try using the OpenWatcom linker instead. http://cmeerw.org/prog/owtools/ -- andy

thanks for the pointer, but no go: yet Open Watcom Linker Version 1.1(DMC) Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. WLINK>loading object files searching libraries Error! E3002: ** internal ** - format not decided does that mean anything to you?
May 31 2004