From 23a75657ad37b290eb7df6ce34de22b1c614f5d6 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 18 Jun 2004 15:41:47 +0000 Subject: [PATCH] * ld-elfvsb/main.c: Ensure visibility_def and visibility_func are actually referenced (gcc 3.4 eliminates comparisons of addresses of global symbols with NULL). * ld-selective/selective.exp: Suppress -fvtable-gc tests for gcc 3.4.0 and above, as this option and its functionality is no longer supported, making these tests fail). --- ld/testsuite/ChangeLog | 9 +++++++ ld/testsuite/ld-elfvsb/main.c | 36 ++++++++++++------------- ld/testsuite/ld-selective/selective.exp | 8 ++++++ 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index aeebbd81a7d..468549250fb 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2004-06-18 Jan Beulich + + * ld-elfvsb/main.c: Ensure visibility_def and visibility_func are + actually referenced (gcc 3.4 eliminates comparisons of addresses + of global symbols with NULL). + * ld-selective/selective.exp: Suppress -fvtable-gc tests for gcc + 3.4.0 and above, as this option and its functionality is no longer + supported, making these tests fail). + 2004-05-18 Nick Clifton * ld-elf/frame.s: Replace @ with % so that the file can be diff --git a/ld/testsuite/ld-elfvsb/main.c b/ld/testsuite/ld-elfvsb/main.c index f071260d47a..b498d43459e 100644 --- a/ld/testsuite/ld-elfvsb/main.c +++ b/ld/testsuite/ld-elfvsb/main.c @@ -74,13 +74,13 @@ extern int visibility_var; #if !defined (HIDDEN_TEST) && defined (PROTECTED_TEST) int -visibility () +visibility (void) { return 1; } static int -main_visibility_check () +main_visibility_check (void) { return ((int (*) (void)) visibility_funptr ()) != visibility; } @@ -88,7 +88,7 @@ main_visibility_check () int visibility_var = 1; static int -main_visibility_checkvar () +main_visibility_checkvar (void) { return visibility_varval () != visibility_var && visibility_varptr () != &visibility_var; @@ -99,7 +99,7 @@ int shared_data = 1; asm (".protected shared_data"); int -shared_func () +shared_func (void) { return 1; } @@ -112,7 +112,7 @@ extern func shared_func_p (); #endif #else static int -main_visibility_check () +main_visibility_check (void) { #ifdef WEAK_TEST return visibility_funptr () == NULL; @@ -122,7 +122,7 @@ main_visibility_check () } static int -main_visibility_checkvar () +main_visibility_checkvar (void) { #ifdef WEAK_TEST return visibility_varval () == 0 @@ -137,7 +137,7 @@ main_visibility_checkvar () /* This function is called by the shared library. */ int -main_called () +main_called (void) { return 6; } @@ -145,7 +145,7 @@ main_called () /* This function overrides a function in the shared library. */ int -shlib_overriddencall2 () +shlib_overriddencall2 (void) { return 8; } @@ -155,19 +155,19 @@ int visibility_com; asm (".hidden visibility_com"); int -main_visibility_checkcom () +main_visibility_checkcom (void) { return visibility_com == 0; } int -main_visibility_checkweak () +main_visibility_checkweak (void) { return 1; } #elif defined (HIDDEN_WEAK_TEST) int -main_visibility_checkcom () +main_visibility_checkcom (void) { return 1; } @@ -203,32 +203,32 @@ extern int visibility_func (); asm (".hidden visibility_func"); int -main_visibility_checkcom () +main_visibility_checkcom (void) { - return &visibility_def != NULL; + return & visibility_def != NULL && visibility_def == 2; } int -main_visibility_checkweak () +main_visibility_checkweak (void) { - return &visibility_func != NULL; + return & visibility_func != NULL && visibility_func () == 2; } #else int -main_visibility_checkcom () +main_visibility_checkcom (void) { return 1; } int -main_visibility_checkweak () +main_visibility_checkweak (void) { return 1; } #endif int -main () +main (void) { int (*p) (); int ret = 0; diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index ba1ebd9150a..6672911cac8 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -89,6 +89,14 @@ foreach testitem $seltests { # It's either C or C++ at the moment. if { $testtype == "C++" } { set testflags "$cflags $cxxflags" + if [string match "*gcc*" [lindex $CC 0]] { + # Starting with 3.4.0, -fvtable-gc is no longer supported and thus + # the functionality we try to test for cannot be expected to work. + catch "exec -- $CC -dumpversion" version + if [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+|\[4-9\]))\\." $version] { + setup_xfail {*-*-*} + } + } } { set testflags "$cflags" } -- 2.30.2