RFA: Add test for linker support of -shared
Nick Clifton
nickc@redhat.com
Tue Nov 3 15:58:00 GMT 2009
Hi Janis,
I would like to add another new proc to target-supports.exp. This
time it is a check for linker support of the -shared command line
switch. Not all linkers support this switch, since not all
toolchains support shared libraries. (Toolchains for embedded
processors in particular, such as the RX).
The intention is to use this proc as a requirement in tests that
want to use the -shared option, notably the new LTO tests.
Tested with an rx-elf toolchain (fewer gcc testsuite failures) and
an i686-pc-linux-gnu toolchain (no regressions).
OK to apply ?
Cheers
Nick
gcc/testsuite/ChangeLog
2009-11-03 Nick Clifton <nickc@redhat.com>
* lib/target-supports.exp
(check_effective_target_linker_supports_shared): New proc.
* g++.dg/lto/20081120-1_0.C: Require linker support of
-shared.
* g++.dg/lto/20091002-1_0.C: Likewise.
* g++.dg/lto/20081120-2_0.C: Likewise.
* g++.dg/lto/20091002-2_0.C: Likewise.
* g++.dg/lto/20091002-3_0.C: Likewise.
* g++.dg/lto/20081123_0.C: Likewise.
* g++.dg/lto/20090313_0.C: Likewise.
* g++.dg/lto/20081109-1_0.C: Likewise.
* g++.dg/lto/20081219_0.C: Likewise.
* g++.dg/lto/20081204-1_0.C: Likewise.
* g++.dg/lto/20090302_0.C: Likewise.
* g++.dg/lto/20081119-1_0.C: Likewise.
* g++.dg/lto/20081118_0.C: Likewise.
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp (revision 153851)
+++ testsuite/lib/target-supports.exp (working copy)
@@ -669,6 +679,14 @@
return 0
}
+# Returns true if the linker accepts the -shared option.
+proc check_effective_target_linker_supports_shared { } {
+ return [check_no_compiler_messages linker_supports_shared executable {
+ int foo (void) { return 0; }
+ } "-shared" ]
+}
+
+
# Return true if the target supports -mpaired-single (as used on MIPS).
proc check_effective_target_mpaired_single { } {
Index: testsuite/g++.dg/lto/20081120-1_0.C
===================================================================
--- testsuite/g++.dg/lto/20081120-1_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081120-1_0.C (working copy)
@@ -1,5 +1,6 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-flto -shared}} }
extern "C"
{
extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
Index: testsuite/g++.dg/lto/20091002-1_0.C
===================================================================
--- testsuite/g++.dg/lto/20091002-1_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20091002-1_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fPIC -flto}} }
// { dg-extra-ld-options "-fPIC -shared" }
Index: testsuite/g++.dg/lto/20081120-2_0.C
===================================================================
--- testsuite/g++.dg/lto/20081120-2_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081120-2_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-flto -shared}} }
template < typename > struct Foo
{
Index: testsuite/g++.dg/lto/20091002-2_0.C
===================================================================
--- testsuite/g++.dg/lto/20091002-2_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20091002-2_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fPIC}} }
// { dg-extra-ld-options "-fPIC -shared" }
Index: testsuite/g++.dg/lto/20091002-3_0.C
===================================================================
--- testsuite/g++.dg/lto/20091002-3_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20091002-3_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fPIC}} }
// { dg-extra-ld-options "-fPIC -shared" }
Index: testsuite/g++.dg/lto/20081123_0.C
===================================================================
--- testsuite/g++.dg/lto/20081123_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081123_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fwhopr -shared -fPIC}} }
int
Index: testsuite/g++.dg/lto/20090313_0.C
===================================================================
--- testsuite/g++.dg/lto/20090313_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20090313_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fwhopr -fPIC}} }
// { dg-extra-ld-options "-fwhopr -shared" }
Index: testsuite/g++.dg/lto/20081109-1_0.C
===================================================================
--- testsuite/g++.dg/lto/20081109-1_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081109-1_0.C (working copy)
@@ -1,5 +1,6 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fPIC -fwhopr}} }
-// { dg-extra-ld-options "-fPIC -fwhopr -shared -fno-exceptions" }
+// { dg-extra-ld-options "-fPIC -fwhopr shared -fno-exceptions" }
void func(); class Foo { };
void bar() { try { func(); } catch (Foo) { } };
Index: testsuite/g++.dg/lto/20081219_0.C
===================================================================
--- testsuite/g++.dg/lto/20081219_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081219_0.C (working copy)
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target linker_supports_shared }
// { dg-lto-options {{-fPIC -fwhopr -O2}} }
// { dg-extra-ld-options "-O2 -fPIC -fwhopr -shared" }
Index: testsuite/g++.dg/lto/20081204-1_0.C
===================================================================
--- testsuite/g++.dg/lto/20081204-1_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081204-1_0.C (working copy)
@@ -1,4 +1,5 @@
/* { dg-lto-do link } */
+/* { dg-require-effective-target linker_supports_shared } */
/* { dg-lto-options {{-fwhopr -fPIC -shared}} } */
/* Tests for the absence during linking of:
Index: testsuite/g++.dg/lto/20090302_0.C
===================================================================
--- testsuite/g++.dg/lto/20090302_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20090302_0.C (working copy)
@@ -1,4 +1,5 @@
/* { dg-lto-do link } */
+/* { dg-require-effective-target linker_supports_shared } */
/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
struct Foo {
bool Mumble();
Index: testsuite/g++.dg/lto/20081119-1_0.C
===================================================================
--- testsuite/g++.dg/lto/20081119-1_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081119-1_0.C (working copy)
@@ -1,4 +1,5 @@
/* { dg-lto-do link } */
+/* { dg-require-effective-target linker_supports_shared } */
/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
#include "20081119-1.h"
Index: testsuite/g++.dg/lto/20081118_0.C
===================================================================
--- testsuite/g++.dg/lto/20081118_0.C (revision 153851)
+++ testsuite/g++.dg/lto/20081118_0.C (working copy)
@@ -1,4 +1,5 @@
/* { dg-lto-do link } */
+/* { dg-require-effective-target linker_supports_shared } */
/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
/* We used to ICE because of dangling pointers. */
More information about the Gcc-patches
mailing list