[5/8] bpf: make target-supports.exp aware of eBPF
diff mbox series

Message ID 20190814213651.20286-6-jose.marchesi@oracle.com
State New
Headers show
Series
  • eBPF support for GCC
Related show

Commit Message

Jose E. Marchesi Aug. 14, 2019, 9:36 p.m. UTC
This patch makes the several effective target checks in
target-supports.exp to be aware of eBPF targets.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_malloc): New
	function.
	(check_effective_target_trampolines): Adapt to eBPF.
	(check_effective_target_stack_size): Likewise.
	(dg-effective-target-value): Likewise.
	(check_effective_target_indirect_jumps): Likewise.
	(check_effective_target_nonlocal_goto): Likewise.
	(check_effective_target_global_constructor): Likewise.
	(check_effective_target_return_address): Likewise.
---
 gcc/testsuite/ChangeLog               | 11 +++++++++++
 gcc/testsuite/lib/target-supports.exp | 27 +++++++++++++++++++--------
 2 files changed, 30 insertions(+), 8 deletions(-)

Patch
diff mbox series

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index a33822f7631..85e31b74113 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -514,7 +514,8 @@  proc check_effective_target_trampolines { } {
 	 || [istarget nvptx-*-*]
 	 || [istarget hppa2.0w-hp-hpux11.23]
 	 || [istarget hppa64-hp-hpux11.23]
-	 || [istarget pru-*-*] } {
+	 || [istarget pru-*-*]
+         || [istarget bpf-*-*] } {
 	return 0;
     }
     return 1
@@ -526,6 +527,9 @@  proc check_effective_target_stack_size { } {
     if [target_info exists gcc,stack_size] {
 	return 1
     }
+    if [istarget bpf-*-*] {
+	return 1
+    }
     return 0
 }
 
@@ -534,7 +538,11 @@  proc check_effective_target_stack_size { } {
 proc dg-effective-target-value { effective_target } {
     if { "$effective_target" == "stack_size" } {
 	if [check_effective_target_stack_size] {
-	    return [target_info gcc,stack_size]
+	    if [istarget bpf-*-*] {
+		return "512"
+	    } else {
+		return [target_info gcc,stack_size]
+	    }
 	}
     }
 
@@ -769,7 +777,7 @@  proc add_options_for_tls { flags } {
 # Return 1 if indirect jumps are supported, 0 otherwise.
 
 proc check_effective_target_indirect_jumps {} {
-    if { [istarget nvptx-*-*] } {
+    if { [istarget nvptx-*-*] || [istarget bpf-*-*] } {
 	return 0
     }
     return 1
@@ -778,7 +786,7 @@  proc check_effective_target_indirect_jumps {} {
 # Return 1 if nonlocal goto is supported, 0 otherwise.
 
 proc check_effective_target_nonlocal_goto {} {
-    if { [istarget nvptx-*-*] } {
+    if { [istarget nvptx-*-*] || [istarget bpf-*-*] } {
 	return 0
     }
     return 1
@@ -787,10 +795,9 @@  proc check_effective_target_nonlocal_goto {} {
 # Return 1 if global constructors are supported, 0 otherwise.
 
 proc check_effective_target_global_constructor {} {
-    if { [istarget nvptx-*-*] } {
-	return 0
-    }
-    if { [istarget amdgcn-*-*] } {
+    if { [istarget nvptx-*-*]
+	 || [istarget amdgcn-*-*]
+	 || [istarget bpf-*-*] } {
 	return 0
     }
     return 1
@@ -813,6 +820,10 @@  proc check_effective_target_return_address {} {
     if { [istarget nvptx-*-*] } {
 	return 0
     }
+    # No notion of return address in eBPF.
+    if { [istarget bpf-*-*] } {
+	return 0
+    }
     # It could be supported on amdgcn, but isn't yet.
     if { [istarget amdgcn*-*-*] } {
 	return 0