[committed,amdgcn] Disable trampolines on GCN5

Message ID 2ea43f87-baae-ad5f-2f78-ef990de50ccd@codesourcery.com
State New
Headers show
Series
  • [committed,amdgcn] Disable trampolines on GCN5
Related show

Commit Message

Andrew Stubbs May 22, 2019, 10:21 p.m.
Trampolines work just fine on GCN3 devices, but GCN5 devices have 
execute permission hardware, and the driver sets permission off for the 
private segment allocation in which the stacks are located.

It may be possible to implement indirect calls to nested functions 
another way, but for now this will prevent unexplained crashes or hangs 
on unsupported devices.

-- 
Andrew Stubbs
Mentor Graphics / CodeSourcery

Comments

Andrew Stubbs June 28, 2019, 4:38 p.m. | #1
On 22/05/2019 23:21, Andrew Stubbs wrote:
> Trampolines work just fine on GCN3 devices, but GCN5 devices have 

> execute permission hardware, and the driver sets permission off for the 

> private segment allocation in which the stacks are located.

> 

> It may be possible to implement indirect calls to nested functions 

> another way, but for now this will prevent unexplained crashes or hangs 

> on unsupported devices.


This is now backported to gcc-9-branch.

Andrew

Patch

Fix trampoline execution failures on GCN5.

2019-05-22  Andrew Stubbs  <ams@codesourcery.com>

	gcc/
	* config/gcn/gcn.c (gcn_trampoline_init): Call "sorry" on GCN5.

diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index 1dd2ff2d4f0..6820837c763 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -3062,6 +3062,10 @@  gcn_asm_trampoline_template (FILE *f)
 static void
 gcn_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 {
+  if (TARGET_GCN5_PLUS)
+    sorry ("nested function trampolines not supported on GCN5 due to"
+           " non-executable stacks");
+
   emit_block_move (m_tramp, assemble_trampoline_template (),
 		   GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);