www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - m32mscoff with lld-link causes SEH errors

reply Daniel C <dcrep rep.com> writes:
Hi, I have a simple program with just one line (below).  I've 
compiled on Windows using
dmd -ms32coff app.d
and have had LINKCMD set to lld-link, but get the following 
errors. Is lld-link only for 64-bit compiles (-m64 is the only 
one that gives no errors)

lld-link: error: /safeseh: app.obj is not compatible with SEH
lld-link: error: /safeseh: ti_Ag_2714_4a7.obj is not compatible 
with SEH
lld-link: error: /safeseh: stdio_4_58e.obj is not compatible with 
SEH
lld-link: error: /safeseh: stdio_1_180.obj is not compatible with 
SEH
lld-link: error: /safeseh: exception_2baa_5b5.obj is not 
compatible with SEH
lld-link: error: /safeseh: deh_win32_256e_60b.obj is not 
compatible with SEH
lld-link: error: /safeseh: deh_win32_2577_653.obj is not 
compatible with SEH
lld-link: error: /safeseh: lifetime_25bb_4e0.obj is not 
compatible with SEH
lld-link: error: /safeseh: lifetime_25a5_482.obj is not 
compatible with SEH
lld-link: error: /safeseh: dmain2_2597_47b.obj is not compatible 
with SEH
lld-link: error: /safeseh: deh_win32_2571_3b9.obj is not 
compatible with SEH
lld-link: error: /safeseh: object_cf_6f6.obj is not compatible 
with SEH
lld-link: error: /safeseh: object_10_583.obj is not compatible 
with SEH
lld-link: error: /safeseh: ti_Ag_2712_42f.obj is not compatible 
with SEH
lld-link: error: /safeseh: object_266_6bb.obj is not compatible 
with SEH
lld-link: error: /safeseh: object_7_32e.obj is not compatible 
with SEH
lld-link: error: /safeseh: ti_Ag_270e_435.obj is not compatible 
with SEH
lld-link: error: /safeseh: ti_Ag_270f_436.obj is not compatible 
with SEH
lld-link: error: /safeseh: object_a_58c.obj is not compatible 
with SEH
lld-link: error: /safeseh: stdio_10_cfb.obj is not compatible 
with SEH

app.d:
import std.stdio;

void main()
{
	writeln("Edit source/app.d to start your project.");
}
May 24 2020
parent reply kinke <kinke gmx.net> writes:
On Monday, 25 May 2020 at 01:32:58 UTC, Daniel C wrote:
 Is lld-link only for 64-bit compiles (-m64 is the only one that 
 gives no errors)
Nope, but SafeSEH is a 32-bit-only feature. DMD doesn't emit SafeSEH compatible object files, and LLD seems to have a different default setting in that regard compared to MS link.exe. Using `-L/safeseh:no` should work around this.
May 26 2020
next sibling parent Daniel C <dcrep rep.com> writes:
On Tuesday, 26 May 2020 at 15:56:31 UTC, kinke wrote:
 On Monday, 25 May 2020 at 01:32:58 UTC, Daniel C wrote:
 Is lld-link only for 64-bit compiles (-m64 is the only one 
 that gives no errors)
Nope, but SafeSEH is a 32-bit-only feature. DMD doesn't emit SafeSEH compatible object files, and LLD seems to have a different default setting in that regard compared to MS link.exe. Using `-L/safeseh:no` should work around this.
Thank you! One more thing to add to my compile/link notes =)
May 26 2020
prev sibling parent Daniel C <dcrep rep.com> writes:
On Tuesday, 26 May 2020 at 15:56:31 UTC, kinke wrote:
 Using `-L/safeseh:no` should work around this.
It successfully made the executable, and it runs fine - until exit lol. Must be more tweaks needed. Edit source/app.d to start your project. object.Error (0): Access Violation ---------------- 0x0045F058 0x0040139F 0x0040100D 0x00405879 0x00405710 0x00402A1E 0x00401030 0x75C6347D in BaseThreadInitThunk 0x77059852 in RtlInitializeExceptionChain 0x77059825 in RtlInitializeExceptionChain - CreateProcess Program Exit code: 1 -
May 26 2020