..., 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
4bcb46b3ade1796c5a57b294f5cca25f00671cac
"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.
#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");
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");
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. */
-// { dg-additional-options -foffload-options=-lstdc++ }
// { dg-additional-options -O0 }
#include "pr101544-1.C"
-// { dg-additional-options -foffload-options=-lstdc++ }
// See also '../libgomp.oacc-c++/pr101544-1.C'.
#ifndef ALWAYS_INLINE
# define ALWAYS_INLINE
-// { 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))