https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84574
--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> --- Author: hjl Date: Mon Apr 16 19:11:13 2018 New Revision: 259422 URL: https://gcc.gnu.org/viewcvs?rev=259422&root=gcc&view=rev Log: i386: Don't generate alias for function return thunk Function return thunks shouldn't be aliased to indirect branch thunks since indirect branch thunks are placed in COMDAT section and a COMDAT section with indirect branch may not have function return thunk. This patch generates function return thunks directly. gcc/ Backport from mainline PR target/84574 * config/i386/i386.c (indirect_thunk_needed): Update comments. (indirect_thunk_bnd_needed): Likewise. (indirect_thunks_used): Likewise. (indirect_thunks_bnd_used): Likewise. (indirect_return_needed): New. (indirect_return_bnd_needed): Likewise. (output_indirect_thunk_function): Add a bool argument for function return. (output_indirect_thunk_function): Don't generate alias for function return thunk. (ix86_code_end): Call output_indirect_thunk_function to generate function return thunks. (ix86_output_function_return): Set indirect_return_bnd_needed and indirect_return_needed instead of indirect_thunk_bnd_needed and indirect_thunk_needed. gcc/testsuite/ Backport from mainline PR target/84574 * gcc.target/i386/ret-thunk-9.c: Expect __x86_return_thunk label instead of __x86_indirect_thunk label. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/config/i386/i386.c branches/gcc-6-branch/gcc/testsuite/ChangeLog branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/ret-thunk-9.c