* [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
@ 2017-03-06 14:17 Toma Tabacu
2017-03-08 15:04 ` Rainer Orth
0 siblings, 1 reply; 8+ messages in thread
From: Toma Tabacu @ 2017-03-06 14:17 UTC (permalink / raw)
To: gcc-patches
Cc: Matthew Fortune, catherine_moore,
Rainer Orth (ro@CeBiTec.Uni-Bielefeld.DE)
Hi,
g++.dg/lto/pr69589_0.C is currently failing for mips-mti-elf with the following error:
xg++: error: unrecognized command line option '-rdynamic'
However, it passes just fine for mips-mti-linux-gnu.
I think that we should skip this test for mips-mti-elf.
This patch achieves this by adding support for check_effective_target_rdynamic
and then using it in g++.dg/lto/pr69589_0.C.
This patch also removes the existing dg-skip-if, as it is made redundant by the
effective target check. The latter is also more convenient, as we won't have to
keep tweaking the dg-skip-if for failing targets anymore.
This is similar to my recent check_effective_target_gettimeofday patch,
which was greatly improved by Rainer Orth's review.
Tested with mips-mti-elf and mips-mti-linux-gnu.
Does this look good ?
Regards,
Toma
gcc/
* doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
Document rdynamic.
gcc/testsuite/
* g++.dg/lto/pr69589_0.C: Add dg-require-effective-target for
rdynamic. Remove dg-skip-if for targets which don't support -rdynamic.
* lib/target-supports.exp (check_effective_target_rdynamic):
New proc.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 0dc4348..d75e078 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2065,6 +2065,9 @@ Target supports @option{-mpe-aligned-commons}.
@item pie
Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
+@item rdynamic
+Target supports @option{-rdynamic}.
+
@item section_anchors
Target supports section anchors.
diff --git a/gcc/testsuite/g++.dg/lto/pr69589_0.C b/gcc/testsuite/g++.dg/lto/pr69589_0.C
index 11766f1..599d5d4 100644
--- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
@@ -1,7 +1,7 @@
// { dg-lto-do link }
// { dg-lto-options "-O2 -rdynamic" }
// { dg-extra-ld-options "-r -nostdlib" }
-// { dg-skip-if "Skip targets without -rdynamic support" { arm*-none-eabi aarch64*-*-elf nios2-*-elf } { "*" } { "" } }
+// { dg-require-effective-target rdynamic }
#pragma GCC visibility push(hidden)
struct A { int &operator[] (long); };
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 2766af4..f46f0ba 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1484,6 +1484,16 @@ proc check_effective_target_static_libgfortran { } {
} "-static"]
}
+# Return 1 if we can use the -rdynamic option, 0 otherwise.
+#
+# When the target name changes, replace the cached result.
+
+proc check_effective_target_rdynamic { } {
+ return [check_no_compiler_messages rdynamic executable {
+ int main() { return 0; }
+ } "-rdynamic"]
+}
+
# Return 1 if cilk-plus is supported by the target, 0 otherwise.
proc check_effective_target_cilkplus { } {
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-03-06 14:17 [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C Toma Tabacu
@ 2017-03-08 15:04 ` Rainer Orth
2017-03-09 9:39 ` Matthew Fortune
2017-03-09 15:08 ` Toma Tabacu
0 siblings, 2 replies; 8+ messages in thread
From: Rainer Orth @ 2017-03-08 15:04 UTC (permalink / raw)
To: Toma Tabacu; +Cc: gcc-patches, Matthew Fortune, catherine_moore
Hi Toma,
> g++.dg/lto/pr69589_0.C is currently failing for mips-mti-elf with the following error:
>
> xg++: error: unrecognized command line option '-rdynamic'
>
> However, it passes just fine for mips-mti-linux-gnu.
> I think that we should skip this test for mips-mti-elf.
could it be that mips/sde.h is just missing -rdynamic handling in
LINK_SPEC? At least some bare-metal targets using gld *do* support
-rdynamic (cf. xtensa/elf.h and aarch64/aarch64-elf-raw.h)...
That said, I like the general direction of this patch, even when the new
keyword is only used in one place.
> This patch achieves this by adding support for check_effective_target_rdynamic
> and then using it in g++.dg/lto/pr69589_0.C.
>
> This patch also removes the existing dg-skip-if, as it is made redundant by the
> effective target check. The latter is also more convenient, as we won't have to
> keep tweaking the dg-skip-if for failing targets anymore.
>
> This is similar to my recent check_effective_target_gettimeofday patch,
> which was greatly improved by Rainer Orth's review.
>
> Tested with mips-mti-elf and mips-mti-linux-gnu.
>
> Does this look good ?
[...]
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 2766af4..f46f0ba 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -1484,6 +1484,16 @@ proc check_effective_target_static_libgfortran { } {
> } "-static"]
> }
>
> +# Return 1 if we can use the -rdynamic option, 0 otherwise.
> +#
> +# When the target name changes, replace the cached result.
I think this line isn't necessary. Just keep the first.
Ok for mainline with that fixed.
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-03-08 15:04 ` Rainer Orth
@ 2017-03-09 9:39 ` Matthew Fortune
2017-03-09 15:08 ` Toma Tabacu
1 sibling, 0 replies; 8+ messages in thread
From: Matthew Fortune @ 2017-03-09 9:39 UTC (permalink / raw)
To: Rainer Orth, Toma Tabacu; +Cc: gcc-patches, catherine_moore
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> > g++.dg/lto/pr69589_0.C is currently failing for mips-mti-elf with the
> following error:
> >
> > xg++: error: unrecognized command line option '-rdynamic'
> >
> > However, it passes just fine for mips-mti-linux-gnu.
> > I think that we should skip this test for mips-mti-elf.
>
> could it be that mips/sde.h is just missing -rdynamic handling in
> LINK_SPEC? At least some bare-metal targets using gld *do* support -
> rdynamic (cf. xtensa/elf.h and aarch64/aarch64-elf-raw.h)...
There's probably no harm in adding it in to mips/sde.h it just doesn't
really add much value either. We have some (very subtle) ABI differences
between ELF and Linux targets so I'm not sure it is worth trying to
make sure all options exist/behave the same given such differences.
Matthew
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-03-08 15:04 ` Rainer Orth
2017-03-09 9:39 ` Matthew Fortune
@ 2017-03-09 15:08 ` Toma Tabacu
2017-06-02 14:06 ` Renlin Li
1 sibling, 1 reply; 8+ messages in thread
From: Toma Tabacu @ 2017-03-09 15:08 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches, Matthew Fortune, catherine_moore
>
> Ok for mainline with that fixed.
>
> Thanks.
> Rainer
>
Committed as r246004.
Thanks,
Toma
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-03-09 15:08 ` Toma Tabacu
@ 2017-06-02 14:06 ` Renlin Li
2017-06-05 12:21 ` Toma Tabacu
0 siblings, 1 reply; 8+ messages in thread
From: Renlin Li @ 2017-06-02 14:06 UTC (permalink / raw)
To: Toma Tabacu, Rainer Orth; +Cc: gcc-patches, Matthew Fortune, catherine_moore
Hi Toma,
Thanks for fixing this! Do you have plan to backport the fix to gcc-6 branch?
Regards,
Renlin
On 09/03/17 15:08, Toma Tabacu wrote:
>>
>> Ok for mainline with that fixed.
>>
>> Thanks.
>> Rainer
>>
>
> Committed as r246004.
>
> Thanks,
> Toma
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-06-02 14:06 ` Renlin Li
@ 2017-06-05 12:21 ` Toma Tabacu
2017-06-06 10:02 ` Rainer Orth
0 siblings, 1 reply; 8+ messages in thread
From: Toma Tabacu @ 2017-06-05 12:21 UTC (permalink / raw)
To: Renlin Li, Rainer Orth; +Cc: gcc-patches, Matthew Fortune, catherine_moore
Hi Renlin,
>
> Thanks for fixing this! Do you have plan to backport the fix to gcc-6 branch?
>
I am happy to backport it.
I've rebased the patch on top of the gcc-6 branch and attached it below.
Rainer, is this OK for gcc-6?
Regards,
Toma Tabacu
gcc/ChangeLog:
Backported from mainline
2017-03-09 Toma Tabacu <toma.tabacu@imgtec.com>
* doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
Document rdynamic.
gcc/testsuite/ChangeLog:
Backported from mainline
2017-03-09 Toma Tabacu <toma.tabacu@imgtec.com>
* g++.dg/lto/pr69589_0.C: Add dg-require-effective-target for
rdynamic.
* lib/target-supports.exp (check_effective_target_rdynamic):
New proc.
Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi (revision 248876)
+++ gcc/doc/sourcebuild.texi (working copy)
@@ -1950,6 +1950,9 @@
@item pie
Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
+@item rdynamic
+Target supports @option{-rdynamic}.
+
@item section_anchors
Target supports section anchors.
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp (revision 248876)
+++ gcc/testsuite/lib/target-supports.exp (working copy)
@@ -1424,6 +1424,14 @@
} "-static"]
}
+# Return 1 if we can use the -rdynamic option, 0 otherwise.
+
+proc check_effective_target_rdynamic { } {
+ return [check_no_compiler_messages rdynamic executable {
+ int main() { return 0; }
+ } "-rdynamic"]
+}
+
# Return 1 if cilk-plus is supported by the target, 0 otherwise.
proc check_effective_target_cilkplus { } {
Index: gcc/testsuite/g++.dg/lto/pr69589_0.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr69589_0.C (revision 248876)
+++ gcc/testsuite/g++.dg/lto/pr69589_0.C (working copy)
@@ -1,6 +1,7 @@
// { dg-lto-do link }
// { dg-lto-options "-O2 -rdynamic" }
// { dg-extra-ld-options "-r -nostdlib" }
+// { dg-require-effective-target rdynamic }
#pragma GCC visibility push(hidden)
struct A { int &operator[] (long); };
template <typename> struct B;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-06-05 12:21 ` Toma Tabacu
@ 2017-06-06 10:02 ` Rainer Orth
2017-06-06 11:55 ` Toma Tabacu
0 siblings, 1 reply; 8+ messages in thread
From: Rainer Orth @ 2017-06-06 10:02 UTC (permalink / raw)
To: Toma Tabacu; +Cc: Renlin Li, gcc-patches, Matthew Fortune, catherine_moore
Hi Toma,
>> Thanks for fixing this! Do you have plan to backport the fix to gcc-6 branch?
>
> I am happy to backport it.
> I've rebased the patch on top of the gcc-6 branch and attached it below.
>
> Rainer, is this OK for gcc-6?
sure, thanks.
Rainer
> gcc/ChangeLog:
>
> Backported from mainline
> 2017-03-09 Toma Tabacu <toma.tabacu@imgtec.com>
>
> * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
> Document rdynamic.
>
> gcc/testsuite/ChangeLog:
>
> Backported from mainline
> 2017-03-09 Toma Tabacu <toma.tabacu@imgtec.com>
>
> * g++.dg/lto/pr69589_0.C: Add dg-require-effective-target for
> rdynamic.
> * lib/target-supports.exp (check_effective_target_rdynamic):
> New proc.
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C.
2017-06-06 10:02 ` Rainer Orth
@ 2017-06-06 11:55 ` Toma Tabacu
0 siblings, 0 replies; 8+ messages in thread
From: Toma Tabacu @ 2017-06-06 11:55 UTC (permalink / raw)
To: Rainer Orth; +Cc: Renlin Li, gcc-patches, Matthew Fortune, catherine_moore
Thanks, Rainer.
Committed as r248916.
Thanks for suggesting a backport, Renlin.
Regards,
Toma
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-06-06 11:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 14:17 [PATCH,testsuite] Add check_effective_target_rdynamic and use it in g++.dg/lto/pr69589_0.C Toma Tabacu
2017-03-08 15:04 ` Rainer Orth
2017-03-09 9:39 ` Matthew Fortune
2017-03-09 15:08 ` Toma Tabacu
2017-06-02 14:06 ` Renlin Li
2017-06-05 12:21 ` Toma Tabacu
2017-06-06 10:02 ` Rainer Orth
2017-06-06 11:55 ` Toma Tabacu
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).