On 12/14/2017 03:18 PM, Rainer Orth wrote:
Hi Jakub,

On Thu, Dec 14, 2017 at 03:09:02PM +0100, Tom de Vries wrote:
On 12/14/2017 02:47 PM, Jakub Jelinek wrote:
On Thu, Dec 14, 2017 at 02:40:12PM +0100, Tom de Vries wrote:
--- a/gcc/testsuite/gcc.dg/visibility-22.c
+++ b/gcc/testsuite/gcc.dg/visibility-22.c
@@ -1,6 +1,7 @@
   /* PR target/32219 */
   /* { dg-do run } */
   /* { dg-require-visibility "" } */
+/* { dg-require-effective-target weak_undefined } */
   /* { dg-options "-O2 -fPIC" { target fpic } } */
   /* This test requires support for undefined weak symbols.  This support
      is not available on hppa*-*-hpux*.  The test is skipped rather than
Shouldn't then the:
/* This test requires support for undefined weak symbols.  This support
     is not available on hppa*-*-hpux*.  The test is skipped rather than
     xfailed to suppress the warning that would otherwise arise.  */
/* { dg-skip-if "" { "hppa*-*-hpux*" "*-*-aix*" "*-*-darwin*" } }  */
stuff be dropped too?
I don't know whether the new effective target test will fail for each of
these 3 targets. But the warning mentioned for hppa*-*-hpux* will make the
effective target test fail, so I think that one can be removed.
Or you can remove all 3, and if unsure, just add those to the weak_undefined
effective target (return 0 for them).  And ask target maintainers to verify
and perhaps remove.
I'd do it the other way round: remove dg-skip-if completely and ping the
target maintainers to check (and eventually improve) the proc.

Hi,

I've committed patch below which removes this dg-skip-if from visibility-22.c and replaces it with a test for a new effective target weak_undefined:
...
/* { dg-skip-if "" { "hppa*-*-hpux*" "*-*-aix*" "*-*-darwin*" } }  */
...

Could you please verify that the test for effective target weak_undefined indeed fails for these targets?

Thanks,
- Tom
Require effective target weak_undefined for visibility-22.c

2017-12-14  Tom de Vries  <t...@codesourcery.com>

	* lib/target-supports.exp (check_effective_target_weak_undefined): New
	proc.
	* gcc.dg/visibility-22.c: Require effective target weak_undefined.

	* doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
	Add item for weak_undefined.

---
 gcc/doc/sourcebuild.texi              | 3 +++
 gcc/testsuite/gcc.dg/visibility-22.c  | 5 +----
 gcc/testsuite/lib/target-supports.exp | 9 +++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 60b6b77..04e18df 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2238,6 +2238,9 @@ Target supports @code{wchar_t} that is compatible with @code{char32_t}.
 @item comdat_group
 Target uses comdat groups.
 
+@item weak_undefined
+Target supports weak undefined symbols.
+
 @item word_mode_no_slow_unalign
 Target does not have slow unaligned access when doing word size accesses.
 @end table
diff --git a/gcc/testsuite/gcc.dg/visibility-22.c b/gcc/testsuite/gcc.dg/visibility-22.c
index 5e8cdad..e2b78d1 100644
--- a/gcc/testsuite/gcc.dg/visibility-22.c
+++ b/gcc/testsuite/gcc.dg/visibility-22.c
@@ -1,11 +1,8 @@
 /* PR target/32219 */
 /* { dg-do run } */
 /* { dg-require-visibility "" } */
+/* { dg-require-effective-target weak_undefined } */
 /* { dg-options "-O2 -fPIC" { target fpic } } */
-/* This test requires support for undefined weak symbols.  This support
-   is not available on hppa*-*-hpux*.  The test is skipped rather than
-   xfailed to suppress the warning that would otherwise arise.  */
-/* { dg-skip-if "" { "hppa*-*-hpux*" "*-*-aix*" "*-*-darwin*" } }  */
 
 extern void foo () __attribute__((weak,visibility("hidden")));
 int
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff8c805..114c1f1 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -328,6 +328,15 @@ proc check_weak_available { } {
     }
 }
 
+# return 1 if weak undefined symbols are supported.
+
+proc check_effective_target_weak_undefined { } {
+    return [check_runtime weak_undefined {
+	extern void foo () __attribute__((weak));
+	int main (void) { if (foo) return 1; return 0; }
+    } ""]
+}
+
 ###############################
 # proc check_weak_override_available { }
 ###############################

Reply via email to