On Fri, Sep 12, 2014 at 4:32 PM, Andi Kleen <a...@firstfloor.org> wrote: > From: Andi Kleen <a...@linux.intel.com> > > Test fentry and no_instrument_function overriding. > > No test cases for the LTO test for now, as the LTO > harness doesn't seem to support different flags for the final > link.
Sure it does - via dg-extra-ld-options (you have to negate compile-time opts to "remove" them). Are you sure the tests are target independent enough? That is, 'mcount' is really 'mcount' on all targets? Ok. Thanks, Richard. > gcc/testsuite/: > > 2014-09-11 Andi Kleen <a...@linux.intel.com> > > * gcc.dg/pg-override.c: New test. > * gcc.dg/pg.c: New test. > * gcc.target/i386/fentry-override.c: New test. > * gcc.target/i386/fentry.c: New test. > --- > gcc/testsuite/gcc.dg/pg-override.c | 18 ++++++++++++++++++ > gcc/testsuite/gcc.dg/pg.c | 18 ++++++++++++++++++ > gcc/testsuite/gcc.target/i386/fentry-override.c | 18 ++++++++++++++++++ > gcc/testsuite/gcc.target/i386/fentry.c | 18 ++++++++++++++++++ > 4 files changed, 72 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/pg-override.c > create mode 100644 gcc/testsuite/gcc.dg/pg.c > create mode 100644 gcc/testsuite/gcc.target/i386/fentry-override.c > create mode 100644 gcc/testsuite/gcc.target/i386/fentry.c > > diff --git a/gcc/testsuite/gcc.dg/pg-override.c > b/gcc/testsuite/gcc.dg/pg-override.c > new file mode 100644 > index 0000000..7cd6680 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pg-override.c > @@ -0,0 +1,18 @@ > +/* Test -fprofile override */ > +/* { dg-do compile } */ > +/* { dg-options "-fprofile" } */ > +/* { dg-final { scan-assembler-not "mcount" } } */ > +/* Origin: Andi Kleen */ > +extern void foobar(const char *); > + > +__attribute__((no_instrument_function)) void func(void) > +{ > + foobar ("Hello world\n"); > +} > + > +__attribute__((no_instrument_function)) void func2(void) > +{ > + int i; > + for (i = 0; i < 10; i++) > + foobar ("Hello world"); > +} > diff --git a/gcc/testsuite/gcc.dg/pg.c b/gcc/testsuite/gcc.dg/pg.c > new file mode 100644 > index 0000000..7cd6680 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pg.c > @@ -0,0 +1,18 @@ > +/* Test -fprofile override */ > +/* { dg-do compile } */ > +/* { dg-options "-fprofile" } */ > +/* { dg-final { scan-assembler-not "mcount" } } */ > +/* Origin: Andi Kleen */ > +extern void foobar(const char *); > + > +__attribute__((no_instrument_function)) void func(void) > +{ > + foobar ("Hello world\n"); > +} > + > +__attribute__((no_instrument_function)) void func2(void) > +{ > + int i; > + for (i = 0; i < 10; i++) > + foobar ("Hello world"); > +} > diff --git a/gcc/testsuite/gcc.target/i386/fentry-override.c > b/gcc/testsuite/gcc.target/i386/fentry-override.c > new file mode 100644 > index 0000000..3771f19 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/fentry-override.c > @@ -0,0 +1,18 @@ > +/* Test -mfentry override */ > +/* { dg-do compile } */ > +/* { dg-options "-mfentry" } */ > +/* { dg-final { scan-assembler-not "__fentry__" } } */ > +/* Origin: Andi Kleen */ > +extern void foobar(const char *); > + > +void __attribute__((no_instrument_function)) func(void) > +{ > + foobar ("Hello world\n"); > +} > + > +void __attribute__((no_instrument_function)) func2(void) > +{ > + int i; > + for (i = 0; i < 10; i++) > + foobar ("Hello world"); > +} > diff --git a/gcc/testsuite/gcc.target/i386/fentry.c > b/gcc/testsuite/gcc.target/i386/fentry.c > new file mode 100644 > index 0000000..bd3db13 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/fentry.c > @@ -0,0 +1,18 @@ > +/* Test -mfentry */ > +/* { dg-do compile } */ > +/* { dg-options "-fprofile -mfentry" } */ > +/* { dg-final { scan-assembler "__fentry__" } } */ > +/* Origin: Andi Kleen */ > +extern void foobar(const char *); > + > +void func(void) > +{ > + foobar ("Hello world\n"); > +} > + > +void func2(void) > +{ > + int i; > + for (i = 0; i < 10; i++) > + foobar ("Hello world"); > +} > -- > 2.1.0 >