Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Andreas Schwab
Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

xgcc: error: unrecognized command line option '-mmpx'

FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx 

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Ilya Enkovich
2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

What is the target?

Ilya


 Andreas.

 --
 Andreas Schwab, SUSE Labs, sch...@suse.de
 GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
 And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Andreas Schwab
Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

 What is the target?

Pick any.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Ilya Enkovich
2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

 What is the target?

 Pick any.

Here it is.

./gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=./gcc/xgcc
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++,fortran
--disable-bootstrap
Thread model: posix
gcc version 5.0.0 20141210 (experimental) (GCC)
make check RUNTESTFLAGS=--target_board='unix{-m32,}' lto.exp=chkp-privatize*
...

=== gcc Summary ===

# of expected passes6
...
grep PASS ./gcc/testsuite/gcc/gcc.log
PASS: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,
-fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
PASS: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_1.o assemble,
-fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
PASS: gcc.dg/lto/chkp-privatize
c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o link,  -fPIC -flto
-flto-partition=max -fcheck-pointer-bounds -mmpx
PASS: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,
-fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
PASS: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_1.o assemble,
-fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
PASS: gcc.dg/lto/chkp-privatize
c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o link,  -fPIC -flto
-flto-partition=max -fcheck-pointer-bounds -mmpx
grep FAIL ./gcc/testsuite/gcc/gcc.log

Ilya


 Andreas.

 --
 Andreas Schwab, SUSE Labs, sch...@suse.de
 GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
 And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Andreas Schwab
Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

 What is the target?

 Pick any.

 Here it is.

Try again.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Ilya Enkovich
2014-12-10 19:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

 What is the target?

 Pick any.

 Here it is.

 Try again.

Same result.  And see no errors for this test in gcc-regression.

Ilya


 Andreas.

 --
 Andreas Schwab, SUSE Labs, sch...@suse.de
 GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
 And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Andreas Schwab
Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 19:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

 2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
 Ilya Enkovich enkovich@gmail.com writes:

   * gcc.dg/lto/lto.exp: Load mpx-dg.exp.
   * gcc.dg/lto/chkp-privatize_0.c: New.
   * gcc.dg/lto/chkp-privatize_1.c: New.

 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  
 -fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx

 What is the target?

 Pick any.

 Here it is.

 Try again.

 Same result.  And see no errors for this test in gcc-regression.

Try again.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
And now for something completely different.


Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread James Greenhalgh
On Wed, Dec 10, 2014 at 05:13:22PM +, Andreas Schwab wrote:
 Ilya Enkovich enkovich@gmail.com writes:
 
  2014-12-10 19:49 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
  2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
  2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
* gcc.dg/lto/lto.exp: Load mpx-dg.exp.
* gcc.dg/lto/chkp-privatize_0.c: New.
* gcc.dg/lto/chkp-privatize_1.c: New.
 
  xgcc: error: unrecognized command line option '-mmpx'
 
  FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  
  -fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
 
  What is the target?
 
  Pick any.
 
  Here it is.
 
  Try again.
 
  Same result.  And see no errors for this test in gcc-regression.
 
 Try again.

In the interests of breaking us out of this loop...

At least: {arm-none-linux-gnueabihf, arm-none-eabi,
aarch64-none-linux-gnueabi, aarch64-none-elf, aarch64_be-none-elf}
fail for me.

Cheers,
James



Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Ilya Enkovich
2014-12-10 21:07 GMT+03:00 James Greenhalgh james.greenha...@arm.com:
 On Wed, Dec 10, 2014 at 05:13:22PM +, Andreas Schwab wrote:
 Ilya Enkovich enkovich@gmail.com writes:

  2014-12-10 19:49 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
  2014-12-10 18:53 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
  2014-12-10 17:49 GMT+03:00 Andreas Schwab sch...@suse.de:
  Ilya Enkovich enkovich@gmail.com writes:
 
