From 930ee1165d793b5bcfa7284f3b4b69d10f267287 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 8 Apr 2015 13:45:20 +0000 Subject: [PATCH] ipa-comdats.c (propagate_comdat_group): Walk through thunks. gcc/ * ipa-comdats.c (propagate_comdat_group): Walk through thunks. gcc/testsuite/ * gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New. From-SVN: r221919 --- gcc/ChangeLog | 4 ++++ gcc/ipa-comdats.c | 10 ++++---- gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/i386/mpx/chkp-thunk-comdat-3.c | 23 +++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a06ed80e5af..08d4342e428 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-04-08 Ilya Enkovich + + * ipa-comdats.c (propagate_comdat_group): Walk through thunks. + 2015-04-08 Gerald Pfeifer * doc/install.texi (bootstrap-lto-noplugin): Rewrite. diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c index e24359cff19..3e6fc1d030e 100644 --- a/gcc/ipa-comdats.c +++ b/gcc/ipa-comdats.c @@ -142,12 +142,14 @@ propagate_comdat_group (struct symtab_node *symbol, { struct symtab_node *symbol2 = edge->caller; - /* If we see inline clone, its comdat group actually - corresponds to the comdat group of the function it is inlined - to. */ - if (cgraph_node * cn = dyn_cast (symbol2)) { + /* Thunks can not call across section boundary. */ + if (cn->thunk.thunk_p) + newgroup = propagate_comdat_group (symbol2, newgroup, map); + /* If we see inline clone, its comdat group actually + corresponds to the comdat group of the function it + is inlined to. */ if (cn->global.inlined_to) symbol2 = cn->global.inlined_to; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c926f3d32ea..f3b61e56040 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-04-08 Ilya Enkovich + + * gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New. + 2015-04-08 Ilya Enkovich * gcc/testsuite/gcc.target/i386/thunk-retbnd.c: New. diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c new file mode 100644 index 00000000000..dd0057e2981 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O -fvisibility=hidden" } */ + +int val; + +static int __attribute__((noinline)) +test1 () +{ + return val; +} + +static int __attribute__((bnd_legacy,noinline)) +test2 () +{ + return test1 (); +} + +int +test3 (void) +{ + return test2 (); +} + -- 2.30.2