public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite] Require effective target weak_undefined for visibility-22.c
@ 2017-12-14 13:40 Tom de Vries
  2017-12-14 13:47 ` Jakub Jelinek
  2017-12-14 14:16 ` Rainer Orth
  0 siblings, 2 replies; 7+ messages in thread
From: Tom de Vries @ 2017-12-14 13:40 UTC (permalink / raw)
  To: GCC Patches, Mike Stump, Rainer Orth

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

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

[-- Attachment #2: 0001-Require-effective-target-weak_undefined-for-visibility-22.c.patch --]
[-- Type: text/x-patch, Size: 1588 bytes --]

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 { }
 ###############################

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 13:40 [testsuite] Require effective target weak_undefined for visibility-22.c Tom de Vries
@ 2017-12-14 13:47 ` Jakub Jelinek
  2017-12-14 14:09   ` Tom de Vries
  2017-12-14 14:16 ` Rainer Orth
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2017-12-14 13:47 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches, Mike Stump, Rainer Orth

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 13:47 ` Jakub Jelinek
@ 2017-12-14 14:09   ` Tom de Vries
  2017-12-14 14:14     ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Tom de Vries @ 2017-12-14 14:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches, Mike Stump, Rainer Orth

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 14:09   ` Tom de Vries
@ 2017-12-14 14:14     ` Jakub Jelinek
  2017-12-14 14:18       ` Rainer Orth
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2017-12-14 14:14 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches, Mike Stump, Rainer Orth

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 13:40 [testsuite] Require effective target weak_undefined for visibility-22.c Tom de Vries
  2017-12-14 13:47 ` Jakub Jelinek
@ 2017-12-14 14:16 ` Rainer Orth
  1 sibling, 0 replies; 7+ messages in thread
From: Rainer Orth @ 2017-12-14 14:16 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches, Mike Stump

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 14:14     ` Jakub Jelinek
@ 2017-12-14 14:18       ` Rainer Orth
  2017-12-14 15:10         ` Tom de Vries
  0 siblings, 1 reply; 7+ messages in thread
From: Rainer Orth @ 2017-12-14 14:18 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Tom de Vries, GCC Patches, Mike Stump

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [testsuite] Require effective target weak_undefined for visibility-22.c
  2017-12-14 14:18       ` Rainer Orth
@ 2017-12-14 15:10         ` Tom de Vries
  0 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2017-12-14 15:10 UTC (permalink / raw)
  To: David Edelsohn, Mike Stump, John David Anglin
  Cc: Rainer Orth, Jakub Jelinek, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]

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

[-- Attachment #2: 0001-Require-effective-target-weak_undefined-for-visibility-22.c.patch --]
[-- Type: text/x-patch, Size: 2455 bytes --]

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 { }
 ###############################

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-14 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 13:40 [testsuite] Require effective target weak_undefined for visibility-22.c Tom de Vries
2017-12-14 13:47 ` Jakub Jelinek
2017-12-14 14:09   ` Tom de Vries
2017-12-14 14:14     ` Jakub Jelinek
2017-12-14 14:18       ` Rainer Orth
2017-12-14 15:10         ` Tom de Vries
2017-12-14 14:16 ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).