https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95134
Bug ID: 95134 Summary: -ffreestanding should avoid libcall 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 freestand]$ cat x.i struct foo { char array[257]; }; extern struct foo x; void func (struct foo i) { x = i; } [hjl@gnu-cfl-2 freestand]$ make x.s /export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O2 -W -ffreestanding -mtune=pentium -m32 -S x.i [hjl@gnu-cfl-2 freestand]$ cat x.s .file "x.i" .text .p2align 4 .globl func .type func, @function func: .LFB0: .cfi_startproc subl $16, %esp .cfi_def_cfa_offset 20 pushl $257 .cfi_def_cfa_offset 24 leal 24(%esp), %eax pushl %eax .cfi_def_cfa_offset 28 pushl $x .cfi_def_cfa_offset 32 call memcpy addl $28, %esp .cfi_def_cfa_offset 4 ret .cfi_endproc .LFE0: .size func, .-func .ident "GCC: (GNU) 11.0.0 20200514 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 freestand]$ x86 backend should avoid libcall if flag_hosted is false.