[Issue 20421] New: Exceptions don't work when linking through lld-link
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 27 07:11:52 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20421
Issue ID: 20421
Summary: Exceptions don't work when linking through lld-link
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: r.sagitario at gmx.de
import std.stdio;
void main(){
try {
throw new Exception("first");
} catch (Exception e) {
writeln("catch ", e.msg);
}
writeln("done");
}
Building this with against the mingw libs with
> dmd.exe -m32mscoff test.d -mscrtlib=msvcrt100
generates an executable that doesn't produce any output, but silently crashes.
When run in a debugger, it reports:
Unhandled exception at 0x004010EF in x.exe: 0xC00001A5: An invalid exception
handler routine has been detected (parameters: 0x00000001).
This seems to happen when lld is used instead of the Microsoft linker.
Using lld from LLVM 9 spits out errors "not compatible with SEH", but links
using /SAFESEH:NO. The resulting executable then works.
--
More information about the Digitalmars-d-bugs
mailing list