Message ID | 19648239-C129-4EAB-A749-840E6225351E@sandoe-acoustics.co.uk |
---|---|
State | New |
Headers | show |
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.
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 ();