RESOLVED FIXED 275567
[Win] Enable BUILTIN_FRAME_ADDRESS using _AddressOfReturnAddress()
https://bugs.webkit.org/show_bug.cgi?id=275567
Summary [Win] Enable BUILTIN_FRAME_ADDRESS using _AddressOfReturnAddress()
Ian Grunert
Reported 2024-06-17 08:07:49 PDT
Disabled on Windows as __builtin_frame_address(1) is unavailable, and cannot be recreated with __builtin_frame_address(0) due to how the stack frame is grown. __builtin_frame_address(0) points at the current frame, and if the current function spills registers to the stack it's pointing at the first of four home spaces. Without knowing the size of the stack frame the compiler reserves we can't walk back up to find the RBP at function entry. Could be implemented on Windows with __builtin_stack_address() once implemented in clang, as that returns the stack pointer at the time of function entry. With that we'd either be able to access the RBP that was pushed to the stack by the function, or we could push it within CCallHelpers so we didn't have to rely on that. Blocked on support for __builtin_stack_address() being added to clang - https://github.com/llvm/llvm-project/issues/82632
Attachments
Ian Grunert
Comment 1 2024-06-17 18:08:16 PDT
__builtin_stack_address() might still not do what we need, it sounds like it might point at the end of the function frame. The overall problem is that on Windows, the frame pointer is after local variables and callee-saved registers. https://learn.microsoft.com/en-us/cpp/build/stack-usage?view=msvc-170 We might be able to get something that works using _AddressOfReturnAddress().
Ian Grunert
Comment 2 2024-06-21 07:46:36 PDT
EWS
Comment 3 2024-06-25 08:17:06 PDT
Committed 280335@main (0ced454cee73): <https://commits.webkit.org/280335@main> Reviewed commits have been landed. Closing PR #30043 and removing active labels.
Radar WebKit Bug Importer
Comment 4 2024-06-25 08:17:30 PDT
Note You need to log in before you can comment on or make changes to this bug.