Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start: Avoid needlessly aligning the stack pointer on some architectures. #20737

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions lib/std/start.zig
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,11 @@ fn _start() callconv(.Naked) noreturn {
.x86_64 =>
\\ xorl %%ebp, %%ebp
\\ movq %%rsp, %%rdi
\\ andq $-16, %%rsp
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\\ callq %[posixCallMainAndExit:P]
,
.x86 =>
\\ xorl %%ebp, %%ebp
\\ movl %%esp, %%eax
\\ andl $-16, %%esp
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\\ subl $12, %%esp
\\ pushl %%eax
\\ calll %[posixCallMainAndExit:P]
Expand All @@ -307,26 +305,10 @@ fn _start() callconv(.Naked) noreturn {
\\ andi sp, sp, -16
\\ tail %[posixCallMainAndExit]@plt
,
.mips, .mipsel =>
.mips, .mipsel, .mips64, .mips64el =>
// The lr is already zeroed on entry, as specified by the ABI.
\\ addiu $fp, $zero, 0
\\ move $a0, $sp
\\ .set push
\\ .set noat
\\ addiu $1, $zero, -16
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\\ and $sp, $sp, $1
\\ .set pop
\\ j %[posixCallMainAndExit]
,
.mips64, .mips64el =>
// The lr is already zeroed on entry, as specified by the ABI.
\\ addiu $fp, $zero, 0
\\ move $a0, $sp
\\ .set push
\\ .set noat
\\ daddiu $1, $zero, -16
\\ and $sp, $sp, $1
\\ .set pop
\\ j %[posixCallMainAndExit]
,
.powerpc, .powerpcle =>
Expand All @@ -343,7 +325,6 @@ fn _start() callconv(.Naked) noreturn {
\\ addis 2, 12, .TOC. - _start@ha
\\ addi 2, 2, .TOC. - _start@l
\\ mr 3, 1
\\ clrrdi 1, 1, 4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\\ li 0, 0
\\ stdu 0, -32(1)
\\ mtlr 0
Expand Down