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.tab...@imgtec.com> * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): Document rdynamic. gcc/testsuite/ChangeLog: Backported from mainline 2017-03-09 Toma Tabacu <toma.tab...@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;