Skip to content

Commit

Permalink
FEXLoader: Align stack base
Browse files Browse the repository at this point in the history
This ensures that __libc_stack_end is aligned, the same way it is on
native.
  • Loading branch information
asahilina committed Nov 12, 2024
1 parent e675f42 commit 4a67893
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Tools/FEXLoader/ELFCodeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ class ELFCodeLoader final : public FEX::CodeLoader {
uint64_t ExecFNLocation = TotalArgumentMemSize;
TotalArgumentMemSize += Args[0].size() + 1;

// Align the argument block to 16 bytes to keep the stack aligned
TotalArgumentMemSize = FEXCore::AlignUp(TotalArgumentMemSize, 16);

// Offset the stack by how much memory we need
StackPointer -= TotalArgumentMemSize;

Expand Down

0 comments on commit 4a67893

Please sign in to comment.