Skip to content

[NativeAOT/x86] Enable SAFESEH #100430

@jkotas

Description

@jkotas

Repro

Build repro/reproNative convenience project for win x86 target (https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md)

Result

1>repro.obj : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(AllocFast.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(WriteBarriers.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(ExceptionHandling.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(GcProbe.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(StubDispatch.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(MiscStubs.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(PInvoke.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>Runtime.WorkstationGC.lib(UniversalTransition.asm.obj) : error LNK2026: module unsafe for SAFESEH image.
1>C:\runtime\src\coreclr\tools\aot\ILCompiler\reproNative\Release\reproNative.exe : fatal error LNK1281: Unable to generate SAFESEH image.

The reproNative project has the secure vcproj defaults, passes /SAFESEH to the linker and linker complains that the inputs are not annotated with SAFESEH.

We should get the obj inputs annotated correctly (looks like it will require change in the obj writer) and pass SAFESEH to the linker on win-x86 to avoid compliance warnings from tools like https://github.com/microsoft/binskim

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions