driver: Forward '-lstdc++' to offloading compilation [PR101544]
..., so that users don't manually need to specify '-foffload-options=-lstdc++'
in addition to '-lstdc++' (specified manually, or implicitly by the driver).
Do like commit 4bcb46b3ad
"driver: Forward '-lgfortran', '-lm' to offloading compilation".
PR driver/101544
gcc/
* gcc.cc (driver_handle_option): Forward host '-lstdc++' to
offloading compilation.
* config/gcn/mkoffload.cc (main): Adjust.
* config/nvptx/mkoffload.cc (main): Likewise.
libgomp/
* testsuite/libgomp.c++/pr101544-1-O0.C: Remove
'-foffload-options=-lstdc++'.
* testsuite/libgomp.c++/pr101544-1.C: Likewise.
* testsuite/libgomp.oacc-c++/pr101544-1.C: Likewise.
This commit is contained in:
parent
bf1aca4a2a
commit
3b36e96b57
6 changed files with 6 additions and 6 deletions
|
@ -1070,7 +1070,8 @@ main (int argc, char **argv)
|
|||
#undef STR
|
||||
/* Translate host into offloading libraries. */
|
||||
else if (strcmp (argv[i], "-l_GCC_gfortran") == 0
|
||||
|| strcmp (argv[i], "-l_GCC_m") == 0)
|
||||
|| strcmp (argv[i], "-l_GCC_m") == 0
|
||||
|| strcmp (argv[i], "-l_GCC_stdc++") == 0)
|
||||
{
|
||||
/* Elide '_GCC_'. */
|
||||
size_t i_dst = strlen ("-l");
|
||||
|
|
|
@ -741,7 +741,8 @@ main (int argc, char **argv)
|
|||
dumppfx = argv[++i];
|
||||
/* Translate host into offloading libraries. */
|
||||
else if (strcmp (argv[i], "-l_GCC_gfortran") == 0
|
||||
|| strcmp (argv[i], "-l_GCC_m") == 0)
|
||||
|| strcmp (argv[i], "-l_GCC_m") == 0
|
||||
|| strcmp (argv[i], "-l_GCC_stdc++") == 0)
|
||||
{
|
||||
/* Elide '_GCC_'. */
|
||||
size_t i_dst = strlen ("-l");
|
||||
|
|
|
@ -4154,7 +4154,8 @@ forward_offload_option (size_t opt_index, const char *arg, bool validated)
|
|||
are injected by default in offloading compilation, and therefore not
|
||||
forwarded here. */
|
||||
/* GCC libraries. */
|
||||
if (/* '-lgfortran' */ strcmp (arg, "gfortran") == 0 )
|
||||
if (/* '-lgfortran' */ strcmp (arg, "gfortran") == 0
|
||||
|| /* '-lstdc++' */ strcmp (arg, "stdc++") == 0)
|
||||
save_switch (concat ("-foffload-options=-l_GCC_", arg, NULL),
|
||||
0, NULL, validated, true);
|
||||
/* Other libraries. */
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// { dg-additional-options -foffload-options=-lstdc++ }
|
||||
// { dg-additional-options -O0 }
|
||||
|
||||
#include "pr101544-1.C"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// { dg-additional-options -foffload-options=-lstdc++ }
|
||||
// See also '../libgomp.oacc-c++/pr101544-1.C'.
|
||||
#ifndef ALWAYS_INLINE
|
||||
# define ALWAYS_INLINE
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// { dg-additional-options -foffload-options=-lstdc++ }
|
||||
// { dg-additional-options -fno-inline } for stable results regarding OpenACC 'routine'.
|
||||
// But actually, as none of the '#pragma acc routine' syntax is accepted, force inlining:
|
||||
#define ALWAYS_INLINE __attribute__((always_inline))
|
||||
|
|
Loading…
Add table
Reference in a new issue