diff options
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r-- | gcc/testsuite/objc.dg/image-info.m | 1 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/lto/lto.exp | 84 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/lto/trivial-1_0.m | 37 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/symtab-1.m | 7 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/torture/tls/thr-init-2.m | 1 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/torture/tls/thr-init-3.m | 1 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/torture/tls/thr-init.m | 1 |
7 files changed, 129 insertions, 3 deletions
diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 0a740fa31f1..e9e9de68906 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -4,6 +4,7 @@ /* Contributed by Ziemowit Laski <zlaski@apple.com>. */ /* { dg-do compile { target { *-*-darwin* } } } */ +/* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-freplace-objc-classes" } */ #include "../objc-obj-c++-shared/Object1.h" diff --git a/gcc/testsuite/objc.dg/lto/lto.exp b/gcc/testsuite/objc.dg/lto/lto.exp new file mode 100644 index 00000000000..4ea89cced6c --- /dev/null +++ b/gcc/testsuite/objc.dg/lto/lto.exp @@ -0,0 +1,84 @@ +# Copyright (C) 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. +# +# Based on gcc/testsuite/gcc.dg/lto/lto.exp. + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib objc-dg.exp + +# Load the language-independent compabibility support procedures. +load_lib lto.exp + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +global LTO_OPTIONS + +set LTO_OPTIONS [list \ + {-O0 -fwhopr -fgnu-runtime} \ + {-O2 -fwhopr -fgnu-runtime} \ + {-O0 -flto -fgnu-runtime} \ + {-O2 -flto -fgnu-runtime} \ +] + +objc_init +lto_init no-mathlib + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "objc_lto" +set tests [lsort [glob -nocomplain $srcdir/$subdir/*_0.m]] + +# Main loop. +foreach src $tests { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + lto-execute $src $sid +} + +# darwin targets can also run code with the NeXT runtime. +if [istarget "*-*-darwin*" ] { +set LTO_OPTIONS [list \ + {-O0 -fwhopr -fnext-runtime} \ + {-O2 -fwhopr -fnext-runtime} \ + {-O0 -flto -fnext-runtime} \ + {-O2 -flto -fnext-runtime} \ +] + foreach src $tests { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + lto-execute $src $sid + } +} + +lto_finish diff --git a/gcc/testsuite/objc.dg/lto/trivial-1_0.m b/gcc/testsuite/objc.dg/lto/trivial-1_0.m new file mode 100644 index 00000000000..076f2306c1b --- /dev/null +++ b/gcc/testsuite/objc.dg/lto/trivial-1_0.m @@ -0,0 +1,37 @@ +/* { dg-lto-do run } */ +/* { dg-skip-if "" { "*-*-darwin*" && lp64 } { "*" } { "" } } */ +extern int printf (char *,...) ; + +typedef struct objc_class *Class; + +struct objc_class { + Class isa; + /* other stuff... */ +} ; + +@interface myRootObject { +@public + Class isa; +} ++initialize; ++(Class)class; + +@end + +@implementation myRootObject ++initialize { + return self; +} + ++(Class)class { + return (Class)self; +} + +@end + +int main(void) +{ + [myRootObject class]; + printf("trivial OK\n"); + return 0; +} diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index 90a79691721..100b245325e 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -22,6 +22,7 @@ -(void)checkValues { } @end -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.word\t2\n\t.word\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { i?86-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { powerpc-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.quad\t0\n\t.long\t0\n\t.space 4\n\t.word\t2\n\t.word\t0\n\t.space 4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.word\t2\n\t.word\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { *86*-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.long\t0\n\t.long\t0\n\t.short\t2\n\t.short\t0\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" { target { powerpc*-*-darwin* && { ! lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.quad\t0\n\t.quad\t0\n\t.word\t2\n\t.word\t0\n\t.space 4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" { target { *86*-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:\n\t.quad\t0\n\t.quad\t0\n\t.short\t2\n\t.short\t0\n\t.space 4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" { target { powerpc*-*-darwin* && { lp64 } } } } } */ diff --git a/gcc/testsuite/objc.dg/torture/tls/thr-init-2.m b/gcc/testsuite/objc.dg/torture/tls/thr-init-2.m index b637e2544e6..9a946bb444d 100644 --- a/gcc/testsuite/objc.dg/torture/tls/thr-init-2.m +++ b/gcc/testsuite/objc.dg/torture/tls/thr-init-2.m @@ -1,5 +1,6 @@ // { dg-do run } // { dg-require-effective-target tls } +// { dg-add-options tls } /* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */ extern void _exit(int); diff --git a/gcc/testsuite/objc.dg/torture/tls/thr-init-3.m b/gcc/testsuite/objc.dg/torture/tls/thr-init-3.m index f30315d8819..6ac977c9bae 100644 --- a/gcc/testsuite/objc.dg/torture/tls/thr-init-3.m +++ b/gcc/testsuite/objc.dg/torture/tls/thr-init-3.m @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target tls } */ +/* { dg-add-options tls } */ /* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */ diff --git a/gcc/testsuite/objc.dg/torture/tls/thr-init.m b/gcc/testsuite/objc.dg/torture/tls/thr-init.m index 6c3bad1b9bb..286a4706f06 100644 --- a/gcc/testsuite/objc.dg/torture/tls/thr-init.m +++ b/gcc/testsuite/objc.dg/torture/tls/thr-init.m @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target tls } */ +/* { dg-add-options tls } */ /* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */ extern void _exit(int); |