D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7960 - link-failure optlink crash EIP=00000000
Summary: link-failure optlink crash EIP=00000000
Status: RESOLVED MOVED
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: x86 Windows
: P2 critical
Assignee: No Owner
URL:
Keywords: Optlink
Depends on:
Blocks:
 
Reported: 2012-04-21 02:31 UTC by Benjamin Thaut
Modified: 2020-06-10 01:37 UTC (History)
3 users (show)

See Also:


Attachments
repro case (742.35 KB, application/zip)
2012-04-21 02:31 UTC, Benjamin Thaut
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Benjamin Thaut 2012-04-21 02:31:52 UTC
Created attachment 1098 [details]
repro case

This crash might have multiple causes. I compile my project with:

dmd -g -unittest -debug -X -Xf"Debug\thBase.json"
-IC:\Users\Benjamin\Documents\d-projects\druntime\import
-IC:\Users\Benjamin\Documents\d-projects\phobos -version=NOGCSAFE
-version=thBase_test -deps="Debug\thBase.dep" -of"Debug\thBase.exe_cv" -map
"Debug\thBase.map" -L/NOMAP -defaultlib=phobosnogc -debuglib=phobosnogc
gcstub.obj -v @Debug\thBase.build.rsp

Dmd launches optlink with:
link.exe
gcstub+"Debug\thBase","Debug\thBase.exe_cv","Debug\thBase.map",user32+kernel32/m/co/noi/NOMAP;

Which causes optlink to crash with EIP=00000000

The first thing which might be a bug in dmd is, that the phobosnogc library is
missing in the link command which I specified both with defaultlib and
debuglib.

If I manually specifiy the phobosnogc.lib in the build command dmd generates
the following link command:

link.exe
gcstub+"Debug\thBase","Debug\thBase.exe_cv","Debug\thBase.map","phobosnogc.lib"+user32+kernel32/m/co/noi/NOMAP;

Which still causes optlink to crash with EIP=00000000.

If I however let dmd only compile and then manually link with:

link.exe
"phobosnogc"+gcstub+"Debug\thBase","Debug\thBase.exe_cv","Debug\thBase.map",user32+kernel32/m/co/noi/NOMAP;

Optlink links everything fine and the executable works just as it should.

So there seem to be 3 different issues here:

1) dmd does not pass the library specified with debuglib defaultlib to optlink
2) Optlink crashes with EIP=00000000
3) The order in which you pass the library files to optlink changes optlink
behaviour.

This issue exists with dmd 2.058 and optlink 8.00.12. See attached repro case.
Comment 1 Benjamin Thaut 2012-04-21 02:34:34 UTC
I'm going to try adding a reduced source to reproduce the issue.
Comment 2 Rainer Schuetze 2013-11-23 02:35:25 UTC
Maybe related: https://github.com/DigitalMars/optlink/pull/11
Comment 3 Mathias LANG 2020-06-10 01:37:44 UTC
Issue transferred to: https://github.com/DigitalMars/optlink/issues/33