https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95162
Bug ID: 95162
Summary: -mpreferred-stack-boundary=2 doesn't work with libgcc
functions
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: ubizjak at gmail dot com
Target Milestone: ---
Target: i386,x86-64
[hjl@gnu-cfl-2 pr95021]$ cat d.c
void
foo (_Decimal32 x)
{
if (x != 3.0df)
__builtin_abort ();
}
[hjl@gnu-cfl-2 pr95021]$ make d.s CC=gcc
gcc -O2 -W -m32 -mpreferred-stack-boundary=2 -S d.c
[hjl@gnu-cfl-2 pr95021]$ cat d.s
.file "d.c"
.text
.globl __bid_nesd2
.section .text.unlikely,"ax",@progbits
.LCOLDB0:
.text
.LHOTB0:
.p2align 4
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
pushl $838860830
.cfi_def_cfa_offset 8
pushl 8(%esp)
.cfi_def_cfa_offset 12
call __bid_nesd2 <<<<<<<< It expects 16 byte alignments.
popl %edx
.cfi_def_cfa_offset 8
popl %ecx
.cfi_def_cfa_offset 4
testl %eax, %eax
jne .L4
ret
.cfi_endproc
.section .text.unlikely
.cfi_startproc
.type foo.cold, @function
foo.cold:
.LFSB0:
.L4:
call abort
.cfi_endproc
.LFE0:
.text
.size foo, .-foo
.section .text.unlikely
.size foo.cold, .-foo.cold
.LCOLDE0:
.text
.LHOTE0:
.ident "GCC: (GNU) 10.1.1 20200507 (Red Hat 10.1.1-1)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr95021]$
When calling libgcc functions which expect 16-byte alignments, we should
realign the outgoing stack.