]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Fix up pr113617 test for darwin [PR113617]
authorJakub Jelinek <jakub@redhat.com>
Fri, 8 Mar 2024 14:18:56 +0000 (15:18 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 8 Mar 2024 14:18:56 +0000 (15:18 +0100)
The test attempts to link a shared library, and apparently Darwin doesn't
allow by default for shared libraries to contain undefined symbols.

The following patch just adds dummy definitions for the symbols, so that
the library no longer has any undefined symbols at least in my linux
testing.
Furthermore, for target { !shared } targets (like darwin until the it is
fixed in target-supports.exp), because we then link a program rather than
shared library, the patch also adds a dummy main definition so that it
can link.

2024-03-08  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/113617
PR target/114233
* g++.dg/other/pr113617.C: Define -DSHARED when linking with -shared.
* g++.dg/other/pr113617-aux.cc: Add definitions for used methods and
templates not defined elsewhere.

gcc/testsuite/g++.dg/other/pr113617-aux.cc
gcc/testsuite/g++.dg/other/pr113617.C

index e6900e05a5fc83651d62dec9aed6290c64c2c005..0576cee34bd682b108c7c257f6f71b9b195ca1e4 100644 (file)
@@ -7,3 +7,42 @@ void qux() {
   A<long long> a;
   a.foo(0, 0);
 }
+
+namespace R {
+template<>
+Y<N1::N2::N3::X<0> >::AI
+Y<N1::N2::N3::X<0> >::operator->()
+{
+  return AI();
+}
+template<>
+Y<N1::N2::N3::X<1> >::AI
+Y<N1::N2::N3::X<1> >::operator->()
+{
+  return AI();
+}
+}
+
+N1::N2::N3::AB ab;
+
+N1::N2::N3::AB &
+N1::N2::N3::AB::bleh()
+{
+  return ab;
+}
+
+N1::N2::N3::AC::AC(int)
+{
+}
+
+void
+N1::N2::N3::AC::m1(R::S<void()>)
+{
+}
+
+#ifndef SHARED
+int
+main()
+{
+}
+#endif
index a02dda1420d334ace34321183dd402622ff4ed68..0ee62c134e669fe107db711f7cc8c72ba61e44ad 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-do link { target c++11 } }
 // { dg-options "-O2" }
 // { dg-additional-options "-fPIC" { target fpic } } */
-// { dg-additional-options "-shared" { target shared } } */
+// { dg-additional-options "-shared -DSHARED" { target shared } } */
 // { dg-additional-sources pr113617-aux.cc }
 
 #include "pr113617.h"