* gcc.dg/lto/lto.exp: Load mpx-dg.exp.
* gcc.dg/lto/chkp-privatize_0.c: New.
* gcc.dg/lto/chkp-privatize_1.c: New.
 
  xgcc: error: unrecognized command line option '-mmpx'
 
  FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  
  -fPIC -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
 
  What is the target?
 
  Pick any.
 
  Here it is.
 
  Try again.
 
  Same result.  And see no errors for this test in gcc-regression.

 Try again.

 In the interests of breaking us out of this loop...

 At least: {arm-none-linux-gnueabihf, arm-none-eabi,
 aarch64-none-linux-gnueabi, aarch64-none-elf, aarch64_be-none-elf}
 fail for me.

Hello James,

Could you please attach a gcc.log file for one of your runs?

Thanks,
Ilya


 Cheers,
 James



Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread James Greenhalgh
On Wed, Dec 10, 2014 at 06:19:08PM +, Ilya Enkovich wrote:
 2014-12-10 21:07 GMT+03:00 James Greenhalgh james.greenha...@arm.com:
  In the interests of breaking us out of this loop...
 
  At least: {arm-none-linux-gnueabihf, arm-none-eabi,
  aarch64-none-linux-gnueabi, aarch64-none-elf, 
  aarch64_be-none-elf}
  fail for me.
 
 Hello James,
 
 Could you please attach a gcc.log file for one of your runs?

Sure, see below.

However, the problem is your dg-require-effective-target line for the test.

From the documentation:

{ dg-require-effective-target keyword [{ selector }] }
Skip the test if the test target, including current multilib flags, is not
covered by the effective-target keyword. If the directive includes the
optional ‘{ selector }’ then the effective-target test is only performed if
the target system matches the selector. 

So what you've written is really the opposite of what you meant :)

i.e.

/* { dg-require-effective-target mpx { target { i?86-*-* x86_64-*-* } } } */

Should look more like:

/* { dg-require-effective-target mpx } */

Which gets me the UNSUPPORTED I expect to see for this test.

Cheers,
James

---
Executing on host: /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
-B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/  
-fno-diagnostics-show-caret -fdiagnostics-color=never   -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx   -c -specs=aem-ve.specs
-mcmodel=small  -o c_lto_chkp-privatize_0.o 
/work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c(timeout 
= 300)
spawn /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
-B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/ 
-fno-diagnostics-show-caret -fdiagnostics-color=never -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx -c -specs=aem-ve.specs 
-mcmodel=small -o c_lto_chkp-privatize_0.o 
/work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
xgcc: error: unrecognized command line option '-mmpx'
compiler exited with status 1
output is:
xgcc: error: unrecognized command line option '-mmpx'

FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx 
Executing on host: /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
-B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/  
-fno-diagnostics-show-caret -fdiagnostics-color=never   -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx   -c -specs=aem-ve.specs
-mcmodel=small  -o c_lto_chkp-privatize_1.o 
/work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c(timeout 
= 300)
spawn /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
-B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/ 
-fno-diagnostics-show-caret -fdiagnostics-color=never -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx -c -specs=aem-ve.specs 
-mcmodel=small -o c_lto_chkp-privatize_1.o 
/work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c
xgcc: error: unrecognized command line option '-mmpx'
compiler exited with status 1
output is:
xgcc: error: unrecognized command line option '-mmpx'

FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_1.o assemble,  -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx 
UNRESOLVED: gcc.dg/lto/chkp-privatize 
c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o link  -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx 
UNRESOLVED: gcc.dg/lto/chkp-privatize 
c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o execute  -fPIC -flto 
-flto-partition=max -fcheck-pointer-bounds -mmpx 





Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-10 Thread Ilya Enkovich
2014-12-10 21:29 GMT+03:00 James Greenhalgh james.greenha...@arm.com:
 On Wed, Dec 10, 2014 at 06:19:08PM +, Ilya Enkovich wrote:
 2014-12-10 21:07 GMT+03:00 James Greenhalgh james.greenha...@arm.com:
  In the interests of breaking us out of this loop...
 
  At least: {arm-none-linux-gnueabihf, arm-none-eabi,
  aarch64-none-linux-gnueabi, aarch64-none-elf, 
  aarch64_be-none-elf}
  fail for me.

 Hello James,

 Could you please attach a gcc.log file for one of your runs?

 Sure, see below.

 However, the problem is your dg-require-effective-target line for the test.

 From the documentation:

 { dg-require-effective-target keyword [{ selector }] }
 Skip the test if the test target, including current multilib flags, is not
 covered by the effective-target keyword. If the directive includes the
 optional ‘{ selector }’ then the effective-target test is only performed 
 if
 the target system matches the selector.

 So what you've written is really the opposite of what you meant :)

