This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [builtins] Implement the __chkstk function for ARM for MinGW
ClosedPublic

Authored by mstorsjo on Jul 7 2018, 2:56 PM.

Details

Summary

On ARM (contrary to both x86 and ARM64), this function is available for linking in from kernel32.dll, but it's not allowed to link that function from there in Windows Store apps.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Jul 7 2018, 2:56 PM
Herald added subscribers: Restricted Project, chrib, kristof.beyls and 2 others. · View Herald Transcript

Microsoft's implementation also checks the stack allocation against the thread's stack limit. Do you care about doing that?

LGTM otherwise, but I'd prefer to wait for @compnerd to take a look. (He's on vacation this week, but he'll be back next week.)

lib/builtins/arm/chkstk.S
10 ↗(On Diff #154503)

It also clobbers the condition codes. We were bitten by this before; see https://reviews.llvm.org/rL311061.

Microsoft's implementation also checks the stack allocation against the thread's stack limit. Do you care about doing that?

That might be neat to do, but we don't do that in the existing implementations of __chkstk* for x86, nor in the aarch64 version I wrote a few months ago (where I justified it to myself with the same reason; it hasn't been done for x86 yet either).

lib/builtins/arm/chkstk.S
10 ↗(On Diff #154503)

Good catch, I'll amend the comment for clarity.

compnerd accepted this revision.Jul 17 2018, 11:57 AM

Seems fine with the adjusted comment

This revision is now accepted and ready to land.Jul 17 2018, 11:57 AM
This revision was automatically updated to reflect the committed changes.