www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Any way to workaround Optlink crash?

reply Denis Koroskin <2korden gmail.com> writes:
I was refactoring the following line of code:

foo(rand() % 256); -> foo(0);

and that causes Optlink to crash now. Any reason why it does so? 

That particular file is just 157 lines long, but the whole project is quite
big, although there are no large files. The biggest one is ~140K, it's from
win32 bindings project (only defines a bunch of constants, and does little
impact on output file size), that I use for a few years now, and they never
caused any problem to me. My files are 40K max.

I believe that line of code has no direct relation to Optlink crash, but I
still post it just to show that it's code simplification that leads to crash,
not adding any new type or symbol or anything.

Thanks for any hint.
Aug 31 2009
next sibling parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Denis Koroskin wrote:
 I was refactoring the following line of code:
 
 foo(rand() % 256); -> foo(0);
 
 and that causes Optlink to crash now. Any reason why it does so? 
 
 That particular file is just 157 lines long, but the whole project is quite
big, although there are no large files. The biggest one is ~140K, it's from
win32 bindings project (only defines a bunch of constants, and does little
impact on output file size), that I use for a few years now, and they never
caused any problem to me. My files are 40K max.
 
 I believe that line of code has no direct relation to Optlink crash, but I
still post it just to show that it's code simplification that leads to crash,
not adding any new type or symbol or anything.
 
 Thanks for any hint.
I guess this is just a random instance of OPTLINK's bug. I recommend sacrificing your firstborn. Or if that doesn't work, change the order in which you pass modules to the compiler - certain symbols (template instantiations, initializers, classinfo, etc) will end up in different object files and that might hit OPTLINK's sweet spot. And/or compile some modules without -g. Maybe you don't need debug symbols everywhere. -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
Aug 31 2009
parent reply Max Samukha <spambox d-coding.com> writes:
Tom S wrote:
 
 And/or compile some modules without -g. Maybe you don't need debug
 symbols everywhere.
 
 
And please vote for http://d.puremagic.com/issues/votes.cgi?action=show_bug&bug_id=424. Something makes Walter think this bug is not critical.
Aug 31 2009
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Max Samukha wrote:
 Tom S wrote:
 And/or compile some modules without -g. Maybe you don't need debug
 symbols everywhere.
And please vote for http://d.puremagic.com/issues/votes.cgi?action=show_bug&bug_id=424. Something makes Walter think this bug is not critical.
I think he knows... But it's a lot of work to write a new linker. COFF/ELF output would not be that bad though, at least if there's some linker that supports these *and* its license allows it to be bundled with DMD. -- Tomasz Stachowiak http://h3.team0xf.com/ h3/h3r3tic on #D freenode
Sep 01 2009
parent reply Max Samukha <spambox d-coding.com> writes:
Tom S wrote:

 Max Samukha wrote:
 Tom S wrote:
 And/or compile some modules without -g. Maybe you don't need debug
 symbols everywhere.
And please vote for http://d.puremagic.com/issues/votes.cgi?action=show_bug&bug_id=424. Something makes Walter think this bug is not critical.
I think he knows... But it's a lot of work to write a new linker.
I am sure it is a lot of work for a single person to do. That's why it would be nice of Walter if he gave us a hint whether the bug is fixable at all and how high it is on his priority list.
 COFF/ELF output would not be that bad though, at least if there's some
 linker that supports these *and* its license allows it to be bundled
 with DMD.
 
 
I doubt such a linker exists. And if it does, I doubt it is of quality good enough to replace OPTLINK.
Sep 01 2009
parent reply =?ISO-8859-1?Q?=22J=E9r=F4me_M=2E_Berger=22?= <jeberger free.fr> writes:
Max Samukha wrote:
 Tom S wrote:
 Max Samukha wrote:
 COFF/ELF output would not be that bad though, at least if there's some=
 linker that supports these *and* its license allows it to be bundled
 with DMD.
I doubt such a linker exists. And if it does, I doubt it is of quality =
good=20
 enough to replace OPTLINK.