Yep, you are right!  I wanted to have this target selector in
dg-lto-do, but it doesn't support selectors and thus I moved it
assuming effect would be the same.  Thanks a lot for help!

Committed as obvious:

2014-12-10  Ilya Enkovich  ilya.enkov...@intel.com

* gcc.dg/lto/chkp-privatize_0.c: Remove unneeded selector
from target check.

diff --git a/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
b/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
index 4c899e8..ad9fdaa 100644
--- a/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
+++ b/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-require-effective-target mpx { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target mpx } */
 /* { dg-lto-options { { -fPIC -flto -flto-partition=max
-fcheck-pointer-bounds -mmpx } } } */

 static int


Thanks,
Ilya


 i.e.

 /* { dg-require-effective-target mpx { target { i?86-*-* x86_64-*-* } } } */

 Should look more like:

 /* { dg-require-effective-target mpx } */

 Which gets me the UNSUPPORTED I expect to see for this test.

 Cheers,
 James

 ---
 Executing on host: /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
 -B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/  
 -fno-diagnostics-show-caret -fdiagnostics-color=never   -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx   -c -specs=aem-ve.specs
 -mcmodel=small  -o c_lto_chkp-privatize_0.o 
 /work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
 (timeout = 300)
 spawn /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
 -B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/ 
 -fno-diagnostics-show-caret -fdiagnostics-color=never -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx -c -specs=aem-ve.specs 
 -mcmodel=small -o c_lto_chkp-privatize_0.o 
 /work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
 xgcc: error: unrecognized command line option '-mmpx'
 compiler exited with status 1
 output is:
 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_0.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
 Executing on host: /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
 -B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/  
 -fno-diagnostics-show-caret -fdiagnostics-color=never   -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx   -c -specs=aem-ve.specs
 -mcmodel=small  -o c_lto_chkp-privatize_1.o 
 /work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c
 (timeout = 300)
 spawn /work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/xgcc 
 -B/work/gcc-clean/build-aarch64-none-elf/obj/gcc2/gcc/ 
 -fno-diagnostics-show-caret -fdiagnostics-color=never -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx -c -specs=aem-ve.specs 
 -mcmodel=small -o c_lto_chkp-privatize_1.o 
 /work/gcc-clean/src/gcc/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c
 xgcc: error: unrecognized command line option '-mmpx'
 compiler exited with status 1
 output is:
 xgcc: error: unrecognized command line option '-mmpx'

 FAIL: gcc.dg/lto/chkp-privatize c_lto_chkp-privatize_1.o assemble,  -fPIC 
 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx
 UNRESOLVED: gcc.dg/lto/chkp-privatize 
 c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o link  -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx
 UNRESOLVED: gcc.dg/lto/chkp-privatize 
 c_lto_chkp-privatize_0.o-c_lto_chkp-privatize_1.o execute  -fPIC -flto 
 -flto-partition=max -fcheck-pointer-bounds -mmpx





Re: [PATCH, CHKP] Fix instrumentation clones privatization

2014-12-08 Thread Jeff Law

On 12/02/14 07:18, Ilya Enkovich wrote:

Hi,

Currently symbol names privatization doesn't work for instrumentation clones 
because clones assembler name is transparent alias and therefore alias target 
should be privatized instead.  This patch does it.  Bootstrapped and tested on 
x86_64-unknown-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2014-12-02  Ilya Enkovich  ilya.enkov...@intel.com

* lto/lto-partition.c (privatize_symbol_name): Correctly
privatize instrumentation clones.

gcc/testsuite/

2014-12-02  Ilya Enkovich  ilya.enkov...@intel.com

* gcc.dg/lto/lto.exp: Load mpx-dg.exp.
* gcc.dg/lto/chkp-privatize_0.c: New.
* gcc.dg/lto/chkp-privatize_1.c: New.

