This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to check_visibility_available
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 18 Nov 2004 22:11:15 +0000 (UTC)
- Subject: Patch to check_visibility_available
This testsuite patch cleans up check_visibility_available in the
testsuite, by making it test the compiler rather than guessing based
on object format.
No testsuite regressions with this patch on i386-pc-solaris2.10. OK
to commit?
2004-11-18 Mark Mitchell <mark@codesourcery.com>
* lib/target-supports.exp (check_visibility_available): Really
test the compiler.
diff -rupN -x CVS gcc-merge-HEAD-csl-sol210-1/gcc/testsuite/lib/target-supports.exp gcc-sol210/gcc/testsuite/lib/target-supports.exp
--- gcc-merge-HEAD-csl-sol210-1/gcc/testsuite/lib/target-supports.exp 2004-09-03 11:09:34.000000000 -0700
+++ gcc-sol210/gcc/testsuite/lib/target-supports.exp 2004-09-27 08:45:15.000000000 -0700
@@ -97,30 +97,32 @@
###############################
# The visibility attribute is only support in some object formats
-# This proc returns 1 if it is supported, 0 if not, -1 if unsure.
+# This proc returns 1 if it is supported, 0 if not.
proc check_visibility_available { } {
+ global visibility_available_saved
+ global tool
global target_triplet
- global target_cpu
# On NetWare, support makes no sense.
-
if { [string match "*-*-netware*" $target_triplet] } {
return 0
}
- # 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 }
- mach-o { return 1 }
- unknown { return -1 }
- default { return 0 }
+ if {![info exists visibility_available_saved] } {
+ set f [open "tmp.c" "w"]
+ puts $f {void f() __attribute__((visibility("hidden")));}
+ puts $f "void f() {}"
+ close $f
+ set lines [${tool}_target_compile "tmp.c" "tmp.o" object ""]
+ file delete "tmp.c"
+ if [string match "" $lines] then {
+ set visibility_available_saved 1
+ } else {
+ set visibility_available_saved 0
+ }
}
+ return $visibility_available_saved
}
###############################
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)