https://gcc.gnu.org/g:809c77bd62a46567911a5b1a01570bff949da83b

commit 809c77bd62a46567911a5b1a01570bff949da83b
Author: Alexandre Oliva <[email protected]>
Date:   Tue Mar 10 04:18:50 2026 -0300

    testsuite: shared: check for shared libsupc++ as well
    
    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.
    
    
    for  gcc/testsuite/ChangeLog
    
            * lib/target-supports.exp (check_effective_target_shared):
            When compiling C++, also check libstdc++ symbols.

Diff:
---
 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 cc3f8a74d9b0..e7cdaa1b2fbc 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"]

Reply via email to