OK.
jeff



[PATCH, CHKP] Fix instrumentation clones privatization

2014-12-02 Thread Ilya Enkovich
Hi,

Currently symbol names privatization doesn't work for instrumentation clones 
because clones assembler name is transparent alias and therefore alias target 
should be privatized instead.  This patch does it.  Bootstrapped and tested on 
x86_64-unknown-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2014-12-02  Ilya Enkovich  ilya.enkov...@intel.com

* lto/lto-partition.c (privatize_symbol_name): Correctly
privatize instrumentation clones.

gcc/testsuite/

2014-12-02  Ilya Enkovich  ilya.enkov...@intel.com

* gcc.dg/lto/lto.exp: Load mpx-dg.exp.
* gcc.dg/lto/chkp-privatize_0.c: New.
* gcc.dg/lto/chkp-privatize_1.c: New.


diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 65f0582..809a493 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -787,8 +787,16 @@ static bool
 privatize_symbol_name (symtab_node *node)
 {
   tree decl = node-decl;
-  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  cgraph_node *cnode;
+  cgraph_node *cnode = dyn_cast cgraph_node * (node);
+  const char *name;
+
+  /* If we want to privatize instrumentation clone
+ then we need to change original function name
+ which is used via transparent alias chain.  */
+  if (cnode  cnode-instrumentation_clone)
+decl = cnode-orig_decl;
+
+  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
 
   /* Our renaming machinery do not handle more than one change of assembler 
name.
  We should not need more than one anyway.  */
@@ -821,15 +829,20 @@ privatize_symbol_name (symtab_node *node)
 (DECL_ASSEMBLER_NAME (decl)));
   /* We could change name which is a target of transparent alias
  chain of instrumented function name.  Fix alias chain if so  .*/
-  if ((cnode = dyn_cast cgraph_node * (node))
-   !cnode-instrumentation_clone
-   cnode-instrumented_version
-   cnode-instrumented_version-orig_decl == decl)
+  if (cnode)
 {
-  tree iname = DECL_ASSEMBLER_NAME (cnode-instrumented_version-decl);
-
-  gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname));
-  TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl);
+  tree iname = NULL_TREE;
+  if (cnode-instrumentation_clone)
+   iname = DECL_ASSEMBLER_NAME (cnode-decl);
+  else if (cnode-instrumented_version
+   cnode-instrumented_version-orig_decl == decl)
+   iname = DECL_ASSEMBLER_NAME (cnode-instrumented_version-decl);
+
+  if (iname)
+   {
+ gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname));
+ TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl);
+   }
 }
   if (symtab-dump_file)
 fprintf (symtab-dump_file,
diff --git a/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c 
b/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
new file mode 100644
index 000..4c899e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/chkp-privatize_0.c
@@ -0,0 +1,18 @@
+/* { dg-lto-do link } */
+/* { dg-require-effective-target mpx { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-lto-options { { -fPIC -flto -flto-partition=max -fcheck-pointer-bounds 
-mmpx } } } */
+
+static int
+__attribute__ ((noinline))
+func1 (int i)
+{
+  return i + 2;
+}
+
+extern int func2 (int i);
+
+int
+main (int argc, char **argv)
+{
+  return func1 (argc) + func2 (argc) + 1;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c 
b/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c
new file mode 100644
index 000..db39e7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/chkp-privatize_1.c
@@ -0,0 +1,8 @@
+int func1 = 10;
+
+int
+func2 (int i)
+{
+  func1++;
+  return i + func1;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/lto.exp b/gcc/testsuite/gcc.dg/lto/lto.exp
index 2586297..797c02f 100644
--- a/gcc/testsuite/gcc.dg/lto/lto.exp
+++ b/gcc/testsuite/gcc.dg/lto/lto.exp
@@ -30,6 +30,7 @@ if $tracelevel then {
 # Load procedures from common libraries. 
 load_lib standard.exp
 load_lib gcc.exp
+load_lib mpx-dg.exp
 
 # Load the language-independent compabibility support procedures.
 load_lib lto.exp