When checking for -shared support for C++ tests, also bring symbols
from libstdc++, to make sure they can be brought into shared
libraries. Otherwise, pr114790_[01].C will fail when the dejagnu test
run arranges to link -lsupc++ explicitly, even if the test uses
-nostdlib.
Regstrapped on x86_64-linux-gnu, regstrapping on powerpc64le-linux-gnu,
also tested with gcc-15 targeting powerpc-elf. Ok to install?
for gcc/testsuite/ChangeLog
* lib/target-supports.exp (check_effective_target_shared):
When compiling C++, also check libstdc++ symbols.
---
gcc/testsuite/lib/target-supports.exp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index cc3f8a74d9b05..e7cdaa1b2fbcf 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1534,11 +1534,16 @@ proc check_effective_target_shared { } {
# requires GOT references, and with a libc symbol that would
# bring in significant parts of a static-only libc. Absent a
# shared libc, this would make -shared tests fail, so we don't
- # want to enable the shared effective target then.
+ # want to enable the shared effective target then. When
+ # compiling c++, also bring in symbols from libsupc++.
return [check_no_compiler_messages shared executable {
#include <stdlib.h>
extern int foo (void); extern int bar;
char *baz (void) {
+ #if __cplusplus
+ extern char *p;
+ delete p;
+ #endif
return foo () + (char*) malloc (bar);
}
} "-shared -fpic $extra_flags"]
--
Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/
Free Software Activist FSFLA co-founder GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!