public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97448] New: Unneccessary stack frame when using stack protector
@ 2020-10-15 15:21 christophe.leroy at csgroup dot eu
2021-09-19 5:28 ` [Bug target/97448] " pinskia at gcc dot gnu.org
2024-08-26 4:16 ` guojiufu at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: christophe.leroy at csgroup dot eu @ 2020-10-15 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97448
Bug ID: 97448
Summary: Unneccessary stack frame when using stack protector
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: christophe.leroy at csgroup dot eu
Target Milestone: ---
While building Linux kernel for 32 bits powerpc with GCC 10.1 with stack frame
protection, functions that don't use the stack at all get a pointless stack
frame, while they don't when stackframe protection is not used:
c0016af4 <get_order>:
c0016af4: 38 63 ff ff addi r3,r3,-1
c0016af8: 94 21 ff f0 stwu r1,-16(r1)
c0016afc: 54 63 a3 3e rlwinm r3,r3,20,12,31
c0016b00: 7c 63 00 34 cntlzw r3,r3
c0016b04: 20 63 00 20 subfic r3,r3,32
c0016b08: 38 21 00 10 addi r1,r1,16
c0016b0c: 4e 80 00 20 blr
c000d1b8 <raw_copy_from_user>:
c000d1b8: 94 21 ff f0 stwu r1,-16(r1)
c000d1bc: 38 21 00 10 addi r1,r1,16
c000d1c0: 48 00 c5 44 b c0019704 <__copy_tofrom_user>
Used GCC version:
GCC version with the BUG:
Using built-in specs.
COLLECT_GCC=/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc
COLLECT_LTO_WRAPPER=/home/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/../libexec/gcc/powerpc64-linux/10.1.0/lto-wrapper
Target: powerpc64-linux
Configured with: /home/arnd/git/gcc/configure --target=powerpc64-linux
--enable-targets=all
--prefix=/home/arnd/cross/x86_64/gcc-10.1.0-nolibc/powerpc64-linux
--enable-languages=c --without-headers --disable-bootstrap --disable-nls
--disable-threads --disable-shared --disable-libmudflap --disable-libssp
--disable-libgomp --disable-decimal-float --disable-libquadmath
--disable-libatomic --disable-libcc1 --disable-libmpx --enable-checking=release
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (GCC)
Build command:
powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/.setup-common.o.d -nostdinc
-isystem
/home/opt/gcc-10.1.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/10.1.0/include
-I./arch/powerpc/include -I./arch/powerpc/include/generated -I./include
-I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc -Wall
-Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration
-Werror=implicit-int -Wno-format-security -std=gnu89 -mcpu=powerpc
-mcpu=powerpc -m32 -msoft-float -pipe -ffixed-r2 -mmultiple
-mno-readonly-in-sdata -mcpu=powerpc64 -mno-altivec -mno-vsx
-fno-asynchronous-unwind-tables -mno-string -mbig-endian
-mstack-protector-guard=tls -mstack-protector-guard-reg=r2
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-address-of-packed-member -O2
-fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector
-Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable
-fomit-frame-pointer -fno-var-tracking-assignments
-Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation
-Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-merge-all-constants
-fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time
-Werror=incompatible-pointer-types -Werror=designated-init
-fmacro-prefix-map=./= -Wno-packed-not-aligned
-mstack-protector-guard-offset=552 -Werror
-DKBUILD_MODFILE='"arch/powerpc/kernel/setup-common"'
-DKBUILD_BASENAME='"setup_common"' -DKBUILD_MODNAME='"setup_common"' -c -o
arch/powerpc/kernel/setup-common.o arch/powerpc/kernel/setup-common.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/97448] Unneccessary stack frame when using stack protector
2020-10-15 15:21 [Bug c/97448] New: Unneccessary stack frame when using stack protector christophe.leroy at csgroup dot eu
@ 2021-09-19 5:28 ` pinskia at gcc dot gnu.org
2024-08-26 4:16 ` guojiufu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-19 5:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97448
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|powerpc |powerpc-*-*linux (32bit)
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase -O2 -fstack-protector:
int fls64(int x)
{
return x;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/97448] Unneccessary stack frame when using stack protector
2020-10-15 15:21 [Bug c/97448] New: Unneccessary stack frame when using stack protector christophe.leroy at csgroup dot eu
2021-09-19 5:28 ` [Bug target/97448] " pinskia at gcc dot gnu.org
@ 2024-08-26 4:16 ` guojiufu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2024-08-26 4:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97448
Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |guojiufu at gcc dot gnu.org
--- Comment #2 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
In rs6000-logue.cc, there are code to check if there are
something(var/vector/...) using stack. But the vars_size is adjusted under
these options, and then even if there are no vars, the 'vars_size' is not
'0'(it becomes padding size).
So, tune code:
unadjust_vars_size = info->vars_size;
if (FRAME_GROWS_DOWNWARD)
773 info->vars_size
774 += RS6000_ALIGN (info->fixed_size + info->vars_size +
info->parm_size,
775 ABI_STACK_BOUNDARY / BITS_PER_UNIT)
776 - (info->fixed_size + info->vars_size + info->parm_size);
unajust_non_fixed_size = unadjust_vars_size + info->parm_size +
info->save_size;
868 non_fixed_size = info->vars_size + info->parm_size + info->save_size;
919 info->push_p = non_fixed_size != 0; ==>
919 info->push_p = unajust_non_fixed_size != 0;
Sorry for not putting the patch here.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-26 4:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 15:21 [Bug c/97448] New: Unneccessary stack frame when using stack protector christophe.leroy at csgroup dot eu
2021-09-19 5:28 ` [Bug target/97448] " pinskia at gcc dot gnu.org
2024-08-26 4:16 ` guojiufu at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).