diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-03-08 15:18:56 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-03-08 15:18:56 +0100 |
commit | 8263a4b6505f84973c2ed2fb8d4f2036ca335ff3 (patch) | |
tree | dcae119264b0d185bf38cf67aaf5333757e163c6 | |
parent | 018ddc86b928514d7dfee024dcdeb204d5dcdd61 (diff) | |
download | gcc-8263a4b6505f84973c2ed2fb8d4f2036ca335ff3.zip gcc-8263a4b6505f84973c2ed2fb8d4f2036ca335ff3.tar.gz gcc-8263a4b6505f84973c2ed2fb8d4f2036ca335ff3.tar.bz2 |
testsuite: Fix up pr113617 test for darwin [PR113617]
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.
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr113617-aux.cc | 39 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr113617.C | 2 |
2 files changed, 40 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/other/pr113617-aux.cc b/gcc/testsuite/g++.dg/other/pr113617-aux.cc index e6900e0..0576cee 100644 --- a/gcc/testsuite/g++.dg/other/pr113617-aux.cc +++ b/gcc/testsuite/g++.dg/other/pr113617-aux.cc @@ -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 diff --git a/gcc/testsuite/g++.dg/other/pr113617.C b/gcc/testsuite/g++.dg/other/pr113617.C index a02dda1..0ee62c1 100644 --- a/gcc/testsuite/g++.dg/other/pr113617.C +++ b/gcc/testsuite/g++.dg/other/pr113617.C @@ -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" |