[testsuite] Require effective target weak_undefined for visibility-22.c

Message ID dbc6cd45-9318-4048-45f7-b469ebbef8b7@mentor.com
State New
Headers show
Series
  • [testsuite] Require effective target weak_undefined for visibility-22.c
Related show

Commit Message

Tom de Vries Dec. 14, 2017, 1:40 p.m.
Hi,

this patch introduces an effective target weak_undefined, and uses it in 
test-case visibility-22.c.

I've tested this on trunk for x86_64, and the test still runs and passes.

I've tested this on an internal branch for the gcn target, where it 
makes the test unsupported (instead of timing out due to random code 
execution).

OK for trunk?

Thanks,
- Tom

Comments

Jakub Jelinek Dec. 14, 2017, 1:47 p.m. | #1
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?

	Jakub
Tom de Vries Dec. 14, 2017, 2:09 p.m. | #2
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.

Thanks,
- Tom
Jakub Jelinek Dec. 14, 2017, 2:14 p.m. | #3
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.

	Jakub
Rainer Orth Dec. 14, 2017, 2:16 p.m. | #4
Hi Tom,

> this patch introduces an effective target weak_undefined, and uses it in

> test-case visibility-22.c.

>

> I've tested this on trunk for x86_64, and the test still runs and passes.

>

> I've tested this on an internal branch for the gcn target, where it makes

> the test unsupported (instead of timing out due to random code execution).

>

> OK for trunk?


I like the idea, thanks for doing this.

> Require effective target weak_undefined for visibility-22.c

>

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

>

> 	* lib/target-supports.exp (check_effective_target_weak_undefined): New

> 	proc.

> 	* gcc.dg/visibility-22.c: Require effective target weak_undefined.


Ok with documentation added to sourcebuild.texi and the dg-skip-if
removed.  If need be, the proc can still be refined.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
Rainer Orth Dec. 14, 2017, 2:18 p.m. | #5
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.
Otherwise those (probably unnecessary) special cases tend to stay
around forever ;-)

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
Tom de Vries Dec. 14, 2017, 3:09 p.m. | #6
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  <tom@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 { }
 ###############################

Patch

Require effective target weak_undefined for visibility-22.c

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

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

---
 gcc/testsuite/gcc.dg/visibility-22.c  | 1 +
 gcc/testsuite/lib/target-supports.exp | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/visibility-22.c b/gcc/testsuite/gcc.dg/visibility-22.c
index 52f59be..49a95ce 100644
--- 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
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 9750b7a..227d8f6 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 { }
 ###############################