diff mbox series

[testsuite] : Fix g++.dg/torture/pr86763.C link failure for glibc < 2.17

Message ID CAFULd4ZQA56M5Z5Q+M3BemY4cC2X7X3yp3V6=OBkOHmLRz8zaQ@mail.gmail.com
State New
Headers show
Series [testsuite] : Fix g++.dg/torture/pr86763.C link failure for glibc < 2.17 | expand

Commit Message

Uros Bizjak Aug. 6, 2018, 3:10 p.m. UTC
2018-08-06  Uros Bizjak  <ubizjak@gmail.com>

    * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt.

Tested on CentOS 5.10 and Fedora 28.

OK for mainline?

Uros.

Comments

Jeff Law Aug. 6, 2018, 3:23 p.m. UTC | #1
On 08/06/2018 09:10 AM, Uros Bizjak wrote:
> 2018-08-06  Uros Bizjak  <ubizjak@gmail.com>
> 
>     * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt.
> 
> Tested on CentOS 5.10 and Fedora 28.
> 
> OK for mainline?
But what about systems without librt?  I'm thinking primarily of the
embedded *-elf targets.

Jeff
Uros Bizjak Aug. 6, 2018, 3:33 p.m. UTC | #2
On Mon, Aug 6, 2018 at 5:23 PM, Jeff Law <law@redhat.com> wrote:
> On 08/06/2018 09:10 AM, Uros Bizjak wrote:
>> 2018-08-06  Uros Bizjak  <ubizjak@gmail.com>
>>
>>     * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt.
>>
>> Tested on CentOS 5.10 and Fedora 28.
>>
>> OK for mainline?
> But what about systems without librt?  I'm thinking primarily of the
> embedded *-elf targets.

Perhaps the following patch is better:

--cut here--
Index: g++.dg/torture/pr86763.C
===================================================================
--- g++.dg/torture/pr86763.C    (revision 263317)
+++ g++.dg/torture/pr86763.C    (working copy)
@@ -1,5 +1,6 @@
 // { dg-do run }
 // { dg-additional-options "-fschedule-insns2 -fstrict-aliasing" }
+// { dg-additional-options "-lrt" { target *-*-linux-gnu } }

 #include <cstdint>
 #include <cassert>
--cut here--

Uros.
Jeff Law Aug. 6, 2018, 3:44 p.m. UTC | #3
On 08/06/2018 09:33 AM, Uros Bizjak wrote:
> On Mon, Aug 6, 2018 at 5:23 PM, Jeff Law <law@redhat.com> wrote:
>> On 08/06/2018 09:10 AM, Uros Bizjak wrote:
>>> 2018-08-06  Uros Bizjak  <ubizjak@gmail.com>
>>>
>>>     * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt.
>>>
>>> Tested on CentOS 5.10 and Fedora 28.
>>>
>>> OK for mainline?
>> But what about systems without librt?  I'm thinking primarily of the
>> embedded *-elf targets.
> 
> Perhaps the following patch is better:
> 
> --cut here--
> Index: g++.dg/torture/pr86763.C
> ===================================================================
> --- g++.dg/torture/pr86763.C    (revision 263317)
> +++ g++.dg/torture/pr86763.C    (working copy)
> @@ -1,5 +1,6 @@
>  // { dg-do run }
>  // { dg-additional-options "-fschedule-insns2 -fstrict-aliasing" }
> +// { dg-additional-options "-lrt" { target *-*-linux-gnu } }
That's be fine with me.

If someone wants the test to be run on solaris or some other target with
librt, they can extend the selector to include the proper target/versions.

Jeff
Uros Bizjak Aug. 6, 2018, 3:46 p.m. UTC | #4
On Mon, Aug 6, 2018 at 5:44 PM, Jeff Law <law@redhat.com> wrote:
> On 08/06/2018 09:33 AM, Uros Bizjak wrote:
>> On Mon, Aug 6, 2018 at 5:23 PM, Jeff Law <law@redhat.com> wrote:
>>> On 08/06/2018 09:10 AM, Uros Bizjak wrote:
>>>> 2018-08-06  Uros Bizjak  <ubizjak@gmail.com>
>>>>
>>>>     * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt.
>>>>
>>>> Tested on CentOS 5.10 and Fedora 28.
>>>>
>>>> OK for mainline?
>>> But what about systems without librt?  I'm thinking primarily of the
>>> embedded *-elf targets.
>>
>> Perhaps the following patch is better:
>>
>> --cut here--
>> Index: g++.dg/torture/pr86763.C
>> ===================================================================
>> --- g++.dg/torture/pr86763.C    (revision 263317)
>> +++ g++.dg/torture/pr86763.C    (working copy)
>> @@ -1,5 +1,6 @@
>>  // { dg-do run }
>>  // { dg-additional-options "-fschedule-insns2 -fstrict-aliasing" }
>> +// { dg-additional-options "-lrt" { target *-*-linux-gnu } }
> That's be fine with me.
>
> If someone wants the test to be run on solaris or some other target with
> librt, they can extend the selector to include the proper target/versions.

Thanks, I'll commit the patch to mainline with updated ChangeLog entry:

2018-08-06  Uros Bizjak  <ubizjak@gmail.com>

    * g++.dg/torture/pr86763.C (dg-additional-options): Add -lrt
    for target *-*-linux-gnu.

Uros.
Andreas Schwab Aug. 6, 2018, 3:54 p.m. UTC | #5
How about replacing clock_gettime with something else?  It's not needed
for the particular test.

Andreas.
Rainer Orth Aug. 7, 2018, 7:55 p.m. UTC | #6
Hi Andreas,

> How about replacing clock_gettime with something else?  It's not needed
> for the particular test.

that would certainly be useful: Solaris 10 also needs librt or
clock_gettime, while Solaris 11 has folded it into libc.

	Rainer
diff mbox series

Patch

Index: g++.dg/torture/pr86763.C
===================================================================
--- g++.dg/torture/pr86763.C	(revision 263317)
+++ g++.dg/torture/pr86763.C	(working copy)
@@ -1,5 +1,5 @@ 
 // { dg-do run }
-// { dg-additional-options "-fschedule-insns2 -fstrict-aliasing" }
+// { dg-additional-options "-fschedule-insns2 -fstrict-aliasing -lrt" }
 
 #include <cstdint>
 #include <cassert>