https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82699
--- Comment #10 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> --- Author: hjl Date: Tue Oct 2 12:12:18 2018 New Revision: 264782 URL: https://gcc.gnu.org/viewcvs?rev=264782&root=gcc&view=rev Log: i386: Insert ENDBR before the profiling counter call ENDBR must be the first instruction of a function. This patch queues ENDBR if we need to put the profiling counter call before the prologue and generate ENDBR before the profiling counter call. i386: Compile pr82699-5.c and pr82699-6.c with -fno-pic Compile pr82699-5.c and pr82699-6.c with -fno-pic to avoid FAIL: gcc.target/i386/pr82699-5.c (test for excess errors) Excess errors: cc1: sorry, unimplemented: -mfentry isn't supported for 32-bit in combination with -fpic FAIL: gcc.target/i386/pr82699-6.c (test for excess errors) Excess errors: cc1: error: -mnop-mcount is not implemented for -fPIC cc1: sorry, unimplemented: -mfentry isn't supported for 32-bit in combination with -fpic when running GCC testsuite with --target_board='unix{-fpic\ -m32,-fpic}'. gcc/ Backport from mainline PR target/82699 * config/i386/i386.c (rest_of_insert_endbranch): Set endbr_queued_at_entrance to true and don't insert ENDBR if x86_function_profiler will be called. (x86_function_profiler): Insert ENDBR if endbr_queued_at_entrance is true. * config/i386/i386.h (machine_function): Add endbr_queued_at_entrance. gcc/testsuite/ Backport from mainline PR target/82699 * gcc.target/i386/pr82699-5.c: Add -fno-pic for ia32. * gcc.target/i386/pr82699-6.c: Add -fno-pic. PR target/82699 * gcc.target/i386/pr82699-1.c: New file. * gcc.target/i386/pr82699-2.c: Likewise. * gcc.target/i386/pr82699-3.c: Likewise. * gcc.target/i386/pr82699-4.c: Likewise. * gcc.target/i386/pr82699-5.c: Likewise. * gcc.target/i386/pr82699-6.c: Likewise. Added: branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-1.c branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-2.c branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-3.c branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-4.c branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-5.c branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr82699-6.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/config/i386/i386.c branches/gcc-8-branch/gcc/config/i386/i386.h branches/gcc-8-branch/gcc/testsuite/ChangeLog