diff options
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r-- | gcc/testsuite/lib/gcc-dg.exp | 17 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 24 |
2 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index ee1d4d8..7fd52a9 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -267,6 +267,23 @@ proc dg-require-weak { args } { } } +# If this target does not support the "visibility" attribute, skip this +# test. + +proc dg-require-visibility { args } { + upvar dg-do-what dg-do-what + upvar name name + + set visibility_available [ check_visibility_available ] + if { $visibility_available == -1 } { + unresolved "$name" + } + if { $visibility_available != 1 } { + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } +} + # If this target does not support the "alias" attribute, skip this # test. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 38d416c..e9a57a1 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -63,6 +63,30 @@ proc check_weak_available { } { } ############################### +# proc check_visibility_available { } +############################### + +# The visibility attribute is only support in some object formats +# This proc returns 1 if it is supported, 0 if not, -1 if unsure. + +proc check_visibility_available { } { + global target_triplet + global target_cpu + + # ELF supports it if the system has recent GNU ld and gas. + # As a start we return 1 for all ELF systems; we'll let people + # add exceptions as necessary. + + set objformat [gcc_target_object_format] + + switch $objformat { + elf { return 1 } + unknown { return -1 } + default { return 0 } + } +} + +############################### # proc check_alias_available { } ############################### |