diff mbox

Remove WORD_SWITCH_TAKES_ARG (Darwin testers useful)

Message ID 19648239-C129-4EAB-A749-840E6225351E@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Nov. 6, 2010, 11:39 a.m. UTC
On 5 Nov 2010, at 15:24, IainS wrote:

>
> On 5 Nov 2010, at 15:10, Mike Stump wrote:
>
>> On Nov 5, 2010, at 7:24 AM, IainS wrote:
>>> Additionally, I made a trivial example using the "-sectcreate"  
>>> option - which produced the expected output.
>>
>> Using gcc -v -segaddr bla on the gcc line is the other test to  
>> try...  If ld gets a -segaddr bla option, its fine.
>
> Yep, that one works too.
> I guess we could construct some kind of darwin-specific test but it  
> would really require inspecting the output of otool  - since we need  
> post-linker output to check.
> (and there's no mechanism in the  test-suite to do that AFAIK).


The testsuite has a nop test already that checks the command line  
doesn't fail

----

But, it is possible to do at least a rudimentary functionality test  
for segaddr.

(It would be possible to do something similar with sectcreate -  
however, dg-additional-files doesn't seem to work for the non-remote  
case.)

Should we apply something like this as a backstop?
Iain

+  return 0;
+}

Comments

Mike Stump Nov. 8, 2010, 10:04 p.m. UTC | #1
On Nov 6, 2010, at 4:39 AM, IainS wrote:
> But, it is possible to do at least a rudimentary functionality test for segaddr.
> 
> (It would be possible to do something similar with sectcreate - however, dg-additional-files doesn't seem to work for the non-remote case.)
> 
> Should we apply something like this as a backstop?

Well, if you're going to write a testcase, it's hard to say no...

Ok.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/darwin-segaddr.c
===================================================================
--- gcc/testsuite/gcc.dg/darwin-segaddr.c	(revision 0)
+++ gcc/testsuite/gcc.dg/darwin-segaddr.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* Check that -segaddr gets through and works.  */
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-options "-O0 -segaddr __TEST 0x200000" { target { *-*-darwin*  
&& { ! lp64 } } } } */
+/* { dg-options "-O0 -segaddr __TEST 0x110000000" { target { *-*- 
darwin* && lp64 } } } */
+
+extern void abort ();
+
+int t __attribute__((section("__TEST,__test")));
+
+int main (void)
+{
+#ifdef __LP64__
+  if ((unsigned long long) &t != 0x110000000ULL)
+#else
+  if ((unsigned long) &t != 0x200000UL)
+#endif
+    abort ();