diff mbox

RFA: PR 66655: Use COFF/PE weak symbols

Message ID 568BA318.2020100@redhat.com
State New
Headers show

Commit Message

Nick Clifton Jan. 5, 2016, 11:03 a.m. UTC
Hi Jeff,

> You probably know the capabilities of COFF/PE better than I, so the
> patch itself is fine.

Thanks - committed.

> Is there any way that test can be shoved into our dejagnu testing
> harness?  I think we've got support somewhere for tests which require
> multiple input files.

dg-additional-sources is the command that you are thinking about.


The attached patch adds the test derived from the BZ.  There is one 
small problem - I could not find a way to stop the additional source 
file from being compiled as a test on its own.  When I investigated 
however it seems that is a common problem for all tests that use 
additional source files, so I do not think that it is a big issue.

Tested with no regressions on an x86_64-pc-linux-gnu toolchain.

OK to apply ?

Cheers
   Nick

gcc/testsuite/ChangeLog
2016-01-05  Nick Clifton  <nickc@redhat.com>

	PR target/66655
	* g++.dg/pr66655.C: New test.
	* g++.dg/pr66655_1.C: Additional source file for the test.
	* g++.dg/pr66655.h: Header file for the test.

Comments

Jeff Law Jan. 5, 2016, 7:08 p.m. UTC | #1
On 01/05/2016 04:03 AM, Nick Clifton wrote:
> Hi Jeff,
>
>> You probably know the capabilities of COFF/PE better than I, so the
>> patch itself is fine.
>
> Thanks - committed.
>
>> Is there any way that test can be shoved into our dejagnu testing
>> harness?  I think we've got support somewhere for tests which require
>> multiple input files.
>
> dg-additional-sources is the command that you are thinking about.
That's it!

>
>
> The attached patch adds the test derived from the BZ.  There is one
> small problem - I could not find a way to stop the additional source
> file from being compiled as a test on its own.  When I investigated
> however it seems that is a common problem for all tests that use
> additional source files, so I do not think that it is a big issue.
I think for C++ code it's usually worked around by naming the 
additional-source file with ".cc" rather than .C.  Can you give that a 
quick whirl and see if that avoids having the additional file used as a 
a test on its own?

Thanks,
jeff
diff mbox

Patch

--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655.C	2016-01-05 10:42:01.769654305 +0000
@@ -0,0 +1,25 @@ 
+/* { dg-do run } */
+/* { dg-additional-sources "pr66655_1.C" } */
+
+#include "pr66655.h"
+
+extern "C" void abort (void);
+
+#define COOKIE 0xabcd0123
+
+int
+g (void)
+{
+  return COOKIE;
+}
+
+extern int f (void);
+
+int
+main (void)
+{
+  S::set(0);
+  if (f () != COOKIE)
+    abort ();
+  return 0;
+}
--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655_1.C	2016-01-05 10:41:23.266433205 +0000
@@ -0,0 +1,17 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include "pr66655.h"
+
+extern int g (void);
+
+int S::i;
+
+int
+f (void)
+{
+  int ret = g ();
+
+  S::set (ret);
+  return ret;
+}
--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655.h	2016-01-05 10:41:45.629561622 +0000
@@ -0,0 +1,5 @@ 
+struct S
+{
+  static int i;
+  static void set (int ii) { i = -ii; }
+};