diff options
-rw-r--r-- | gcc/config/i386/i386.cc | 52 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-1.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-10.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-11.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-12.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-2.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-3.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-4.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-5.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-6.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-7.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-8.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr120936-9.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr93492-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr93492-5.c | 2 |
15 files changed, 261 insertions, 23 deletions
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 24aedc1..b64175d 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -23686,19 +23686,21 @@ x86_field_alignment (tree type, int computed) /* Print call to TARGET to FILE. */ static void -x86_print_call_or_nop (FILE *file, const char *target) +x86_print_call_or_nop (FILE *file, const char *target, + const char *label) { if (flag_nop_mcount || !strcmp (target, "nop")) /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */ - fprintf (file, "1:" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n"); + fprintf (file, "%s" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n", + label); else if (!TARGET_PECOFF && flag_pic) { gcc_assert (flag_plt); - fprintf (file, "1:\tcall\t%s@PLT\n", target); + fprintf (file, "%s\tcall\t%s@PLT\n", label, target); } else - fprintf (file, "1:\tcall\t%s\n", target); + fprintf (file, "%s\tcall\t%s\n", label, target); } static bool @@ -23783,6 +23785,13 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) const char *mcount_name = MCOUNT_NAME; + bool fentry_section_p + = (flag_record_mcount + || lookup_attribute ("fentry_section", + DECL_ATTRIBUTES (current_function_decl))); + + const char *label = fentry_section_p ? "1:" : ""; + if (current_fentry_name (&mcount_name)) ; else if (fentry_name) @@ -23818,11 +23827,12 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) reg = legacy_reg; } if (ASSEMBLER_DIALECT == ASM_INTEL) - fprintf (file, "1:\tmovabs\t%s, OFFSET FLAT:%s\n" - "\tcall\t%s\n", reg, mcount_name, reg); + fprintf (file, "%s\tmovabs\t%s, OFFSET FLAT:%s\n" + "\tcall\t%s\n", label, reg, mcount_name, + reg); else - fprintf (file, "1:\tmovabsq\t$%s, %%%s\n\tcall\t*%%%s\n", - mcount_name, reg, reg); + fprintf (file, "%s\tmovabsq\t$%s, %%%s\n\tcall\t*%%%s\n", + label, mcount_name, reg, reg); break; case CM_LARGE_PIC: #ifdef NO_PROFILE_COUNTERS @@ -23863,21 +23873,21 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) if (!flag_plt) { if (ASSEMBLER_DIALECT == ASM_INTEL) - fprintf (file, "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]\n", - mcount_name); + fprintf (file, "%s\tcall\t[QWORD PTR %s@GOTPCREL[rip]]\n", + label, mcount_name); else - fprintf (file, "1:\tcall\t*%s@GOTPCREL(%%rip)\n", - mcount_name); + fprintf (file, "%s\tcall\t*%s@GOTPCREL(%%rip)\n", + label, mcount_name); break; } /* fall through */ default: - x86_print_call_or_nop (file, mcount_name); + x86_print_call_or_nop (file, mcount_name, label); break; } } else - x86_print_call_or_nop (file, mcount_name); + x86_print_call_or_nop (file, mcount_name, label); } else if (flag_pic) { @@ -23892,11 +23902,13 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) LPREFIX, labelno); #endif if (flag_plt) - x86_print_call_or_nop (file, mcount_name); + x86_print_call_or_nop (file, mcount_name, label); else if (ASSEMBLER_DIALECT == ASM_INTEL) - fprintf (file, "1:\tcall\t[DWORD PTR %s@GOT[ebx]]\n", mcount_name); + fprintf (file, "%s\tcall\t[DWORD PTR %s@GOT[ebx]]\n", + label, mcount_name); else - fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name); + fprintf (file, "%s\tcall\t*%s@GOT(%%ebx)\n", + label, mcount_name); } else { @@ -23909,12 +23921,10 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) fprintf (file, "\tmovl\t$%sP%d, %%" PROFILE_COUNT_REGISTER "\n", LPREFIX, labelno); #endif - x86_print_call_or_nop (file, mcount_name); + x86_print_call_or_nop (file, mcount_name, label); } - if (flag_record_mcount - || lookup_attribute ("fentry_section", - DECL_ATTRIBUTES (current_function_decl))) + if (fentry_section_p) { const char *sname = "__mcount_loc"; diff --git a/gcc/testsuite/gcc.target/i386/pr120936-1.c b/gcc/testsuite/gcc.target/i386/pr120936-1.c new file mode 100644 index 0000000..a20680d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -pg -mno-fentry -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +** call mcount +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-10.c b/gcc/testsuite/gcc.target/i386/pr120936-10.c new file mode 100644 index 0000000..ab95b08 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-10.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { fpic && lp64 } } } */ +/* { dg-options "-O2 -mcmodel=large -pg -mno-fentry -fpic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: movabsq \$_GLOBAL_OFFSET_TABLE_-1b, %r11 +** leaq 1b\(%rip\), %r10 +** addq %r11, %r10 +** movabsq \$mcount@PLTOFF, %r11 +** addq %r11, %r10 +** call \*%r10 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-11.c b/gcc/testsuite/gcc.target/i386/pr120936-11.c new file mode 100644 index 0000000..3e39dfe --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-11.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { fpic && lp64 } } } */ +/* { dg-options "-O2 -mrecord-mcount -mcmodel=large -pg -mno-fentry -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: movabsq \$mcount, %r10 +** call \*%r10 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-12.c b/gcc/testsuite/gcc.target/i386/pr120936-12.c new file mode 100644 index 0000000..b5a2aac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-12.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { fpic && lp64 } } } */ +/* { dg-options "-O2 -mcmodel=large -mrecord-mcount -pg -mno-fentry -fpic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: movabsq \$_GLOBAL_OFFSET_TABLE_-1b, %r11 +** leaq 1b\(%rip\), %r10 +** addq %r11, %r10 +** movabsq \$mcount@PLTOFF, %r11 +** addq %r11, %r10 +** call \*%r10 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-2.c b/gcc/testsuite/gcc.target/i386/pr120936-2.c new file mode 100644 index 0000000..0835658 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -pg -mno-fentry -fpic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +** call mcount@PLT +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-3.c b/gcc/testsuite/gcc.target/i386/pr120936-3.c new file mode 100644 index 0000000..dc0a8f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -mnop-mcount -pg -mno-fentry -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +** .byte 0x0f, 0x1f, 0x44, 0x00, 0x00 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-4.c b/gcc/testsuite/gcc.target/i386/pr120936-4.c new file mode 100644 index 0000000..2420f0b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -pg -mno-fentry -mrecord-mcount -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: call mcount +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-5.c b/gcc/testsuite/gcc.target/i386/pr120936-5.c new file mode 100644 index 0000000..20ecd37 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-5.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -pg -mrecord-mcount -mno-fentry -fpic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: call mcount@PLT +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-6.c b/gcc/testsuite/gcc.target/i386/pr120936-6.c new file mode 100644 index 0000000..6e2290f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-6.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -mrecord-mcount -mnop-mcount -pg -mno-fentry -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: .byte 0x0f, 0x1f, 0x44, 0x00, 0x00 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-7.c b/gcc/testsuite/gcc.target/i386/pr120936-7.c new file mode 100644 index 0000000..0c86467 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-7.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-options "-O2 -pg -mno-fentry -fpic -fno-plt -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +** call \*mcount@GOTPCREL\(%rip\) +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-8.c b/gcc/testsuite/gcc.target/i386/pr120936-8.c new file mode 100644 index 0000000..3f86781 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-8.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-options "-O2 -pg -mrecord-mcount -mno-fentry -fpic -fno-plt -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^(1|\t?\.)} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +**1: call \*mcount@GOTPCREL\(%rip\) +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr120936-9.c b/gcc/testsuite/gcc.target/i386/pr120936-9.c new file mode 100644 index 0000000..3f4b387 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr120936-9.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { fpic && lp64 } } } */ +/* { dg-options "-O2 -mcmodel=large -pg -mno-fentry -fno-pic -fno-shrink-wrap" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* +**foo: +**.LFB[0-9]+: +**... +** .cfi_.* +** movabsq \$mcount, %r10 +** call \*%r10 +**... +*/ + +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/pr93492-3.c b/gcc/testsuite/gcc.target/i386/pr93492-3.c index b68da30..cdca595 100644 --- a/gcc/testsuite/gcc.target/i386/pr93492-3.c +++ b/gcc/testsuite/gcc.target/i386/pr93492-3.c @@ -10,4 +10,4 @@ f10_endbr (void) { } -/* { dg-final { scan-assembler "\t\.cfi_startproc\n\tendbr(32|64)\n.*\.LPFE0:\n\tnop\n1:\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */ +/* { dg-final { scan-assembler "\t\.cfi_startproc\n\tendbr(32|64)\n.*\.LPFE0:\n\tnop\n\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr93492-5.c b/gcc/testsuite/gcc.target/i386/pr93492-5.c index ee9849a..cc71f67 100644 --- a/gcc/testsuite/gcc.target/i386/pr93492-5.c +++ b/gcc/testsuite/gcc.target/i386/pr93492-5.c @@ -9,4 +9,4 @@ foo (void) { } -/* { dg-final { scan-assembler "\t\.cfi_startproc\n.*\.LPFE0:\n\tnop\n1:\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */ +/* { dg-final { scan-assembler "\t\.cfi_startproc\n.*\.LPFE0:\n\tnop\n\tcall\t\[^\n\]*__fentry__\[^\n\]*\n\tret\n" } } */ |