darwin, x86 - disable '-mfentry' for the port.

This can't work without special support because placing
the call directly after the function label breaks the
ABI requirement that call sites are 16byte aligned.

gcc/

2019-05-23  Iain Sandoe  <iain@sandoe.co.uk>

       * config/i386/darwin.h: Reject -mfentry*.
       * doc/sourcebuild.texi: Document mfentry target support.

gcc/testsuite/

2019-05-23  Iain Sandoe  <iain@sandoe.co.uk>

       * lib/target-supports.exp (check_effective_target_mfentry): New.
       * gcc.target/i386/fentry-override.c: Require effective target mfentry.
       * gcc/testsuite/gcc.target/i386/fentry.c: Likewise
       * gcc.target/i386/fentryname1.c: Likewise
       * gcc.target/i386/fentryname2.c: Likewise
       * gcc.target/i386/fentryname3.c: Likewise
       * gcc.target/i386/nop-mcount.c: Likewise
       * gcc.target/i386/pr82699-2.c: Likewise
       * gcc.target/i386/pr82699-4.c: Likewise
       * gcc.target/i386/pr82699-5.c: Likewise
       * gcc.target/i386/pr82699-6.c: Likewise
       * gcc.target/i386/returninst1.c: Likewise
       * gcc.target/i386/returninst2.c: Likewise
       * gcc.target/i386/returninst3.c : Likewise

From-SVN: r271580
This commit is contained in:
Iain Sandoe 2019-05-23 20:51:04 +00:00 committed by Iain Sandoe
parent 99f8432359
commit aa992ce717
18 changed files with 52 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2019-05-23 Iain Sandoe <iain@sandoe.co.uk>
* config/i386/darwin.h: Reject -mfentry*.
* doc/sourcebuild.texi: Document mfentry target support.
2019-05-23 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000.c (rs6000_global_entry_point_needed_p):

View file

@ -132,7 +132,8 @@ extern int darwin_emit_branch_islands;
#define CC1_SPEC "%(cc1_cpu) \
%{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
%{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
%{mx32:%eDarwin is not an mx32 platform}" \
%{mx32:%eDarwin is not an mx32 platform} \
%{mfentry*:%eDarwin does not support -mfentry or associated options}" \
DARWIN_CC1_SPEC
#undef ASM_SPEC

View file

@ -2382,6 +2382,10 @@ Target supports compiling @code{aes} instructions.
@item fma4
Target supports compiling @code{fma4} instructions.
@item mfentry
Target supports the @code{-mfentry} option that alters the
position of profiling calls such that they precede the prologue.
@item ms_hook_prologue
Target supports attribute @code{ms_hook_prologue}.

View file

@ -1,3 +1,20 @@
2019-05-23 Iain Sandoe <iain@sandoe.co.uk>
* lib/target-supports.exp (check_effective_target_mfentry): New.
* gcc.target/i386/fentry-override.c: Require effective target mfentry.
* gcc/testsuite/gcc.target/i386/fentry.c: Likewise
* gcc.target/i386/fentryname1.c: Likewise
* gcc.target/i386/fentryname2.c: Likewise
* gcc.target/i386/fentryname3.c: Likewise
* gcc.target/i386/nop-mcount.c: Likewise
* gcc.target/i386/pr82699-2.c: Likewise
* gcc.target/i386/pr82699-4.c: Likewise
* gcc.target/i386/pr82699-5.c: Likewise
* gcc.target/i386/pr82699-6.c: Likewise
* gcc.target/i386/returninst1.c: Likewise
* gcc.target/i386/returninst2.c: Likewise
* gcc.target/i386/returninst3.c : Likewise
2019-05-23 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.target/powerpc/localentry-1.c: New file.

View file

@ -1,5 +1,6 @@
/* Test -mfentry override */
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-mfentry" } */
/* { dg-final { scan-assembler-not "__fentry__" } } */
/* Origin: Andi Kleen */

View file

@ -1,5 +1,6 @@
/* Test -mfentry */
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-fprofile -mfentry" } */
/* { dg-final { scan-assembler "__fentry__" } } */
/* Origin: Andi Kleen */

View file

@ -1,4 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -mfentry-name=foo" } */
/* { dg-final { scan-assembler "call.*foo" } } */
/* { dg-final { scan-assembler "call.*bar" } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -mrecord-mcount -mfentry-section=foo" } */
/* { dg-final { scan-assembler "section.*foo" } } */
/* { dg-final { scan-assembler "section.*bar" } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry" } */
/* { dg-final { scan-assembler "section.*__entry_loc" } } */
/* { dg-final { scan-assembler "0x0f, 0x1f, 0x44, 0x00, 0x00" } } */

View file

@ -1,5 +1,6 @@
/* Test -mnop-mcount */
/* { dg-do compile { target { *-*-linux* && nonpic } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -mrecord-mcount -mnop-mcount" } */
/* { dg-final { scan-assembler-not "__fentry__" } } */
/* Origin: Andi Kleen */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-O2 -fno-pic -fcf-protection -pg -mfentry -fasynchronous-unwind-tables" } */
/* { dg-final { scan-assembler-times {\t\.cfi_startproc\n\tendbr} 1 } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-O2 -fpic -fcf-protection -pg -mfentry -fasynchronous-unwind-tables" } */
/* { dg-final { scan-assembler-times {\t\.cfi_startproc\n\tendbr} 1 } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-O2 -fcf-protection -mfentry -fasynchronous-unwind-tables" } */
/* { dg-additional-options "-fno-pic" { target ia32 } } */
/* { dg-final { scan-assembler-times {\t\.cfi_startproc\n\tendbr} 1 } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-fno-pic -O2 -fcf-protection -pg -mfentry -mrecord-mcount -mnop-mcount -fasynchronous-unwind-tables" } */
/* { dg-final { scan-assembler-times {\t\.cfi_startproc\n\tendbr} 1 } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -minstrument-return=call -mrecord-return" } */
/* { dg-final { scan-assembler "call.*__return__" } } */
/* { dg-final { scan-assembler "section.*return_loc" } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -minstrument-return=nop5 -mrecord-return" } */
/* { dg-final { scan-assembler-times "0x0f, 0x1f, 0x44, 0x00, 0x00" 3 } } */
/* { dg-final { scan-assembler "section.*return_loc" } } */

View file

@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
/* { dg-options "-pg -mfentry -minstrument-return=call" } */
/* { dg-final { scan-assembler-not "call.*__return__" } } */

View file

@ -9359,3 +9359,14 @@ proc check_effective_target_llvm_binutils { } {
expr { [istarget amdgcn*-*-*]
|| [check_effective_target_offload_gcn] }}]
}
# Return 1 if the compiler supports '-mfentry'.
proc check_effective_target_mfentry { } {
if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
return 0
}
return [check_no_compiler_messages mfentry object {
void foo (void) { }
} "-mfentry"]
}