On 11/08/14 18:34, Mike Stump wrote:
On Aug 11, 2014, at 2:06 AM, Richard Earnshaw <rearn...@arm.com> wrote:
Not quite, read the subject line again.
Doh.  I did miss that entirely.  The solutions I gave were for other cases than 
the case at hand.

I'm not sure what the correct change to the testsuite is here.
The below is close, let me refine it a little.

Perhaps the best solution would be something like marking the test as
"large" in some way and for "large" tests the linker would handle
"relocation truncated to fit" errors from the linker through some target
hook that had a better understanding of whether size related options
were being used and could decide between error and unsupported.
How about a target tiny in supports.exp and any target that is tiny, we handle 
overflows in relocs as always unsupported.  Works for all tiny targets, and 
uniformly works for all languages and all test cases of all time.  Doesn’t 
depend upon guessing a size (how many bytes is tiny, is it code or data, and 
exactly how many bytes were generated on the target for the test case) nor 
guessing which test case are large.  If you test the entire test suite with the 
tiny flag or if that flag is the default, then supports will say that the 
target is tiny.  If you don’t give that flag and it isn’t the default, that 
same target is large.  A person that only has tiny, can just say I’m tiny, and 
be forever done with it.  An advanced ports with relaxation can then remove the 
I’m tiny, and then test relaxation.

I think that offers little code to do this (5-10 lines), handles most 
situations nicely, retains as much testing as possible generally speaking.

If one wants to handle mcmodel options on test cases seamlessly, one can use 
check-flags I think as well, see check_effective_target_arm_fp16_ok_nocache for 
example.

Something like:

  proc ${tool}_check_unsupported_p { output } {
     if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
   return "memory full”
+    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output] && 
[check_effective_target_tiny] } {
   return "memory full”
      }

proc check_effective_target_tiny { } {
     if { [istarget blabla-*-*]
         return 1
     }
     return 0
}

if the choice is static for the target.  Slightly more complex is check-flags 
is used. I’ll leave that as an exercise for the reader.  :-)


So how about this?

We add a check_effective_target_tiny (and define it for aarch64) and when find a "relocation truncated" message we say it's unsupported only when check_effective_target_tiny holds.

Kyrill


2014-08-19  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    * lib/gcc-defs.exp (${tool}_check_unsupported_p):
    Return memory full when we have a tiny target and relocation
    truncation occurs.
    * lib/gcc-dg.exp (gcc-dg-prune): Likewise.
    * lib/objc.exp (${tool}_check_unsupported_p): Likewise.
    * lib/target-supports.exp (check_effective_target_tiny): New function.

diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 69a5971..1ea7028 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -157,6 +157,11 @@ proc ${tool}_check_unsupported_p { output } {
     if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
 	return "memory full"
     }
+    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output]
+          && [check_effective_target_tiny] } {
+        return "memory full"
+     }
+
     if { [istarget spu-*-*] && \
 	     [string match "*exceeds local store*" $output] } {
 	return "memory full"
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 3390caa..dfdb257 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -233,6 +233,11 @@ proc gcc-dg-prune { system text } {
 	return "::unsupported::memory full"
     }
 
+    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $text]
+          && [check_effective_target_tiny] } {
+        return "::unsupported::memory full"
+    }
+
     # Likewise, if we see ".text exceeds local store range" or
     # similar.
     if {[string match "spu-*" $system] && \
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index 5ecefa9..e19b264 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -357,6 +357,10 @@ proc ${tool}_check_unsupported_p { output } {
     if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
 	return "memory full"
     }
+    if { [regexp "(^|\n)\[^\n\]*: relocation truncated to fit" $output]
+          && [check_effective_target_tiny] } {
+        return "memory full"
+    }
     return ""
 }
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c03370d..9eed181 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5950,6 +5950,14 @@ proc check_effective_target_fenv_exceptions {} {
     } [add_options_for_ieee "-std=gnu99"]]
 }
 
+proc check_effective_target_tiny {} {
+    if { [istarget aarch64*-*-*]
+         && [check_effective_target_aarch64_tiny] } {
+        return 1
+    }
+    return 0
+}
+
 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
 
 proc check_effective_target_logical_op_short_circuit {} {

Reply via email to