=20
GNU ld supports these formats on *nix, windows and MacOS. It has=20 very good quality and its license allows it to be bundled with=20 anything... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Sep 01 2009
parent reply div0 <div0 users.sourceforge.net> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jérôme M. Berger wrote:
 Max Samukha wrote:
 Tom S wrote:
 Max Samukha wrote:
 COFF/ELF output would not be that bad though, at least if there's some
 linker that supports these *and* its license allows it to be bundled
 with DMD.
I doubt such a linker exists. And if it does, I doubt it is of quality good enough to replace OPTLINK.
GNU ld supports these formats on *nix, windows and MacOS. It has very good quality and its license allows it to be bundled with anything... Jerome
Yeah but have you actually linked a D program with it? (esp. on 'doze) - -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFKnZkuT9LetA9XoXwRAv5BAJ4+P/lRQsHCVN/eDrZaAgPvHsbWZACdF/Dx 7CQ28E5zAM4v2aNWM9RCMms= =kOpB -----END PGP SIGNATURE-----
Sep 01 2009
next sibling parent =?ISO-8859-1?Q?=22J=E9r=F4me_M=2E_Berger=22?= <jeberger free.fr> writes:
div0 wrote:
 J=E9r=F4me M. Berger wrote:
 Max Samukha wrote:
 Tom S wrote:
 Max Samukha wrote:
 COFF/ELF output would not be that bad though, at least if there's so=
me
 linker that supports these *and* its license allows it to be bundled=
 with DMD.
I doubt such a linker exists. And if it does, I doubt it is of qualit=
y
 good enough to replace OPTLINK.
GNU ld supports these formats on *nix, windows and MacOS. It has very good quality and its license allows it to be bundled with anythin=
g...
=20
         Jerome
=20 Yeah but have you actually linked a D program with it? (esp. on 'doze) =20
Yes, using gdc (on both 'doze and 'nux). All you need is COFF=20 output from the compiler. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Sep 02 2009
prev sibling parent grauzone <none example.net> writes:
div0 wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Jérôme M. Berger wrote:
 Max Samukha wrote:
 Tom S wrote:
 Max Samukha wrote:
 COFF/ELF output would not be that bad though, at least if there's some
 linker that supports these *and* its license allows it to be bundled
 with DMD.
I doubt such a linker exists. And if it does, I doubt it is of quality good enough to replace OPTLINK.
GNU ld supports these formats on *nix, windows and MacOS. It has very good quality and its license allows it to be bundled with anything... Jerome
Yeah but have you actually linked a D program with it? (esp. on 'doze)
Probably that wasn't really clear: dmd on Linux uses GNU ld for linking. Walter has an ELF backend for this. Walter also wrote a backend for Mach for the MacOSX port.
 - --
 My enormous talent is exceeded only by my outrageous laziness.
 http://www.ssTk.co.uk
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iD8DBQFKnZkuT9LetA9XoXwRAv5BAJ4+P/lRQsHCVN/eDrZaAgPvHsbWZACdF/Dx
 7CQ28E5zAM4v2aNWM9RCMms=
 =kOpB
 -----END PGP SIGNATURE-----
Sep 02 2009
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Denis Koroskin" <2korden gmail.com> wrote in message 
news:h7hbe8$1sni$1 digitalmars.com...
I was refactoring the following line of code:

 foo(rand() % 256); -> foo(0);

 and that causes Optlink to crash now. Any reason why it does so?

 That particular file is just 157 lines long, but the whole project is 
 quite big, although there are no large files. The biggest one is ~140K, 
 it's from win32 bindings project (only defines a bunch of constants, and 
 does little impact on output file size), that I use for a few years now, 
 and they never caused any problem to me. My files are 40K max.

 I believe that line of code has no direct relation to Optlink crash, but I 
 still post it just to show that it's code simplification that leads to 
 crash, not adding any new type or symbol or anything.

 Thanks for any hint.
I don't mean to sound patronizing, but you did try clearing out all the object files and doing a clean build, right? I only point it out because I've been bit a few times by an object file that got out of date but didn't get rebuilt (especially when using rebuild and switching to a different configuration, like debug vs release...and I've been suspecting that templates might have a tendency to trigger the same problem too). It took me awhile to catch on to the fact that this was happening.
Sep 02 2009